@sproutsocial/seeds-react-peek-in 0.5.1 → 0.6.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.mts CHANGED
@@ -33,6 +33,15 @@ type TypePeekInPanelToggleConfig = {
33
33
  "aria-label"?: string;
34
34
  };
35
35
  type TypePeekInProps = (TypePeekInControlledProps | TypePeekInUncontrolledProps) & {
36
+ /**
37
+ * Accessible label for the overlay dialog.
38
+ *
39
+ * Takes precedence over the label derived from `PeekInHeader`'s `title`.
40
+ * Required whenever the header `title` is not a plain string — a `ReactNode`
41
+ * title cannot be read as text, so without this the dialog has no meaningful
42
+ * accessible name.
43
+ */
44
+ "aria-label"?: string;
36
45
  /** Aria label for the built-in close button */
37
46
  closeButtonAriaLabel?: string;
38
47
  /** Additional action buttons shown in the action bar alongside the close button */
@@ -71,6 +80,13 @@ type TypePeekInProps = (TypePeekInControlledProps | TypePeekInUncontrolledProps)
71
80
  interface TypePeekInHeaderProps {
72
81
  /** Title displayed on the left side of the header */
73
82
  title: React.ReactNode;
83
+ /**
84
+ * Secondary text rendered beneath the title.
85
+ *
86
+ * Also used as a last-resort accessible name for the overlay when it is a
87
+ * plain string and neither `aria-label` nor a string `title` is available.
88
+ */
89
+ subtitle?: React.ReactNode;
74
90
  /** If provided, renders a back arrow button before the title */
75
91
  onBack?: () => void;
76
92
  /** Action buttons rendered on the right side of the header */
@@ -123,17 +139,85 @@ interface TypePeekInPanelProps {
123
139
  actionsInHeader?: boolean;
124
140
  children: React.ReactNode;
125
141
  }
142
+ /**
143
+ * Props for PeekInFooter.
144
+ *
145
+ * Mirrors `TypeModalFooterProps` so Modal and PeekIn footers are learnable as
146
+ * one API. At least one of `primaryButton`, `cancelButton`, or `leftAction`
147
+ * must be supplied.
148
+ *
149
+ * Unlike ModalFooter this does not extend `TypeBoxProps`, matching the other
150
+ * PeekIn sub-components, which take domain props only.
151
+ */
152
+ type TypePeekInFooterProps = {
153
+ /**
154
+ * Whether clicking the primary button closes the PeekIn.
155
+ * Set to `false` when the primary action is async and the overlay should stay
156
+ * open until it completes.
157
+ * @default true
158
+ */
159
+ closeOnPrimaryAction?: boolean;
160
+ } & ({
161
+ /** Primary action, right-aligned. Closes the PeekIn unless `closeOnPrimaryAction` is false. */
162
+ primaryButton: React.ReactNode;
163
+ /** Cancel/secondary action, right-aligned. Always closes the PeekIn. */
164
+ cancelButton?: React.ReactNode;
165
+ /** Action pinned to the far left (e.g. Delete). Never closes the PeekIn. */
166
+ leftAction?: React.ReactNode;
167
+ } | {
168
+ primaryButton?: React.ReactNode;
169
+ cancelButton: React.ReactNode;
170
+ leftAction?: React.ReactNode;
171
+ } | {
172
+ primaryButton?: React.ReactNode;
173
+ cancelButton?: React.ReactNode;
174
+ leftAction: React.ReactNode;
175
+ });
126
176
  interface TypePeekInTriggerProps {
127
177
  /** Element that opens the PeekIn when clicked */
128
178
  children: React.ReactNode;
129
179
  }
130
180
 
181
+ /**
182
+ * Header for PeekIn's main column.
183
+ *
184
+ * Layout comes from the seeds-peek-in-* classes in peek-in.css rather than
185
+ * styled-system props on Box, so the header is Box-free on both render paths
186
+ * and the desktop header row matches how PeekInTailwind lays out the mobile
187
+ * bottom-sheet header. The title, subtitle, and back button still come from
188
+ * the composed Seeds primitives, which own their own styling.
189
+ */
131
190
  declare const PeekInHeader: React.FC<TypePeekInHeaderProps>;
132
191
 
133
192
  declare const PeekInContent: React.FC<TypePeekInContentProps>;
134
193
 
194
+ /**
195
+ * Footer for PeekIn's main column, holding the overlay's primary actions.
196
+ *
197
+ * Slot behavior matches ModalFooter exactly:
198
+ * - `cancelButton` always closes
199
+ * - `primaryButton` closes unless `closeOnPrimaryAction` is false
200
+ * - `leftAction` never closes — the consumer owns it
201
+ *
202
+ * @example
203
+ * <PeekInFooter
204
+ * leftAction={<Button appearance="destructive">Delete</Button>}
205
+ * cancelButton={<Button>Cancel</Button>}
206
+ * primaryButton={<Button appearance="primary">Save</Button>}
207
+ * />
208
+ */
209
+ declare const PeekInFooter: React.FC<TypePeekInFooterProps>;
210
+
135
211
  declare const PeekInPanel: React.FC<TypePeekInPanelProps>;
136
212
 
213
+ /**
214
+ * Marks the element that opens the PeekIn.
215
+ *
216
+ * This is a slot marker, not a renderer. PeekIn reads `children` off this
217
+ * element and wires it up itself — as the Modal's trigger on desktop, and as a
218
+ * click-handled clone on mobile — so this component is never mounted on either
219
+ * path. It renders its children only as a defensive fallback for direct use.
220
+ */
137
221
  declare const PeekInTrigger: React.FC<TypePeekInTriggerProps>;
138
222
 
139
223
  /**
@@ -150,4 +234,4 @@ declare const PeekIn: {
150
234
  displayName: string;
151
235
  };
152
236
 
153
- export { PeekIn, PeekInContent, PeekInHeader, PeekInPanel, PeekInTrigger, type TypePeekInActionProps, type TypePeekInContentProps, type TypePeekInHeaderProps, type TypePeekInPanelProps, type TypePeekInPanelToggleConfig, type TypePeekInProps, type TypePeekInTriggerProps };
237
+ export { PeekIn, PeekInContent, PeekInFooter, PeekInHeader, PeekInPanel, PeekInTrigger, type TypePeekInActionProps, type TypePeekInContentProps, type TypePeekInFooterProps, type TypePeekInHeaderProps, type TypePeekInPanelProps, type TypePeekInPanelToggleConfig, type TypePeekInProps, type TypePeekInTriggerProps };
package/dist/index.d.ts CHANGED
@@ -33,6 +33,15 @@ type TypePeekInPanelToggleConfig = {
33
33
  "aria-label"?: string;
34
34
  };
35
35
  type TypePeekInProps = (TypePeekInControlledProps | TypePeekInUncontrolledProps) & {
36
+ /**
37
+ * Accessible label for the overlay dialog.
38
+ *
39
+ * Takes precedence over the label derived from `PeekInHeader`'s `title`.
40
+ * Required whenever the header `title` is not a plain string — a `ReactNode`
41
+ * title cannot be read as text, so without this the dialog has no meaningful
42
+ * accessible name.
43
+ */
44
+ "aria-label"?: string;
36
45
  /** Aria label for the built-in close button */
37
46
  closeButtonAriaLabel?: string;
38
47
  /** Additional action buttons shown in the action bar alongside the close button */
@@ -71,6 +80,13 @@ type TypePeekInProps = (TypePeekInControlledProps | TypePeekInUncontrolledProps)
71
80
  interface TypePeekInHeaderProps {
72
81
  /** Title displayed on the left side of the header */
73
82
  title: React.ReactNode;
83
+ /**
84
+ * Secondary text rendered beneath the title.
85
+ *
86
+ * Also used as a last-resort accessible name for the overlay when it is a
87
+ * plain string and neither `aria-label` nor a string `title` is available.
88
+ */
89
+ subtitle?: React.ReactNode;
74
90
  /** If provided, renders a back arrow button before the title */
75
91
  onBack?: () => void;
76
92
  /** Action buttons rendered on the right side of the header */
@@ -123,17 +139,85 @@ interface TypePeekInPanelProps {
123
139
  actionsInHeader?: boolean;
124
140
  children: React.ReactNode;
125
141
  }
142
+ /**
143
+ * Props for PeekInFooter.
144
+ *
145
+ * Mirrors `TypeModalFooterProps` so Modal and PeekIn footers are learnable as
146
+ * one API. At least one of `primaryButton`, `cancelButton`, or `leftAction`
147
+ * must be supplied.
148
+ *
149
+ * Unlike ModalFooter this does not extend `TypeBoxProps`, matching the other
150
+ * PeekIn sub-components, which take domain props only.
151
+ */
152
+ type TypePeekInFooterProps = {
153
+ /**
154
+ * Whether clicking the primary button closes the PeekIn.
155
+ * Set to `false` when the primary action is async and the overlay should stay
156
+ * open until it completes.
157
+ * @default true
158
+ */
159
+ closeOnPrimaryAction?: boolean;
160
+ } & ({
161
+ /** Primary action, right-aligned. Closes the PeekIn unless `closeOnPrimaryAction` is false. */
162
+ primaryButton: React.ReactNode;
163
+ /** Cancel/secondary action, right-aligned. Always closes the PeekIn. */
164
+ cancelButton?: React.ReactNode;
165
+ /** Action pinned to the far left (e.g. Delete). Never closes the PeekIn. */
166
+ leftAction?: React.ReactNode;
167
+ } | {
168
+ primaryButton?: React.ReactNode;
169
+ cancelButton: React.ReactNode;
170
+ leftAction?: React.ReactNode;
171
+ } | {
172
+ primaryButton?: React.ReactNode;
173
+ cancelButton?: React.ReactNode;
174
+ leftAction: React.ReactNode;
175
+ });
126
176
  interface TypePeekInTriggerProps {
127
177
  /** Element that opens the PeekIn when clicked */
128
178
  children: React.ReactNode;
129
179
  }
130
180
 
181
+ /**
182
+ * Header for PeekIn's main column.
183
+ *
184
+ * Layout comes from the seeds-peek-in-* classes in peek-in.css rather than
185
+ * styled-system props on Box, so the header is Box-free on both render paths
186
+ * and the desktop header row matches how PeekInTailwind lays out the mobile
187
+ * bottom-sheet header. The title, subtitle, and back button still come from
188
+ * the composed Seeds primitives, which own their own styling.
189
+ */
131
190
  declare const PeekInHeader: React.FC<TypePeekInHeaderProps>;
132
191
 
133
192
  declare const PeekInContent: React.FC<TypePeekInContentProps>;
134
193
 
194
+ /**
195
+ * Footer for PeekIn's main column, holding the overlay's primary actions.
196
+ *
197
+ * Slot behavior matches ModalFooter exactly:
198
+ * - `cancelButton` always closes
199
+ * - `primaryButton` closes unless `closeOnPrimaryAction` is false
200
+ * - `leftAction` never closes — the consumer owns it
201
+ *
202
+ * @example
203
+ * <PeekInFooter
204
+ * leftAction={<Button appearance="destructive">Delete</Button>}
205
+ * cancelButton={<Button>Cancel</Button>}
206
+ * primaryButton={<Button appearance="primary">Save</Button>}
207
+ * />
208
+ */
209
+ declare const PeekInFooter: React.FC<TypePeekInFooterProps>;
210
+
135
211
  declare const PeekInPanel: React.FC<TypePeekInPanelProps>;
136
212
 
213
+ /**
214
+ * Marks the element that opens the PeekIn.
215
+ *
216
+ * This is a slot marker, not a renderer. PeekIn reads `children` off this
217
+ * element and wires it up itself — as the Modal's trigger on desktop, and as a
218
+ * click-handled clone on mobile — so this component is never mounted on either
219
+ * path. It renders its children only as a defensive fallback for direct use.
220
+ */
137
221
  declare const PeekInTrigger: React.FC<TypePeekInTriggerProps>;
138
222
 
139
223
  /**
@@ -150,4 +234,4 @@ declare const PeekIn: {
150
234
  displayName: string;
151
235
  };
152
236
 
153
- export { PeekIn, PeekInContent, PeekInHeader, PeekInPanel, PeekInTrigger, type TypePeekInActionProps, type TypePeekInContentProps, type TypePeekInHeaderProps, type TypePeekInPanelProps, type TypePeekInPanelToggleConfig, type TypePeekInProps, type TypePeekInTriggerProps };
237
+ export { PeekIn, PeekInContent, PeekInFooter, PeekInHeader, PeekInPanel, PeekInTrigger, type TypePeekInActionProps, type TypePeekInContentProps, type TypePeekInFooterProps, type TypePeekInHeaderProps, type TypePeekInPanelProps, type TypePeekInPanelToggleConfig, type TypePeekInProps, type TypePeekInTriggerProps };