@uipath/apollo-wind 2.64.0 → 2.65.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/components/ui/index.cjs +101 -90
  2. package/dist/components/ui/index.d.ts +1 -0
  3. package/dist/components/ui/index.js +1 -0
  4. package/dist/components/ui/json-tree-view/JsonTree.cjs +1 -1
  5. package/dist/components/ui/json-tree-view/JsonTree.d.ts +2 -2
  6. package/dist/components/ui/json-tree-view/JsonTree.js +1 -1
  7. package/dist/components/ui/json-tree-view/JsonTree.types.d.ts +6 -0
  8. package/dist/components/ui/json-tree-view/JsonTreeRow.cjs +1 -1
  9. package/dist/components/ui/json-tree-view/JsonTreeRow.d.ts +2 -2
  10. package/dist/components/ui/json-tree-view/JsonTreeRow.js +1 -1
  11. package/dist/components/ui/sidebar/index.cjs +113 -0
  12. package/dist/components/ui/sidebar/index.d.ts +10 -0
  13. package/dist/components/ui/sidebar/index.js +7 -0
  14. package/dist/components/ui/sidebar/sidebar-context.cjs +151 -0
  15. package/dist/components/ui/sidebar/sidebar-context.d.ts +39 -0
  16. package/dist/components/ui/sidebar/sidebar-context.js +108 -0
  17. package/dist/components/ui/sidebar/sidebar-group.cjs +87 -0
  18. package/dist/components/ui/sidebar/sidebar-group.d.ts +10 -0
  19. package/dist/components/ui/sidebar/sidebar-group.js +44 -0
  20. package/dist/components/ui/sidebar/sidebar-layout.cjs +92 -0
  21. package/dist/components/ui/sidebar/sidebar-layout.d.ts +7 -0
  22. package/dist/components/ui/sidebar/sidebar-layout.js +46 -0
  23. package/dist/components/ui/sidebar/sidebar-menu-sub.cjs +79 -0
  24. package/dist/components/ui/sidebar/sidebar-menu-sub.d.ts +11 -0
  25. package/dist/components/ui/sidebar/sidebar-menu-sub.js +39 -0
  26. package/dist/components/ui/sidebar/sidebar-menu.cjs +185 -0
  27. package/dist/components/ui/sidebar/sidebar-menu.d.ts +26 -0
  28. package/dist/components/ui/sidebar/sidebar-menu.js +133 -0
  29. package/dist/components/ui/sidebar/sidebar.cjs +220 -0
  30. package/dist/components/ui/sidebar/sidebar.d.ts +22 -0
  31. package/dist/components/ui/sidebar/sidebar.js +177 -0
  32. package/dist/index.cjs +94 -18
  33. package/dist/index.d.ts +3 -1
  34. package/dist/index.js +2 -1
  35. package/dist/styles.css +626 -0
  36. package/package.json +1 -1
