@copilotkit/react-ui 0.10.0-alpha.3 → 0.10.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +184 -92
- package/CHANGELOG.md +22 -0
- package/dist/components/chat-components/chat-list.js +470 -0
- package/dist/components/chat-components/chat-list.js.map +1 -0
- package/dist/components/chat-components/chat-message-actions.js +188 -0
- package/dist/components/chat-components/chat-message-actions.js.map +1 -0
- package/dist/components/chat-components/chat-message.js +431 -0
- package/dist/components/chat-components/chat-message.js.map +1 -0
- package/dist/components/chat-components/chat-panel.js +330 -0
- package/dist/components/chat-components/chat-panel.js.map +1 -0
- package/dist/components/chat-components/chat-scroll-anchor.js +65 -0
- package/dist/components/chat-components/chat-scroll-anchor.js.map +1 -0
- package/dist/components/chat-components/clear-history.js +323 -0
- package/dist/components/chat-components/clear-history.js.map +1 -0
- package/dist/components/chat-components/copilot-chat.js +876 -0
- package/dist/components/chat-components/copilot-chat.js.map +1 -0
- package/dist/components/chat-components/default-empty-screen.js +211 -0
- package/dist/components/chat-components/default-empty-screen.js.map +1 -0
- package/dist/components/chat-components/external-link.js +35 -0
- package/dist/components/chat-components/external-link.js.map +1 -0
- package/dist/components/chat-components/markdown.js +14 -0
- package/dist/components/chat-components/markdown.js.map +1 -0
- package/dist/components/chat-components/prompt-form.js +245 -0
- package/dist/components/chat-components/prompt-form.js.map +1 -0
- package/dist/components/chat-components/theme-toggle.js +158 -0
- package/dist/components/chat-components/theme-toggle.js.map +1 -0
- package/dist/components/chat-components/toaster.js +12 -0
- package/dist/components/chat-components/toaster.js.map +1 -0
- package/dist/components/chat-components/ui/alert-dialog.js +229 -0
- package/dist/components/chat-components/ui/alert-dialog.js.map +1 -0
- package/dist/components/chat-components/ui/badge.js +70 -0
- package/dist/components/chat-components/ui/badge.js.map +1 -0
- package/dist/components/chat-components/ui/button.js +105 -0
- package/dist/components/chat-components/ui/button.js.map +1 -0
- package/dist/components/chat-components/ui/codeblock.js +299 -0
- package/dist/components/chat-components/ui/codeblock.js.map +1 -0
- package/dist/components/chat-components/ui/dialog.js +198 -0
- package/dist/components/chat-components/ui/dialog.js.map +1 -0
- package/dist/components/chat-components/ui/dropdown-menu.js +153 -0
- package/dist/components/chat-components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/chat-components/ui/icons.js +567 -0
- package/dist/components/chat-components/ui/icons.js.map +1 -0
- package/dist/components/chat-components/ui/input.js +80 -0
- package/dist/components/chat-components/ui/input.js.map +1 -0
- package/dist/components/chat-components/ui/label.js +80 -0
- package/dist/components/chat-components/ui/label.js.map +1 -0
- package/dist/components/chat-components/ui/select.js +196 -0
- package/dist/components/chat-components/ui/select.js.map +1 -0
- package/dist/components/chat-components/ui/separator.js +84 -0
- package/dist/components/chat-components/ui/separator.js.map +1 -0
- package/dist/components/chat-components/ui/sheet.js +189 -0
- package/dist/components/chat-components/ui/sheet.js.map +1 -0
- package/dist/components/chat-components/ui/switch.js +88 -0
- package/dist/components/chat-components/ui/switch.js.map +1 -0
- package/dist/components/chat-components/ui/textarea.js +79 -0
- package/dist/components/chat-components/ui/textarea.js.map +1 -0
- package/dist/components/chat-components/ui/tooltip.js +86 -0
- package/dist/components/chat-components/ui/tooltip.js.map +1 -0
- package/dist/components/index.js +989 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/sidebar/copilot-sidebar-ui-provider.js +984 -0
- package/dist/components/sidebar/copilot-sidebar-ui-provider.js.map +1 -0
- package/dist/components/sidebar/copilot-sidebar.js +916 -0
- package/dist/components/sidebar/copilot-sidebar.js.map +1 -0
- package/dist/components/sidebar/sidebar-context.js +14 -0
- package/dist/components/sidebar/sidebar-context.js.map +1 -0
- package/dist/context/index.js +4 -0
- package/dist/context/index.js.map +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-at-bottom.js +44 -0
- package/dist/hooks/use-at-bottom.js.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.js +49 -0
- package/dist/hooks/use-copy-to-clipboard.js.map +1 -0
- package/dist/hooks/use-enter-submit.js +20 -0
- package/dist/hooks/use-enter-submit.js.map +1 -0
- package/dist/index.js +989 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -1
- package/dist/lib/utils.js +64 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/utils.test.js +10 -0
- package/dist/lib/utils.test.js.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/types.js +4 -0
- package/dist/types/types.js.map +1 -0
- package/package.json +4 -4
- package/tsup.config.ts +1 -1
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
5
|
+
var clsx = require('clsx');
|
|
6
|
+
var nanoid = require('nanoid');
|
|
7
|
+
var tailwindMerge = require('tailwind-merge');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
function _interopNamespaceDefault(e) {
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
28
|
+
var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DropdownMenuPrimitive);
|
|
29
|
+
|
|
30
|
+
var __defProp = Object.defineProperty;
|
|
31
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
32
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
33
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
34
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
35
|
+
var __spreadValues = (a, b) => {
|
|
36
|
+
for (var prop in b || (b = {}))
|
|
37
|
+
if (__hasOwnProp.call(b, prop))
|
|
38
|
+
__defNormalProp(a, prop, b[prop]);
|
|
39
|
+
if (__getOwnPropSymbols)
|
|
40
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
41
|
+
if (__propIsEnum.call(b, prop))
|
|
42
|
+
__defNormalProp(a, prop, b[prop]);
|
|
43
|
+
}
|
|
44
|
+
return a;
|
|
45
|
+
};
|
|
46
|
+
var __objRest = (source, exclude) => {
|
|
47
|
+
var target = {};
|
|
48
|
+
for (var prop in source)
|
|
49
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
50
|
+
target[prop] = source[prop];
|
|
51
|
+
if (source != null && __getOwnPropSymbols)
|
|
52
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
53
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
54
|
+
target[prop] = source[prop];
|
|
55
|
+
}
|
|
56
|
+
return target;
|
|
57
|
+
};
|
|
58
|
+
function cn(...inputs) {
|
|
59
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
60
|
+
}
|
|
61
|
+
nanoid.customAlphabet(
|
|
62
|
+
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
63
|
+
7
|
|
64
|
+
);
|
|
65
|
+
var DropdownMenu = DropdownMenuPrimitive__namespace.Root;
|
|
66
|
+
var DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
|
|
67
|
+
var DropdownMenuGroup = DropdownMenuPrimitive__namespace.Group;
|
|
68
|
+
var DropdownMenuPortal = DropdownMenuPrimitive__namespace.Portal;
|
|
69
|
+
var DropdownMenuSub = DropdownMenuPrimitive__namespace.Sub;
|
|
70
|
+
var DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
|
|
71
|
+
var DropdownMenuSubContent = React__namespace.forwardRef((_a, ref) => {
|
|
72
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
73
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.SubContent, __spreadValues({
|
|
74
|
+
ref,
|
|
75
|
+
className: cn(
|
|
76
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",
|
|
77
|
+
className
|
|
78
|
+
)
|
|
79
|
+
}, props));
|
|
80
|
+
});
|
|
81
|
+
DropdownMenuSubContent.displayName = DropdownMenuPrimitive__namespace.SubContent.displayName;
|
|
82
|
+
var DropdownMenuContent = React__namespace.forwardRef((_a, ref) => {
|
|
83
|
+
var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest(_b, ["className", "sideOffset"]);
|
|
84
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, {
|
|
85
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Content, __spreadValues({
|
|
86
|
+
ref,
|
|
87
|
+
sideOffset,
|
|
88
|
+
className: cn(
|
|
89
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow animate-in 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",
|
|
90
|
+
className
|
|
91
|
+
)
|
|
92
|
+
}, props))
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
|
|
96
|
+
var DropdownMenuItem = React__namespace.forwardRef((_a, ref) => {
|
|
97
|
+
var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
|
|
98
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Item, __spreadValues({
|
|
99
|
+
ref,
|
|
100
|
+
className: cn(
|
|
101
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
102
|
+
inset && "pl-8",
|
|
103
|
+
className
|
|
104
|
+
)
|
|
105
|
+
}, props));
|
|
106
|
+
});
|
|
107
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive__namespace.Item.displayName;
|
|
108
|
+
var DropdownMenuLabel = React__namespace.forwardRef((_a, ref) => {
|
|
109
|
+
var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
|
|
110
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Label, __spreadValues({
|
|
111
|
+
ref,
|
|
112
|
+
className: cn(
|
|
113
|
+
"px-2 py-1.5 text-sm font-semibold",
|
|
114
|
+
inset && "pl-8",
|
|
115
|
+
className
|
|
116
|
+
)
|
|
117
|
+
}, props));
|
|
118
|
+
});
|
|
119
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive__namespace.Label.displayName;
|
|
120
|
+
var DropdownMenuSeparator = React__namespace.forwardRef((_a, ref) => {
|
|
121
|
+
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
122
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Separator, __spreadValues({
|
|
123
|
+
ref,
|
|
124
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className)
|
|
125
|
+
}, props));
|
|
126
|
+
});
|
|
127
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive__namespace.Separator.displayName;
|
|
128
|
+
var DropdownMenuShortcut = (_a) => {
|
|
129
|
+
var _b = _a, {
|
|
130
|
+
className
|
|
131
|
+
} = _b, props = __objRest(_b, [
|
|
132
|
+
"className"
|
|
133
|
+
]);
|
|
134
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadValues({
|
|
135
|
+
className: cn("ml-auto text-xs tracking-widest opacity-60", className)
|
|
136
|
+
}, props));
|
|
137
|
+
};
|
|
138
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
139
|
+
|
|
140
|
+
exports.DropdownMenu = DropdownMenu;
|
|
141
|
+
exports.DropdownMenuContent = DropdownMenuContent;
|
|
142
|
+
exports.DropdownMenuGroup = DropdownMenuGroup;
|
|
143
|
+
exports.DropdownMenuItem = DropdownMenuItem;
|
|
144
|
+
exports.DropdownMenuLabel = DropdownMenuLabel;
|
|
145
|
+
exports.DropdownMenuPortal = DropdownMenuPortal;
|
|
146
|
+
exports.DropdownMenuRadioGroup = DropdownMenuRadioGroup;
|
|
147
|
+
exports.DropdownMenuSeparator = DropdownMenuSeparator;
|
|
148
|
+
exports.DropdownMenuShortcut = DropdownMenuShortcut;
|
|
149
|
+
exports.DropdownMenuSub = DropdownMenuSub;
|
|
150
|
+
exports.DropdownMenuSubContent = DropdownMenuSubContent;
|
|
151
|
+
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
152
|
+
//# sourceMappingURL=out.js.map
|
|
153
|
+
//# sourceMappingURL=dropdown-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/chat-components/ui/dropdown-menu.tsx","../../../../src/lib/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,YAAY,WAAW;AACvB,YAAY,2BAA2B;;;ACHvC,SAAS,YAA6B;AACtC,SAAS,sBAAsB;AAC/B,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;AAEO,IAAM,SAAS;AAAA,EACpB;AAAA,EACA;AACF;;;ADYE;AAvBF;AAOA,IAAM,eAAqC;AAE3C,IAAM,sBAA4C;AAElD,IAAM,oBAA0C;AAEhD,IAAM,qBAA2C;AAEjD,IAAM,kBAAwC;AAE9C,IAAM,yBAA+C;AAErD,IAAM,yBAA+B,iBAGnC,CAAC,IAAyB,QAAK;AAA9B,eAAE,YAtBL,IAsBG,IAAgB,kBAAhB,IAAgB,CAAd;AACH,6BAAuB,kCAAtB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,KACI,MACN;AAAA,CACD;AACD,uBAAuB,cACC,iCAAW;AAEnC,IAAM,sBAA4B,iBAGhC,CAAC,IAAyC,QAAK;AAA9C,eAAE,aAAW,aAAa,EAtC7B,IAsCG,IAAgC,kBAAhC,IAAgC,CAA9B,aAAW;AACd,6BAAuB,8BAAtB;AAAA,IACC,8BAAuB,+BAAtB;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,OACI,MACN;AAAA,GACF;AAAA,CACD;AACD,oBAAoB,cAAoC,8BAAQ;AAEhE,IAAM,mBAAyB,iBAK7B,CAAC,IAAgC,QAAK;AAArC,eAAE,aAAW,MA1DhB,IA0DG,IAAuB,kBAAvB,IAAuB,CAArB,aAAW;AACd,6BAAuB,4BAAtB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA,SAAS;AAAA,MACT;AAAA,IACF;AAAA,KACI,MACN;AAAA,CACD;AACD,iBAAiB,cAAoC,2BAAK;AAE1D,IAAM,oBAA0B,iBAK9B,CAAC,IAAgC,QAAK;AAArC,eAAE,aAAW,MA5EhB,IA4EG,IAAuB,kBAAvB,IAAuB,CAArB,aAAW;AACd,6BAAuB,6BAAtB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA,SAAS;AAAA,MACT;AAAA,IACF;AAAA,KACI,MACN;AAAA,CACD;AACD,kBAAkB,cAAoC,4BAAM;AAE5D,IAAM,wBAA8B,iBAGlC,CAAC,IAAyB,QAAK;AAA9B,eAAE,YA5FL,IA4FG,IAAgB,kBAAhB,IAAgB,CAAd;AACH,6BAAuB,iCAAtB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,4BAA4B,SAAS;AAAA,KAC/C,MACN;AAAA,CACD;AACD,sBAAsB,cAAoC,gCAAU;AAEpE,IAAM,uBAAuB,CAAC,OAGe;AAHf,eAC5B;AAAA;AAAA,EAtGF,IAqG8B,IAEzB,kBAFyB,IAEzB;AAAA,IADH;AAAA;AAGA,SACE,oBAAC;AAAA,IACC,WAAW,GAAG,8CAA8C,SAAS;AAAA,KACjE,MACN;AAEJ;AACA,qBAAqB,cAAc","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\n\nimport { cn } from \"../../../lib/utils\";\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\n\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\n\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\n\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\n\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\n\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow animate-in 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\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"px-2 py-1.5 text-sm font-semibold\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)}\n {...props}\n />\n );\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuRadioGroup,\n};\n","import { clsx, type ClassValue } from \"clsx\";\nimport { customAlphabet } from \"nanoid\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const nanoid = customAlphabet(\n \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\",\n 7\n); // 7-character random string\n\nexport async function fetcher<JSON = any>(\n input: RequestInfo,\n init?: RequestInit\n): Promise<JSON> {\n const res = await fetch(input, init);\n\n if (!res.ok) {\n const json = await res.json();\n if (json.error) {\n const error = new Error(json.error) as Error & {\n status: number;\n };\n error.status = res.status;\n throw error;\n } else {\n throw new Error(\"An unexpected error occurred\");\n }\n }\n\n return res.json();\n}\n\nexport function formatDate(input: string | number | Date): string {\n const date = new Date(input);\n return date.toLocaleDateString(\"en-US\", {\n month: \"long\",\n day: \"numeric\",\n year: \"numeric\",\n });\n}\n"]}
|