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