@uipath/apollo-wind 2.63.0 → 2.65.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/components/forms/aria-ids.cjs +38 -0
- package/dist/components/forms/aria-ids.d.ts +2 -0
- package/dist/components/forms/aria-ids.js +4 -0
- package/dist/components/forms/demo-mocks.cjs +0 -448
- package/dist/components/forms/demo-mocks.js +0 -448
- package/dist/components/forms/field-control.cjs +21 -17
- package/dist/components/forms/field-control.d.ts +3 -1
- package/dist/components/forms/field-control.js +21 -17
- package/dist/components/forms/field-renderer.cjs +65 -37
- package/dist/components/forms/field-renderer.js +66 -38
- package/dist/components/forms/form-designer.cjs +204 -3
- package/dist/components/forms/form-designer.js +204 -3
- package/dist/components/forms/form-examples.cjs +3 -190
- package/dist/components/forms/form-examples.d.ts +0 -10
- package/dist/components/forms/form-examples.js +3 -184
- package/dist/components/forms/form-schema.d.ts +6 -0
- package/dist/components/forms/metadata-form.cjs +9 -1
- package/dist/components/forms/metadata-form.d.ts +8 -1
- package/dist/components/forms/metadata-form.js +9 -1
- package/dist/components/forms/mode-aware-field.cjs +11 -6
- package/dist/components/forms/mode-aware-field.d.ts +2 -0
- package/dist/components/forms/mode-aware-field.js +11 -6
- package/dist/components/forms/string-list-field.cjs +5 -4
- package/dist/components/forms/string-list-field.d.ts +4 -2
- package/dist/components/forms/string-list-field.js +5 -4
- package/dist/components/ui/index.cjs +77 -66
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/json-tree-view/JsonTree.types.d.ts +13 -0
- package/dist/components/ui/json-tree-view/JsonTreeRow.cjs +2 -1
- package/dist/components/ui/json-tree-view/JsonTreeRow.js +2 -1
- package/dist/components/ui/json-tree-view/JsonTypeBadge.cjs +43 -6
- package/dist/components/ui/json-tree-view/JsonTypeBadge.d.ts +6 -3
- package/dist/components/ui/json-tree-view/JsonTypeBadge.js +44 -7
- package/dist/components/ui/json-tree-view/index.d.ts +1 -1
- package/dist/components/ui/json-tree-view/strings.cjs +1 -0
- package/dist/components/ui/json-tree-view/strings.d.ts +10 -2
- package/dist/components/ui/json-tree-view/strings.js +1 -0
- package/dist/components/ui/prompt-value-control.cjs +3 -1
- package/dist/components/ui/prompt-value-control.d.ts +5 -0
- package/dist/components/ui/prompt-value-control.js +3 -1
- package/dist/components/ui/sidebar/index.cjs +113 -0
- package/dist/components/ui/sidebar/index.d.ts +10 -0
- package/dist/components/ui/sidebar/index.js +7 -0
- package/dist/components/ui/sidebar/sidebar-context.cjs +151 -0
- package/dist/components/ui/sidebar/sidebar-context.d.ts +39 -0
- package/dist/components/ui/sidebar/sidebar-context.js +108 -0
- package/dist/components/ui/sidebar/sidebar-group.cjs +87 -0
- package/dist/components/ui/sidebar/sidebar-group.d.ts +10 -0
- package/dist/components/ui/sidebar/sidebar-group.js +44 -0
- package/dist/components/ui/sidebar/sidebar-layout.cjs +92 -0
- package/dist/components/ui/sidebar/sidebar-layout.d.ts +7 -0
- package/dist/components/ui/sidebar/sidebar-layout.js +46 -0
- package/dist/components/ui/sidebar/sidebar-menu-sub.cjs +79 -0
- package/dist/components/ui/sidebar/sidebar-menu-sub.d.ts +11 -0
- package/dist/components/ui/sidebar/sidebar-menu-sub.js +39 -0
- package/dist/components/ui/sidebar/sidebar-menu.cjs +185 -0
- package/dist/components/ui/sidebar/sidebar-menu.d.ts +26 -0
- package/dist/components/ui/sidebar/sidebar-menu.js +133 -0
- package/dist/components/ui/sidebar/sidebar.cjs +220 -0
- package/dist/components/ui/sidebar/sidebar.d.ts +22 -0
- package/dist/components/ui/sidebar/sidebar.js +177 -0
- package/dist/components/ui/variable-value-control.cjs +3 -1
- package/dist/components/ui/variable-value-control.d.ts +5 -0
- package/dist/components/ui/variable-value-control.js +3 -1
- package/dist/index.cjs +94 -18
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -1
- package/dist/styles.css +647 -0
- package/package.json +1 -1
- package/dist/templates/Forms/form-builder-example.d.ts +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { JsonTreeNodeType } from './JsonTree.types';
|
|
2
|
+
import type { JsonTreeNodeType, NodeBadgeReference } from './JsonTree.types';
|
|
3
3
|
export interface JsonTypeBadgeProps {
|
|
4
4
|
type: JsonTreeNodeType;
|
|
5
5
|
/** Replaces the default type icon (e.g. a paperclip for file nodes). */
|
|
@@ -8,10 +8,13 @@ export interface JsonTypeBadgeProps {
|
|
|
8
8
|
className?: string;
|
|
9
9
|
/** Tooltip content on hover. Defaults to the capitalized type name. */
|
|
10
10
|
tooltip?: ReactNode;
|
|
11
|
+
/** Marks the value as a reference: adds a corner tab with an arrow. */
|
|
12
|
+
reference?: NodeBadgeReference;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* Compact badge for a JSON value type. Deliberately neutral: the value text
|
|
14
16
|
* carries the color coding, the badge only carries the type icon. Hovering it
|
|
15
|
-
* shows the type name (override via `tooltip`).
|
|
17
|
+
* shows the type name (override via `tooltip`). A `reference` adds a corner
|
|
18
|
+
* tab with an arrow; it has no hover state of its own, only the tooltip.
|
|
16
19
|
*/
|
|
17
|
-
export declare function JsonTypeBadge({ type, icon, className, tooltip }: JsonTypeBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function JsonTypeBadge({ type, icon, className, tooltip, reference }: JsonTypeBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowUpRight, Braces, Brackets, CircleSlash2, Hash, ToggleLeft, Type } from "lucide-react";
|
|
2
3
|
import { cn } from "../../../lib/index.js";
|
|
3
|
-
import { Braces, Brackets, CircleSlash2, Hash, ToggleLeft, Type } from "lucide-react";
|
|
4
4
|
import { JsonTreeTooltip } from "./JsonTreeTooltip.js";
|
|
5
|
+
import { useJsonTreeViewStrings } from "./strings.js";
|
|
5
6
|
const TYPE_ICON = {
|
|
6
7
|
string: Type,
|
|
7
8
|
number: Hash,
|
|
@@ -18,18 +19,54 @@ const TYPE_LABEL = {
|
|
|
18
19
|
array: 'Array',
|
|
19
20
|
null: 'Null'
|
|
20
21
|
};
|
|
21
|
-
function JsonTypeBadge({ type, icon, className, tooltip }) {
|
|
22
|
+
function JsonTypeBadge({ type, icon, className, tooltip, reference }) {
|
|
23
|
+
const strings = useJsonTreeViewStrings();
|
|
22
24
|
const DefaultIcon = TYPE_ICON[type];
|
|
23
|
-
|
|
25
|
+
const box = /*#__PURE__*/ jsx("span", {
|
|
26
|
+
className: cn('inline-flex h-4.5 min-w-4.5 shrink-0 items-center justify-center rounded border border-border bg-surface-overlay px-0.5 text-foreground-muted [&_svg]:size-2.75', className),
|
|
27
|
+
children: icon ?? /*#__PURE__*/ jsx(DefaultIcon, {})
|
|
28
|
+
});
|
|
29
|
+
if (!reference) return /*#__PURE__*/ jsx(JsonTreeTooltip, {
|
|
24
30
|
content: /*#__PURE__*/ jsx("span", {
|
|
25
31
|
className: "break-all font-mono text-xs font-semibold leading-4",
|
|
26
32
|
children: tooltip ?? TYPE_LABEL[type]
|
|
27
33
|
}),
|
|
28
34
|
placement: "top",
|
|
29
35
|
delay: true,
|
|
30
|
-
children:
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
children: box
|
|
37
|
+
});
|
|
38
|
+
const title = strings.referenceType(TYPE_LABEL[type]);
|
|
39
|
+
return /*#__PURE__*/ jsx(JsonTreeTooltip, {
|
|
40
|
+
content: tooltip ?? /*#__PURE__*/ jsxs("span", {
|
|
41
|
+
className: "flex flex-col gap-0.5 leading-4",
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ jsx("span", {
|
|
44
|
+
className: "text-xs font-semibold",
|
|
45
|
+
children: title
|
|
46
|
+
}),
|
|
47
|
+
reference.source && /*#__PURE__*/ jsx("span", {
|
|
48
|
+
className: "break-all text-xs text-foreground-muted",
|
|
49
|
+
children: reference.source
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
}),
|
|
53
|
+
placement: "top",
|
|
54
|
+
delay: true,
|
|
55
|
+
children: /*#__PURE__*/ jsxs("span", {
|
|
56
|
+
className: "relative inline-flex shrink-0 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
57
|
+
role: "img",
|
|
58
|
+
tabIndex: 0,
|
|
59
|
+
"aria-label": reference.source ? `${title}, ${reference.source}` : title,
|
|
60
|
+
children: [
|
|
61
|
+
box,
|
|
62
|
+
/*#__PURE__*/ jsx("span", {
|
|
63
|
+
className: "absolute -right-1 -bottom-1 grid size-3 place-items-center rounded-[3px] border border-border bg-surface-overlay text-foreground-muted",
|
|
64
|
+
children: /*#__PURE__*/ jsx(ArrowUpRight, {
|
|
65
|
+
className: "size-2.5",
|
|
66
|
+
strokeWidth: 3
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
]
|
|
33
70
|
})
|
|
34
71
|
});
|
|
35
72
|
}
|
|
@@ -7,4 +7,4 @@ export * from './JsonTree';
|
|
|
7
7
|
export * from './JsonTree.types';
|
|
8
8
|
export * from './JsonTreeToolbar';
|
|
9
9
|
export * from './JsonTypeBadge';
|
|
10
|
-
export { DEFAULT_JSON_TREE_VIEW_STRINGS, type JsonTreeViewStrings, JsonTreeViewProvider, type JsonTreeViewProviderProps, useJsonTreeViewStrings, } from './strings';
|
|
10
|
+
export { DEFAULT_JSON_TREE_VIEW_STRINGS, type JsonTreeViewStrings, JsonTreeViewProvider, type JsonTreeViewProviderProps, type ResolvedJsonTreeViewStrings, useJsonTreeViewStrings, } from './strings';
|
|
@@ -41,6 +41,7 @@ const DEFAULT_JSON_TREE_VIEW_STRINGS = {
|
|
|
41
41
|
itemCount: (count)=>1 === count ? '1 item' : `${count} items`,
|
|
42
42
|
keyCount: (count)=>1 === count ? '1 key' : `${count} keys`,
|
|
43
43
|
requiredMarker: 'required',
|
|
44
|
+
referenceType: (typeLabel)=>`${typeLabel} · reference`,
|
|
44
45
|
pathCopied: 'Path copied',
|
|
45
46
|
copyPathHint: 'Click to copy this path',
|
|
46
47
|
copyPathFor: (path)=>`Copy path for ${path}`,
|
|
@@ -16,6 +16,12 @@ export interface JsonTreeViewStrings {
|
|
|
16
16
|
keyCount: (count: number) => string;
|
|
17
17
|
/** Screen-reader text for the required-field marker. */
|
|
18
18
|
requiredMarker: string;
|
|
19
|
+
/**
|
|
20
|
+
* Type badge tooltip title for a reference, given the type name (e.g. "String").
|
|
21
|
+
* Optional so catalogs written before it was added still type-check; falls
|
|
22
|
+
* back to the English default.
|
|
23
|
+
*/
|
|
24
|
+
referenceType?: (typeLabel: string) => string;
|
|
19
25
|
pathCopied: string;
|
|
20
26
|
copyPathHint: string;
|
|
21
27
|
copyPathFor: (path: string) => string;
|
|
@@ -48,7 +54,9 @@ export interface JsonTreeViewStrings {
|
|
|
48
54
|
expandAll: string;
|
|
49
55
|
collapseAll: string;
|
|
50
56
|
}
|
|
51
|
-
|
|
57
|
+
/** Strings with every optional key filled in, as the tree parts read them. */
|
|
58
|
+
export type ResolvedJsonTreeViewStrings = Required<JsonTreeViewStrings>;
|
|
59
|
+
export declare const DEFAULT_JSON_TREE_VIEW_STRINGS: ResolvedJsonTreeViewStrings;
|
|
52
60
|
export interface JsonTreeViewProviderProps {
|
|
53
61
|
/** Overrides merged over any outer provider's strings, then the English defaults. */
|
|
54
62
|
strings?: Partial<JsonTreeViewStrings>;
|
|
@@ -61,5 +69,5 @@ export interface JsonTreeViewProviderProps {
|
|
|
61
69
|
* including the toolbar and editors when they are rendered on their own.
|
|
62
70
|
*/
|
|
63
71
|
export declare function JsonTreeViewProvider({ strings, tooltipContentClassName, children, }: JsonTreeViewProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
64
|
-
export declare function useJsonTreeViewStrings():
|
|
72
|
+
export declare function useJsonTreeViewStrings(): ResolvedJsonTreeViewStrings;
|
|
65
73
|
export declare function useJsonTreeViewTooltipClassName(): string | undefined;
|
|
@@ -10,6 +10,7 @@ const DEFAULT_JSON_TREE_VIEW_STRINGS = {
|
|
|
10
10
|
itemCount: (count)=>1 === count ? '1 item' : `${count} items`,
|
|
11
11
|
keyCount: (count)=>1 === count ? '1 key' : `${count} keys`,
|
|
12
12
|
requiredMarker: 'required',
|
|
13
|
+
referenceType: (typeLabel)=>`${typeLabel} · reference`,
|
|
13
14
|
pathCopied: 'Path copied',
|
|
14
15
|
copyPathHint: 'Click to copy this path',
|
|
15
16
|
copyPathFor: (path)=>`Copy path for ${path}`,
|
|
@@ -28,10 +28,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
});
|
|
29
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
30
|
const external_react_namespaceObject = require("react");
|
|
31
|
+
const aria_ids_cjs_namespaceObject = require("../forms/aria-ids.cjs");
|
|
31
32
|
const value_mode_strings_cjs_namespaceObject = require("./field-addons/value-mode-strings.cjs");
|
|
32
33
|
const external_textarea_cjs_namespaceObject = require("./textarea.cjs");
|
|
33
34
|
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
34
|
-
const PromptValueControl = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ id, name, value, onChange, onBlur, inputRef, disabled, placeholder, strings, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy }, ref)=>{
|
|
35
|
+
const PromptValueControl = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ id, name, value, onChange, onBlur, inputRef, disabled, placeholder, strings, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, controlProps }, ref)=>{
|
|
35
36
|
const text = {
|
|
36
37
|
...value_mode_strings_cjs_namespaceObject.DEFAULT_VALUE_MODE_STRINGS,
|
|
37
38
|
...strings
|
|
@@ -55,6 +56,7 @@ const PromptValueControl = /*#__PURE__*/ external_react_namespaceObject.forwardR
|
|
|
55
56
|
className: className,
|
|
56
57
|
"aria-label": ariaLabel,
|
|
57
58
|
"aria-labelledby": ariaLabelledBy,
|
|
59
|
+
"aria-describedby": (0, aria_ids_cjs_namespaceObject.joinIds)(ariaDescribedBy, controlProps?.['aria-describedby']),
|
|
58
60
|
rows: 1,
|
|
59
61
|
minRows: 1,
|
|
60
62
|
maxRows: 6
|
|
@@ -17,6 +17,11 @@ export interface PromptValueControlProps {
|
|
|
17
17
|
className?: string;
|
|
18
18
|
'aria-label'?: string;
|
|
19
19
|
'aria-labelledby'?: string;
|
|
20
|
+
'aria-describedby'?: string;
|
|
21
|
+
/** The value-mode wiring; its `aria-describedby` joins the control's own. */
|
|
22
|
+
controlProps?: {
|
|
23
|
+
'aria-describedby'?: string;
|
|
24
|
+
};
|
|
20
25
|
}
|
|
21
26
|
/**
|
|
22
27
|
* A prompt an agent fills the value from: a textarea that starts one line tall and grows to six.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useCallback, useMemo } from "react";
|
|
3
|
+
import { joinIds } from "../forms/aria-ids.js";
|
|
3
4
|
import { DEFAULT_VALUE_MODE_STRINGS } from "./field-addons/value-mode-strings.js";
|
|
4
5
|
import { Textarea } from "./textarea.js";
|
|
5
6
|
import { composeRefs } from "../../lib/index.js";
|
|
6
|
-
const PromptValueControl = /*#__PURE__*/ forwardRef(({ id, name, value, onChange, onBlur, inputRef, disabled, placeholder, strings, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy }, ref)=>{
|
|
7
|
+
const PromptValueControl = /*#__PURE__*/ forwardRef(({ id, name, value, onChange, onBlur, inputRef, disabled, placeholder, strings, className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, controlProps }, ref)=>{
|
|
7
8
|
const text = {
|
|
8
9
|
...DEFAULT_VALUE_MODE_STRINGS,
|
|
9
10
|
...strings
|
|
@@ -27,6 +28,7 @@ const PromptValueControl = /*#__PURE__*/ forwardRef(({ id, name, value, onChange
|
|
|
27
28
|
className: className,
|
|
28
29
|
"aria-label": ariaLabel,
|
|
29
30
|
"aria-labelledby": ariaLabelledBy,
|
|
31
|
+
"aria-describedby": joinIds(ariaDescribedBy, controlProps?.['aria-describedby']),
|
|
30
32
|
rows: 1,
|
|
31
33
|
minRows: 1,
|
|
32
34
|
maxRows: 6
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
SidebarFooter: ()=>external_sidebar_layout_cjs_namespaceObject.SidebarFooter,
|
|
28
|
+
SidebarMenuSub: ()=>external_sidebar_menu_sub_cjs_namespaceObject.SidebarMenuSub,
|
|
29
|
+
SidebarMenuSubButton: ()=>external_sidebar_menu_sub_cjs_namespaceObject.SidebarMenuSubButton,
|
|
30
|
+
SidebarProvider: ()=>external_sidebar_context_cjs_namespaceObject.SidebarProvider,
|
|
31
|
+
SidebarContent: ()=>external_sidebar_layout_cjs_namespaceObject.SidebarContent,
|
|
32
|
+
SidebarGroupAction: ()=>external_sidebar_group_cjs_namespaceObject.SidebarGroupAction,
|
|
33
|
+
SidebarHeader: ()=>external_sidebar_layout_cjs_namespaceObject.SidebarHeader,
|
|
34
|
+
SidebarMenuBadge: ()=>external_sidebar_menu_cjs_namespaceObject.SidebarMenuBadge,
|
|
35
|
+
SidebarMenuSkeleton: ()=>external_sidebar_menu_cjs_namespaceObject.SidebarMenuSkeleton,
|
|
36
|
+
SidebarMenu: ()=>external_sidebar_menu_cjs_namespaceObject.SidebarMenu,
|
|
37
|
+
Sidebar: ()=>external_sidebar_cjs_namespaceObject.Sidebar,
|
|
38
|
+
SidebarSeparator: ()=>external_sidebar_layout_cjs_namespaceObject.SidebarSeparator,
|
|
39
|
+
SidebarTrigger: ()=>external_sidebar_cjs_namespaceObject.SidebarTrigger,
|
|
40
|
+
SidebarGroupContent: ()=>external_sidebar_group_cjs_namespaceObject.SidebarGroupContent,
|
|
41
|
+
SidebarMenuItem: ()=>external_sidebar_menu_cjs_namespaceObject.SidebarMenuItem,
|
|
42
|
+
SidebarGroupLabel: ()=>external_sidebar_group_cjs_namespaceObject.SidebarGroupLabel,
|
|
43
|
+
sidebarMenuButtonVariants: ()=>external_sidebar_menu_cjs_namespaceObject.sidebarMenuButtonVariants,
|
|
44
|
+
useSidebar: ()=>external_sidebar_context_cjs_namespaceObject.useSidebar,
|
|
45
|
+
SidebarInput: ()=>external_sidebar_layout_cjs_namespaceObject.SidebarInput,
|
|
46
|
+
SidebarMenuButton: ()=>external_sidebar_menu_cjs_namespaceObject.SidebarMenuButton,
|
|
47
|
+
SidebarInset: ()=>external_sidebar_cjs_namespaceObject.SidebarInset,
|
|
48
|
+
SidebarMenuAction: ()=>external_sidebar_menu_cjs_namespaceObject.SidebarMenuAction,
|
|
49
|
+
SidebarMenuSubItem: ()=>external_sidebar_menu_sub_cjs_namespaceObject.SidebarMenuSubItem,
|
|
50
|
+
SidebarRail: ()=>external_sidebar_cjs_namespaceObject.SidebarRail,
|
|
51
|
+
SidebarGroup: ()=>external_sidebar_group_cjs_namespaceObject.SidebarGroup
|
|
52
|
+
});
|
|
53
|
+
const external_sidebar_cjs_namespaceObject = require("./sidebar.cjs");
|
|
54
|
+
const external_sidebar_context_cjs_namespaceObject = require("./sidebar-context.cjs");
|
|
55
|
+
const external_sidebar_group_cjs_namespaceObject = require("./sidebar-group.cjs");
|
|
56
|
+
const external_sidebar_layout_cjs_namespaceObject = require("./sidebar-layout.cjs");
|
|
57
|
+
const external_sidebar_menu_cjs_namespaceObject = require("./sidebar-menu.cjs");
|
|
58
|
+
const external_sidebar_menu_sub_cjs_namespaceObject = require("./sidebar-menu-sub.cjs");
|
|
59
|
+
exports.Sidebar = __webpack_exports__.Sidebar;
|
|
60
|
+
exports.SidebarContent = __webpack_exports__.SidebarContent;
|
|
61
|
+
exports.SidebarFooter = __webpack_exports__.SidebarFooter;
|
|
62
|
+
exports.SidebarGroup = __webpack_exports__.SidebarGroup;
|
|
63
|
+
exports.SidebarGroupAction = __webpack_exports__.SidebarGroupAction;
|
|
64
|
+
exports.SidebarGroupContent = __webpack_exports__.SidebarGroupContent;
|
|
65
|
+
exports.SidebarGroupLabel = __webpack_exports__.SidebarGroupLabel;
|
|
66
|
+
exports.SidebarHeader = __webpack_exports__.SidebarHeader;
|
|
67
|
+
exports.SidebarInput = __webpack_exports__.SidebarInput;
|
|
68
|
+
exports.SidebarInset = __webpack_exports__.SidebarInset;
|
|
69
|
+
exports.SidebarMenu = __webpack_exports__.SidebarMenu;
|
|
70
|
+
exports.SidebarMenuAction = __webpack_exports__.SidebarMenuAction;
|
|
71
|
+
exports.SidebarMenuBadge = __webpack_exports__.SidebarMenuBadge;
|
|
72
|
+
exports.SidebarMenuButton = __webpack_exports__.SidebarMenuButton;
|
|
73
|
+
exports.SidebarMenuItem = __webpack_exports__.SidebarMenuItem;
|
|
74
|
+
exports.SidebarMenuSkeleton = __webpack_exports__.SidebarMenuSkeleton;
|
|
75
|
+
exports.SidebarMenuSub = __webpack_exports__.SidebarMenuSub;
|
|
76
|
+
exports.SidebarMenuSubButton = __webpack_exports__.SidebarMenuSubButton;
|
|
77
|
+
exports.SidebarMenuSubItem = __webpack_exports__.SidebarMenuSubItem;
|
|
78
|
+
exports.SidebarProvider = __webpack_exports__.SidebarProvider;
|
|
79
|
+
exports.SidebarRail = __webpack_exports__.SidebarRail;
|
|
80
|
+
exports.SidebarSeparator = __webpack_exports__.SidebarSeparator;
|
|
81
|
+
exports.SidebarTrigger = __webpack_exports__.SidebarTrigger;
|
|
82
|
+
exports.sidebarMenuButtonVariants = __webpack_exports__.sidebarMenuButtonVariants;
|
|
83
|
+
exports.useSidebar = __webpack_exports__.useSidebar;
|
|
84
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
85
|
+
"Sidebar",
|
|
86
|
+
"SidebarContent",
|
|
87
|
+
"SidebarFooter",
|
|
88
|
+
"SidebarGroup",
|
|
89
|
+
"SidebarGroupAction",
|
|
90
|
+
"SidebarGroupContent",
|
|
91
|
+
"SidebarGroupLabel",
|
|
92
|
+
"SidebarHeader",
|
|
93
|
+
"SidebarInput",
|
|
94
|
+
"SidebarInset",
|
|
95
|
+
"SidebarMenu",
|
|
96
|
+
"SidebarMenuAction",
|
|
97
|
+
"SidebarMenuBadge",
|
|
98
|
+
"SidebarMenuButton",
|
|
99
|
+
"SidebarMenuItem",
|
|
100
|
+
"SidebarMenuSkeleton",
|
|
101
|
+
"SidebarMenuSub",
|
|
102
|
+
"SidebarMenuSubButton",
|
|
103
|
+
"SidebarMenuSubItem",
|
|
104
|
+
"SidebarProvider",
|
|
105
|
+
"SidebarRail",
|
|
106
|
+
"SidebarSeparator",
|
|
107
|
+
"SidebarTrigger",
|
|
108
|
+
"sidebarMenuButtonVariants",
|
|
109
|
+
"useSidebar"
|
|
110
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
111
|
+
Object.defineProperty(exports, '__esModule', {
|
|
112
|
+
value: true
|
|
113
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { SidebarProps } from './sidebar';
|
|
2
|
+
export { Sidebar, SidebarInset, SidebarRail, SidebarTrigger } from './sidebar';
|
|
3
|
+
export type { SidebarProviderProps } from './sidebar-context';
|
|
4
|
+
export { SidebarProvider, useSidebar } from './sidebar-context';
|
|
5
|
+
export { SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, } from './sidebar-group';
|
|
6
|
+
export { SidebarContent, SidebarFooter, SidebarHeader, SidebarInput, SidebarSeparator, } from './sidebar-layout';
|
|
7
|
+
export type { SidebarMenuButtonProps } from './sidebar-menu';
|
|
8
|
+
export { SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, sidebarMenuButtonVariants, } from './sidebar-menu';
|
|
9
|
+
export type { SidebarMenuSubButtonProps } from './sidebar-menu-sub';
|
|
10
|
+
export { SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem } from './sidebar-menu-sub';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Sidebar, SidebarInset, SidebarRail, SidebarTrigger } from "./sidebar.js";
|
|
2
|
+
import { SidebarProvider, useSidebar } from "./sidebar-context.js";
|
|
3
|
+
import { SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel } from "./sidebar-group.js";
|
|
4
|
+
import { SidebarContent, SidebarFooter, SidebarHeader, SidebarInput, SidebarSeparator } from "./sidebar-layout.js";
|
|
5
|
+
import { SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, sidebarMenuButtonVariants } from "./sidebar-menu.js";
|
|
6
|
+
import { SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem } from "./sidebar-menu-sub.js";
|
|
7
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, sidebarMenuButtonVariants, useSidebar };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.r = (exports1)=>{
|
|
17
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
SIDEBAR_WIDTH_MOBILE: ()=>SIDEBAR_WIDTH_MOBILE,
|
|
29
|
+
SidebarProvider: ()=>SidebarProvider,
|
|
30
|
+
guardDisabledClick: ()=>guardDisabledClick,
|
|
31
|
+
useSidebar: ()=>useSidebar
|
|
32
|
+
});
|
|
33
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
34
|
+
const external_react_namespaceObject = require("react");
|
|
35
|
+
const external_tooltip_cjs_namespaceObject = require("../tooltip.cjs");
|
|
36
|
+
const index_cjs_namespaceObject = require("../../../lib/index.cjs");
|
|
37
|
+
const SIDEBAR_WIDTH = '16rem';
|
|
38
|
+
const SIDEBAR_WIDTH_MOBILE = '18rem';
|
|
39
|
+
const SIDEBAR_WIDTH_ICON = '3rem';
|
|
40
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
|
41
|
+
const MOBILE_BREAKPOINT = 768;
|
|
42
|
+
function useIsMobile() {
|
|
43
|
+
const [isMobile, setIsMobile] = external_react_namespaceObject.useState(false);
|
|
44
|
+
external_react_namespaceObject.useEffect(()=>{
|
|
45
|
+
if ("u" < typeof window || !window.matchMedia) return;
|
|
46
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
47
|
+
const onChange = ()=>setIsMobile(mql.matches);
|
|
48
|
+
onChange();
|
|
49
|
+
mql.addEventListener('change', onChange);
|
|
50
|
+
return ()=>mql.removeEventListener('change', onChange);
|
|
51
|
+
}, []);
|
|
52
|
+
return isMobile;
|
|
53
|
+
}
|
|
54
|
+
const SidebarContext = /*#__PURE__*/ external_react_namespaceObject.createContext(null);
|
|
55
|
+
function useSidebar() {
|
|
56
|
+
const context = external_react_namespaceObject.useContext(SidebarContext);
|
|
57
|
+
if (!context) throw new Error('useSidebar must be used within a SidebarProvider.');
|
|
58
|
+
return context;
|
|
59
|
+
}
|
|
60
|
+
const SidebarProvider = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, keyboardShortcut = false, className, style, children, ...props }, ref)=>{
|
|
61
|
+
const isMobile = useIsMobile();
|
|
62
|
+
const [openMobile, setOpenMobile] = external_react_namespaceObject.useState(false);
|
|
63
|
+
const [_open, _setOpen] = external_react_namespaceObject.useState(defaultOpen);
|
|
64
|
+
const open = openProp ?? _open;
|
|
65
|
+
const setOpen = external_react_namespaceObject.useCallback((value)=>{
|
|
66
|
+
const openState = 'function' == typeof value ? value(open) : value;
|
|
67
|
+
if (void 0 === openProp) _setOpen(openState);
|
|
68
|
+
setOpenProp?.(openState);
|
|
69
|
+
}, [
|
|
70
|
+
setOpenProp,
|
|
71
|
+
openProp,
|
|
72
|
+
open
|
|
73
|
+
]);
|
|
74
|
+
const toggleSidebar = external_react_namespaceObject.useCallback(()=>isMobile ? setOpenMobile((value)=>!value) : setOpen((value)=>!value), [
|
|
75
|
+
isMobile,
|
|
76
|
+
setOpen
|
|
77
|
+
]);
|
|
78
|
+
external_react_namespaceObject.useEffect(()=>{
|
|
79
|
+
if (!keyboardShortcut) return;
|
|
80
|
+
const handleKeyDown = (event)=>{
|
|
81
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
toggleSidebar();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
87
|
+
return ()=>window.removeEventListener('keydown', handleKeyDown);
|
|
88
|
+
}, [
|
|
89
|
+
keyboardShortcut,
|
|
90
|
+
toggleSidebar
|
|
91
|
+
]);
|
|
92
|
+
const state = open ? 'expanded' : 'collapsed';
|
|
93
|
+
const contextValue = external_react_namespaceObject.useMemo(()=>({
|
|
94
|
+
state,
|
|
95
|
+
open,
|
|
96
|
+
setOpen,
|
|
97
|
+
isMobile,
|
|
98
|
+
openMobile,
|
|
99
|
+
setOpenMobile,
|
|
100
|
+
toggleSidebar
|
|
101
|
+
}), [
|
|
102
|
+
state,
|
|
103
|
+
open,
|
|
104
|
+
setOpen,
|
|
105
|
+
isMobile,
|
|
106
|
+
openMobile,
|
|
107
|
+
toggleSidebar
|
|
108
|
+
]);
|
|
109
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SidebarContext.Provider, {
|
|
110
|
+
value: contextValue,
|
|
111
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tooltip_cjs_namespaceObject.TooltipProvider, {
|
|
112
|
+
delayDuration: 0,
|
|
113
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
114
|
+
ref: ref,
|
|
115
|
+
"data-slot": "sidebar-wrapper",
|
|
116
|
+
style: {
|
|
117
|
+
'--sidebar-width': SIDEBAR_WIDTH,
|
|
118
|
+
'--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
|
|
119
|
+
...style
|
|
120
|
+
},
|
|
121
|
+
className: (0, index_cjs_namespaceObject.cn)('group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-surface', className),
|
|
122
|
+
...props,
|
|
123
|
+
children: children
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
SidebarProvider.displayName = 'SidebarProvider';
|
|
129
|
+
function guardDisabledClick(ariaDisabled, onClickCapture) {
|
|
130
|
+
return (event)=>{
|
|
131
|
+
if (true === ariaDisabled || 'true' === ariaDisabled) {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
event.stopPropagation();
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
onClickCapture?.(event);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
exports.SIDEBAR_WIDTH_MOBILE = __webpack_exports__.SIDEBAR_WIDTH_MOBILE;
|
|
140
|
+
exports.SidebarProvider = __webpack_exports__.SidebarProvider;
|
|
141
|
+
exports.guardDisabledClick = __webpack_exports__.guardDisabledClick;
|
|
142
|
+
exports.useSidebar = __webpack_exports__.useSidebar;
|
|
143
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
144
|
+
"SIDEBAR_WIDTH_MOBILE",
|
|
145
|
+
"SidebarProvider",
|
|
146
|
+
"guardDisabledClick",
|
|
147
|
+
"useSidebar"
|
|
148
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
149
|
+
Object.defineProperty(exports, '__esModule', {
|
|
150
|
+
value: true
|
|
151
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
3
|
+
type SidebarContextProps = {
|
|
4
|
+
state: 'expanded' | 'collapsed';
|
|
5
|
+
open: boolean;
|
|
6
|
+
setOpen: (open: boolean) => void;
|
|
7
|
+
openMobile: boolean;
|
|
8
|
+
setOpenMobile: (open: boolean) => void;
|
|
9
|
+
isMobile: boolean;
|
|
10
|
+
toggleSidebar: () => void;
|
|
11
|
+
};
|
|
12
|
+
declare function useSidebar(): SidebarContextProps;
|
|
13
|
+
/**
|
|
14
|
+
* Wraps the sidebar and the content next to it. By default the wrapper fills at
|
|
15
|
+
* least the viewport height (`min-h-svh`), which suits a full-page app layout.
|
|
16
|
+
* When embedding a `collapsible="none"` sidebar in a dialog, card or split pane,
|
|
17
|
+
* pass `className="min-h-0"` (plus a height such as `h-full`) so it sizes to its
|
|
18
|
+
* container instead.
|
|
19
|
+
*/
|
|
20
|
+
export interface SidebarProviderProps extends React.ComponentProps<'div'> {
|
|
21
|
+
/** Initial open state when uncontrolled. */
|
|
22
|
+
defaultOpen?: boolean;
|
|
23
|
+
/** Controlled open state. */
|
|
24
|
+
open?: boolean;
|
|
25
|
+
/** Called when the open state changes. Use it to persist the state. */
|
|
26
|
+
onOpenChange?: (open: boolean) => void;
|
|
27
|
+
/** Toggle the sidebar with Cmd/Ctrl+B. Off by default. */
|
|
28
|
+
keyboardShortcut?: boolean;
|
|
29
|
+
}
|
|
30
|
+
declare const SidebarProvider: React.ForwardRefExoticComponent<Omit<SidebarProviderProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
/**
|
|
32
|
+
* Capture-phase click handler for `aria-disabled` items. `aria-disabled` only
|
|
33
|
+
* announces the state and the disabled styles only block pointer input, so this
|
|
34
|
+
* also stops Enter on a focused link. Running in the capture phase matters for
|
|
35
|
+
* `asChild`: Radix Slot runs the child's own `onClick` before the slot's, and a
|
|
36
|
+
* capture handler that stops propagation keeps both from firing.
|
|
37
|
+
*/
|
|
38
|
+
declare function guardDisabledClick<E extends HTMLElement>(ariaDisabled: React.AriaAttributes['aria-disabled'], onClickCapture: React.MouseEventHandler<E> | undefined): React.MouseEventHandler<E>;
|
|
39
|
+
export { guardDisabledClick, SidebarProvider, useSidebar };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, forwardRef, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { TooltipProvider } from "../tooltip.js";
|
|
5
|
+
import { cn } from "../../../lib/index.js";
|
|
6
|
+
const SIDEBAR_WIDTH = '16rem';
|
|
7
|
+
const SIDEBAR_WIDTH_MOBILE = '18rem';
|
|
8
|
+
const SIDEBAR_WIDTH_ICON = '3rem';
|
|
9
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
|
10
|
+
const MOBILE_BREAKPOINT = 768;
|
|
11
|
+
function useIsMobile() {
|
|
12
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
13
|
+
useEffect(()=>{
|
|
14
|
+
if ("u" < typeof window || !window.matchMedia) return;
|
|
15
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
16
|
+
const onChange = ()=>setIsMobile(mql.matches);
|
|
17
|
+
onChange();
|
|
18
|
+
mql.addEventListener('change', onChange);
|
|
19
|
+
return ()=>mql.removeEventListener('change', onChange);
|
|
20
|
+
}, []);
|
|
21
|
+
return isMobile;
|
|
22
|
+
}
|
|
23
|
+
const SidebarContext = /*#__PURE__*/ createContext(null);
|
|
24
|
+
function useSidebar() {
|
|
25
|
+
const context = useContext(SidebarContext);
|
|
26
|
+
if (!context) throw new Error('useSidebar must be used within a SidebarProvider.');
|
|
27
|
+
return context;
|
|
28
|
+
}
|
|
29
|
+
const SidebarProvider = /*#__PURE__*/ forwardRef(({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, keyboardShortcut = false, className, style, children, ...props }, ref)=>{
|
|
30
|
+
const isMobile = useIsMobile();
|
|
31
|
+
const [openMobile, setOpenMobile] = useState(false);
|
|
32
|
+
const [_open, _setOpen] = useState(defaultOpen);
|
|
33
|
+
const open = openProp ?? _open;
|
|
34
|
+
const setOpen = useCallback((value)=>{
|
|
35
|
+
const openState = 'function' == typeof value ? value(open) : value;
|
|
36
|
+
if (void 0 === openProp) _setOpen(openState);
|
|
37
|
+
setOpenProp?.(openState);
|
|
38
|
+
}, [
|
|
39
|
+
setOpenProp,
|
|
40
|
+
openProp,
|
|
41
|
+
open
|
|
42
|
+
]);
|
|
43
|
+
const toggleSidebar = useCallback(()=>isMobile ? setOpenMobile((value)=>!value) : setOpen((value)=>!value), [
|
|
44
|
+
isMobile,
|
|
45
|
+
setOpen
|
|
46
|
+
]);
|
|
47
|
+
useEffect(()=>{
|
|
48
|
+
if (!keyboardShortcut) return;
|
|
49
|
+
const handleKeyDown = (event)=>{
|
|
50
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
toggleSidebar();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
56
|
+
return ()=>window.removeEventListener('keydown', handleKeyDown);
|
|
57
|
+
}, [
|
|
58
|
+
keyboardShortcut,
|
|
59
|
+
toggleSidebar
|
|
60
|
+
]);
|
|
61
|
+
const state = open ? 'expanded' : 'collapsed';
|
|
62
|
+
const contextValue = useMemo(()=>({
|
|
63
|
+
state,
|
|
64
|
+
open,
|
|
65
|
+
setOpen,
|
|
66
|
+
isMobile,
|
|
67
|
+
openMobile,
|
|
68
|
+
setOpenMobile,
|
|
69
|
+
toggleSidebar
|
|
70
|
+
}), [
|
|
71
|
+
state,
|
|
72
|
+
open,
|
|
73
|
+
setOpen,
|
|
74
|
+
isMobile,
|
|
75
|
+
openMobile,
|
|
76
|
+
toggleSidebar
|
|
77
|
+
]);
|
|
78
|
+
return /*#__PURE__*/ jsx(SidebarContext.Provider, {
|
|
79
|
+
value: contextValue,
|
|
80
|
+
children: /*#__PURE__*/ jsx(TooltipProvider, {
|
|
81
|
+
delayDuration: 0,
|
|
82
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
83
|
+
ref: ref,
|
|
84
|
+
"data-slot": "sidebar-wrapper",
|
|
85
|
+
style: {
|
|
86
|
+
'--sidebar-width': SIDEBAR_WIDTH,
|
|
87
|
+
'--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
|
|
88
|
+
...style
|
|
89
|
+
},
|
|
90
|
+
className: cn('group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-surface', className),
|
|
91
|
+
...props,
|
|
92
|
+
children: children
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
SidebarProvider.displayName = 'SidebarProvider';
|
|
98
|
+
function guardDisabledClick(ariaDisabled, onClickCapture) {
|
|
99
|
+
return (event)=>{
|
|
100
|
+
if (true === ariaDisabled || 'true' === ariaDisabled) {
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
event.stopPropagation();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
onClickCapture?.(event);
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export { SIDEBAR_WIDTH_MOBILE, SidebarProvider, guardDisabledClick, useSidebar };
|