@particle-academy/react-fancy 5.9.0 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +44 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +44 -16
- package/dist/index.js.map +1 -1
- package/dist/styles.css +12 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6739,6 +6739,7 @@ var circularSizeMap = {
|
|
|
6739
6739
|
md: 48,
|
|
6740
6740
|
lg: 64
|
|
6741
6741
|
};
|
|
6742
|
+
var namedStrokeWidth = { sm: 3, md: 4, lg: 5 };
|
|
6742
6743
|
var textSizeClasses = {
|
|
6743
6744
|
sm: "text-[8px]",
|
|
6744
6745
|
md: "text-[10px]",
|
|
@@ -6750,15 +6751,18 @@ var Progress = react.forwardRef(
|
|
|
6750
6751
|
max = 100,
|
|
6751
6752
|
variant = "bar",
|
|
6752
6753
|
size = "md",
|
|
6754
|
+
strokeWidth: strokeWidthProp,
|
|
6753
6755
|
color = "blue",
|
|
6754
6756
|
indeterminate = false,
|
|
6755
6757
|
showValue = false,
|
|
6756
6758
|
className
|
|
6757
6759
|
}, ref) => {
|
|
6760
|
+
const named = typeof size === "number" ? "md" : size;
|
|
6758
6761
|
const percentage = Math.min(100, Math.max(0, value / max * 100));
|
|
6759
6762
|
if (variant === "circular") {
|
|
6760
|
-
const
|
|
6761
|
-
const
|
|
6763
|
+
const pixelSize = typeof size === "number" ? size : null;
|
|
6764
|
+
const diameter = pixelSize ?? circularSizeMap[named];
|
|
6765
|
+
const strokeWidth = strokeWidthProp ?? (pixelSize === null ? namedStrokeWidth[named] : Math.max(3, Math.round(diameter * 0.075)));
|
|
6762
6766
|
const radius = (diameter - strokeWidth) / 2;
|
|
6763
6767
|
const circumference = 2 * Math.PI * radius;
|
|
6764
6768
|
const offset = indeterminate ? circumference * 0.75 : circumference - percentage / 100 * circumference;
|
|
@@ -6771,14 +6775,19 @@ var Progress = react.forwardRef(
|
|
|
6771
6775
|
"aria-valuemin": 0,
|
|
6772
6776
|
"aria-valuemax": max,
|
|
6773
6777
|
"data-react-fancy-progress": "",
|
|
6774
|
-
|
|
6775
|
-
|
|
6778
|
+
"data-size": pixelSize === null ? named : void 0,
|
|
6779
|
+
className: cn(
|
|
6780
|
+
"relative inline-flex items-center justify-center",
|
|
6781
|
+
className
|
|
6782
|
+
),
|
|
6783
|
+
style: pixelSize === null ? void 0 : { width: pixelSize, height: pixelSize },
|
|
6776
6784
|
children: [
|
|
6777
6785
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
6778
6786
|
"svg",
|
|
6779
6787
|
{
|
|
6780
|
-
|
|
6781
|
-
|
|
6788
|
+
viewBox: `0 0 ${diameter} ${diameter}`,
|
|
6789
|
+
width: "100%",
|
|
6790
|
+
height: "100%",
|
|
6782
6791
|
className: cn(indeterminate && "animate-spin"),
|
|
6783
6792
|
children: [
|
|
6784
6793
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6816,7 +6825,7 @@ var Progress = react.forwardRef(
|
|
|
6816
6825
|
className: cn(
|
|
6817
6826
|
"absolute font-medium",
|
|
6818
6827
|
progressText[color],
|
|
6819
|
-
textSizeClasses[
|
|
6828
|
+
textSizeClasses[named]
|
|
6820
6829
|
),
|
|
6821
6830
|
children: [
|
|
6822
6831
|
Math.round(percentage),
|
|
@@ -6844,7 +6853,7 @@ var Progress = react.forwardRef(
|
|
|
6844
6853
|
{
|
|
6845
6854
|
className: cn(
|
|
6846
6855
|
"w-full overflow-hidden rounded-full bg-zinc-200 dark:bg-zinc-700",
|
|
6847
|
-
barHeightClasses[
|
|
6856
|
+
barHeightClasses[named]
|
|
6848
6857
|
),
|
|
6849
6858
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6850
6859
|
"div",
|
|
@@ -15273,6 +15282,7 @@ function PromptInput({
|
|
|
15273
15282
|
const [attachments, setAttachments] = react.useState([]);
|
|
15274
15283
|
const [picker, setPicker] = react.useState(null);
|
|
15275
15284
|
const taRef = react.useRef(null);
|
|
15285
|
+
const fileRef = react.useRef(null);
|
|
15276
15286
|
const [dragOver, setDragOver] = react.useState(false);
|
|
15277
15287
|
const colors = mentionColor ?? DEFAULT_MENTION_COLOR;
|
|
15278
15288
|
const tokens = react.useMemo(
|
|
@@ -15379,19 +15389,25 @@ function PromptInput({
|
|
|
15379
15389
|
submit();
|
|
15380
15390
|
}
|
|
15381
15391
|
};
|
|
15382
|
-
const
|
|
15383
|
-
|
|
15384
|
-
|
|
15385
|
-
const files = Array.from(e.dataTransfer.files);
|
|
15392
|
+
const attach = (list) => {
|
|
15393
|
+
const files = Array.from(list ?? []);
|
|
15394
|
+
if (files.length === 0) return;
|
|
15386
15395
|
setAttachments((cur) => [
|
|
15387
15396
|
...cur,
|
|
15388
15397
|
...files.map((f) => ({
|
|
15389
|
-
id:
|
|
15398
|
+
id: crypto.randomUUID(),
|
|
15390
15399
|
name: f.name,
|
|
15391
|
-
bytes: f.size
|
|
15400
|
+
bytes: f.size,
|
|
15401
|
+
file: f,
|
|
15402
|
+
type: f.type
|
|
15392
15403
|
}))
|
|
15393
15404
|
]);
|
|
15394
15405
|
};
|
|
15406
|
+
const onDrop = (e) => {
|
|
15407
|
+
e.preventDefault();
|
|
15408
|
+
setDragOver(false);
|
|
15409
|
+
attach(e.dataTransfer.files);
|
|
15410
|
+
};
|
|
15395
15411
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15396
15412
|
"div",
|
|
15397
15413
|
{
|
|
@@ -15500,11 +15516,23 @@ function PromptInput({
|
|
|
15500
15516
|
variant: "ghost",
|
|
15501
15517
|
size: "sm",
|
|
15502
15518
|
className: "shrink-0",
|
|
15503
|
-
onClick: () =>
|
|
15504
|
-
},
|
|
15519
|
+
onClick: () => fileRef.current?.click(),
|
|
15505
15520
|
children: "\u{1F4CE} attach"
|
|
15506
15521
|
}
|
|
15507
15522
|
) }),
|
|
15523
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15524
|
+
"input",
|
|
15525
|
+
{
|
|
15526
|
+
ref: fileRef,
|
|
15527
|
+
type: "file",
|
|
15528
|
+
multiple: true,
|
|
15529
|
+
className: "hidden",
|
|
15530
|
+
onChange: (e) => {
|
|
15531
|
+
attach(e.target.files);
|
|
15532
|
+
e.target.value = "";
|
|
15533
|
+
}
|
|
15534
|
+
}
|
|
15535
|
+
),
|
|
15508
15536
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-2 flex min-w-0 items-center gap-1.5 overflow-hidden", children: [
|
|
15509
15537
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-1.5 w-24 shrink overflow-hidden rounded-full bg-zinc-200 dark:bg-zinc-700", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
15510
15538
|
"div",
|