beez-ui 0.10.0 → 2.0.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/CHANGELOG.md +40 -1
- package/README.md +63 -16
- package/THIRD_PARTY_NOTICES.md +31 -0
- package/assets/fonts/ibmplexmono-LICENSE.txt +93 -93
- package/assets/fonts/{poppins-LICENSE.txt → inter-LICENSE.txt} +2 -2
- package/assets/fonts/inter-latin-variable.woff2 +0 -0
- package/dist/components/account-menu.d.ts +5 -2
- package/dist/components/account-menu.js +150 -145
- package/dist/components/alert-dialog.d.ts +4 -2
- package/dist/components/alert-dialog.js +78 -66
- package/dist/components/animated-collapse.js +106 -36
- package/dist/components/button-interaction.d.ts +23 -0
- package/dist/components/button-interaction.js +22 -0
- package/dist/components/button-label.d.ts +8 -0
- package/dist/components/button-label.js +322 -0
- package/dist/components/button.d.ts +23 -10
- package/dist/components/button.js +111 -64
- package/dist/components/calendar.d.ts +2 -2
- package/dist/components/calendar.js +4 -4
- package/dist/components/carousel.d.ts +3 -3
- package/dist/components/carousel.js +3 -3
- package/dist/components/control-button.d.ts +16 -0
- package/dist/components/control-button.js +215 -0
- package/dist/components/data-table.js +7 -7
- package/dist/components/dialog.js +3 -2
- package/dist/components/dropdown-menu.js +1 -1
- package/dist/components/file-upload.js +5 -5
- package/dist/components/filter-presets-bar.js +6 -6
- package/dist/components/filter-query-bar.js +2 -2
- package/dist/components/input-group.d.ts +2 -2
- package/dist/components/input-group.js +2 -2
- package/dist/components/pagination.d.ts +2 -2
- package/dist/components/pagination.js +2 -2
- package/dist/components/reaction-button.js +2 -2
- package/dist/components/rich-link-editor.js +7 -7
- package/dist/components/rich-text-content.js +1 -1
- package/dist/components/sheet.js +2 -2
- package/dist/components/sidebar-panel-context.d.ts +17 -0
- package/dist/components/sidebar-panel-context.js +14 -0
- package/dist/components/sidebar.d.ts +40 -3
- package/dist/components/sidebar.js +259 -103
- package/dist/components/typing-animation.js +1 -1
- package/dist/constants/button.d.ts +16 -0
- package/dist/constants/button.js +16 -0
- package/dist/hooks/use-sidebar-persistence.d.ts +1 -1
- package/dist/hooks/use-sidebar-persistence.js +2 -2
- package/dist/motion/arc-press.d.ts +6 -0
- package/dist/motion/arc-press.js +59 -0
- package/dist/motion/arc-tokens.d.ts +32 -0
- package/dist/motion/arc-tokens.js +42 -0
- package/dist/providers/beez-ui-provider.d.ts +1 -1
- package/dist/providers/beez-ui-provider.js +6 -1
- package/dist/styles.css +1 -1
- package/fonts.css +5 -5
- package/package.json +3 -2
- package/styles.css +4 -4
- package/theme.css +248 -87
- package/assets/fonts/poppins-latin-600.woff2 +0 -0
|
@@ -11,7 +11,7 @@ import { cn } from "../lib/utils.js";
|
|
|
11
11
|
import { classifyFiles } from "../lib/file-acceptance.js";
|
|
12
12
|
import { formatFileSize } from "../lib/format-file-size.js";
|
|
13
13
|
import { AnimatedListItem } from "./animated-list-item.js";
|
|
14
|
-
import {
|
|
14
|
+
import { ControlButton } from "./control-button.js";
|
|
15
15
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
const COMPLETE_PROGRESS = 100;
|
|
17
17
|
const FILE_UPLOAD_DROP_ZONE_DEFAULT_LABELS = {
|
|
@@ -236,8 +236,8 @@ export function FileUploadDropZone(t0) {
|
|
|
236
236
|
}
|
|
237
237
|
let t22;
|
|
238
238
|
if ($[38] !== isDisabled || $[39] !== resolvedLabels.uploadAction || $[40] !== t20 || $[41] !== t21) {
|
|
239
|
-
t22 = /* @__PURE__ */ _jsxs(
|
|
240
|
-
className: "h-auto p-0 font-
|
|
239
|
+
t22 = /* @__PURE__ */ _jsxs(ControlButton, {
|
|
240
|
+
className: "h-auto p-0 font-medium",
|
|
241
241
|
disabled: isDisabled,
|
|
242
242
|
type: "button",
|
|
243
243
|
variant: "link",
|
|
@@ -575,7 +575,7 @@ export function FileUploadItem(t0) {
|
|
|
575
575
|
}
|
|
576
576
|
let t20;
|
|
577
577
|
if ($[45] !== isDeleteDisabled || $[46] !== name || $[47] !== onDelete || $[48] !== resolvedLabels.delete) {
|
|
578
|
-
t20 = onDelete ? /* @__PURE__ */ _jsx(
|
|
578
|
+
t20 = onDelete ? /* @__PURE__ */ _jsx(ControlButton, {
|
|
579
579
|
"aria-label": `${resolvedLabels.delete} ${name}`,
|
|
580
580
|
className: "-mt-2 -mr-2 self-start text-muted-foreground",
|
|
581
581
|
disabled: isDeleteDisabled,
|
|
@@ -607,7 +607,7 @@ export function FileUploadItem(t0) {
|
|
|
607
607
|
}
|
|
608
608
|
let t22;
|
|
609
609
|
if ($[53] !== clampedProgress || $[54] !== failed || $[55] !== isFillVariant || $[56] !== onRetry || $[57] !== progressBarProps || $[58] !== resolvedLabels.retry) {
|
|
610
|
-
t22 = failed ? onRetry ? /* @__PURE__ */ _jsx(
|
|
610
|
+
t22 = failed ? onRetry ? /* @__PURE__ */ _jsx(ControlButton, {
|
|
611
611
|
className: "mt-1.5 h-auto p-0 text-destructive",
|
|
612
612
|
size: "sm",
|
|
613
613
|
type: "button",
|
|
@@ -7,7 +7,7 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
7
7
|
import { useId, useState } from "react";
|
|
8
8
|
import { Bookmark, Pencil, X } from "lucide-react";
|
|
9
9
|
import { cn } from "../lib/utils.js";
|
|
10
|
-
import {
|
|
10
|
+
import { ControlButton } from "./control-button.js";
|
|
11
11
|
import { FilterQueryBar } from "./filter-query-bar.js";
|
|
12
12
|
import { Input } from "./input.js";
|
|
13
13
|
import { Label } from "./label.js";
|
|
@@ -143,7 +143,7 @@ export function FilterPresetSaveButton(t0) {
|
|
|
143
143
|
asChild: true,
|
|
144
144
|
children: /* @__PURE__ */ _jsx(PopoverTrigger, {
|
|
145
145
|
asChild: true,
|
|
146
|
-
children: /* @__PURE__ */ _jsx(
|
|
146
|
+
children: /* @__PURE__ */ _jsx(ControlButton, {
|
|
147
147
|
"data-slot": "filter-preset-save-button",
|
|
148
148
|
"aria-label": resolvedLabels.saveAction,
|
|
149
149
|
className,
|
|
@@ -251,7 +251,7 @@ export function FilterPresetSaveButton(t0) {
|
|
|
251
251
|
}
|
|
252
252
|
let t14;
|
|
253
253
|
if ($[33] !== handleConfirmSave || $[34] !== resolvedLabels.saveConfirm || $[35] !== resolvedLabels.saveConfirmAriaLabel) {
|
|
254
|
-
t14 = /* @__PURE__ */ _jsx(
|
|
254
|
+
t14 = /* @__PURE__ */ _jsx(ControlButton, {
|
|
255
255
|
"aria-label": resolvedLabels.saveConfirmAriaLabel,
|
|
256
256
|
onClick: handleConfirmSave,
|
|
257
257
|
size: "sm",
|
|
@@ -450,7 +450,7 @@ export function FilterPresetsBar(t0) {
|
|
|
450
450
|
role: "alert",
|
|
451
451
|
children: editError
|
|
452
452
|
}) : null,
|
|
453
|
-
/* @__PURE__ */ _jsx(
|
|
453
|
+
/* @__PURE__ */ _jsx(ControlButton, {
|
|
454
454
|
"aria-label": resolvedLabels.editConfirmAriaLabel,
|
|
455
455
|
onClick: handleConfirmEdit,
|
|
456
456
|
size: "sm",
|
|
@@ -479,13 +479,13 @@ export function FilterPresetsBar(t0) {
|
|
|
479
479
|
children: resolvedLabels.deleteConfirmation(preset_1.name)
|
|
480
480
|
}), /* @__PURE__ */ _jsxs("div", {
|
|
481
481
|
className: "flex justify-end gap-2",
|
|
482
|
-
children: [/* @__PURE__ */ _jsx(
|
|
482
|
+
children: [/* @__PURE__ */ _jsx(ControlButton, {
|
|
483
483
|
onClick: () => setDeletingPresetName(null),
|
|
484
484
|
size: "sm",
|
|
485
485
|
type: "button",
|
|
486
486
|
variant: "outline",
|
|
487
487
|
children: resolvedLabels.cancel
|
|
488
|
-
}), /* @__PURE__ */ _jsx(
|
|
488
|
+
}), /* @__PURE__ */ _jsx(ControlButton, {
|
|
489
489
|
onClick: () => {
|
|
490
490
|
setDeletingPresetName(null);
|
|
491
491
|
onDeletePreset(preset_1.name);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { c as _c } from "react/compiler-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Calendar, Check, CircleDot, CircleMinus, CircleSlash, Folder, Hash, List, Type, User, X } from "lucide-react";
|
|
5
|
-
import {
|
|
5
|
+
import { ControlButton } from "./control-button.js";
|
|
6
6
|
import { Input } from "./input.js";
|
|
7
7
|
import { Popover, PopoverAnchor, PopoverContent } from "./popover.js";
|
|
8
8
|
import { GlideSlot } from "../motion/glide-slot.js";
|
|
@@ -708,7 +708,7 @@ export function FilterQueryBar(t0) {
|
|
|
708
708
|
}
|
|
709
709
|
let t31;
|
|
710
710
|
if ($[67] !== handleClear || $[68] !== value) {
|
|
711
|
-
t31 = value ? /* @__PURE__ */ _jsx(
|
|
711
|
+
t31 = value ? /* @__PURE__ */ _jsx(ControlButton, {
|
|
712
712
|
"aria-label": CLEAR_FILTER_ARIA_LABEL,
|
|
713
713
|
className: "active:-translate-y-0",
|
|
714
714
|
onClick: handleClear,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
|
-
import {
|
|
3
|
+
import { ControlButton } from "./control-button.js";
|
|
4
4
|
declare function InputGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
5
5
|
declare const inputGroupAddonVariants: (props?: ({
|
|
6
6
|
align?: "block-end" | "block-start" | "inline-end" | "inline-start" | null | undefined;
|
|
@@ -9,7 +9,7 @@ declare function InputGroupAddon({ className, align, ...props }: React.Component
|
|
|
9
9
|
declare const inputGroupButtonVariants: (props?: ({
|
|
10
10
|
size?: "icon-sm" | "icon-xs" | "sm" | "xs" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
|
-
declare function InputGroupButton({ className, type, variant, size, ...props }: Omit<React.ComponentProps<typeof
|
|
12
|
+
declare function InputGroupButton({ className, type, variant, size, ...props }: Omit<React.ComponentProps<typeof ControlButton>, "size"> & VariantProps<typeof inputGroupButtonVariants>): React.JSX.Element;
|
|
13
13
|
declare function InputGroupText({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
14
14
|
declare function InputGroupInput({ className, ...props }: React.ComponentProps<"input">): React.JSX.Element;
|
|
15
15
|
declare function InputGroupTextarea({ className, ...props }: React.ComponentProps<"textarea">): React.JSX.Element;
|
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
import { MotionSlot } from "../motion/motion-slot.js";
|
|
6
6
|
import { cn } from "../lib/utils.js";
|
|
7
|
-
import {
|
|
7
|
+
import { ControlButton } from "./control-button.js";
|
|
8
8
|
import { Input } from "./input.js";
|
|
9
9
|
import { Textarea } from "./textarea.js";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -153,7 +153,7 @@ function InputGroupButton(t0) {
|
|
|
153
153
|
}
|
|
154
154
|
let t5;
|
|
155
155
|
if ($[9] !== props || $[10] !== size || $[11] !== t4 || $[12] !== type || $[13] !== variant) {
|
|
156
|
-
t5 = /* @__PURE__ */ _jsx(
|
|
156
|
+
t5 = /* @__PURE__ */ _jsx(ControlButton, {
|
|
157
157
|
type,
|
|
158
158
|
"data-size": size,
|
|
159
159
|
variant,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type LinkProps } from "./link.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ControlButton } from "./control-button.js";
|
|
4
4
|
declare function Pagination({ className, ...props }: React.ComponentProps<"nav">): React.JSX.Element;
|
|
5
5
|
/** Lists page links; the current page's highlight glides to the newly selected page. */
|
|
6
6
|
declare function PaginationContent({ className, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
|
|
7
7
|
declare function PaginationItem({ ...props }: React.ComponentProps<"li">): React.JSX.Element;
|
|
8
8
|
export type PaginationLinkProps = {
|
|
9
9
|
isActive?: boolean;
|
|
10
|
-
} & Pick<React.ComponentProps<typeof
|
|
10
|
+
} & Pick<React.ComponentProps<typeof ControlButton>, "size"> & LinkProps;
|
|
11
11
|
declare function PaginationLink({ className, isActive, size, ...props }: PaginationLinkProps): React.JSX.Element;
|
|
12
12
|
declare function PaginationPrevious({ className, text, ...props }: React.ComponentProps<typeof PaginationLink> & {
|
|
13
13
|
text?: string;
|
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { Link } from "./link.js";
|
|
5
5
|
import { GlideSlot } from "../motion/glide-slot.js";
|
|
6
6
|
import { cn } from "../lib/utils.js";
|
|
7
|
-
import {
|
|
7
|
+
import { ControlButton } from "./control-button.js";
|
|
8
8
|
import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
function Pagination(t0) {
|
|
@@ -155,7 +155,7 @@ function PaginationLink(t0) {
|
|
|
155
155
|
}
|
|
156
156
|
let t6;
|
|
157
157
|
if ($[11] !== size || $[12] !== t2 || $[13] !== t3 || $[14] !== t5) {
|
|
158
|
-
t6 = /* @__PURE__ */ _jsx(
|
|
158
|
+
t6 = /* @__PURE__ */ _jsx(ControlButton, {
|
|
159
159
|
asChild: true,
|
|
160
160
|
variant: t2,
|
|
161
161
|
size,
|
|
@@ -6,7 +6,7 @@ import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js"
|
|
|
6
6
|
import { cn } from "../lib/utils.js";
|
|
7
7
|
import { MOTION_EASE, MOTION_TIMING } from "../motion/tokens.js";
|
|
8
8
|
import { AnimatedCount } from "./animated-count.js";
|
|
9
|
-
import {
|
|
9
|
+
import { ControlButton } from "./control-button.js";
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
/** Peak scale the icon reaches while popping into the active state. */
|
|
12
12
|
const REACTION_ICON_POP_SCALE = 1.28;
|
|
@@ -95,7 +95,7 @@ export function ReactionButton(t0) {
|
|
|
95
95
|
}
|
|
96
96
|
let t10;
|
|
97
97
|
if ($[12] !== activeColorStyle || $[13] !== ariaLabel || $[14] !== isActive || $[15] !== isDisabled || $[16] !== onClick || $[17] !== t4 || $[18] !== t5 || $[19] !== t8 || $[20] !== t9) {
|
|
98
|
-
t10 = /* @__PURE__ */ _jsxs(
|
|
98
|
+
t10 = /* @__PURE__ */ _jsxs(ControlButton, {
|
|
99
99
|
"data-slot": "reaction-button",
|
|
100
100
|
"data-active": t4,
|
|
101
101
|
"aria-label": ariaLabel,
|
|
@@ -4,7 +4,7 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
4
4
|
import { useEffect, useRef } from "react";
|
|
5
5
|
import { cn } from "../lib/utils.js";
|
|
6
6
|
import { RICH_LINK_POPOVER_MODE, RICH_TEXT_EDITOR_KEY, RICH_TEXT_SEGMENT_TYPE } from "../lib/rich-text/link-markdown-constants.js";
|
|
7
|
-
import {
|
|
7
|
+
import { ControlButton } from "./control-button.js";
|
|
8
8
|
import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
const BUTTON_TYPE = "button";
|
|
@@ -22,11 +22,11 @@ const LINK_REL = "noreferrer";
|
|
|
22
22
|
const RICH_LINK_EDITOR_CLASS_NAMES = {
|
|
23
23
|
editor: "min-h-28 w-full cursor-text border-0 bg-background p-0 leading-[1.65] whitespace-pre-wrap text-foreground [font:inherit] [overflow-wrap:anywhere] focus:outline-0 empty:before:pointer-events-none empty:before:text-muted-foreground/75 empty:before:content-[attr(data-placeholder)] max-md:text-base",
|
|
24
24
|
editorInvalid: "rounded-[0.35rem] shadow-[inset_0_-2px_0_var(--destructive)] outline-0",
|
|
25
|
-
editorLink: "cursor-pointer rounded-[0.2rem] font-
|
|
25
|
+
editorLink: "cursor-pointer rounded-[0.2rem] font-medium text-primary underline decoration-[0.08em] underline-offset-[0.18em] transition-colors hover:text-[color-mix(in_oklab,var(--primary)_72%,var(--foreground))] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
26
26
|
popover: "gap-3",
|
|
27
27
|
editForm: "grid gap-3 animate-in fade-in slide-in-from-bottom-1 duration-200",
|
|
28
28
|
actions: "flex flex-wrap items-center gap-2",
|
|
29
|
-
label: "grid gap-[0.35rem] text-[0.85rem] font-
|
|
29
|
+
label: "grid gap-[0.35rem] text-[0.85rem] font-medium text-muted-foreground",
|
|
30
30
|
input: "min-h-8 rounded-lg border border-border/80 bg-background px-[0.65rem] font-normal text-foreground outline-0 transition-[border-color,box-shadow] [font:inherit] focus-visible:border-ring focus-visible:shadow-[0_0_0_3px_color-mix(in_oklab,var(--ring)_35%,transparent)] aria-invalid:border-destructive aria-invalid:focus-visible:shadow-[0_0_0_3px_color-mix(in_oklab,var(--destructive)_25%,transparent)] max-md:text-base"
|
|
31
31
|
};
|
|
32
32
|
const RICH_LINK_EDITOR_DEFAULT_COPY = {
|
|
@@ -176,14 +176,14 @@ export function RichLinkEditor(t0) {
|
|
|
176
176
|
onPaste: _temp5,
|
|
177
177
|
children: popoverMode === RICH_LINK_POPOVER_MODE.actions ? /* @__PURE__ */ _jsxs("div", {
|
|
178
178
|
className: RICH_LINK_EDITOR_CLASS_NAMES.actions,
|
|
179
|
-
children: [/* @__PURE__ */ _jsx(
|
|
179
|
+
children: [/* @__PURE__ */ _jsx(ControlButton, {
|
|
180
180
|
onClick: () => {
|
|
181
181
|
setPopoverMode(RICH_LINK_POPOVER_MODE.edit);
|
|
182
182
|
},
|
|
183
183
|
type: BUTTON_TYPE,
|
|
184
184
|
variant: BUTTON_VARIANT.ghost,
|
|
185
185
|
children: copy.editAction
|
|
186
|
-
}), /* @__PURE__ */ _jsx(
|
|
186
|
+
}), /* @__PURE__ */ _jsx(ControlButton, {
|
|
187
187
|
onClick: () => {
|
|
188
188
|
removeLink(segment);
|
|
189
189
|
},
|
|
@@ -221,7 +221,7 @@ export function RichLinkEditor(t0) {
|
|
|
221
221
|
}),
|
|
222
222
|
/* @__PURE__ */ _jsxs("div", {
|
|
223
223
|
className: RICH_LINK_EDITOR_CLASS_NAMES.actions,
|
|
224
|
-
children: [/* @__PURE__ */ _jsx(
|
|
224
|
+
children: [/* @__PURE__ */ _jsx(ControlButton, {
|
|
225
225
|
disabled: !isLinkEditValid,
|
|
226
226
|
onClick: () => {
|
|
227
227
|
if (activeLink) {
|
|
@@ -230,7 +230,7 @@ export function RichLinkEditor(t0) {
|
|
|
230
230
|
},
|
|
231
231
|
type: BUTTON_TYPE,
|
|
232
232
|
children: copy.editSave
|
|
233
|
-
}), /* @__PURE__ */ _jsx(
|
|
233
|
+
}), /* @__PURE__ */ _jsx(ControlButton, {
|
|
234
234
|
onClick: closeLinkPopover,
|
|
235
235
|
type: BUTTON_TYPE,
|
|
236
236
|
variant: BUTTON_VARIANT.outline,
|
|
@@ -16,7 +16,7 @@ export function RichTextContent({ content, onLinkClick, linkClassName }) {
|
|
|
16
16
|
const segments = parseRichTextSegments(content);
|
|
17
17
|
return /* @__PURE__ */ _jsx(_Fragment, { children: segments.map((segment, segmentIndex) => segment.type === RICH_TEXT_SEGMENT_TYPE.link ? /* @__PURE__ */ _jsx("a", {
|
|
18
18
|
"data-slot": "rich-text-link",
|
|
19
|
-
className: cn(RICH_TEXT_LINK_CLASS_NAME, "font-
|
|
19
|
+
className: cn(RICH_TEXT_LINK_CLASS_NAME, "font-medium decoration-[0.08em]", linkClassName),
|
|
20
20
|
href: segment.url,
|
|
21
21
|
onClick: onLinkClick,
|
|
22
22
|
rel: LINK_REL,
|
package/dist/components/sheet.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Dialog as SheetPrimitive } from "radix-ui";
|
|
|
5
5
|
import { MotionSlot } from "../motion/motion-slot.js";
|
|
6
6
|
import { MotionPresence, MotionOpenProvider, useMotionOpenState } from "../motion/presence.js";
|
|
7
7
|
import { cn } from "../lib/utils.js";
|
|
8
|
-
import {
|
|
8
|
+
import { ControlButton } from "./control-button.js";
|
|
9
9
|
import { XIcon } from "lucide-react";
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
function Sheet(t0) {
|
|
@@ -209,7 +209,7 @@ function SheetContent(t0) {
|
|
|
209
209
|
asChild: true,
|
|
210
210
|
children: /* @__PURE__ */ _jsx(MotionSlot, {
|
|
211
211
|
kind: "delayed-pop",
|
|
212
|
-
children: /* @__PURE__ */ _jsxs(
|
|
212
|
+
children: /* @__PURE__ */ _jsxs(ControlButton, {
|
|
213
213
|
variant: "ghost",
|
|
214
214
|
className: "absolute top-4 right-4",
|
|
215
215
|
size: "icon-sm",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal: panel state shared by the sidebar parts and by components that adapt to the icon rail
|
|
3
|
+
* (such as `AccountMenu`), kept apart so they can read it without importing the sidebar itself.
|
|
4
|
+
*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
export type SidebarPanelState = {
|
|
7
|
+
/** Whether the desktop sidebar is shrunk to its icon rail; always false in the mobile sheet. */
|
|
8
|
+
collapsed: boolean;
|
|
9
|
+
collapsible: "offcanvas" | "icon" | "none";
|
|
10
|
+
side: "left" | "right";
|
|
11
|
+
};
|
|
12
|
+
export declare const SidebarPanelContext: React.Context<SidebarPanelState | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Reads the panel state when rendered inside a `Sidebar`, and `null` anywhere else.
|
|
15
|
+
* @returns The panel state, or `null` outside a sidebar.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useOptionalSidebarPanel(): SidebarPanelState | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/**
|
|
3
|
+
* Internal: panel state shared by the sidebar parts and by components that adapt to the icon rail
|
|
4
|
+
* (such as `AccountMenu`), kept apart so they can read it without importing the sidebar itself.
|
|
5
|
+
*/
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
export const SidebarPanelContext = React.createContext(null);
|
|
8
|
+
/**
|
|
9
|
+
* Reads the panel state when rendered inside a `Sidebar`, and `null` anywhere else.
|
|
10
|
+
* @returns The panel state, or `null` outside a sidebar.
|
|
11
|
+
*/
|
|
12
|
+
export function useOptionalSidebarPanel() {
|
|
13
|
+
return React.use(SidebarPanelContext);
|
|
14
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { type HTMLMotionProps } from "motion/react";
|
|
10
|
+
import { type SidebarPanelState } from "./sidebar-panel-context.js";
|
|
10
11
|
type SidebarState = "expanded" | "collapsed";
|
|
11
12
|
type SidebarSide = "left" | "right";
|
|
12
13
|
type SidebarVariant = "sidebar" | "floating" | "inset";
|
|
@@ -31,6 +32,13 @@ type SidebarContextValue = {
|
|
|
31
32
|
* @returns Open state for desktop and mobile, viewport and motion flags, and state setters.
|
|
32
33
|
*/
|
|
33
34
|
declare function useSidebar(): SidebarContextValue;
|
|
35
|
+
/**
|
|
36
|
+
* Reads the state of the enclosing `Sidebar` panel, so product content can adapt to the icon rail
|
|
37
|
+
* without depending on its DOM attributes.
|
|
38
|
+
* @returns Whether the panel is collapsed to its icon rail (always false in the mobile sheet), its
|
|
39
|
+
* collapse mode and its side.
|
|
40
|
+
*/
|
|
41
|
+
declare function useSidebarPanel(): SidebarPanelState;
|
|
34
42
|
type SidebarProviderStyle = React.CSSProperties & {
|
|
35
43
|
"--sidebar-width"?: string;
|
|
36
44
|
"--sidebar-width-icon"?: string;
|
|
@@ -48,14 +56,18 @@ export type SidebarProviderProps = React.ComponentProps<"div"> & {
|
|
|
48
56
|
onOpenMobileChange?: (open: boolean) => void;
|
|
49
57
|
/** Opts into local persistence without changing the shared SSR cookie contract. */
|
|
50
58
|
storageKey?: string;
|
|
59
|
+
/** Cookie that keeps the desktop state for server entrypoints; defaults to `sidebar_state`. */
|
|
60
|
+
cookieName?: string;
|
|
61
|
+
/** Lifetime of that cookie in seconds; defaults to seven days. */
|
|
62
|
+
cookieMaxAge?: number;
|
|
51
63
|
style?: SidebarProviderStyle;
|
|
52
64
|
};
|
|
53
65
|
/**
|
|
54
66
|
* 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
|
|
67
|
+
* @param props - Controlled or default state for both viewports, persistence options and wrapper attributes.
|
|
56
68
|
* @returns The wrapper that lays out the sidebar next to its inset.
|
|
57
69
|
*/
|
|
58
|
-
declare function SidebarProvider({ children, open: openProp, defaultOpen, onOpenChange, openMobile: openMobileProp, defaultOpenMobile, onOpenMobileChange, storageKey, className, style, ...props }: SidebarProviderProps): React.JSX.Element;
|
|
70
|
+
declare function SidebarProvider({ children, open: openProp, defaultOpen, onOpenChange, openMobile: openMobileProp, defaultOpenMobile, onOpenMobileChange, storageKey, cookieName, cookieMaxAge, className, style, ...props }: SidebarProviderProps): React.JSX.Element;
|
|
59
71
|
export type SidebarProps = Omit<HTMLMotionProps<"aside">, "children"> & {
|
|
60
72
|
children?: React.ReactNode;
|
|
61
73
|
side?: SidebarSide;
|
|
@@ -99,6 +111,31 @@ declare function SidebarInset({ className, ...props }: HTMLMotionProps<"main">):
|
|
|
99
111
|
declare function SidebarHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
100
112
|
declare function SidebarContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
101
113
|
declare function SidebarFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
114
|
+
export type SidebarLabelProps = React.ComponentProps<"span"> & {
|
|
115
|
+
/** Renders the child element instead of a `span`, for example a paragraph. */
|
|
116
|
+
asChild?: boolean;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Product text that only makes sense in the expanded sidebar, such as a workspace name or an empty
|
|
120
|
+
* state: it leaves the layout while the panel is the icon rail and always shows in the mobile sheet.
|
|
121
|
+
* @param props - Span attributes, or `asChild` to keep the child element.
|
|
122
|
+
* @returns The content, or nothing in the icon rail.
|
|
123
|
+
*/
|
|
124
|
+
declare function SidebarLabel({ asChild, ...props }: SidebarLabelProps): React.JSX.Element | null;
|
|
125
|
+
export type SidebarBrandButtonProps = React.ComponentProps<"button"> & {
|
|
126
|
+
/** Square tile such as a logo or initials; it stays visible in the icon rail. */
|
|
127
|
+
icon: React.ReactNode;
|
|
128
|
+
/** Trailing affordance such as a chevron, hidden in the icon rail. */
|
|
129
|
+
trailing?: React.ReactNode;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Header row that identifies the workspace, often the trigger of a workspace switcher. It forwards
|
|
133
|
+
* its props and ref to the `button`, so it works as `DropdownMenuTrigger asChild`, and keeps its tile
|
|
134
|
+
* on the menu icon column while the label and trailing content leave in the icon rail.
|
|
135
|
+
* @param props - Tile, label, trailing content and native button attributes.
|
|
136
|
+
* @returns The brand button.
|
|
137
|
+
*/
|
|
138
|
+
declare function SidebarBrandButton({ icon, trailing, children, className, type, ...props }: SidebarBrandButtonProps): React.JSX.Element;
|
|
102
139
|
declare function SidebarGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
103
140
|
/** Section heading that fades out of the icon rail and is hidden from assistive technology there. */
|
|
104
141
|
declare function SidebarGroupLabel({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
@@ -155,4 +192,4 @@ export type SidebarMenuButtonProps = SidebarActionProps & {
|
|
|
155
192
|
* @returns The menu link or button.
|
|
156
193
|
*/
|
|
157
194
|
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, };
|
|
195
|
+
export { Sidebar, SidebarBrandButton, SidebarClose, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarTrigger, useSidebar, useSidebarPanel, };
|