@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.
Files changed (105) hide show
  1. package/dist/components/ai/ai-icon.js +2 -25
  2. package/dist/components/ai/ai-prompt-suggestion.js +3 -26
  3. package/dist/components/brand/tick-icon.js +2 -25
  4. package/dist/components/chat/chat-input.js +8 -31
  5. package/dist/components/chat/chat-typing-indicator.js +2 -2
  6. package/dist/components/chat/chat-view.js +6 -34
  7. package/dist/components/loading/ai-spinner.js +2 -13
  8. package/dist/components/loading/tick-loader.js +39 -104
  9. package/dist/components/print/answer-box.js +2 -25
  10. package/dist/components/question-types/fetch-component.js +65 -106
  11. package/dist/components/question-types/format-question-type.d.ts +41 -41
  12. package/dist/components/question-types/format-question-type.js +36 -37
  13. package/dist/components/rich-text/minimal-rich-text-field.d.ts +2 -2
  14. package/dist/components/rich-text/minimal-rich-text-field.js +47 -85
  15. package/dist/components/rich-text/rich-text-display.js +15 -33
  16. package/dist/components/rich-text/rich-text-field.js +2 -25
  17. package/dist/components/rich-text/rich-text-toolbar.d.ts +3 -2
  18. package/dist/components/rich-text/rich-text-toolbar.js +5 -6
  19. package/dist/components/rich-text/tiptap/collaboration-caret.js +24 -34
  20. package/dist/components/rich-text/tiptap/comments/comment-bubble.d.ts +1 -1
  21. package/dist/components/rich-text/tiptap/comments/comment-bubble.js +36 -41
  22. package/dist/components/rich-text/tiptap/content-reference.js +6 -7
  23. package/dist/components/rich-text/tiptap/crop-page-clipping-modal.d.ts +3 -3
  24. package/dist/components/rich-text/tiptap/crop-page-clipping-modal.js +20 -25
  25. package/dist/components/rich-text/tiptap/extensions.d.ts +2 -2
  26. package/dist/components/rich-text/tiptap/extensions.js +6 -16
  27. package/dist/components/rich-text/tiptap/file-attachment.js +9 -11
  28. package/dist/components/rich-text/tiptap/file-handler.d.ts +2 -2
  29. package/dist/components/rich-text/tiptap/file-handler.js +110 -185
  30. package/dist/components/rich-text/tiptap/image.js +18 -23
  31. package/dist/components/rich-text/tiptap/mathematics-component.js +25 -30
  32. package/dist/components/rich-text/tiptap/mathematics.js +56 -82
  33. package/dist/components/rich-text/tiptap/page-clipping.js +3 -4
  34. package/dist/components/rich-text/tiptap/png-scanner.js +63 -108
  35. package/dist/components/rich-text/tiptap/rich-text-formatting-menu.d.ts +1 -1
  36. package/dist/components/rich-text/tiptap/rich-text-formatting-menu.js +31 -46
  37. package/dist/components/ui/alert.d.ts +3 -3
  38. package/dist/components/ui/alert.js +7 -32
  39. package/dist/components/ui/avatar.js +18 -14
  40. package/dist/components/ui/badge.d.ts +3 -3
  41. package/dist/components/ui/badge.js +4 -27
  42. package/dist/components/ui/button.d.ts +4 -4
  43. package/dist/components/ui/button.js +4 -27
  44. package/dist/components/ui/card.js +6 -46
  45. package/dist/components/ui/checkbox.js +1 -26
  46. package/dist/components/ui/color-picker.js +11 -22
  47. package/dist/components/ui/command-palette.d.ts +2 -2
  48. package/dist/components/ui/command-palette.js +38 -72
  49. package/dist/components/ui/command.js +18 -49
  50. package/dist/components/ui/comments.js +37 -107
  51. package/dist/components/ui/context-menu.js +30 -67
  52. package/dist/components/ui/dialog.js +15 -61
  53. package/dist/components/ui/dropdown.js +17 -64
  54. package/dist/components/ui/floating-menu.js +2 -25
  55. package/dist/components/ui/floating-resizable.d.ts +5 -0
  56. package/dist/components/ui/floating-resizable.js +24 -0
  57. package/dist/components/ui/help-icon.js +1 -2
  58. package/dist/components/ui/icon-picker.js +50 -130
  59. package/dist/components/ui/index.d.ts +1 -0
  60. package/dist/components/ui/index.js +1 -0
  61. package/dist/components/ui/input.js +2 -25
  62. package/dist/components/ui/label.d.ts +1 -1
  63. package/dist/components/ui/label.js +2 -27
  64. package/dist/components/ui/popover.d.ts +2 -2
  65. package/dist/components/ui/popover.js +4 -32
  66. package/dist/components/ui/progress-bar.js +2 -3
  67. package/dist/components/ui/radio-group.js +4 -28
  68. package/dist/components/ui/resizable.d.ts +6 -9
  69. package/dist/components/ui/resizable.js +13 -60
  70. package/dist/components/ui/select.js +12 -55
  71. package/dist/components/ui/separator.js +1 -26
  72. package/dist/components/ui/sheet.d.ts +3 -3
  73. package/dist/components/ui/sheet.js +11 -51
  74. package/dist/components/ui/skeleton.js +2 -25
  75. package/dist/components/ui/slider.js +7 -32
  76. package/dist/components/ui/sortable.d.ts +1 -1
  77. package/dist/components/ui/sortable.js +131 -155
  78. package/dist/components/ui/switch.d.ts +3 -3
  79. package/dist/components/ui/switch.js +3 -28
  80. package/dist/components/ui/table.js +8 -54
  81. package/dist/components/ui/tabs.js +8 -34
  82. package/dist/components/ui/text-selection-menu.d.ts +1 -1
  83. package/dist/components/ui/text-selection-menu.js +19 -25
  84. package/dist/components/ui/textarea.js +7 -30
  85. package/dist/components/ui/tooltip.js +4 -29
  86. package/dist/components/web-components/content-reference.js +81 -106
  87. package/dist/components/web-components/file-attachment.js +9 -30
  88. package/dist/components/web-components/index.js +1 -1
  89. package/dist/components/web-components/inline-comment-reply.js +3 -24
  90. package/dist/components/web-components/inline-comment.js +3 -24
  91. package/dist/components/web-components/inline-math.js +14 -36
  92. package/dist/components/web-components/page-clipping.js +13 -34
  93. package/dist/lib/compose-refs.js +10 -18
  94. package/dist/lib/use-spin-loop.js +19 -69
  95. package/dist/src/global.css +2 -2
  96. package/dist/utils.js +1 -5
  97. package/package.json +5 -4
  98. package/dist/components/rich-text/tiptap/comments/comment-reply.d.ts +0 -21
  99. package/dist/components/rich-text/tiptap/comments/comment-reply.js +0 -230
  100. package/dist/components/rich-text/tiptap/comments/comment.d.ts +0 -22
  101. package/dist/components/rich-text/tiptap/comments/comment.js +0 -198
  102. package/dist/components/rich-text/tiptap/comments/helpers.d.ts +0 -19
  103. package/dist/components/rich-text/tiptap/comments/helpers.js +0 -95
  104. package/dist/components/rich-text/tiptap/comments/types.d.ts +0 -29
  105. 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
