@aginies/ui 0.1.0 → 0.2.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.d.cts CHANGED
@@ -1320,24 +1320,103 @@ export declare function Toolbar(props: ToolbarProps): JSX.Element;
1320
1320
  /** Vertical hairline between toolbar groups. */
1321
1321
  export declare function ToolbarSeparator(props: React.HTMLAttributes<HTMLSpanElement>): JSX.Element;
1322
1322
 
1323
- /** The console frame: optional GlobalHeader on top, VerticalNavigation on the left, a scrolling main area with the console gutter, optional SidePanel on the right. */
1323
+ /** The console frame: optional GlobalHeader on top, VerticalNavigation on the left, a scrolling main area with the console gutter, optional side panel on the right. It measures its own width: ≥ 1280 everything docked; 1024–1279 the sidebar on its 56px rail; < 1024 the sidebar is a drawer and the side panel a sheet from the right, both opened from a 48px page bar; < 768 the gutter is 16px. */
1324
1324
  export interface PageLayoutProps extends React.HTMLAttributes<HTMLDivElement> {
1325
1325
  /** A GlobalHeader (brand screens) — consoles usually omit it */
1326
1326
  header?: React.ReactNode;
1327
- /** A VerticalNavigation */
1327
+ /** A VerticalNavigation; it reads its state (docked, rail, drawer) from the PageLayout */
1328
1328
  navigation?: React.ReactNode;
1329
- /** A side panel: inspector, artifact, conversation */
1329
+ /** A side panel: inspector, artifact, conversation. A SidePanel passed without a mode is docked in the frame */
1330
1330
  sidePanel?: React.ReactNode;
1331
1331
  /** Defaults to --panel-w (288) */
1332
1332
  sidePanelWidth?: number | string;
1333
- /** Content max width (default --content-max 1440) */
1333
+ /** Content width preset: reading (--content-reading 960: settings, documents, wizards) · default (--content-max 1440) · wide (--content-wide 1920: dashboards that add columns) · full (no cap: tables and canvases) */
1334
+ width?: 'reading' | 'default' | 'wide' | 'full';
1335
+ /** Content max width; overrides width */
1334
1336
  maxWidth?: number | string;
1335
1337
  /** No gutter or max width, and the content fills the main area's height (canvas, split views) */
1336
1338
  flush?: boolean;
1339
+ /** Sidebar state: auto (default, from the measured width), or forced docked / rail / overlay */
1340
+ sidebarMode?: 'auto' | 'docked' | 'rail' | 'overlay';
1341
+ /** Side panel state: auto (default: docked ≥ 1024, overlay below), or forced docked / overlay */
1342
+ panelMode?: 'auto' | 'docked' | 'overlay';
1343
+ /** Overlay drawer open (controlled); uncontrolled it opens from the page bar */
1344
+ sidebarOpen?: boolean;
1345
+ onSidebarOpenChange?: (open: boolean) => void;
1346
+ /** Overlay sheet open (controlled); uncontrolled it opens from the page bar and when a side panel appears while the page is narrow */
1347
+ panelOpen?: boolean;
1348
+ onPanelOpenChange?: (open: boolean) => void;
1349
+ /** The 48px page bar shown while the sidebar or panel is an overlay: false hides it (open them through usePageLayout), a node replaces the mark in its middle */
1350
+ bar?: boolean | React.ReactNode;
1351
+ labels?: { openNav?: string; closeNav?: string; openPanel?: string; closePanel?: string; navigation?: string; details?: string };
1337
1352
  as?: any;
1338
1353
  }
1339
1354
  export declare function PageLayout(props: PageLayoutProps): JSX.Element;
1340
1355
 
