@alpic-ai/ui 0.0.0-staging.433fefa → 0.0.0-staging.4bd7e7e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/sidebar.mjs +28 -13
- package/package.json +1 -1
- package/src/components/sidebar.tsx +12 -11
|
@@ -6,7 +6,6 @@ import { Separator } from "./separator.mjs";
|
|
|
6
6
|
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "./sheet.mjs";
|
|
7
7
|
import { useIsMobile } from "../hooks/use-mobile.mjs";
|
|
8
8
|
import { Skeleton } from "./skeleton.mjs";
|
|
9
|
-
import { PanelLeftClose, PanelLeftOpen } from "lucide-react";
|
|
10
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { cva } from "class-variance-authority";
|
|
12
11
|
import * as React from "react";
|
|
@@ -132,8 +131,7 @@ function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas"
|
|
|
132
131
|
});
|
|
133
132
|
}
|
|
134
133
|
function SidebarTrigger({ className, onClick, ...props }) {
|
|
135
|
-
const {
|
|
136
|
-
const isOpen = isMobile ? openMobile : state === "expanded";
|
|
134
|
+
const { toggleSidebar } = useSidebar();
|
|
137
135
|
return /* @__PURE__ */ jsxs(Button, {
|
|
138
136
|
"data-sidebar": "trigger",
|
|
139
137
|
"data-slot": "sidebar-trigger",
|
|
@@ -145,12 +143,35 @@ function SidebarTrigger({ className, onClick, ...props }) {
|
|
|
145
143
|
toggleSidebar();
|
|
146
144
|
},
|
|
147
145
|
...props,
|
|
148
|
-
children: [
|
|
146
|
+
children: [/* @__PURE__ */ jsx(SidebarToggleIcon, { className: "size-4.5" }), /* @__PURE__ */ jsx("span", {
|
|
149
147
|
className: "sr-only",
|
|
150
148
|
children: "Toggle Sidebar"
|
|
151
149
|
})]
|
|
152
150
|
});
|
|
153
151
|
}
|
|
152
|
+
function SidebarToggleIcon({ className, ...props }) {
|
|
153
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
154
|
+
viewBox: "0 0 20 20",
|
|
155
|
+
fill: "none",
|
|
156
|
+
"aria-hidden": "true",
|
|
157
|
+
className,
|
|
158
|
+
...props,
|
|
159
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
160
|
+
x: "2.75",
|
|
161
|
+
y: "2.75",
|
|
162
|
+
width: "14.5",
|
|
163
|
+
height: "14.5",
|
|
164
|
+
rx: "4",
|
|
165
|
+
stroke: "currentColor",
|
|
166
|
+
strokeWidth: "1.5"
|
|
167
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
168
|
+
d: "M10 4.75V15.25",
|
|
169
|
+
stroke: "currentColor",
|
|
170
|
+
strokeWidth: "1.5",
|
|
171
|
+
strokeLinecap: "round"
|
|
172
|
+
})]
|
|
173
|
+
});
|
|
174
|
+
}
|
|
154
175
|
function SidebarRail({ className, ...props }) {
|
|
155
176
|
const { toggleSidebar } = useSidebar();
|
|
156
177
|
return /* @__PURE__ */ jsx("button", {
|
|
@@ -187,15 +208,9 @@ function SidebarHeader({ className, icon, title, children, ...props }) {
|
|
|
187
208
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
188
209
|
className: "flex h-8 items-center gap-2 px-3",
|
|
189
210
|
children: [
|
|
190
|
-
/* @__PURE__ */
|
|
191
|
-
className: "
|
|
192
|
-
children:
|
|
193
|
-
className: "transition-opacity group-data-[collapsible=icon]:group-hover:opacity-0",
|
|
194
|
-
children: icon
|
|
195
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
196
|
-
className: "absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-data-[collapsible=icon]:group-hover:opacity-100",
|
|
197
|
-
children: /* @__PURE__ */ jsx(SidebarTrigger, {})
|
|
198
|
-
})]
|
|
211
|
+
/* @__PURE__ */ jsx("div", {
|
|
212
|
+
className: "shrink-0",
|
|
213
|
+
children: icon
|
|
199
214
|
}),
|
|
200
215
|
/* @__PURE__ */ jsx("span", {
|
|
201
216
|
className: "text-foreground text-md min-w-0 truncate font-medium group-data-[collapsible=icon]:hidden",
|
package/package.json
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { Slot } from "@radix-ui/react-slot";
|
|
4
4
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
|
-
import { PanelLeftClose, PanelLeftOpen } from "lucide-react";
|
|
6
5
|
import * as React from "react";
|
|
7
6
|
|
|
8
7
|
import { useIsMobile } from "../hooks/use-mobile";
|
|
@@ -231,9 +230,7 @@ function Sidebar({
|
|
|
231
230
|
}
|
|
232
231
|
|
|
233
232
|
function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {
|
|
234
|
-
const {
|
|
235
|
-
|
|
236
|
-
const isOpen = isMobile ? openMobile : state === "expanded";
|
|
233
|
+
const { toggleSidebar } = useSidebar();
|
|
237
234
|
|
|
238
235
|
return (
|
|
239
236
|
<Button
|
|
@@ -248,12 +245,21 @@ function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<t
|
|
|
248
245
|
}}
|
|
249
246
|
{...props}
|
|
250
247
|
>
|
|
251
|
-
|
|
248
|
+
<SidebarToggleIcon className="size-4.5" />
|
|
252
249
|
<span className="sr-only">Toggle Sidebar</span>
|
|
253
250
|
</Button>
|
|
254
251
|
);
|
|
255
252
|
}
|
|
256
253
|
|
|
254
|
+
function SidebarToggleIcon({ className, ...props }: React.ComponentProps<"svg">) {
|
|
255
|
+
return (
|
|
256
|
+
<svg viewBox="0 0 20 20" fill="none" aria-hidden="true" className={className} {...props}>
|
|
257
|
+
<rect x="2.75" y="2.75" width="14.5" height="14.5" rx="4" stroke="currentColor" strokeWidth="1.5" />
|
|
258
|
+
<path d="M10 4.75V15.25" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" />
|
|
259
|
+
</svg>
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
|
|
257
263
|
function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
|
|
258
264
|
const { toggleSidebar } = useSidebar();
|
|
259
265
|
|
|
@@ -320,12 +326,7 @@ function SidebarHeader({ className, icon, title, children, ...props }: SidebarHe
|
|
|
320
326
|
{...props}
|
|
321
327
|
>
|
|
322
328
|
<div className="flex h-8 items-center gap-2 px-3">
|
|
323
|
-
<div className="
|
|
324
|
-
<span className="transition-opacity group-data-[collapsible=icon]:group-hover:opacity-0">{icon}</span>
|
|
325
|
-
<div className="absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-data-[collapsible=icon]:group-hover:opacity-100">
|
|
326
|
-
<SidebarTrigger />
|
|
327
|
-
</div>
|
|
328
|
-
</div>
|
|
329
|
+
<div className="shrink-0">{icon}</div>
|
|
329
330
|
<span className="text-foreground text-md min-w-0 truncate font-medium group-data-[collapsible=icon]:hidden">
|
|
330
331
|
{title}
|
|
331
332
|
</span>
|