@abgov/react-components 7.2.0-dev.11 → 7.2.0-dev.13
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/index.d.ts +2 -0
- package/index.js +65 -0
- package/index.js.map +1 -1
- package/index.mjs +65 -0
- package/index.mjs.map +1 -1
- package/lib/scroll-panel/scroll-panel.d.ts +32 -0
- package/lib/workspace-layout/workspace-layout-scroll-state.d.ts +22 -0
- package/lib/workspace-layout/workspace-layout.d.ts +42 -0
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DataAttributes } from '@abgov/ui-components-common';
|
|
2
|
+
import { default as React, ReactNode, JSX } from 'react';
|
|
3
|
+
interface WCProps {
|
|
4
|
+
height?: string;
|
|
5
|
+
testid?: string;
|
|
6
|
+
}
|
|
7
|
+
declare module "react" {
|
|
8
|
+
namespace JSX {
|
|
9
|
+
interface IntrinsicElements {
|
|
10
|
+
"goa-scroll-panel": WCProps & React.HTMLAttributes<HTMLElement>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export interface GoabScrollPanelProps extends DataAttributes {
|
|
15
|
+
/** Content rendered in the sticky header region. */
|
|
16
|
+
header?: ReactNode;
|
|
17
|
+
/** Content rendered in the scrollable body region. */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
/** Content rendered in the sticky footer region. */
|
|
20
|
+
footer?: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Sets the height of the panel. Accepts any valid CSS height value, including
|
|
23
|
+
* calc()/min()/clamp() and viewport units (e.g. "400px", "100%", "100vh",
|
|
24
|
+
* "calc(100vh - 4rem)"). Invalid values fall back to "100%". Defaults to "100%".
|
|
25
|
+
* The parent element must establish a height context for "100%" to resolve.
|
|
26
|
+
*/
|
|
27
|
+
height?: string;
|
|
28
|
+
/** Sets a data-testid attribute for automated testing. */
|
|
29
|
+
testId?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function GoabScrollPanel({ header, children, footer, height, testId, ...rest }: GoabScrollPanelProps): JSX.Element;
|
|
32
|
+
export default GoabScrollPanel;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { GoabWorkspaceLayoutScrollState } from '@abgov/ui-components-common';
|
|
2
|
+
export interface GoabWorkspaceLayoutScrollStateValue {
|
|
3
|
+
scrollPosition: GoabWorkspaceLayoutScrollState;
|
|
4
|
+
isScrollable: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const GoabWorkspaceLayoutScrollStateDefault: GoabWorkspaceLayoutScrollStateValue;
|
|
7
|
+
/** @internal — provided by GoabWorkspaceLayout, consumed via the hook below. */
|
|
8
|
+
export declare const GoabWorkspaceLayoutScrollStateContext: import('react').Context<GoabWorkspaceLayoutScrollStateValue>;
|
|
9
|
+
/**
|
|
10
|
+
* Hook that returns the current scroll state of the nearest enclosing
|
|
11
|
+
* GoabWorkspaceLayout. Returns `{ scrollPosition: 'no-scroll', isScrollable: false }`
|
|
12
|
+
* if no layout is mounted.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const { scrollPosition, isScrollable } = useGoabWorkspaceLayoutScrollState();
|
|
17
|
+
* const isCollapsed =
|
|
18
|
+
* scrollPosition === GoabWorkspaceLayoutScrollState.MIDDLE ||
|
|
19
|
+
* scrollPosition === GoabWorkspaceLayoutScrollState.AT_BOTTOM;
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function useGoabWorkspaceLayoutScrollState(): GoabWorkspaceLayoutScrollStateValue;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DataAttributes, GoabWorkspaceLayoutOnScrollStateChangeDetail } from '@abgov/ui-components-common';
|
|
2
|
+
import { default as React, ReactNode, JSX } from 'react';
|
|
3
|
+
interface WCProps {
|
|
4
|
+
testid?: string;
|
|
5
|
+
}
|
|
6
|
+
declare module "react" {
|
|
7
|
+
namespace JSX {
|
|
8
|
+
interface IntrinsicElements {
|
|
9
|
+
"goa-workspace-layout": WCProps & React.HTMLAttributes<HTMLElement> & {
|
|
10
|
+
ref: React.RefObject<HTMLElement | null>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export interface GoabWorkspaceLayoutProps extends DataAttributes {
|
|
16
|
+
/** Content rendered in the side navigation region (e.g. work-side-menu). */
|
|
17
|
+
sideMenu?: ReactNode;
|
|
18
|
+
/** Content rendered in the sticky page header region. */
|
|
19
|
+
pageHeader?: ReactNode;
|
|
20
|
+
/** Content rendered in the sticky page footer region. */
|
|
21
|
+
pageFooter?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* A GoabPushDrawer rendered as a sibling of the main card, inside the same
|
|
24
|
+
* workspace shell. Use this slot when the page needs a push drawer alongside
|
|
25
|
+
* the workspace layout — it gives the drawer the shell-level height and flex
|
|
26
|
+
* context it expects, so the consumer does not have to wrap the layout in
|
|
27
|
+
* their own flex container. The side menu is not pushed; only the card is.
|
|
28
|
+
*/
|
|
29
|
+
pushDrawer?: ReactNode;
|
|
30
|
+
/** Main scrollable content. */
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
/** Sets a data-testid attribute for automated testing. */
|
|
33
|
+
testId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Called whenever the internal scroll state changes (no-scroll → at-top →
|
|
36
|
+
* middle → at-bottom)
|
|
37
|
+
*/
|
|
38
|
+
onScrollStateChange?: (detail: GoabWorkspaceLayoutOnScrollStateChangeDetail) => void;
|
|
39
|
+
}
|
|
40
|
+
export declare function GoabWorkspaceLayout({ sideMenu, pageHeader, pageFooter, pushDrawer, children, testId, onScrollStateChange, ...rest }: GoabWorkspaceLayoutProps): JSX.Element;
|
|
41
|
+
export default GoabWorkspaceLayout;
|
|
42
|
+
export { useGoabWorkspaceLayoutScrollState, type GoabWorkspaceLayoutScrollStateValue, } from './workspace-layout-scroll-state';
|