@motiadev/workbench 0.0.6 → 0.0.7

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 (191) hide show
  1. package/dist/README.md +50 -0
  2. package/dist/index.d.ts +0 -1
  3. package/dist/middleware.d.ts +2 -2
  4. package/dist/middleware.js +10 -12
  5. package/dist/src/components/app-sidebar.d.ts +0 -1
  6. package/dist/src/components/app-sidebar.js +5 -6
  7. package/dist/src/components/log-console.d.ts +0 -1
  8. package/dist/src/components/log-level-badge.d.ts +0 -1
  9. package/dist/src/components/ui/badge.d.ts +1 -2
  10. package/dist/src/components/ui/button.d.ts +1 -2
  11. package/dist/src/components/ui/collapsible.d.ts +0 -1
  12. package/dist/src/components/ui/dialog.d.ts +0 -1
  13. package/dist/src/components/ui/input.d.ts +0 -1
  14. package/dist/src/components/ui/label.d.ts +0 -1
  15. package/dist/src/components/ui/select.d.ts +0 -1
  16. package/dist/src/components/ui/separator.d.ts +0 -1
  17. package/dist/src/components/ui/sheet.d.ts +1 -2
  18. package/dist/src/components/ui/sidebar.d.ts +0 -1
  19. package/dist/src/components/ui/skeleton.d.ts +0 -1
  20. package/dist/src/components/ui/switch.d.ts +0 -1
  21. package/dist/src/components/ui/table.d.ts +0 -1
  22. package/dist/src/components/ui/textarea.d.ts +0 -1
  23. package/dist/src/components/ui/tooltip.d.ts +0 -1
  24. package/dist/src/hooks/use-list-flows.d.ts +0 -1
  25. package/dist/src/hooks/use-log-listener.d.ts +0 -1
  26. package/dist/src/hooks/use-mobile.d.ts +0 -1
  27. package/dist/src/lib/utils.d.ts +0 -1
  28. package/dist/src/main.d.ts +0 -8
  29. package/dist/src/main.js +6 -7
  30. package/dist/src/publicComponents/api-node.d.ts +0 -1
  31. package/dist/src/publicComponents/base-handle.d.ts +0 -1
  32. package/dist/src/publicComponents/base-node.d.ts +0 -1
  33. package/dist/src/publicComponents/emits.d.ts +0 -1
  34. package/dist/src/publicComponents/event-node.d.ts +0 -1
  35. package/dist/src/publicComponents/node-props.d.ts +0 -1
  36. package/dist/src/publicComponents/noop-node.d.ts +0 -1
  37. package/dist/src/publicComponents/subscribe.d.ts +0 -1
  38. package/dist/src/route-wrapper.d.ts +0 -1
  39. package/dist/src/routes/flow.d.ts +1 -0
  40. package/dist/src/routes/flow.js +16 -0
  41. package/dist/src/routes/index.d.ts +1 -2
  42. package/dist/src/routes/index.js +2 -6
  43. package/dist/src/stores/use-logs.d.ts +0 -1
  44. package/dist/src/views/flow/arrow-head.d.ts +0 -1
  45. package/dist/src/views/flow/base-edge.d.ts +0 -1
  46. package/dist/src/views/flow/flow-loader.d.ts +0 -1
  47. package/dist/src/views/flow/flow-view.d.ts +0 -1
  48. package/dist/src/views/flow/hooks/use-get-flow-state.d.ts +0 -1
  49. package/dist/src/views/flow/hooks/use-organize-nodes.d.ts +0 -1
  50. package/dist/src/views/flow/legend.d.ts +0 -1
  51. package/dist/src/views/flow/node-organizer.d.ts +0 -1
  52. package/dist/src/views/flow/nodes/api-flow-node.d.ts +0 -1
  53. package/dist/src/views/flow/nodes/event-flow-node.d.ts +0 -1
  54. package/dist/src/views/flow/nodes/json-schema-form.d.ts +0 -1
  55. package/dist/src/views/flow/nodes/language-indicator.d.ts +0 -1
  56. package/dist/src/views/flow/nodes/nodes.types.d.ts +0 -1
  57. package/dist/src/views/flow/nodes/noop-flow-node.d.ts +0 -1
  58. package/dist/tailwind.config.d.ts +0 -1
  59. package/dist/vite.config.d.ts +1 -10
  60. package/dist/vite.config.js +4 -5
  61. package/package.json +3 -3
  62. package/components.json +0 -21
  63. package/dist/index.d.ts.map +0 -1
  64. package/dist/middleware.d.ts.map +0 -1
  65. package/dist/src/components/app-sidebar.d.ts.map +0 -1
  66. package/dist/src/components/log-console.d.ts.map +0 -1
  67. package/dist/src/components/log-level-badge.d.ts.map +0 -1
  68. package/dist/src/components/ui/badge.d.ts.map +0 -1
  69. package/dist/src/components/ui/button.d.ts.map +0 -1
  70. package/dist/src/components/ui/collapsible.d.ts.map +0 -1
  71. package/dist/src/components/ui/dialog.d.ts.map +0 -1
  72. package/dist/src/components/ui/input.d.ts.map +0 -1
  73. package/dist/src/components/ui/label.d.ts.map +0 -1
  74. package/dist/src/components/ui/select.d.ts.map +0 -1
  75. package/dist/src/components/ui/separator.d.ts.map +0 -1
  76. package/dist/src/components/ui/sheet.d.ts.map +0 -1
  77. package/dist/src/components/ui/sidebar.d.ts.map +0 -1
  78. package/dist/src/components/ui/skeleton.d.ts.map +0 -1
  79. package/dist/src/components/ui/switch.d.ts.map +0 -1
  80. package/dist/src/components/ui/table.d.ts.map +0 -1
  81. package/dist/src/components/ui/textarea.d.ts.map +0 -1
  82. package/dist/src/components/ui/tooltip.d.ts.map +0 -1
  83. package/dist/src/hooks/use-list-flows.d.ts.map +0 -1
  84. package/dist/src/hooks/use-log-listener.d.ts.map +0 -1
  85. package/dist/src/hooks/use-mobile.d.ts.map +0 -1
  86. package/dist/src/lib/utils.d.ts.map +0 -1
  87. package/dist/src/main.d.ts.map +0 -1
  88. package/dist/src/publicComponents/api-node.d.ts.map +0 -1
  89. package/dist/src/publicComponents/base-handle.d.ts.map +0 -1
  90. package/dist/src/publicComponents/base-node.d.ts.map +0 -1
  91. package/dist/src/publicComponents/emits.d.ts.map +0 -1
  92. package/dist/src/publicComponents/event-node.d.ts.map +0 -1
  93. package/dist/src/publicComponents/node-props.d.ts.map +0 -1
  94. package/dist/src/publicComponents/noop-node.d.ts.map +0 -1
  95. package/dist/src/publicComponents/subscribe.d.ts.map +0 -1
  96. package/dist/src/route-wrapper.d.ts.map +0 -1
  97. package/dist/src/routeTree.gen.d.ts +0 -53
  98. package/dist/src/routeTree.gen.d.ts.map +0 -1
  99. package/dist/src/routeTree.gen.js +0 -45
  100. package/dist/src/routes/__root.d.ts +0 -2
  101. package/dist/src/routes/__root.d.ts.map +0 -1
  102. package/dist/src/routes/__root.js +0 -15
  103. package/dist/src/routes/flow/$id.d.ts +0 -4
  104. package/dist/src/routes/flow/$id.d.ts.map +0 -1
  105. package/dist/src/routes/flow/$id.js +0 -15
  106. package/dist/src/routes/index.d.ts.map +0 -1
  107. package/dist/src/stores/use-logs.d.ts.map +0 -1
  108. package/dist/src/views/flow/arrow-head.d.ts.map +0 -1
  109. package/dist/src/views/flow/base-edge.d.ts.map +0 -1
  110. package/dist/src/views/flow/flow-loader.d.ts.map +0 -1
  111. package/dist/src/views/flow/flow-view.d.ts.map +0 -1
  112. package/dist/src/views/flow/hooks/use-get-flow-state.d.ts.map +0 -1
  113. package/dist/src/views/flow/hooks/use-organize-nodes.d.ts.map +0 -1
  114. package/dist/src/views/flow/legend.d.ts.map +0 -1
  115. package/dist/src/views/flow/node-organizer.d.ts.map +0 -1
  116. package/dist/src/views/flow/nodes/api-flow-node.d.ts.map +0 -1
  117. package/dist/src/views/flow/nodes/event-flow-node.d.ts.map +0 -1
  118. package/dist/src/views/flow/nodes/json-schema-form.d.ts.map +0 -1
  119. package/dist/src/views/flow/nodes/language-indicator.d.ts.map +0 -1
  120. package/dist/src/views/flow/nodes/nodes.types.d.ts.map +0 -1
  121. package/dist/src/views/flow/nodes/noop-flow-node.d.ts.map +0 -1
  122. package/dist/tailwind.config.d.ts.map +0 -1
  123. package/dist/tsconfig.app.tsbuildinfo +0 -1
  124. package/dist/tsconfig.node.tsbuildinfo +0 -1
  125. package/dist/vite.config.d.ts.map +0 -1
  126. package/eslint.config.js +0 -28
  127. package/index.html +0 -19
  128. package/index.tsx +0 -10
  129. package/middleware.ts +0 -48
  130. package/postcss.config.js +0 -6
  131. package/src/assets/.empty +0 -0
  132. package/src/components/app-sidebar.tsx +0 -55
  133. package/src/components/log-console.tsx +0 -76
  134. package/src/components/log-level-badge.tsx +0 -12
  135. package/src/components/ui/badge.tsx +0 -31
  136. package/src/components/ui/button.tsx +0 -47
  137. package/src/components/ui/collapsible.tsx +0 -9
  138. package/src/components/ui/dialog.tsx +0 -120
  139. package/src/components/ui/input.tsx +0 -21
  140. package/src/components/ui/label.tsx +0 -26
  141. package/src/components/ui/select.tsx +0 -157
  142. package/src/components/ui/separator.tsx +0 -22
  143. package/src/components/ui/sheet.tsx +0 -106
  144. package/src/components/ui/sidebar.tsx +0 -637
  145. package/src/components/ui/skeleton.tsx +0 -7
  146. package/src/components/ui/switch.tsx +0 -27
  147. package/src/components/ui/table.tsx +0 -76
  148. package/src/components/ui/textarea.tsx +0 -22
  149. package/src/components/ui/tooltip.tsx +0 -32
  150. package/src/hooks/use-list-flows.tsx +0 -20
  151. package/src/hooks/use-log-listener.tsx +0 -32
  152. package/src/hooks/use-mobile.tsx +0 -19
  153. package/src/lib/utils.ts +0 -6
  154. package/src/main.tsx +0 -28
  155. package/src/publicComponents/api-node.tsx +0 -28
  156. package/src/publicComponents/base-handle.tsx +0 -43
  157. package/src/publicComponents/base-node.tsx +0 -57
  158. package/src/publicComponents/emits.tsx +0 -22
  159. package/src/publicComponents/event-node.tsx +0 -36
  160. package/src/publicComponents/node-props.tsx +0 -15
  161. package/src/publicComponents/noop-node.tsx +0 -21
  162. package/src/publicComponents/subscribe.tsx +0 -19
  163. package/src/route-wrapper.tsx +0 -9
  164. package/src/routeTree.gen.ts +0 -109
  165. package/src/routes/__root.tsx +0 -26
  166. package/src/routes/flow/$id.tsx +0 -21
  167. package/src/routes/index.tsx +0 -13
  168. package/src/stores/use-logs.ts +0 -22
  169. package/src/views/flow/arrow-head.tsx +0 -13
  170. package/src/views/flow/base-edge.tsx +0 -31
  171. package/src/views/flow/flow-loader.tsx +0 -3
  172. package/src/views/flow/flow-view.tsx +0 -72
  173. package/src/views/flow/hooks/use-get-flow-state.tsx +0 -93
  174. package/src/views/flow/hooks/use-organize-nodes.ts +0 -60
  175. package/src/views/flow/legend.tsx +0 -96
  176. package/src/views/flow/node-organizer.tsx +0 -70
  177. package/src/views/flow/nodes/api-flow-node.tsx +0 -6
  178. package/src/views/flow/nodes/event-flow-node.tsx +0 -6
  179. package/src/views/flow/nodes/json-schema-form.tsx +0 -110
  180. package/src/views/flow/nodes/language-indicator.tsx +0 -74
  181. package/src/views/flow/nodes/nodes.types.ts +0 -36
  182. package/src/views/flow/nodes/noop-flow-node.tsx +0 -6
  183. package/src/vite-env.d.ts +0 -1
  184. package/tailwind.config.ts +0 -75
  185. package/tsconfig.app.json +0 -32
  186. package/tsconfig.json +0 -14
  187. package/tsconfig.node.json +0 -32
  188. package/tsconfig.node.tsbuildinfo +0 -1
  189. package/vite.config.ts +0 -14
  190. /package/{public → dist/public}/.empty +0 -0
  191. /package/{src → dist/src}/index.css +0 -0
