@starasia/admin 8.8.0 → 8.10.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/components/SidePanel/SidePanelItem.d.ts +63 -0
- package/dist/components/SidePanel/index.d.ts +88 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.cjs.js +53 -2
- package/dist/index.es.js +2457 -2141
- package/dist/index.umd.js +53 -2
- package/package.json +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface SidePanelItemProps {
|
|
4
|
+
/**
|
|
5
|
+
* Highlight this row as the currently selected one — paints the accent
|
|
6
|
+
* bar (`--sa-border-focused`) + a subtle brand fill.
|
|
7
|
+
*/
|
|
8
|
+
active?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Which edge the active/focus accent bar sits on. Match it to the
|
|
11
|
+
* `SidePanel`'s `side` so the bar hugs the panel's outer edge.
|
|
12
|
+
* @default 'left'
|
|
13
|
+
*/
|
|
14
|
+
accentSide?: "left" | "right";
|
|
15
|
+
/** Click handler for selecting the row. */
|
|
16
|
+
onClick?: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Top line — typically a document code / id (e.g. "SJ-BIB/03-2026/0004").
|
|
19
|
+
* Truncates with an ellipsis when it overflows.
|
|
20
|
+
*/
|
|
21
|
+
title?: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Trailing element on the title row — usually a `<Badge />` (e.g. status).
|
|
24
|
+
* Pinned to the right, never shrinks.
|
|
25
|
+
*/
|
|
26
|
+
badge?: React.ReactNode;
|
|
27
|
+
/** Main bold line — e.g. the entity / company name. */
|
|
28
|
+
heading?: React.ReactNode;
|
|
29
|
+
/** Subtle bottom line — e.g. "Created By: …". */
|
|
30
|
+
meta?: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Custom body — when provided, overrides the
|
|
33
|
+
* `title`/`badge`/`heading`/`meta` layout entirely.
|
|
34
|
+
*/
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
/** Render the bottom divider between rows. @default true */
|
|
37
|
+
divider?: boolean;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
className?: string;
|
|
40
|
+
style?: React.CSSProperties;
|
|
41
|
+
/** aria-label when the row content isn't plain readable text. */
|
|
42
|
+
"aria-label"?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* SidePanelItem — a selectable list-row card for use inside `SidePanel`'s
|
|
46
|
+
* `children`. Shows a document code (`title`) with an optional `badge`, a
|
|
47
|
+
* bold `heading`, and a subtle `meta` line. The `active` row gets an accent
|
|
48
|
+
* left border; every row has a hover and keyboard-focus state.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* {records.map((r) => (
|
|
52
|
+
* <SidePanelItem
|
|
53
|
+
* key={r.id}
|
|
54
|
+
* active={r.id === activeId}
|
|
55
|
+
* onClick={() => setActiveId(r.id)}
|
|
56
|
+
* title={r.code}
|
|
57
|
+
* badge={<Badge variant="warning" size="sm" text={r.status} />}
|
|
58
|
+
* heading={r.company}
|
|
59
|
+
* meta={`Created By: ${r.createdBy}`}
|
|
60
|
+
* />
|
|
61
|
+
* ))}
|
|
62
|
+
*/
|
|
63
|
+
export declare const SidePanelItem: React.FC<SidePanelItemProps>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BoxProps } from '@starasia/box';
|
|
3
|
+
|
|
4
|
+
export { SidePanelItem } from './SidePanelItem';
|
|
5
|
+
export type { SidePanelItemProps } from './SidePanelItem';
|
|
6
|
+
export interface SidePanelToggleLabel {
|
|
7
|
+
/** aria-label when the panel is currently open (clicking will collapse it). */
|
|
8
|
+
collapse: string;
|
|
9
|
+
/** aria-label when the panel is currently collapsed (clicking will expand it). */
|
|
10
|
+
expand: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SidePanelProps {
|
|
13
|
+
/** Scrollable body content of the panel. */
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Fixed (non-scrolling) content pinned to the top of the panel —
|
|
17
|
+
* e.g. a search box + filter button. Stays put while `children` scroll.
|
|
18
|
+
*/
|
|
19
|
+
header?: React.ReactNode;
|
|
20
|
+
/** Controlled collapsed state. Omit to run uncontrolled (see `defaultCollapsed`). */
|
|
21
|
+
collapsed?: boolean;
|
|
22
|
+
/** Initial collapsed state when uncontrolled. @default false */
|
|
23
|
+
defaultCollapsed?: boolean;
|
|
24
|
+
/** Called on toggle with the next collapsed state. */
|
|
25
|
+
onToggle?: (collapsed: boolean) => void;
|
|
26
|
+
/** Expanded panel width in px. @default 337 */
|
|
27
|
+
width?: number;
|
|
28
|
+
/** Which edge the panel hugs (and where the toggle "ear" sits). @default 'left' */
|
|
29
|
+
side?: "left" | "right";
|
|
30
|
+
/** Distance from the top of the viewport for sticky positioning. @default '4rem' */
|
|
31
|
+
offsetTop?: number | string;
|
|
32
|
+
/** Panel height. @default 'calc(100vh - {offsetTop})' */
|
|
33
|
+
height?: number | string;
|
|
34
|
+
/** Show the toggle "ear" button on the outer edge. @default true */
|
|
35
|
+
showToggle?: boolean;
|
|
36
|
+
/** Where the toggle "ear" sits vertically along the panel edge. @default 'top' */
|
|
37
|
+
togglePosition?: "top" | "center" | "bottom";
|
|
38
|
+
/**
|
|
39
|
+
* Distance in px from the anchored edge for `togglePosition` 'top' / 'bottom'.
|
|
40
|
+
* Ignored when `togglePosition` is 'center'. @default 40
|
|
41
|
+
*/
|
|
42
|
+
toggleOffset?: number;
|
|
43
|
+
/** Accessible labels for the toggle button. */
|
|
44
|
+
toggleLabel?: SidePanelToggleLabel;
|
|
45
|
+
/** Extra style for the outer sticky wrapper. */
|
|
46
|
+
style?: React.CSSProperties;
|
|
47
|
+
/** Extra style for the scrollable body container. */
|
|
48
|
+
bodyStyle?: React.CSSProperties;
|
|
49
|
+
className?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Main content region for the master-detail layout. When provided, SidePanel
|
|
52
|
+
* renders the two-column shell itself: this panel on the anchored `side` (its
|
|
53
|
+
* `header` = search/filter, `children` = list body) and `pageLayout` in an
|
|
54
|
+
* independently-scrolling content column. On mobile (< md) the panel becomes
|
|
55
|
+
* a fixed overlay/drawer with a scrim so it doesn't steal width.
|
|
56
|
+
*
|
|
57
|
+
* Omit for standalone use (just the panel) to compose the layout by hand.
|
|
58
|
+
*/
|
|
59
|
+
pageLayout?: React.ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* Whether the panel floats over the content as a drawer (with a scrim) instead
|
|
62
|
+
* of taking a column. Only applies in integrated mode (`pageLayout` set).
|
|
63
|
+
* - `'mobile'` (default): overlay only below the `md` breakpoint.
|
|
64
|
+
* - `true`: always overlay.
|
|
65
|
+
* - `false`: never overlay (always a side column).
|
|
66
|
+
* @default 'mobile'
|
|
67
|
+
*/
|
|
68
|
+
overlay?: boolean | "mobile";
|
|
69
|
+
/** Override the outer flex-row region (integrated mode only). */
|
|
70
|
+
wrapperProps?: BoxProps;
|
|
71
|
+
/** Override the right-hand scrolling content column (integrated mode only). */
|
|
72
|
+
contentProps?: BoxProps;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* SidePanel — a sticky side panel that smoothly collapses to zero width
|
|
76
|
+
* and back. Provide fixed top content via `header` and scrolling content as
|
|
77
|
+
* `children`. A toggle "ear" hangs off the outer edge. Works controlled
|
|
78
|
+
* (`collapsed` + `onToggle`) or uncontrolled (`defaultCollapsed`).
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* <SidePanel
|
|
82
|
+
* header={<SearchAndFilter />}
|
|
83
|
+
* defaultCollapsed={false}
|
|
84
|
+
* >
|
|
85
|
+
* {records.map((r) => <ListRow key={r.id} {...r} />)}
|
|
86
|
+
* </SidePanel>
|
|
87
|
+
*/
|
|
88
|
+
export declare const SidePanel: React.FC<SidePanelProps>;
|
|
@@ -21,6 +21,7 @@ export * from './InputFile';
|
|
|
21
21
|
export * from './Typography';
|
|
22
22
|
export * from './ScrollToTopButton';
|
|
23
23
|
export * from './InputImage';
|
|
24
|
+
export * from './SidePanel';
|
|
24
25
|
export * from './AsideBar';
|
|
25
26
|
export * from './FloatingFooter';
|
|
26
27
|
export * from './VerticalField';
|