1356
+ /** State of the enclosing PageLayout, for a page that needs to adapt (drop table columns, put the menu button in its own header). */
1357
+ export interface PageLayoutState {
1358
+ /** Breakpoint of the page's own width */
1359
+ bp: Breakpoint;
1360
+ sidebar: 'docked' | 'rail' | 'overlay' | null;
1361
+ panel: 'docked' | 'overlay' | null;
1362
+ railExpanded: boolean;
1363
+ setRailExpanded: (expanded: boolean) => void;
1364
+ sidebarOpen: boolean;
1365
+ openSidebar: () => void;
1366
+ closeSidebar: () => void;
1367
+ panelOpen: boolean;
1368
+ openPanel: () => void;
1369
+ closePanel: () => void;
1370
+ }
1371
+ /** The enclosing PageLayout's state; null outside one. */
1372
+ export declare function usePageLayout(): PageLayoutState | null;
1373
+ export declare const PageLayoutContext: React.Context<PageLayoutState | null>;
1374
+
1375
+ /** Breakpoint names: base < 640 ≤ sm < 768 ≤ md < 1024 ≤ lg < 1280 ≤ xl < 1536 ≤ 2xl (tokens bp-sm … bp-2xl). */
1376
+ export type Breakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
1377
+ /** A value per breakpoint, mobile first: each one holds until a larger breakpoint sets another. */
1378
+ export type Responsive<T> = T | Partial<Record<Breakpoint, T>>;
1379
+
1380
+ /** 12-column grid (--grid-columns, --grid-gap) laid out by its own width through a container query, so it responds to its pane, not the window. Dashboards, record bodies, card galleries. */
1381
+ export interface GridProps extends React.HTMLAttributes<HTMLElement> {
1382
+ /** Gallery mode: auto-fill columns at least this wide (number = px), e.g. 280 for cards. GridItem spans are ignored */
1383
+ min?: number | string;
1384
+ /** Column count (default --grid-columns, 12) */
1385
+ columns?: number;
1386
+ /** Gap: lg (default, --grid-gap 24), md 16, sm 12, none, or any length */
1387
+ gap?: 'none' | 'sm' | 'md' | 'lg' | number | string;
1388
+ /** Row gap when it differs from gap */
1389
+ rowGap?: 'none' | 'sm' | 'md' | 'lg' | number | string;
1390
+ /** Vertical alignment of items in a row (default stretch) */
1391
+ align?: 'start' | 'center' | 'end';
1392
+ /** Back-fills holes left by wide items */
1393
+ dense?: boolean;
1394
+ as?: any;
1395
+ }
1396
+ export declare function Grid(props: GridProps): JSX.Element;
1397
+ /** One cell of a Grid. */
1398
+ export interface GridItemProps extends React.HTMLAttributes<HTMLElement> {
1399
+ /** Columns to span: a number, 'full', or per breakpoint of the Grid's width ({ base: 12, lg: 6, xl: 4 }). Default 12 */
1400
+ span?: Responsive<number | 'full'>;
1401
+ /** Starting column line */
1402
+ start?: number;
1403
+ /** Rows to span */
1404
+ rowSpan?: number;
1405
+ as?: any;
1406
+ }
1407
+ export declare function GridItem(props: GridItemProps): JSX.Element;
1408
+
1409
+ /** Breakpoint values in px (= tokens): { sm: 640, md: 768, lg: 1024, xl: 1280, '2xl': 1536 }. */
1410
+ export declare const BREAKPOINTS: Record<Exclude<Breakpoint, 'base'>, number>;
1411
+ /** Name of the largest breakpoint a width reaches. */
1412
+ export declare function breakpointFor(width: number): Breakpoint;
1413
+ /** Width (px) of an element, kept current with a ResizeObserver; null until measured. */
1414
+ export declare function useElementWidth(ref: React.RefObject<Element>): number | null;
1415
+ /** Breakpoint of an element's own width; null until measured. Use it to drop low-priority table columns in a narrow pane. */
1416
+ export declare function useBreakpoint(ref: React.RefObject<Element>): Breakpoint | null;
1417
+ /** Drawer/sheet focus handling: focus moves into the container on open, Tab stays inside, Esc calls onClose, focus returns on close. */
1418
+ export declare function useOverlayFocus(ref: React.RefObject<HTMLElement>, open: boolean, onClose?: () => void): void;
1419
+
1341
1420
  /** The website's .room: a section that inverts the theme inside — sets data-theme opposite to its ancestor and paints --bg. */
1342
1421
  export interface RoomProps extends React.HTMLAttributes<HTMLElement> {
1343
1422
  /** Force a theme instead of inverting the ancestor's */
@@ -1412,7 +1491,9 @@ export interface VerticalNavigationProps extends Omit<React.HTMLAttributes<HTMLE
1412
1491
  /** Each new width while resizing; persist it and pass it back as width */
1413
1492
  onResize?: (width: number) => void;
1414
1493
  logoHref?: string;
1415
- labels?: { search?: string; collapse?: string; expand?: string; navigation?: string; resize?: string };
1494
+ /** Layout state. Omit it inside PageLayout, which sets it from its width: docked ≥ 1280, rail 1024–1279 (collapsed to 56px until the user expands it), overlay < 1024 (a drawer with a close button that closes when an item is chosen). Standalone default: docked */
1495
+ mode?: 'docked' | 'rail' | 'overlay';
1496
+ labels?: { search?: string; collapse?: string; expand?: string; navigation?: string; resize?: string; close?: string };
1416
1497
  }