- var 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", {
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(_a) {
41
- var className = _a.className, variant = _a.variant, props = __rest(_a, ["className", "variant"]);
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(_a) {
45
- var className = _a.className, props = __rest(_a, ["className"]);
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(_a) {
49
- var className = _a.className, props = __rest(_a, ["className"]);
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 var Avatar = function (_a) {
7
- var entity = _a.entity, className = _a.className, _b = _a.size, size = _b === void 0 ? 40 : _b;
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
- var color = useMemo(function () {
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("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" &&
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
- ? "url(".concat(entity.avatar, ")")
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
- var userColors = [
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
- var userColorCache = new Map();
45
- export var getUserColor = function (userId) {
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
- var hash = userId
48
+ const hash = userId
50
49
  .split("")
51
- .reduce(function (acc, char) { return acc + char.charCodeAt(0); }, 0);
52
- var color = userColors[hash % userColors.length];
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 var getUserInitials = function (name) {
57
- return name === null || name === void 0 ? void 0 : name.split(" ").map(function (part) { return part[0]; }).join("").substring(0, 2).toUpperCase();
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
- var badgeVariants = cva("font-semibold text-xs rounded-4xl py-0.5 px-2 whitespace-nowrap", {
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
- var Badge = React.forwardRef(function (_a, ref) {
45
- var className = _a.className, variant = _a.variant, _b = _a.asChild, asChild = _b === void 0 ? false : _b, props = __rest(_a, ["className", "variant", "asChild"]);
46
- var Comp = asChild ? Slot : "span";
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
- var 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", {
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
- var Button = React.forwardRef(function (_a, ref) {
59
- var className = _a.className, variant = _a.variant, size = _a.size, _b = _a.asChild, asChild = _b === void 0 ? false : _b, props = __rest(_a, ["className", "variant", "size", "asChild"]);
60
- var Comp = asChild ? Slot : "button";
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
- var Card = React.forwardRef(function (_a, ref) {
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
- var CardHeader = React.forwardRef(function (_a, ref) {
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
- var CardTitle = React.forwardRef(function (_a, ref) {
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
- var CardDescription = React.forwardRef(function (_a, ref) {
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
- var CardContent = React.forwardRef(function (_a, ref) {
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
- var CardFooter = React.forwardRef(function (_a, ref) {
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
- var Checkbox = React.forwardRef(function (_a, ref) {
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
- var defaultSwatches = [
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
- var ColorPicker = function (_a) {
30
- var value = _a.value, _b = _a.swatches, swatches = _b === void 0 ? defaultSwatches : _b, _c = _a.defaultValue, defaultValue = _c === void 0 ? "#ffffff" : _c, _d = _a.customLabelTitle, customLabelTitle = _d === void 0 ? "Custom" : _d, _e = _a.allowCustom, allowCustom = _e === void 0 ? true : _e, swatchClassName = _a.swatchClassName, className = _a.className, onChange = _a.onChange;
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
- var availableSwatches = useMemo(function () { return Array.from(new Set(__spreadArray([defaultValue], swatches, true).filter(Boolean))); }, [defaultValue, swatches]);
35
- var onChangeProxy = function (newValue) {
36
- var normalizedValue = newValue.toLowerCase().trim();
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
- var hasSwatchSelected = useMemo(function () { return availableSwatches.includes(parsedValue); }, [availableSwatches, parsedValue]);
49
- return (_jsxs("div", { className: cn("flex flex-wrap gap-2", className), children: [availableSwatches.map(function (color) { return (_jsx(Button, { style: { backgroundColor: color }, variant: "roundedWhite", size: "sm", className: cn("size-8 p-0", color === parsedValue && "border-black", swatchClassName), onClick: function () { return 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: {
50
- backgroundColor: !hasSwatchSelected && parsedValue,
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: function (e) {
52
- var _a;
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
- var useCommandStore = create()(function (set) { return ({
8
+ const useCommandStore = create()((set) => ({
40
9
  commands: [],
41
- add: function (command) {
42
- return set(function (state) { return ({
43
- commands: __spreadArray(__spreadArray([], state.commands.filter(function (cmd) { return cmd.id !== command.id; }), true), [
44
- command,
45
- ], false),
46
- }); });
47
- },
48
- remove: function (id) {
49
- return set(function (state) { return ({
50
- commands: state.commands.filter(function (cmd) { return cmd.id !== id; }),
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 var useCommand = function (commandInput) {
58
- var command = useMemo(function () { return (__assign({ enabled: true }, commandInput)); }, [commandInput]);
59
- var addCommand = useCommandStore(function (state) { return state.add; });
60
- var removeCommand = useCommandStore(function (state) { return state.remove; });
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(function () {
31
+ useEffect(() => {
63
32
  if (command.enabled) {
64
33
  addCommand(command);
65
34
  }
66
- return function () {
35
+ return () => {
67
36
  removeCommand(command.id);
68
37
  };
69
38
  }, [command, addCommand, removeCommand]);
70
39
  };
71
- var formatShortcut = function (shortcut) {
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 var CommandPalette = function (_a) {
87
- var _b = _a.placeholderText, placeholderText = _b === void 0 ? "Type a command or search..." : _b, _c = _a.noResultsText, noResultsText = _c === void 0 ? "No results found." : _c;
88
- var _d = useState(false), open = _d[0], setOpen = _d[1];
89
- useHotkeys("mod+k", function () { return setOpen(function (open) { return !open; }); });
90
- var commands = useCommandStore(function (state) { return state.commands; });
91
- var groupedCommands = useMemo(function () {
92
- var groups = {};
93
- commands.forEach(function (command) {
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(function (_a) {
103
- var group = _a[0], commands = _a[1];
104
- return (_jsx(CommandGroup, { heading: group, children: commands.length > 0 &&
105
- commands.map(function (_a) {
106
- var Icon = _a.icon, command = __rest(_a, ["icon"]);
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
  };