@@ -1,637 +0,0 @@
1
- import * as React from 'react'
2
- import { Slot } from '@radix-ui/react-slot'
3
- import { VariantProps, cva } from 'class-variance-authority'
4
- import { PanelLeft } from 'lucide-react'
5
-
6
- import { useIsMobile } from '@/hooks/use-mobile'
7
- import { cn } from '@/lib/utils'
8
- import { Button } from '@/components/ui/button'
9
- import { Input } from '@/components/ui/input'
10
- import { Separator } from '@/components/ui/separator'
11
- import { Sheet, SheetContent } from '@/components/ui/sheet'
12
- import { Skeleton } from '@/components/ui/skeleton'
13
- import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
14
-
15
- const SIDEBAR_COOKIE_NAME = 'sidebar:state'
16
- const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
17
- const SIDEBAR_WIDTH = '16rem'
18
- const SIDEBAR_WIDTH_MOBILE = '18rem'
19
- const SIDEBAR_WIDTH_ICON = '3rem'
20
- const SIDEBAR_KEYBOARD_SHORTCUT = 'b'
21
-
22
- type SidebarContext = {
23
- state: 'expanded' | 'collapsed'
24
- open: boolean
25
- setOpen: (open: boolean) => void
26
- openMobile: boolean
27
- setOpenMobile: (open: boolean) => void
28
- isMobile: boolean
29
- toggleSidebar: () => void
30
- }
31
-
32
- const SidebarContext = React.createContext<SidebarContext | null>(null)
33
-
34
- function useSidebar() {
35
- const context = React.useContext(SidebarContext)
36
- if (!context) {
37
- throw new Error('useSidebar must be used within a SidebarProvider.')
38
- }
39
-
40
- return context
41
- }
42
-
43
- const SidebarProvider = React.forwardRef<
44
- HTMLDivElement,
45
- React.ComponentProps<'div'> & {
46
- defaultOpen?: boolean
47
- open?: boolean
48
- onOpenChange?: (open: boolean) => void
49
- }
50
- >(({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }, ref) => {
51
- const isMobile = useIsMobile()
52
- const [openMobile, setOpenMobile] = React.useState(false)
53
-
54
- // This is the internal state of the sidebar.
55
- // We use openProp and setOpenProp for control from outside the component.
56
- const [_open, _setOpen] = React.useState(defaultOpen)
57
- const open = openProp ?? _open
58
- const setOpen = React.useCallback(
59
- (value: boolean | ((value: boolean) => boolean)) => {
60
- const openState = typeof value === 'function' ? value(open) : value
61
- if (setOpenProp) {
62
- setOpenProp(openState)
63
- } else {
64
- _setOpen(openState)
65
- }
66
-
67
- // This sets the cookie to keep the sidebar state.
68
- document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`
69
- },
70
- [setOpenProp, open],
71
- )
72
-
73
- // Helper to toggle the sidebar.
74
- const toggleSidebar = React.useCallback(() => {
75
- return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open)
76
- }, [isMobile, setOpen, setOpenMobile])
77
-
78
- // Adds a keyboard shortcut to toggle the sidebar.
79
- React.useEffect(() => {
80
- const handleKeyDown = (event: KeyboardEvent) => {
81
- if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
82
- event.preventDefault()
83
- toggleSidebar()
84
- }
85
- }
86
-
87
- window.addEventListener('keydown', handleKeyDown)
88
- return () => window.removeEventListener('keydown', handleKeyDown)
89
- }, [toggleSidebar])
90
-
91
- // We add a state so that we can do data-state="expanded" or "collapsed".
92
- // This makes it easier to style the sidebar with Tailwind classes.
93
- const state = open ? 'expanded' : 'collapsed'
94
-
95
- const contextValue = React.useMemo<SidebarContext>(
96
- () => ({
97
- state,
98
- open,
99
- setOpen,
100
- isMobile,
101
- openMobile,
102
- setOpenMobile,
103
- toggleSidebar,
104
- }),
105
- [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],
106
- )
107
-
108
- return (
109
- <SidebarContext.Provider value={contextValue}>
110
- <TooltipProvider delayDuration={0}>
111
- <div
112
- style={
113
- {
114
- '--sidebar-width': SIDEBAR_WIDTH,
115
- '--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
116
- ...style,
117
- } as React.CSSProperties
118
- }
119
- className={cn('group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar', className)}
120
- ref={ref}
121
- {...props}
122
- >
123
- {children}
124
- </div>
125
- </TooltipProvider>
126
- </SidebarContext.Provider>
127
- )
128
- })
129
- SidebarProvider.displayName = 'SidebarProvider'
130
-
131
- const Sidebar = React.forwardRef<
132
- HTMLDivElement,
133
- React.ComponentProps<'div'> & {
134
- side?: 'left' | 'right'
135
- variant?: 'sidebar' | 'floating' | 'inset'
136
- collapsible?: 'offcanvas' | 'icon' | 'none'
137
- }
138
- >(({ side = 'left', variant = 'sidebar', collapsible = 'offcanvas', className, children, ...props }, ref) => {
139
- const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
140
-
141
- if (collapsible === 'none') {
142
- return (
143
- <div
144
- className={cn('flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground', className)}
145
- ref={ref}
146
- {...props}
147
- >
148
- {children}
149
- </div>
150
- )
151
- }
152
-
153
- if (isMobile) {
154
- return (
155
- <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
156
- <SheetContent
157
- data-sidebar="sidebar"
158
- data-mobile="true"
159
- className="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
160
- style={
161
- {
162
- '--sidebar-width': SIDEBAR_WIDTH_MOBILE,
163
- } as React.CSSProperties
164
- }
165
- side={side}
166
- >
167
- <div className="flex h-full w-full flex-col">{children}</div>
168
- </SheetContent>
169
- </Sheet>
170
- )
171
- }
172
-
173
- return (
174
- <div
175
- ref={ref}
176
- className="group peer hidden md:block text-sidebar-foreground"
177
- data-state={state}
178
- data-collapsible={state === 'collapsed' ? collapsible : ''}
179
- data-variant={variant}
180
- data-side={side}
181
- >
182
- {/* This is what handles the sidebar gap on desktop */}
183
- <div
184
- className={cn(
185
- 'duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear',
186
- 'group-data-[collapsible=offcanvas]:w-0',
187
- 'group-data-[side=right]:rotate-180',
188
- variant === 'floating' || variant === 'inset'
189
- ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'
190
- : 'group-data-[collapsible=icon]:w-[--sidebar-width-icon]',
191
- )}
192
- />
193
- <div
194
- className={cn(
195
- 'duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex',
196
- side === 'left'
197
- ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
198
- : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
199
- // Adjust the padding for floating and inset variants.
200
- variant === 'floating' || variant === 'inset'
201
- ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'
202
- : 'group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l',
203
- className,
204
- )}
205
- {...props}
206
- >
207
- <div
208
- data-sidebar="sidebar"
209
- className="flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow"
210
- >
211
- {children}
212
- </div>
213
- </div>
214
- </div>
215
- )
216
- })
217
- Sidebar.displayName = 'Sidebar'
218
-
219
- const SidebarTrigger = React.forwardRef<React.ElementRef<typeof Button>, React.ComponentProps<typeof Button>>(
220
- ({ className, onClick, ...props }, ref) => {
221
- const { toggleSidebar } = useSidebar()
222
-
223
- return (
224
- <Button
225
- ref={ref}
226
- data-sidebar="trigger"
227
- variant="ghost"
228
- size="icon"
229
- className={cn('h-7 w-7', className)}
230
- onClick={(event) => {
231
- onClick?.(event)
232
- toggleSidebar()
233
- }}
234
- {...props}
235
- >
236
- <PanelLeft />
237
- <span className="sr-only">Toggle Sidebar</span>
238
- </Button>
239
- )
240
- },
241
- )
242
- SidebarTrigger.displayName = 'SidebarTrigger'
243
-
244
- const SidebarRail = React.forwardRef<HTMLButtonElement, React.ComponentProps<'button'>>(
245
- ({ className, ...props }, ref) => {
246
- const { toggleSidebar } = useSidebar()
247
-
248
- return (
249
- <button
250
- ref={ref}
251
- data-sidebar="rail"
252
- aria-label="Toggle Sidebar"
253
- tabIndex={-1}
254
- onClick={toggleSidebar}
255
- title="Toggle Sidebar"
256
- className={cn(
257
- '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',
258
- '[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize',
259
- '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
260
- 'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar',
261
- '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
262
- '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
263
- className,
264
- )}
265
- {...props}
266
- />
267
- )
268
- },
269
- )
270
- SidebarRail.displayName = 'SidebarRail'
271
-
272
- const SidebarInset = React.forwardRef<HTMLDivElement, React.ComponentProps<'main'>>(({ className, ...props }, ref) => {
273
- return (
274
- <main
275
- ref={ref}
276
- className={cn(
277
- 'relative flex min-h-svh flex-1 flex-col bg-background',
278
- 'peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] 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',
279
- className,
280
- )}
281
- {...props}
282
- />
283
- )
284
- })
285
- SidebarInset.displayName = 'SidebarInset'
286
-
287
- const SidebarInput = React.forwardRef<React.ElementRef<typeof Input>, React.ComponentProps<typeof Input>>(
288
- ({ className, ...props }, ref) => {
289
- return (
290
- <Input
291
- ref={ref}
292
- data-sidebar="input"
293
- className={cn(
294
- 'h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring',
295
- className,
296
- )}
297
- {...props}
298
- />
299
- )
300
- },
301
- )
302
- SidebarInput.displayName = 'SidebarInput'
303
-
304
- const SidebarHeader = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {
305
- return <div ref={ref} data-sidebar="header" className={cn('flex flex-col gap-2 p-2', className)} {...props} />
306
- })
307
- SidebarHeader.displayName = 'SidebarHeader'
308
-
309
- const SidebarFooter = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {
310
- return <div ref={ref} data-sidebar="footer" className={cn('flex flex-col gap-2 p-2', className)} {...props} />
311
- })
312
- SidebarFooter.displayName = 'SidebarFooter'
313
-
314
- const SidebarSeparator = React.forwardRef<React.ElementRef<typeof Separator>, React.ComponentProps<typeof Separator>>(
315
- ({ className, ...props }, ref) => {
316
- return (
317
- <Separator
318
- ref={ref}
319
- data-sidebar="separator"
320
- className={cn('mx-2 w-auto bg-sidebar-border', className)}
321
- {...props}
322
- />
323
- )
324
- },
325
- )
326
- SidebarSeparator.displayName = 'SidebarSeparator'
327
-
328
- const SidebarContent = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {
329
- return (
330
- <div
331
- ref={ref}
332
- data-sidebar="content"
333
- className={cn(
334
- 'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',
335
- className,
336
- )}
337
- {...props}
338
- />
339
- )
340
- })
341
- SidebarContent.displayName = 'SidebarContent'
342
-
343
- const SidebarGroup = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {
344
- return (
345
- <div
346
- ref={ref}
347
- data-sidebar="group"
348
- className={cn('relative flex w-full min-w-0 flex-col p-2', className)}
349
- {...props}
350
- />
351
- )
352
- })
353
- SidebarGroup.displayName = 'SidebarGroup'
354
-
355
- const SidebarGroupLabel = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'> & { asChild?: boolean }>(
356
- ({ className, asChild = false, ...props }, ref) => {
357
- const Comp = asChild ? Slot : 'div'
358
-
359
- return (
360
- <Comp
361
- ref={ref}
362
- data-sidebar="group-label"
363
- className={cn(
364
- 'duration-200 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,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
365
- 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
366
- className,
367
- )}
368
- {...props}
369
- />
370
- )
371
- },
372
- )
373
- SidebarGroupLabel.displayName = 'SidebarGroupLabel'
374
-
375
- const SidebarGroupAction = React.forwardRef<HTMLButtonElement, React.ComponentProps<'button'> & { asChild?: boolean }>(
376
- ({ className, asChild = false, ...props }, ref) => {
377
- const Comp = asChild ? Slot : 'button'
378
-
379
- return (
380
- <Comp
381
- ref={ref}
382
- data-sidebar="group-action"
383
- className={cn(
384
- 'absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
385
- // Increases the hit area of the button on mobile.
386
- 'after:absolute after:-inset-2 after:md:hidden',
387
- 'group-data-[collapsible=icon]:hidden',
388
- className,
389
- )}
390
- {...props}
391
- />
392
- )
393
- },
394
- )
395
- SidebarGroupAction.displayName = 'SidebarGroupAction'
396
-
397
- const SidebarGroupContent = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
398
- ({ className, ...props }, ref) => (
399
- <div ref={ref} data-sidebar="group-content" className={cn('w-full text-sm', className)} {...props} />
400
- ),
401
- )
402
- SidebarGroupContent.displayName = 'SidebarGroupContent'
403
-
404
- const SidebarMenu = React.forwardRef<HTMLUListElement, React.ComponentProps<'ul'>>(({ className, ...props }, ref) => (
405
- <ul ref={ref} data-sidebar="menu" className={cn('flex w-full min-w-0 flex-col gap-1', className)} {...props} />
406
- ))
407
- SidebarMenu.displayName = 'SidebarMenu'
408
-
409
- const SidebarMenuItem = React.forwardRef<HTMLLIElement, React.ComponentProps<'li'>>(({ className, ...props }, ref) => (
410
- <li ref={ref} data-sidebar="menu-item" className={cn('group/menu-item relative', className)} {...props} />
411
- ))
412
- SidebarMenuItem.displayName = 'SidebarMenuItem'
413
-
414
- const sidebarMenuButtonVariants = cva(
415
- '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 group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
416
- {
417
- variants: {
418
- variant: {
419
- default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
420
- outline:
421
- 'bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]',
422
- },
423
- size: {
424
- default: 'h-8 text-sm',
425
- sm: 'h-7 text-xs',
426
- lg: 'h-12 text-sm group-data-[collapsible=icon]:!p-0',
427
- },
428
- },
429
- defaultVariants: {
430
- variant: 'default',
431
- size: 'default',
432
- },
433
- },
434
- )
435
-
436
- const SidebarMenuButton = React.forwardRef<
437
- HTMLButtonElement,
438
- React.ComponentProps<'button'> & {
439
- asChild?: boolean
440
- isActive?: boolean
441
- tooltip?: string | React.ComponentProps<typeof TooltipContent>
442
- } & VariantProps<typeof sidebarMenuButtonVariants>
443
- >(({ asChild = false, isActive = false, variant = 'default', size = 'default', tooltip, className, ...props }, ref) => {
444
- const Comp = asChild ? Slot : 'button'
445
- const { isMobile, state } = useSidebar()
446
-
447
- const button = (
448
- <Comp
449
- ref={ref}
450
- data-sidebar="menu-button"
451
- data-size={size}
452
- data-active={isActive}
453
- className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
454
- {...props}
455
- />
456
- )
457
-
458
- if (!tooltip) {
459
- return button
460
- }
461
-
462
- if (typeof tooltip === 'string') {
463
- tooltip = {
464
- children: tooltip,
465
- }
466
- }
467
-
468
- return (
469
- <Tooltip>
470
- <TooltipTrigger asChild>{button}</TooltipTrigger>
471
- <TooltipContent side="right" align="center" hidden={state !== 'collapsed' || isMobile} {...tooltip} />
472
- </Tooltip>
473
- )
474
- })
475
- SidebarMenuButton.displayName = 'SidebarMenuButton'
476
-
477
- const SidebarMenuAction = React.forwardRef<
478
- HTMLButtonElement,
479
- React.ComponentProps<'button'> & {
480
- asChild?: boolean
481
- showOnHover?: boolean
482
- }
483
- >(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
484
- const Comp = asChild ? Slot : 'button'
485
-
486
- return (
487
- <Comp
488
- ref={ref}
489
- data-sidebar="menu-action"
490
- className={cn(
491
- 'absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0',
492
- // Increases the hit area of the button on mobile.
493
- 'after:absolute after:-inset-2 after:md:hidden',
494
- 'peer-data-[size=sm]/menu-button:top-1',
495
- 'peer-data-[size=default]/menu-button:top-1.5',
496
- 'peer-data-[size=lg]/menu-button:top-2.5',
497
- 'group-data-[collapsible=icon]:hidden',
498
- showOnHover &&
499
- 'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0',
500
- className,
501
- )}
502
- {...props}
503
- />
504
- )
505
- })
506
- SidebarMenuAction.displayName = 'SidebarMenuAction'
507
-
508
- const SidebarMenuBadge = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
509
- ({ className, ...props }, ref) => (
510
- <div
511
- ref={ref}
512
- data-sidebar="menu-badge"
513
- className={cn(
514
- 'absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none',
515
- 'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',
516
- 'peer-data-[size=sm]/menu-button:top-1',
517
- 'peer-data-[size=default]/menu-button:top-1.5',
518
- 'peer-data-[size=lg]/menu-button:top-2.5',
519
- 'group-data-[collapsible=icon]:hidden',
520
- className,
521
- )}
522
- {...props}
523
- />
524
- ),
525
- )
526
- SidebarMenuBadge.displayName = 'SidebarMenuBadge'
527
-
528
- const SidebarMenuSkeleton = React.forwardRef<
529
- HTMLDivElement,
530
- React.ComponentProps<'div'> & {
531
- showIcon?: boolean
532
- }
533
- >(({ className, showIcon = false, ...props }, ref) => {
534
- // Random width between 50 to 90%.
535
- const width = React.useMemo(() => {
536
- return `${Math.floor(Math.random() * 40) + 50}%`
537
- }, [])
538
-
539
- return (
540
- <div
541
- ref={ref}
542
- data-sidebar="menu-skeleton"
543
- className={cn('rounded-md h-8 flex gap-2 px-2 items-center', className)}
544
- {...props}
545
- >
546
- {showIcon && <Skeleton className="size-4 rounded-md" data-sidebar="menu-skeleton-icon" />}
547
- <Skeleton
548
- className="h-4 flex-1 max-w-[--skeleton-width]"
549
- data-sidebar="menu-skeleton-text"
550
- style={
551
- {
552
- '--skeleton-width': width,
553
- } as React.CSSProperties
554
- }
555
- />
556
- </div>
557
- )
558
- })
559
- SidebarMenuSkeleton.displayName = 'SidebarMenuSkeleton'
560
-
561
- const SidebarMenuSub = React.forwardRef<HTMLUListElement, React.ComponentProps<'ul'>>(
562
- ({ className, ...props }, ref) => (
563
- <ul
564
- ref={ref}
565
- data-sidebar="menu-sub"
566
- className={cn(
567
- 'mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5',
568
- 'group-data-[collapsible=icon]:hidden',
569
- className,
570
- )}
571
- {...props}
572
- />
573
- ),
574
- )
575
- SidebarMenuSub.displayName = 'SidebarMenuSub'
576
-
577
- const SidebarMenuSubItem = React.forwardRef<HTMLLIElement, React.ComponentProps<'li'>>(({ ...props }, ref) => (
578
- <li ref={ref} {...props} />
579
- ))
580
- SidebarMenuSubItem.displayName = 'SidebarMenuSubItem'
581
-
582
- const SidebarMenuSubButton = React.forwardRef<
583
- HTMLAnchorElement,
584
- React.ComponentProps<'a'> & {
585
- asChild?: boolean
586
- size?: 'sm' | 'md'
587
- isActive?: boolean
588
- }
589
- >(({ asChild = false, size = 'md', isActive, className, ...props }, ref) => {
590
- const Comp = asChild ? Slot : 'a'
591
-
592
- return (
593
- <Comp
594
- ref={ref}
595
- data-sidebar="menu-sub-button"
596
- data-size={size}
597
- data-active={isActive}
598
- className={cn(
599
- 'flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring 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 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground',
600
- 'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground',
601
- size === 'sm' && 'text-xs',
602
- size === 'md' && 'text-sm',
603
- 'group-data-[collapsible=icon]:hidden',
604
- className,
605
- )}
606
- {...props}
607
- />
608
- )
609
- })
610
- SidebarMenuSubButton.displayName = 'SidebarMenuSubButton'
611
-
612
- export {
613
- Sidebar,
614
- SidebarContent,
615
- SidebarFooter,
616
- SidebarGroup,
617
- SidebarGroupAction,
618
- SidebarGroupContent,
619
- SidebarGroupLabel,
620
- SidebarHeader,
621
- SidebarInput,
622
- SidebarInset,
623
- SidebarMenu,
624
- SidebarMenuAction,
625
- SidebarMenuBadge,
626
- SidebarMenuButton,
627
- SidebarMenuItem,
628
- SidebarMenuSkeleton,
629
- SidebarMenuSub,
630
- SidebarMenuSubButton,
631
- SidebarMenuSubItem,
632
- SidebarProvider,
633
- SidebarRail,
634
- SidebarSeparator,
635
- SidebarTrigger,
636
- useSidebar,
637
- }
@@ -1,7 +0,0 @@
1
- import { cn } from '@/lib/utils'
2
-
3
- function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
4
- return <div className={cn('animate-pulse rounded-md bg-primary/10', className)} {...props} />
5
- }
6
-
7
- export { Skeleton }
@@ -1,27 +0,0 @@
1
- import * as React from "react"
2
- import * as SwitchPrimitives from "@radix-ui/react-switch"
3
-
4
- import { cn } from "@/lib/utils"
5
-
6
- const Switch = React.forwardRef<
7
- React.ElementRef<typeof SwitchPrimitives.Root>,
8
- React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
9
- >(({ className, ...props }, ref) => (
10
- <SwitchPrimitives.Root
11
- className={cn(
12
- "peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
13
- className
14
- )}
15
- {...props}
16
- ref={ref}
17
- >
18
- <SwitchPrimitives.Thumb
19
- className={cn(
20
- "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
21
- )}
22
- />
23
- </SwitchPrimitives.Root>
24
- ))
25
- Switch.displayName = SwitchPrimitives.Root.displayName
26
-
27
- export { Switch }