@appcorp/shadcn 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/app-sidebar.js +1 -34
- package/components/audio.js +1 -13
- package/components/dashboard.js +1 -29
- package/components/drawer-generic.js +1 -39
- package/components/enhanced-checkbox.js +1 -39
- package/components/enhanced-combobox.js +1 -271
- package/components/enhanced-drawer-footer.js +1 -30
- package/components/enhanced-drawer-header.js +1 -7
- package/components/enhanced-dropzone-impl.js +1 -218
- package/components/enhanced-dropzone.js +1 -8
- package/components/enhanced-input.js +1 -40
- package/components/enhanced-label.js +1 -22
- package/components/enhanced-radio.js +1 -15
- package/components/enhanced-select.js +1 -33
- package/components/enhanced-slider.js +1 -33
- package/components/enhanced-switch.js +1 -42
- package/components/enhanced-table-footer-action.js +1 -102
- package/components/enhanced-table-footer-page.js +1 -124
- package/components/enhanced-table-footer-pagination.js +1 -108
- package/components/enhanced-table-header-action.js +1 -32
- package/components/enhanced-table-header-search.js +1 -10
- package/components/enhanced-table.js +1 -301
- package/components/enhanced-textarea.js +1 -40
- package/components/field.js +1 -96
- package/components/image-resize-dialog.js +1 -82
- package/components/nav-main.js +1 -40
- package/components/nav-projects.js +1 -39
- package/components/nav-user.js +1 -52
- package/components/show-toast.js +1 -7
- package/components/sidebar.js +1 -257
- package/components/team-switcher.js +1 -42
- package/components/theme-provider.js +1 -112
- package/components/timeline.js +1 -13
- package/components/tooltip.js +1 -36
- package/components/ui/accordion.js +1 -37
- package/components/ui/alert-dialog.js +1 -63
- package/components/ui/alert.js +1 -41
- package/components/ui/area-chart-v1-impl.js +1 -75
- package/components/ui/area-chart-v1.js +1 -5
- package/components/ui/aspect-ratio.js +1 -4
- package/components/ui/avatar.js +1 -31
- package/components/ui/badge.js +1 -32
- package/components/ui/breadcrumb.js +1 -54
- package/components/ui/button.js +1 -44
- package/components/ui/calendar-impl.js +1 -55
- package/components/ui/calendar.js +1 -6
- package/components/ui/card.js +1 -44
- package/components/ui/carousel-impl.js +1 -117
- package/components/ui/carousel.js +1 -9
- package/components/ui/chart-impl.js +6 -161
- package/components/ui/chart.js +1 -10
- package/components/ui/checkbox.js +1 -24
- package/components/ui/collapsible.js +1 -6
- package/components/ui/combobox.js +1 -52
- package/components/ui/command-impl.js +1 -63
- package/components/ui/command.js +1 -13
- package/components/ui/context-menu.js +1 -80
- package/components/ui/dialog.js +1 -57
- package/components/ui/drawer-impl.js +1 -56
- package/components/ui/drawer.js +1 -14
- package/components/ui/dropdown-menu.js +1 -82
- package/components/ui/form.d.ts +1 -1
- package/components/ui/form.js +1 -78
- package/components/ui/hover-card.js +1 -23
- package/components/ui/input-otp-impl.js +1 -43
- package/components/ui/input-otp.js +1 -8
- package/components/ui/input.js +1 -19
- package/components/ui/label.js +1 -23
- package/components/ui/language-selector.js +1 -25
- package/components/ui/menubar.js +1 -103
- package/components/ui/navigation-menu.js +1 -59
- package/components/ui/pagination.js +1 -60
- package/components/ui/popover.js +1 -25
- package/components/ui/progress.js +1 -22
- package/components/ui/radio-group.js +1 -29
- package/components/ui/resizable-impl.js +1 -27
- package/components/ui/resizable.js +1 -7
- package/components/ui/scroll-area.js +1 -32
- package/components/ui/select.js +1 -71
- package/components/ui/separator.js +1 -21
- package/components/ui/sheet.js +1 -71
- package/components/ui/skeleton.js +1 -18
- package/components/ui/slider.js +1 -32
- package/components/ui/sonner.js +1 -28
- package/components/ui/switch.js +1 -22
- package/components/ui/table.js +1 -55
- package/components/ui/tabs.js +1 -32
- package/components/ui/textarea.js +1 -19
- package/components/ui/theme-switcher.js +1 -102
- package/components/ui/toggle.js +1 -39
- package/data/admin-dashboard.js +1 -301
- package/hooks/use-enhanced-combobox.js +1 -73
- package/hooks/use-mobile.js +1 -15
- package/hooks/use-outside-click.js +1 -19
- package/lib/themes.js +1 -147
- package/lib/toast-utils.js +1 -170
- package/lib/utils.js +1 -5
- package/package.json +2 -2
- package/utils/transform-breadcrumbs.js +1 -7
- package/utils/transform-navitems.js +1 -18
|
@@ -1,40 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import * as React from "react";
|
|
13
|
-
import { cn } from "../lib/utils";
|
|
14
|
-
import { Textarea } from "./ui/textarea";
|
|
15
|
-
import { EnhancedLabel } from "./enhanced-label";
|
|
16
|
-
const EnhancedTextarea = React.forwardRef((_a, ref) => {
|
|
17
|
-
var { className, error, info, label, required, id, testIdWrapper, testIdLabel, testIdTextarea, testIdMessage, testIdError, testIdInfo } = _a, props = __rest(_a, ["className", "error", "info", "label", "required", "id", "testIdWrapper", "testIdLabel", "testIdTextarea", "testIdMessage", "testIdError", "testIdInfo"]);
|
|
18
|
-
// Determine if there's an error (for aria-invalid and styling)
|
|
19
|
-
const hasError = Boolean(error);
|
|
20
|
-
const textareaElement = (React.createElement(Textarea, Object.assign({ ref: ref, id: id, "data-testid": testIdTextarea, "aria-invalid": hasError, required: required, className: cn(
|
|
21
|
-
// Error state styling
|
|
22
|
-
hasError &&
|
|
23
|
-
"border-destructive focus-visible:border-destructive focus-visible:ring-destructive/20",
|
|
24
|
-
// Normal state when no error
|
|
25
|
-
!hasError &&
|
|
26
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className) }, props)));
|
|
27
|
-
// If label is provided, render the complete textarea with label structure
|
|
28
|
-
if (label) {
|
|
29
|
-
return (React.createElement("div", { className: "w-full space-y-2", "data-testid": testIdWrapper },
|
|
30
|
-
React.createElement(EnhancedLabel, { htmlFor: id, required: required, testIdLabel: testIdLabel }, label),
|
|
31
|
-
textareaElement,
|
|
32
|
-
(error || info) && (React.createElement("div", { "data-testid": testIdMessage }, error ? (React.createElement("p", { className: "text-xs text-destructive", "data-testid": testIdError }, error)) : info ? (React.createElement("p", { className: "text-xs text-blue-600 dark:text-blue-400", "data-testid": testIdInfo }, info)) : null))));
|
|
33
|
-
}
|
|
34
|
-
// If no label, render just the textarea with messages (backward compatibility)
|
|
35
|
-
return (React.createElement("div", { className: "w-full", "data-testid": testIdWrapper },
|
|
36
|
-
textareaElement,
|
|
37
|
-
(error || info) && (React.createElement("div", { "data-testid": testIdMessage }, error ? (React.createElement("p", { className: "text-xs text-destructive", "data-testid": testIdError }, error)) : info ? (React.createElement("p", { className: "text-xs text-blue-600 dark:text-blue-400", "data-testid": testIdInfo }, info)) : null))));
|
|
38
|
-
});
|
|
39
|
-
EnhancedTextarea.displayName = "EnhancedTextarea";
|
|
40
|
-
export { EnhancedTextarea };
|
|
1
|
+
"use strict";var I=function(a,d){var s={};for(var e in a)Object.prototype.hasOwnProperty.call(a,e)&&d.indexOf(e)<0&&(s[e]=a[e]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,e=Object.getOwnPropertySymbols(a);t<e.length;t++)d.indexOf(e[t])<0&&Object.prototype.propertyIsEnumerable.call(a,e[t])&&(s[e[t]]=a[e[t]]);return s};import*as r from"react";import{cn as y}from"../lib/utils";import{Textarea as N}from"./ui/textarea";import{EnhancedLabel as O}from"./enhanced-label";const b=r.forwardRef((a,d)=>{var{className:s,error:e,info:t,label:l,required:n,id:c,testIdWrapper:o,testIdLabel:v,testIdTextarea:x,testIdMessage:m,testIdError:u,testIdInfo:f}=a,E=I(a,["className","error","info","label","required","id","testIdWrapper","testIdLabel","testIdTextarea","testIdMessage","testIdError","testIdInfo"]);const i=!!e,p=r.createElement(N,Object.assign({ref:d,id:c,"data-testid":x,"aria-invalid":i,required:n,className:y(i&&"border-destructive focus-visible:border-destructive focus-visible:ring-destructive/20",!i&&"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",s)},E));return l?r.createElement("div",{className:"w-full space-y-2","data-testid":o},r.createElement(O,{htmlFor:c,required:n,testIdLabel:v},l),p,(e||t)&&r.createElement("div",{"data-testid":m},e?r.createElement("p",{className:"text-xs text-destructive","data-testid":u},e):t?r.createElement("p",{className:"text-xs text-blue-600 dark:text-blue-400","data-testid":f},t):null)):r.createElement("div",{className:"w-full","data-testid":o},p,(e||t)&&r.createElement("div",{"data-testid":m},e?r.createElement("p",{className:"text-xs text-destructive","data-testid":u},e):t?r.createElement("p",{className:"text-xs text-blue-600 dark:text-blue-400","data-testid":f},t):null))});b.displayName="EnhancedTextarea";export{b as EnhancedTextarea};
|
package/components/field.js
CHANGED
|
@@ -1,96 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
import React, { useMemo } from "react";
|
|
14
|
-
import { cva } from "class-variance-authority";
|
|
15
|
-
import { cn } from "../lib/utils";
|
|
16
|
-
import { Label } from "./ui/label";
|
|
17
|
-
import { Separator } from "./ui/separator";
|
|
18
|
-
function FieldSet(_a) {
|
|
19
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
20
|
-
return (React.createElement("fieldset", Object.assign({ "data-slot": "field-set", className: cn("flex flex-col gap-6", "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className) }, props)));
|
|
21
|
-
}
|
|
22
|
-
function FieldLegend(_a) {
|
|
23
|
-
var { className, variant = "legend" } = _a, props = __rest(_a, ["className", "variant"]);
|
|
24
|
-
return (React.createElement("legend", Object.assign({ "data-slot": "field-legend", "data-variant": variant, className: cn("mb-3 font-medium", "data-[variant=legend]:text-base", "data-[variant=label]:text-sm", className) }, props)));
|
|
25
|
-
}
|
|
26
|
-
function FieldGroup(_a) {
|
|
27
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
28
|
-
return (React.createElement("div", Object.assign({ "data-slot": "field-group", className: cn("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4", className) }, props)));
|
|
29
|
-
}
|
|
30
|
-
const fieldVariants = cva("group/field data-[invalid=true]:text-destructive flex w-full gap-3", {
|
|
31
|
-
variants: {
|
|
32
|
-
orientation: {
|
|
33
|
-
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
34
|
-
horizontal: [
|
|
35
|
-
"flex-row items-center",
|
|
36
|
-
"[&>[data-slot=field-label]]:flex-auto",
|
|
37
|
-
"has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px has-[>[data-slot=field-content]]:items-start",
|
|
38
|
-
],
|
|
39
|
-
responsive: [
|
|
40
|
-
"@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto flex-col [&>*]:w-full [&>.sr-only]:w-auto",
|
|
41
|
-
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
42
|
-
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
defaultVariants: {
|
|
47
|
-
orientation: "vertical",
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
function Field(_a) {
|
|
51
|
-
var { className, orientation = "vertical" } = _a, props = __rest(_a, ["className", "orientation"]);
|
|
52
|
-
return (React.createElement("div", Object.assign({ role: "group", "data-slot": "field", "data-orientation": orientation, className: cn(fieldVariants({ orientation }), className) }, props)));
|
|
53
|
-
}
|
|
54
|
-
function FieldContent(_a) {
|
|
55
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
56
|
-
return (React.createElement("div", Object.assign({ "data-slot": "field-content", className: cn("group/field-content flex flex-1 flex-col gap-1.5 leading-snug", className) }, props)));
|
|
57
|
-
}
|
|
58
|
-
function FieldLabel(_a) {
|
|
59
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
60
|
-
return (React.createElement(Label, Object.assign({ "data-slot": "field-label", className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>[data-slot=field]]:p-4", "has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10", className) }, props)));
|
|
61
|
-
}
|
|
62
|
-
function FieldTitle(_a) {
|
|
63
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
64
|
-
return (React.createElement("div", Object.assign({ "data-slot": "field-label", className: cn("flex w-fit items-center gap-2 text-sm font-medium leading-snug group-data-[disabled=true]/field:opacity-50", className) }, props)));
|
|
65
|
-
}
|
|
66
|
-
function FieldDescription(_a) {
|
|
67
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
68
|
-
return (React.createElement("p", Object.assign({ "data-slot": "field-description", className: cn("text-muted-foreground text-sm font-normal leading-normal group-has-[[data-orientation=horizontal]]/field:text-balance", "nth-last-2:-mt-1 last:mt-0 [[data-variant=legend]+&]:-mt-1.5", "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4", className) }, props)));
|
|
69
|
-
}
|
|
70
|
-
function FieldSeparator(_a) {
|
|
71
|
-
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
|
|
72
|
-
return (React.createElement("div", Object.assign({ "data-slot": "field-separator", "data-content": !!children, className: cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className) }, props),
|
|
73
|
-
React.createElement(Separator, { className: "absolute inset-0 top-1/2" }),
|
|
74
|
-
children && (React.createElement("span", { className: "bg-background text-muted-foreground relative mx-auto block w-fit px-2", "data-slot": "field-separator-content" }, children))));
|
|
75
|
-
}
|
|
76
|
-
function FieldError(_a) {
|
|
77
|
-
var { className, children, errors } = _a, props = __rest(_a, ["className", "children", "errors"]);
|
|
78
|
-
const content = useMemo(() => {
|
|
79
|
-
var _a;
|
|
80
|
-
if (children) {
|
|
81
|
-
return children;
|
|
82
|
-
}
|
|
83
|
-
if (!errors) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
if ((errors === null || errors === void 0 ? void 0 : errors.length) === 1 && ((_a = errors[0]) === null || _a === void 0 ? void 0 : _a.message)) {
|
|
87
|
-
return errors[0].message;
|
|
88
|
-
}
|
|
89
|
-
return (React.createElement("ul", { className: "ml-4 flex list-disc flex-col gap-1" }, errors.map((error, index) => (error === null || error === void 0 ? void 0 : error.message) && React.createElement("li", { key: index }, error.message))));
|
|
90
|
-
}, [children, errors]);
|
|
91
|
-
if (!content) {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
return (React.createElement("div", Object.assign({ role: "alert", "data-slot": "field-error", className: cn("text-destructive text-sm font-normal", className) }, props), content));
|
|
95
|
-
}
|
|
96
|
-
export { Field, FieldLabel, FieldDescription, FieldError, FieldGroup, FieldLegend, FieldSeparator, FieldSet, FieldContent, FieldTitle, };
|
|
1
|
+
"use strict";"use client";var s=function(e,l){var a={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&l.indexOf(t)<0&&(a[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,t=Object.getOwnPropertySymbols(e);n<t.length;n++)l.indexOf(t[n])<0&&Object.prototype.propertyIsEnumerable.call(e,t[n])&&(a[t[n]]=e[t[n]]);return a};import r,{useMemo as m}from"react";import{cva as u}from"class-variance-authority";import{cn as o}from"../lib/utils";import{Label as p}from"./ui/label";import{Separator as g}from"./ui/separator";function v(e){var{className:l}=e,a=s(e,["className"]);return r.createElement("fieldset",Object.assign({"data-slot":"field-set",className:o("flex flex-col gap-6","has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",l)},a))}function b(e){var{className:l,variant:a="legend"}=e,t=s(e,["className","variant"]);return r.createElement("legend",Object.assign({"data-slot":"field-legend","data-variant":a,className:o("mb-3 font-medium","data-[variant=legend]:text-base","data-[variant=label]:text-sm",l)},t))}function x(e){var{className:l}=e,a=s(e,["className"]);return r.createElement("div",Object.assign({"data-slot":"field-group",className:o("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",l)},a))}const h=u("group/field data-[invalid=true]:text-destructive flex w-full gap-3",{variants:{orientation:{vertical:["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],horizontal:["flex-row items-center","[&>[data-slot=field-label]]:flex-auto","has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px has-[>[data-slot=field-content]]:items-start"],responsive:["@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto flex-col [&>*]:w-full [&>.sr-only]:w-auto","@md/field-group:[&>[data-slot=field-label]]:flex-auto","@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"]}},defaultVariants:{orientation:"vertical"}});function N(e){var{className:l,orientation:a="vertical"}=e,t=s(e,["className","orientation"]);return r.createElement("div",Object.assign({role:"group","data-slot":"field","data-orientation":a,className:o(h({orientation:a}),l)},t))}function y(e){var{className:l}=e,a=s(e,["className"]);return r.createElement("div",Object.assign({"data-slot":"field-content",className:o("group/field-content flex flex-1 flex-col gap-1.5 leading-snug",l)},a))}function O(e){var{className:l}=e,a=s(e,["className"]);return r.createElement(p,Object.assign({"data-slot":"field-label",className:o("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>[data-slot=field]]:p-4","has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",l)},a))}function w(e){var{className:l}=e,a=s(e,["className"]);return r.createElement("div",Object.assign({"data-slot":"field-label",className:o("flex w-fit items-center gap-2 text-sm font-medium leading-snug group-data-[disabled=true]/field:opacity-50",l)},a))}function E(e){var{className:l}=e,a=s(e,["className"]);return r.createElement("p",Object.assign({"data-slot":"field-description",className:o("text-muted-foreground text-sm font-normal leading-normal group-has-[[data-orientation=horizontal]]/field:text-balance","nth-last-2:-mt-1 last:mt-0 [[data-variant=legend]+&]:-mt-1.5","[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",l)},a))}function j(e){var{children:l,className:a}=e,t=s(e,["children","className"]);return r.createElement("div",Object.assign({"data-slot":"field-separator","data-content":!!l,className:o("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",a)},t),r.createElement(g,{className:"absolute inset-0 top-1/2"}),l&&r.createElement("span",{className:"bg-background text-muted-foreground relative mx-auto block w-fit px-2","data-slot":"field-separator-content"},l))}function k(e){var{className:l,children:a,errors:t}=e,n=s(e,["className","children","errors"]);const c=m(()=>{var d;return a||(t?t?.length===1&&(!((d=t[0])===null||d===void 0)&&d.message)?t[0].message:r.createElement("ul",{className:"ml-4 flex list-disc flex-col gap-1"},t.map((i,f)=>i?.message&&r.createElement("li",{key:f},i.message))):null)},[a,t]);return c?r.createElement("div",Object.assign({role:"alert","data-slot":"field-error",className:o("text-destructive text-sm font-normal",l)},n),c):null}export{N as Field,O as FieldLabel,E as FieldDescription,k as FieldError,x as FieldGroup,b as FieldLegend,j as FieldSeparator,v as FieldSet,y as FieldContent,w as FieldTitle};
|
|
@@ -1,82 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { Suspense, useCallback, useState } from "react";
|
|
3
|
-
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "./ui/dialog";
|
|
4
|
-
import { Button } from "./ui/button";
|
|
5
|
-
import { Slider } from "./ui/slider";
|
|
6
|
-
const Cropper = React.lazy(() => import("react-easy-crop"));
|
|
7
|
-
/**
|
|
8
|
-
* Create a cropped image from the provided source and crop area.
|
|
9
|
-
*/
|
|
10
|
-
async function getCroppedImg(imageSrc, pixelCrop, fileName = "cropped-image.jpg") {
|
|
11
|
-
const image = await createImage(imageSrc);
|
|
12
|
-
const canvas = document.createElement("canvas");
|
|
13
|
-
const ctx = canvas.getContext("2d");
|
|
14
|
-
if (!ctx) {
|
|
15
|
-
throw new Error("No 2d context");
|
|
16
|
-
}
|
|
17
|
-
// Set canvas size to match the crop area
|
|
18
|
-
canvas.width = pixelCrop.width;
|
|
19
|
-
canvas.height = pixelCrop.height;
|
|
20
|
-
// Draw the cropped image
|
|
21
|
-
ctx.drawImage(image, pixelCrop.x, pixelCrop.y, pixelCrop.width, pixelCrop.height, 0, 0, pixelCrop.width, pixelCrop.height);
|
|
22
|
-
// Convert canvas to blob and then to File
|
|
23
|
-
return new Promise((resolve, reject) => {
|
|
24
|
-
canvas.toBlob((blob) => {
|
|
25
|
-
if (!blob) {
|
|
26
|
-
reject(new Error("Canvas is empty"));
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const file = new File([blob], fileName, { type: "image/jpeg" });
|
|
30
|
-
resolve(file);
|
|
31
|
-
}, "image/jpeg");
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Create an HTMLImageElement from a URL.
|
|
36
|
-
*/
|
|
37
|
-
function createImage(url) {
|
|
38
|
-
return new Promise((resolve, reject) => {
|
|
39
|
-
const image = new Image();
|
|
40
|
-
image.addEventListener("load", () => resolve(image));
|
|
41
|
-
image.addEventListener("error", (error) => reject(error));
|
|
42
|
-
image.src = url;
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* A dialog component that allows users to crop/resize an image to a square aspect ratio.
|
|
47
|
-
* Uses react-easy-crop for the cropping functionality.
|
|
48
|
-
*/
|
|
49
|
-
export const ImageResizeDialog = ({ open, onClose, imageUrl, onCropComplete, fileName = "cropped-image.jpg", }) => {
|
|
50
|
-
const [crop, setCrop] = useState({ x: 0, y: 0 });
|
|
51
|
-
const [zoom, setZoom] = useState(1);
|
|
52
|
-
const [croppedAreaPixels, setCroppedAreaPixels] = useState(null);
|
|
53
|
-
const handleCropComplete = useCallback((_croppedArea, croppedAreaPixels) => {
|
|
54
|
-
setCroppedAreaPixels(croppedAreaPixels);
|
|
55
|
-
}, []);
|
|
56
|
-
const handleSave = useCallback(async () => {
|
|
57
|
-
if (!croppedAreaPixels)
|
|
58
|
-
return;
|
|
59
|
-
try {
|
|
60
|
-
const croppedImage = await getCroppedImg(imageUrl, croppedAreaPixels, fileName);
|
|
61
|
-
onCropComplete(croppedImage);
|
|
62
|
-
onClose();
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
console.error("Failed to crop image:", error);
|
|
66
|
-
}
|
|
67
|
-
}, [croppedAreaPixels, imageUrl, fileName, onCropComplete, onClose]);
|
|
68
|
-
return (React.createElement(Dialog, { open: open, onOpenChange: onClose },
|
|
69
|
-
React.createElement(DialogContent, { className: "max-w-3xl", "data-slot": "image-resize-dialog", "data-testid": "image-resize-dialog" },
|
|
70
|
-
React.createElement(DialogHeader, null,
|
|
71
|
-
React.createElement(DialogTitle, null, "Resize Image"),
|
|
72
|
-
React.createElement(DialogDescription, null, "Adjust the crop area to create a square image. Use the slider to zoom in or out.")),
|
|
73
|
-
React.createElement("div", { className: "relative h-[400px] w-full bg-muted rounded-md overflow-hidden" },
|
|
74
|
-
React.createElement(Suspense, { fallback: React.createElement("div", { className: "flex h-full w-full items-center justify-center text-muted-foreground text-sm" }, "Loading crop editor...") },
|
|
75
|
-
React.createElement(Cropper, { image: imageUrl, crop: crop, zoom: zoom, aspect: 1, onCropChange: setCrop, onCropComplete: handleCropComplete, onZoomChange: setZoom }))),
|
|
76
|
-
React.createElement("div", { className: "space-y-2" },
|
|
77
|
-
React.createElement("label", { className: "text-sm font-medium" }, "Zoom"),
|
|
78
|
-
React.createElement(Slider, { value: [zoom], onValueChange: (values) => setZoom(values[0] || 1), min: 1, max: 3, step: 0.1, className: "w-full", "data-testid": "zoom-slider" })),
|
|
79
|
-
React.createElement(DialogFooter, null,
|
|
80
|
-
React.createElement(Button, { variant: "outline", onClick: onClose, "data-testid": "cancel-button" }, "Cancel"),
|
|
81
|
-
React.createElement(Button, { onClick: handleSave, "data-testid": "save-button" }, "Save")))));
|
|
82
|
-
};
|
|
1
|
+
"use strict";"use client";import e,{Suspense as v,useCallback as u,useState as g}from"react";import{Dialog as y,DialogContent as x,DialogDescription as z,DialogFooter as C,DialogHeader as D,DialogTitle as I}from"./ui/dialog";import{Button as p}from"./ui/button";import{Slider as j}from"./ui/slider";const N=e.lazy(()=>import("react-easy-crop"));async function b(c,t,n="cropped-image.jpg"){const a=await S(c),o=document.createElement("canvas"),m=o.getContext("2d");if(!m)throw new Error("No 2d context");return o.width=t.width,o.height=t.height,m.drawImage(a,t.x,t.y,t.width,t.height,0,0,t.width,t.height),new Promise((d,s)=>{o.toBlob(i=>{if(!i){s(new Error("Canvas is empty"));return}const l=new File([i],n,{type:"image/jpeg"});d(l)},"image/jpeg")})}function S(c){return new Promise((t,n)=>{const a=new Image;a.addEventListener("load",()=>t(a)),a.addEventListener("error",o=>n(o)),a.src=c})}export const ImageResizeDialog=({open:c,onClose:t,imageUrl:n,onCropComplete:a,fileName:o="cropped-image.jpg"})=>{const[m,d]=g({x:0,y:0}),[s,i]=g(1),[l,h]=g(null),E=u((r,w)=>{h(w)},[]),f=u(async()=>{if(l)try{const r=await b(n,l,o);a(r),t()}catch(r){console.error("Failed to crop image:",r)}},[l,n,o,a,t]);return e.createElement(y,{open:c,onOpenChange:t},e.createElement(x,{className:"max-w-3xl","data-slot":"image-resize-dialog","data-testid":"image-resize-dialog"},e.createElement(D,null,e.createElement(I,null,"Resize Image"),e.createElement(z,null,"Adjust the crop area to create a square image. Use the slider to zoom in or out.")),e.createElement("div",{className:"relative h-[400px] w-full bg-muted rounded-md overflow-hidden"},e.createElement(v,{fallback:e.createElement("div",{className:"flex h-full w-full items-center justify-center text-muted-foreground text-sm"},"Loading crop editor...")},e.createElement(N,{image:n,crop:m,zoom:s,aspect:1,onCropChange:d,onCropComplete:E,onZoomChange:i}))),e.createElement("div",{className:"space-y-2"},e.createElement("label",{className:"text-sm font-medium"},"Zoom"),e.createElement(j,{value:[s],onValueChange:r=>i(r[0]||1),min:1,max:3,step:.1,className:"w-full","data-testid":"zoom-slider"})),e.createElement(C,null,e.createElement(p,{variant:"outline",onClick:t,"data-testid":"cancel-button"},"Cancel"),e.createElement(p,{onClick:f,"data-testid":"save-button"},"Save"))))};
|
package/components/nav-main.js
CHANGED
|
@@ -1,40 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { useMemo } from "react";
|
|
3
|
-
import { ChevronRight } from "lucide-react";
|
|
4
|
-
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "./ui/collapsible";
|
|
5
|
-
import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, } from "./sidebar";
|
|
6
|
-
import Link from "next/link";
|
|
7
|
-
export const NavMain = React.memo(({ items }) => {
|
|
8
|
-
const processedItems = useMemo(() => {
|
|
9
|
-
return items
|
|
10
|
-
.filter(({ enabled }) => enabled)
|
|
11
|
-
.sort((a, b) => a.order - b.order);
|
|
12
|
-
}, [items]);
|
|
13
|
-
return (React.createElement(SidebarGroup, null,
|
|
14
|
-
React.createElement(SidebarGroupLabel, null, "Current App"),
|
|
15
|
-
React.createElement(SidebarMenu, null, processedItems.map((item) => {
|
|
16
|
-
var _a, _b;
|
|
17
|
-
if (!((_a = item.subItems) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
18
|
-
return (React.createElement(SidebarMenuItem, { key: item.title },
|
|
19
|
-
React.createElement(Link, { href: item.url },
|
|
20
|
-
React.createElement(SidebarMenuButton, { className: "cursor-pointer" },
|
|
21
|
-
item.icon && React.createElement(item.icon, null),
|
|
22
|
-
React.createElement("span", null, item.title)))));
|
|
23
|
-
}
|
|
24
|
-
return (React.createElement(Collapsible, { key: item.title, asChild: true, defaultOpen: item.isActive, className: "group/collapsible" },
|
|
25
|
-
React.createElement(SidebarMenuItem, null,
|
|
26
|
-
React.createElement(CollapsibleTrigger, { asChild: true },
|
|
27
|
-
React.createElement(SidebarMenuButton, { tooltip: item.title, className: item.isActive ? "bg-gray-300" : "" },
|
|
28
|
-
item.icon && React.createElement(item.icon, null),
|
|
29
|
-
React.createElement("span", null, item.title),
|
|
30
|
-
React.createElement(ChevronRight, { className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" }))),
|
|
31
|
-
((_b = item.subItems) === null || _b === void 0 ? void 0 : _b.length) > 0 && (React.createElement(CollapsibleContent, null,
|
|
32
|
-
React.createElement(SidebarMenuSub, null, item.subItems
|
|
33
|
-
.filter(({ enabled }) => enabled)
|
|
34
|
-
.sort((a, b) => a.order - b.order)
|
|
35
|
-
.map((subItem) => (React.createElement(SidebarMenuSubItem, { key: subItem.title, className: `rounded-md ${subItem.isActive ? "bg-gray-200" : ""}` },
|
|
36
|
-
React.createElement(SidebarMenuSubButton, { asChild: true },
|
|
37
|
-
React.createElement(Link, { href: subItem.url },
|
|
38
|
-
React.createElement("span", null, subItem.title))))))))))));
|
|
39
|
-
}))));
|
|
40
|
-
});
|
|
1
|
+
"use strict";"use client";import e,{useMemo as m}from"react";import{ChevronRight as p}from"lucide-react";import{Collapsible as d,CollapsibleContent as E,CollapsibleTrigger as b}from"./ui/collapsible";import{SidebarGroup as f,SidebarGroupLabel as g,SidebarMenu as S,SidebarMenuButton as o,SidebarMenuItem as u,SidebarMenuSub as v,SidebarMenuSubButton as h,SidebarMenuSubItem as C}from"./sidebar";import c from"next/link";export const NavMain=e.memo(({items:a})=>{const i=m(()=>a.filter(({enabled:t})=>t).sort((t,l)=>t.order-l.order),[a]);return e.createElement(f,null,e.createElement(g,null,"Current App"),e.createElement(S,null,i.map(t=>{var l,n;return!((l=t.subItems)===null||l===void 0)&&l.length?e.createElement(d,{key:t.title,asChild:!0,defaultOpen:t.isActive,className:"group/collapsible"},e.createElement(u,null,e.createElement(b,{asChild:!0},e.createElement(o,{tooltip:t.title,className:t.isActive?"bg-gray-300":""},t.icon&&e.createElement(t.icon,null),e.createElement("span",null,t.title),e.createElement(p,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"}))),((n=t.subItems)===null||n===void 0?void 0:n.length)>0&&e.createElement(E,null,e.createElement(v,null,t.subItems.filter(({enabled:r})=>r).sort((r,s)=>r.order-s.order).map(r=>e.createElement(C,{key:r.title,className:`rounded-md ${r.isActive?"bg-gray-200":""}`},e.createElement(h,{asChild:!0},e.createElement(c,{href:r.url},e.createElement("span",null,r.title))))))))):e.createElement(u,{key:t.title},e.createElement(c,{href:t.url},e.createElement(o,{className:"cursor-pointer"},t.icon&&e.createElement(t.icon,null),e.createElement("span",null,t.title))))})))});
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Folder, Forward, MoreHorizontal, Trash2 } from "lucide-react";
|
|
3
|
-
import Link from "next/link";
|
|
4
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "./ui/dropdown-menu";
|
|
5
|
-
import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem, useSidebar, } from "./sidebar";
|
|
6
|
-
import React from "react";
|
|
7
|
-
export const NavProjects = ({ apps, offerUrl }) => {
|
|
8
|
-
var _a, _b;
|
|
9
|
-
const { isMobile } = useSidebar();
|
|
10
|
-
return (React.createElement(SidebarGroup, { className: "group-data-[collapsible=icon]:hidden" },
|
|
11
|
-
React.createElement(SidebarGroupLabel, null, "More Apps"),
|
|
12
|
-
React.createElement(SidebarMenu, null, (_b = (_a = apps === null || apps === void 0 ? void 0 : apps.filter(({ enabled }) => enabled)) === null || _a === void 0 ? void 0 : _a.sort((a, b) => a.order - b.order)) === null || _b === void 0 ? void 0 :
|
|
13
|
-
_b.map((item) => (React.createElement(SidebarMenuItem, { key: item.name },
|
|
14
|
-
React.createElement(SidebarMenuButton, { asChild: true },
|
|
15
|
-
React.createElement(Link, { href: item.url },
|
|
16
|
-
React.createElement(item.icon, null),
|
|
17
|
-
React.createElement("span", null, item.name))),
|
|
18
|
-
React.createElement(DropdownMenu, null,
|
|
19
|
-
React.createElement(DropdownMenuTrigger, { asChild: true },
|
|
20
|
-
React.createElement(SidebarMenuAction, { showOnHover: true },
|
|
21
|
-
React.createElement(MoreHorizontal, null),
|
|
22
|
-
React.createElement("span", { className: "sr-only" }, "More"))),
|
|
23
|
-
React.createElement(DropdownMenuContent, { className: "w-48 rounded-lg", side: isMobile ? "bottom" : "right", align: isMobile ? "end" : "start" },
|
|
24
|
-
React.createElement(DropdownMenuItem, null,
|
|
25
|
-
React.createElement(Folder, { className: "text-muted-foreground" }),
|
|
26
|
-
React.createElement("span", null, "View Project")),
|
|
27
|
-
React.createElement(DropdownMenuItem, null,
|
|
28
|
-
React.createElement(Forward, { className: "text-muted-foreground" }),
|
|
29
|
-
React.createElement("span", null, "Share Project")),
|
|
30
|
-
React.createElement(DropdownMenuSeparator, null),
|
|
31
|
-
React.createElement(DropdownMenuItem, null,
|
|
32
|
-
React.createElement(Trash2, { className: "text-muted-foreground" }),
|
|
33
|
-
React.createElement("span", null, "Delete Project"))))))),
|
|
34
|
-
offerUrl && (React.createElement(SidebarMenuItem, null,
|
|
35
|
-
React.createElement(Link, { href: offerUrl },
|
|
36
|
-
React.createElement(SidebarMenuButton, { className: "text-sidebar-foreground/70" },
|
|
37
|
-
React.createElement(MoreHorizontal, { className: "text-sidebar-foreground/70" }),
|
|
38
|
-
React.createElement("span", null, "Offers"))))))));
|
|
39
|
-
};
|
|
1
|
+
"use strict";"use client";import{Folder as E,Forward as p,MoreHorizontal as c,Trash2 as b}from"lucide-react";import u from"next/link";import{DropdownMenu as f,DropdownMenuContent as M,DropdownMenuItem as a,DropdownMenuSeparator as g,DropdownMenuTrigger as h}from"./ui/dropdown-menu";import{SidebarGroup as v,SidebarGroupLabel as w,SidebarMenu as N,SidebarMenuAction as S,SidebarMenuButton as d,SidebarMenuItem as s,useSidebar as x}from"./sidebar";import e from"react";export const NavProjects=({apps:r,offerUrl:o})=>{var n,l;const{isMobile:m}=x();return e.createElement(v,{className:"group-data-[collapsible=icon]:hidden"},e.createElement(w,null,"More Apps"),e.createElement(N,null,(l=(n=r?.filter(({enabled:t})=>t))===null||n===void 0?void 0:n.sort((t,i)=>t.order-i.order))===null||l===void 0?void 0:l.map(t=>e.createElement(s,{key:t.name},e.createElement(d,{asChild:!0},e.createElement(u,{href:t.url},e.createElement(t.icon,null),e.createElement("span",null,t.name))),e.createElement(f,null,e.createElement(h,{asChild:!0},e.createElement(S,{showOnHover:!0},e.createElement(c,null),e.createElement("span",{className:"sr-only"},"More"))),e.createElement(M,{className:"w-48 rounded-lg",side:m?"bottom":"right",align:m?"end":"start"},e.createElement(a,null,e.createElement(E,{className:"text-muted-foreground"}),e.createElement("span",null,"View Project")),e.createElement(a,null,e.createElement(p,{className:"text-muted-foreground"}),e.createElement("span",null,"Share Project")),e.createElement(g,null),e.createElement(a,null,e.createElement(b,{className:"text-muted-foreground"}),e.createElement("span",null,"Delete Project")))))),o&&e.createElement(s,null,e.createElement(u,{href:o},e.createElement(d,{className:"text-sidebar-foreground/70"},e.createElement(c,{className:"text-sidebar-foreground/70"}),e.createElement("span",null,"Offers"))))))};
|
package/components/nav-user.js
CHANGED
|
@@ -1,52 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { ChevronsUpDown, LogOut } from "lucide-react";
|
|
4
|
-
import { Avatar, AvatarFallback, AvatarImage } from "./ui/avatar";
|
|
5
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "./ui/dropdown-menu";
|
|
6
|
-
import { SidebarMenu, SidebarMenuButton, SidebarMenuItem, useSidebar, } from "./sidebar";
|
|
7
|
-
import Link from "next/link";
|
|
8
|
-
export function NavUser({ user, footerNavItems, handleSignOut, }) {
|
|
9
|
-
const { isMobile } = useSidebar();
|
|
10
|
-
return (React.createElement(SidebarMenu, null,
|
|
11
|
-
React.createElement(SidebarMenuItem, null,
|
|
12
|
-
React.createElement(DropdownMenu, null,
|
|
13
|
-
React.createElement(DropdownMenuTrigger, { asChild: true },
|
|
14
|
-
React.createElement(SidebarMenuButton, { size: "lg", className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground" },
|
|
15
|
-
React.createElement(Avatar, { className: "h-8 w-8 rounded-lg" },
|
|
16
|
-
React.createElement(AvatarImage, { src: user.avatar, alt: user.name }),
|
|
17
|
-
React.createElement(AvatarFallback, { className: "rounded-lg" }, user.name
|
|
18
|
-
.split(" ")
|
|
19
|
-
.map((n) => n[0])
|
|
20
|
-
.join("")
|
|
21
|
-
.toUpperCase())),
|
|
22
|
-
React.createElement("div", { className: "grid flex-1 text-left text-sm leading-tight" },
|
|
23
|
-
React.createElement("span", { className: "truncate font-medium" }, user.name),
|
|
24
|
-
React.createElement("span", { className: "truncate text-xs" }, user.email)),
|
|
25
|
-
React.createElement(ChevronsUpDown, { className: "ml-auto size-4" }))),
|
|
26
|
-
React.createElement(DropdownMenuContent, { className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg", side: isMobile ? "bottom" : "right", align: "end", sideOffset: 4 },
|
|
27
|
-
React.createElement(DropdownMenuLabel, { className: "p-0 font-normal" },
|
|
28
|
-
React.createElement("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm" },
|
|
29
|
-
React.createElement(Avatar, { className: "h-8 w-8 rounded-lg" },
|
|
30
|
-
React.createElement(AvatarImage, { src: user.avatar, alt: user.name }),
|
|
31
|
-
React.createElement(AvatarFallback, { className: "rounded-lg" }, "CN")),
|
|
32
|
-
React.createElement("div", { className: "grid flex-1 text-left text-sm leading-tight" },
|
|
33
|
-
React.createElement("span", { className: "truncate font-medium" }, user.name),
|
|
34
|
-
React.createElement("span", { className: "truncate text-xs" }, user.email)))),
|
|
35
|
-
React.createElement(DropdownMenuSeparator, null),
|
|
36
|
-
footerNavItems
|
|
37
|
-
.filter(({ enabled }) => enabled)
|
|
38
|
-
.sort((a, b) => a.order - b.order)
|
|
39
|
-
.map((item) => {
|
|
40
|
-
if (item.title === "Divider") {
|
|
41
|
-
return React.createElement(DropdownMenuSeparator, { key: item.title });
|
|
42
|
-
}
|
|
43
|
-
return (React.createElement(Link, { href: item.url, key: item.title },
|
|
44
|
-
React.createElement(DropdownMenuItem, null,
|
|
45
|
-
item.icon && React.createElement(item.icon, null),
|
|
46
|
-
item.title)));
|
|
47
|
-
}),
|
|
48
|
-
React.createElement(DropdownMenuSeparator, null),
|
|
49
|
-
React.createElement(DropdownMenuItem, { onClick: handleSignOut },
|
|
50
|
-
React.createElement(LogOut, null),
|
|
51
|
-
"Sign Out"))))));
|
|
52
|
-
}
|
|
1
|
+
"use strict";"use client";import e from"react";import{ChevronsUpDown as u,LogOut as p}from"lucide-react";import{Avatar as r,AvatarFallback as l,AvatarImage as m}from"./ui/avatar";import{DropdownMenu as E,DropdownMenuContent as g,DropdownMenuItem as c,DropdownMenuLabel as f,DropdownMenuSeparator as n,DropdownMenuTrigger as x}from"./ui/dropdown-menu";import{SidebarMenu as N,SidebarMenuButton as w,SidebarMenuItem as b,useSidebar as v}from"./sidebar";import M from"next/link";export function NavUser({user:a,footerNavItems:o,handleSignOut:s}){const{isMobile:i}=v();return e.createElement(N,null,e.createElement(b,null,e.createElement(E,null,e.createElement(x,{asChild:!0},e.createElement(w,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"},e.createElement(r,{className:"h-8 w-8 rounded-lg"},e.createElement(m,{src:a.avatar,alt:a.name}),e.createElement(l,{className:"rounded-lg"},a.name.split(" ").map(t=>t[0]).join("").toUpperCase())),e.createElement("div",{className:"grid flex-1 text-left text-sm leading-tight"},e.createElement("span",{className:"truncate font-medium"},a.name),e.createElement("span",{className:"truncate text-xs"},a.email)),e.createElement(u,{className:"ml-auto size-4"}))),e.createElement(g,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:i?"bottom":"right",align:"end",sideOffset:4},e.createElement(f,{className:"p-0 font-normal"},e.createElement("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm"},e.createElement(r,{className:"h-8 w-8 rounded-lg"},e.createElement(m,{src:a.avatar,alt:a.name}),e.createElement(l,{className:"rounded-lg"},"CN")),e.createElement("div",{className:"grid flex-1 text-left text-sm leading-tight"},e.createElement("span",{className:"truncate font-medium"},a.name),e.createElement("span",{className:"truncate text-xs"},a.email)))),e.createElement(n,null),o.filter(({enabled:t})=>t).sort((t,d)=>t.order-d.order).map(t=>t.title==="Divider"?e.createElement(n,{key:t.title}):e.createElement(M,{href:t.url,key:t.title},e.createElement(c,null,t.icon&&e.createElement(t.icon,null),t.title))),e.createElement(n,null),e.createElement(c,{onClick:s},e.createElement(p,null),"Sign Out")))))}
|
package/components/show-toast.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export const showToast = (description, variant) => {
|
|
3
|
-
generateThemeToast({
|
|
4
|
-
description,
|
|
5
|
-
variant,
|
|
6
|
-
});
|
|
7
|
-
};
|
|
1
|
+
"use strict";import{generateThemeToast as t}from"../lib/toast-utils";export const showToast=(o,e)=>{t({description:o,variant:e})};
|