beez-ui 0.9.0 → 0.10.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.
@@ -39,6 +39,8 @@ export interface FilterPresetSaveButtonProps {
39
39
  /** Saves the current query under the given name. Returns `false` when there is no query to save. */
40
40
  onSaveCurrentQuery: (presetName: string) => boolean;
41
41
  labels?: Partial<FilterPresetLabels>;
42
+ /** Classes of the icon button, for example to adapt it to the action slot of an input. */
43
+ className?: string;
42
44
  }
43
45
  /**
44
46
  * Compact icon button that saves the current query as a named preset. Fits the action slot of
@@ -46,7 +48,7 @@ export interface FilterPresetSaveButtonProps {
46
48
  * @param props - Save availability, save callback and optional labels.
47
49
  * @returns The button and its naming popover.
48
50
  */
49
- export declare function FilterPresetSaveButton({ canSaveCurrentQuery, onSaveCurrentQuery, labels }: FilterPresetSaveButtonProps): import("react").JSX.Element;
51
+ export declare function FilterPresetSaveButton({ canSaveCurrentQuery, onSaveCurrentQuery, labels, className }: FilterPresetSaveButtonProps): import("react").JSX.Element;
50
52
  export interface FilterPresetsBarProps {
51
53
  presets: readonly FilterPreset[];
52
54
  /** Qualifiers of the filter bar, offered as suggestions while editing a preset query. */
@@ -74,8 +74,8 @@ const CHIP_ICON_BUTTON_CLASS_NAME = "inline-flex cursor-pointer items-center bor
74
74
  * @returns The button and its naming popover.
75
75
  */
76
76
  export function FilterPresetSaveButton(t0) {
77
- const $ = _c(45);
78
- const { canSaveCurrentQuery, onSaveCurrentQuery, labels } = t0;
77
+ const $ = _c(46);
78
+ const { canSaveCurrentQuery, onSaveCurrentQuery, labels, className } = t0;
79
79
  let t1;
80
80
  if ($[0] !== labels) {
81
81
  t1 = {
@@ -138,7 +138,7 @@ export function FilterPresetSaveButton(t0) {
138
138
  t5 = $[8];
139
139
  }
140
140
  let t6;
141
- if ($[9] !== resolvedLabels.saveAction || $[10] !== t4) {
141
+ if ($[9] !== className || $[10] !== resolvedLabels.saveAction || $[11] !== t4) {
142
142
  t6 = /* @__PURE__ */ _jsx(TooltipTrigger, {
143
143
  asChild: true,
144
144
  children: /* @__PURE__ */ _jsx(PopoverTrigger, {
@@ -146,6 +146,7 @@ export function FilterPresetSaveButton(t0) {
146
146
  children: /* @__PURE__ */ _jsx(Button, {
147
147
  "data-slot": "filter-preset-save-button",
148
148
  "aria-label": resolvedLabels.saveAction,
149
+ className,
149
150
  disabled: t4,
150
151
  size: "icon-xs",
151
152
  type: "button",
@@ -154,56 +155,57 @@ export function FilterPresetSaveButton(t0) {
154
155
  })
155
156
  })
156
157
  });
157
- $[9] = resolvedLabels.saveAction;
158
- $[10] = t4;
159
- $[11] = t6;
158
+ $[9] = className;
159
+ $[10] = resolvedLabels.saveAction;
160
+ $[11] = t4;
161
+ $[12] = t6;
160
162
  } else {
161
- t6 = $[11];
163
+ t6 = $[12];
162
164
  }
163
165
  let t7;
164
- if ($[12] !== resolvedLabels.saveAction) {
166
+ if ($[13] !== resolvedLabels.saveAction) {
165
167
  t7 = /* @__PURE__ */ _jsx(TooltipContent, { children: resolvedLabels.saveAction });
166
- $[12] = resolvedLabels.saveAction;
167
- $[13] = t7;
168
+ $[13] = resolvedLabels.saveAction;
169
+ $[14] = t7;
168
170
  } else {
169
- t7 = $[13];
171
+ t7 = $[14];
170
172
  }
171
173
  let t8;
172
- if ($[14] !== t6 || $[15] !== t7) {
174
+ if ($[15] !== t6 || $[16] !== t7) {
173
175
  t8 = /* @__PURE__ */ _jsxs(Tooltip, { children: [t6, t7] });
174
- $[14] = t6;
175
- $[15] = t7;
176
- $[16] = t8;
176
+ $[15] = t6;
177
+ $[16] = t7;
178
+ $[17] = t8;
177
179
  } else {
178
- t8 = $[16];
180
+ t8 = $[17];
179
181
  }
180
182
  let t9;
181
- if ($[17] !== nameInputId || $[18] !== resolvedLabels.presetName) {
183
+ if ($[18] !== nameInputId || $[19] !== resolvedLabels.presetName) {
182
184
  t9 = /* @__PURE__ */ _jsx(Label, {
183
185
  htmlFor: nameInputId,
184
186
  children: resolvedLabels.presetName
185
187
  });
186
- $[17] = nameInputId;
187
- $[18] = resolvedLabels.presetName;
188
- $[19] = t9;
188
+ $[18] = nameInputId;
189
+ $[19] = resolvedLabels.presetName;
190
+ $[20] = t9;
189
191
  } else {
190
- t9 = $[19];
192
+ t9 = $[20];
191
193
  }
192
194
  let t10;
193
- if ($[20] !== error) {
195
+ if ($[21] !== error) {
194
196
  t10 = (event) => {
195
197
  setNameDraft(event.target.value);
196
198
  if (error) {
197
199
  setError(null);
198
200
  }
199
201
  };
200
- $[20] = error;
201
- $[21] = t10;
202
+ $[21] = error;
203
+ $[22] = t10;
202
204
  } else {
203
- t10 = $[21];
205
+ t10 = $[22];
204
206
  }
205
207
  let t11;
206
- if ($[22] !== handleConfirmSave) {
208
+ if ($[23] !== handleConfirmSave) {
207
209
  t11 = (event_0) => {
208
210
  if (event_0.key !== ENTER_KEY) {
209
211
  return;
@@ -211,13 +213,13 @@ export function FilterPresetSaveButton(t0) {
211
213
  event_0.preventDefault();
212
214
  handleConfirmSave();
213
215
  };
214
- $[22] = handleConfirmSave;
215
- $[23] = t11;
216
+ $[23] = handleConfirmSave;
217
+ $[24] = t11;
216
218
  } else {
217
- t11 = $[23];
219
+ t11 = $[24];
218
220
  }
219
221
  let t12;
220
- if ($[24] !== nameDraft || $[25] !== nameInputId || $[26] !== resolvedLabels.presetNamePlaceholder || $[27] !== t10 || $[28] !== t11) {
222
+ if ($[25] !== nameDraft || $[26] !== nameInputId || $[27] !== resolvedLabels.presetNamePlaceholder || $[28] !== t10 || $[29] !== t11) {
221
223
  t12 = /* @__PURE__ */ _jsx(Input, {
222
224
  id: nameInputId,
223
225
  onChange: t10,
@@ -226,29 +228,29 @@ export function FilterPresetSaveButton(t0) {
226
228
  type: "text",
227
229
  value: nameDraft
228
230
  });
229
- $[24] = nameDraft;
230
- $[25] = nameInputId;
231
- $[26] = resolvedLabels.presetNamePlaceholder;
232
- $[27] = t10;
233
- $[28] = t11;
234
- $[29] = t12;
231
+ $[25] = nameDraft;
232
+ $[26] = nameInputId;
233
+ $[27] = resolvedLabels.presetNamePlaceholder;
234
+ $[28] = t10;
235
+ $[29] = t11;
236
+ $[30] = t12;
235
237
  } else {
236
- t12 = $[29];
238
+ t12 = $[30];
237
239
  }
238
240
  let t13;
239
- if ($[30] !== error) {
241
+ if ($[31] !== error) {
240
242
  t13 = error ? /* @__PURE__ */ _jsx("p", {
241
243
  className: ERROR_CLASS_NAME,
242
244
  role: "alert",
243
245
  children: error
244
246
  }) : null;
245
- $[30] = error;
246
- $[31] = t13;
247
+ $[31] = error;
248
+ $[32] = t13;
247
249
  } else {
248
- t13 = $[31];
250
+ t13 = $[32];
249
251
  }
250
252
  let t14;
251
- if ($[32] !== handleConfirmSave || $[33] !== resolvedLabels.saveConfirm || $[34] !== resolvedLabels.saveConfirmAriaLabel) {
253
+ if ($[33] !== handleConfirmSave || $[34] !== resolvedLabels.saveConfirm || $[35] !== resolvedLabels.saveConfirmAriaLabel) {
252
254
  t14 = /* @__PURE__ */ _jsx(Button, {
253
255
  "aria-label": resolvedLabels.saveConfirmAriaLabel,
254
256
  onClick: handleConfirmSave,
@@ -256,15 +258,15 @@ export function FilterPresetSaveButton(t0) {
256
258
  type: "button",
257
259
  children: resolvedLabels.saveConfirm
258
260
  });
259
- $[32] = handleConfirmSave;
260
- $[33] = resolvedLabels.saveConfirm;
261
- $[34] = resolvedLabels.saveConfirmAriaLabel;
262
- $[35] = t14;
261
+ $[33] = handleConfirmSave;
262
+ $[34] = resolvedLabels.saveConfirm;
263
+ $[35] = resolvedLabels.saveConfirmAriaLabel;
264
+ $[36] = t14;
263
265
  } else {
264
- t14 = $[35];
266
+ t14 = $[36];
265
267
  }
266
268
  let t15;
267
- if ($[36] !== t12 || $[37] !== t13 || $[38] !== t14 || $[39] !== t9) {
269
+ if ($[37] !== t12 || $[38] !== t13 || $[39] !== t14 || $[40] !== t9) {
268
270
  t15 = /* @__PURE__ */ _jsxs(PopoverContent, {
269
271
  align: "end",
270
272
  className: FORM_POPOVER_CLASS_NAME,
@@ -275,27 +277,27 @@ export function FilterPresetSaveButton(t0) {
275
277
  t14
276
278
  ]
277
279
  });
278
- $[36] = t12;
279
- $[37] = t13;
280
- $[38] = t14;
281
- $[39] = t9;
282
- $[40] = t15;
280
+ $[37] = t12;
281
+ $[38] = t13;
282
+ $[39] = t14;
283
+ $[40] = t9;
284
+ $[41] = t15;
283
285
  } else {
284
- t15 = $[40];
286
+ t15 = $[41];
285
287
  }
286
288
  let t16;
287
- if ($[41] !== isOpen || $[42] !== t15 || $[43] !== t8) {
289
+ if ($[42] !== isOpen || $[43] !== t15 || $[44] !== t8) {
288
290
  t16 = /* @__PURE__ */ _jsxs(Popover, {
289
291
  onOpenChange: handleOpenChange,
290
292
  open: isOpen,
291
293
  children: [t8, t15]
292
294
  });
293
- $[41] = isOpen;
294
- $[42] = t15;
295
- $[43] = t8;
296
- $[44] = t16;
295
+ $[42] = isOpen;
296
+ $[43] = t15;
297
+ $[44] = t8;
298
+ $[45] = t16;
297
299
  } else {
298
- t16 = $[44];
300
+ t16 = $[45];
299
301
  }
300
302
  return t16;
301
303
  }
@@ -1,5 +1,5 @@
1
1
  /** Cross-fades between states of the same region, such as idle, loading and result. */
2
- import type { ReactNode } from "react";
2
+ import { type ReactNode } from "react";
3
3
  declare const PRESENCE_SWAP_ELEMENTS: {
4
4
  readonly div: import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>;
5
5
  readonly span: import("motion/react").ForwardRefComponent<HTMLSpanElement, import("motion/react").HTMLMotionProps<"span">>;
@@ -1,5 +1,7 @@
1
1
  "use client";
2
2
  import { c as _c } from "react/compiler-runtime";
3
+ /** Cross-fades between states of the same region, such as idle, loading and result. */
4
+ import { useState } from "react";
3
5
  import { AnimatePresence, motion, useIsPresent } from "motion/react";
4
6
  import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
5
7
  import { cn } from "../lib/utils.js";
@@ -20,8 +22,12 @@ function PresenceSwapItem(t0) {
20
22
  const { as, className, children } = t0;
21
23
  const MotionElement = PRESENCE_SWAP_ELEMENTS[as];
22
24
  const isPresent = useIsPresent();
25
+ const [isMountedExiting] = useState(!isPresent);
23
26
  const shouldReduceMotion = usePrefersReducedMotion();
24
27
  const distance = shouldReduceMotion ? 0 : MOTION_CONTENT_DISTANCE;
28
+ if (isMountedExiting) {
29
+ return null;
30
+ }
25
31
  const t1 = isPresent ? undefined : true;
26
32
  const t2 = !isPresent || undefined;
27
33
  let t3;
@@ -98,6 +104,47 @@ function PresenceSwapItem(t0) {
98
104
  return t8;
99
105
  }
100
106
  /**
107
+ * Gives every key change its own presence key. Motion keeps the exit bookkeeping of a key that
108
+ * already left, so a reused key (loading → error → loading) mounted already exiting would have
109
+ * its removal ignored and stall a `wait` swap forever.
110
+ * @param presenceKey - Key identifying the current state.
111
+ * @returns A key that is never reused within this swap.
112
+ */
113
+ function usePresenceSwapKey(presenceKey) {
114
+ const $ = _c(5);
115
+ let t0;
116
+ if ($[0] !== presenceKey) {
117
+ t0 = {
118
+ presenceKey,
119
+ generation: 0
120
+ };
121
+ $[0] = presenceKey;
122
+ $[1] = t0;
123
+ } else {
124
+ t0 = $[1];
125
+ }
126
+ const [current, setCurrent] = useState(t0);
127
+ if (current.presenceKey !== presenceKey) {
128
+ const t1 = current.generation + 1;
129
+ let t2;
130
+ if ($[2] !== presenceKey || $[3] !== t1) {
131
+ t2 = {
132
+ presenceKey,
133
+ generation: t1
134
+ };
135
+ $[2] = presenceKey;
136
+ $[3] = t1;
137
+ $[4] = t2;
138
+ } else {
139
+ t2 = $[4];
140
+ }
141
+ const next = t2;
142
+ setCurrent(next);
143
+ return `${next.generation}:${presenceKey}`;
144
+ }
145
+ return `${current.generation}:${presenceKey}`;
146
+ }
147
+ /**
101
148
  * Swaps keyed content with a short lift-and-fade; the first render is not animated.
102
149
  * @param props - Key identifying the current state and its content.
103
150
  * @returns The animated content.
@@ -107,6 +154,7 @@ export function PresenceSwap(t0) {
107
154
  const { presenceKey, children, as: t1, className, mode: t2 } = t0;
108
155
  const as = t1 === undefined ? "div" : t1;
109
156
  const mode = t2 === undefined ? "wait" : t2;
157
+ const itemKey = usePresenceSwapKey(presenceKey);
110
158
  const t3 = as === "span" && "inline-flex items-center";
111
159
  let t4;
112
160
  if ($[0] !== className || $[1] !== t3) {
@@ -118,15 +166,15 @@ export function PresenceSwap(t0) {
118
166
  t4 = $[2];
119
167
  }
120
168
  let t5;
121
- if ($[3] !== as || $[4] !== children || $[5] !== presenceKey || $[6] !== t4) {
169
+ if ($[3] !== as || $[4] !== children || $[5] !== itemKey || $[6] !== t4) {
122
170
  t5 = /* @__PURE__ */ _jsx(PresenceSwapItem, {
123
171
  as,
124
172
  className: t4,
125
173
  children
126
- }, presenceKey);
174
+ }, itemKey);
127
175
  $[3] = as;
128
176
  $[4] = children;
129
- $[5] = presenceKey;
177
+ $[5] = itemKey;
130
178
  $[6] = t4;
131
179
  $[7] = t5;
132
180
  } else {
@@ -1,71 +1,158 @@
1
+ /**
2
+ * Animated application sidebar adapted from beui.dev/components/motion/animated-sidebar: the rail
3
+ * morphs its width with a spring, labels fade out of the icon rail, a shared pill follows the
4
+ * hovered and active items, submenus unfold with a stagger, and small screens get a focus-trapped
5
+ * sheet. Links route through the `BeezUIProvider` adapter and the open state keeps the
6
+ * `sidebar_state` cookie contract read by server entrypoints.
7
+ */
1
8
  import * as React from "react";
2
- import { type VariantProps } from "class-variance-authority";
3
- import { Button } from "./button.js";
4
- import { Input } from "./input.js";
5
- import { Separator } from "./separator.js";
6
- import { TooltipContent } from "./tooltip.js";
7
- type SidebarContextProps = {
8
- state: "expanded" | "collapsed";
9
+ import { type HTMLMotionProps } from "motion/react";
10
+ type SidebarState = "expanded" | "collapsed";
11
+ type SidebarSide = "left" | "right";
12
+ type SidebarVariant = "sidebar" | "floating" | "inset";
13
+ type SidebarCollapsible = "offcanvas" | "icon" | "none";
14
+ type SidebarLinkTarget = "_blank" | "_self" | "_parent" | "_top";
15
+ type SidebarContextValue = {
16
+ isMobile: boolean;
17
+ layoutId: string;
18
+ /** Sheet width; the sheet is portaled outside the wrapper that declares the CSS variables. */
19
+ mobileWidth: string;
9
20
  open: boolean;
10
- setOpen: (open: boolean) => void;
11
21
  openMobile: boolean;
22
+ reduce: boolean;
23
+ setOpen: (open: boolean) => void;
12
24
  setOpenMobile: (open: boolean) => void;
13
- isMobile: boolean;
25
+ state: SidebarState;
14
26
  toggleSidebar: () => void;
27
+ triggerRef: React.RefObject<HTMLButtonElement | null>;
28
+ };
29
+ /**
30
+ * Reads the sidebar state shared by `SidebarProvider`.
31
+ * @returns Open state for desktop and mobile, viewport and motion flags, and state setters.
32
+ */
33
+ declare function useSidebar(): SidebarContextValue;
34
+ type SidebarProviderStyle = React.CSSProperties & {
35
+ "--sidebar-width"?: string;
36
+ "--sidebar-width-icon"?: string;
37
+ "--sidebar-width-mobile"?: string;
15
38
  };
16
- declare function useSidebar(): SidebarContextProps;
17
- declare function SidebarProvider({ defaultOpen, storageKey, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }: React.ComponentProps<"div"> & {
39
+ export type SidebarProviderProps = React.ComponentProps<"div"> & {
40
+ /** Controlled desktop state. */
41
+ open?: boolean;
42
+ /** Desktop state before any interaction; server entrypoints pass the `sidebar_state` cookie here. */
18
43
  defaultOpen?: boolean;
44
+ onOpenChange?: (open: boolean) => void;
45
+ /** Controlled state of the small-screen sheet. */
46
+ openMobile?: boolean;
47
+ defaultOpenMobile?: boolean;
48
+ onOpenMobileChange?: (open: boolean) => void;
19
49
  /** Opts into local persistence without changing the shared SSR cookie contract. */
20
50
  storageKey?: string;
21
- open?: boolean;
22
- onOpenChange?: (open: boolean) => void;
23
- }): React.JSX.Element;
24
- declare function Sidebar({ side, variant, collapsible, className, children, dir, ...props }: React.ComponentProps<"div"> & {
25
- side?: "left" | "right";
26
- variant?: "sidebar" | "floating" | "inset";
27
- collapsible?: "offcanvas" | "icon" | "none";
28
- }): React.JSX.Element;
29
- declare function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
30
- declare function SidebarRail({ className, ...props }: React.ComponentProps<"button">): React.JSX.Element;
31
- declare function SidebarInset({ className, ...props }: React.ComponentProps<"main">): React.JSX.Element;
32
- declare function SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>): React.JSX.Element;
51
+ style?: SidebarProviderStyle;
52
+ };
53
+ /**
54
+ * Owns the open state of the sidebar, the ⌘B / Ctrl+B shortcut and the layout wrapper.
55
+ * @param props - Controlled or default state for both viewports, persistence key and wrapper attributes.
56
+ * @returns The wrapper that lays out the sidebar next to its inset.
57
+ */
58
+ declare function SidebarProvider({ children, open: openProp, defaultOpen, onOpenChange, openMobile: openMobileProp, defaultOpenMobile, onOpenMobileChange, storageKey, className, style, ...props }: SidebarProviderProps): React.JSX.Element;
59
+ export type SidebarProps = Omit<HTMLMotionProps<"aside">, "children"> & {
60
+ children?: React.ReactNode;
61
+ side?: SidebarSide;
62
+ variant?: SidebarVariant;
63
+ /** `icon` shrinks to an icon rail, `offcanvas` slides away, `none` stays expanded on every viewport. */
64
+ collapsible?: SidebarCollapsible;
65
+ ariaLabel?: string;
66
+ /** Classes of the inner panel that paints the sidebar surface. */
67
+ panelClassName?: string;
68
+ };
69
+ /**
70
+ * Renders the sidebar: a width-morphing rail on desktop and a sheet on small screens.
71
+ * @param props - Side, variant, collapse mode, accessible name and panel classes.
72
+ * @returns The desktop rail, the mobile sheet portal, or an always-expanded panel.
73
+ */
74
+ declare function Sidebar({ side, variant, collapsible, ariaLabel, children, className, panelClassName, style, ...props }: SidebarProps): React.JSX.Element;
75
+ /**
76
+ * Button that toggles the desktop rail or the mobile sheet; shows a panel icon unless given children.
77
+ * @param props - Native button attributes.
78
+ * @returns The toggle button.
79
+ */
80
+ declare function SidebarTrigger({ children, className, onClick, ref, type, ...props }: React.ComponentProps<"button">): React.JSX.Element;
81
+ /**
82
+ * Button that closes the sidebar on the current viewport.
83
+ * @param props - Native button attributes; the content is the consumer's icon or text.
84
+ * @returns The close button.
85
+ */
86
+ declare function SidebarClose({ className, onClick, type, ...props }: React.ComponentProps<"button">): React.JSX.Element;
87
+ /**
88
+ * Thin hit area on the sidebar edge that toggles it with the pointer.
89
+ * @param props - Native button attributes.
90
+ * @returns The rail button, outside the tab order.
91
+ */
92
+ declare function SidebarRail({ className, onClick, type, ...props }: React.ComponentProps<"button">): React.JSX.Element;
93
+ /**
94
+ * Main content area laid out next to the sidebar.
95
+ * @param props - Motion-enabled `main` attributes.
96
+ * @returns The content landmark.
97
+ */
98
+ declare function SidebarInset({ className, ...props }: HTMLMotionProps<"main">): React.JSX.Element;
33
99
  declare function SidebarHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
34
- declare function SidebarFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
35
- declare function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>): React.JSX.Element;
36
100
  declare function SidebarContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
101
+ declare function SidebarFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
37
102
  declare function SidebarGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
38
- declare function SidebarGroupLabel({ className, asChild, ...props }: React.ComponentProps<"div"> & {
39
- asChild?: boolean;
40
- }): React.JSX.Element;
41
- declare function SidebarGroupAction({ className, asChild, ...props }: React.ComponentProps<"button"> & {
42
- asChild?: boolean;
43
- }): React.JSX.Element;
103
+ /** Section heading that fades out of the icon rail and is hidden from assistive technology there. */
104
+ declare function SidebarGroupLabel({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
44
105
  declare function SidebarGroupContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
106
+ /** Menu list whose items share a hover pill that glides between them. */
45
107
  declare function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
46
- declare function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">): React.JSX.Element;
47
- declare const sidebarMenuButtonVariants: (props?: ({
48
- variant?: "default" | "outline" | null | undefined;
49
- size?: "default" | "lg" | "sm" | null | undefined;
50
- } & import("class-variance-authority/types").ClassProp) | undefined) => string;
51
- declare function SidebarMenuButton({ asChild, isActive, variant, size, tooltip, className, ...props }: React.ComponentProps<"button"> & {
52
- asChild?: boolean;
53
- isActive?: boolean;
54
- tooltip?: string | React.ComponentProps<typeof TooltipContent>;
55
- } & VariantProps<typeof sidebarMenuButtonVariants>): React.JSX.Element;
56
- declare function SidebarMenuAction({ className, asChild, showOnHover, ...props }: React.ComponentProps<"button"> & {
57
- asChild?: boolean;
58
- showOnHover?: boolean;
59
- }): React.JSX.Element;
60
- declare function SidebarMenuBadge({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
61
- declare function SidebarMenuSkeleton({ className, showIcon, ...props }: React.ComponentProps<"div"> & {
62
- showIcon?: boolean;
63
- }): React.JSX.Element;
64
- declare function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
65
- declare function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<"li">): React.JSX.Element;
66
- declare function SidebarMenuSubButton({ asChild, size, isActive, className, ...props }: React.ComponentProps<"a"> & {
67
- asChild?: boolean;
68
- size?: "sm" | "md";
108
+ declare function SidebarMenuItem({ className, ...props }: HTMLMotionProps<"li">): React.JSX.Element;
109
+ export type SidebarMenuSubProps = Omit<HTMLMotionProps<"ul">, "children"> & {
110
+ /** Whether the submenu is unfolded; it never renders inside the icon rail. */
111
+ open: boolean;
112
+ children?: React.ReactNode;
113
+ };
114
+ /**
115
+ * Nested list that unfolds with a clip and staggered items.
116
+ * @param props - Open state and motion-enabled list attributes.
117
+ * @returns The submenu while open and the sidebar is expanded.
118
+ */
119
+ declare function SidebarMenuSub({ open, children, className, ...props }: SidebarMenuSubProps): React.JSX.Element;
120
+ declare function SidebarMenuSubItem({ className, ...props }: HTMLMotionProps<"li">): React.JSX.Element;
121
+ type SidebarActionProps = {
122
+ children: React.ReactNode;
123
+ icon?: React.ReactNode;
124
+ /** Renders a link through the `BeezUIProvider` routing adapter instead of a button. */
125
+ href?: string;
69
126
  isActive?: boolean;
70
- }): React.JSX.Element;
71
- export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar, };
127
+ disabled?: boolean;
128
+ target?: SidebarLinkTarget;
129
+ rel?: string;
130
+ onSelect?: () => void;
131
+ className?: string;
132
+ };
133
+ export type SidebarMenuSubButtonProps = SidebarActionProps & {
134
+ /** Closes the mobile sheet after selecting; on by default. */
135
+ closeOnSelect?: boolean;
136
+ };
137
+ /**
138
+ * Submenu entry; shows a dot when no icon is given.
139
+ * @param props - Label, icon, link or select handler, active and disabled state.
140
+ * @returns The submenu link or button.
141
+ */
142
+ declare function SidebarMenuSubButton({ children, icon, href, isActive, disabled, closeOnSelect, target, rel, onSelect, className, }: SidebarMenuSubButtonProps): React.JSX.Element;
143
+ export type SidebarMenuButtonProps = SidebarActionProps & {
144
+ /** Trailing content such as a counter, hidden in the icon rail. */
145
+ badge?: React.ReactNode;
146
+ /** Marks the button as a submenu toggle and shows a rotating chevron. */
147
+ ariaExpanded?: boolean;
148
+ /** Closes the mobile sheet after selecting; defaults to on, except for submenu toggles. */
149
+ closeOnSelect?: boolean;
150
+ };
151
+ /**
152
+ * Top-level menu entry: the active one carries a pill that glides between entries, and the label
153
+ * fades out of the icon rail, leaving a string label as accessible name and native tooltip.
154
+ * @param props - Label, icon, badge, link or select handler, submenu and active state.
155
+ * @returns The menu link or button.
156
+ */
157
+ declare function SidebarMenuButton({ children, icon, badge, href, isActive, ariaExpanded, disabled, closeOnSelect, target, rel, onSelect, className, }: SidebarMenuButtonProps): React.JSX.Element;
158
+ export { Sidebar, SidebarClose, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarTrigger, useSidebar, };