1417
1498
  export declare function VerticalNavigation(props: VerticalNavigationProps): JSX.Element;
1418
1499
 
@@ -1511,7 +1592,15 @@ export interface SplitViewProps extends Omit<React.HTMLAttributes<HTMLDivElement
1511
1592
  resizable?: boolean;
1512
1593
  /** Shows a toggle that hides the list */
1513
1594
  collapsible?: boolean;
1514
- labels?: { resize?: string; empty?: string; collapse?: string; expand?: string };
1595
+ /** Width of the SplitView itself (a breakpoint name or px) below which list and detail stack: the list fills the pane and a picked record opens as a full pane with a back button. Default 'md' (768); false never stacks. Below 'lg' (1024) the list narrows to --panel-w */
1596
+ stackBelow?: 'sm' | 'md' | 'lg' | 'xl' | number | false;
1597
+ /** Pane shown first when stacked (default 'list') */
1598
+ defaultStackedView?: 'list' | 'detail';
1599
+ /** Called when the stacked pane changes */
1600
+ onStackedViewChange?: (view: 'list' | 'detail') => void;
1601
+ /** Called by the stacked detail's back button (after it returns to the list) */
1602
+ onBack?: () => void;
1603
+ labels?: { resize?: string; empty?: string; collapse?: string; expand?: string; back?: string };
1515
1604
  }
1516
1605
  export declare function SplitView(props: SplitViewProps): JSX.Element;
1517
1606
 
@@ -1994,7 +2083,10 @@ export interface SidePanelProps extends Omit<React.HTMLAttributes<HTMLElement>,
1994
2083
  size?: 'md' | 'lg';
1995
2084
  /** Any width (number = px), overriding size: a 600px trace inspector, "40vw" */
1996
2085
  width?: number | string;
2086
+ /** docked sits in the layout (inside PageLayout, a SidePanel with no mode is docked); overlay (default) is a modal sheet from the right: scrim, focus moved in and kept inside, Esc and scrim click call onClose, focus restored */
1997
2087
  mode?: 'overlay' | 'docked';
2088
+ /** Overlay only: the --overlay scrim behind the sheet (default true) */
2089
+ scrim?: boolean;
1998
2090
  children?: React.ReactNode;
1999
2091
  labels?: { close?: string };
2000
2092
  }
package/dist/index.d.ts CHANGED
@@ -1320,24 +1320,103 @@ export declare function Toolbar(props: ToolbarProps): JSX.Element;
1320
1320
  /** Vertical hairline between toolbar groups. */
1321
1321
  export declare function ToolbarSeparator(props: React.HTMLAttributes<HTMLSpanElement>): JSX.Element;
1322
1322
 
1323
- /** The console frame: optional GlobalHeader on top, VerticalNavigation on the left, a scrolling main area with the console gutter, optional SidePanel on the right. */
1323
+ /** The console frame: optional GlobalHeader on top, VerticalNavigation on the left, a scrolling main area with the console gutter, optional side panel on the right. It measures its own width: ≥ 1280 everything docked; 1024–1279 the sidebar on its 56px rail; < 1024 the sidebar is a drawer and the side panel a sheet from the right, both opened from a 48px page bar; < 768 the gutter is 16px. */
1324
1324
  export interface PageLayoutProps extends React.HTMLAttributes<HTMLDivElement> {
1325
1325
  /** A GlobalHeader (brand screens) — consoles usually omit it */
1326
1326
  header?: React.ReactNode;
1327
- /** A VerticalNavigation */
1327
+ /** A VerticalNavigation; it reads its state (docked, rail, drawer) from the PageLayout */
1328
1328
  navigation?: React.ReactNode;
1329
- /** A side panel: inspector, artifact, conversation */
1329
+ /** A side panel: inspector, artifact, conversation. A SidePanel passed without a mode is docked in the frame */
1330
1330
  sidePanel?: React.ReactNode;
1331
1331
  /** Defaults to --panel-w (288) */
1332
1332
  sidePanelWidth?: number | string;
1333
- /** Content max width (default --content-max 1440) */
1333
+ /** Content width preset: reading (--content-reading 960: settings, documents, wizards) · default (--content-max 1440) · wide (--content-wide 1920: dashboards that add columns) · full (no cap: tables and canvases) */
1334
+ width?: 'reading' | 'default' | 'wide' | 'full';
1335
+ /** Content max width; overrides width */
1334
1336
  maxWidth?: number | string;
1335
1337
  /** No gutter or max width, and the content fills the main area's height (canvas, split views) */
1336
1338
  flush?: boolean;
1339
+ /** Sidebar state: auto (default, from the measured width), or forced docked / rail / overlay */
1340
+ sidebarMode?: 'auto' | 'docked' | 'rail' | 'overlay';
1341
+ /** Side panel state: auto (default: docked ≥ 1024, overlay below), or forced docked / overlay */
1342
+ panelMode?: 'auto' | 'docked' | 'overlay';
1343
+ /** Overlay drawer open (controlled); uncontrolled it opens from the page bar */
1344
+ sidebarOpen?: boolean;
1345
+ onSidebarOpenChange?: (open: boolean) => void;
1346
+ /** Overlay sheet open (controlled); uncontrolled it opens from the page bar and when a side panel appears while the page is narrow */
1347
+ panelOpen?: boolean;
1348
+ onPanelOpenChange?: (open: boolean) => void;
1349
+ /** The 48px page bar shown while the sidebar or panel is an overlay: false hides it (open them through usePageLayout), a node replaces the mark in its middle */
1350
+ bar?: boolean | React.ReactNode;
1351
+ labels?: { openNav?: string; closeNav?: string; openPanel?: string; closePanel?: string; navigation?: string; details?: string };
1337
1352
  as?: any;
1338
1353
  }
