nish-ui 1.6.0 → 1.8.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/files.json CHANGED
@@ -6,6 +6,9 @@
6
6
  "theme.js",
7
7
  "theme.global.js",
8
8
  "elements.js",
9
+ "elements-forms.js",
10
+ "elements-data.js",
11
+ "elements-charts.js",
9
12
  "fonts/inter-latin-wght-normal.3100e775.woff2",
10
13
  "fonts/inter-latin-ext-wght-normal.34b9c504.woff2"
11
14
  ]
package/dist/index.d.ts CHANGED
@@ -1360,6 +1360,10 @@ interface AppHeaderProps {
1360
1360
  name: ReactNode;
1361
1361
  /** An icon before the name, drawn in the accent color. */
1362
1362
  icon?: ReactNode;
1363
+ /** Replaces the icon and name, and their home link, with your own node (a profile
1364
+ * switcher, a wordmark with a subtitle). It is not wrapped in a link; `name` stays for
1365
+ * screen readers. */
1366
+ brand?: ReactNode;
1363
1367
  /** Where the "← nish.software" pill goes. Default https://nish.software. */
1364
1368
  hubHref?: string;
1365
1369
  /** Buttons before the theme toggle. */
@@ -1394,7 +1398,7 @@ interface AppHeaderProps {
1394
1398
  /** The shared app header: the hub pill, the wordmark, actions and the theme toggle,
1395
1399
  * with an optional nav row. Opaque by default (glass is opt-in), safe-area aware. A
1396
1400
  * sticky header publishes its height as `--nish-header-h` for the rest of the layout. */
1397
- declare function AppHeader({ name, icon, hubHref, actions, nav, themeToggle, sticky, innerClassName, homeHref, hideNameBelow, navLabel, compactPill, glass, overflowActions, className, }: AppHeaderProps): react.JSX.Element;
1401
+ declare function AppHeader({ name, icon, brand, hubHref, actions, nav, themeToggle, sticky, innerClassName, homeHref, hideNameBelow, navLabel, compactPill, glass, overflowActions, className, }: AppHeaderProps): react.JSX.Element;
1398
1402
  interface SectionHeaderProps {
1399
1403
  /** The section's title. */
1400
1404
  title: ReactNode;
@@ -1785,11 +1789,7 @@ interface ScrollRowProps {
1785
1789
  /** A single horizontally scrolling row (chips, filters, tabs) with edge fades and no
1786
1790
  * scrollbar. The pressed, selected or current child is scrolled into view when it
1787
1791
  * changes. */
1788
- declare function ScrollRow({ children, bleed, fade, snap, as, label, className }: ScrollRowProps): react.DetailedReactHTMLElement<{
1789
- ref: react.RefObject<HTMLElement | null>;
1790
- 'aria-label': string | undefined;
1791
- className: string;
1792
- }, HTMLElement>;
1792
+ declare function ScrollRow({ children, bleed, fade, snap, as, label, className }: ScrollRowProps): react.JSX.Element;
1793
1793
  /** The id of the section crossing the middle band of the viewport: the last one that
1794
1794
  * entered it. At the very top of the page, or before any section has been seen, it is
1795
1795
  * the first id. Sections are looked up with `document.getElementById`.
@@ -2742,15 +2742,34 @@ interface InboxProps {
2742
2742
  * and reports what was picked. Rows wrap at phone widths and the actions collapse into one menu under 480px. */
2743
2743
  declare function Inbox({ items, view, onViewChange, counts, sources, source, onSourceChange, onHandle, onUnhandle, onSnooze, onUnsnooze, onHandleAll, onAction, loading, error, onRetry, hasMore, onLoadMore, loadingMore, selectedId, sourceLabels, className, }: InboxProps): react.JSX.Element;
2744
2744
 
2745
+ interface AppShellSidebar {
2746
+ /** Controlled collapsed state; pair it with onCollapsedChange. */
2747
+ collapsed?: boolean;
2748
+ /** Collapsed state on first load when uncontrolled. Default false. */
2749
+ defaultCollapsed?: boolean;
2750
+ onCollapsedChange?: (collapsed: boolean) => void;
2751
+ /** localStorage key that remembers the uncontrolled state across visits. Default
2752
+ * "nish-sidebar-collapsed"; false keeps it in memory only. */
2753
+ storageKey?: string | false;
2754
+ /** Buttons above the nav (search, an assistant). Give them labels: collapsed, they stack as
2755
+ * icons. Below 1024px, where there is no sidebar, they show in the header before `actions`. */
2756
+ tools?: ReactNode;
2757
+ /** Next to the collapse button at the bottom. Sidebar only: put anything people need on a
2758
+ * phone in `actions` or `moreItems` too. */
2759
+ footer?: ReactNode;
2760
+ }
2745
2761
  interface AppShellProps {
2746
2762
  /** App name (wordmark) and icon for the header. */
2747
2763
  name: ReactNode;
2748
2764
  icon?: ReactNode;
2765
+ /** Replaces the header's icon and name, and their home link, with your own node (a
2766
+ * profile switcher, a wordmark with a subtitle). It is not wrapped in a link. */
2767
+ brand?: ReactNode;
2749
2768
  /** Home link on the icon and name. Default "/". */
2750
2769
  homeHref?: string;
2751
2770
  hubHref?: string;
2752
- /** Every destination, in order. All show in the rail and the desktop header nav; the BottomNav shows the first `primary` and puts the rest in a MoreSheet. */
2753
- nav: NavItem[];
2771
+ /** Every destination, in order. All show in the rail and the desktop header nav (or the sidebar); the BottomNav shows the first `primary` and puts the rest in a MoreSheet. Empty or left out, the shell has no nav at all (no tabs, rail, sidebar, BottomNav or sheet): the signed-out frame. */
2772
+ nav?: NavItem[];
2754
2773
  /** How many items the BottomNav shows before "More". Default 4; when nav.length <= 5 all fit and there is no More. */
2755
2774
  primary?: number;
2756
2775
  /** Extra MoreSheet-only items (settings, sign out) shown after the overflow nav items. From md up they sit in a "More" menu in the header. Give them `onSelect`: the menu runs it, and only follows `href` (a full page load) when there is no `onSelect`. */
@@ -2766,6 +2785,12 @@ interface AppShellProps {
2766
2785
  loading?: boolean;
2767
2786
  /** Passed to ConnectionBanner; false hides the banner. Default {} (browser online state only). */
2768
2787
  connection?: ConnectionBannerProps | false;
2788
+ /** App banners (a live alert, a maintenance notice) under the ConnectionBanner, in one
2789
+ * sticky stack under the header. Its height is published as --nish-banners-h. */
2790
+ banner?: ReactNode;
2791
+ /** From 1024px, show the nav as a left sidebar that collapses to icons, instead of header
2792
+ * tabs. true for the defaults; the collapsed state is remembered in localStorage. */
2793
+ sidebar?: boolean | AppShellSidebar;
2769
2794
  /** PageContainer size, or false to render children with no container (full-bleed pages). Default 'default'. */
2770
2795
  container?: PageContainerProps['size'] | false;
2771
2796
  /** Toaster props, or false when the app renders its own. Default {}. */
@@ -2780,9 +2805,10 @@ interface AppShellProps {
2780
2805
  * The app frame: skip link, header with desktop tabs, loading bar, connection banner, the
2781
2806
  * NavRail (768 to 1023px), the BottomNav with a More sheet (under 768px), the page
2782
2807
  * container, an error boundary and the Toaster, all from one `nav` list.
2783
- * Under 768px the BottomNav shows, from 768px the rail, from 1024px tabs in the header.
2808
+ * Under 768px the BottomNav shows, from 768px the rail, from 1024px tabs in the header (or
2809
+ * the sidebar). With no nav it is the signed-out frame: header, banners and page only.
2784
2810
  */
2785
- declare function AppShell({ name, icon, homeHref, hubHref, nav, primary, moreItems, renderLink, actions, themeToggle, railFooter, loading, connection, container, toaster, errorBoundary, resetKey, children, }: AppShellProps): react.JSX.Element;
2811
+ declare function AppShell({ name, icon, brand, homeHref, hubHref, nav, primary, moreItems, renderLink, actions, themeToggle, railFooter, loading, connection, banner, sidebar, container, toaster, errorBoundary, resetKey, children, }: AppShellProps): react.JSX.Element;
2786
2812
 
2787
2813
  declare class ApiError extends Error {
2788
2814
  /** HTTP status; 0 = network failure or abort-by-timeout. */
@@ -2801,7 +2827,7 @@ declare class ApiError extends Error {
2801
2827
  interface ApiFetchOptions extends Omit<RequestInit, 'body'> {
2802
2828
  /** Serialized as JSON with content-type application/json. A string/FormData/Blob is sent as is. */
2803
2829
  body?: unknown;
2804
- /** Aborts and throws ApiError(status 0, message "Request timed out") after this many ms (covers the body read too). Default 15000. */
2830
+ /** Aborts and throws ApiError(status 0, message "The server took too long to answer.") after this many ms (covers the body read too). Default 15000. */
2805
2831
  timeoutMs?: number;
2806
2832
  /** Resolve null instead of throwing on 404. */
2807
2833
  nullOn404?: boolean;
@@ -2941,12 +2967,15 @@ type UrlStateShape = Record<string, string | string[] | number | boolean>;
2941
2967
  /**
2942
2968
  * Typed URL query state. Values equal to the default are left out of the URL, other keys in
2943
2969
  * the URL are kept. Strings, numbers, booleans (written as 1/0) and string arrays (repeated
2944
- * keys) are supported; the type of each default decides how its key is parsed.
2945
- * `prefix: 'j'` stores `q` as `j.q`. Returns [state, patch, reset].
2970
+ * keys, so a value may contain a comma) are supported; the type of each default decides how
2971
+ * its key is parsed. `prefix: 'j'` stores `q` as `j.q`. `comma: true` (or a list of keys)
2972
+ * also reads a single `?k=a,b` as ['a', 'b'], for links written before repeated keys.
2973
+ * Returns [state, patch, reset].
2946
2974
  */
2947
2975
  declare function useUrlState<S extends UrlStateShape>(defaults: S, o?: {
2948
2976
  adapter?: UrlStateAdapter;
2949
2977
  prefix?: string;
2978
+ comma?: boolean | readonly (keyof S & string)[];
2950
2979
  }): [S, (patch: Partial<S> | ((prev: S) => Partial<S>)) => void, () => void];
2951
2980
 
2952
2981
  interface SettingsSectionProps {
@@ -2955,11 +2984,14 @@ interface SettingsSectionProps {
2955
2984
  id?: string;
2956
2985
  /** Right side of the heading (a Reset button). */
2957
2986
  actions?: ReactNode;
2987
+ /** The dense form for modals, sheets and side panels: a small heading and the rows
2988
+ * divided by lines with no Card around them. Its SettingRows are compact too. */
2989
+ compact?: boolean;
2958
2990
  children: ReactNode;
2959
2991
  className?: string;
2960
2992
  }
2961
2993
  /** A titled group of setting rows in one unpadded Card, rows divided by a line. */
2962
- declare function SettingsSection({ title, description, id, actions, children, className }: SettingsSectionProps): react.JSX.Element;
2994
+ declare function SettingsSection({ title, description, id, actions, compact, children, className }: SettingsSectionProps): react.JSX.Element;
2963
2995
  interface SettingRowProps {
2964
2996
  label: ReactNode;
2965
2997
  description?: ReactNode;
@@ -2971,13 +3003,16 @@ interface SettingRowProps {
2971
3003
  stacked?: boolean;
2972
3004
  /** Keep the control at the end of the label row at every width (Switch, Checkbox). */
2973
3005
  inline?: boolean;
3006
+ /** Tighter row (44px tall, no side padding, label beside the control at every width).
3007
+ * Default: on inside a compact SettingsSection. */
3008
+ compact?: boolean;
2974
3009
  /** A muted status after the control: "Saved", "Saving…", or an error (tone="error" → text-th-loss). */
2975
3010
  status?: ReactNode;
2976
3011
  statusTone?: 'muted' | 'error' | 'ok';
2977
3012
  className?: string;
2978
3013
  }
2979
3014
  /** One label + control row inside a SettingsSection. */
2980
- declare function SettingRow({ label, description, children, htmlFor, stacked, inline, status, statusTone, className, }: SettingRowProps): react.JSX.Element;
3015
+ declare function SettingRow({ label, description, children, htmlFor, stacked, inline, compact: compactProp, status, statusTone, className, }: SettingRowProps): react.JSX.Element;
2981
3016
  type SaveStatus = 'idle' | 'saving' | 'saved' | 'error';
2982
3017
  /** Tracks one save: run(promise) → 'saving' → 'saved' for 1500ms (or 'error' for 3000ms, with the message) → 'idle'.
2983
3018
  * `label` is the text for SettingRow.status: "Saving…", "Saved", the error message, or null. Rethrows nothing. */
@@ -3342,4 +3377,4 @@ interface MediaChipProps {
3342
3377
  declare function MediaChip({ thumbnailUrl, label, onClick, action, className }: MediaChipProps): react.JSX.Element;
3343
3378
 
3344
3379
  export { ActivityFeed, AgentNode, AnimatedList, ApiError, AppErrorBoundary, AppHeader, AppShell, AsyncPanel, BREAKPOINTS, Badge, BarChart, BellIcon, BottomNav, Button, COLOR_ROLES, Callout, Card, CardHeader, CardListSkeleton, ChartLegend, CheckIcon, Checkbox, Chip, ChipGroup, ClockIcon, Combobox, CommandPalette, ConfirmDialog, ConnectionBanner, CopyButton, DEFAULT_THEME, Disclosure, Drawer, DropdownMenu, EmptyState, ErrorState, Favicon, Field, FieldGroup, FilterBar, FilterSheet, FlowSteps, HUE_ROLES, INBOX_ACTION_HEADER, INBOX_ACTION_TIMEOUT_MS, INBOX_DEFAULT_SETTINGS, INBOX_SOURCE_LABELS, IconButton, Inbox, Input, Kbd, KeyValueList, Label, LayoutPresetIcon, LayoutPresetPicker, LineChart, LinkCard, ListRow, LoadingBar, MAX_PANES, MediaChip, MediaRow, MediaThumb, MenuItem, MenuLabel, MenuSeparator, MenuSubHeader, Meter, Modal, MoreIcon, MoreSheet, NARROW_BREAKPOINT, NARROW_MAX, NARROW_QUERY, NavRail, NumberField, PHONE_QUERY, PRESETS, PageContainer, PageHeader, Popover, RangeBar, RelativeTime, ResponsiveTable, SCALE, SHADOWS, SOFT_ROLES, ScrollRow, SearchInput, SectionHeader, SectionNav, Segmented, Select, ServiceTokensSection, SettingRow, SettingsIcon, SettingsSection, Skeleton, SkeletonCard, SkeletonLines, SkeletonRows, Sparkline, Spinner, SplitDividers, SplitStage, Stat, StatGrid, StatGridSkeleton, StatusDot, StepBar, StickyActionBar, StickyBar, Switch, THEMES, TOGGLE_ORDER, TabPanel, Table, TableWrap, Tabs, Td, Textarea, Th, ThemeToggle, TickerText, Toaster, Tooltip, Tr, WorkflowBoard, addSlot, apiFetch, applyTheme, badgeClass, buttonClass, cardClass, chipClass, cn, computeDividers, computeRects, configureApi, confirmDialog, copyText, countLeaves, cycleTheme, defaultPreset, dismissToast, equalize, fieldClass, getThemeChoice, iconButtonClass, initTheme, isThemeName, isValidLayout, linkClass, locationAdapter, menuItemClass, mountChecklist, mountHeightVar, mountScrollspy, mountStuck, mountThemeToggle, mountTooltips, narrowLayout, navigateFromLayer, onThemeChange, openSheet, presetOptions, presetsFor, readToken, registerThemes, removeSlot, resizeAt, resolveTheme, revealClass, schemeOf, setThemeChoice, showToast, signTone, swapSlots, tabClass, tableClass, toast, toneFor, useBreakpoint, useCommandHotkey, useDocumentTitle, useHeightVar, useLocalStorage, useMediaQuery, useNarrow, useNow, useOnline, usePhone, usePrefersReducedMotion, useResource, useSaveStatus, useScrollEdges, useScrollSpy, useServiceTokens, useStuck, useTheme, useToast, useUrlState };
3345
- export type { ActivityFeedProps, ActivityItem, AgentNodeProps, AgentNodeState, AnimatedListProps, ApiConfig, ApiFetchOptions, AppErrorBoundaryProps, AppHeaderProps, AppShellProps, AsyncPanelProps, BadgeClassOptions, BadgeHue, BadgeProps, BadgeTone, BarChartProps, BottomNavProps, Breakpoint, ButtonClassOptions, ButtonProps, ButtonSize, ButtonVariant, CalloutProps, CalloutTone, CanvasEdge, CanvasEdgeKind, CanvasGroup, CanvasHue, CanvasLayout, CanvasLayoutMode, CanvasNode, CanvasNodeKind, CardClassOptions, CardElement, CardHeaderProps, CardListSkeletonProps, CardPadding, CardProps, ChartLegendItem, ChartLegendProps, ChartLegendTone, ChartTone, CheckboxProps, ChipClassOptions, ChipGroupProps, ChipProps, Column, ComboboxOption, ComboboxProps, CommandItem, CommandPaletteProps, ConfirmDialogOptions, ConfirmDialogProps, ConnectionBannerProps, CopyButtonProps, DisclosureProps, Divider, DrawerProps, DropdownMenuProps, EmptyStateProps, ErrorStateProps, FaviconProps, FieldClassOptions, FieldGroupProps, FieldProps, FieldSize, FilterBarProps, FilterSheetProps, FlowStepItem, FlowStepStatus, FlowStepsProps, IconButtonClassOptions, IconButtonProps, IconButtonSize, IconButtonVariant, InboxAction, InboxActionCall, InboxActionResult, InboxItem, InboxListResponse, InboxProps, InboxSettings, InboxSeverity, InboxView, InputProps, KeyValueItem, KeyValueListProps, LayoutNode, LayoutOptions, LayoutPresetIconProps, LayoutPresetOption, LayoutPresetPickerProps, LineChartProps, LinePoint, LineSeries, LinkCardAccent, LinkCardProps, LinkClassOptions, ListRowProps, LoadingBarProps, MediaChipProps, MediaRowProps, MediaThumbProps, MediaThumbShape, MediaThumbSize, MenuItemClassOptions, MenuItemProps, MenuSubHeaderProps, MeterProps, MeterTone, ModalProps, MoreSheetProps, MountScrollspyOptions, MountThemeToggleOptions, NarrowLayout, NavItem, NavRailProps, NumberFieldProps, PageContainerProps, PageHeaderProps, PopoverCloseReason, PopoverProps, Preset, RangeBarProps, Rect, RelativeTimeProps, RenderLink, Resource, ResponsiveTableProps, RoutedEdge, SaveStatus, ScrollRowProps, SearchInputProps, SectionHeaderProps, SectionNavItem, SectionNavProps, SegmentedOption, SegmentedProps, SegmentedTone, SelectProps, ServiceTokenListResponse, ServiceTokenView, ServiceTokensSectionProps, SettingRowProps, SettingsSectionProps, ShowToastOptions, SkeletonCardProps, SkeletonRowsProps, Sort, SparklineProps, SparklineTone, SpinnerProps, SplitDividersProps, SplitStageProps, StatGridProps, StatGridSkeletonProps, StatProps, StaticToastTone, StatusDotProps, StatusTone, StepBarProps, StickyActionBarProps, StickyBarProps, SwitchProps, SystemCanvasProps, TabItem, TabPanelProps, TableProps, TableWrapProps, TabsBreakpoint, TabsProps, TabsSize, TdProps, TextareaProps, ThProps, ThemeChoice, ThemeName, ThemePreset, ThemeState, ThemeToggleLabels, ThemeToggleProps, TickerTextProps, ToastAction, ToastItem, ToastOptions, ToastTone, ToasterProps, TooltipProps, TrProps, UrlStateAdapter, UrlStateShape, UseResourceOptions, WorkflowBoardAgent, WorkflowBoardPhase, WorkflowBoardProps };
3380
+ export type { ActivityFeedProps, ActivityItem, AgentNodeProps, AgentNodeState, AnimatedListProps, ApiConfig, ApiFetchOptions, AppErrorBoundaryProps, AppHeaderProps, AppShellProps, AppShellSidebar, AsyncPanelProps, BadgeClassOptions, BadgeHue, BadgeProps, BadgeTone, BarChartProps, BottomNavProps, Breakpoint, ButtonClassOptions, ButtonProps, ButtonSize, ButtonVariant, CalloutProps, CalloutTone, CanvasEdge, CanvasEdgeKind, CanvasGroup, CanvasHue, CanvasLayout, CanvasLayoutMode, CanvasNode, CanvasNodeKind, CardClassOptions, CardElement, CardHeaderProps, CardListSkeletonProps, CardPadding, CardProps, ChartLegendItem, ChartLegendProps, ChartLegendTone, ChartTone, CheckboxProps, ChipClassOptions, ChipGroupProps, ChipProps, Column, ComboboxOption, ComboboxProps, CommandItem, CommandPaletteProps, ConfirmDialogOptions, ConfirmDialogProps, ConnectionBannerProps, CopyButtonProps, DisclosureProps, Divider, DrawerProps, DropdownMenuProps, EmptyStateProps, ErrorStateProps, FaviconProps, FieldClassOptions, FieldGroupProps, FieldProps, FieldSize, FilterBarProps, FilterSheetProps, FlowStepItem, FlowStepStatus, FlowStepsProps, IconButtonClassOptions, IconButtonProps, IconButtonSize, IconButtonVariant, InboxAction, InboxActionCall, InboxActionResult, InboxItem, InboxListResponse, InboxProps, InboxSettings, InboxSeverity, InboxView, InputProps, KeyValueItem, KeyValueListProps, LayoutNode, LayoutOptions, LayoutPresetIconProps, LayoutPresetOption, LayoutPresetPickerProps, LineChartProps, LinePoint, LineSeries, LinkCardAccent, LinkCardProps, LinkClassOptions, ListRowProps, LoadingBarProps, MediaChipProps, MediaRowProps, MediaThumbProps, MediaThumbShape, MediaThumbSize, MenuItemClassOptions, MenuItemProps, MenuSubHeaderProps, MeterProps, MeterTone, ModalProps, MoreSheetProps, MountScrollspyOptions, MountThemeToggleOptions, NarrowLayout, NavItem, NavRailProps, NumberFieldProps, PageContainerProps, PageHeaderProps, PopoverCloseReason, PopoverProps, Preset, RangeBarProps, Rect, RelativeTimeProps, RenderLink, Resource, ResponsiveTableProps, RoutedEdge, SaveStatus, ScrollRowProps, SearchInputProps, SectionHeaderProps, SectionNavItem, SectionNavProps, SegmentedOption, SegmentedProps, SegmentedTone, SelectProps, ServiceTokenListResponse, ServiceTokenView, ServiceTokensSectionProps, SettingRowProps, SettingsSectionProps, ShowToastOptions, SkeletonCardProps, SkeletonRowsProps, Sort, SparklineProps, SparklineTone, SpinnerProps, SplitDividersProps, SplitStageProps, StatGridProps, StatGridSkeletonProps, StatProps, StaticToastTone, StatusDotProps, StatusTone, StepBarProps, StickyActionBarProps, StickyBarProps, SwitchProps, SystemCanvasProps, TabItem, TabPanelProps, TableProps, TableWrapProps, TabsBreakpoint, TabsProps, TabsSize, TdProps, TextareaProps, ThProps, ThemeChoice, ThemeName, ThemePreset, ThemeState, ThemeToggleLabels, ThemeToggleProps, TickerTextProps, ToastAction, ToastItem, ToastOptions, ToastTone, ToasterProps, TooltipProps, TrProps, UrlStateAdapter, UrlStateShape, UseResourceOptions, WorkflowBoardAgent, WorkflowBoardPhase, WorkflowBoardProps };