@@ -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 };
@@ -0,0 +1,87 @@
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
+ SidebarGroupAction: ()=>SidebarGroupAction,
28
+ SidebarGroupContent: ()=>SidebarGroupContent,
29
+ SidebarGroupLabel: ()=>SidebarGroupLabel,
30
+ SidebarGroup: ()=>SidebarGroup
31
+ });
32
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
33
+ const react_slot_namespaceObject = require("@radix-ui/react-slot");
34
+ const external_react_namespaceObject = require("react");
35
+ const index_cjs_namespaceObject = require("../../../lib/index.cjs");
36
+ const SidebarGroup = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
37
+ ref: ref,
38
+ "data-slot": "sidebar-group",
39
+ "data-sidebar": "group",
40
+ className: (0, index_cjs_namespaceObject.cn)('relative flex w-full min-w-0 flex-col p-2', className),
41
+ ...props
42
+ }));
43
+ SidebarGroup.displayName = 'SidebarGroup';
44
+ const SidebarGroupLabel = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, asChild = false, ...props }, ref)=>{
45
+ const Comp = asChild ? react_slot_namespaceObject.Slot : 'div';
46
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Comp, {
47
+ ref: ref,
48
+ "data-slot": "sidebar-group-label",
49
+ "data-sidebar": "group-label",
50
+ className: (0, index_cjs_namespaceObject.cn)('flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-foreground-muted ring-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0', 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0', className),
51
+ ...props
52
+ });
53
+ });
54
+ SidebarGroupLabel.displayName = 'SidebarGroupLabel';
55
+ const SidebarGroupAction = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, asChild = false, ...props }, ref)=>{
56
+ const Comp = asChild ? react_slot_namespaceObject.Slot : 'button';
57
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Comp, {
58
+ ref: ref,
59
+ type: asChild ? void 0 : 'button',
60
+ "data-slot": "sidebar-group-action",
61
+ "data-sidebar": "group-action",
62
+ className: (0, index_cjs_namespaceObject.cn)('absolute top-3.5 right-3 flex aspect-square w-5 cursor-pointer items-center justify-center rounded-md p-0 text-foreground-muted ring-ring outline-hidden transition-transform hover:bg-background-hover hover:text-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0', 'after:absolute after:-inset-2 md:after:hidden', 'group-data-[collapsible=icon]:hidden', className),
63
+ ...props
64
+ });
65
+ });
66
+ SidebarGroupAction.displayName = 'SidebarGroupAction';
67
+ const SidebarGroupContent = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
68
+ ref: ref,
69
+ "data-slot": "sidebar-group-content",
70
+ "data-sidebar": "group-content",
71
+ className: (0, index_cjs_namespaceObject.cn)('w-full text-sm', className),
72
+ ...props
73
+ }));
74
+ SidebarGroupContent.displayName = 'SidebarGroupContent';
75
+ exports.SidebarGroup = __webpack_exports__.SidebarGroup;
76
+ exports.SidebarGroupAction = __webpack_exports__.SidebarGroupAction;
77
+ exports.SidebarGroupContent = __webpack_exports__.SidebarGroupContent;
78
+ exports.SidebarGroupLabel = __webpack_exports__.SidebarGroupLabel;
79
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
80
+ "SidebarGroup",
81
+ "SidebarGroupAction",
82
+ "SidebarGroupContent",
83
+ "SidebarGroupLabel"
84
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
85
+ Object.defineProperty(exports, '__esModule', {
86
+ value: true
87
+ });
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ declare const SidebarGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
3
+ declare const SidebarGroupLabel: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
4
+ asChild?: boolean;
5
+ }, "ref"> & React.RefAttributes<HTMLDivElement>>;
6
+ declare const SidebarGroupAction: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & {
7
+ asChild?: boolean;
8
+ }, "ref"> & React.RefAttributes<HTMLButtonElement>>;
9
+ declare const SidebarGroupContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
10
+ export { SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel };
@@ -0,0 +1,44 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { forwardRef } from "react";
4
+ import { cn } from "../../../lib/index.js";
5
+ const SidebarGroup = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
6
+ ref: ref,
7
+ "data-slot": "sidebar-group",
8
+ "data-sidebar": "group",
9
+ className: cn('relative flex w-full min-w-0 flex-col p-2', className),
10
+ ...props
11
+ }));
12
+ SidebarGroup.displayName = 'SidebarGroup';
13
+ const SidebarGroupLabel = /*#__PURE__*/ forwardRef(({ className, asChild = false, ...props }, ref)=>{
14
+ const Comp = asChild ? Slot : 'div';
15
+ return /*#__PURE__*/ jsx(Comp, {
16
+ ref: ref,
17
+ "data-slot": "sidebar-group-label",
18
+ "data-sidebar": "group-label",
19
+ className: cn('flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-foreground-muted ring-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0', 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0', className),
20
+ ...props
21
+ });
22
+ });
23
+ SidebarGroupLabel.displayName = 'SidebarGroupLabel';
24
+ const SidebarGroupAction = /*#__PURE__*/ forwardRef(({ className, asChild = false, ...props }, ref)=>{
25
+ const Comp = asChild ? Slot : 'button';
26
+ return /*#__PURE__*/ jsx(Comp, {
27
+ ref: ref,
28
+ type: asChild ? void 0 : 'button',
29
+ "data-slot": "sidebar-group-action",
30
+ "data-sidebar": "group-action",
31
+ className: cn('absolute top-3.5 right-3 flex aspect-square w-5 cursor-pointer items-center justify-center rounded-md p-0 text-foreground-muted ring-ring outline-hidden transition-transform hover:bg-background-hover hover:text-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0', 'after:absolute after:-inset-2 md:after:hidden', 'group-data-[collapsible=icon]:hidden', className),
32
+ ...props
33
+ });
34
+ });
35
+ SidebarGroupAction.displayName = 'SidebarGroupAction';
36
+ const SidebarGroupContent = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx("div", {
37
+ ref: ref,
38
+ "data-slot": "sidebar-group-content",
39
+ "data-sidebar": "group-content",
40
+ className: cn('w-full text-sm', className),
41
+ ...props
42
+ }));
43
+ SidebarGroupContent.displayName = 'SidebarGroupContent';
44
+ export { SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel };