@examplary/ui 1.56.0 → 1.58.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/dist/components/ai/ai-icon.js +2 -25
- package/dist/components/ai/ai-prompt-suggestion.js +3 -26
- package/dist/components/brand/tick-icon.js +2 -25
- package/dist/components/chat/chat-input.js +8 -31
- package/dist/components/chat/chat-typing-indicator.js +2 -2
- package/dist/components/chat/chat-view.js +6 -34
- package/dist/components/loading/ai-spinner.js +2 -13
- package/dist/components/loading/tick-loader.js +39 -104
- package/dist/components/print/answer-box.js +2 -25
- package/dist/components/question-types/fetch-component.js +65 -106
- package/dist/components/question-types/format-question-type.d.ts +41 -41
- package/dist/components/question-types/format-question-type.js +36 -37
- package/dist/components/rich-text/minimal-rich-text-field.d.ts +2 -2
- package/dist/components/rich-text/minimal-rich-text-field.js +47 -85
- package/dist/components/rich-text/rich-text-display.js +15 -33
- package/dist/components/rich-text/rich-text-field.js +2 -25
- package/dist/components/rich-text/rich-text-toolbar.d.ts +3 -2
- package/dist/components/rich-text/rich-text-toolbar.js +5 -6
- package/dist/components/rich-text/tiptap/collaboration-caret.js +24 -34
- package/dist/components/rich-text/tiptap/comments/comment-bubble.d.ts +1 -1
- package/dist/components/rich-text/tiptap/comments/comment-bubble.js +36 -41
- package/dist/components/rich-text/tiptap/content-reference.js +6 -7
- package/dist/components/rich-text/tiptap/crop-page-clipping-modal.d.ts +3 -3
- package/dist/components/rich-text/tiptap/crop-page-clipping-modal.js +20 -25
- package/dist/components/rich-text/tiptap/extensions.d.ts +2 -2
- package/dist/components/rich-text/tiptap/extensions.js +6 -16
- package/dist/components/rich-text/tiptap/file-attachment.js +9 -11
- package/dist/components/rich-text/tiptap/file-handler.d.ts +2 -2
- package/dist/components/rich-text/tiptap/file-handler.js +110 -185
- package/dist/components/rich-text/tiptap/image.js +18 -23
- package/dist/components/rich-text/tiptap/mathematics-component.js +25 -30
- package/dist/components/rich-text/tiptap/mathematics.js +56 -82
- package/dist/components/rich-text/tiptap/page-clipping.js +3 -4
- package/dist/components/rich-text/tiptap/png-scanner.js +63 -108
- package/dist/components/rich-text/tiptap/rich-text-formatting-menu.d.ts +1 -1
- package/dist/components/rich-text/tiptap/rich-text-formatting-menu.js +31 -46
- package/dist/components/ui/alert.d.ts +3 -3
- package/dist/components/ui/alert.js +7 -32
- package/dist/components/ui/avatar.js +18 -14
- package/dist/components/ui/badge.d.ts +3 -3
- package/dist/components/ui/badge.js +4 -27
- package/dist/components/ui/button.d.ts +4 -4
- package/dist/components/ui/button.js +4 -27
- package/dist/components/ui/card.js +6 -46
- package/dist/components/ui/checkbox.js +1 -26
- package/dist/components/ui/color-picker.js +11 -22
- package/dist/components/ui/command-palette.d.ts +2 -2
- package/dist/components/ui/command-palette.js +38 -72
- package/dist/components/ui/command.js +18 -49
- package/dist/components/ui/comments.js +37 -107
- package/dist/components/ui/context-menu.js +30 -67
- package/dist/components/ui/dialog.js +15 -61
- package/dist/components/ui/dropdown.js +17 -64
- package/dist/components/ui/floating-menu.js +2 -25
- package/dist/components/ui/floating-resizable.d.ts +5 -0
- package/dist/components/ui/floating-resizable.js +24 -0
- package/dist/components/ui/help-icon.js +1 -2
- package/dist/components/ui/icon-picker.js +50 -130
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/input.js +2 -25
- package/dist/components/ui/label.d.ts +1 -1
- package/dist/components/ui/label.js +2 -27
- package/dist/components/ui/popover.d.ts +2 -2
- package/dist/components/ui/popover.js +4 -32
- package/dist/components/ui/progress-bar.js +2 -3
- package/dist/components/ui/radio-group.js +4 -28
- package/dist/components/ui/resizable.d.ts +6 -9
- package/dist/components/ui/resizable.js +13 -60
- package/dist/components/ui/select.js +12 -55
- package/dist/components/ui/separator.js +1 -26
- package/dist/components/ui/sheet.d.ts +3 -3
- package/dist/components/ui/sheet.js +11 -51
- package/dist/components/ui/skeleton.js +2 -25
- package/dist/components/ui/slider.js +7 -32
- package/dist/components/ui/sortable.d.ts +1 -1
- package/dist/components/ui/sortable.js +131 -155
- package/dist/components/ui/switch.d.ts +3 -3
- package/dist/components/ui/switch.js +3 -28
- package/dist/components/ui/table.js +8 -54
- package/dist/components/ui/tabs.js +8 -34
- package/dist/components/ui/text-selection-menu.d.ts +1 -1
- package/dist/components/ui/text-selection-menu.js +19 -25
- package/dist/components/ui/textarea.js +7 -30
- package/dist/components/ui/tooltip.js +4 -29
- package/dist/components/web-components/content-reference.js +81 -106
- package/dist/components/web-components/file-attachment.js +9 -30
- package/dist/components/web-components/index.js +1 -1
- package/dist/components/web-components/inline-comment-reply.js +3 -24
- package/dist/components/web-components/inline-comment.js +3 -24
- package/dist/components/web-components/inline-math.js +14 -36
- package/dist/components/web-components/page-clipping.js +13 -34
- package/dist/lib/compose-refs.js +10 -18
- package/dist/lib/use-spin-loop.js +19 -69
- package/dist/src/global.css +2 -2
- package/dist/utils.js +1 -5
- package/package.json +5 -4
- package/dist/components/rich-text/tiptap/comments/comment-reply.d.ts +0 -21
- package/dist/components/rich-text/tiptap/comments/comment-reply.js +0 -230
- package/dist/components/rich-text/tiptap/comments/comment.d.ts +0 -22
- package/dist/components/rich-text/tiptap/comments/comment.js +0 -198
- package/dist/components/rich-text/tiptap/comments/helpers.d.ts +0 -19
- package/dist/components/rich-text/tiptap/comments/helpers.js +0 -95
- package/dist/components/rich-text/tiptap/comments/types.d.ts +0 -29
- package/dist/components/rich-text/tiptap/comments/types.js +0 -1
|
@@ -1,29 +1,7 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
2
|
import { cva } from "class-variance-authority";
|
|
25
3
|
import { cn } from "../../utils";
|
|
26
|
-
|
|
4
|
+
const alertVariants = cva("relative w-full rounded-xl border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current shadow-shadow border-neutral-800", {
|
|
27
5
|
variants: {
|
|
28
6
|
variant: {
|
|
29
7
|
default: "bg-white border-border",
|
|
@@ -37,16 +15,13 @@ var alertVariants = cva("relative w-full rounded-xl border px-4 py-3 text-sm gri
|
|
|
37
15
|
variant: "default",
|
|
38
16
|
},
|
|
39
17
|
});
|
|
40
|
-
function Alert(
|
|
41
|
-
|
|
42
|
-
return (_jsx("div", __assign({ "data-slot": "alert", role: "alert", className: cn(alertVariants({ variant: variant }), className) }, props)));
|
|
18
|
+
function Alert({ className, variant, ...props }) {
|
|
19
|
+
return (_jsx("div", { "data-slot": "alert", role: "alert", className: cn(alertVariants({ variant }), className), ...props }));
|
|
43
20
|
}
|
|
44
|
-
function AlertTitle(
|
|
45
|
-
|
|
46
|
-
return (_jsx("div", __assign({ "data-slot": "alert-title", className: cn("col-start-2 line-clamp-1 min-h-4 font-heading font-medium text-base", className) }, props)));
|
|
21
|
+
function AlertTitle({ className, ...props }) {
|
|
22
|
+
return (_jsx("div", { "data-slot": "alert-title", className: cn("col-start-2 line-clamp-1 min-h-4 font-heading font-medium text-base", className), ...props }));
|
|
47
23
|
}
|
|
48
|
-
function AlertDescription(
|
|
49
|
-
|
|
50
|
-
return (_jsx("div", __assign({ "data-slot": "alert-description", className: cn("col-start-2 grid justify-items-start gap-1 text-sm font-base [&_p]:leading-relaxed", className) }, props)));
|
|
24
|
+
function AlertDescription({ className, ...props }) {
|
|
25
|
+
return (_jsx("div", { "data-slot": "alert-description", className: cn("col-start-2 grid justify-items-start gap-1 text-sm font-base [&_p]:leading-relaxed", className), ...props }));
|
|
51
26
|
}
|
|
52
27
|
export { Alert, AlertTitle, AlertDescription };
|
|
@@ -3,26 +3,25 @@ import { useMemo } from "react";
|
|
|
3
3
|
import { BuildingIcon, Globe2Icon, LockIcon, UserIcon, UsersIcon, } from "lucide-react";
|
|
4
4
|
import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, } from "./tooltip";
|
|
5
5
|
import { cn } from "../../utils";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
var initials = useMemo(function () {
|
|
6
|
+
export const Avatar = ({ entity, className, size = 40 }) => {
|
|
7
|
+
const initials = useMemo(() => {
|
|
9
8
|
if (!entity.name || entity.type !== "user")
|
|
10
9
|
return;
|
|
11
10
|
return getUserInitials(entity.name);
|
|
12
11
|
}, [entity.name, entity.type]);
|
|
13
|
-
|
|
12
|
+
const color = useMemo(() => {
|
|
14
13
|
if (entity.color)
|
|
15
14
|
return entity.color;
|
|
16
15
|
if (!entity.id || entity.type !== "user")
|
|
17
16
|
return;
|
|
18
17
|
return getUserColor(entity.id);
|
|
19
18
|
}, [entity.id, entity.type, entity.color]);
|
|
20
|
-
return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { delayDuration: 100, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("div", { className: cn(
|
|
19
|
+
return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { delayDuration: 100, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("div", { className: cn(`rounded-full flex items-center justify-center shrink-0 bg-cover bg-center`, entity.type === "everyone" && "bg-emerald-200", entity.type === "nobody" && "bg-pink-200", entity.type === "org" && "bg-blue-200", entity.type !== "everyone" &&
|
|
21
20
|
entity.type !== "org" &&
|
|
22
21
|
entity.type !== "nobody" &&
|
|
23
22
|
"bg-zinc-200", className), style: {
|
|
24
23
|
backgroundImage: entity.avatar
|
|
25
|
-
?
|
|
24
|
+
? `url(${entity.avatar})`
|
|
26
25
|
: undefined,
|
|
27
26
|
backgroundColor: color,
|
|
28
27
|
width: size,
|
|
@@ -31,7 +30,7 @@ export var Avatar = function (_a) {
|
|
|
31
30
|
!entity.avatar &&
|
|
32
31
|
(initials ? (_jsx("span", { style: { fontSize: size * 0.4, letterSpacing: 0.4 }, className: "text-white font-medium", children: initials })) : (_jsx(UserIcon, { className: cn(color ? "text-white" : "text-zinc-600"), size: size * 0.45 })))] }) }), _jsx(TooltipContent, { className: "max-w-sm py-2", sideOffset: 10, children: _jsx("div", { className: "text-xs [&_svg]:size-4 [&_svg]:shrink-0 flex items-center gap-1.5", children: entity.name || entity.type || "User" }) })] }) }));
|
|
33
32
|
};
|
|
34
|
-
|
|
33
|
+
const userColors = [
|
|
35
34
|
"#f87171",
|
|
36
35
|
"#fbbf24",
|
|
37
36
|
"#a3e635",
|
|
@@ -41,18 +40,23 @@ var userColors = [
|
|
|
41
40
|
"#a78bfa",
|
|
42
41
|
"#e879f9",
|
|
43
42
|
];
|
|
44
|
-
|
|
45
|
-
export
|
|
43
|
+
const userColorCache = new Map();
|
|
44
|
+
export const getUserColor = (userId) => {
|
|
46
45
|
if (userColorCache.has(userId)) {
|
|
47
46
|
return userColorCache.get(userId);
|
|
48
47
|
}
|
|
49
|
-
|
|
48
|
+
const hash = userId
|
|
50
49
|
.split("")
|
|
51
|
-
.reduce(
|
|
52
|
-
|
|
50
|
+
.reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
|
51
|
+
const color = userColors[hash % userColors.length];
|
|
53
52
|
userColorCache.set(userId, color);
|
|
54
53
|
return color;
|
|
55
54
|
};
|
|
56
|
-
export
|
|
57
|
-
return name
|
|
55
|
+
export const getUserInitials = (name) => {
|
|
56
|
+
return name
|
|
57
|
+
?.split(" ")
|
|
58
|
+
.map((part) => part[0])
|
|
59
|
+
.join("")
|
|
60
|
+
.substring(0, 2)
|
|
61
|
+
.toUpperCase();
|
|
58
62
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
|
-
declare const badgeVariants: (props?: {
|
|
4
|
-
variant?: "default" | "secondary" | "destructive" | "blue" | "bright" | "positive" | "orange";
|
|
5
|
-
} & import("class-variance-authority/types").ClassProp) => string;
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "secondary" | "destructive" | "blue" | "bright" | "positive" | "orange" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badgeVariants> {
|
|
7
7
|
asChild?: boolean;
|
|
8
8
|
}
|
|
@@ -1,31 +1,9 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
2
|
import * as React from "react";
|
|
25
3
|
import { Slot } from "@radix-ui/react-slot";
|
|
26
4
|
import { cva } from "class-variance-authority";
|
|
27
5
|
import { cn } from "../../utils";
|
|
28
|
-
|
|
6
|
+
const badgeVariants = cva("font-semibold text-xs rounded-4xl py-0.5 px-2 whitespace-nowrap", {
|
|
29
7
|
variants: {
|
|
30
8
|
variant: {
|
|
31
9
|
default: "bg-purplegray-100 text-purplegray-600",
|
|
@@ -41,10 +19,9 @@ var badgeVariants = cva("font-semibold text-xs rounded-4xl py-0.5 px-2 whitespac
|
|
|
41
19
|
variant: "default",
|
|
42
20
|
},
|
|
43
21
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return (_jsx(Comp, __assign({ className: cn(badgeVariants({ variant: variant, className: className })), ref: ref }, props)));
|
|
22
|
+
const Badge = React.forwardRef(({ className, variant, asChild = false, ...props }, ref) => {
|
|
23
|
+
const Comp = asChild ? Slot : "span";
|
|
24
|
+
return (_jsx(Comp, { className: cn(badgeVariants({ variant, className })), ref: ref, ...props }));
|
|
48
25
|
});
|
|
49
26
|
Badge.displayName = "Badge";
|
|
50
27
|
export { Badge, badgeVariants };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
|
-
declare const buttonVariants: (props?: {
|
|
4
|
-
variant?: "default" | "primary" | "secondary" | "destructive" | "white" | "plain" | "roundedPlain" | "dashed" | "rounded" | "roundedPrimary" | "roundedSecondary" | "roundedWhite";
|
|
5
|
-
size?: "default" | "sm" | "lg" | "icon" | "icon-lg" | "icon-sm";
|
|
6
|
-
} & import("class-variance-authority/types").ClassProp) => string;
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "primary" | "secondary" | "destructive" | "white" | "plain" | "roundedPlain" | "dashed" | "rounded" | "roundedPrimary" | "roundedSecondary" | "roundedWhite" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | "icon-lg" | "icon-sm" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
8
|
asChild?: boolean;
|
|
9
9
|
}
|
|
@@ -1,31 +1,9 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
2
|
import * as React from "react";
|
|
25
3
|
import { Slot } from "@radix-ui/react-slot";
|
|
26
4
|
import { cva } from "class-variance-authority";
|
|
27
5
|
import { cn } from "../../utils";
|
|
28
|
-
|
|
6
|
+
const buttonVariants = cva("inline-flex items-center select-none text-text dark:text-white cursor-pointer justify-center whitespace-nowrap rounded-full font-base ring-offset-white transition-all gap-1.5 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black/20 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", {
|
|
29
7
|
variants: {
|
|
30
8
|
variant: {
|
|
31
9
|
default: "bg-nav border border-black dark:bg-zinc-800 dark:border-white hover:shadow-light",
|
|
@@ -55,10 +33,9 @@ var buttonVariants = cva("inline-flex items-center select-none text-text dark:te
|
|
|
55
33
|
size: "default",
|
|
56
34
|
},
|
|
57
35
|
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return (_jsx(Comp, __assign({ className: cn(buttonVariants({ variant: variant, size: size, className: className })), ref: ref }, props)));
|
|
36
|
+
const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
37
|
+
const Comp = asChild ? Slot : "button";
|
|
38
|
+
return (_jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props }));
|
|
62
39
|
});
|
|
63
40
|
Button.displayName = "Button";
|
|
64
41
|
export { Button, buttonVariants };
|
|
@@ -1,56 +1,16 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
2
|
import * as React from "react";
|
|
25
3
|
import { cn } from "../../utils";
|
|
26
|
-
|
|
27
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
28
|
-
return (_jsx("div", __assign({ ref: ref, className: cn("rounded-xl border border-border bg-white text-black", className) }, props)));
|
|
29
|
-
});
|
|
4
|
+
const Card = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("rounded-xl border border-border bg-white text-black", className), ...props })));
|
|
30
5
|
Card.displayName = "Card";
|
|
31
|
-
|
|
32
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
33
|
-
return (_jsx("div", __assign({ ref: ref, className: cn("flex flex-col space-y-1.5 p-6", className) }, props)));
|
|
34
|
-
});
|
|
6
|
+
const CardHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })));
|
|
35
7
|
CardHeader.displayName = "CardHeader";
|
|
36
|
-
|
|
37
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
38
|
-
return (_jsx("div", __assign({ ref: ref, className: cn("text-xl leading-none font-heading", className) }, props)));
|
|
39
|
-
});
|
|
8
|
+
const CardTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("text-xl leading-none font-heading", className), ...props })));
|
|
40
9
|
CardTitle.displayName = "CardTitle";
|
|
41
|
-
|
|
42
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
43
|
-
return (_jsx("div", __assign({ ref: ref, className: cn("text-sm text-black font-base !mt-3", className) }, props)));
|
|
44
|
-
});
|
|
10
|
+
const CardDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("text-sm text-black font-base !mt-3", className), ...props })));
|
|
45
11
|
CardDescription.displayName = "CardDescription";
|
|
46
|
-
|
|
47
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
48
|
-
return (_jsx("div", __assign({ ref: ref, className: cn("p-6 pt-0", className) }, props)));
|
|
49
|
-
});
|
|
12
|
+
const CardContent = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("p-6 pt-0", className), ...props })));
|
|
50
13
|
CardContent.displayName = "CardContent";
|
|
51
|
-
|
|
52
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
53
|
-
return (_jsx("div", __assign({ ref: ref, className: cn("flex items-center p-6 pt-0", className) }, props)));
|
|
54
|
-
});
|
|
14
|
+
const CardFooter = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("flex items-center p-6 pt-0", className), ...props })));
|
|
55
15
|
CardFooter.displayName = "CardFooter";
|
|
56
16
|
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent, };
|
|
@@ -1,34 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
3
|
import * as React from "react";
|
|
26
4
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
27
5
|
import { CheckIcon } from "lucide-react";
|
|
28
6
|
import { cn } from "../../utils";
|
|
29
|
-
|
|
30
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
31
|
-
return (_jsx(CheckboxPrimitive.Root, __assign({ ref: ref, className: cn("peer size-4.5 shrink-0 outline-none rounded-xs border-2 border-border-accent ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black/10 disabled:cursor-not-allowed disabled:text-zinc-400 data-[state=checked]:bg-current data-[state=checked]:border-current", className, "outline") }, props, { children: _jsx(CheckboxPrimitive.Indicator, { className: cn("flex items-center justify-center text-current"), children: _jsx(CheckIcon, { className: "w-full h-full text-white", strokeWidth: 2.6 }) }) })));
|
|
32
|
-
});
|
|
7
|
+
const Checkbox = React.forwardRef(({ className, ...props }, ref) => (_jsx(CheckboxPrimitive.Root, { ref: ref, className: cn("peer size-4.5 shrink-0 outline-none rounded-xs border-2 border-border-accent ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-black/10 disabled:cursor-not-allowed disabled:text-zinc-400 data-[state=checked]:bg-current data-[state=checked]:border-current", className, "outline"), ...props, children: _jsx(CheckboxPrimitive.Indicator, { className: cn("flex items-center justify-center text-current"), children: _jsx(CheckIcon, { className: "w-full h-full text-white", strokeWidth: 2.6 }) }) })));
|
|
33
8
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
34
9
|
export { Checkbox };
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
3
|
import { useMemo } from "react";
|
|
13
4
|
import { HexColorPicker } from "react-colorful";
|
|
@@ -16,7 +7,7 @@ import { Button } from "./button";
|
|
|
16
7
|
import { Input } from "./input";
|
|
17
8
|
import { Popover, PopoverContent, PopoverTrigger } from "./popover";
|
|
18
9
|
import { cn } from "../../utils";
|
|
19
|
-
|
|
10
|
+
const defaultSwatches = [
|
|
20
11
|
"#f87171",
|
|
21
12
|
"#fbbf24",
|
|
22
13
|
"#a3e635",
|
|
@@ -26,14 +17,13 @@ var defaultSwatches = [
|
|
|
26
17
|
"#a78bfa",
|
|
27
18
|
"#e879f9",
|
|
28
19
|
];
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var parsedValue = useMemo(function () {
|
|
20
|
+
const ColorPicker = ({ value, swatches = defaultSwatches, defaultValue = "#ffffff", customLabelTitle = "Custom", allowCustom = true, swatchClassName, className, onChange, }) => {
|
|
21
|
+
const parsedValue = useMemo(() => {
|
|
32
22
|
return (value || defaultValue || "#ffffff").toLowerCase().trim();
|
|
33
23
|
}, [value, defaultValue]);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
const availableSwatches = useMemo(() => Array.from(new Set([defaultValue, ...swatches].filter(Boolean))), [defaultValue, swatches]);
|
|
25
|
+
const onChangeProxy = (newValue) => {
|
|
26
|
+
const normalizedValue = newValue.toLowerCase().trim();
|
|
37
27
|
if (!/^#([0-9A-F]{3}){1,2}$/i.test(normalizedValue)) {
|
|
38
28
|
onChange("");
|
|
39
29
|
return;
|
|
@@ -45,12 +35,11 @@ var ColorPicker = function (_a) {
|
|
|
45
35
|
onChange(normalizedValue);
|
|
46
36
|
}
|
|
47
37
|
};
|
|
48
|
-
|
|
49
|
-
return (_jsxs("div", { className: cn("flex flex-wrap gap-2", className), children: [availableSwatches.map(
|
|
50
|
-
backgroundColor: !hasSwatchSelected
|
|
51
|
-
}, children: [_jsx(PipetteIcon, {}), customLabelTitle] }) }), _jsxs(PopoverContent, { className: "rounded-xl bg-white p-4", children: [_jsx(HexColorPicker, { color: parsedValue, onChange: onChangeProxy, className: "w-full!" }), _jsx(Input, { className: "w-full mt-2", maxLength: 7, onChange:
|
|
52
|
-
|
|
53
|
-
onChange((_a = e === null || e === void 0 ? void 0 : e.currentTarget) === null || _a === void 0 ? void 0 : _a.value);
|
|
38
|
+
const hasSwatchSelected = useMemo(() => availableSwatches.includes(parsedValue), [availableSwatches, parsedValue]);
|
|
39
|
+
return (_jsxs("div", { className: cn("flex flex-wrap gap-2", className), children: [availableSwatches.map((color) => (_jsx(Button, { style: { backgroundColor: color }, variant: "roundedWhite", size: "sm", className: cn("size-8 p-0", color === parsedValue && "border-black", swatchClassName), onClick: () => onChangeProxy(color) }, color))), allowCustom && (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { variant: "roundedWhite", size: "sm", className: cn("h-8", !hasSwatchSelected && "border-black"), style: {
|
|
40
|
+
backgroundColor: !hasSwatchSelected ? parsedValue : "",
|
|
41
|
+
}, children: [_jsx(PipetteIcon, {}), customLabelTitle] }) }), _jsxs(PopoverContent, { className: "rounded-xl bg-white p-4", children: [_jsx(HexColorPicker, { color: parsedValue, onChange: onChangeProxy, className: "w-full!" }), _jsx(Input, { className: "w-full mt-2", maxLength: 7, onChange: (e) => {
|
|
42
|
+
onChange(e?.currentTarget?.value);
|
|
54
43
|
}, value: parsedValue })] })] }))] }));
|
|
55
44
|
};
|
|
56
45
|
export { ColorPicker };
|
|
@@ -12,6 +12,6 @@ export type Command = {
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const useCommand: (commandInput: Command) => void;
|
|
14
14
|
export declare const CommandPalette: ({ placeholderText, noResultsText, }: {
|
|
15
|
-
placeholderText?: string;
|
|
16
|
-
noResultsText?: string;
|
|
15
|
+
placeholderText?: string | undefined;
|
|
16
|
+
noResultsText?: string | undefined;
|
|
17
17
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,97 +1,69 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
25
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
26
|
-
if (ar || !(i in from)) {
|
|
27
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
28
|
-
ar[i] = from[i];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
32
|
-
};
|
|
33
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
34
3
|
import { useEffect, useMemo, useState } from "react";
|
|
35
4
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
36
5
|
import { create } from "zustand";
|
|
37
6
|
import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandShortcut, } from "./command";
|
|
38
7
|
import { replaceShortCut } from "./dropdown";
|
|
39
|
-
|
|
8
|
+
const useCommandStore = create()((set) => ({
|
|
40
9
|
commands: [],
|
|
41
|
-
add:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}); });
|
|
52
|
-
},
|
|
53
|
-
}); });
|
|
10
|
+
add: (command) => set((state) => ({
|
|
11
|
+
commands: [
|
|
12
|
+
...state.commands.filter((cmd) => cmd.id !== command.id),
|
|
13
|
+
command,
|
|
14
|
+
],
|
|
15
|
+
})),
|
|
16
|
+
remove: (id) => set((state) => ({
|
|
17
|
+
commands: state.commands.filter((cmd) => cmd.id !== id),
|
|
18
|
+
})),
|
|
19
|
+
}));
|
|
54
20
|
/**
|
|
55
21
|
* React hook to register commands for the Command Palette.
|
|
56
22
|
*/
|
|
57
|
-
export
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
23
|
+
export const useCommand = (commandInput) => {
|
|
24
|
+
const command = useMemo(() => ({
|
|
25
|
+
enabled: true,
|
|
26
|
+
...commandInput,
|
|
27
|
+
}), [commandInput]);
|
|
28
|
+
const addCommand = useCommandStore((state) => state.add);
|
|
29
|
+
const removeCommand = useCommandStore((state) => state.remove);
|
|
61
30
|
useHotkeys(command.shortcut || [], command.action, command);
|
|
62
|
-
useEffect(
|
|
31
|
+
useEffect(() => {
|
|
63
32
|
if (command.enabled) {
|
|
64
33
|
addCommand(command);
|
|
65
34
|
}
|
|
66
|
-
return
|
|
35
|
+
return () => {
|
|
67
36
|
removeCommand(command.id);
|
|
68
37
|
};
|
|
69
38
|
}, [command, addCommand, removeCommand]);
|
|
70
39
|
};
|
|
71
|
-
|
|
40
|
+
const formatShortcut = (shortcut) => {
|
|
72
41
|
if (Array.isArray(shortcut)) {
|
|
73
42
|
return formatShortcut(shortcut[0]);
|
|
74
43
|
}
|
|
75
44
|
return replaceShortCut(shortcut
|
|
76
45
|
.replace("mod", "⌘")
|
|
46
|
+
.replace("shift+equal", "plus")
|
|
77
47
|
.replace("shift", "⇧")
|
|
78
48
|
.replace("alt", "⌥")
|
|
79
49
|
.replace("ctrl", "⌃")
|
|
80
50
|
.replace("up", "↑")
|
|
81
51
|
.replace("down", "↓")
|
|
52
|
+
.replace("minus", "−")
|
|
53
|
+
.replace("equal", "=")
|
|
82
54
|
.replace("backspace", "⌫")
|
|
83
55
|
.replace(/\+/g, "")
|
|
56
|
+
.replace("plus", "+")
|
|
84
57
|
.toUpperCase());
|
|
85
58
|
};
|
|
86
|
-
export
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var group = command.group || "";
|
|
59
|
+
export const CommandPalette = ({ placeholderText = "Type a command or search...", noResultsText = "No results found.", }) => {
|
|
60
|
+
const [open, setOpen] = useState(false);
|
|
61
|
+
useHotkeys("mod+k", () => setOpen((open) => !open));
|
|
62
|
+
const commands = useCommandStore((state) => state.commands);
|
|
63
|
+
const groupedCommands = useMemo(() => {
|
|
64
|
+
const groups = {};
|
|
65
|
+
commands.forEach((command) => {
|
|
66
|
+
const group = command.group || "";
|
|
95
67
|
if (!groups[group]) {
|
|
96
68
|
groups[group] = [];
|
|
97
69
|
}
|
|
@@ -99,15 +71,9 @@ export var CommandPalette = function (_a) {
|
|
|
99
71
|
});
|
|
100
72
|
return groups;
|
|
101
73
|
}, [commands]);
|
|
102
|
-
return (_jsxs(CommandDialog, { open: open, onOpenChange: setOpen, children: [_jsx(CommandInput, { placeholder: placeholderText }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: noResultsText }), Object.entries(groupedCommands).map(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return (_jsxs(CommandItem, { onSelect: function () {
|
|
108
|
-
command.action();
|
|
109
|
-
setOpen(false);
|
|
110
|
-
}, children: [Icon && _jsx(Icon, {}), _jsx("span", { children: command.label }), command.shortcut && (_jsx(CommandShortcut, { children: formatShortcut(command.shortcut) }))] }, command.id));
|
|
111
|
-
}) }, group));
|
|
112
|
-
})] })] }));
|
|
74
|
+
return (_jsxs(CommandDialog, { open: open, onOpenChange: setOpen, children: [_jsx(CommandInput, { placeholder: placeholderText }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: noResultsText }), Object.entries(groupedCommands).map(([group, commands]) => (_jsx(CommandGroup, { heading: group, children: commands.length > 0 &&
|
|
75
|
+
commands.map(({ icon: Icon, ...command }) => (_jsxs(CommandItem, { onSelect: () => {
|
|
76
|
+
command.action();
|
|
77
|
+
setOpen(false);
|
|
78
|
+
}, children: [Icon && _jsx(Icon, {}), _jsx("span", { children: command.label }), command.shortcut && (_jsx(CommandShortcut, { children: formatShortcut(command.shortcut) }))] }, command.id))) }, group)))] })] }));
|
|
113
79
|
};
|