@sproutsocial/seeds-react-panel 0.3.7

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.
@@ -0,0 +1,178 @@
1
+ import * as React from 'react';
2
+ import { TypeStyledComponentsCommonProps, TypeSystemCommonProps } from '@sproutsocial/seeds-react-system-props';
3
+ import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
4
+ import { TypeButtonProps } from '@sproutsocial/seeds-react-button';
5
+ import { TypeDrawerSnapPoint, TypeDrawerActionProps } from '@sproutsocial/seeds-react-drawer';
6
+ export { TypeDrawerActionProps as TypePanelActionProps } from '@sproutsocial/seeds-react-drawer';
7
+ import * as react_jsx_runtime from 'react/jsx-runtime';
8
+
9
+ type PanelDirection = "left" | "right" | "bottom";
10
+ interface TypePanelContext {
11
+ isPanelOpen: boolean;
12
+ togglePanel: () => void;
13
+ openPanel: () => void;
14
+ closePanel: () => void;
15
+ closeButtonLabel?: string;
16
+ }
17
+ interface TypePanelProviderProps {
18
+ children: React.ReactNode;
19
+ /** Initial open state for uncontrolled usage. */
20
+ defaultOpen?: boolean;
21
+ /** Controlled open state. When provided, the provider becomes controlled. */
22
+ open?: boolean;
23
+ /** Called whenever the open state changes. Required for controlled usage. */
24
+ onOpenChange?: (open: boolean) => void;
25
+ }
26
+ interface TypePanelProps extends TypeStyledComponentsCommonProps, TypeSystemCommonProps, Omit<React.ComponentPropsWithoutRef<"div">, "color"> {
27
+ children: React.ReactNode;
28
+ /** Label for the close button. Usually "Close". */
29
+ closeButtonLabel: string;
30
+ /**
31
+ * Custom header content. When provided, replaces the auto-rendered default
32
+ * header entirely — `title` and `titleId` are ignored.
33
+ */
34
+ header?: React.ReactNode;
35
+ /** Custom footer content. Not rendered when omitted. */
36
+ footer?: React.ReactNode;
37
+ /** Title shown in the auto-rendered default header. Ignored when `header` is provided. */
38
+ title?: string;
39
+ /**
40
+ * Sets the `id` on the title element of the auto-rendered header. When the
41
+ * default header is used, Panel automatically wires `aria-labelledby` to this
42
+ * id so the dialog/aside has an accessible name. Pass an explicit
43
+ * `aria-labelledby` to override (e.g. when pointing at a different element).
44
+ * Ignored when `header` is provided — supply your own `aria-labelledby` in
45
+ * that case.
46
+ */
47
+ titleId?: string;
48
+ /** Side the panel anchors to on desktop. Defaults to "right". */
49
+ direction?: PanelDirection;
50
+ /**
51
+ * Width (px) when direction is "left" or "right", or height (px) when
52
+ * direction is "bottom". Defaults to 384 to match the existing web-app-core
53
+ * Panel.
54
+ */
55
+ width?: number;
56
+ /**
57
+ * Visual gap (px) between the panel and the adjacent content. Applied as
58
+ * margin on the side facing the content (left when direction="right",
59
+ * right when direction="left", top when direction="bottom"). Animates with
60
+ * the panel's open/close transition and collapses to 0 when closed so the
61
+ * gap does not remain visible alongside a zero-width panel. Defaults to 0.
62
+ */
63
+ gap?: number;
64
+ /**
65
+ * Forwarded to `useIsMobile`. Accepts a px number or any CSS media-query
66
+ * length. Below this width, the panel renders as an overlay bottom sheet
67
+ * (via seeds-react-drawer). Defaults to the theme's `breakpoints.sm`.
68
+ */
69
+ mobileBreakpoint?: number | string;
70
+ /** Applies only to the mobile bottom-sheet rendering. */
71
+ zIndex?: number;
72
+ /** Optional id used for data-qa-panel attributes. */
73
+ id?: string;
74
+ /**
75
+ * Snap points the panel can rest at when rendered as a mobile bottom sheet.
76
+ * Numbers 0–1 are viewport-height fractions; numbers > 1 are pixels; strings
77
+ * accept `px`/`rem` (e.g. `"480px"`, `"30rem"`). Order matters — the last
78
+ * entry is the "expanded" state. Ignored on the desktop side-panel rendering.
79
+ */
80
+ snapPoints?: TypeDrawerSnapPoint[];
81
+ /** Initial snap point for uncontrolled use. Mobile only. */
82
+ defaultSnapPoint?: TypeDrawerSnapPoint | null;
83
+ /** Controlled active snap point. Pair with `onSnapPointChange`. Mobile only. */
84
+ snapPoint?: TypeDrawerSnapPoint | null;
85
+ /** Fires when the active snap point changes. Mobile only. */
86
+ onSnapPointChange?: (snapPoint: TypeDrawerSnapPoint | null) => void;
87
+ /**
88
+ * When true, fast swipes can't skip past adjacent snap points. Mobile only.
89
+ */
90
+ snapToSequentialPoints?: boolean;
91
+ /**
92
+ * Action buttons shown in a floating rail above the panel on mobile (the
93
+ * bottom-sheet rendering). Ignored on desktop side-panel rendering — pass
94
+ * actions through `header`/`footer` slots there. The rail owns the close
95
+ * button so the default header omits its built-in close affordance.
96
+ */
97
+ actions?: TypeDrawerActionProps[];
98
+ /**
99
+ * Opt out of the floating mobile rail and render the `actions` inline in the
100
+ * header as pill buttons instead. Useful for nested bottom sheets and
101
+ * snap-point layouts where the floating rail would collide with surrounding
102
+ * UI. Defaults to `false`.
103
+ *
104
+ * When `header` is omitted, Panel auto-composes a mobile header that renders
105
+ * the title, the `actions` as pills, and a close-button pill. When `header`
106
+ * is provided, the consumer is responsible for rendering the actions inside
107
+ * their own header — `actions` is forwarded for context only.
108
+ */
109
+ actionsInHeader?: boolean;
110
+ }
111
+ interface TypePanelHeaderProps extends TypeBoxProps {
112
+ title?: string;
113
+ /**
114
+ * When children are provided, `<Panel.CloseButton />` is NOT rendered
115
+ * automatically. Include it yourself to preserve keyboard accessibility.
116
+ */
117
+ children?: React.ReactNode;
118
+ /** Render-prop override that receives the parent panel context. */
119
+ render?: React.FC<TypePanelContext>;
120
+ }
121
+ interface TypePanelContentProps extends TypeBoxProps {
122
+ children?: React.ReactNode;
123
+ }
124
+ interface TypePanelFooterProps extends TypeBoxProps {
125
+ children?: React.ReactNode;
126
+ }
127
+ interface TypePanelCloseButtonProps extends Omit<TypeButtonProps, "children"> {
128
+ /** Render-prop override that receives the parent panel context. */
129
+ render?: React.FC<TypePanelContext>;
130
+ children?: React.ReactNode;
131
+ }
132
+
133
+ declare const PanelComponent: {
134
+ ({ children, closeButtonLabel, header, footer, title, titleId, direction, width, gap, mobileBreakpoint, zIndex, id, snapPoints, defaultSnapPoint, snapPoint, onSnapPointChange, snapToSequentialPoints, actions, actionsInHeader, "aria-labelledby": ariaLabelledByProp, "aria-label": ariaLabel, ...rest }: TypePanelProps): react_jsx_runtime.JSX.Element;
135
+ Header: {
136
+ ({ title, id, children, render, ...rest }: TypePanelHeaderProps): string | number | boolean | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
137
+ displayName: string;
138
+ };
139
+ Content: {
140
+ ({ children, ...rest }: TypePanelContentProps): react_jsx_runtime.JSX.Element;
141
+ displayName: string;
142
+ };
143
+ CloseButton: {
144
+ (props: TypePanelCloseButtonProps): string | number | boolean | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null;
145
+ displayName: string;
146
+ };
147
+ Footer: {
148
+ ({ children, ...rest }: TypePanelFooterProps): react_jsx_runtime.JSX.Element;
149
+ displayName: string;
150
+ };
151
+ };
152
+
153
+ declare const PanelContext: React.Context<TypePanelContext | null>;
154
+ declare const usePanelContext: () => TypePanelContext;
155
+
156
+ declare const PanelProvider: ({ children, defaultOpen, open: controlledOpen, onOpenChange, }: TypePanelProviderProps) => react_jsx_runtime.JSX.Element;
157
+
158
+ declare const PanelHeader: {
159
+ ({ title, id, children, render, ...rest }: TypePanelHeaderProps): string | number | boolean | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
160
+ displayName: string;
161
+ };
162
+
163
+ declare const PanelContent: {
164
+ ({ children, ...rest }: TypePanelContentProps): react_jsx_runtime.JSX.Element;
165
+ displayName: string;
166
+ };
167
+
168
+ declare const PanelCloseButton: {
169
+ (props: TypePanelCloseButtonProps): string | number | boolean | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null;
170
+ displayName: string;
171
+ };
172
+
173
+ declare const PanelFooter: {
174
+ ({ children, ...rest }: TypePanelFooterProps): react_jsx_runtime.JSX.Element;
175
+ displayName: string;
176
+ };
177
+
178
+ export { PanelComponent as Panel, PanelCloseButton, PanelContent, PanelContext, type PanelDirection, PanelFooter, PanelHeader, PanelProvider, type TypePanelCloseButtonProps, type TypePanelContentProps, type TypePanelContext, type TypePanelFooterProps, type TypePanelHeaderProps, type TypePanelProps, type TypePanelProviderProps, PanelComponent as default, usePanelContext };
@@ -0,0 +1,178 @@
1
+ import * as React from 'react';
2
+ import { TypeStyledComponentsCommonProps, TypeSystemCommonProps } from '@sproutsocial/seeds-react-system-props';
3
+ import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
4
+ import { TypeButtonProps } from '@sproutsocial/seeds-react-button';
5
+ import { TypeDrawerSnapPoint, TypeDrawerActionProps } from '@sproutsocial/seeds-react-drawer';
6
+ export { TypeDrawerActionProps as TypePanelActionProps } from '@sproutsocial/seeds-react-drawer';
7
+ import * as react_jsx_runtime from 'react/jsx-runtime';
8
+
9
+ type PanelDirection = "left" | "right" | "bottom";
10
+ interface TypePanelContext {
11
+ isPanelOpen: boolean;
12
+ togglePanel: () => void;
13
+ openPanel: () => void;
14
+ closePanel: () => void;
15
+ closeButtonLabel?: string;
16
+ }
17
+ interface TypePanelProviderProps {
18
+ children: React.ReactNode;
19
+ /** Initial open state for uncontrolled usage. */
20
+ defaultOpen?: boolean;
21
+ /** Controlled open state. When provided, the provider becomes controlled. */
22
+ open?: boolean;
23
+ /** Called whenever the open state changes. Required for controlled usage. */
24
+ onOpenChange?: (open: boolean) => void;
25
+ }
26
+ interface TypePanelProps extends TypeStyledComponentsCommonProps, TypeSystemCommonProps, Omit<React.ComponentPropsWithoutRef<"div">, "color"> {
27
+ children: React.ReactNode;
28
+ /** Label for the close button. Usually "Close". */
29
+ closeButtonLabel: string;
30
+ /**
31
+ * Custom header content. When provided, replaces the auto-rendered default
32
+ * header entirely — `title` and `titleId` are ignored.
33
+ */
34
+ header?: React.ReactNode;
35
+ /** Custom footer content. Not rendered when omitted. */
36
+ footer?: React.ReactNode;
37
+ /** Title shown in the auto-rendered default header. Ignored when `header` is provided. */
38
+ title?: string;
39
+ /**
40
+ * Sets the `id` on the title element of the auto-rendered header. When the
41
+ * default header is used, Panel automatically wires `aria-labelledby` to this
42
+ * id so the dialog/aside has an accessible name. Pass an explicit
43
+ * `aria-labelledby` to override (e.g. when pointing at a different element).
44
+ * Ignored when `header` is provided — supply your own `aria-labelledby` in
45
+ * that case.
46
+ */
47
+ titleId?: string;
48
+ /** Side the panel anchors to on desktop. Defaults to "right". */
49
+ direction?: PanelDirection;
50
+ /**
51
+ * Width (px) when direction is "left" or "right", or height (px) when
52
+ * direction is "bottom". Defaults to 384 to match the existing web-app-core
53
+ * Panel.
54
+ */
55
+ width?: number;
56
+ /**
57
+ * Visual gap (px) between the panel and the adjacent content. Applied as
58
+ * margin on the side facing the content (left when direction="right",
59
+ * right when direction="left", top when direction="bottom"). Animates with
60
+ * the panel's open/close transition and collapses to 0 when closed so the
61
+ * gap does not remain visible alongside a zero-width panel. Defaults to 0.
62
+ */
63
+ gap?: number;
64
+ /**
65
+ * Forwarded to `useIsMobile`. Accepts a px number or any CSS media-query
66
+ * length. Below this width, the panel renders as an overlay bottom sheet
67
+ * (via seeds-react-drawer). Defaults to the theme's `breakpoints.sm`.
68
+ */
69
+ mobileBreakpoint?: number | string;
70
+ /** Applies only to the mobile bottom-sheet rendering. */
71
+ zIndex?: number;
72
+ /** Optional id used for data-qa-panel attributes. */
73
+ id?: string;
74
+ /**
75
+ * Snap points the panel can rest at when rendered as a mobile bottom sheet.
76
+ * Numbers 0–1 are viewport-height fractions; numbers > 1 are pixels; strings
77
+ * accept `px`/`rem` (e.g. `"480px"`, `"30rem"`). Order matters — the last
78
+ * entry is the "expanded" state. Ignored on the desktop side-panel rendering.
79
+ */
80
+ snapPoints?: TypeDrawerSnapPoint[];
81
+ /** Initial snap point for uncontrolled use. Mobile only. */
82
+ defaultSnapPoint?: TypeDrawerSnapPoint | null;
83
+ /** Controlled active snap point. Pair with `onSnapPointChange`. Mobile only. */
84
+ snapPoint?: TypeDrawerSnapPoint | null;
85
+ /** Fires when the active snap point changes. Mobile only. */
86
+ onSnapPointChange?: (snapPoint: TypeDrawerSnapPoint | null) => void;
87
+ /**
88
+ * When true, fast swipes can't skip past adjacent snap points. Mobile only.
89
+ */
90
+ snapToSequentialPoints?: boolean;
91
+ /**
92
+ * Action buttons shown in a floating rail above the panel on mobile (the
93
+ * bottom-sheet rendering). Ignored on desktop side-panel rendering — pass
94
+ * actions through `header`/`footer` slots there. The rail owns the close
95
+ * button so the default header omits its built-in close affordance.
96
+ */
97
+ actions?: TypeDrawerActionProps[];
98
+ /**
99
+ * Opt out of the floating mobile rail and render the `actions` inline in the
100
+ * header as pill buttons instead. Useful for nested bottom sheets and
101
+ * snap-point layouts where the floating rail would collide with surrounding
102
+ * UI. Defaults to `false`.
103
+ *
104
+ * When `header` is omitted, Panel auto-composes a mobile header that renders
105
+ * the title, the `actions` as pills, and a close-button pill. When `header`
106
+ * is provided, the consumer is responsible for rendering the actions inside
107
+ * their own header — `actions` is forwarded for context only.
108
+ */
109
+ actionsInHeader?: boolean;
110
+ }
111
+ interface TypePanelHeaderProps extends TypeBoxProps {
112
+ title?: string;
113
+ /**
114
+ * When children are provided, `<Panel.CloseButton />` is NOT rendered
115
+ * automatically. Include it yourself to preserve keyboard accessibility.
116
+ */
117
+ children?: React.ReactNode;
118
+ /** Render-prop override that receives the parent panel context. */
119
+ render?: React.FC<TypePanelContext>;
120
+ }
121
+ interface TypePanelContentProps extends TypeBoxProps {
122
+ children?: React.ReactNode;
123
+ }
124
+ interface TypePanelFooterProps extends TypeBoxProps {
125
+ children?: React.ReactNode;
126
+ }
127
+ interface TypePanelCloseButtonProps extends Omit<TypeButtonProps, "children"> {
128
+ /** Render-prop override that receives the parent panel context. */
129
+ render?: React.FC<TypePanelContext>;
130
+ children?: React.ReactNode;
131
+ }
132
+
133
+ declare const PanelComponent: {
134
+ ({ children, closeButtonLabel, header, footer, title, titleId, direction, width, gap, mobileBreakpoint, zIndex, id, snapPoints, defaultSnapPoint, snapPoint, onSnapPointChange, snapToSequentialPoints, actions, actionsInHeader, "aria-labelledby": ariaLabelledByProp, "aria-label": ariaLabel, ...rest }: TypePanelProps): react_jsx_runtime.JSX.Element;
135
+ Header: {
136
+ ({ title, id, children, render, ...rest }: TypePanelHeaderProps): string | number | boolean | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
137
+ displayName: string;
138
+ };
139
+ Content: {
140
+ ({ children, ...rest }: TypePanelContentProps): react_jsx_runtime.JSX.Element;
141
+ displayName: string;
142
+ };
143
+ CloseButton: {
144
+ (props: TypePanelCloseButtonProps): string | number | boolean | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null;
145
+ displayName: string;
146
+ };
147
+ Footer: {
148
+ ({ children, ...rest }: TypePanelFooterProps): react_jsx_runtime.JSX.Element;
149
+ displayName: string;
150
+ };
151
+ };
152
+
153
+ declare const PanelContext: React.Context<TypePanelContext | null>;
154
+ declare const usePanelContext: () => TypePanelContext;
155
+
156
+ declare const PanelProvider: ({ children, defaultOpen, open: controlledOpen, onOpenChange, }: TypePanelProviderProps) => react_jsx_runtime.JSX.Element;
157
+
158
+ declare const PanelHeader: {
159
+ ({ title, id, children, render, ...rest }: TypePanelHeaderProps): string | number | boolean | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
160
+ displayName: string;
161
+ };
162
+
163
+ declare const PanelContent: {
164
+ ({ children, ...rest }: TypePanelContentProps): react_jsx_runtime.JSX.Element;
165
+ displayName: string;
166
+ };
167
+
168
+ declare const PanelCloseButton: {
169
+ (props: TypePanelCloseButtonProps): string | number | boolean | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null;
170
+ displayName: string;
171
+ };
172
+
173
+ declare const PanelFooter: {
174
+ ({ children, ...rest }: TypePanelFooterProps): react_jsx_runtime.JSX.Element;
175
+ displayName: string;
176
+ };
177
+
178
+ export { PanelComponent as Panel, PanelCloseButton, PanelContent, PanelContext, type PanelDirection, PanelFooter, PanelHeader, PanelProvider, type TypePanelCloseButtonProps, type TypePanelContentProps, type TypePanelContext, type TypePanelFooterProps, type TypePanelHeaderProps, type TypePanelProps, type TypePanelProviderProps, PanelComponent as default, usePanelContext };