@nordmanai/nif 0.2.11 → 0.2.12

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.
@@ -30,6 +30,8 @@ type SidebarContextValue = {
30
30
  setCollapsible: (mode: NmSidebarCollapsible) => void;
31
31
  };
32
32
  /** The sidebar's state: expanded or collapsed, peeking, on a desktop or a phone, and the function that toggles it. */
33
+ /** The sidebar context when there is one. For a part that lives in a bar shared by pages with and without a sidebar. */
34
+ export declare function useOptionalSidebar(): SidebarContextValue | null;
33
35
  export declare function useSidebar(): SidebarContextValue;
34
36
  export type NmSidebarProviderProps = ComponentProps<'div'> & {
35
37
  defaultOpen?: boolean;
@@ -73,7 +75,9 @@ export declare function NmSidebarRail({ className, label, ...props }: ComponentP
73
75
  label?: string;
74
76
  }): ReactNode;
75
77
  /** The main area beside the sidebar. With the inset variant it is the raised card. */
76
- export declare function NmSidebarInset({ className, ...props }: ComponentProps<'main'>): ReactNode;
78
+ export declare function NmSidebarInset({ className, render, ref, ...props }: ComponentProps<'main'> & {
79
+ render?: RenderProp;
80
+ }): ReactNode;
77
81
  /** A search field in the sidebar. The NIF Input. */
78
82
  export declare function NmSidebarInput({ className, ...props }: ComponentProps<typeof NmInput>): ReactNode;
79
83
  /** Sticky at the top: a brand, a title or a workspace switcher, and the toggle when the sidebar collapses to it. */
@@ -122,10 +126,12 @@ export declare function NmSidebarMenuSkeleton({ className, showIcon, ...props }:
122
126
  /** Rows under a row, indented by a line. */
123
127
  export declare function NmSidebarMenuSub({ className, ...props }: ComponentProps<'ul'>): ReactNode;
124
128
  export declare function NmSidebarMenuSubItem({ className, ...props }: ComponentProps<'li'>): ReactNode;
125
- export declare function NmSidebarMenuSubButton({ render, size, isActive, className, ref, ...props }: ComponentProps<'a'> & {
129
+ export declare function NmSidebarMenuSubButton({ render, size, isActive, disabled, className, ref, ...props }: ComponentProps<'a'> & {
126
130
  render?: RenderProp;
127
131
  size?: Exclude<NmSidebarButtonSize, 'lg'>;
128
132
  isActive?: boolean;
133
+ /** Not available. A link gets aria-disabled; a rendered button gets disabled. */
134
+ disabled?: boolean;
129
135
  }): ReactNode;
130
136
  /** A chevron at the end of a row. In a collapsible row it points right and turns down when the row is open. With `menu` it points down, for a row that opens a menu. */
131
137
  export declare function NmSidebarChevron({ className, menu, ...props }: Omit<ComponentProps<typeof NmIcon>, 'id'> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nordmanai/nif",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Nordman Interface Framework: the one UI and UX system for every Nordman product. Base UI, in the shadcn composition, styled by NIF tokens.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.11",
2
+ "version": "0.2.12",
3
3
  "versions": {
4
4
  "@animate-ui/react": "^2.4.2",
5
5
  "@base-ui/react": "^1.9.0",
@@ -80,7 +80,8 @@
80
80
  The column keeps its collapsed width in the flow, and the inner panel floats out over the page. */
81
81
  .nm-sidebar[data-peek] {
82
82
  overflow: visible;
83
- z-index: 1;
83
+ /* Over the main area and its top bar, under menus. */
84
+ z-index: var(--nm-rail-z);
84
85
  }
85
86
  .nm-sidebar[data-mode='offcanvas'][data-peek] {
86
87
  width: 0;
@@ -63,6 +63,10 @@ const SidebarContext = createContext<SidebarContextValue | null>(null);
63
63
  const PEEK_KEEPS = '[data-slot="sidebar"], [data-slot="sidebar-trigger"], [data-slot="tooltip-content"], [role="menu"], [role="dialog"]';
64
64
 
65
65
  /** The sidebar's state: expanded or collapsed, peeking, on a desktop or a phone, and the function that toggles it. */
66
+ /** The sidebar context when there is one. For a part that lives in a bar shared by pages with and without a sidebar. */
67
+ export function useOptionalSidebar(): SidebarContextValue | null {
68
+ return useContext(SidebarContext);
69
+ }
66
70
  export function useSidebar(): SidebarContextValue {
67
71
  const context = useContext(SidebarContext);
68
72
  if (!context) {
@@ -345,8 +349,13 @@ export function NmSidebarRail({ className, label = 'Toggle sidebar', ...props }:
345
349
  }
346
350
 
347
351
  /** The main area beside the sidebar. With the inset variant it is the raised card. */
348
- export function NmSidebarInset({ className, ...props }: ComponentProps<'main'>): ReactNode {
349
- return <main data-slot="sidebar-inset" className={nmClass('nm-sidebar__inset', className)} {...props} />;
352
+ export function NmSidebarInset({ className, render, ref, ...props }: ComponentProps<'main'> & { render?: RenderProp }): ReactNode {
353
+ return useRender({
354
+ render,
355
+ ref,
356
+ defaultTagName: 'main',
357
+ props: { 'data-slot': 'sidebar-inset', className: nmClass('nm-sidebar__inset', className), ...props },
358
+ });
350
359
  }
351
360
 
352
361
  /** A search field in the sidebar. The NIF Input. */
@@ -507,10 +516,17 @@ export function NmSidebarMenuSubButton({
507
516
  render,
508
517
  size = 'default',
509
518
  isActive = false,
519
+ disabled = false,
510
520
  className,
511
521
  ref,
512
522
  ...props
513
- }: ComponentProps<'a'> & { render?: RenderProp; size?: Exclude<NmSidebarButtonSize, 'lg'>; isActive?: boolean }): ReactNode {
523
+ }: ComponentProps<'a'> & {
524
+ render?: RenderProp;
525
+ size?: Exclude<NmSidebarButtonSize, 'lg'>;
526
+ isActive?: boolean;
527
+ /** Not available. A link gets aria-disabled; a rendered button gets disabled. */
528
+ disabled?: boolean;
529
+ }): ReactNode {
514
530
  return useRender({
515
531
  render,
516
532
  ref,
@@ -519,6 +535,9 @@ export function NmSidebarMenuSubButton({
519
535
  'data-slot': 'sidebar-menu-sub-button',
520
536
  'data-size': size,
521
537
  'data-active': isActive ? '' : undefined,
538
+ 'data-disabled': disabled ? '' : undefined,
539
+ 'aria-disabled': disabled ? true : undefined,
540
+ disabled: disabled ? true : undefined,
522
541
  'aria-current': isActive ? 'page' : undefined,
523
542
  className: nmClass('nm-sidebar__menu-sub-button', className),
524
543
  ...props,