@nimbus-ds/patterns 1.36.0 → 1.38.1

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.ts CHANGED
@@ -133,6 +133,191 @@ export type AppShellMenuContextValue = {
133
133
  * @throws If `enforce=true` and used without a provider.
134
134
  */
135
135
  export declare const useAppShellMenuContext: (enforce?: boolean) => AppShellMenuContextValue;
136
+ export type BottomSheetPadding = "none" | "base";
137
+ /**
138
+ * A snap point expressed as a viewport-height percentage (e.g. "60%") or the
139
+ * keyword "full" (edge-to-edge, covering the full viewport height).
140
+ */
141
+ export type BottomSheetSnapPoint = `${number}%` | "full";
142
+ /**
143
+ * Predicate variant of `closeOnOutsidePress`: receives the DOM event and
144
+ * returns `true` to allow closing, `false` to ignore the press.
145
+ */
146
+ export type CloseOnOutsidePress = (event: PointerEvent | MouseEvent) => boolean;
147
+ export interface BottomSheetProperties {
148
+ /**
149
+ * Determines if the bottom sheet is shown or not.
150
+ * @default false
151
+ */
152
+ open?: boolean;
153
+ /**
154
+ * Callback fired when the component requests to be closed (overlay press,
155
+ * close control, Escape, or a downward dismiss gesture).
156
+ * () => void;
157
+ */
158
+ onRemove?: () => void;
159
+ /**
160
+ * Ordered list of heights the sheet can snap to. Each entry is a
161
+ * viewport-height percentage (e.g. "60%") or the keyword "full".
162
+ * @default ["60%", "90%", "full"]
163
+ */
164
+ snapPoints?: BottomSheetSnapPoint[];
165
+ /**
166
+ * Index within `snapPoints` used as the initial snap point.
167
+ * @default 0
168
+ */
169
+ defaultSnap?: number;
170
+ /**
171
+ * Content of the sheet. Compose with BottomSheet.Header, BottomSheet.Body
172
+ * and BottomSheet.Footer.
173
+ * @TJS-type React.ReactNode
174
+ */
175
+ children?: ReactNode;
176
+ /**
177
+ * Controls whether pressing outside should close the sheet.
178
+ * - boolean: enable/disable dismissal on outside press
179
+ * - function: receive the DOM event and return true to allow closing
180
+ * @default true
181
+ */
182
+ closeOnOutsidePress?: boolean | CloseOnOutsidePress;
183
+ /**
184
+ * The attribute name to ignore when checking for outside presses, so
185
+ * portaled Popover/Modal content does not close the sheet.
186
+ * @default "data-nimbus-outside-press-ignore"
187
+ */
188
+ ignoreAttributeName?: string;
189
+ /**
190
+ * Determines if background scroll is locked while the sheet is open.
191
+ * @default true
192
+ */
193
+ needRemoveScroll?: boolean;
194
+ /**
195
+ * Accessible name (`aria-label`) for the drag grabber. Override for
196
+ * non-English locales, since the built-in default is English-only.
197
+ * @default "Drag to resize or dismiss"
198
+ */
199
+ grabberLabel?: string;
200
+ /**
201
+ * Explicit z-index for the sheet layer. Omitted by default: like Nimbus's
202
+ * own Sidebar/Modal/Popover, the sheet relies on DOM mount order rather
203
+ * than a z-index. Its portal mounts into the nearest Nimbus
204
+ * <ThemeProvider>'s own wrapper element (the same container
205
+ * Sidebar/Modal/Popover portal into), falling back to document.body only
206
+ * when no ThemeProvider is present. In both cases, later-mounted siblings
207
+ * paint on top of earlier ones as long as neither sets a z-index, so this
208
+ * keeps the sheet correctly stacked against Popover and other BottomSheet
209
+ * instances. Only set this to force a specific stacking order against
210
+ * something outside that convention.
211
+ */
212
+ zIndex?: number;
213
+ }
214
+ /**
215
+ * Public props for `BottomSheet`. Combines `BottomSheetProperties` (the
216
+ * sheet's own behavior — visibility, snap points, dismissal, stacking) with
217
+ * `root` and every native `div` attribute except `color`.
218
+ */
219
+ export type BottomSheetProps = BottomSheetProperties & {
220
+ /**
221
+ * Root element where the portal should be mounted. When provided and not
222
+ * null, the portal renders inside this element. Otherwise it renders into
223
+ * the nearest Nimbus <ThemeProvider>'s own wrapper element (same as
224
+ * Sidebar/Modal/Popover), so it inherits the active theme's CSS custom
225
+ * properties and stacks correctly against them; it falls back to
226
+ * document.body only when no ThemeProvider is present. Useful to scope the
227
+ * sheet within a container (e.g., AppShell.Chat).
228
+ */
229
+ root?: HTMLElement | null;
230
+ } & Omit<HTMLAttributes<HTMLDivElement>, "color">;
231
+ export interface BottomSheetHeaderProperties {
232
+ /**
233
+ * The content of the sheet header. Accepts any node (title, actions, icons).
234
+ * @TJS-type React.ReactNode
235
+ */
236
+ children?: ReactNode;
237
+ /**
238
+ * The padding around the header content area.
239
+ * @default base
240
+ */
241
+ padding?: BottomSheetPadding;
242
+ }
243
+ /**
244
+ * Public props for `BottomSheet.Header`. Combines `BottomSheetHeaderProperties`
245
+ * with every native element attribute except `color` (same reason as
246
+ * `BottomSheetProps`: it conflicts with Box's own color-token sprinkle).
247
+ */
248
+ export type BottomSheetHeaderProps = BottomSheetHeaderProperties & Omit<HTMLAttributes<HTMLElement>, "color">;
249
+ export interface BottomSheetBodyProperties {
250
+ /**
251
+ * The scrollable content of the sheet.
252
+ * @TJS-type React.ReactNode
253
+ */
254
+ children: ReactNode;
255
+ /**
256
+ * The padding around the body content area.
257
+ * @default base
258
+ */
259
+ padding?: BottomSheetPadding;
260
+ }
261
+ /**
262
+ * Public props for `BottomSheet.Body`. Combines `BottomSheetBodyProperties`
263
+ * (`children` is required, unlike `Header`'s) with every native element
264
+ * attribute except `color`.
265
+ */
266
+ export type BottomSheetBodyProps = BottomSheetBodyProperties & Omit<HTMLAttributes<HTMLElement>, "color">;
267
+ export interface BottomSheetFooterProperties {
268
+ /**
269
+ * The content of the sheet footer.
270
+ * @TJS-type React.ReactNode
271
+ */
272
+ children: ReactNode;
273
+ /**
274
+ * The padding around the footer content area.
275
+ * @default base
276
+ */
277
+ padding?: BottomSheetPadding;
278
+ }
279
+ /**
280
+ * Public props for `BottomSheet.Footer`. Combines `BottomSheetFooterProperties`
281
+ * (`children` is required, same as `Body`) with every native element
282
+ * attribute except `color`. `BottomSheet.Footer` itself is optional to
283
+ * render at all — omitting it entirely is how a sheet renders without a
284
+ * footer region.
285
+ */
286
+ export type BottomSheetFooterProps = BottomSheetFooterProperties & Omit<HTMLAttributes<HTMLElement>, "color">;
287
+ /**
288
+ * The composable subcomponents attached to `BottomSheet`
289
+ * (`BottomSheet.Header`, `BottomSheet.Body`, `BottomSheet.Footer`), used to
290
+ * compose the sheet's `children`.
291
+ */
292
+ export interface BottomSheetComponents {
293
+ /** Chrome region above the body; the drag grabber is pinned above it. */
294
+ Header: FC<BottomSheetHeaderProps>;
295
+ /** The scrollable content region. */
296
+ Body: FC<BottomSheetBodyProps>;
297
+ /** Optional chrome region below the body (e.g. action buttons). */
298
+ Footer: FC<BottomSheetFooterProps>;
299
+ }
300
+ declare const BottomSheetBase: React.FC<BottomSheetProps>;
301
+ /**
302
+ * A mobile-first modal sheet that slides up from the bottom edge, with
303
+ * configurable snap points and a pointer-driven drag gesture to resize
304
+ * between them or dismiss by dragging down.
305
+ *
306
+ * Controlled via `open`/`onRemove`, the same contract as `Sidebar`: the
307
+ * component never changes its own visibility, it only requests to close (via
308
+ * overlay press, Escape, or a downward dismiss gesture) — the consumer sets
309
+ * `open` to `false` in response.
310
+ *
311
+ * Compose with `BottomSheet.Header` (optional), `BottomSheet.Body`
312
+ * (required), and `BottomSheet.Footer` (optional) as `children`.
313
+ *
314
+ * Behaves as a modal: renders as `role="dialog"`/`aria-modal="true"`, dims
315
+ * and blocks the background, traps focus while open, and restores it to the
316
+ * previously focused element on close. Automatically labels the dialog via
317
+ * `aria-labelledby` pointing at `BottomSheet.Header` when one is present;
318
+ * pass an explicit `aria-label`/`aria-labelledby` to override that.
319
+ */
320
+ export declare const BottomSheet: typeof BottomSheetBase & BottomSheetComponents;
136
321
  export interface CalloutCardProperties {
137
322
  /**
138
323
  * CalloutCard color.
@@ -734,12 +919,7 @@ export interface MenuProperties {
734
919
  }
735
920
  export type MenuProps = MenuProperties & Omit<HTMLAttributes<HTMLElement>, "color">;
736
921
  export declare const Menu: React.FC<MenuProps> & MenuComponents;
737
- export interface NavTabsItemProperties {
738
- /**
739
- * Icon element to be rendered inside the button.
740
- * @TJS-type React.ReactNode
741
- */
742
- icon: ReactNode;
922
+ export interface NavTabsItemBaseProperties {
743
923
  /**
744
924
  * Controls whether the button is active or not.
745
925
  */
@@ -758,7 +938,30 @@ export interface NavTabsItemProperties {
758
938
  */
759
939
  ariaLabel: string;
760
940
  }
761
- export type NavTabsItemProps = NavTabsItemProperties & Omit<BoxProperties, "onClick"> & Omit<HTMLAttributes<HTMLElement>, "color">;
941
+ export interface NavTabsItemNeutralProperties extends NavTabsItemBaseProperties {
942
+ /**
943
+ * Visual variant of the button.
944
+ * "ai-generative" renders a fixed AI icon with a gradient border and does not accept a custom `icon`.
945
+ * @default "neutral"
946
+ */
947
+ appearance?: "neutral";
948
+ /**
949
+ * Icon element to be rendered inside the button.
950
+ * @TJS-type React.ReactNode
951
+ */
952
+ icon: ReactNode;
953
+ }
954
+ export interface NavTabsItemAIGenerativeProperties extends Omit<NavTabsItemBaseProperties, "active"> {
955
+ /**
956
+ * Visual variant of the button.
957
+ * "ai-generative" renders a fixed AI icon with a gradient border and does not accept a custom `icon`.
958
+ */
959
+ appearance: "ai-generative";
960
+ icon?: never;
961
+ active?: never;
962
+ }
963
+ export type NavTabsItemVariantProperties = NavTabsItemNeutralProperties | NavTabsItemAIGenerativeProperties;
964
+ export type NavTabsItemProps = NavTabsItemVariantProperties & Omit<BoxProperties, "onClick"> & Omit<HTMLAttributes<HTMLElement>, "color">;
762
965
  declare const NavTabsItem: React.FC<NavTabsItemProps>;
763
966
  export interface NavTabsComponents {
764
967
  Item: typeof NavTabsItem;