@object-ui/components 3.1.4 → 3.3.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/.turbo/turbo-build.log +44 -24
- package/CHANGELOG.md +26 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +34092 -33838
- package/dist/index.umd.cjs +40 -40
- package/dist/{src → packages/components/src}/custom/mobile-dialog-content.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/accordion.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/alert-dialog.d.ts +1 -1
- package/dist/packages/components/src/ui/aspect-ratio.d.ts +10 -0
- package/dist/{src → packages/components/src}/ui/avatar.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/button.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/chart.d.ts +7 -0
- package/dist/{src → packages/components/src}/ui/checkbox.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/collapsible.d.ts +8 -1
- package/dist/{src → packages/components/src}/ui/command.d.ts +2 -2
- package/dist/{src → packages/components/src}/ui/context-menu.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/dialog.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/drawer.d.ts +6 -10
- package/dist/{src → packages/components/src}/ui/dropdown-menu.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/form.d.ts +2 -2
- package/dist/{src → packages/components/src}/ui/hover-card.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/label.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/menubar.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/navigation-menu.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/popover.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/progress.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/radio-group.d.ts +1 -1
- package/dist/packages/components/src/ui/resizable.d.ts +7 -0
- package/dist/{src → packages/components/src}/ui/scroll-area.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/select.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/separator.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/sheet.d.ts +1 -2
- package/dist/{src → packages/components/src}/ui/sidebar.d.ts +1 -8
- package/dist/{src → packages/components/src}/ui/slider.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/switch.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/tabs.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/toast.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/toggle-group.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/toggle.d.ts +1 -1
- package/dist/{src → packages/components/src}/ui/tooltip.d.ts +1 -1
- package/package.json +40 -13
- package/src/__tests__/__snapshots__/snapshot-critical.test.tsx.snap +3 -3
- package/src/custom/button-group.tsx +2 -2
- package/src/custom/field.tsx +3 -3
- package/src/custom/filter-builder.tsx +1 -1
- package/src/custom/item.tsx +2 -2
- package/src/custom/mobile-dialog-content.tsx +1 -1
- package/src/custom/sort-builder.tsx +1 -1
- package/src/index.css +114 -0
- package/src/renderers/complex/data-table.tsx +9 -9
- package/src/renderers/data-display/table.tsx +1 -1
- package/src/renderers/form/form.tsx +9 -2
- package/src/stories-json/chatbot.stories.tsx +101 -0
- package/src/ui/accordion.tsx +1 -1
- package/src/ui/alert-dialog.tsx +1 -1
- package/src/ui/aspect-ratio.tsx +1 -1
- package/src/ui/avatar.tsx +1 -1
- package/src/ui/breadcrumb.tsx +2 -2
- package/src/ui/button.tsx +2 -4
- package/src/ui/chart.tsx +10 -0
- package/src/ui/checkbox.tsx +1 -1
- package/src/ui/collapsible.tsx +1 -1
- package/src/ui/command.tsx +2 -2
- package/src/ui/context-menu.tsx +3 -3
- package/src/ui/dialog.tsx +4 -21
- package/src/ui/drawer.tsx +13 -13
- package/src/ui/dropdown-menu.tsx +3 -3
- package/src/ui/form.tsx +5 -5
- package/src/ui/hover-card.tsx +2 -2
- package/src/ui/label.tsx +1 -1
- package/src/ui/menubar.tsx +3 -3
- package/src/ui/navigation-menu.tsx +1 -1
- package/src/ui/popover.tsx +2 -2
- package/src/ui/progress.tsx +1 -1
- package/src/ui/radio-group.tsx +1 -1
- package/src/ui/resizable.tsx +7 -7
- package/src/ui/scroll-area.tsx +1 -1
- package/src/ui/select.tsx +2 -2
- package/src/ui/separator.tsx +1 -1
- package/src/ui/sheet.tsx +2 -3
- package/src/ui/sidebar.tsx +28 -113
- package/src/ui/slider.tsx +3 -4
- package/src/ui/switch.tsx +1 -1
- package/src/ui/tabs.tsx +1 -1
- package/src/ui/toast.tsx +1 -1
- package/src/ui/toggle-group.tsx +1 -1
- package/src/ui/toggle.tsx +1 -1
- package/src/ui/tooltip.tsx +2 -2
- package/vite.config.ts +1 -0
- package/dist/src/ui/aspect-ratio.d.ts +0 -3
- package/dist/src/ui/resizable.d.ts +0 -14
- /package/dist/{src → packages/components/src}/SchemaRenderer.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/action-param-dialog.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/button-group.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/combobox.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/config-field-renderer.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/config-panel-renderer.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/config-row.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/date-picker.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/empty.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/field.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/filter-builder.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/input-group.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/item.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/kbd.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/native-select.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/navigation-overlay.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/section-header.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/sort-builder.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/spinner.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/view-skeleton.d.ts +0 -0
- /package/dist/{src → packages/components/src}/custom/view-states.d.ts +0 -0
- /package/dist/{src → packages/components/src}/debug/DebugPanel.d.ts +0 -0
- /package/dist/{src → packages/components/src}/debug/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/hooks/use-config-draft.d.ts +0 -0
- /package/dist/{src → packages/components/src}/hooks/use-mobile.d.ts +0 -0
- /package/dist/{src → packages/components/src}/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/lib/use-sync-external-store-shim.d.ts +0 -0
- /package/dist/{src → packages/components/src}/lib/use-sync-external-store-with-selector-shim.d.ts +0 -0
- /package/dist/{src → packages/components/src}/lib/utils.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/action/action-bar.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/action/action-button.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/action/action-group.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/action/action-icon.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/action/action-menu.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/action/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/action/resolve-icon.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/basic/button-group.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/basic/div.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/basic/html.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/basic/icon.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/basic/image.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/basic/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/basic/navigation-menu.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/basic/pagination.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/basic/separator.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/basic/span.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/basic/text.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/complex/carousel.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/complex/data-table.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/complex/filter-builder.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/complex/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/complex/resizable.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/complex/scroll-area.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/complex/table.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/data-display/alert.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/data-display/avatar.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/data-display/badge.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/data-display/breadcrumb.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/data-display/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/data-display/kbd.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/data-display/list.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/data-display/statistic.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/data-display/table.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/data-display/tree-view.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/disclosure/accordion.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/disclosure/collapsible.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/disclosure/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/disclosure/toggle-group.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/feedback/empty.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/feedback/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/feedback/loading.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/feedback/progress.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/feedback/skeleton.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/feedback/sonner.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/feedback/spinner.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/feedback/toast.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/feedback/toaster.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/button.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/calendar.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/checkbox.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/combobox.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/command.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/date-picker.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/file-upload.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/form.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/input-otp.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/input.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/label.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/radio-group.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/select.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/slider.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/switch.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/textarea.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/form/toggle.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/layout/aspect-ratio.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/layout/card.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/layout/container.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/layout/flex.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/layout/grid.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/layout/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/layout/page.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/layout/semantic.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/layout/stack.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/layout/tabs.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/navigation/header-bar.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/navigation/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/navigation/sidebar.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/overlay/alert-dialog.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/overlay/context-menu.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/overlay/dialog.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/overlay/drawer.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/overlay/dropdown-menu.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/overlay/hover-card.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/overlay/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/overlay/menubar.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/overlay/popover.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/overlay/sheet.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/overlay/tooltip.d.ts +0 -0
- /package/dist/{src → packages/components/src}/renderers/placeholders.d.ts +0 -0
- /package/dist/{src → packages/components/src}/types/config-panel.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/alert.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/badge.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/breadcrumb.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/calendar.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/card.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/carousel.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/index.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/input-otp.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/input.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/pagination.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/skeleton.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/sonner.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/table.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/textarea.d.ts +0 -0
- /package/dist/{src → packages/components/src}/ui/typography.d.ts +0 -0
package/src/ui/sidebar.tsx
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"use client"
|
|
10
10
|
|
|
11
11
|
import * as React from "react"
|
|
12
|
-
import { Slot
|
|
12
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
13
13
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
14
14
|
import { PanelLeft } from "lucide-react"
|
|
15
15
|
|
|
@@ -39,11 +39,6 @@ const SIDEBAR_WIDTH = "16rem"
|
|
|
39
39
|
const SIDEBAR_WIDTH_MOBILE = "18rem"
|
|
40
40
|
const SIDEBAR_WIDTH_ICON = "3rem"
|
|
41
41
|
const SIDEBAR_KEYBOARD_SHORTCUT = "b"
|
|
42
|
-
const SIDEBAR_WIDTH_STORAGE_KEY = "sidebar_width"
|
|
43
|
-
const SIDEBAR_MIN_WIDTH = 200 // px
|
|
44
|
-
const SIDEBAR_MAX_WIDTH = 480 // px
|
|
45
|
-
const SIDEBAR_DEFAULT_WIDTH_PX = 256 // 16rem in px
|
|
46
|
-
const SIDEBAR_CLICK_THRESHOLD_PX = 5
|
|
47
42
|
|
|
48
43
|
type SidebarContextProps = {
|
|
49
44
|
state: "expanded" | "collapsed"
|
|
@@ -53,10 +48,6 @@ type SidebarContextProps = {
|
|
|
53
48
|
setOpenMobile: (open: boolean) => void
|
|
54
49
|
isMobile: boolean
|
|
55
50
|
toggleSidebar: () => void
|
|
56
|
-
/** Current sidebar width in pixels (only used when resizable) */
|
|
57
|
-
sidebarWidth: number | null
|
|
58
|
-
/** Update sidebar width (only used when resizable) */
|
|
59
|
-
setSidebarWidth: (width: number | null) => void
|
|
60
51
|
}
|
|
61
52
|
|
|
62
53
|
const SidebarContext = React.createContext<SidebarContextProps | null>(null)
|
|
@@ -93,27 +84,6 @@ const SidebarProvider = React.forwardRef<
|
|
|
93
84
|
const isMobile = useIsMobile()
|
|
94
85
|
const [openMobile, setOpenMobile] = React.useState(false)
|
|
95
86
|
|
|
96
|
-
// Resizable sidebar width state (persisted to localStorage)
|
|
97
|
-
const [sidebarWidth, setSidebarWidthState] = React.useState<number | null>(() => {
|
|
98
|
-
try {
|
|
99
|
-
const stored = localStorage.getItem(SIDEBAR_WIDTH_STORAGE_KEY)
|
|
100
|
-
if (!stored) return null
|
|
101
|
-
const value = Number(stored)
|
|
102
|
-
if (isNaN(value)) return null
|
|
103
|
-
return Math.max(SIDEBAR_MIN_WIDTH, Math.min(SIDEBAR_MAX_WIDTH, value))
|
|
104
|
-
} catch { return null }
|
|
105
|
-
})
|
|
106
|
-
const setSidebarWidth = React.useCallback((width: number | null) => {
|
|
107
|
-
setSidebarWidthState(width)
|
|
108
|
-
try {
|
|
109
|
-
if (width != null) {
|
|
110
|
-
localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, String(width))
|
|
111
|
-
} else {
|
|
112
|
-
localStorage.removeItem(SIDEBAR_WIDTH_STORAGE_KEY)
|
|
113
|
-
}
|
|
114
|
-
} catch { /* ignore */ }
|
|
115
|
-
}, [])
|
|
116
|
-
|
|
117
87
|
// This is the internal state of the sidebar.
|
|
118
88
|
// We use openProp and setOpenProp for control from outside the component.
|
|
119
89
|
const [_open, _setOpen] = React.useState(defaultOpen)
|
|
@@ -169,10 +139,8 @@ const SidebarProvider = React.forwardRef<
|
|
|
169
139
|
openMobile,
|
|
170
140
|
setOpenMobile,
|
|
171
141
|
toggleSidebar,
|
|
172
|
-
sidebarWidth,
|
|
173
|
-
setSidebarWidth,
|
|
174
142
|
}),
|
|
175
|
-
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar
|
|
143
|
+
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
176
144
|
)
|
|
177
145
|
|
|
178
146
|
return (
|
|
@@ -181,7 +149,7 @@ const SidebarProvider = React.forwardRef<
|
|
|
181
149
|
<div
|
|
182
150
|
style={
|
|
183
151
|
{
|
|
184
|
-
"--sidebar-width":
|
|
152
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
185
153
|
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
186
154
|
...style,
|
|
187
155
|
} as React.CSSProperties
|
|
@@ -227,7 +195,7 @@ const Sidebar = React.forwardRef<
|
|
|
227
195
|
return (
|
|
228
196
|
<div
|
|
229
197
|
className={cn(
|
|
230
|
-
"flex h-full w-[
|
|
198
|
+
"flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",
|
|
231
199
|
className
|
|
232
200
|
)}
|
|
233
201
|
ref={ref}
|
|
@@ -244,7 +212,7 @@ const Sidebar = React.forwardRef<
|
|
|
244
212
|
<SheetContent
|
|
245
213
|
data-sidebar="sidebar"
|
|
246
214
|
data-mobile="true"
|
|
247
|
-
className="w-[
|
|
215
|
+
className="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
|
|
248
216
|
style={
|
|
249
217
|
{
|
|
250
218
|
"--sidebar-width": SIDEBAR_WIDTH_MOBILE,
|
|
@@ -267,31 +235,31 @@ const Sidebar = React.forwardRef<
|
|
|
267
235
|
ref={ref}
|
|
268
236
|
className="group peer hidden text-sidebar-foreground md:block"
|
|
269
237
|
data-state={state}
|
|
270
|
-
data-collapsible={
|
|
238
|
+
data-collapsible={collapsible}
|
|
271
239
|
data-variant={variant}
|
|
272
240
|
data-side={side}
|
|
273
241
|
>
|
|
274
242
|
{/* This is what handles the sidebar gap on desktop */}
|
|
275
243
|
<div
|
|
276
244
|
className={cn(
|
|
277
|
-
"relative w-[
|
|
245
|
+
"relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear",
|
|
278
246
|
"group-data-[collapsible=offcanvas]:w-0",
|
|
279
247
|
"group-data-[side=right]:rotate-180",
|
|
280
248
|
variant === "floating" || variant === "inset"
|
|
281
249
|
? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]"
|
|
282
|
-
: "group-data-[collapsible=icon]:w-[
|
|
250
|
+
: "group-data-[collapsible=icon]:w-[--sidebar-width-icon]"
|
|
283
251
|
)}
|
|
284
252
|
/>
|
|
285
253
|
<div
|
|
286
254
|
className={cn(
|
|
287
|
-
"fixed inset-y-0 z-10 hidden h-svh w-[
|
|
255
|
+
"fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
288
256
|
side === "left"
|
|
289
257
|
? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
|
|
290
258
|
: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
291
259
|
// Adjust the padding for floating and inset variants.
|
|
292
260
|
variant === "floating" || variant === "inset"
|
|
293
261
|
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]"
|
|
294
|
-
: "group-data-[collapsible=icon]:w-[
|
|
262
|
+
: "group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
295
263
|
className
|
|
296
264
|
)}
|
|
297
265
|
{...props}
|
|
@@ -339,47 +307,7 @@ const SidebarRail = React.forwardRef<
|
|
|
339
307
|
HTMLButtonElement,
|
|
340
308
|
React.ComponentProps<"button">
|
|
341
309
|
>(({ className, ...props }, ref) => {
|
|
342
|
-
const { toggleSidebar
|
|
343
|
-
const dragging = React.useRef(false)
|
|
344
|
-
const startX = React.useRef(0)
|
|
345
|
-
const startWidth = React.useRef(0)
|
|
346
|
-
|
|
347
|
-
const handlePointerDown = React.useCallback((e: React.PointerEvent) => {
|
|
348
|
-
// Only initiate resize on left mouse button
|
|
349
|
-
if (e.button !== 0) return
|
|
350
|
-
e.preventDefault()
|
|
351
|
-
dragging.current = true
|
|
352
|
-
startX.current = e.clientX
|
|
353
|
-
|
|
354
|
-
// Get the current sidebar width from computed CSS variable
|
|
355
|
-
const wrapper = (e.target as HTMLElement).closest('[style*="--sidebar-width"]') as HTMLElement | null
|
|
356
|
-
startWidth.current = wrapper
|
|
357
|
-
? parseInt(getComputedStyle(wrapper).getPropertyValue('--sidebar-width')) || SIDEBAR_DEFAULT_WIDTH_PX
|
|
358
|
-
: SIDEBAR_DEFAULT_WIDTH_PX
|
|
359
|
-
|
|
360
|
-
const onPointerMove = (ev: PointerEvent) => {
|
|
361
|
-
if (!dragging.current) return
|
|
362
|
-
const delta = ev.clientX - startX.current
|
|
363
|
-
const newWidth = Math.max(SIDEBAR_MIN_WIDTH, Math.min(SIDEBAR_MAX_WIDTH, startWidth.current + delta))
|
|
364
|
-
setSidebarWidth(newWidth)
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
const onPointerUp = () => {
|
|
368
|
-
dragging.current = false
|
|
369
|
-
document.removeEventListener('pointermove', onPointerMove)
|
|
370
|
-
document.removeEventListener('pointerup', onPointerUp)
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
document.addEventListener('pointermove', onPointerMove)
|
|
374
|
-
document.addEventListener('pointerup', onPointerUp)
|
|
375
|
-
}, [setSidebarWidth])
|
|
376
|
-
|
|
377
|
-
const handleClick = React.useCallback((e: React.MouseEvent) => {
|
|
378
|
-
// Only toggle on click (not at end of drag)
|
|
379
|
-
if (Math.abs(e.clientX - startX.current) < SIDEBAR_CLICK_THRESHOLD_PX) {
|
|
380
|
-
toggleSidebar()
|
|
381
|
-
}
|
|
382
|
-
}, [toggleSidebar])
|
|
310
|
+
const { toggleSidebar } = useSidebar()
|
|
383
311
|
|
|
384
312
|
return (
|
|
385
313
|
<button
|
|
@@ -387,13 +315,11 @@ const SidebarRail = React.forwardRef<
|
|
|
387
315
|
data-sidebar="rail"
|
|
388
316
|
aria-label="Toggle Sidebar"
|
|
389
317
|
tabIndex={-1}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
onDoubleClick={() => setSidebarWidth(null)}
|
|
393
|
-
title="Drag to resize, click to toggle, double-click to reset"
|
|
318
|
+
onClick={toggleSidebar}
|
|
319
|
+
title="Toggle Sidebar"
|
|
394
320
|
className={cn(
|
|
395
321
|
"absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",
|
|
396
|
-
"[[data-side=left]_&]:cursor-
|
|
322
|
+
"[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize",
|
|
397
323
|
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
398
324
|
"group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar",
|
|
399
325
|
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
@@ -414,7 +340,7 @@ const SidebarInset = React.forwardRef<
|
|
|
414
340
|
<main
|
|
415
341
|
ref={ref}
|
|
416
342
|
className={cn(
|
|
417
|
-
"relative flex
|
|
343
|
+
"relative flex w-full flex-1 flex-col bg-background",
|
|
418
344
|
"md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",
|
|
419
345
|
className
|
|
420
346
|
)}
|
|
@@ -473,11 +399,8 @@ const SidebarFooter = React.forwardRef<
|
|
|
473
399
|
SidebarFooter.displayName = "SidebarFooter"
|
|
474
400
|
|
|
475
401
|
const SidebarSeparator = React.forwardRef<
|
|
476
|
-
|
|
477
|
-
React.
|
|
478
|
-
orientation?: "horizontal" | "vertical"
|
|
479
|
-
decorative?: boolean
|
|
480
|
-
}
|
|
402
|
+
React.ElementRef<typeof Separator>,
|
|
403
|
+
React.ComponentProps<typeof Separator>
|
|
481
404
|
>(({ className, ...props }, ref) => {
|
|
482
405
|
return (
|
|
483
406
|
<Separator
|
|
@@ -527,14 +450,14 @@ const SidebarGroupLabel = React.forwardRef<
|
|
|
527
450
|
HTMLDivElement,
|
|
528
451
|
React.ComponentProps<"div"> & { asChild?: boolean }
|
|
529
452
|
>(({ className, asChild = false, ...props }, ref) => {
|
|
530
|
-
const Comp = asChild ?
|
|
453
|
+
const Comp = asChild ? Slot : "div"
|
|
531
454
|
|
|
532
455
|
return (
|
|
533
456
|
<Comp
|
|
534
457
|
ref={ref}
|
|
535
458
|
data-sidebar="group-label"
|
|
536
459
|
className={cn(
|
|
537
|
-
"flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0
|
|
460
|
+
"flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
538
461
|
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
539
462
|
className
|
|
540
463
|
)}
|
|
@@ -548,7 +471,7 @@ const SidebarGroupAction = React.forwardRef<
|
|
|
548
471
|
HTMLButtonElement,
|
|
549
472
|
React.ComponentProps<"button"> & { asChild?: boolean }
|
|
550
473
|
>(({ className, asChild = false, ...props }, ref) => {
|
|
551
|
-
const Comp = asChild ?
|
|
474
|
+
const Comp = asChild ? Slot : "button"
|
|
552
475
|
|
|
553
476
|
return (
|
|
554
477
|
<Comp
|
|
@@ -607,17 +530,7 @@ const SidebarMenuItem = React.forwardRef<
|
|
|
607
530
|
SidebarMenuItem.displayName = "SidebarMenuItem"
|
|
608
531
|
|
|
609
532
|
const sidebarMenuButtonVariants = cva(
|
|
610
|
-
[
|
|
611
|
-
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding,color,background-color] duration-150",
|
|
612
|
-
"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground",
|
|
613
|
-
"disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50",
|
|
614
|
-
"data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground",
|
|
615
|
-
"data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground",
|
|
616
|
-
"group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
617
|
-
// Active indicator bar (3px left accent)
|
|
618
|
-
"relative data-[active=true]:before:absolute data-[active=true]:before:left-0 data-[active=true]:before:top-1/2 data-[active=true]:before:-translate-y-1/2",
|
|
619
|
-
"data-[active=true]:before:h-4 data-[active=true]:before:w-[3px] data-[active=true]:before:rounded-full data-[active=true]:before:bg-primary",
|
|
620
|
-
].join(" "),
|
|
533
|
+
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground sidebar-menu-button-icon-mode [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
621
534
|
{
|
|
622
535
|
variants: {
|
|
623
536
|
variant: {
|
|
@@ -628,7 +541,7 @@ const sidebarMenuButtonVariants = cva(
|
|
|
628
541
|
size: {
|
|
629
542
|
default: "h-8 text-sm",
|
|
630
543
|
sm: "h-7 text-xs",
|
|
631
|
-
lg: "h-12 text-sm
|
|
544
|
+
lg: "h-12 text-sm sidebar-menu-button-icon-mode-lg",
|
|
632
545
|
},
|
|
633
546
|
},
|
|
634
547
|
defaultVariants: {
|
|
@@ -658,7 +571,7 @@ const SidebarMenuButton = React.forwardRef<
|
|
|
658
571
|
},
|
|
659
572
|
ref
|
|
660
573
|
) => {
|
|
661
|
-
const Comp = asChild ?
|
|
574
|
+
const Comp = asChild ? Slot : "button"
|
|
662
575
|
const { isMobile, state } = useSidebar()
|
|
663
576
|
|
|
664
577
|
const button = (
|
|
@@ -704,7 +617,7 @@ const SidebarMenuAction = React.forwardRef<
|
|
|
704
617
|
showOnHover?: boolean
|
|
705
618
|
}
|
|
706
619
|
>(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
|
|
707
|
-
const Comp = asChild ?
|
|
620
|
+
const Comp = asChild ? Slot : "button"
|
|
708
621
|
|
|
709
622
|
return (
|
|
710
623
|
<Comp
|
|
@@ -756,7 +669,9 @@ const SidebarMenuSkeleton = React.forwardRef<
|
|
|
756
669
|
}
|
|
757
670
|
>(({ className, showIcon = false, ...props }, ref) => {
|
|
758
671
|
// Random width between 50 to 90%.
|
|
759
|
-
const
|
|
672
|
+
const width = React.useMemo(() => {
|
|
673
|
+
return `${Math.floor(Math.random() * 40) + 50}%`
|
|
674
|
+
}, [])
|
|
760
675
|
|
|
761
676
|
return (
|
|
762
677
|
<div
|
|
@@ -816,7 +731,7 @@ const SidebarMenuSubButton = React.forwardRef<
|
|
|
816
731
|
isActive?: boolean
|
|
817
732
|
}
|
|
818
733
|
>(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
|
|
819
|
-
const Comp = asChild ?
|
|
734
|
+
const Comp = asChild ? Slot : "a"
|
|
820
735
|
|
|
821
736
|
return (
|
|
822
737
|
<Comp
|
package/src/ui/slider.tsx
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
"use client"
|
|
10
10
|
|
|
11
11
|
import * as React from "react"
|
|
12
|
-
import
|
|
12
|
+
import * as SliderPrimitive from "@radix-ui/react-slider"
|
|
13
13
|
|
|
14
14
|
import { cn } from "../lib/utils"
|
|
15
15
|
|
|
16
16
|
const Slider = React.forwardRef<
|
|
17
17
|
React.ElementRef<typeof SliderPrimitive.Root>,
|
|
18
18
|
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
|
|
19
|
-
>(({ className,
|
|
19
|
+
>(({ className, ...props }, ref) => (
|
|
20
20
|
<SliderPrimitive.Root
|
|
21
21
|
ref={ref}
|
|
22
22
|
className={cn(
|
|
@@ -29,9 +29,8 @@ const Slider = React.forwardRef<
|
|
|
29
29
|
<SliderPrimitive.Range className="absolute h-full bg-primary" />
|
|
30
30
|
</SliderPrimitive.Track>
|
|
31
31
|
<SliderPrimitive.Thumb
|
|
32
|
-
aria-label={ariaLabel}
|
|
33
|
-
aria-labelledby={ariaLabelledBy}
|
|
34
32
|
className="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"
|
|
33
|
+
aria-label={props["aria-label"]}
|
|
35
34
|
/>
|
|
36
35
|
</SliderPrimitive.Root>
|
|
37
36
|
))
|
package/src/ui/switch.tsx
CHANGED
package/src/ui/tabs.tsx
CHANGED
package/src/ui/toast.tsx
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"use client"
|
|
10
10
|
|
|
11
11
|
import * as React from "react"
|
|
12
|
-
import
|
|
12
|
+
import * as ToastPrimitives from "@radix-ui/react-toast"
|
|
13
13
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
14
14
|
import { X } from "lucide-react"
|
|
15
15
|
|
package/src/ui/toggle-group.tsx
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"use client"
|
|
10
10
|
|
|
11
11
|
import * as React from "react"
|
|
12
|
-
import
|
|
12
|
+
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
|
|
13
13
|
import { type VariantProps } from "class-variance-authority"
|
|
14
14
|
|
|
15
15
|
import { cn } from "../lib/utils"
|
package/src/ui/toggle.tsx
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"use client"
|
|
10
10
|
|
|
11
11
|
import * as React from "react"
|
|
12
|
-
import
|
|
12
|
+
import * as TogglePrimitive from "@radix-ui/react-toggle"
|
|
13
13
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
14
14
|
|
|
15
15
|
import { cn } from "../lib/utils"
|
package/src/ui/tooltip.tsx
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"use client"
|
|
10
10
|
|
|
11
11
|
import * as React from "react"
|
|
12
|
-
import
|
|
12
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
|
|
13
13
|
|
|
14
14
|
import { cn } from "../lib/utils"
|
|
15
15
|
|
|
@@ -27,7 +27,7 @@ const TooltipContent = React.forwardRef<
|
|
|
27
27
|
ref={ref}
|
|
28
28
|
sideOffset={sideOffset}
|
|
29
29
|
className={cn(
|
|
30
|
-
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2
|
|
30
|
+
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
|
|
31
31
|
className
|
|
32
32
|
)}
|
|
33
33
|
{...props}
|
package/vite.config.ts
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ObjectUI
|
|
3
|
-
* Copyright (c) 2024-present ObjectStack Inc.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
import * as ResizablePrimitive from "react-resizable-panels";
|
|
9
|
-
declare const ResizablePanelGroup: ({ className, ...props }: React.ComponentProps<typeof ResizablePrimitive.Group>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
declare const ResizablePanel: typeof ResizablePrimitive.Panel;
|
|
11
|
-
declare const ResizableHandle: ({ withHandle, className, ...props }: React.ComponentProps<typeof ResizablePrimitive.Separator> & {
|
|
12
|
-
withHandle?: boolean;
|
|
13
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export { ResizablePanelGroup, ResizablePanel, ResizableHandle };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/{src → packages/components/src}/lib/use-sync-external-store-with-selector-shim.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|