@hyphen/hyphen-components 7.8.0 → 7.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.
@@ -243,9 +243,26 @@ function useSidebar(sideOverride?: SidebarSide) {
243
243
  const SidebarProvider = forwardRef<
244
244
  HTMLDivElement,
245
245
  React.ComponentProps<'div'> & {
246
+ /**
247
+ * Initial open state for uncontrolled usage. Pass a boolean for both
248
+ * sides, or `{ left, right }` to set each side independently.
249
+ */
246
250
  defaultOpen?: SidebarOpenValue;
251
+ /**
252
+ * Controlled open state. Pass a boolean for both sides, or
253
+ * `{ left, right }` to control each side independently.
254
+ */
247
255
  open?: SidebarOpenValue;
256
+ /**
257
+ * localStorage key(s) the open state is written to when a sidebar is
258
+ * toggled. A string applies to the left sidebar, with `_right` appended
259
+ * for the right sidebar; pass `{ left, right }` to set each explicitly.
260
+ */
248
261
  storageKey?: SidebarStorageKey;
262
+ /**
263
+ * Called when a sidebar is toggled, with the new open state and which
264
+ * side was toggled.
265
+ */
249
266
  onOpenChange?: (open: boolean, side?: SidebarSide) => void;
250
267
  }
251
268
  >(
@@ -368,7 +385,15 @@ SidebarProvider.displayName = 'SidebarProvider';
368
385
  const Sidebar = React.forwardRef<
369
386
  HTMLDivElement,
370
387
  React.ComponentProps<'div'> & {
388
+ /**
389
+ * Which edge of the viewport the sidebar is attached to.
390
+ */
371
391
  side?: 'left' | 'right';
392
+ /**
393
+ * Collapse behavior when the sidebar is toggled closed: slide fully out
394
+ * of view (`offcanvas`), collapse to a narrow icon strip (`icon`), or
395
+ * stay at full width (`none`).
396
+ */
372
397
  collapsible?: 'offcanvas' | 'icon' | 'none';
373
398
  }
374
399
  >(
@@ -498,7 +523,14 @@ Sidebar.displayName = 'Sidebar';
498
523
  const SidebarTrigger = React.forwardRef<
499
524
  React.ElementRef<typeof Button>,
500
525
  React.ComponentProps<typeof Button> & {
526
+ /**
527
+ * Which sidebar to toggle. Defaults to the side of the containing
528
+ * Sidebar, or `left` outside of one.
529
+ */
501
530
  side?: SidebarSide;
531
+ /**
532
+ * Icon shown on the trigger button.
533
+ */
502
534
  iconName?: IconName;
503
535
  }
504
536
  >(({ className, onClick, side, iconName = 'dock-left', ...props }, ref) => {
@@ -642,8 +674,18 @@ SidebarMenuItem.displayName = 'SidebarMenuItem';
642
674
  const SidebarMenuButton = React.forwardRef<
643
675
  HTMLButtonElement,
644
676
  React.ComponentProps<'button'> & {
677
+ /**
678
+ * Render the child element (e.g. a router link) instead of a `button`.
679
+ */
645
680
  asChild?: boolean;
681
+ /**
682
+ * Marks the item as the current page.
683
+ */
646
684
  isActive?: boolean;
685
+ /**
686
+ * Tooltip shown when the sidebar is collapsed to icons (desktop only).
687
+ * Pass a string, or TooltipContent props for full control.
688
+ */
647
689
  tooltip?: string | React.ComponentProps<typeof TooltipContent>;
648
690
  }
649
691
  >(