@examplary/ui 1.56.0 → 1.60.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 (107) 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.d.ts +1 -5
  7. package/dist/components/chat/chat-view.js +8 -36
  8. package/dist/components/loading/ai-spinner.js +2 -13
  9. package/dist/components/loading/tick-loader.js +39 -104
  10. package/dist/components/print/answer-box.js +2 -25
  11. package/dist/components/question-types/fetch-component.js +65 -106
  12. package/dist/components/question-types/format-question-type.d.ts +41 -41
  13. package/dist/components/question-types/format-question-type.js +36 -37
  14. package/dist/components/rich-text/minimal-rich-text-field.d.ts +2 -2
  15. package/dist/components/rich-text/minimal-rich-text-field.js +47 -85
  16. package/dist/components/rich-text/rich-text-display.js +15 -33
  17. package/dist/components/rich-text/rich-text-field.js +2 -25
  18. package/dist/components/rich-text/rich-text-toolbar.d.ts +3 -2
  19. package/dist/components/rich-text/rich-text-toolbar.js +5 -6
  20. package/dist/components/rich-text/tiptap/collaboration-caret.js +24 -34
  21. package/dist/components/rich-text/tiptap/comments/comment-bubble.d.ts +1 -1
  22. package/dist/components/rich-text/tiptap/comments/comment-bubble.js +36 -41
  23. package/dist/components/rich-text/tiptap/content-reference.js +6 -7
  24. package/dist/components/rich-text/tiptap/crop-page-clipping-modal.d.ts +3 -3
  25. package/dist/components/rich-text/tiptap/crop-page-clipping-modal.js +20 -25
  26. package/dist/components/rich-text/tiptap/extensions.d.ts +2 -2
  27. package/dist/components/rich-text/tiptap/extensions.js +6 -16
  28. package/dist/components/rich-text/tiptap/file-attachment.js +9 -11
  29. package/dist/components/rich-text/tiptap/file-handler.d.ts +2 -2
  30. package/dist/components/rich-text/tiptap/file-handler.js +110 -185
  31. package/dist/components/rich-text/tiptap/image.js +18 -23
  32. package/dist/components/rich-text/tiptap/mathematics-component.js +25 -30
  33. package/dist/components/rich-text/tiptap/mathematics.js +56 -82
  34. package/dist/components/rich-text/tiptap/page-clipping.js +3 -4
  35. package/dist/components/rich-text/tiptap/png-scanner.js +63 -108
  36. package/dist/components/rich-text/tiptap/rich-text-formatting-menu.d.ts +1 -1
  37. package/dist/components/rich-text/tiptap/rich-text-formatting-menu.js +31 -47
  38. package/dist/components/ui/alert.d.ts +3 -3
  39. package/dist/components/ui/alert.js +7 -32
  40. package/dist/components/ui/avatar.d.ts +2 -1
  41. package/dist/components/ui/avatar.js +33 -26
  42. package/dist/components/ui/badge.d.ts +3 -3
  43. package/dist/components/ui/badge.js +4 -27
  44. package/dist/components/ui/button.d.ts +4 -4
  45. package/dist/components/ui/button.js +4 -27
  46. package/dist/components/ui/card.js +6 -46
  47. package/dist/components/ui/checkbox.js +1 -26
  48. package/dist/components/ui/color-picker.js +11 -22
  49. package/dist/components/ui/command-palette.d.ts +3 -3
  50. package/dist/components/ui/command-palette.js +54 -73
  51. package/dist/components/ui/command.js +18 -49
  52. package/dist/components/ui/comments.js +37 -107
  53. package/dist/components/ui/context-menu.js +30 -67
  54. package/dist/components/ui/dialog.js +15 -61
  55. package/dist/components/ui/dropdown.js +17 -64
  56. package/dist/components/ui/floating-menu.js +2 -25
  57. package/dist/components/ui/floating-resizable.d.ts +5 -0
  58. package/dist/components/ui/floating-resizable.js +24 -0
  59. package/dist/components/ui/help-icon.js +1 -2
  60. package/dist/components/ui/icon-picker.js +50 -130
  61. package/dist/components/ui/index.d.ts +1 -0
  62. package/dist/components/ui/index.js +1 -0
  63. package/dist/components/ui/input.js +2 -25
  64. package/dist/components/ui/label.d.ts +1 -1
  65. package/dist/components/ui/label.js +2 -27
  66. package/dist/components/ui/popover.d.ts +2 -2
  67. package/dist/components/ui/popover.js +4 -32
  68. package/dist/components/ui/progress-bar.js +2 -3
  69. package/dist/components/ui/radio-group.js +4 -28
  70. package/dist/components/ui/resizable.d.ts +6 -9
  71. package/dist/components/ui/resizable.js +13 -60
  72. package/dist/components/ui/select.js +12 -55
  73. package/dist/components/ui/separator.js +1 -26
  74. package/dist/components/ui/sheet.d.ts +3 -3
  75. package/dist/components/ui/sheet.js +11 -51
  76. package/dist/components/ui/skeleton.js +2 -25
  77. package/dist/components/ui/slider.js +7 -32
  78. package/dist/components/ui/sortable.d.ts +1 -1
  79. package/dist/components/ui/sortable.js +131 -155
  80. package/dist/components/ui/switch.d.ts +3 -3
  81. package/dist/components/ui/switch.js +3 -28
  82. package/dist/components/ui/table.js +8 -54
  83. package/dist/components/ui/tabs.js +8 -34
  84. package/dist/components/ui/text-selection-menu.d.ts +1 -1
  85. package/dist/components/ui/text-selection-menu.js +19 -25
  86. package/dist/components/ui/textarea.js +7 -30
  87. package/dist/components/ui/tooltip.js +4 -29
  88. package/dist/components/web-components/content-reference.js +81 -106
  89. package/dist/components/web-components/file-attachment.js +9 -30
  90. package/dist/components/web-components/index.js +1 -1
  91. package/dist/components/web-components/inline-comment-reply.js +3 -24
  92. package/dist/components/web-components/inline-comment.js +3 -24
  93. package/dist/components/web-components/inline-math.js +14 -36
  94. package/dist/components/web-components/page-clipping.js +13 -34
  95. package/dist/lib/compose-refs.js +10 -18
  96. package/dist/lib/use-spin-loop.js +19 -69
  97. package/dist/src/global.css +2 -2
  98. package/dist/utils.js +1 -5
  99. package/package.json +5 -4
  100. package/dist/components/rich-text/tiptap/comments/comment-reply.d.ts +0 -21
  101. package/dist/components/rich-text/tiptap/comments/comment-reply.js +0 -230
  102. package/dist/components/rich-text/tiptap/comments/comment.d.ts +0 -22
  103. package/dist/components/rich-text/tiptap/comments/comment.js +0 -198
  104. package/dist/components/rich-text/tiptap/comments/helpers.d.ts +0 -19
  105. package/dist/components/rich-text/tiptap/comments/helpers.js +0 -95
  106. package/dist/components/rich-text/tiptap/comments/types.d.ts +0 -29
  107. package/dist/components/rich-text/tiptap/comments/types.js +0 -1
