@starasia/admin 8.8.0 → 8.9.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/index.d.ts +86 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.es.js +2122 -1947
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BoxProps } from '@starasia/box';
|
|
3
|
+
|
|
4
|
+
export interface SidePanelToggleLabel {
|
|
5
|
+
/** aria-label when the panel is currently open (clicking will collapse it). */
|
|
6
|
+
collapse: string;
|
|
7
|
+
/** aria-label when the panel is currently collapsed (clicking will expand it). */
|
|
8
|
+
expand: string;
|
|
9
|
+
}
|
|
10
|
+
export interface SidePanelProps {
|
|
11
|
+
/** Scrollable body content of the panel. */
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Fixed (non-scrolling) content pinned to the top of the panel —
|
|
15
|
+
* e.g. a search box + filter button. Stays put while `children` scroll.
|
|
16
|
+
*/
|
|
17
|
+
header?: React.ReactNode;
|
|
18
|
+
/** Controlled collapsed state. Omit to run uncontrolled (see `defaultCollapsed`). */
|
|
19
|
+
collapsed?: boolean;
|
|
20
|
+
/** Initial collapsed state when uncontrolled. @default false */
|
|
21
|
+
defaultCollapsed?: boolean;
|
|
22
|
+
/** Called on toggle with the next collapsed state. */
|
|
23
|
+
onToggle?: (collapsed: boolean) => void;
|
|
24
|
+
/** Expanded panel width in px. @default 337 */
|
|
25
|
+
width?: number;
|
|
26
|
+
/** Which edge the panel hugs (and where the toggle "ear" sits). @default 'left' */
|
|
27
|
+
side?: "left" | "right";
|
|
28
|
+
/** Distance from the top of the viewport for sticky positioning. @default '4rem' */
|
|
29
|
+
offsetTop?: number | string;
|
|
30
|
+
/** Panel height. @default 'calc(100vh - {offsetTop})' */
|
|
31
|
+
height?: number | string;
|
|
32
|
+
/** Show the toggle "ear" button on the outer edge. @default true */
|
|
33
|
+
showToggle?: boolean;
|
|
34
|
+
/** Where the toggle "ear" sits vertically along the panel edge. @default 'top' */
|
|
35
|
+
togglePosition?: "top" | "center" | "bottom";
|
|
36
|
+
/**
|
|
37
|
+
* Distance in px from the anchored edge for `togglePosition` 'top' / 'bottom'.
|
|
38
|
+
* Ignored when `togglePosition` is 'center'. @default 40
|
|
39
|
+
*/
|
|
40
|
+
toggleOffset?: number;
|
|
41
|
+
/** Accessible labels for the toggle button. */
|
|
42
|
+
toggleLabel?: SidePanelToggleLabel;
|
|
43
|
+
/** Extra style for the outer sticky wrapper. */
|
|
44
|
+
style?: React.CSSProperties;
|
|
45
|
+
/** Extra style for the scrollable body container. */
|
|
46
|
+
bodyStyle?: React.CSSProperties;
|
|
47
|
+
className?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Main content region for the master-detail layout. When provided, SidePanel
|
|
50
|
+
* renders the two-column shell itself: this panel on the anchored `side` (its
|
|
51
|
+
* `header` = search/filter, `children` = list body) and `pageLayout` in an
|
|
52
|
+
* independently-scrolling content column. On mobile (< md) the panel becomes
|
|
53
|
+
* a fixed overlay/drawer with a scrim so it doesn't steal width.
|
|
54
|
+
*
|
|
55
|
+
* Omit for standalone use (just the panel) to compose the layout by hand.
|
|
56
|
+
*/
|
|
57
|
+
pageLayout?: React.ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the panel floats over the content as a drawer (with a scrim) instead
|
|
60
|
+
* of taking a column. Only applies in integrated mode (`pageLayout` set).
|
|
61
|
+
* - `'mobile'` (default): overlay only below the `md` breakpoint.
|
|
62
|
+
* - `true`: always overlay.
|
|
63
|
+
* - `false`: never overlay (always a side column).
|
|
64
|
+
* @default 'mobile'
|
|
65
|
+
*/
|
|
66
|
+
overlay?: boolean | "mobile";
|
|
67
|
+
/** Override the outer flex-row region (integrated mode only). */
|
|
68
|
+
wrapperProps?: BoxProps;
|
|
69
|
+
/** Override the right-hand scrolling content column (integrated mode only). */
|
|
70
|
+
contentProps?: BoxProps;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* SidePanel — a sticky side panel that smoothly collapses to zero width
|
|
74
|
+
* and back. Provide fixed top content via `header` and scrolling content as
|
|
75
|
+
* `children`. A toggle "ear" hangs off the outer edge. Works controlled
|
|
76
|
+
* (`collapsed` + `onToggle`) or uncontrolled (`defaultCollapsed`).
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* <SidePanel
|
|
80
|
+
* header={<SearchAndFilter />}
|
|
81
|
+
* defaultCollapsed={false}
|
|
82
|
+
* >
|
|
83
|
+
* {records.map((r) => <ListRow key={r.id} {...r} />)}
|
|
84
|
+
* </SidePanel>
|
|
85
|
+
*/
|
|
86
|
+
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';
|