1339
1354
  export declare function PageLayout(props: PageLayoutProps): JSX.Element;
1340
1355
 
1356
+ /** State of the enclosing PageLayout, for a page that needs to adapt (drop table columns, put the menu button in its own header). */
1357
+ export interface PageLayoutState {
1358
+ /** Breakpoint of the page's own width */
1359
+ bp: Breakpoint;
1360
+ sidebar: 'docked' | 'rail' | 'overlay' | null;
1361
+ panel: 'docked' | 'overlay' | null;
1362
+ railExpanded: boolean;
1363
+ setRailExpanded: (expanded: boolean) => void;
1364
+ sidebarOpen: boolean;
1365
+ openSidebar: () => void;
1366
+ closeSidebar: () => void;
1367
+ panelOpen: boolean;
1368
+ openPanel: () => void;
1369
+ closePanel: () => void;
1370
+ }
1371
+ /** The enclosing PageLayout's state; null outside one. */
1372
+ export declare function usePageLayout(): PageLayoutState | null;
1373
+ export declare const PageLayoutContext: React.Context<PageLayoutState | null>;
1374
+
1375
+ /** Breakpoint names: base < 640 ≤ sm < 768 ≤ md < 1024 ≤ lg < 1280 ≤ xl < 1536 ≤ 2xl (tokens bp-sm … bp-2xl). */
1376
+ export type Breakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
1377
+ /** A value per breakpoint, mobile first: each one holds until a larger breakpoint sets another. */
1378
+ export type Responsive<T> = T | Partial<Record<Breakpoint, T>>;
1379
+
1380
+ /** 12-column grid (--grid-columns, --grid-gap) laid out by its own width through a container query, so it responds to its pane, not the window. Dashboards, record bodies, card galleries. */
1381
+ export interface GridProps extends React.HTMLAttributes<HTMLElement> {
1382
+ /** Gallery mode: auto-fill columns at least this wide (number = px), e.g. 280 for cards. GridItem spans are ignored */
1383
+ min?: number | string;
1384
+ /** Column count (default --grid-columns, 12) */
1385
+ columns?: number;
1386
+ /** Gap: lg (default, --grid-gap 24), md 16, sm 12, none, or any length */
1387
+ gap?: 'none' | 'sm' | 'md' | 'lg' | number | string;
1388
+ /** Row gap when it differs from gap */
1389
+ rowGap?: 'none' | 'sm' | 'md' | 'lg' | number | string;
1390
+ /** Vertical alignment of items in a row (default stretch) */
1391
+ align?: 'start' | 'center' | 'end';
1392
+ /** Back-fills holes left by wide items */
1393
+ dense?: boolean;
1394
+ as?: any;
1395
+ }
1396
+ export declare function Grid(props: GridProps): JSX.Element;
1397
+ /** One cell of a Grid. */
1398
+ export interface GridItemProps extends React.HTMLAttributes<HTMLElement> {
1399
+ /** Columns to span: a number, 'full', or per breakpoint of the Grid's width ({ base: 12, lg: 6, xl: 4 }). Default 12 */
1400
+ span?: Responsive<number | 'full'>;
1401
+ /** Starting column line */
1402
+ start?: number;
1403
+ /** Rows to span */
1404
+ rowSpan?: number;
1405
+ as?: any;
1406
+ }
1407
+ export declare function GridItem(props: GridItemProps): JSX.Element;
1408
+
1409
+ /** Breakpoint values in px (= tokens): { sm: 640, md: 768, lg: 1024, xl: 1280, '2xl': 1536 }. */
1410
+ export declare const BREAKPOINTS: Record<Exclude<Breakpoint, 'base'>, number>;
1411
+ /** Name of the largest breakpoint a width reaches. */
1412
+ export declare function breakpointFor(width: number): Breakpoint;
1413
+ /** Width (px) of an element, kept current with a ResizeObserver; null until measured. */
1414
+ export declare function useElementWidth(ref: React.RefObject<Element>): number | null;
1415
+ /** Breakpoint of an element's own width; null until measured. Use it to drop low-priority table columns in a narrow pane. */
1416
+ export declare function useBreakpoint(ref: React.RefObject<Element>): Breakpoint | null;
1417
+ /** Drawer/sheet focus handling: focus moves into the container on open, Tab stays inside, Esc calls onClose, focus returns on close. */
1418
+ export declare function useOverlayFocus(ref: React.RefObject<HTMLElement>, open: boolean, onClose?: () => void): void;
1419
+
1341
1420
  /** The website's .room: a section that inverts the theme inside — sets data-theme opposite to its ancestor and paints --bg. */