@@ -1,113 +1,94 @@
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
+ preventDefault: true,
63
+ enableOnContentEditable: true,
64
+ enableOnFormTags: true,
65
+ });
66
+ const commands = useCommandStore((state) => state.commands);
67
+ const groupedCommands = useMemo(() => {
68
+ const groups = {};
69
+ commands.forEach((command) => {
70
+ const group = command.group || "";
95
71
  if (!groups[group]) {
96
72
  groups[group] = [];
97
73
  }
98
74
  groups[group].push(command);
99
75
  });
100
- return groups;
76
+ return Object.keys(groups)
77
+ .sort((a, b) => {
78
+ if (a === "Developer")
79
+ return 1;
80
+ if (b === "Developer")
81
+ return -1;
82
+ return a.localeCompare(b);
83
+ })
84
+ .reduce((acc, key) => {
85
+ acc[key] = groups[key];
86
+ return acc;
87
+ }, {});
101
88
  }, [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
- })] })] }));
89
+ 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 &&
90
+ commands.map(({ icon: Icon, ...command }) => (_jsxs(CommandItem, { onSelect: () => {
91
+ command.action();
92
+ setOpen(false);
93
+ }, children: [Icon && _jsx(Icon, {}), _jsx("span", { children: command.label }), command.shortcut && (_jsx(CommandShortcut, { children: formatShortcut(command.shortcut) }))] }, command.id))) }, group)))] })] }));
113
94
  };
@@ -1,65 +1,34 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
25
3
  import { Command as CommandPrimitive } from "cmdk";
26
4
  import { SearchIcon } from "lucide-react";
27
5
  import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "./dialog";
28
6
  import { cn } from "../../utils";