1342
1421
  export interface RoomProps extends React.HTMLAttributes<HTMLElement> {
1343
1422
  /** Force a theme instead of inverting the ancestor's */
@@ -1412,7 +1491,9 @@ export interface VerticalNavigationProps extends Omit<React.HTMLAttributes<HTMLE
1412
1491
  /** Each new width while resizing; persist it and pass it back as width */
1413
1492
  onResize?: (width: number) => void;
1414
1493
  logoHref?: string;
1415
- labels?: { search?: string; collapse?: string; expand?: string; navigation?: string; resize?: string };
1494
+ /** Layout state. Omit it inside PageLayout, which sets it from its width: docked ≥ 1280, rail 1024–1279 (collapsed to 56px until the user expands it), overlay < 1024 (a drawer with a close button that closes when an item is chosen). Standalone default: docked */
1495
+ mode?: 'docked' | 'rail' | 'overlay';
1496
+ labels?: { search?: string; collapse?: string; expand?: string; navigation?: string; resize?: string; close?: string };
1416
1497
  }
1417
1498
  export declare function VerticalNavigation(props: VerticalNavigationProps): JSX.Element;
1418
1499
 
@@ -1511,7 +1592,15 @@ export interface SplitViewProps extends Omit<React.HTMLAttributes<HTMLDivElement
1511
1592
  resizable?: boolean;
1512
1593
  /** Shows a toggle that hides the list */
1513
1594
  collapsible?: boolean;
1514
- labels?: { resize?: string; empty?: string; collapse?: string; expand?: string };
1595
+ /** Width of the SplitView itself (a breakpoint name or px) below which list and detail stack: the list fills the pane and a picked record opens as a full pane with a back button. Default 'md' (768); false never stacks. Below 'lg' (1024) the list narrows to --panel-w */
1596
+ stackBelow?: 'sm' | 'md' | 'lg' | 'xl' | number | false;
1597
+ /** Pane shown first when stacked (default 'list') */
1598
+ defaultStackedView?: 'list' | 'detail';
1599
+ /** Called when the stacked pane changes */
1600
+ onStackedViewChange?: (view: 'list' | 'detail') => void;
1601
+ /** Called by the stacked detail's back button (after it returns to the list) */
1602
+ onBack?: () => void;
1603
+ labels?: { resize?: string; empty?: string; collapse?: string; expand?: string; back?: string };
1515
1604
  }
1516
1605
  export declare function SplitView(props: SplitViewProps): JSX.Element;
1517
1606
 
@@ -1994,7 +2083,10 @@ export interface SidePanelProps extends Omit<React.HTMLAttributes<HTMLElement>,
1994
2083
  size?: 'md' | 'lg';
1995
2084
  /** Any width (number = px), overriding size: a 600px trace inspector, "40vw" */
1996
2085
  width?: number | string;
2086
+ /** docked sits in the layout (inside PageLayout, a SidePanel with no mode is docked); overlay (default) is a modal sheet from the right: scrim, focus moved in and kept inside, Esc and scrim click call onClose, focus restored */
1997
2087
  mode?: 'overlay' | 'docked';
2088
+ /** Overlay only: the --overlay scrim behind the sheet (default true) */
2089
+ scrim?: boolean;
1998
2090
  children?: React.ReactNode;
1999
2091
  labels?: { close?: string };
2000
2092
  }