29
- function Command(_a) {
30
- var className = _a.className, props = __rest(_a, ["className"]);
31
- return (_jsx(CommandPrimitive, __assign({ "data-slot": "command", className: cn("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md", className) }, props)));
7
+ function Command({ className, ...props }) {
8
+ return (_jsx(CommandPrimitive, { "data-slot": "command", className: cn("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md", className), ...props }));
32
9
  }
33
- function CommandDialog(_a) {
34
- var _b = _a.title, title = _b === void 0 ? "Command Palette" : _b, _c = _a.description, description = _c === void 0 ? "Search for a command to run..." : _c, children = _a.children, className = _a.className, _d = _a.showCloseButton, showCloseButton = _d === void 0 ? false : _d, props = __rest(_a, ["title", "description", "children", "className", "showCloseButton"]);
35
- return (_jsxs(Dialog, __assign({}, props, { children: [_jsxs(DialogHeader, { className: "sr-only", children: [_jsx(DialogTitle, { children: title }), _jsx(DialogDescription, { children: description })] }), _jsx(DialogContent, { className: cn("overflow-hidden p-0!", className), showClose: showCloseButton, children: _jsx(Command, { className: "[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children: children }) })] })));
10
+ function CommandDialog({ title = "Command Palette", description = "Search for a command to run...", children, className, showCloseButton = false, ...props }) {
11
+ return (_jsxs(Dialog, { ...props, children: [_jsxs(DialogHeader, { className: "sr-only", children: [_jsx(DialogTitle, { children: title }), _jsx(DialogDescription, { children: description })] }), _jsx(DialogContent, { className: cn("overflow-hidden p-0!", className), showClose: showCloseButton, children: _jsx(Command, { className: "[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children: children }) })] }));
36
12
  }
37
- function CommandInput(_a) {
38
- var className = _a.className, props = __rest(_a, ["className"]);
39
- return (_jsxs("div", { "data-slot": "command-input-wrapper", className: "flex h-9 items-center gap-2 border-b border-border px-3", children: [_jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }), _jsx(CommandPrimitive.Input, __assign({ "data-slot": "command-input", className: cn("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className) }, props))] }));
13
+ function CommandInput({ className, ...props }) {
14
+ return (_jsxs("div", { "data-slot": "command-input-wrapper", className: "flex h-9 items-center gap-2 border-b border-border px-3", children: [_jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }), _jsx(CommandPrimitive.Input, { "data-slot": "command-input", className: cn("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className), ...props })] }));
40
15
  }
41
- function CommandList(_a) {
42
- var className = _a.className, props = __rest(_a, ["className"]);
43
- return (_jsx(CommandPrimitive.List, __assign({ "data-slot": "command-list", className: cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", className) }, props)));
16
+ function CommandList({ className, ...props }) {
17
+ return (_jsx(CommandPrimitive.List, { "data-slot": "command-list", className: cn("max-h-[300px] scroll-py-2 py-1 overflow-x-hidden overflow-y-auto ring-0 focus-within:ring-0 outline-none rounded-lg", className), ...props }));
44
18
  }
45
- function CommandEmpty(_a) {
46
- var props = __rest(_a, []);
47
- return (_jsx(CommandPrimitive.Empty, __assign({ "data-slot": "command-empty", className: "py-6 text-center text-sm" }, props)));
19
+ function CommandEmpty({ ...props }) {
20
+ return (_jsx(CommandPrimitive.Empty, { "data-slot": "command-empty", className: "py-6 text-center text-sm", ...props }));
48
21
  }
49
- function CommandGroup(_a) {
50
- var className = _a.className, props = __rest(_a, ["className"]);
51
- return (_jsx(CommandPrimitive.Group, __assign({ "data-slot": "command-group", className: cn("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium", className) }, props)));
22
+ function CommandGroup({ className, ...props }) {
23
+ return (_jsx(CommandPrimitive.Group, { "data-slot": "command-group", className: cn("text-black [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-3 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-[13px] [&_[cmdk-group-heading]]:mt-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:font-heading", className), ...props }));
52
24
  }
53
- function CommandSeparator(_a) {
54
- var className = _a.className, props = __rest(_a, ["className"]);
55
- return (_jsx(CommandPrimitive.Separator, __assign({ "data-slot": "command-separator", className: cn("bg-border -mx-1 h-px", className) }, props)));
25
+ function CommandSeparator({ className, ...props }) {
26
+ return (_jsx(CommandPrimitive.Separator, { "data-slot": "command-separator", className: cn("bg-border -mx-1 h-px", className), ...props }));
56
27
  }
57
- function CommandItem(_a) {
58
- var className = _a.className, props = __rest(_a, ["className"]);
59
- return (_jsx(CommandPrimitive.Item, __assign({ "data-slot": "command-item", className: cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className) }, props)));
28
+ function CommandItem({ className, ...props }) {
29
+ return (_jsx(CommandPrimitive.Item, { "data-slot": "command-item", className: cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-md px-3! py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props }));
60
30
  }
61
- function CommandShortcut(_a) {
62
- var className = _a.className, props = __rest(_a, ["className"]);
63
- return (_jsx("span", __assign({ "data-slot": "command-shortcut", className: cn("text-zinc-500 ml-auto text-xs font-medium tracking-widest", className) }, props)));
31
+ function CommandShortcut({ className, ...props }) {
32
+ return (_jsx("span", { "data-slot": "command-shortcut", className: cn("text-zinc-500 ml-auto text-xs font-medium tracking-widest", className), ...props }));
64
33
  }
65
34
  export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
@@ -1,50 +1,3 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
23
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
49
2
  import { useEffect, useMemo, useState } from "react";
50
3
  import { Trans, useTranslation } from "react-i18next";
@@ -56,31 +9,26 @@ import { Popover, PopoverContent, PopoverItem, PopoverTrigger, } from "./popover
56
9
  import { cn } from "../../utils";
57
10
  import { MinimalRichTextField } from "../rich-text/minimal-rich-text-field";
58
11
  import { RichTextDisplay } from "../rich-text/rich-text-display";
59
- export var CommentItem = function (_a) {
60
- var _b, _c;
61
- var comment = _a.comment, onSave = _a.onSave, onResolve = _a.onResolve, onReply = _a.onReply, onDelete = _a.onDelete, onCancel = _a.onCancel, commentAuthor = _a.commentAuthor, onEditingChange = _a.onEditingChange, _d = _a.isTopLevel, isTopLevel = _d === void 0 ? true : _d, className = _a.className;
62
- var t = useTranslation().t;
63
- var _e = useState(comment.value || ""), draft = _e[0], setDraft = _e[1];
64
- var _f = useState(false), focused = _f[0], setFocused = _f[1];
65
- var _g = useState(false), loading = _g[0], setLoading = _g[1];
66
- var _h = useState(!comment.value && ((_b = comment.createdBy) === null || _b === void 0 ? void 0 : _b.id) === (commentAuthor === null || commentAuthor === void 0 ? void 0 : commentAuthor.id) && !!onSave), editing = _h[0], setEditing = _h[1];
67
- useEffect(function () {
12
+ export const CommentItem = ({ comment, onSave, onResolve, onReply, onDelete, onCancel, commentAuthor, onEditingChange, isTopLevel = true, className, }) => {
13
+ const { t } = useTranslation();
14
+ const [draft, setDraft] = useState(comment.value || "");
15
+ const [focused, setFocused] = useState(false);
16
+ const [loading, setLoading] = useState(false);
17
+ const [editing, setEditing] = useState(!comment.value && comment.createdBy?.id === commentAuthor?.id && !!onSave);
18
+ useEffect(() => {
68
19
  if (onEditingChange) {
69
20
  onEditingChange(comment.id, editing);
70
- return function () { return onEditingChange(comment.id, false); };
21
+ return () => onEditingChange(comment.id, false);
71
22
  }
72
23
  }, [editing, comment.id, onEditingChange]);
73
- var quoteColor = useMemo(function () {
74
- var _a, _b;
75
- return ((_a = comment.createdBy) === null || _a === void 0 ? void 0 : _a.color) ||
76
- (comment.createdBy && getUserColor((_b = comment.createdBy) === null || _b === void 0 ? void 0 : _b.id));
77
- }, [comment.createdBy]);
78
- return (_jsxs("div", { className: cn("flex gap-3 items-start", className), children: [_jsx(Avatar, { entity: __assign({ type: "user" }, (comment.createdBy || {})), size: 24 }), _jsxs("div", { className: "flex-1 flex flex-col gap-1 break-all", children: [_jsxs("div", { children: [_jsx("div", { className: cn("leading-[1] font-medium font-heading", !comment.createdAt && "py-1.25"), children: ((_c = comment.createdBy) === null || _c === void 0 ? void 0 : _c.name) || "Unknown User" }), comment.createdAt && (_jsx("div", { className: "text-xs font-normal text-zinc-500", children: formatDistanceToNow(new Date(comment.createdAt), {
24
+ const quoteColor = useMemo(() => comment.createdBy?.color ||
25
+ (comment.createdBy && getUserColor(comment.createdBy?.id)), [comment.createdBy]);
26
+ return (_jsxs("div", { className: cn("flex gap-3 items-start", className), children: [_jsx(Avatar, { entity: { type: "user", ...(comment.createdBy || {}) }, size: 24 }), _jsxs("div", { className: "flex-1 flex flex-col gap-1 break-all", children: [_jsxs("div", { children: [_jsx("div", { className: cn("leading-[1] font-medium font-heading", !comment.createdAt && "py-1.25"), children: comment.createdBy?.name || "Unknown User" }), comment.createdAt && (_jsx("div", { className: "text-xs font-normal text-zinc-500", children: formatDistanceToNow(new Date(comment.createdAt), {
79
27
  addSuffix: true,
80
- }) }))] }), comment.quotation && (_jsxs("blockquote", { className: "mt-1 mb-2 pl-3.5 py-0.5 relative text-sm italic text-zinc-800 line-clamp-2", onClick: function () {
28
+ }) }))] }), comment.quotation && (_jsxs("blockquote", { className: "mt-1 mb-2 pl-3.5 py-0.5 relative text-sm italic text-zinc-800 line-clamp-2", onClick: () => {
81
29
  if (!comment.id)
82
30
  return;
83
- var highlight = document.querySelector("[data-comment=\"".concat(comment.id, "\"]"));
31
+ const highlight = document.querySelector(`[data-comment="${comment.id}"]`);
84
32
  if (!highlight)
85
33
  return;
86
34
  highlight.scrollIntoView({
@@ -88,55 +36,37 @@ export var CommentItem = function (_a) {
88
36
  block: "center",
89
37
  });
90
38
  highlight.classList.add("highlighted");
91
- setTimeout(function () { return highlight.classList.remove("highlighted"); }, 1200);
92
- }, children: [comment.quotation, _jsx("span", { className: "absolute inset-0 right-auto w-0.75 rounded bg-zinc-600 opacity-50", style: { backgroundColor: quoteColor } })] })), editing ? (_jsxs(_Fragment, { children: [_jsx(MinimalRichTextField, { value: draft, "data-comment-input": comment.id, onChange: function (value) { return setDraft(value); }, onKeyDown: function (e) { return __awaiter(void 0, void 0, void 0, function () {
93
- return __generator(this, function (_a) {
94
- switch (_a.label) {
95
- case 0:
96
- if (!(e.key === "Enter" && e.metaKey)) return [3 /*break*/, 4];
97
- e.preventDefault();
98
- setLoading(true);
99
- if (!(draft.trim().length > 0)) return [3 /*break*/, 4];
100
- _a.label = 1;
101
- case 1:
102
- _a.trys.push([1, , 3, 4]);
103
- return [4 /*yield*/, onSave(draft)];
104
- case 2:
105
- _a.sent();
39
+ setTimeout(() => highlight.classList.remove("highlighted"), 1200);
40
+ }, children: [comment.quotation, _jsx("span", { className: "absolute inset-0 right-auto w-0.75 rounded bg-zinc-600 opacity-50", style: { backgroundColor: quoteColor } })] })), editing ? (_jsxs(_Fragment, { children: [_jsx(MinimalRichTextField, { value: draft, "data-comment-input": comment.id, onChange: (value) => setDraft(value), onKeyDown: async (e) => {
41
+ if (e.key === "Enter" && e.metaKey) {
42
+ e.preventDefault();
43
+ setLoading(true);
44
+ if (draft.trim().length > 0) {
45
+ try {
46
+ await onSave(draft);
106
47
  setEditing(false);
107
- return [3 /*break*/, 4];
108
- case 3:
48
+ }
49
+ finally {
109
50
  setLoading(false);
110
- return [7 /*endfinally*/];
111
- case 4: return [2 /*return*/];
51
+ }
112
52
  }
113
- });
114
- }); }, autoFocus: true, placeholder: comment.inReplyTo
53
+ }
54
+ }, autoFocus: true, placeholder: comment.inReplyTo
115
55
  ? t("formatting.comments.reply-placeholder")
116
- : t("formatting.comments.comment-placeholder"), disabled: loading, className: cn("border border-border focus-within:border-border-accent", "px-3 py-2 text-sm font-normal rounded-3xl", "focus-within:rounded-xl focus-within:min-h-20 transition-all", "flex-1 w-full overflow-x-auto break-all", focused && "rounded-xl min-h-20"), onFocus: function () { return setFocused(true); } }), _jsxs("div", { className: "flex items-center justify-end gap-2 mt-2", children: [onCancel && (_jsx(Button, { type: "button", variant: "secondary", size: "sm", disabled: loading, onClick: function () {
56
+ : t("formatting.comments.comment-placeholder"), disabled: loading, className: cn("border border-border focus-within:border-border-accent", "px-3 py-2 text-sm font-normal rounded-3xl", "focus-within:rounded-xl focus-within:min-h-20 transition-all", "flex-1 w-full overflow-x-auto break-all", focused && "rounded-xl min-h-20"), onFocus: () => setFocused(true) }), _jsxs("div", { className: "flex items-center justify-end gap-2 mt-2", children: [onCancel && (_jsx(Button, { type: "button", variant: "secondary", size: "sm", disabled: loading, onClick: () => {
117
57
  onCancel();
118
58
  setDraft(comment.value || "");
119
59
  setEditing(false);
120
- }, children: _jsx(Trans, { children: "formatting.comments.cancel" }) })), _jsx(Button, { type: "button", onClick: function () { return __awaiter(void 0, void 0, void 0, function () {
121
- return __generator(this, function (_a) {
122
- switch (_a.label) {
123
- case 0:
124
- setLoading(true);
125
- _a.label = 1;
126
- case 1:
127
- _a.trys.push([1, , 3, 4]);
128
- return [4 /*yield*/, onSave(draft)];
129
- case 2:
130
- _a.sent();
131
- setEditing(false);
132
- return [3 /*break*/, 4];
133
- case 3:
134
- setLoading(false);
135
- return [7 /*endfinally*/];
136
- case 4: return [2 /*return*/];
137
- }
138
- });
139
- }); }, disabled: !draft.trim() || loading, variant: "primary", size: "sm", title: "Save comment", "aria-label": "Save comment", children: _jsx(Trans, { children: "formatting.comments.save-comment" }) })] })] })) : (_jsx(RichTextDisplay, { className: "text-sm font-normal", children: comment.value || "" }))] }), !editing && (_jsxs("div", { children: [isTopLevel && onReply && (_jsx("button", { type: "button", onClick: function () { return onReply(); }, title: "Reply", "aria-label": "Reply", className: "p-1.5 cursor-pointer hover:bg-zinc-100 rounded-base", children: _jsx(MessageCircleIcon, { className: "size-3.5" }) })), isTopLevel && onResolve && (_jsx("button", { type: "button", onClick: function () { return onResolve(); }, title: "Resolve comment", "aria-label": "Resolve comment", className: "p-1.5 cursor-pointer hover:bg-zinc-100 rounded-base", children: _jsx(CheckIcon, { className: "size-3.5" }) })), (onDelete || onSave) && (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", title: "Comment options", "aria-label": "Comment options", className: "p-1.5 cursor-pointer hover:bg-zinc-100 rounded-base", children: _jsx(MoreHorizontalIcon, { className: "size-3.5" }) }) }), _jsxs(PopoverContent, { className: "p-0 gap-0 overflow-hidden min-w-32", children: [!!onSave && (_jsxs(PopoverItem, { onClick: function () {
60
+ }, children: _jsx(Trans, { children: "formatting.comments.cancel" }) })), _jsx(Button, { type: "button", onClick: async () => {
61
+ setLoading(true);
62
+ try {
63
+ await onSave(draft);
64
+ setEditing(false);
65
+ }
66
+ finally {
67
+ setLoading(false);
68
+ }
69
+ }, disabled: !draft.trim() || loading, variant: "primary", size: "sm", title: "Save comment", "aria-label": "Save comment", children: _jsx(Trans, { children: "formatting.comments.save-comment" }) })] })] })) : (_jsx(RichTextDisplay, { className: "text-sm font-normal", children: comment.value || "" }))] }), !editing && (_jsxs("div", { children: [isTopLevel && onReply && (_jsx("button", { type: "button", onClick: () => onReply(), title: "Reply", "aria-label": "Reply", className: "p-1.5 cursor-pointer hover:bg-zinc-100 rounded-base", children: _jsx(MessageCircleIcon, { className: "size-3.5" }) })), isTopLevel && onResolve && (_jsx("button", { type: "button", onClick: () => onResolve(), title: "Resolve comment", "aria-label": "Resolve comment", className: "p-1.5 cursor-pointer hover:bg-zinc-100 rounded-base", children: _jsx(CheckIcon, { className: "size-3.5" }) })), (onDelete || onSave) && (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", title: "Comment options", "aria-label": "Comment options", className: "p-1.5 cursor-pointer hover:bg-zinc-100 rounded-base", children: _jsx(MoreHorizontalIcon, { className: "size-3.5" }) }) }), _jsxs(PopoverContent, { className: "p-0 gap-0 overflow-hidden min-w-32", children: [!!onSave && (_jsxs(PopoverItem, { onClick: () => {
140
70
  setEditing(true);
141
71
  }, className: "text-xs border-0", children: [_jsx(PencilLineIcon, { className: "size-3.5! mr-1" }), _jsx(Trans, { children: "formatting.comments.edit-comment" })] })), !!onDelete && (_jsxs(PopoverItem, { onClick: onDelete, className: "text-xs border-0", children: [_jsx(TrashIcon, { className: "size-3.5! mr-1" }), _jsx(Trans, { children: "formatting.comments.delete-comment" })] }))] })] }))] }))] }));
142
72
  };
@@ -1,88 +1,51 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
25
3
  import { ChevronRightIcon, CheckIcon } from "lucide-react";
26
4
  import { ContextMenu as ContextMenuPrimitive } from "radix-ui";
27
5
  import { cn } from "../../utils";
28
- function ContextMenu(_a) {
29
- var props = __rest(_a, []);
30
- return _jsx(ContextMenuPrimitive.Root, __assign({ "data-slot": "context-menu" }, props));
6
+ function ContextMenu({ ...props }) {
7
+ return _jsx(ContextMenuPrimitive.Root, { "data-slot": "context-menu", ...props });
31
8
  }
32
- function ContextMenuTrigger(_a) {
33
- var className = _a.className, props = __rest(_a, ["className"]);
34
- return (_jsx(ContextMenuPrimitive.Trigger, __assign({ "data-slot": "context-menu-trigger", className: cn("select-none", className) }, props)));
9
+ function ContextMenuTrigger({ className, ...props }) {
10
+ return (_jsx(ContextMenuPrimitive.Trigger, { "data-slot": "context-menu-trigger", className: cn("select-none", className), ...props }));
35
11
  }
36
- function ContextMenuGroup(_a) {
37
- var props = __rest(_a, []);
38
- return (_jsx(ContextMenuPrimitive.Group, __assign({ "data-slot": "context-menu-group" }, props)));
12
+ function ContextMenuGroup({ ...props }) {
13
+ return (_jsx(ContextMenuPrimitive.Group, { "data-slot": "context-menu-group", ...props }));
39
14
  }
40
- function ContextMenuPortal(_a) {
41
- var props = __rest(_a, []);
42
- return (_jsx(ContextMenuPrimitive.Portal, __assign({ "data-slot": "context-menu-portal" }, props)));
15
+ function ContextMenuPortal({ ...props }) {
16
+ return (_jsx(ContextMenuPrimitive.Portal, { "data-slot": "context-menu-portal", ...props }));
43
17
  }
44
- function ContextMenuSub(_a) {
45
- var props = __rest(_a, []);
46
- return _jsx(ContextMenuPrimitive.Sub, __assign({ "data-slot": "context-menu-sub" }, props));
18
+ function ContextMenuSub({ ...props }) {
19
+ return _jsx(ContextMenuPrimitive.Sub, { "data-slot": "context-menu-sub", ...props });
47
20
  }
48
- function ContextMenuRadioGroup(_a) {
49
- var props = __rest(_a, []);
50
- return (_jsx(ContextMenuPrimitive.RadioGroup, __assign({ "data-slot": "context-menu-radio-group" }, props)));
21
+ function ContextMenuRadioGroup({ ...props }) {
22
+ return (_jsx(ContextMenuPrimitive.RadioGroup, { "data-slot": "context-menu-radio-group", ...props }));
51
23
  }
52
- function ContextMenuContent(_a) {
53
- var className = _a.className, props = __rest(_a, ["className"]);
54
- return (_jsx(ContextMenuPrimitive.Portal, { children: _jsx(ContextMenuPrimitive.Content, __assign({ "data-slot": "context-menu-content", className: cn("empty:hidden data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-black/10 bg-white text-black min-w-36 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-context-menu-content-available-height) origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto", className) }, props)) }));
24
+ function ContextMenuContent({ className, ...props }) {
25
+ return (_jsx(ContextMenuPrimitive.Portal, { children: _jsx(ContextMenuPrimitive.Content, { "data-slot": "context-menu-content", className: cn("empty:hidden data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-black/10 bg-white text-black min-w-36 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-context-menu-content-available-height) origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto", className), ...props }) }));
55
26
  }
56
- function ContextMenuItem(_a) {
57
- var className = _a.className, inset = _a.inset, _b = _a.variant, variant = _b === void 0 ? "default" : _b, props = __rest(_a, ["className", "inset", "variant"]);
58
- return (_jsx(ContextMenuPrimitive.Item, __assign({ "data-slot": "context-menu-item", "data-inset": inset, "data-variant": variant, className: cn("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive focus:*:[svg]:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 group/context-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className) }, props)));
27
+ function ContextMenuItem({ className, inset, variant = "default", ...props }) {
28
+ return (_jsx(ContextMenuPrimitive.Item, { "data-slot": "context-menu-item", "data-inset": inset, "data-variant": variant, className: cn("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive focus:*:[svg]:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 group/context-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), ...props }));
59
29
  }
60
- function ContextMenuSubTrigger(_a) {
61
- var className = _a.className, inset = _a.inset, children = _a.children, props = __rest(_a, ["className", "inset", "children"]);
62
- return (_jsxs(ContextMenuPrimitive.SubTrigger, __assign({ "data-slot": "context-menu-sub-trigger", "data-inset": inset, className: cn("focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0", className) }, props, { children: [children, _jsx(ChevronRightIcon, { className: "cn-rtl-flip ml-auto" })] })));
30
+ function ContextMenuSubTrigger({ className, inset, children, ...props }) {
31
+ return (_jsxs(ContextMenuPrimitive.SubTrigger, { "data-slot": "context-menu-sub-trigger", "data-inset": inset, className: cn("focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0", className), ...props, children: [children, _jsx(ChevronRightIcon, { className: "cn-rtl-flip ml-auto" })] }));
63
32
  }
64
- function ContextMenuSubContent(_a) {
65
- var className = _a.className, props = __rest(_a, ["className"]);
66
- return (_jsx(ContextMenuPrimitive.SubContent, __assign({ "data-slot": "context-menu-sub-content", className: cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-popover text-popover-foreground min-w-32 rounded-lg border p-1 shadow-lg duration-100 z-50 origin-(--radix-context-menu-content-transform-origin) overflow-hidden", className) }, props)));
33
+ function ContextMenuSubContent({ className, ...props }) {
34
+ return (_jsx(ContextMenuPrimitive.SubContent, { "data-slot": "context-menu-sub-content", className: cn("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-popover text-popover-foreground min-w-32 rounded-lg border p-1 shadow-lg duration-100 z-50 origin-(--radix-context-menu-content-transform-origin) overflow-hidden", className), ...props }));
67
35
  }
68
- function ContextMenuCheckboxItem(_a) {
69
- var className = _a.className, children = _a.children, checked = _a.checked, inset = _a.inset, props = __rest(_a, ["className", "children", "checked", "inset"]);
70
- return (_jsxs(ContextMenuPrimitive.CheckboxItem, __assign({ "data-slot": "context-menu-checkbox-item", "data-inset": inset, className: cn("focus:bg-accent focus:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), checked: checked }, props, { children: [_jsx("span", { className: "absolute right-2 pointer-events-none", children: _jsx(ContextMenuPrimitive.ItemIndicator, { children: _jsx(CheckIcon, {}) }) }), children] })));
36
+ function ContextMenuCheckboxItem({ className, children, checked, inset, ...props }) {
37
+ return (_jsxs(ContextMenuPrimitive.CheckboxItem, { "data-slot": "context-menu-checkbox-item", "data-inset": inset, className: cn("focus:bg-accent focus:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), checked: checked, ...props, children: [_jsx("span", { className: "absolute right-2 pointer-events-none", children: _jsx(ContextMenuPrimitive.ItemIndicator, { children: _jsx(CheckIcon, {}) }) }), children] }));
71
38
  }
72
- function ContextMenuRadioItem(_a) {
73
- var className = _a.className, children = _a.children, inset = _a.inset, props = __rest(_a, ["className", "children", "inset"]);
74
- return (_jsxs(ContextMenuPrimitive.RadioItem, __assign({ "data-slot": "context-menu-radio-item", "data-inset": inset, className: cn("focus:bg-accent focus:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className) }, props, { children: [_jsx("span", { className: "absolute right-2 pointer-events-none", children: _jsx(ContextMenuPrimitive.ItemIndicator, { children: _jsx(CheckIcon, {}) }) }), children] })));
39
+ function ContextMenuRadioItem({ className, children, inset, ...props }) {
40
+ return (_jsxs(ContextMenuPrimitive.RadioItem, { "data-slot": "context-menu-radio-item", "data-inset": inset, className: cn("focus:bg-accent focus:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", className), ...props, children: [_jsx("span", { className: "absolute right-2 pointer-events-none", children: _jsx(ContextMenuPrimitive.ItemIndicator, { children: _jsx(CheckIcon, {}) }) }), children] }));
75
41
  }
76
- function ContextMenuLabel(_a) {
77
- var className = _a.className, inset = _a.inset, props = __rest(_a, ["className", "inset"]);
78
- return (_jsx(ContextMenuPrimitive.Label, __assign({ "data-slot": "context-menu-label", "data-inset": inset, className: cn("text-muted-foreground px-1.5 py-1 text-xs font-medium data-inset:pl-7", className) }, props)));
42
+ function ContextMenuLabel({ className, inset, ...props }) {
43
+ return (_jsx(ContextMenuPrimitive.Label, { "data-slot": "context-menu-label", "data-inset": inset, className: cn("text-muted-foreground px-1.5 py-1 text-xs font-medium data-inset:pl-7", className), ...props }));
79
44
  }
80
- function ContextMenuSeparator(_a) {
81
- var className = _a.className, props = __rest(_a, ["className"]);
82
- return (_jsx(ContextMenuPrimitive.Separator, __assign({ "data-slot": "context-menu-separator", className: cn("bg-border -mx-1 my-1 h-px", className) }, props)));
45
+ function ContextMenuSeparator({ className, ...props }) {
46
+ return (_jsx(ContextMenuPrimitive.Separator, { "data-slot": "context-menu-separator", className: cn("bg-border -mx-1 my-1 h-px", className), ...props }));
83
47
  }
84
- function ContextMenuShortcut(_a) {
85
- var className = _a.className, props = __rest(_a, ["className"]);
86
- return (_jsx("span", __assign({ "data-slot": "context-menu-shortcut", className: cn("text-muted-foreground group-focus/context-menu-item:text-accent-foreground ml-auto text-xs tracking-widest", className) }, props)));
48
+ function ContextMenuShortcut({ className, ...props }) {
49
+ return (_jsx("span", { "data-slot": "context-menu-shortcut", className: cn("text-muted-foreground group-focus/context-menu-item:text-accent-foreground ml-auto text-xs tracking-widest", className), ...props }));
87
50
  }
88
51
  export { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuCheckboxItem, ContextMenuRadioItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuShortcut, ContextMenuGroup, ContextMenuPortal, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuRadioGroup, };