@rufous/ui 0.2.81 → 0.2.83
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/main.cjs +628 -735
- package/dist/main.d.cts +7 -1
- package/dist/main.d.ts +7 -1
- package/dist/main.js +633 -740
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -3870,7 +3870,7 @@ var RufousLogoLoader = ({ size = 80, sx, className }) => {
|
|
|
3870
3870
|
};
|
|
3871
3871
|
|
|
3872
3872
|
// lib/DataGrid/DataGrid.tsx
|
|
3873
|
-
import
|
|
3873
|
+
import React75, { useState as useState9, useMemo as useMemo2, useRef as useRef9, useEffect as useEffect9 } from "react";
|
|
3874
3874
|
import {
|
|
3875
3875
|
ChevronUp,
|
|
3876
3876
|
ChevronDown,
|
|
@@ -3889,6 +3889,238 @@ import {
|
|
|
3889
3889
|
Trash2,
|
|
3890
3890
|
Plus
|
|
3891
3891
|
} from "lucide-react";
|
|
3892
|
+
|
|
3893
|
+
// lib/Tooltip/Tooltip.tsx
|
|
3894
|
+
import React74, {
|
|
3895
|
+
useCallback as useCallback3,
|
|
3896
|
+
useEffect as useEffect8,
|
|
3897
|
+
useRef as useRef8,
|
|
3898
|
+
useState as useState8
|
|
3899
|
+
} from "react";
|
|
3900
|
+
import ReactDOM3 from "react-dom";
|
|
3901
|
+
var GAP = 8;
|
|
3902
|
+
function computePosition(anchor, tooltip, placement) {
|
|
3903
|
+
const { top: aTop, left: aLeft, width: aW, height: aH } = anchor;
|
|
3904
|
+
const { width: tW, height: tH } = tooltip;
|
|
3905
|
+
let top = 0;
|
|
3906
|
+
let left = 0;
|
|
3907
|
+
let arrowLeft;
|
|
3908
|
+
let arrowTop;
|
|
3909
|
+
switch (placement) {
|
|
3910
|
+
case "top":
|
|
3911
|
+
top = aTop - tH - GAP;
|
|
3912
|
+
left = aLeft + aW / 2 - tW / 2;
|
|
3913
|
+
arrowLeft = tW / 2 - 4;
|
|
3914
|
+
break;
|
|
3915
|
+
case "top-start":
|
|
3916
|
+
top = aTop - tH - GAP;
|
|
3917
|
+
left = aLeft;
|
|
3918
|
+
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
3919
|
+
break;
|
|
3920
|
+
case "top-end":
|
|
3921
|
+
top = aTop - tH - GAP;
|
|
3922
|
+
left = aLeft + aW - tW;
|
|
3923
|
+
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
3924
|
+
break;
|
|
3925
|
+
case "bottom":
|
|
3926
|
+
top = aTop + aH + GAP;
|
|
3927
|
+
left = aLeft + aW / 2 - tW / 2;
|
|
3928
|
+
arrowLeft = tW / 2 - 4;
|
|
3929
|
+
break;
|
|
3930
|
+
case "bottom-start":
|
|
3931
|
+
top = aTop + aH + GAP;
|
|
3932
|
+
left = aLeft;
|
|
3933
|
+
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
3934
|
+
break;
|
|
3935
|
+
case "bottom-end":
|
|
3936
|
+
top = aTop + aH + GAP;
|
|
3937
|
+
left = aLeft + aW - tW;
|
|
3938
|
+
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
3939
|
+
break;
|
|
3940
|
+
case "left":
|
|
3941
|
+
top = aTop + aH / 2 - tH / 2;
|
|
3942
|
+
left = aLeft - tW - GAP;
|
|
3943
|
+
arrowTop = tH / 2 - 4;
|
|
3944
|
+
break;
|
|
3945
|
+
case "left-start":
|
|
3946
|
+
top = aTop;
|
|
3947
|
+
left = aLeft - tW - GAP;
|
|
3948
|
+
arrowTop = Math.min(aH / 2, tH - 16);
|
|
3949
|
+
break;
|
|
3950
|
+
case "left-end":
|
|
3951
|
+
top = aTop + aH - tH;
|
|
3952
|
+
left = aLeft - tW - GAP;
|
|
3953
|
+
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
3954
|
+
break;
|
|
3955
|
+
case "right":
|
|
3956
|
+
top = aTop + aH / 2 - tH / 2;
|
|
3957
|
+
left = aLeft + aW + GAP;
|
|
3958
|
+
arrowTop = tH / 2 - 4;
|
|
3959
|
+
break;
|
|
3960
|
+
case "right-start":
|
|
3961
|
+
top = aTop;
|
|
3962
|
+
left = aLeft + aW + GAP;
|
|
3963
|
+
arrowTop = Math.min(aH / 2, tH - 16);
|
|
3964
|
+
break;
|
|
3965
|
+
case "right-end":
|
|
3966
|
+
top = aTop + aH - tH;
|
|
3967
|
+
left = aLeft + aW + GAP;
|
|
3968
|
+
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
3969
|
+
break;
|
|
3970
|
+
default:
|
|
3971
|
+
top = aTop - tH - GAP;
|
|
3972
|
+
left = aLeft + aW / 2 - tW / 2;
|
|
3973
|
+
}
|
|
3974
|
+
const vw = window.innerWidth;
|
|
3975
|
+
const vh = window.innerHeight;
|
|
3976
|
+
left = Math.max(8, Math.min(left, vw - tW - 8));
|
|
3977
|
+
top = Math.max(8, Math.min(top, vh - tH - 8));
|
|
3978
|
+
return { top, left, arrowLeft, arrowTop };
|
|
3979
|
+
}
|
|
3980
|
+
var Tooltip = ({
|
|
3981
|
+
title,
|
|
3982
|
+
placement = "top",
|
|
3983
|
+
arrow = false,
|
|
3984
|
+
open: controlledOpen,
|
|
3985
|
+
disableHoverListener = false,
|
|
3986
|
+
disableFocusListener = false,
|
|
3987
|
+
enterDelay = 100,
|
|
3988
|
+
leaveDelay = 0,
|
|
3989
|
+
children,
|
|
3990
|
+
followCursor = false,
|
|
3991
|
+
className = "",
|
|
3992
|
+
style,
|
|
3993
|
+
sx
|
|
3994
|
+
}) => {
|
|
3995
|
+
const sxClass = useSx(sx);
|
|
3996
|
+
const [internalOpen, setInternalOpen] = useState8(false);
|
|
3997
|
+
const [position, setPosition] = useState8({ top: 0, left: 0 });
|
|
3998
|
+
const anchorRef = useRef8(null);
|
|
3999
|
+
const tooltipRef = useRef8(null);
|
|
4000
|
+
const enterTimer = useRef8(null);
|
|
4001
|
+
const leaveTimer = useRef8(null);
|
|
4002
|
+
const cursorPos = useRef8({ x: 0, y: 0 });
|
|
4003
|
+
const isOpen = controlledOpen !== void 0 ? controlledOpen : internalOpen;
|
|
4004
|
+
const clearTimers = useCallback3(() => {
|
|
4005
|
+
if (enterTimer.current) clearTimeout(enterTimer.current);
|
|
4006
|
+
if (leaveTimer.current) clearTimeout(leaveTimer.current);
|
|
4007
|
+
}, []);
|
|
4008
|
+
const updatePosition = useCallback3(() => {
|
|
4009
|
+
if (!anchorRef.current || !tooltipRef.current) return;
|
|
4010
|
+
const anchorRect = anchorRef.current.getBoundingClientRect();
|
|
4011
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
4012
|
+
if (followCursor) {
|
|
4013
|
+
const fakeRect = {
|
|
4014
|
+
top: cursorPos.current.y,
|
|
4015
|
+
left: cursorPos.current.x,
|
|
4016
|
+
right: cursorPos.current.x,
|
|
4017
|
+
bottom: cursorPos.current.y,
|
|
4018
|
+
width: 0,
|
|
4019
|
+
height: 0,
|
|
4020
|
+
x: cursorPos.current.x,
|
|
4021
|
+
y: cursorPos.current.y,
|
|
4022
|
+
toJSON: () => ({})
|
|
4023
|
+
};
|
|
4024
|
+
setPosition(computePosition(fakeRect, tooltipRect, placement));
|
|
4025
|
+
} else {
|
|
4026
|
+
setPosition(computePosition(anchorRect, tooltipRect, placement));
|
|
4027
|
+
}
|
|
4028
|
+
}, [placement, followCursor]);
|
|
4029
|
+
useEffect8(() => {
|
|
4030
|
+
if (isOpen) {
|
|
4031
|
+
requestAnimationFrame(() => {
|
|
4032
|
+
updatePosition();
|
|
4033
|
+
});
|
|
4034
|
+
}
|
|
4035
|
+
}, [isOpen, updatePosition]);
|
|
4036
|
+
const handleOpen = useCallback3(() => {
|
|
4037
|
+
clearTimers();
|
|
4038
|
+
if (enterDelay > 0) {
|
|
4039
|
+
enterTimer.current = setTimeout(() => {
|
|
4040
|
+
setInternalOpen(true);
|
|
4041
|
+
}, enterDelay);
|
|
4042
|
+
} else {
|
|
4043
|
+
setInternalOpen(true);
|
|
4044
|
+
}
|
|
4045
|
+
}, [enterDelay, clearTimers]);
|
|
4046
|
+
const handleClose = useCallback3(() => {
|
|
4047
|
+
clearTimers();
|
|
4048
|
+
if (leaveDelay > 0) {
|
|
4049
|
+
leaveTimer.current = setTimeout(() => {
|
|
4050
|
+
setInternalOpen(false);
|
|
4051
|
+
}, leaveDelay);
|
|
4052
|
+
} else {
|
|
4053
|
+
setInternalOpen(false);
|
|
4054
|
+
}
|
|
4055
|
+
}, [leaveDelay, clearTimers]);
|
|
4056
|
+
const handleMouseMove = useCallback3(
|
|
4057
|
+
(e) => {
|
|
4058
|
+
cursorPos.current = { x: e.clientX, y: e.clientY };
|
|
4059
|
+
if (isOpen && followCursor) {
|
|
4060
|
+
updatePosition();
|
|
4061
|
+
}
|
|
4062
|
+
},
|
|
4063
|
+
[isOpen, followCursor, updatePosition]
|
|
4064
|
+
);
|
|
4065
|
+
useEffect8(() => {
|
|
4066
|
+
return () => clearTimers();
|
|
4067
|
+
}, [clearTimers]);
|
|
4068
|
+
const childProps = {};
|
|
4069
|
+
if (!disableHoverListener) {
|
|
4070
|
+
childProps.onMouseEnter = handleOpen;
|
|
4071
|
+
childProps.onMouseLeave = handleClose;
|
|
4072
|
+
childProps.onMouseMove = followCursor ? handleMouseMove : void 0;
|
|
4073
|
+
}
|
|
4074
|
+
if (!disableFocusListener) {
|
|
4075
|
+
childProps.onFocus = handleOpen;
|
|
4076
|
+
childProps.onBlur = handleClose;
|
|
4077
|
+
}
|
|
4078
|
+
const tooltipClasses = [
|
|
4079
|
+
"rf-tooltip",
|
|
4080
|
+
`rf-tooltip--placement-${placement}`,
|
|
4081
|
+
isOpen ? "rf-tooltip--visible" : "",
|
|
4082
|
+
sxClass,
|
|
4083
|
+
className
|
|
4084
|
+
].filter(Boolean).join(" ");
|
|
4085
|
+
const tooltipElement = /* @__PURE__ */ React74.createElement(
|
|
4086
|
+
"div",
|
|
4087
|
+
{
|
|
4088
|
+
ref: tooltipRef,
|
|
4089
|
+
className: tooltipClasses,
|
|
4090
|
+
style: {
|
|
4091
|
+
top: position.top,
|
|
4092
|
+
left: position.left,
|
|
4093
|
+
...style
|
|
4094
|
+
},
|
|
4095
|
+
role: "tooltip",
|
|
4096
|
+
"aria-hidden": !isOpen
|
|
4097
|
+
},
|
|
4098
|
+
title,
|
|
4099
|
+
arrow && /* @__PURE__ */ React74.createElement(
|
|
4100
|
+
"span",
|
|
4101
|
+
{
|
|
4102
|
+
className: "rf-tooltip__arrow",
|
|
4103
|
+
style: {
|
|
4104
|
+
...position.arrowLeft !== void 0 ? { left: position.arrowLeft } : {},
|
|
4105
|
+
...position.arrowTop !== void 0 ? { top: position.arrowTop } : {}
|
|
4106
|
+
}
|
|
4107
|
+
}
|
|
4108
|
+
)
|
|
4109
|
+
);
|
|
4110
|
+
return /* @__PURE__ */ React74.createElement(React74.Fragment, null, /* @__PURE__ */ React74.createElement(
|
|
4111
|
+
"span",
|
|
4112
|
+
{
|
|
4113
|
+
ref: anchorRef,
|
|
4114
|
+
style: { display: "inline-flex", position: "relative" },
|
|
4115
|
+
"aria-describedby": isOpen ? "rf-tooltip" : void 0,
|
|
4116
|
+
...childProps
|
|
4117
|
+
},
|
|
4118
|
+
React74.cloneElement(children)
|
|
4119
|
+
), ReactDOM3.createPortal(tooltipElement, document.body));
|
|
4120
|
+
};
|
|
4121
|
+
Tooltip.displayName = "Tooltip";
|
|
4122
|
+
|
|
4123
|
+
// lib/DataGrid/DataGrid.tsx
|
|
3892
4124
|
var getOperatorsForType = (type) => {
|
|
3893
4125
|
if (type === "date") return [
|
|
3894
4126
|
{ value: "is", label: "is" },
|
|
@@ -3941,10 +4173,12 @@ function DataGrid({
|
|
|
3941
4173
|
pageSizeOptions = [5, 10, 25, 50],
|
|
3942
4174
|
title,
|
|
3943
4175
|
className,
|
|
3944
|
-
sx
|
|
4176
|
+
sx,
|
|
4177
|
+
onRowDoubleClick,
|
|
4178
|
+
onCellDoubleClick
|
|
3945
4179
|
}) {
|
|
3946
4180
|
const sxClass = useSx(sx);
|
|
3947
|
-
const [columnOverrides, setColumnOverrides] =
|
|
4181
|
+
const [columnOverrides, setColumnOverrides] = useState9({});
|
|
3948
4182
|
const resolvedColumns = useMemo2(() => {
|
|
3949
4183
|
return initialColumnsProp.map((col) => {
|
|
3950
4184
|
const field = String(col.field || col.key || "");
|
|
@@ -3958,7 +4192,7 @@ function DataGrid({
|
|
|
3958
4192
|
};
|
|
3959
4193
|
});
|
|
3960
4194
|
}, [initialColumnsProp, columnOverrides]);
|
|
3961
|
-
const [columnWidths, setColumnWidths] =
|
|
4195
|
+
const [columnWidths, setColumnWidths] = useState9(() => {
|
|
3962
4196
|
const widths = {};
|
|
3963
4197
|
initialColumnsProp.forEach((col) => {
|
|
3964
4198
|
const field = String(col.field || col.key || "");
|
|
@@ -3967,26 +4201,26 @@ function DataGrid({
|
|
|
3967
4201
|
});
|
|
3968
4202
|
return widths;
|
|
3969
4203
|
});
|
|
3970
|
-
const [pageSize, setPageSize] =
|
|
3971
|
-
const [sortField, setSortField] =
|
|
3972
|
-
const [sortDirection, setSortDirection] =
|
|
3973
|
-
const [filterText, setFilterText] =
|
|
3974
|
-
const [currentPage, setCurrentPage] =
|
|
3975
|
-
const [columnFilters, setColumnFilters] =
|
|
3976
|
-
const [resizingColumn, setResizingColumn] =
|
|
3977
|
-
const [startX, setStartX] =
|
|
3978
|
-
const [startWidth, setStartWidth] =
|
|
3979
|
-
const [activeMenu, setActiveMenu] =
|
|
3980
|
-
const [menuPosition, setMenuPosition] =
|
|
3981
|
-
const menuRef =
|
|
3982
|
-
const [showManageColumns, setShowManageColumns] =
|
|
3983
|
-
const [showAdvancedFilter, setShowAdvancedFilter] =
|
|
4204
|
+
const [pageSize, setPageSize] = useState9(initialPageSize);
|
|
4205
|
+
const [sortField, setSortField] = useState9(null);
|
|
4206
|
+
const [sortDirection, setSortDirection] = useState9(null);
|
|
4207
|
+
const [filterText, setFilterText] = useState9("");
|
|
4208
|
+
const [currentPage, setCurrentPage] = useState9(1);
|
|
4209
|
+
const [columnFilters, setColumnFilters] = useState9({});
|
|
4210
|
+
const [resizingColumn, setResizingColumn] = useState9(null);
|
|
4211
|
+
const [startX, setStartX] = useState9(0);
|
|
4212
|
+
const [startWidth, setStartWidth] = useState9(0);
|
|
4213
|
+
const [activeMenu, setActiveMenu] = useState9(null);
|
|
4214
|
+
const [menuPosition, setMenuPosition] = useState9({ top: 0, left: 0 });
|
|
4215
|
+
const menuRef = useRef9(null);
|
|
4216
|
+
const [showManageColumns, setShowManageColumns] = useState9(false);
|
|
4217
|
+
const [showAdvancedFilter, setShowAdvancedFilter] = useState9(false);
|
|
3984
4218
|
const initialFilterCol = String(initialColumnsProp[0]?.field || initialColumnsProp[0]?.key || "");
|
|
3985
|
-
const [advancedFilters, setAdvancedFilters] =
|
|
4219
|
+
const [advancedFilters, setAdvancedFilters] = useState9([
|
|
3986
4220
|
{ column: initialFilterCol, operator: getDefaultOperator(initialColumnsProp[0]?.type), value: "", logic: "AND" }
|
|
3987
4221
|
]);
|
|
3988
|
-
const [colSearch, setColSearch] =
|
|
3989
|
-
|
|
4222
|
+
const [colSearch, setColSearch] = useState9("");
|
|
4223
|
+
useEffect9(() => {
|
|
3990
4224
|
const handleMouseMove = (e) => {
|
|
3991
4225
|
if (!resizingColumn) return;
|
|
3992
4226
|
const col = resolvedColumns.find((c) => String(c.field) === resizingColumn);
|
|
@@ -4006,7 +4240,7 @@ function DataGrid({
|
|
|
4006
4240
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
4007
4241
|
};
|
|
4008
4242
|
}, [resizingColumn, startX, startWidth, resolvedColumns]);
|
|
4009
|
-
|
|
4243
|
+
useEffect9(() => {
|
|
4010
4244
|
const handleClickOutside = (e) => {
|
|
4011
4245
|
if (menuRef.current && !menuRef.current.contains(e.target)) {
|
|
4012
4246
|
setActiveMenu(null);
|
|
@@ -4015,7 +4249,7 @@ function DataGrid({
|
|
|
4015
4249
|
document.addEventListener("mousedown", handleClickOutside);
|
|
4016
4250
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
4017
4251
|
}, []);
|
|
4018
|
-
|
|
4252
|
+
useEffect9(() => {
|
|
4019
4253
|
setColumnWidths((prev) => {
|
|
4020
4254
|
const next = { ...prev };
|
|
4021
4255
|
initialColumnsProp.forEach((col) => {
|
|
@@ -4252,7 +4486,7 @@ function DataGrid({
|
|
|
4252
4486
|
return offset2;
|
|
4253
4487
|
};
|
|
4254
4488
|
const hasActiveFilters = advancedFilters.some((f) => f.value);
|
|
4255
|
-
return /* @__PURE__ */
|
|
4489
|
+
return /* @__PURE__ */ React75.createElement("div", { className: ["dg-root", sxClass, className].filter(Boolean).join(" ") }, /* @__PURE__ */ React75.createElement("div", { className: "dg-header" }, /* @__PURE__ */ React75.createElement("div", { className: "dg-header-info" }, /* @__PURE__ */ React75.createElement("h2", null, title), /* @__PURE__ */ React75.createElement("p", null, filteredData.length, " total records")), /* @__PURE__ */ React75.createElement("div", { className: "dg-header-actions" }, /* @__PURE__ */ React75.createElement("div", { className: "dg-search-wrap" }, /* @__PURE__ */ React75.createElement(Search, { size: 15 }), /* @__PURE__ */ React75.createElement(
|
|
4256
4490
|
"input",
|
|
4257
4491
|
{
|
|
4258
4492
|
className: "dg-search",
|
|
@@ -4263,52 +4497,50 @@ function DataGrid({
|
|
|
4263
4497
|
setCurrentPage(1);
|
|
4264
4498
|
}
|
|
4265
4499
|
}
|
|
4266
|
-
)), /* @__PURE__ */
|
|
4500
|
+
)), /* @__PURE__ */ React75.createElement(Tooltip, { title: "Filters", placement: "top" }, /* @__PURE__ */ React75.createElement(
|
|
4267
4501
|
"button",
|
|
4268
4502
|
{
|
|
4269
4503
|
className: `dg-icon-btn ${hasActiveFilters ? "active" : ""}`,
|
|
4270
|
-
onClick: () => setShowAdvancedFilter(true)
|
|
4271
|
-
title: "Filters"
|
|
4504
|
+
onClick: () => setShowAdvancedFilter(true)
|
|
4272
4505
|
},
|
|
4273
|
-
/* @__PURE__ */
|
|
4274
|
-
), /* @__PURE__ */
|
|
4506
|
+
/* @__PURE__ */ React75.createElement(Filter, { size: 16 })
|
|
4507
|
+
)), /* @__PURE__ */ React75.createElement(Tooltip, { title: "Manage Columns", placement: "top" }, /* @__PURE__ */ React75.createElement(
|
|
4275
4508
|
"button",
|
|
4276
4509
|
{
|
|
4277
4510
|
className: "dg-icon-btn",
|
|
4278
|
-
onClick: () => setShowManageColumns(true)
|
|
4279
|
-
title: "Manage Columns"
|
|
4511
|
+
onClick: () => setShowManageColumns(true)
|
|
4280
4512
|
},
|
|
4281
|
-
/* @__PURE__ */
|
|
4282
|
-
), /* @__PURE__ */
|
|
4513
|
+
/* @__PURE__ */ React75.createElement(Columns, { size: 16 })
|
|
4514
|
+
)), /* @__PURE__ */ React75.createElement("button", { className: "dg-action-btn", onClick: handleExport }, /* @__PURE__ */ React75.createElement(Download, { size: 14 }), " Export CSV"))), /* @__PURE__ */ React75.createElement("div", { className: "dg-table-wrap" }, /* @__PURE__ */ React75.createElement("table", { className: "dg-table" }, /* @__PURE__ */ React75.createElement("thead", null, /* @__PURE__ */ React75.createElement("tr", null, visibleColumns.map((col, idx) => {
|
|
4283
4515
|
const colField = String(col.field);
|
|
4284
4516
|
const width = columnWidths[colField] || 200;
|
|
4285
4517
|
const leftOffset = getLeftOffset(col, idx);
|
|
4286
4518
|
const rightOffset = getRightOffset(col, idx);
|
|
4287
4519
|
const isSorted = sortField === col.field;
|
|
4288
|
-
return /* @__PURE__ */
|
|
4520
|
+
return /* @__PURE__ */ React75.createElement(
|
|
4289
4521
|
"th",
|
|
4290
4522
|
{
|
|
4291
4523
|
key: colField,
|
|
4292
4524
|
className: `dg-thead-cell${col.pinned === "left" ? " pinned-left" : col.pinned === "right" ? " pinned-right" : ""} ${col.headerClassName || ""}`,
|
|
4293
4525
|
style: { width, minWidth: width, left: leftOffset, right: rightOffset, flex: col.flex }
|
|
4294
4526
|
},
|
|
4295
|
-
/* @__PURE__ */
|
|
4527
|
+
/* @__PURE__ */ React75.createElement("div", { className: "dg-th-inner" }, /* @__PURE__ */ React75.createElement(
|
|
4296
4528
|
"div",
|
|
4297
4529
|
{
|
|
4298
4530
|
className: `dg-th-label${col.sortable === false ? " no-sort" : ""}`,
|
|
4299
4531
|
onClick: () => col.sortable !== false && handleSort(col.field || "")
|
|
4300
4532
|
},
|
|
4301
4533
|
col.headerName,
|
|
4302
|
-
isSorted && sortDirection === "asc" && /* @__PURE__ */
|
|
4303
|
-
isSorted && sortDirection === "desc" && /* @__PURE__ */
|
|
4304
|
-
), /* @__PURE__ */
|
|
4534
|
+
isSorted && sortDirection === "asc" && /* @__PURE__ */ React75.createElement(ChevronUp, { size: 12 }),
|
|
4535
|
+
isSorted && sortDirection === "desc" && /* @__PURE__ */ React75.createElement(ChevronDown, { size: 12 })
|
|
4536
|
+
), /* @__PURE__ */ React75.createElement("div", { className: "dg-th-actions" }, !col.disableColumnMenu && /* @__PURE__ */ React75.createElement(
|
|
4305
4537
|
"button",
|
|
4306
4538
|
{
|
|
4307
4539
|
className: "dg-th-menu-btn",
|
|
4308
4540
|
onClick: (e) => handleMenuOpen(e, colField)
|
|
4309
4541
|
},
|
|
4310
|
-
/* @__PURE__ */
|
|
4311
|
-
), /* @__PURE__ */
|
|
4542
|
+
/* @__PURE__ */ React75.createElement(MoreVertical, { size: 13 })
|
|
4543
|
+
), /* @__PURE__ */ React75.createElement(
|
|
4312
4544
|
"div",
|
|
4313
4545
|
{
|
|
4314
4546
|
className: `dg-resizer${resizingColumn === colField ? " resizing" : ""}`,
|
|
@@ -4321,17 +4553,18 @@ function DataGrid({
|
|
|
4321
4553
|
}
|
|
4322
4554
|
)))
|
|
4323
4555
|
);
|
|
4324
|
-
}), actions && /* @__PURE__ */
|
|
4556
|
+
}), actions && /* @__PURE__ */ React75.createElement("th", { style: { width: 0, padding: 0 } }))), /* @__PURE__ */ React75.createElement("tbody", null, paginatedData.length === 0 ? /* @__PURE__ */ React75.createElement("tr", null, /* @__PURE__ */ React75.createElement("td", { colSpan: visibleColumns.length + (actions ? 1 : 0), className: "dg-empty" }, "No records found")) : paginatedData.map((item) => /* @__PURE__ */ React75.createElement("tr", { key: item.id, className: "dg-tbody-row", onDoubleClick: () => onRowDoubleClick?.(item) }, visibleColumns.map((col, idx) => {
|
|
4325
4557
|
const colField = String(col.field);
|
|
4326
4558
|
const width = columnWidths[colField] || 200;
|
|
4327
4559
|
const leftOffset = getLeftOffset(col, idx);
|
|
4328
4560
|
const rightOffset = getRightOffset(col, idx);
|
|
4329
|
-
return /* @__PURE__ */
|
|
4561
|
+
return /* @__PURE__ */ React75.createElement(
|
|
4330
4562
|
"td",
|
|
4331
4563
|
{
|
|
4332
4564
|
key: `${item.id}-${colField}`,
|
|
4333
4565
|
className: `dg-td${col.pinned === "left" ? " pinned-left" : col.pinned === "right" ? " pinned-right" : ""} ${col.cellClassName || ""}`,
|
|
4334
|
-
style: { width, minWidth: width, maxWidth: width, left: leftOffset, right: rightOffset, flex: col.flex }
|
|
4566
|
+
style: { width, minWidth: width, maxWidth: width, left: leftOffset, right: rightOffset, flex: col.flex },
|
|
4567
|
+
onDoubleClick: () => onCellDoubleClick?.({ row: item, field: colField, value: item[col.field || ""] })
|
|
4335
4568
|
},
|
|
4336
4569
|
(() => {
|
|
4337
4570
|
const field = String(col.field);
|
|
@@ -4347,22 +4580,20 @@ function DataGrid({
|
|
|
4347
4580
|
return String(formattedValue ?? "");
|
|
4348
4581
|
})()
|
|
4349
4582
|
);
|
|
4350
|
-
}), actions && /* @__PURE__ */
|
|
4583
|
+
}), actions && /* @__PURE__ */ React75.createElement("td", { className: "dg-row-actions-cell" }, (() => {
|
|
4351
4584
|
const resolvedActions = typeof actions === "function" ? actions(item) : actions;
|
|
4352
4585
|
const visibleActions = resolvedActions.filter((a) => !a.show || a.show(item));
|
|
4353
4586
|
if (visibleActions.length === 0) return null;
|
|
4354
|
-
return /* @__PURE__ */
|
|
4587
|
+
return /* @__PURE__ */ React75.createElement("div", { className: "dg-row-actions" }, /* @__PURE__ */ React75.createElement("div", { className: "dg-action-group" }, visibleActions.map((action, i) => /* @__PURE__ */ React75.createElement(Tooltip, { key: i, title: action.label, placement: "top" }, /* @__PURE__ */ React75.createElement(
|
|
4355
4588
|
"button",
|
|
4356
4589
|
{
|
|
4357
|
-
key: i,
|
|
4358
4590
|
className: "dg-row-action-btn",
|
|
4359
4591
|
style: { color: action.color || "var(--text-secondary)" },
|
|
4360
|
-
onClick: () => action.onClick(item)
|
|
4361
|
-
title: action.label
|
|
4592
|
+
onClick: () => action.onClick(item)
|
|
4362
4593
|
},
|
|
4363
4594
|
action.icon
|
|
4364
|
-
))));
|
|
4365
|
-
})())))))), /* @__PURE__ */
|
|
4595
|
+
)))));
|
|
4596
|
+
})())))))), /* @__PURE__ */ React75.createElement("div", { className: "dg-pagination" }, /* @__PURE__ */ React75.createElement("div", { className: "dg-page-info" }, /* @__PURE__ */ React75.createElement("div", { className: "dg-per-page" }, /* @__PURE__ */ React75.createElement("span", null, "Rows per page:"), /* @__PURE__ */ React75.createElement(
|
|
4366
4597
|
"select",
|
|
4367
4598
|
{
|
|
4368
4599
|
value: pageSize,
|
|
@@ -4371,8 +4602,8 @@ function DataGrid({
|
|
|
4371
4602
|
setCurrentPage(1);
|
|
4372
4603
|
}
|
|
4373
4604
|
},
|
|
4374
|
-
pageSizeOptions.map((o) => /* @__PURE__ */
|
|
4375
|
-
)), /* @__PURE__ */
|
|
4605
|
+
pageSizeOptions.map((o) => /* @__PURE__ */ React75.createElement("option", { key: o, value: o }, o))
|
|
4606
|
+
)), /* @__PURE__ */ React75.createElement("span", null, (currentPage - 1) * pageSize + 1, "\u2013", Math.min(currentPage * pageSize, filteredData.length), " of ", filteredData.length)), /* @__PURE__ */ React75.createElement("div", { className: "dg-page-nav" }, /* @__PURE__ */ React75.createElement("button", { className: "dg-page-btn", disabled: currentPage === 1, onClick: () => setCurrentPage((p) => p - 1) }, /* @__PURE__ */ React75.createElement(ChevronLeft, { size: 15 })), /* @__PURE__ */ React75.createElement("span", { className: "dg-page-fraction" }, currentPage, " / ", totalPages), /* @__PURE__ */ React75.createElement("button", { className: "dg-page-btn", disabled: currentPage === totalPages, onClick: () => setCurrentPage((p) => p + 1) }, /* @__PURE__ */ React75.createElement(ChevronRight, { size: 15 })))), activeMenu && /* @__PURE__ */ React75.createElement(
|
|
4376
4607
|
"div",
|
|
4377
4608
|
{
|
|
4378
4609
|
ref: menuRef,
|
|
@@ -4383,25 +4614,25 @@ function DataGrid({
|
|
|
4383
4614
|
...menuPosition.right !== void 0 ? { right: menuPosition.right } : {}
|
|
4384
4615
|
}
|
|
4385
4616
|
},
|
|
4386
|
-
/* @__PURE__ */
|
|
4387
|
-
/* @__PURE__ */
|
|
4388
|
-
/* @__PURE__ */
|
|
4617
|
+
/* @__PURE__ */ React75.createElement("button", { className: "dg-menu-item", onClick: () => handleSort(activeMenu, "asc") }, /* @__PURE__ */ React75.createElement(ArrowUp, { size: 14 }), " Sort ascending"),
|
|
4618
|
+
/* @__PURE__ */ React75.createElement("button", { className: "dg-menu-item", onClick: () => handleSort(activeMenu, "desc") }, /* @__PURE__ */ React75.createElement(ArrowDown, { size: 14 }), " Sort descending"),
|
|
4619
|
+
/* @__PURE__ */ React75.createElement("div", { className: "dg-menu-divider" }),
|
|
4389
4620
|
(() => {
|
|
4390
4621
|
const col = resolvedColumns.find((c) => c.field === activeMenu);
|
|
4391
4622
|
if (!col) return null;
|
|
4392
|
-
return /* @__PURE__ */
|
|
4623
|
+
return /* @__PURE__ */ React75.createElement(React75.Fragment, null, col.pinned === "left" ? /* @__PURE__ */ React75.createElement("button", { className: "dg-menu-item", onClick: () => togglePin(activeMenu, "left") }, /* @__PURE__ */ React75.createElement(Pin, { size: 14, style: { transform: "rotate(0deg)", opacity: 0.5 } }), " Unpin") : /* @__PURE__ */ React75.createElement("button", { className: "dg-menu-item", onClick: () => togglePin(activeMenu, "left") }, /* @__PURE__ */ React75.createElement(Pin, { size: 14, style: { transform: "rotate(45deg)" } }), " Pin left"), col.pinned === "right" ? /* @__PURE__ */ React75.createElement("button", { className: "dg-menu-item", onClick: () => togglePin(activeMenu, "right") }, /* @__PURE__ */ React75.createElement(Pin, { size: 14, style: { transform: "rotate(0deg)", opacity: 0.5 } }), " Unpin") : /* @__PURE__ */ React75.createElement("button", { className: "dg-menu-item", onClick: () => togglePin(activeMenu, "right") }, /* @__PURE__ */ React75.createElement(Pin, { size: 14, style: { transform: "rotate(-45deg)" } }), " Pin right"));
|
|
4393
4624
|
})(),
|
|
4394
|
-
/* @__PURE__ */
|
|
4395
|
-
/* @__PURE__ */
|
|
4625
|
+
/* @__PURE__ */ React75.createElement("div", { className: "dg-menu-divider" }),
|
|
4626
|
+
/* @__PURE__ */ React75.createElement("button", { className: "dg-menu-item", onClick: () => {
|
|
4396
4627
|
setShowAdvancedFilter(true);
|
|
4397
4628
|
setActiveMenu(null);
|
|
4398
|
-
} }, /* @__PURE__ */
|
|
4399
|
-
/* @__PURE__ */
|
|
4400
|
-
/* @__PURE__ */
|
|
4629
|
+
} }, /* @__PURE__ */ React75.createElement(Filter, { size: 14 }), " Filter\u2026"),
|
|
4630
|
+
/* @__PURE__ */ React75.createElement("button", { className: "dg-menu-item", onClick: () => toggleHide(activeMenu) }, /* @__PURE__ */ React75.createElement(EyeOff, { size: 14 }), " Hide column"),
|
|
4631
|
+
/* @__PURE__ */ React75.createElement("button", { className: "dg-menu-item", onClick: () => {
|
|
4401
4632
|
setShowManageColumns(true);
|
|
4402
4633
|
setActiveMenu(null);
|
|
4403
|
-
} }, /* @__PURE__ */
|
|
4404
|
-
), showManageColumns && /* @__PURE__ */
|
|
4634
|
+
} }, /* @__PURE__ */ React75.createElement(Columns, { size: 14 }), " Manage columns")
|
|
4635
|
+
), showManageColumns && /* @__PURE__ */ React75.createElement("div", { className: "dg-modal-overlay", onClick: () => setShowManageColumns(false) }, /* @__PURE__ */ React75.createElement("div", { className: "dg-modal", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React75.createElement("div", { className: "dg-modal-header" }, /* @__PURE__ */ React75.createElement("h3", null, "Manage Columns"), /* @__PURE__ */ React75.createElement("button", { className: "dg-icon-btn", onClick: () => setShowManageColumns(false) }, /* @__PURE__ */ React75.createElement(X2, { size: 18 }))), /* @__PURE__ */ React75.createElement("div", { className: "dg-modal-body" }, /* @__PURE__ */ React75.createElement("div", { className: "dg-search-wrap", style: { marginBottom: 8 } }, /* @__PURE__ */ React75.createElement(Search, { size: 14 }), /* @__PURE__ */ React75.createElement(
|
|
4405
4636
|
"input",
|
|
4406
4637
|
{
|
|
4407
4638
|
className: "dg-search",
|
|
@@ -4413,15 +4644,15 @@ function DataGrid({
|
|
|
4413
4644
|
)), resolvedColumns.filter((c) => c.header.toLowerCase().includes(colSearch.toLowerCase())).map((col) => {
|
|
4414
4645
|
const key = String(col.key);
|
|
4415
4646
|
const isUnhideable = col.hideable === false;
|
|
4416
|
-
return /* @__PURE__ */
|
|
4417
|
-
})), /* @__PURE__ */
|
|
4647
|
+
return /* @__PURE__ */ React75.createElement("div", { key, className: `dg-col-row${isUnhideable ? " disabled" : ""}` }, /* @__PURE__ */ React75.createElement("div", { className: "dg-col-label" }, /* @__PURE__ */ React75.createElement("div", { className: "dg-col-dot", style: { background: col.hidden ? "var(--border-color)" : "var(--primary-color)" } }), col.header), !isUnhideable && /* @__PURE__ */ React75.createElement("button", { className: "dg-icon-btn", onClick: () => toggleHide(key) }, col.hidden ? /* @__PURE__ */ React75.createElement(EyeOff, { size: 14 }) : /* @__PURE__ */ React75.createElement(EyeOff, { size: 14, style: { opacity: 0.4 } })));
|
|
4648
|
+
})), /* @__PURE__ */ React75.createElement("div", { className: "dg-modal-footer" }, /* @__PURE__ */ React75.createElement("button", { className: "dg-action-btn", onClick: () => setColumnOverrides((prev) => {
|
|
4418
4649
|
const next = { ...prev };
|
|
4419
4650
|
resolvedColumns.forEach((c) => {
|
|
4420
4651
|
const k = String(c.key);
|
|
4421
4652
|
next[k] = { ...next[k], hidden: false };
|
|
4422
4653
|
});
|
|
4423
4654
|
return next;
|
|
4424
|
-
}) }, "Show All"), /* @__PURE__ */
|
|
4655
|
+
}) }, "Show All"), /* @__PURE__ */ React75.createElement("button", { className: "dg-action-btn", onClick: () => {
|
|
4425
4656
|
const newOverrides = { ...columnOverrides };
|
|
4426
4657
|
resolvedColumns.forEach((c) => {
|
|
4427
4658
|
if (c.hideable !== false) {
|
|
@@ -4430,21 +4661,21 @@ function DataGrid({
|
|
|
4430
4661
|
}
|
|
4431
4662
|
});
|
|
4432
4663
|
setColumnOverrides(newOverrides);
|
|
4433
|
-
} }, "Hide All")))), showAdvancedFilter && /* @__PURE__ */
|
|
4664
|
+
} }, "Hide All")))), showAdvancedFilter && /* @__PURE__ */ React75.createElement("div", { className: "dg-modal-overlay", onClick: () => setShowAdvancedFilter(false) }, /* @__PURE__ */ React75.createElement("div", { className: "dg-modal dg-modal-wide dg-filter-modal", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React75.createElement("div", { className: "dg-modal-header" }, /* @__PURE__ */ React75.createElement("h3", null, "Filters"), /* @__PURE__ */ React75.createElement("button", { className: "dg-icon-btn", onClick: () => setShowAdvancedFilter(false) }, /* @__PURE__ */ React75.createElement(X2, { size: 18 }))), /* @__PURE__ */ React75.createElement("div", { className: "dg-modal-body" }, advancedFilters.map((f, idx) => /* @__PURE__ */ React75.createElement("div", { key: idx }, idx > 0 && /* @__PURE__ */ React75.createElement("div", { className: "dg-filter-logic" }, /* @__PURE__ */ React75.createElement(
|
|
4434
4665
|
"button",
|
|
4435
4666
|
{
|
|
4436
4667
|
className: `dg-logic-btn${f.logic === "AND" ? " active" : ""}`,
|
|
4437
4668
|
onClick: () => setAdvancedFilters((p) => p.map((fi, i) => i === idx ? { ...fi, logic: "AND" } : fi))
|
|
4438
4669
|
},
|
|
4439
4670
|
"AND"
|
|
4440
|
-
), /* @__PURE__ */
|
|
4671
|
+
), /* @__PURE__ */ React75.createElement(
|
|
4441
4672
|
"button",
|
|
4442
4673
|
{
|
|
4443
4674
|
className: `dg-logic-btn${f.logic === "OR" ? " active" : ""}`,
|
|
4444
4675
|
onClick: () => setAdvancedFilters((p) => p.map((fi, i) => i === idx ? { ...fi, logic: "OR" } : fi))
|
|
4445
4676
|
},
|
|
4446
4677
|
"OR"
|
|
4447
|
-
)), /* @__PURE__ */
|
|
4678
|
+
)), /* @__PURE__ */ React75.createElement("div", { className: "dg-filter-row" }, advancedFilters.length > 1 && /* @__PURE__ */ React75.createElement("button", { className: "dg-icon-btn", onClick: () => setAdvancedFilters((p) => p.filter((_, i) => i !== idx)) }, /* @__PURE__ */ React75.createElement(X2, { size: 14 })), /* @__PURE__ */ React75.createElement(
|
|
4448
4679
|
"select",
|
|
4449
4680
|
{
|
|
4450
4681
|
className: "dg-filter-select",
|
|
@@ -4456,20 +4687,20 @@ function DataGrid({
|
|
|
4456
4687
|
setAdvancedFilters((p) => p.map((fi, i) => i === idx ? { ...fi, column: newColKey, operator: defaultOp, value: "" } : fi));
|
|
4457
4688
|
}
|
|
4458
4689
|
},
|
|
4459
|
-
resolvedColumns.map((c) => /* @__PURE__ */
|
|
4690
|
+
resolvedColumns.map((c) => /* @__PURE__ */ React75.createElement("option", { key: String(c.key), value: String(c.key) }, c.header))
|
|
4460
4691
|
), (() => {
|
|
4461
4692
|
const col = resolvedColumns.find((c) => String(c.key) === f.column);
|
|
4462
4693
|
const operators = getOperatorsForType(col?.type);
|
|
4463
4694
|
const hideValue = f.operator === "is empty" || f.operator === "is not empty";
|
|
4464
|
-
return /* @__PURE__ */
|
|
4695
|
+
return /* @__PURE__ */ React75.createElement(React75.Fragment, null, /* @__PURE__ */ React75.createElement(
|
|
4465
4696
|
"select",
|
|
4466
4697
|
{
|
|
4467
4698
|
className: "dg-filter-select dg-filter-select-sm",
|
|
4468
4699
|
value: f.operator,
|
|
4469
4700
|
onChange: (e) => setAdvancedFilters((p) => p.map((fi, i) => i === idx ? { ...fi, operator: e.target.value, value: "" } : fi))
|
|
4470
4701
|
},
|
|
4471
|
-
operators.map((op) => /* @__PURE__ */
|
|
4472
|
-
), !hideValue && col?.type === "date" && /* @__PURE__ */
|
|
4702
|
+
operators.map((op) => /* @__PURE__ */ React75.createElement("option", { key: op.value, value: op.value }, op.label))
|
|
4703
|
+
), !hideValue && col?.type === "date" && /* @__PURE__ */ React75.createElement("div", { className: "dg-filter-datefield" }, /* @__PURE__ */ React75.createElement(
|
|
4473
4704
|
DateField,
|
|
4474
4705
|
{
|
|
4475
4706
|
value: f.value,
|
|
@@ -4478,17 +4709,17 @@ function DataGrid({
|
|
|
4478
4709
|
}
|
|
4479
4710
|
)), !hideValue && col?.type === "status" && (() => {
|
|
4480
4711
|
const options = col.statusOptions || [...new Set(data.map((item) => String(item[col.field || col.key || ""])))].filter((v) => v && v !== "undefined" && v !== "null").sort();
|
|
4481
|
-
return /* @__PURE__ */
|
|
4712
|
+
return /* @__PURE__ */ React75.createElement(
|
|
4482
4713
|
"select",
|
|
4483
4714
|
{
|
|
4484
4715
|
className: "dg-filter-select",
|
|
4485
4716
|
value: f.value,
|
|
4486
4717
|
onChange: (e) => setAdvancedFilters((p) => p.map((fi, i) => i === idx ? { ...fi, value: e.target.value } : fi))
|
|
4487
4718
|
},
|
|
4488
|
-
/* @__PURE__ */
|
|
4489
|
-
options.map((opt) => /* @__PURE__ */
|
|
4719
|
+
/* @__PURE__ */ React75.createElement("option", { value: "" }, "Select\u2026"),
|
|
4720
|
+
options.map((opt) => /* @__PURE__ */ React75.createElement("option", { key: opt, value: opt }, opt))
|
|
4490
4721
|
);
|
|
4491
|
-
})(), !hideValue && col?.type !== "date" && col?.type !== "status" && /* @__PURE__ */
|
|
4722
|
+
})(), !hideValue && col?.type !== "date" && col?.type !== "status" && /* @__PURE__ */ React75.createElement(
|
|
4492
4723
|
"input",
|
|
4493
4724
|
{
|
|
4494
4725
|
type: col?.type === "number" ? "number" : "text",
|
|
@@ -4498,7 +4729,7 @@ function DataGrid({
|
|
|
4498
4729
|
onChange: (e) => setAdvancedFilters((p) => p.map((fi, i) => i === idx ? { ...fi, value: e.target.value } : fi))
|
|
4499
4730
|
}
|
|
4500
4731
|
));
|
|
4501
|
-
})()))), /* @__PURE__ */
|
|
4732
|
+
})()))), /* @__PURE__ */ React75.createElement(
|
|
4502
4733
|
"button",
|
|
4503
4734
|
{
|
|
4504
4735
|
className: "dg-action-btn",
|
|
@@ -4509,9 +4740,9 @@ function DataGrid({
|
|
|
4509
4740
|
setAdvancedFilters((p) => [...p, { column: String(firstCol.key), operator: defaultOp, value: "", logic: "AND" }]);
|
|
4510
4741
|
}
|
|
4511
4742
|
},
|
|
4512
|
-
/* @__PURE__ */
|
|
4743
|
+
/* @__PURE__ */ React75.createElement(Plus, { size: 14 }),
|
|
4513
4744
|
" Add Filter"
|
|
4514
|
-
)), /* @__PURE__ */
|
|
4745
|
+
)), /* @__PURE__ */ React75.createElement("div", { className: "dg-modal-footer" }, /* @__PURE__ */ React75.createElement(
|
|
4515
4746
|
"button",
|
|
4516
4747
|
{
|
|
4517
4748
|
className: "dg-action-btn",
|
|
@@ -4520,25 +4751,25 @@ function DataGrid({
|
|
|
4520
4751
|
setAdvancedFilters([{ column: String(firstCol.key), operator: getDefaultOperator(firstCol?.type), value: "", logic: "AND" }]);
|
|
4521
4752
|
}
|
|
4522
4753
|
},
|
|
4523
|
-
/* @__PURE__ */
|
|
4754
|
+
/* @__PURE__ */ React75.createElement(Trash2, { size: 14 }),
|
|
4524
4755
|
" Reset"
|
|
4525
|
-
), /* @__PURE__ */
|
|
4756
|
+
), /* @__PURE__ */ React75.createElement("button", { className: "submit-btn", onClick: () => setShowAdvancedFilter(false) }, "Apply")))));
|
|
4526
4757
|
}
|
|
4527
4758
|
|
|
4528
4759
|
// lib/Select/Select.tsx
|
|
4529
|
-
import
|
|
4530
|
-
useState as
|
|
4531
|
-
useRef as
|
|
4532
|
-
useEffect as
|
|
4533
|
-
useCallback as
|
|
4760
|
+
import React76, {
|
|
4761
|
+
useState as useState10,
|
|
4762
|
+
useRef as useRef10,
|
|
4763
|
+
useEffect as useEffect10,
|
|
4764
|
+
useCallback as useCallback4
|
|
4534
4765
|
} from "react";
|
|
4535
|
-
import
|
|
4536
|
-
var ChevronDownIcon2 = () => /* @__PURE__ */
|
|
4537
|
-
var CheckIcon2 = () => /* @__PURE__ */
|
|
4766
|
+
import ReactDOM4 from "react-dom";
|
|
4767
|
+
var ChevronDownIcon2 = () => /* @__PURE__ */ React76.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React76.createElement("polyline", { points: "6 9 12 15 18 9" }));
|
|
4768
|
+
var CheckIcon2 = () => /* @__PURE__ */ React76.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React76.createElement("polyline", { points: "20 6 9 17 4 12" }));
|
|
4538
4769
|
function normaliseOptions(options) {
|
|
4539
4770
|
return options.map((o) => typeof o === "string" ? { value: o, label: o } : o);
|
|
4540
4771
|
}
|
|
4541
|
-
var Select =
|
|
4772
|
+
var Select = React76.forwardRef(function Select2(props, ref) {
|
|
4542
4773
|
const {
|
|
4543
4774
|
options: rawOptions,
|
|
4544
4775
|
value,
|
|
@@ -4557,14 +4788,14 @@ var Select = React75.forwardRef(function Select2(props, ref) {
|
|
|
4557
4788
|
style,
|
|
4558
4789
|
sx
|
|
4559
4790
|
} = props;
|
|
4560
|
-
const [open, setOpen] =
|
|
4561
|
-
const [focusedIdx, setFocusedIdx] =
|
|
4562
|
-
const [popupStyle, setPopupStyle] =
|
|
4563
|
-
const containerRef =
|
|
4564
|
-
const listRef =
|
|
4565
|
-
const inputId =
|
|
4791
|
+
const [open, setOpen] = useState10(false);
|
|
4792
|
+
const [focusedIdx, setFocusedIdx] = useState10(-1);
|
|
4793
|
+
const [popupStyle, setPopupStyle] = useState10({});
|
|
4794
|
+
const containerRef = useRef10(null);
|
|
4795
|
+
const listRef = useRef10(null);
|
|
4796
|
+
const inputId = useRef10(`rf-sel-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
4566
4797
|
const sxClass = useSx(sx);
|
|
4567
|
-
const calcPopupStyle =
|
|
4798
|
+
const calcPopupStyle = useCallback4(() => {
|
|
4568
4799
|
if (!containerRef.current) return;
|
|
4569
4800
|
const rect = containerRef.current.getBoundingClientRect();
|
|
4570
4801
|
setPopupStyle({
|
|
@@ -4575,28 +4806,28 @@ var Select = React75.forwardRef(function Select2(props, ref) {
|
|
|
4575
4806
|
}, []);
|
|
4576
4807
|
const options = normaliseOptions(rawOptions);
|
|
4577
4808
|
const selectedValues = multiple ? Array.isArray(value) ? value : value != null ? [value] : [] : value != null ? [value] : [];
|
|
4578
|
-
const isSelected =
|
|
4809
|
+
const isSelected = useCallback4(
|
|
4579
4810
|
(optValue) => selectedValues.includes(optValue),
|
|
4580
4811
|
[selectedValues]
|
|
4581
4812
|
);
|
|
4582
4813
|
const getSelectedLabels = () => options.filter((o) => selectedValues.includes(o.value)).map((o) => o.label);
|
|
4583
4814
|
const hasValue = selectedValues.length > 0;
|
|
4584
4815
|
const isFloating = Boolean(open || hasValue);
|
|
4585
|
-
const openPopup =
|
|
4816
|
+
const openPopup = useCallback4(() => {
|
|
4586
4817
|
if (disabled) return;
|
|
4587
4818
|
calcPopupStyle();
|
|
4588
4819
|
setOpen(true);
|
|
4589
4820
|
setFocusedIdx(-1);
|
|
4590
4821
|
}, [disabled, calcPopupStyle]);
|
|
4591
|
-
const closePopup =
|
|
4822
|
+
const closePopup = useCallback4(() => {
|
|
4592
4823
|
setOpen(false);
|
|
4593
4824
|
setFocusedIdx(-1);
|
|
4594
4825
|
}, []);
|
|
4595
|
-
const togglePopup =
|
|
4826
|
+
const togglePopup = useCallback4(() => {
|
|
4596
4827
|
if (open) closePopup();
|
|
4597
4828
|
else openPopup();
|
|
4598
4829
|
}, [open, openPopup, closePopup]);
|
|
4599
|
-
|
|
4830
|
+
useEffect10(() => {
|
|
4600
4831
|
if (!open) return;
|
|
4601
4832
|
const handleOutside = (e) => {
|
|
4602
4833
|
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
@@ -4612,7 +4843,7 @@ var Select = React75.forwardRef(function Select2(props, ref) {
|
|
|
4612
4843
|
window.removeEventListener("resize", calcPopupStyle);
|
|
4613
4844
|
};
|
|
4614
4845
|
}, [open, closePopup, calcPopupStyle]);
|
|
4615
|
-
const selectOption =
|
|
4846
|
+
const selectOption = useCallback4((opt) => {
|
|
4616
4847
|
if (opt.disabled) return;
|
|
4617
4848
|
if (multiple) {
|
|
4618
4849
|
const already = isSelected(opt.value);
|
|
@@ -4687,20 +4918,20 @@ var Select = React75.forwardRef(function Select2(props, ref) {
|
|
|
4687
4918
|
if (multiple) {
|
|
4688
4919
|
const labels = getSelectedLabels();
|
|
4689
4920
|
if (labels.length === 0) {
|
|
4690
|
-
return /* @__PURE__ */
|
|
4921
|
+
return /* @__PURE__ */ React76.createElement("div", { className: "rf-select__chips" }, placeholder && /* @__PURE__ */ React76.createElement("span", { className: "rf-select__display rf-select__display--placeholder" }, placeholder));
|
|
4691
4922
|
}
|
|
4692
4923
|
if (labels.length <= 2) {
|
|
4693
|
-
return /* @__PURE__ */
|
|
4924
|
+
return /* @__PURE__ */ React76.createElement("div", { className: "rf-select__chips" }, labels.map((l, i) => /* @__PURE__ */ React76.createElement("span", { key: i, className: "rf-select__chip" }, l)));
|
|
4694
4925
|
}
|
|
4695
|
-
return /* @__PURE__ */
|
|
4926
|
+
return /* @__PURE__ */ React76.createElement("div", { className: "rf-select__chips" }, labels.slice(0, 2).map((l, i) => /* @__PURE__ */ React76.createElement("span", { key: i, className: "rf-select__chip" }, l)), /* @__PURE__ */ React76.createElement("span", { className: "rf-select__count" }, "+", labels.length - 2));
|
|
4696
4927
|
}
|
|
4697
4928
|
const selectedOpt = options.find((o) => o.value === value);
|
|
4698
4929
|
if (selectedOpt) {
|
|
4699
|
-
return /* @__PURE__ */
|
|
4930
|
+
return /* @__PURE__ */ React76.createElement("div", { className: "rf-select__display" }, selectedOpt.label);
|
|
4700
4931
|
}
|
|
4701
|
-
return /* @__PURE__ */
|
|
4932
|
+
return /* @__PURE__ */ React76.createElement("div", { className: `rf-select__display${placeholder ? " rf-select__display--placeholder" : ""}` }, placeholder || "\xA0");
|
|
4702
4933
|
};
|
|
4703
|
-
return /* @__PURE__ */
|
|
4934
|
+
return /* @__PURE__ */ React76.createElement(
|
|
4704
4935
|
"div",
|
|
4705
4936
|
{
|
|
4706
4937
|
ref: (node) => {
|
|
@@ -4711,7 +4942,7 @@ var Select = React75.forwardRef(function Select2(props, ref) {
|
|
|
4711
4942
|
className: rootClasses,
|
|
4712
4943
|
style
|
|
4713
4944
|
},
|
|
4714
|
-
/* @__PURE__ */
|
|
4945
|
+
/* @__PURE__ */ React76.createElement(
|
|
4715
4946
|
"div",
|
|
4716
4947
|
{
|
|
4717
4948
|
className: "rf-text-field__wrapper",
|
|
@@ -4725,16 +4956,16 @@ var Select = React75.forwardRef(function Select2(props, ref) {
|
|
|
4725
4956
|
onKeyDown: handleKeyDown
|
|
4726
4957
|
},
|
|
4727
4958
|
renderDisplay(),
|
|
4728
|
-
label && /* @__PURE__ */
|
|
4729
|
-
variant === "outlined" && /* @__PURE__ */
|
|
4730
|
-
/* @__PURE__ */
|
|
4959
|
+
label && /* @__PURE__ */ React76.createElement("label", { id: inputId, className: "rf-text-field__label" }, label, required && /* @__PURE__ */ React76.createElement("span", { className: "rf-text-field__asterisk" }, " *")),
|
|
4960
|
+
variant === "outlined" && /* @__PURE__ */ React76.createElement("fieldset", { className: "rf-text-field__notch" }, label ? /* @__PURE__ */ React76.createElement("legend", { className: "rf-text-field__legend" }, /* @__PURE__ */ React76.createElement("span", null, label, required ? " *" : "")) : /* @__PURE__ */ React76.createElement("legend", { className: "rf-text-field__legend--empty" })),
|
|
4961
|
+
/* @__PURE__ */ React76.createElement("div", { className: "rf-select__arrow", "aria-hidden": "true" }, /* @__PURE__ */ React76.createElement(ChevronDownIcon2, null))
|
|
4731
4962
|
),
|
|
4732
|
-
helperText && /* @__PURE__ */
|
|
4733
|
-
open && !disabled &&
|
|
4734
|
-
/* @__PURE__ */
|
|
4963
|
+
helperText && /* @__PURE__ */ React76.createElement("div", { className: `rf-text-field__helper-text${error ? " rf-text-field__helper-text--error" : ""}` }, helperText),
|
|
4964
|
+
open && !disabled && ReactDOM4.createPortal(
|
|
4965
|
+
/* @__PURE__ */ React76.createElement("div", { className: "rf-select__popup", role: "presentation", style: popupStyle }, /* @__PURE__ */ React76.createElement("ul", { ref: listRef, className: "rf-select__listbox", role: "listbox", "aria-multiselectable": multiple }, options.map((opt, idx) => {
|
|
4735
4966
|
const selected = isSelected(opt.value);
|
|
4736
4967
|
const focused = focusedIdx === idx;
|
|
4737
|
-
return /* @__PURE__ */
|
|
4968
|
+
return /* @__PURE__ */ React76.createElement(
|
|
4738
4969
|
"li",
|
|
4739
4970
|
{
|
|
4740
4971
|
key: opt.value,
|
|
@@ -4753,8 +4984,8 @@ var Select = React75.forwardRef(function Select2(props, ref) {
|
|
|
4753
4984
|
onMouseDown: (e) => e.preventDefault(),
|
|
4754
4985
|
onClick: () => selectOption(opt)
|
|
4755
4986
|
},
|
|
4756
|
-
/* @__PURE__ */
|
|
4757
|
-
/* @__PURE__ */
|
|
4987
|
+
/* @__PURE__ */ React76.createElement("span", { className: "rf-select__option-label" }, opt.label),
|
|
4988
|
+
/* @__PURE__ */ React76.createElement("span", { className: "rf-select__option-check", "aria-hidden": "true" }, /* @__PURE__ */ React76.createElement(CheckIcon2, null))
|
|
4758
4989
|
);
|
|
4759
4990
|
}))),
|
|
4760
4991
|
document.body
|
|
@@ -4764,11 +4995,11 @@ var Select = React75.forwardRef(function Select2(props, ref) {
|
|
|
4764
4995
|
Select.displayName = "Select";
|
|
4765
4996
|
|
|
4766
4997
|
// lib/Slider/Slider.tsx
|
|
4767
|
-
import
|
|
4768
|
-
useState as
|
|
4769
|
-
useRef as
|
|
4770
|
-
useEffect as
|
|
4771
|
-
useCallback as
|
|
4998
|
+
import React77, {
|
|
4999
|
+
useState as useState11,
|
|
5000
|
+
useRef as useRef11,
|
|
5001
|
+
useEffect as useEffect11,
|
|
5002
|
+
useCallback as useCallback5
|
|
4772
5003
|
} from "react";
|
|
4773
5004
|
function clamp(val, min, max) {
|
|
4774
5005
|
return Math.max(min, Math.min(max, val));
|
|
@@ -4779,7 +5010,7 @@ function snapToStep(val, min, step) {
|
|
|
4779
5010
|
function pct(val, min, max) {
|
|
4780
5011
|
return (val - min) / (max - min) * 100;
|
|
4781
5012
|
}
|
|
4782
|
-
var Slider =
|
|
5013
|
+
var Slider = React77.forwardRef(function Slider2(props, ref) {
|
|
4783
5014
|
const {
|
|
4784
5015
|
value,
|
|
4785
5016
|
onChange,
|
|
@@ -4799,9 +5030,9 @@ var Slider = React76.forwardRef(function Slider2(props, ref) {
|
|
|
4799
5030
|
sx
|
|
4800
5031
|
} = props;
|
|
4801
5032
|
const sxClass = useSx(sx);
|
|
4802
|
-
const trackRef =
|
|
4803
|
-
const draggingThumb =
|
|
4804
|
-
const [dragging, setDragging] =
|
|
5033
|
+
const trackRef = useRef11(null);
|
|
5034
|
+
const draggingThumb = useRef11(null);
|
|
5035
|
+
const [dragging, setDragging] = useState11(null);
|
|
4805
5036
|
const isRange = range || Array.isArray(value);
|
|
4806
5037
|
const rawVal = value ?? (isRange ? [min, max] : min);
|
|
4807
5038
|
const vals = isRange ? Array.isArray(rawVal) ? [rawVal[0], rawVal[1]] : [rawVal, rawVal] : [rawVal, rawVal];
|
|
@@ -4812,7 +5043,7 @@ var Slider = React76.forwardRef(function Slider2(props, ref) {
|
|
|
4812
5043
|
computedMarks.push(...marks);
|
|
4813
5044
|
}
|
|
4814
5045
|
const hasLabelledMarks = computedMarks.some((m) => m.label);
|
|
4815
|
-
const getValueFromPointer =
|
|
5046
|
+
const getValueFromPointer = useCallback5((e) => {
|
|
4816
5047
|
const track = trackRef.current;
|
|
4817
5048
|
if (!track) return min;
|
|
4818
5049
|
const rect = track.getBoundingClientRect();
|
|
@@ -4826,7 +5057,7 @@ var Slider = React76.forwardRef(function Slider2(props, ref) {
|
|
|
4826
5057
|
const raw = min + ratio * (max - min);
|
|
4827
5058
|
return clamp(snapToStep(raw, min, step), min, max);
|
|
4828
5059
|
}, [min, max, step, orientation]);
|
|
4829
|
-
|
|
5060
|
+
useEffect11(() => {
|
|
4830
5061
|
if (dragging === null) return;
|
|
4831
5062
|
const onMove = (e) => {
|
|
4832
5063
|
const newVal = getValueFromPointer(e);
|
|
@@ -4919,7 +5150,7 @@ var Slider = React76.forwardRef(function Slider2(props, ref) {
|
|
|
4919
5150
|
const val = vals[thumb];
|
|
4920
5151
|
const p = pct(val, min, max);
|
|
4921
5152
|
const thumbStyle = orientation === "vertical" ? { bottom: `${p}%`, transform: "translate(-50%, 50%)" } : { left: `${p}%` };
|
|
4922
|
-
return /* @__PURE__ */
|
|
5153
|
+
return /* @__PURE__ */ React77.createElement(
|
|
4923
5154
|
"div",
|
|
4924
5155
|
{
|
|
4925
5156
|
key: thumb,
|
|
@@ -4935,30 +5166,30 @@ var Slider = React76.forwardRef(function Slider2(props, ref) {
|
|
|
4935
5166
|
onPointerDown: (e) => handleThumbPointerDown(e, thumb),
|
|
4936
5167
|
onKeyDown: (e) => handleThumbKeyDown(e, thumb)
|
|
4937
5168
|
},
|
|
4938
|
-
valueLabelDisplay !== "off" && /* @__PURE__ */
|
|
5169
|
+
valueLabelDisplay !== "off" && /* @__PURE__ */ React77.createElement("div", { className: "rf-slider__value-label", "aria-hidden": "true" }, val)
|
|
4939
5170
|
);
|
|
4940
5171
|
};
|
|
4941
|
-
return /* @__PURE__ */
|
|
5172
|
+
return /* @__PURE__ */ React77.createElement("div", { ref, className: rootClasses, style }, label && /* @__PURE__ */ React77.createElement("div", { className: "rf-slider__label" }, label), /* @__PURE__ */ React77.createElement(
|
|
4942
5173
|
"div",
|
|
4943
5174
|
{
|
|
4944
5175
|
ref: trackRef,
|
|
4945
5176
|
className: "rf-slider__track-container",
|
|
4946
5177
|
onPointerDown: handleTrackPointerDown
|
|
4947
5178
|
},
|
|
4948
|
-
/* @__PURE__ */
|
|
4949
|
-
/* @__PURE__ */
|
|
5179
|
+
/* @__PURE__ */ React77.createElement("div", { className: "rf-slider__rail", "aria-hidden": "true" }),
|
|
5180
|
+
/* @__PURE__ */ React77.createElement("div", { className: "rf-slider__track", style: trackStyle, "aria-hidden": "true" }),
|
|
4950
5181
|
computedMarks.map((mark) => {
|
|
4951
5182
|
const p = pct(mark.value, min, max);
|
|
4952
5183
|
const isActive = isRange ? mark.value >= vals[0] && mark.value <= vals[1] : mark.value <= vals[0];
|
|
4953
5184
|
const markStyle = orientation === "vertical" ? { bottom: `${p}%`, transform: "translate(-50%, 50%)" } : { left: `${p}%` };
|
|
4954
|
-
return /* @__PURE__ */
|
|
5185
|
+
return /* @__PURE__ */ React77.createElement(React77.Fragment, { key: mark.value }, /* @__PURE__ */ React77.createElement(
|
|
4955
5186
|
"div",
|
|
4956
5187
|
{
|
|
4957
5188
|
className: `rf-slider__mark${isActive ? " rf-slider__mark--active" : ""}`,
|
|
4958
5189
|
style: markStyle,
|
|
4959
5190
|
"aria-hidden": "true"
|
|
4960
5191
|
}
|
|
4961
|
-
), mark.label && orientation === "horizontal" && /* @__PURE__ */
|
|
5192
|
+
), mark.label && orientation === "horizontal" && /* @__PURE__ */ React77.createElement(
|
|
4962
5193
|
"div",
|
|
4963
5194
|
{
|
|
4964
5195
|
className: "rf-slider__mark-label",
|
|
@@ -4970,13 +5201,13 @@ var Slider = React76.forwardRef(function Slider2(props, ref) {
|
|
|
4970
5201
|
}),
|
|
4971
5202
|
renderThumb(0),
|
|
4972
5203
|
isRange && renderThumb(1)
|
|
4973
|
-
), hasLabelledMarks && orientation === "horizontal" && /* @__PURE__ */
|
|
5204
|
+
), hasLabelledMarks && orientation === "horizontal" && /* @__PURE__ */ React77.createElement("div", { className: "rf-slider__marks-labels", "aria-hidden": "true" }));
|
|
4974
5205
|
});
|
|
4975
5206
|
Slider.displayName = "Slider";
|
|
4976
5207
|
|
|
4977
5208
|
// lib/Switch/Switch.tsx
|
|
4978
|
-
import
|
|
4979
|
-
var Switch =
|
|
5209
|
+
import React78, { useRef as useRef12 } from "react";
|
|
5210
|
+
var Switch = React78.forwardRef(function Switch2(props, ref) {
|
|
4980
5211
|
const {
|
|
4981
5212
|
checked = false,
|
|
4982
5213
|
onChange,
|
|
@@ -4991,8 +5222,8 @@ var Switch = React77.forwardRef(function Switch2(props, ref) {
|
|
|
4991
5222
|
sx
|
|
4992
5223
|
} = props;
|
|
4993
5224
|
const sxClass = useSx(sx);
|
|
4994
|
-
const inputRef =
|
|
4995
|
-
const inputId =
|
|
5225
|
+
const inputRef = useRef12(null);
|
|
5226
|
+
const inputId = useRef12(`rf-sw-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
4996
5227
|
const handleChange = (e) => {
|
|
4997
5228
|
if (!disabled) onChange?.(e.target.checked);
|
|
4998
5229
|
};
|
|
@@ -5006,7 +5237,7 @@ var Switch = React77.forwardRef(function Switch2(props, ref) {
|
|
|
5006
5237
|
sxClass,
|
|
5007
5238
|
className
|
|
5008
5239
|
].filter(Boolean).join(" ");
|
|
5009
|
-
return /* @__PURE__ */
|
|
5240
|
+
return /* @__PURE__ */ React78.createElement(
|
|
5010
5241
|
"label",
|
|
5011
5242
|
{
|
|
5012
5243
|
ref,
|
|
@@ -5014,7 +5245,7 @@ var Switch = React77.forwardRef(function Switch2(props, ref) {
|
|
|
5014
5245
|
style,
|
|
5015
5246
|
htmlFor: inputId
|
|
5016
5247
|
},
|
|
5017
|
-
/* @__PURE__ */
|
|
5248
|
+
/* @__PURE__ */ React78.createElement(
|
|
5018
5249
|
"input",
|
|
5019
5250
|
{
|
|
5020
5251
|
ref: inputRef,
|
|
@@ -5029,16 +5260,16 @@ var Switch = React77.forwardRef(function Switch2(props, ref) {
|
|
|
5029
5260
|
"aria-checked": checked
|
|
5030
5261
|
}
|
|
5031
5262
|
),
|
|
5032
|
-
/* @__PURE__ */
|
|
5033
|
-
label && /* @__PURE__ */
|
|
5263
|
+
/* @__PURE__ */ React78.createElement("div", { className: "rf-switch__track", "aria-hidden": "true" }, /* @__PURE__ */ React78.createElement("div", { className: "rf-switch__thumb" })),
|
|
5264
|
+
label && /* @__PURE__ */ React78.createElement("span", { className: "rf-switch__label" }, label, required && /* @__PURE__ */ React78.createElement("span", { style: { color: "var(--tf-error-color, #d32f2f)" } }, " *"))
|
|
5034
5265
|
);
|
|
5035
5266
|
});
|
|
5036
5267
|
Switch.displayName = "Switch";
|
|
5037
5268
|
|
|
5038
5269
|
// lib/RadioGroup/RadioGroup.tsx
|
|
5039
|
-
import
|
|
5270
|
+
import React79, { useRef as useRef13, createContext as createContext3, useContext as useContext3 } from "react";
|
|
5040
5271
|
var RadioGroupContext = createContext3({});
|
|
5041
|
-
var Radio =
|
|
5272
|
+
var Radio = React79.forwardRef(function Radio2(props, ref) {
|
|
5042
5273
|
const ctx = useContext3(RadioGroupContext);
|
|
5043
5274
|
const {
|
|
5044
5275
|
value,
|
|
@@ -5051,7 +5282,7 @@ var Radio = React78.forwardRef(function Radio2(props, ref) {
|
|
|
5051
5282
|
sx
|
|
5052
5283
|
} = props;
|
|
5053
5284
|
const sxClass = useSx(sx);
|
|
5054
|
-
const inputId =
|
|
5285
|
+
const inputId = useRef13(`rf-radio-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
5055
5286
|
const isChecked = checkedProp !== void 0 ? checkedProp : ctx.value === value;
|
|
5056
5287
|
const isDisabled = disabledProp !== void 0 ? disabledProp : ctx.disabled ?? false;
|
|
5057
5288
|
const size = sizeProp ?? ctx.size ?? "medium";
|
|
@@ -5069,7 +5300,7 @@ var Radio = React78.forwardRef(function Radio2(props, ref) {
|
|
|
5069
5300
|
isDisabled ? "rf-radio--disabled" : "",
|
|
5070
5301
|
sxClass
|
|
5071
5302
|
].filter(Boolean).join(" ");
|
|
5072
|
-
return /* @__PURE__ */
|
|
5303
|
+
return /* @__PURE__ */ React79.createElement("label", { ref, className: rootClasses, htmlFor: inputId }, /* @__PURE__ */ React79.createElement(
|
|
5073
5304
|
"input",
|
|
5074
5305
|
{
|
|
5075
5306
|
id: inputId,
|
|
@@ -5082,10 +5313,10 @@ var Radio = React78.forwardRef(function Radio2(props, ref) {
|
|
|
5082
5313
|
name,
|
|
5083
5314
|
"aria-checked": isChecked
|
|
5084
5315
|
}
|
|
5085
|
-
), /* @__PURE__ */
|
|
5316
|
+
), /* @__PURE__ */ React79.createElement("div", { className: "rf-radio__control", "aria-hidden": "true" }, /* @__PURE__ */ React79.createElement("div", { className: "rf-radio__ripple" }), /* @__PURE__ */ React79.createElement("div", { className: "rf-radio__outer" }, /* @__PURE__ */ React79.createElement("div", { className: "rf-radio__inner" }))), label && /* @__PURE__ */ React79.createElement("span", { className: "rf-radio__label" }, label));
|
|
5086
5317
|
});
|
|
5087
5318
|
Radio.displayName = "Radio";
|
|
5088
|
-
var RadioGroup =
|
|
5319
|
+
var RadioGroup = React79.forwardRef(function RadioGroup2(props, ref) {
|
|
5089
5320
|
const {
|
|
5090
5321
|
value,
|
|
5091
5322
|
onChange,
|
|
@@ -5101,7 +5332,7 @@ var RadioGroup = React78.forwardRef(function RadioGroup2(props, ref) {
|
|
|
5101
5332
|
sx
|
|
5102
5333
|
} = props;
|
|
5103
5334
|
const sxClass = useSx(sx);
|
|
5104
|
-
const groupName =
|
|
5335
|
+
const groupName = useRef13(name ?? `rf-rg-${Math.random().toString(36).slice(2, 9)}`).current;
|
|
5105
5336
|
const rootClasses = [
|
|
5106
5337
|
"rf-radio-group",
|
|
5107
5338
|
row ? "rf-radio-group--row" : "",
|
|
@@ -5109,7 +5340,7 @@ var RadioGroup = React78.forwardRef(function RadioGroup2(props, ref) {
|
|
|
5109
5340
|
sxClass,
|
|
5110
5341
|
className
|
|
5111
5342
|
].filter(Boolean).join(" ");
|
|
5112
|
-
return /* @__PURE__ */
|
|
5343
|
+
return /* @__PURE__ */ React79.createElement(RadioGroupContext.Provider, { value: { value, onChange, name: groupName, disabled, size } }, /* @__PURE__ */ React79.createElement(
|
|
5113
5344
|
"div",
|
|
5114
5345
|
{
|
|
5115
5346
|
ref,
|
|
@@ -5118,8 +5349,8 @@ var RadioGroup = React78.forwardRef(function RadioGroup2(props, ref) {
|
|
|
5118
5349
|
role: "radiogroup",
|
|
5119
5350
|
"aria-label": label
|
|
5120
5351
|
},
|
|
5121
|
-
label && /* @__PURE__ */
|
|
5122
|
-
options ? options.map((opt) => /* @__PURE__ */
|
|
5352
|
+
label && /* @__PURE__ */ React79.createElement("div", { className: "rf-radio-group__label" }, label),
|
|
5353
|
+
options ? options.map((opt) => /* @__PURE__ */ React79.createElement(
|
|
5123
5354
|
Radio,
|
|
5124
5355
|
{
|
|
5125
5356
|
key: opt.value,
|
|
@@ -5133,12 +5364,12 @@ var RadioGroup = React78.forwardRef(function RadioGroup2(props, ref) {
|
|
|
5133
5364
|
RadioGroup.displayName = "RadioGroup";
|
|
5134
5365
|
|
|
5135
5366
|
// lib/Rating/Rating.tsx
|
|
5136
|
-
import
|
|
5137
|
-
useState as
|
|
5138
|
-
useRef as
|
|
5367
|
+
import React80, {
|
|
5368
|
+
useState as useState12,
|
|
5369
|
+
useRef as useRef14
|
|
5139
5370
|
} from "react";
|
|
5140
5371
|
var starSize = { small: 18, medium: 24, large: 32 };
|
|
5141
|
-
var FilledStarIcon = ({ size }) => /* @__PURE__ */
|
|
5372
|
+
var FilledStarIcon = ({ size }) => /* @__PURE__ */ React80.createElement(
|
|
5142
5373
|
"svg",
|
|
5143
5374
|
{
|
|
5144
5375
|
width: size,
|
|
@@ -5147,9 +5378,9 @@ var FilledStarIcon = ({ size }) => /* @__PURE__ */ React79.createElement(
|
|
|
5147
5378
|
fill: "currentColor",
|
|
5148
5379
|
"aria-hidden": "true"
|
|
5149
5380
|
},
|
|
5150
|
-
/* @__PURE__ */
|
|
5381
|
+
/* @__PURE__ */ React80.createElement("path", { d: "M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" })
|
|
5151
5382
|
);
|
|
5152
|
-
var EmptyStarIcon = ({ size }) => /* @__PURE__ */
|
|
5383
|
+
var EmptyStarIcon = ({ size }) => /* @__PURE__ */ React80.createElement(
|
|
5153
5384
|
"svg",
|
|
5154
5385
|
{
|
|
5155
5386
|
width: size,
|
|
@@ -5160,9 +5391,9 @@ var EmptyStarIcon = ({ size }) => /* @__PURE__ */ React79.createElement(
|
|
|
5160
5391
|
strokeWidth: "1.6",
|
|
5161
5392
|
"aria-hidden": "true"
|
|
5162
5393
|
},
|
|
5163
|
-
/* @__PURE__ */
|
|
5394
|
+
/* @__PURE__ */ React80.createElement("path", { d: "M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z" })
|
|
5164
5395
|
);
|
|
5165
|
-
var Rating =
|
|
5396
|
+
var Rating = React80.forwardRef(function Rating2(props, ref) {
|
|
5166
5397
|
const {
|
|
5167
5398
|
value,
|
|
5168
5399
|
onChange,
|
|
@@ -5180,13 +5411,13 @@ var Rating = React79.forwardRef(function Rating2(props, ref) {
|
|
|
5180
5411
|
sx
|
|
5181
5412
|
} = props;
|
|
5182
5413
|
const sxClass = useSx(sx);
|
|
5183
|
-
const [hoverValue, setHoverValue] =
|
|
5184
|
-
const starsRef =
|
|
5414
|
+
const [hoverValue, setHoverValue] = useState12(null);
|
|
5415
|
+
const starsRef = useRef14(null);
|
|
5185
5416
|
const currentValue = value ?? 0;
|
|
5186
5417
|
const displayValue = hoverValue !== null ? hoverValue : currentValue;
|
|
5187
5418
|
const iconSize = starSize[size] ?? 24;
|
|
5188
|
-
const renderedFilledIcon = icon ?? /* @__PURE__ */
|
|
5189
|
-
const renderedEmptyIcon = emptyIcon ?? /* @__PURE__ */
|
|
5419
|
+
const renderedFilledIcon = icon ?? /* @__PURE__ */ React80.createElement(FilledStarIcon, { size: iconSize });
|
|
5420
|
+
const renderedEmptyIcon = emptyIcon ?? /* @__PURE__ */ React80.createElement(EmptyStarIcon, { size: iconSize });
|
|
5190
5421
|
const isFilled = (pos) => {
|
|
5191
5422
|
if (highlightSelectedOnly) return displayValue === pos;
|
|
5192
5423
|
return displayValue >= pos - (precision < 1 ? 0.25 : 0);
|
|
@@ -5247,7 +5478,7 @@ var Rating = React79.forwardRef(function Rating2(props, ref) {
|
|
|
5247
5478
|
sxClass,
|
|
5248
5479
|
className
|
|
5249
5480
|
].filter(Boolean).join(" ");
|
|
5250
|
-
return /* @__PURE__ */
|
|
5481
|
+
return /* @__PURE__ */ React80.createElement("div", { ref, className: rootClasses, style }, label && /* @__PURE__ */ React80.createElement("div", { className: "rf-rating__label" }, label), /* @__PURE__ */ React80.createElement(
|
|
5251
5482
|
"div",
|
|
5252
5483
|
{
|
|
5253
5484
|
ref: starsRef,
|
|
@@ -5264,7 +5495,7 @@ var Rating = React79.forwardRef(function Rating2(props, ref) {
|
|
|
5264
5495
|
"rf-rating__item",
|
|
5265
5496
|
isHovered ? "rf-rating__item--hovered" : ""
|
|
5266
5497
|
].filter(Boolean).join(" ");
|
|
5267
|
-
return /* @__PURE__ */
|
|
5498
|
+
return /* @__PURE__ */ React80.createElement(
|
|
5268
5499
|
"button",
|
|
5269
5500
|
{
|
|
5270
5501
|
key: pos,
|
|
@@ -5279,15 +5510,15 @@ var Rating = React79.forwardRef(function Rating2(props, ref) {
|
|
|
5279
5510
|
},
|
|
5280
5511
|
halfFilled ? (
|
|
5281
5512
|
// Half-star: show half filled + half empty
|
|
5282
|
-
/* @__PURE__ */
|
|
5513
|
+
/* @__PURE__ */ React80.createElement("div", { className: "rf-rating__icon-container", style: { position: "relative" } }, /* @__PURE__ */ React80.createElement("span", { className: "rf-rating__icon--empty" }, renderedEmptyIcon), /* @__PURE__ */ React80.createElement(
|
|
5283
5514
|
"span",
|
|
5284
5515
|
{
|
|
5285
5516
|
className: "rf-rating__half-left",
|
|
5286
5517
|
style: { position: "absolute", inset: 0, width: "50%", overflow: "hidden" }
|
|
5287
5518
|
},
|
|
5288
|
-
/* @__PURE__ */
|
|
5519
|
+
/* @__PURE__ */ React80.createElement("span", { className: "rf-rating__icon--filled" }, renderedFilledIcon)
|
|
5289
5520
|
))
|
|
5290
|
-
) : /* @__PURE__ */
|
|
5521
|
+
) : /* @__PURE__ */ React80.createElement("div", { className: "rf-rating__icon-container" }, /* @__PURE__ */ React80.createElement("span", { className: filled ? "rf-rating__icon--filled" : "rf-rating__icon--empty" }, filled ? renderedFilledIcon : renderedEmptyIcon))
|
|
5291
5522
|
);
|
|
5292
5523
|
})
|
|
5293
5524
|
));
|
|
@@ -5295,12 +5526,12 @@ var Rating = React79.forwardRef(function Rating2(props, ref) {
|
|
|
5295
5526
|
Rating.displayName = "Rating";
|
|
5296
5527
|
|
|
5297
5528
|
// lib/ToggleButton/ToggleButton.tsx
|
|
5298
|
-
import
|
|
5529
|
+
import React81, {
|
|
5299
5530
|
createContext as createContext4,
|
|
5300
5531
|
useContext as useContext4
|
|
5301
5532
|
} from "react";
|
|
5302
5533
|
var ToggleGroupContext = createContext4({});
|
|
5303
|
-
var ToggleButton =
|
|
5534
|
+
var ToggleButton = React81.forwardRef(
|
|
5304
5535
|
function ToggleButton2(props, ref) {
|
|
5305
5536
|
const ctx = useContext4(ToggleGroupContext);
|
|
5306
5537
|
const { value, children, disabled: disabledProp, selected: selectedProp, sx } = props;
|
|
@@ -5333,7 +5564,7 @@ var ToggleButton = React80.forwardRef(
|
|
|
5333
5564
|
}
|
|
5334
5565
|
}
|
|
5335
5566
|
};
|
|
5336
|
-
const isIconOnly =
|
|
5567
|
+
const isIconOnly = React81.Children.count(children) === 1 && React81.isValidElement(children) && children.type === "svg";
|
|
5337
5568
|
const btnClasses = [
|
|
5338
5569
|
"rf-toggle-btn",
|
|
5339
5570
|
isSelected ? "rf-toggle-btn--selected" : "",
|
|
@@ -5341,7 +5572,7 @@ var ToggleButton = React80.forwardRef(
|
|
|
5341
5572
|
isIconOnly ? "rf-toggle-btn--icon-only" : "",
|
|
5342
5573
|
sxClass
|
|
5343
5574
|
].filter(Boolean).join(" ");
|
|
5344
|
-
return /* @__PURE__ */
|
|
5575
|
+
return /* @__PURE__ */ React81.createElement(
|
|
5345
5576
|
"button",
|
|
5346
5577
|
{
|
|
5347
5578
|
ref,
|
|
@@ -5356,7 +5587,7 @@ var ToggleButton = React80.forwardRef(
|
|
|
5356
5587
|
}
|
|
5357
5588
|
);
|
|
5358
5589
|
ToggleButton.displayName = "ToggleButton";
|
|
5359
|
-
var ToggleButtonGroup =
|
|
5590
|
+
var ToggleButtonGroup = React81.forwardRef(
|
|
5360
5591
|
function ToggleButtonGroup2(props, ref) {
|
|
5361
5592
|
const {
|
|
5362
5593
|
value,
|
|
@@ -5383,7 +5614,7 @@ var ToggleButtonGroup = React80.forwardRef(
|
|
|
5383
5614
|
sxClass,
|
|
5384
5615
|
className
|
|
5385
5616
|
].filter(Boolean).join(" ");
|
|
5386
|
-
return /* @__PURE__ */
|
|
5617
|
+
return /* @__PURE__ */ React81.createElement(ToggleGroupContext.Provider, { value: { value, onChange, exclusive, size, disabled, color } }, /* @__PURE__ */ React81.createElement(
|
|
5387
5618
|
"div",
|
|
5388
5619
|
{
|
|
5389
5620
|
ref,
|
|
@@ -5399,7 +5630,7 @@ var ToggleButtonGroup = React80.forwardRef(
|
|
|
5399
5630
|
ToggleButtonGroup.displayName = "ToggleButtonGroup";
|
|
5400
5631
|
|
|
5401
5632
|
// lib/Avatar/Avatar.tsx
|
|
5402
|
-
import
|
|
5633
|
+
import React82, { useState as useState13 } from "react";
|
|
5403
5634
|
var DEFAULT_PALETTE = [
|
|
5404
5635
|
"#a41b06",
|
|
5405
5636
|
"#8b1605",
|
|
@@ -5434,7 +5665,7 @@ function getInitials(alt) {
|
|
|
5434
5665
|
}
|
|
5435
5666
|
return words[0][0].toUpperCase();
|
|
5436
5667
|
}
|
|
5437
|
-
var Avatar =
|
|
5668
|
+
var Avatar = React82.forwardRef(
|
|
5438
5669
|
({
|
|
5439
5670
|
src,
|
|
5440
5671
|
alt,
|
|
@@ -5449,7 +5680,7 @@ var Avatar = React81.forwardRef(
|
|
|
5449
5680
|
sx
|
|
5450
5681
|
}, ref) => {
|
|
5451
5682
|
const sxClass = useSx(sx);
|
|
5452
|
-
const [imgError, setImgError] =
|
|
5683
|
+
const [imgError, setImgError] = useState13(false);
|
|
5453
5684
|
const { className: sizeClass, style: sizeStyle } = getSizeStyle(size);
|
|
5454
5685
|
const bgColor = color || DEFAULT_PALETTE[_avatarColorIndex % DEFAULT_PALETTE.length];
|
|
5455
5686
|
const classes = [
|
|
@@ -5469,7 +5700,7 @@ var Avatar = React81.forwardRef(
|
|
|
5469
5700
|
inlineStyle.backgroundColor = bgColor;
|
|
5470
5701
|
inlineStyle.color = "#ffffff";
|
|
5471
5702
|
}
|
|
5472
|
-
return /* @__PURE__ */
|
|
5703
|
+
return /* @__PURE__ */ React82.createElement("div", { ref, className: classes, style: inlineStyle, "aria-label": alt, role: alt ? "img" : void 0, onClick, tabIndex: onClick ? 0 : void 0 }, showImage ? /* @__PURE__ */ React82.createElement(
|
|
5473
5704
|
"img",
|
|
5474
5705
|
{
|
|
5475
5706
|
src,
|
|
@@ -5478,7 +5709,7 @@ var Avatar = React81.forwardRef(
|
|
|
5478
5709
|
onError: () => setImgError(true),
|
|
5479
5710
|
...imgProps
|
|
5480
5711
|
}
|
|
5481
|
-
) : /* @__PURE__ */
|
|
5712
|
+
) : /* @__PURE__ */ React82.createElement("span", { className: "rf-avatar__initials" }, content));
|
|
5482
5713
|
}
|
|
5483
5714
|
);
|
|
5484
5715
|
Avatar.displayName = "Avatar";
|
|
@@ -5491,7 +5722,7 @@ var AvatarGroup = ({
|
|
|
5491
5722
|
sx
|
|
5492
5723
|
}) => {
|
|
5493
5724
|
const sxClass = useSx(sx);
|
|
5494
|
-
const childArray =
|
|
5725
|
+
const childArray = React82.Children.toArray(children);
|
|
5495
5726
|
const totalCount = childArray.length;
|
|
5496
5727
|
const overflowCount = totalCount > max ? totalCount - (max - 1) : 0;
|
|
5497
5728
|
const visibleChildren = overflowCount > 0 ? childArray.slice(0, max - 1) : childArray;
|
|
@@ -5505,7 +5736,7 @@ var AvatarGroup = ({
|
|
|
5505
5736
|
}
|
|
5506
5737
|
const classes = ["rf-avatar-group", spacingClass, sxClass, className].filter(Boolean).join(" ");
|
|
5507
5738
|
const avatarsToRender = [...visibleChildren].reverse();
|
|
5508
|
-
return /* @__PURE__ */
|
|
5739
|
+
return /* @__PURE__ */ React82.createElement("div", { className: classes, style, role: "group" }, overflowCount > 0 && /* @__PURE__ */ React82.createElement(
|
|
5509
5740
|
Avatar,
|
|
5510
5741
|
{
|
|
5511
5742
|
className: "rf-avatar-group__overflow",
|
|
@@ -5517,7 +5748,7 @@ var AvatarGroup = ({
|
|
|
5517
5748
|
), avatarsToRender.map((child, i) => {
|
|
5518
5749
|
if (typeof spacing === "number") {
|
|
5519
5750
|
const typedChild = child;
|
|
5520
|
-
return
|
|
5751
|
+
return React82.cloneElement(typedChild, {
|
|
5521
5752
|
key: i,
|
|
5522
5753
|
style: {
|
|
5523
5754
|
marginLeft: i < avatarsToRender.length - 1 ? -spacing : 0,
|
|
@@ -5531,7 +5762,7 @@ var AvatarGroup = ({
|
|
|
5531
5762
|
AvatarGroup.displayName = "AvatarGroup";
|
|
5532
5763
|
|
|
5533
5764
|
// lib/Chip/Chip.tsx
|
|
5534
|
-
import
|
|
5765
|
+
import React83 from "react";
|
|
5535
5766
|
var Chip = ({
|
|
5536
5767
|
label,
|
|
5537
5768
|
onDelete,
|
|
@@ -5569,7 +5800,7 @@ var Chip = ({
|
|
|
5569
5800
|
onDelete();
|
|
5570
5801
|
}
|
|
5571
5802
|
};
|
|
5572
|
-
return /* @__PURE__ */
|
|
5803
|
+
return /* @__PURE__ */ React83.createElement(
|
|
5573
5804
|
"div",
|
|
5574
5805
|
{
|
|
5575
5806
|
className: classes,
|
|
@@ -5580,10 +5811,10 @@ var Chip = ({
|
|
|
5580
5811
|
onKeyDown: !disabled ? handleKeyDown : void 0,
|
|
5581
5812
|
"aria-disabled": disabled || void 0
|
|
5582
5813
|
},
|
|
5583
|
-
avatar && /* @__PURE__ */
|
|
5584
|
-
!avatar && icon && /* @__PURE__ */
|
|
5585
|
-
/* @__PURE__ */
|
|
5586
|
-
onDelete && /* @__PURE__ */
|
|
5814
|
+
avatar && /* @__PURE__ */ React83.createElement("span", { className: "rf-chip__avatar" }, avatar),
|
|
5815
|
+
!avatar && icon && /* @__PURE__ */ React83.createElement("span", { className: "rf-chip__icon", "aria-hidden": "true" }, icon),
|
|
5816
|
+
/* @__PURE__ */ React83.createElement("span", { className: "rf-chip__label" }, label),
|
|
5817
|
+
onDelete && /* @__PURE__ */ React83.createElement(
|
|
5587
5818
|
"button",
|
|
5588
5819
|
{
|
|
5589
5820
|
className: "rf-chip__delete",
|
|
@@ -5604,7 +5835,7 @@ var Chip = ({
|
|
|
5604
5835
|
Chip.displayName = "Chip";
|
|
5605
5836
|
|
|
5606
5837
|
// lib/Divider/Divider.tsx
|
|
5607
|
-
import
|
|
5838
|
+
import React84 from "react";
|
|
5608
5839
|
var Divider = ({
|
|
5609
5840
|
orientation = "horizontal",
|
|
5610
5841
|
variant = "fullWidth",
|
|
@@ -5618,7 +5849,7 @@ var Divider = ({
|
|
|
5618
5849
|
sx
|
|
5619
5850
|
}) => {
|
|
5620
5851
|
const sxClass = useSx(sx);
|
|
5621
|
-
const hasChildren =
|
|
5852
|
+
const hasChildren = React84.Children.count(children) > 0;
|
|
5622
5853
|
const variantClass = variant === "inset" ? "rf-divider--inset" : variant === "middle" ? "rf-divider--middle" : "";
|
|
5623
5854
|
const classes = [
|
|
5624
5855
|
"rf-divider",
|
|
@@ -5634,7 +5865,7 @@ var Divider = ({
|
|
|
5634
5865
|
].filter(Boolean).join(" ");
|
|
5635
5866
|
const Tag = component || (hasChildren ? "div" : "hr");
|
|
5636
5867
|
if (!hasChildren) {
|
|
5637
|
-
return /* @__PURE__ */
|
|
5868
|
+
return /* @__PURE__ */ React84.createElement(
|
|
5638
5869
|
Tag,
|
|
5639
5870
|
{
|
|
5640
5871
|
className: classes,
|
|
@@ -5643,7 +5874,7 @@ var Divider = ({
|
|
|
5643
5874
|
}
|
|
5644
5875
|
);
|
|
5645
5876
|
}
|
|
5646
|
-
return /* @__PURE__ */
|
|
5877
|
+
return /* @__PURE__ */ React84.createElement(
|
|
5647
5878
|
Tag,
|
|
5648
5879
|
{
|
|
5649
5880
|
className: classes,
|
|
@@ -5651,13 +5882,13 @@ var Divider = ({
|
|
|
5651
5882
|
role: "separator",
|
|
5652
5883
|
"aria-orientation": orientation
|
|
5653
5884
|
},
|
|
5654
|
-
/* @__PURE__ */
|
|
5885
|
+
/* @__PURE__ */ React84.createElement("span", { className: "rf-divider__text" }, children)
|
|
5655
5886
|
);
|
|
5656
5887
|
};
|
|
5657
5888
|
Divider.displayName = "Divider";
|
|
5658
5889
|
|
|
5659
5890
|
// lib/List/List.tsx
|
|
5660
|
-
import
|
|
5891
|
+
import React85 from "react";
|
|
5661
5892
|
var List = ({
|
|
5662
5893
|
dense = false,
|
|
5663
5894
|
disablePadding = false,
|
|
@@ -5675,7 +5906,7 @@ var List = ({
|
|
|
5675
5906
|
sxClass,
|
|
5676
5907
|
className
|
|
5677
5908
|
].filter(Boolean).join(" ");
|
|
5678
|
-
return /* @__PURE__ */
|
|
5909
|
+
return /* @__PURE__ */ React85.createElement("ul", { className: classes, style }, subheader, children);
|
|
5679
5910
|
};
|
|
5680
5911
|
List.displayName = "List";
|
|
5681
5912
|
var ListItem = ({
|
|
@@ -5699,7 +5930,7 @@ var ListItem = ({
|
|
|
5699
5930
|
sxClass,
|
|
5700
5931
|
className
|
|
5701
5932
|
].filter(Boolean).join(" ");
|
|
5702
|
-
return /* @__PURE__ */
|
|
5933
|
+
return /* @__PURE__ */ React85.createElement("li", { className: classes, style }, /* @__PURE__ */ React85.createElement("div", { className: "rf-list-item__content" }, children), secondaryAction && /* @__PURE__ */ React85.createElement("div", { className: "rf-list-item__secondary-action" }, secondaryAction));
|
|
5703
5934
|
};
|
|
5704
5935
|
ListItem.displayName = "ListItem";
|
|
5705
5936
|
var ListItemText = ({
|
|
@@ -5716,12 +5947,12 @@ var ListItemText = ({
|
|
|
5716
5947
|
inset ? "rf-list-item-text--inset" : "",
|
|
5717
5948
|
sxClass
|
|
5718
5949
|
].filter(Boolean).join(" ");
|
|
5719
|
-
return /* @__PURE__ */
|
|
5950
|
+
return /* @__PURE__ */ React85.createElement("div", { className: classes }, /* @__PURE__ */ React85.createElement("p", { className: "rf-list-item-text__primary", ...primaryTypographyProps }, primary), secondary && /* @__PURE__ */ React85.createElement("p", { className: "rf-list-item-text__secondary", ...secondaryTypographyProps }, secondary));
|
|
5720
5951
|
};
|
|
5721
5952
|
ListItemText.displayName = "ListItemText";
|
|
5722
5953
|
var ListItemIcon = ({ children, sx }) => {
|
|
5723
5954
|
const sxClass = useSx(sx);
|
|
5724
|
-
return /* @__PURE__ */
|
|
5955
|
+
return /* @__PURE__ */ React85.createElement("div", { className: ["rf-list-item-icon", sxClass].filter(Boolean).join(" "), "aria-hidden": "true" }, children);
|
|
5725
5956
|
};
|
|
5726
5957
|
ListItemIcon.displayName = "ListItemIcon";
|
|
5727
5958
|
var ListItemButton = ({
|
|
@@ -5753,7 +5984,7 @@ var ListItemButton = ({
|
|
|
5753
5984
|
"aria-disabled": disabled || void 0
|
|
5754
5985
|
};
|
|
5755
5986
|
if (href) {
|
|
5756
|
-
return /* @__PURE__ */
|
|
5987
|
+
return /* @__PURE__ */ React85.createElement(
|
|
5757
5988
|
"a",
|
|
5758
5989
|
{
|
|
5759
5990
|
href,
|
|
@@ -5764,7 +5995,7 @@ var ListItemButton = ({
|
|
|
5764
5995
|
children
|
|
5765
5996
|
);
|
|
5766
5997
|
}
|
|
5767
|
-
return /* @__PURE__ */
|
|
5998
|
+
return /* @__PURE__ */ React85.createElement(
|
|
5768
5999
|
"button",
|
|
5769
6000
|
{
|
|
5770
6001
|
type: "button",
|
|
@@ -5793,12 +6024,12 @@ var ListSubheader = ({
|
|
|
5793
6024
|
color !== "default" ? `rf-list-subheader--color-${color}` : "",
|
|
5794
6025
|
sxClass
|
|
5795
6026
|
].filter(Boolean).join(" ");
|
|
5796
|
-
return /* @__PURE__ */
|
|
6027
|
+
return /* @__PURE__ */ React85.createElement("li", { className: classes, role: "presentation", "aria-label": typeof children === "string" ? children : void 0 }, children);
|
|
5797
6028
|
};
|
|
5798
6029
|
ListSubheader.displayName = "ListSubheader";
|
|
5799
6030
|
|
|
5800
6031
|
// lib/Typography/Typography.tsx
|
|
5801
|
-
import
|
|
6032
|
+
import React86 from "react";
|
|
5802
6033
|
var VARIANT_ELEMENT_MAP = {
|
|
5803
6034
|
h1: "h1",
|
|
5804
6035
|
h2: "h2",
|
|
@@ -5807,353 +6038,123 @@ var VARIANT_ELEMENT_MAP = {
|
|
|
5807
6038
|
h5: "h5",
|
|
5808
6039
|
h6: "h6",
|
|
5809
6040
|
subtitle1: "h6",
|
|
5810
|
-
subtitle2: "h6",
|
|
5811
|
-
body1: "p",
|
|
5812
|
-
body2: "p",
|
|
5813
|
-
caption: "span",
|
|
5814
|
-
overline: "span",
|
|
5815
|
-
button: "span"
|
|
5816
|
-
};
|
|
5817
|
-
var COLOR_CLASSES = {
|
|
5818
|
-
primary: "rf-typography--color-primary",
|
|
5819
|
-
secondary: "rf-typography--color-secondary",
|
|
5820
|
-
textPrimary: "rf-typography--color-textPrimary",
|
|
5821
|
-
textSecondary: "rf-typography--color-textSecondary",
|
|
5822
|
-
error: "rf-typography--color-error"
|
|
5823
|
-
};
|
|
5824
|
-
var WEIGHT_CLASSES = {
|
|
5825
|
-
light: "rf-typography--weight-light",
|
|
5826
|
-
regular: "rf-typography--weight-regular",
|
|
5827
|
-
medium: "rf-typography--weight-medium",
|
|
5828
|
-
bold: "rf-typography--weight-bold"
|
|
5829
|
-
};
|
|
5830
|
-
var Typography = ({
|
|
5831
|
-
variant = "body1",
|
|
5832
|
-
component,
|
|
5833
|
-
align = "inherit",
|
|
5834
|
-
color,
|
|
5835
|
-
noWrap = false,
|
|
5836
|
-
gutterBottom = false,
|
|
5837
|
-
paragraph = false,
|
|
5838
|
-
fontWeight,
|
|
5839
|
-
children,
|
|
5840
|
-
className = "",
|
|
5841
|
-
style,
|
|
5842
|
-
sx
|
|
5843
|
-
}) => {
|
|
5844
|
-
const sxClass = useSx(sx);
|
|
5845
|
-
const Tag = component || (paragraph ? "p" : VARIANT_ELEMENT_MAP[variant] || "span");
|
|
5846
|
-
const colorClass = color ? COLOR_CLASSES[color] : "";
|
|
5847
|
-
const colorStyle = color && !COLOR_CLASSES[color] ? { color } : {};
|
|
5848
|
-
let weightClass = "";
|
|
5849
|
-
let weightStyle = {};
|
|
5850
|
-
if (fontWeight !== void 0) {
|
|
5851
|
-
if (typeof fontWeight === "string") {
|
|
5852
|
-
weightClass = WEIGHT_CLASSES[fontWeight] || "";
|
|
5853
|
-
} else {
|
|
5854
|
-
weightStyle = { fontWeight };
|
|
5855
|
-
}
|
|
5856
|
-
}
|
|
5857
|
-
const alignClass = align !== "inherit" ? `rf-typography--align-${align}` : "";
|
|
5858
|
-
const classes = [
|
|
5859
|
-
"rf-typography",
|
|
5860
|
-
`rf-typography--${variant}`,
|
|
5861
|
-
alignClass,
|
|
5862
|
-
colorClass,
|
|
5863
|
-
weightClass,
|
|
5864
|
-
noWrap ? "rf-typography--no-wrap" : "",
|
|
5865
|
-
gutterBottom ? "rf-typography--gutter-bottom" : "",
|
|
5866
|
-
paragraph ? "rf-typography--paragraph" : "",
|
|
5867
|
-
sxClass,
|
|
5868
|
-
className
|
|
5869
|
-
].filter(Boolean).join(" ");
|
|
5870
|
-
const inlineStyle = {
|
|
5871
|
-
...colorStyle,
|
|
5872
|
-
...weightStyle,
|
|
5873
|
-
...style
|
|
5874
|
-
};
|
|
5875
|
-
return /* @__PURE__ */ React85.createElement(Tag, { className: classes, style: Object.keys(inlineStyle).length > 0 ? inlineStyle : void 0 }, children);
|
|
5876
|
-
};
|
|
5877
|
-
Typography.displayName = "Typography";
|
|
5878
|
-
|
|
5879
|
-
// lib/Skeleton/Skeleton.tsx
|
|
5880
|
-
import React86 from "react";
|
|
5881
|
-
var Skeleton = ({
|
|
5882
|
-
variant = "text",
|
|
5883
|
-
width,
|
|
5884
|
-
height,
|
|
5885
|
-
animation = "pulse",
|
|
5886
|
-
className = "",
|
|
5887
|
-
style,
|
|
5888
|
-
sx
|
|
5889
|
-
}) => {
|
|
5890
|
-
const sxClass = useSx(sx);
|
|
5891
|
-
const animationClass = animation === "pulse" ? "rf-skeleton--pulse" : animation === "wave" ? "rf-skeleton--wave" : "rf-skeleton--no-animation";
|
|
5892
|
-
const classes = [
|
|
5893
|
-
"rf-skeleton",
|
|
5894
|
-
`rf-skeleton--${variant}`,
|
|
5895
|
-
animationClass,
|
|
5896
|
-
sxClass,
|
|
5897
|
-
className
|
|
5898
|
-
].filter(Boolean).join(" ");
|
|
5899
|
-
const inlineStyle = {
|
|
5900
|
-
...width !== void 0 ? { width: typeof width === "number" ? width : width } : {},
|
|
5901
|
-
...height !== void 0 ? { height: typeof height === "number" ? height : height } : {},
|
|
5902
|
-
...style
|
|
5903
|
-
};
|
|
5904
|
-
if (variant === "text" && !height) {
|
|
5905
|
-
}
|
|
5906
|
-
if (variant === "circular" && !width && !height) {
|
|
5907
|
-
inlineStyle.width = 40;
|
|
5908
|
-
inlineStyle.height = 40;
|
|
5909
|
-
}
|
|
5910
|
-
if (variant === "rectangular" && !height) {
|
|
5911
|
-
inlineStyle.height = 140;
|
|
5912
|
-
}
|
|
5913
|
-
if (variant === "rounded" && !height) {
|
|
5914
|
-
inlineStyle.height = 140;
|
|
5915
|
-
}
|
|
5916
|
-
return /* @__PURE__ */ React86.createElement(
|
|
5917
|
-
"span",
|
|
5918
|
-
{
|
|
5919
|
-
className: classes,
|
|
5920
|
-
style: Object.keys(inlineStyle).length > 0 ? inlineStyle : void 0,
|
|
5921
|
-
"aria-busy": "true",
|
|
5922
|
-
"aria-live": "polite"
|
|
5923
|
-
}
|
|
5924
|
-
);
|
|
5925
|
-
};
|
|
5926
|
-
Skeleton.displayName = "Skeleton";
|
|
5927
|
-
|
|
5928
|
-
// lib/Tooltip/Tooltip.tsx
|
|
5929
|
-
import React87, {
|
|
5930
|
-
useCallback as useCallback5,
|
|
5931
|
-
useEffect as useEffect11,
|
|
5932
|
-
useRef as useRef14,
|
|
5933
|
-
useState as useState13
|
|
5934
|
-
} from "react";
|
|
5935
|
-
import ReactDOM4 from "react-dom";
|
|
5936
|
-
var GAP = 8;
|
|
5937
|
-
function computePosition(anchor, tooltip, placement) {
|
|
5938
|
-
const { top: aTop, left: aLeft, width: aW, height: aH } = anchor;
|
|
5939
|
-
const { width: tW, height: tH } = tooltip;
|
|
5940
|
-
let top = 0;
|
|
5941
|
-
let left = 0;
|
|
5942
|
-
let arrowLeft;
|
|
5943
|
-
let arrowTop;
|
|
5944
|
-
switch (placement) {
|
|
5945
|
-
case "top":
|
|
5946
|
-
top = aTop - tH - GAP;
|
|
5947
|
-
left = aLeft + aW / 2 - tW / 2;
|
|
5948
|
-
arrowLeft = tW / 2 - 4;
|
|
5949
|
-
break;
|
|
5950
|
-
case "top-start":
|
|
5951
|
-
top = aTop - tH - GAP;
|
|
5952
|
-
left = aLeft;
|
|
5953
|
-
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
5954
|
-
break;
|
|
5955
|
-
case "top-end":
|
|
5956
|
-
top = aTop - tH - GAP;
|
|
5957
|
-
left = aLeft + aW - tW;
|
|
5958
|
-
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
5959
|
-
break;
|
|
5960
|
-
case "bottom":
|
|
5961
|
-
top = aTop + aH + GAP;
|
|
5962
|
-
left = aLeft + aW / 2 - tW / 2;
|
|
5963
|
-
arrowLeft = tW / 2 - 4;
|
|
5964
|
-
break;
|
|
5965
|
-
case "bottom-start":
|
|
5966
|
-
top = aTop + aH + GAP;
|
|
5967
|
-
left = aLeft;
|
|
5968
|
-
arrowLeft = Math.min(aW / 2, tW - 16);
|
|
5969
|
-
break;
|
|
5970
|
-
case "bottom-end":
|
|
5971
|
-
top = aTop + aH + GAP;
|
|
5972
|
-
left = aLeft + aW - tW;
|
|
5973
|
-
arrowLeft = Math.max(tW - aW / 2 - 4, 8);
|
|
5974
|
-
break;
|
|
5975
|
-
case "left":
|
|
5976
|
-
top = aTop + aH / 2 - tH / 2;
|
|
5977
|
-
left = aLeft - tW - GAP;
|
|
5978
|
-
arrowTop = tH / 2 - 4;
|
|
5979
|
-
break;
|
|
5980
|
-
case "left-start":
|
|
5981
|
-
top = aTop;
|
|
5982
|
-
left = aLeft - tW - GAP;
|
|
5983
|
-
arrowTop = Math.min(aH / 2, tH - 16);
|
|
5984
|
-
break;
|
|
5985
|
-
case "left-end":
|
|
5986
|
-
top = aTop + aH - tH;
|
|
5987
|
-
left = aLeft - tW - GAP;
|
|
5988
|
-
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
5989
|
-
break;
|
|
5990
|
-
case "right":
|
|
5991
|
-
top = aTop + aH / 2 - tH / 2;
|
|
5992
|
-
left = aLeft + aW + GAP;
|
|
5993
|
-
arrowTop = tH / 2 - 4;
|
|
5994
|
-
break;
|
|
5995
|
-
case "right-start":
|
|
5996
|
-
top = aTop;
|
|
5997
|
-
left = aLeft + aW + GAP;
|
|
5998
|
-
arrowTop = Math.min(aH / 2, tH - 16);
|
|
5999
|
-
break;
|
|
6000
|
-
case "right-end":
|
|
6001
|
-
top = aTop + aH - tH;
|
|
6002
|
-
left = aLeft + aW + GAP;
|
|
6003
|
-
arrowTop = Math.max(tH - aH / 2 - 4, 8);
|
|
6004
|
-
break;
|
|
6005
|
-
default:
|
|
6006
|
-
top = aTop - tH - GAP;
|
|
6007
|
-
left = aLeft + aW / 2 - tW / 2;
|
|
6008
|
-
}
|
|
6009
|
-
const vw = window.innerWidth;
|
|
6010
|
-
const vh = window.innerHeight;
|
|
6011
|
-
left = Math.max(8, Math.min(left, vw - tW - 8));
|
|
6012
|
-
top = Math.max(8, Math.min(top, vh - tH - 8));
|
|
6013
|
-
return { top, left, arrowLeft, arrowTop };
|
|
6014
|
-
}
|
|
6015
|
-
var Tooltip = ({
|
|
6016
|
-
title,
|
|
6017
|
-
placement = "top",
|
|
6018
|
-
arrow = false,
|
|
6019
|
-
open: controlledOpen,
|
|
6020
|
-
disableHoverListener = false,
|
|
6021
|
-
disableFocusListener = false,
|
|
6022
|
-
enterDelay = 100,
|
|
6023
|
-
leaveDelay = 0,
|
|
6041
|
+
subtitle2: "h6",
|
|
6042
|
+
body1: "p",
|
|
6043
|
+
body2: "p",
|
|
6044
|
+
caption: "span",
|
|
6045
|
+
overline: "span",
|
|
6046
|
+
button: "span"
|
|
6047
|
+
};
|
|
6048
|
+
var COLOR_CLASSES = {
|
|
6049
|
+
primary: "rf-typography--color-primary",
|
|
6050
|
+
secondary: "rf-typography--color-secondary",
|
|
6051
|
+
textPrimary: "rf-typography--color-textPrimary",
|
|
6052
|
+
textSecondary: "rf-typography--color-textSecondary",
|
|
6053
|
+
error: "rf-typography--color-error"
|
|
6054
|
+
};
|
|
6055
|
+
var WEIGHT_CLASSES = {
|
|
6056
|
+
light: "rf-typography--weight-light",
|
|
6057
|
+
regular: "rf-typography--weight-regular",
|
|
6058
|
+
medium: "rf-typography--weight-medium",
|
|
6059
|
+
bold: "rf-typography--weight-bold"
|
|
6060
|
+
};
|
|
6061
|
+
var Typography = ({
|
|
6062
|
+
variant = "body1",
|
|
6063
|
+
component,
|
|
6064
|
+
align = "inherit",
|
|
6065
|
+
color,
|
|
6066
|
+
noWrap = false,
|
|
6067
|
+
gutterBottom = false,
|
|
6068
|
+
paragraph = false,
|
|
6069
|
+
fontWeight,
|
|
6024
6070
|
children,
|
|
6025
|
-
followCursor = false,
|
|
6026
6071
|
className = "",
|
|
6027
6072
|
style,
|
|
6028
6073
|
sx
|
|
6029
6074
|
}) => {
|
|
6030
6075
|
const sxClass = useSx(sx);
|
|
6031
|
-
const [
|
|
6032
|
-
const
|
|
6033
|
-
const
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
const clearTimers = useCallback5(() => {
|
|
6040
|
-
if (enterTimer.current) clearTimeout(enterTimer.current);
|
|
6041
|
-
if (leaveTimer.current) clearTimeout(leaveTimer.current);
|
|
6042
|
-
}, []);
|
|
6043
|
-
const updatePosition = useCallback5(() => {
|
|
6044
|
-
if (!anchorRef.current || !tooltipRef.current) return;
|
|
6045
|
-
const anchorRect = anchorRef.current.getBoundingClientRect();
|
|
6046
|
-
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
6047
|
-
if (followCursor) {
|
|
6048
|
-
const fakeRect = {
|
|
6049
|
-
top: cursorPos.current.y,
|
|
6050
|
-
left: cursorPos.current.x,
|
|
6051
|
-
right: cursorPos.current.x,
|
|
6052
|
-
bottom: cursorPos.current.y,
|
|
6053
|
-
width: 0,
|
|
6054
|
-
height: 0,
|
|
6055
|
-
x: cursorPos.current.x,
|
|
6056
|
-
y: cursorPos.current.y,
|
|
6057
|
-
toJSON: () => ({})
|
|
6058
|
-
};
|
|
6059
|
-
setPosition(computePosition(fakeRect, tooltipRect, placement));
|
|
6060
|
-
} else {
|
|
6061
|
-
setPosition(computePosition(anchorRect, tooltipRect, placement));
|
|
6062
|
-
}
|
|
6063
|
-
}, [placement, followCursor]);
|
|
6064
|
-
useEffect11(() => {
|
|
6065
|
-
if (isOpen) {
|
|
6066
|
-
requestAnimationFrame(() => {
|
|
6067
|
-
updatePosition();
|
|
6068
|
-
});
|
|
6069
|
-
}
|
|
6070
|
-
}, [isOpen, updatePosition]);
|
|
6071
|
-
const handleOpen = useCallback5(() => {
|
|
6072
|
-
clearTimers();
|
|
6073
|
-
if (enterDelay > 0) {
|
|
6074
|
-
enterTimer.current = setTimeout(() => {
|
|
6075
|
-
setInternalOpen(true);
|
|
6076
|
-
}, enterDelay);
|
|
6077
|
-
} else {
|
|
6078
|
-
setInternalOpen(true);
|
|
6079
|
-
}
|
|
6080
|
-
}, [enterDelay, clearTimers]);
|
|
6081
|
-
const handleClose = useCallback5(() => {
|
|
6082
|
-
clearTimers();
|
|
6083
|
-
if (leaveDelay > 0) {
|
|
6084
|
-
leaveTimer.current = setTimeout(() => {
|
|
6085
|
-
setInternalOpen(false);
|
|
6086
|
-
}, leaveDelay);
|
|
6076
|
+
const Tag = component || (paragraph ? "p" : VARIANT_ELEMENT_MAP[variant] || "span");
|
|
6077
|
+
const colorClass = color ? COLOR_CLASSES[color] : "";
|
|
6078
|
+
const colorStyle = color && !COLOR_CLASSES[color] ? { color } : {};
|
|
6079
|
+
let weightClass = "";
|
|
6080
|
+
let weightStyle = {};
|
|
6081
|
+
if (fontWeight !== void 0) {
|
|
6082
|
+
if (typeof fontWeight === "string") {
|
|
6083
|
+
weightClass = WEIGHT_CLASSES[fontWeight] || "";
|
|
6087
6084
|
} else {
|
|
6088
|
-
|
|
6085
|
+
weightStyle = { fontWeight };
|
|
6089
6086
|
}
|
|
6090
|
-
}, [leaveDelay, clearTimers]);
|
|
6091
|
-
const handleMouseMove = useCallback5(
|
|
6092
|
-
(e) => {
|
|
6093
|
-
cursorPos.current = { x: e.clientX, y: e.clientY };
|
|
6094
|
-
if (isOpen && followCursor) {
|
|
6095
|
-
updatePosition();
|
|
6096
|
-
}
|
|
6097
|
-
},
|
|
6098
|
-
[isOpen, followCursor, updatePosition]
|
|
6099
|
-
);
|
|
6100
|
-
useEffect11(() => {
|
|
6101
|
-
return () => clearTimers();
|
|
6102
|
-
}, [clearTimers]);
|
|
6103
|
-
const childProps = {};
|
|
6104
|
-
if (!disableHoverListener) {
|
|
6105
|
-
childProps.onMouseEnter = handleOpen;
|
|
6106
|
-
childProps.onMouseLeave = handleClose;
|
|
6107
|
-
childProps.onMouseMove = followCursor ? handleMouseMove : void 0;
|
|
6108
|
-
}
|
|
6109
|
-
if (!disableFocusListener) {
|
|
6110
|
-
childProps.onFocus = handleOpen;
|
|
6111
|
-
childProps.onBlur = handleClose;
|
|
6112
6087
|
}
|
|
6113
|
-
const
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6088
|
+
const alignClass = align !== "inherit" ? `rf-typography--align-${align}` : "";
|
|
6089
|
+
const classes = [
|
|
6090
|
+
"rf-typography",
|
|
6091
|
+
`rf-typography--${variant}`,
|
|
6092
|
+
alignClass,
|
|
6093
|
+
colorClass,
|
|
6094
|
+
weightClass,
|
|
6095
|
+
noWrap ? "rf-typography--no-wrap" : "",
|
|
6096
|
+
gutterBottom ? "rf-typography--gutter-bottom" : "",
|
|
6097
|
+
paragraph ? "rf-typography--paragraph" : "",
|
|
6117
6098
|
sxClass,
|
|
6118
6099
|
className
|
|
6119
6100
|
].filter(Boolean).join(" ");
|
|
6120
|
-
const
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6101
|
+
const inlineStyle = {
|
|
6102
|
+
...colorStyle,
|
|
6103
|
+
...weightStyle,
|
|
6104
|
+
...style
|
|
6105
|
+
};
|
|
6106
|
+
return /* @__PURE__ */ React86.createElement(Tag, { className: classes, style: Object.keys(inlineStyle).length > 0 ? inlineStyle : void 0 }, children);
|
|
6107
|
+
};
|
|
6108
|
+
Typography.displayName = "Typography";
|
|
6109
|
+
|
|
6110
|
+
// lib/Skeleton/Skeleton.tsx
|
|
6111
|
+
import React87 from "react";
|
|
6112
|
+
var Skeleton = ({
|
|
6113
|
+
variant = "text",
|
|
6114
|
+
width,
|
|
6115
|
+
height,
|
|
6116
|
+
animation = "pulse",
|
|
6117
|
+
className = "",
|
|
6118
|
+
style,
|
|
6119
|
+
sx
|
|
6120
|
+
}) => {
|
|
6121
|
+
const sxClass = useSx(sx);
|
|
6122
|
+
const animationClass = animation === "pulse" ? "rf-skeleton--pulse" : animation === "wave" ? "rf-skeleton--wave" : "rf-skeleton--no-animation";
|
|
6123
|
+
const classes = [
|
|
6124
|
+
"rf-skeleton",
|
|
6125
|
+
`rf-skeleton--${variant}`,
|
|
6126
|
+
animationClass,
|
|
6127
|
+
sxClass,
|
|
6128
|
+
className
|
|
6129
|
+
].filter(Boolean).join(" ");
|
|
6130
|
+
const inlineStyle = {
|
|
6131
|
+
...width !== void 0 ? { width: typeof width === "number" ? width : width } : {},
|
|
6132
|
+
...height !== void 0 ? { height: typeof height === "number" ? height : height } : {},
|
|
6133
|
+
...style
|
|
6134
|
+
};
|
|
6135
|
+
if (variant === "text" && !height) {
|
|
6136
|
+
}
|
|
6137
|
+
if (variant === "circular" && !width && !height) {
|
|
6138
|
+
inlineStyle.width = 40;
|
|
6139
|
+
inlineStyle.height = 40;
|
|
6140
|
+
}
|
|
6141
|
+
if (variant === "rectangular" && !height) {
|
|
6142
|
+
inlineStyle.height = 140;
|
|
6143
|
+
}
|
|
6144
|
+
if (variant === "rounded" && !height) {
|
|
6145
|
+
inlineStyle.height = 140;
|
|
6146
|
+
}
|
|
6147
|
+
return /* @__PURE__ */ React87.createElement(
|
|
6146
6148
|
"span",
|
|
6147
6149
|
{
|
|
6148
|
-
|
|
6149
|
-
style:
|
|
6150
|
-
"aria-
|
|
6151
|
-
|
|
6152
|
-
}
|
|
6153
|
-
|
|
6154
|
-
), ReactDOM4.createPortal(tooltipElement, document.body));
|
|
6150
|
+
className: classes,
|
|
6151
|
+
style: Object.keys(inlineStyle).length > 0 ? inlineStyle : void 0,
|
|
6152
|
+
"aria-busy": "true",
|
|
6153
|
+
"aria-live": "polite"
|
|
6154
|
+
}
|
|
6155
|
+
);
|
|
6155
6156
|
};
|
|
6156
|
-
|
|
6157
|
+
Skeleton.displayName = "Skeleton";
|
|
6157
6158
|
|
|
6158
6159
|
// lib/Box/Box.tsx
|
|
6159
6160
|
import * as React88 from "react";
|
|
@@ -8646,7 +8647,7 @@ var TextToSpeech = forwardRef12(({ editor, onTextToSpeech }, ref) => {
|
|
|
8646
8647
|
setPaused(false);
|
|
8647
8648
|
}, []);
|
|
8648
8649
|
useImperativeHandle2(ref, () => ({ stop: handleStop }), [handleStop]);
|
|
8649
|
-
return /* @__PURE__ */ React107.createElement("div", { className: "tts-wrapper", ref: panelRef }, /* @__PURE__ */ React107.createElement(
|
|
8650
|
+
return /* @__PURE__ */ React107.createElement("div", { className: "tts-wrapper", ref: panelRef }, /* @__PURE__ */ React107.createElement(Tooltip, { title: "Text to Speech", placement: "top" }, /* @__PURE__ */ React107.createElement(
|
|
8650
8651
|
"button",
|
|
8651
8652
|
{
|
|
8652
8653
|
className: `toolbar-btn ${speaking ? "is-active" : ""}`,
|
|
@@ -8656,11 +8657,10 @@ var TextToSpeech = forwardRef12(({ editor, onTextToSpeech }, ref) => {
|
|
|
8656
8657
|
} else {
|
|
8657
8658
|
setShowPanel(!showPanel);
|
|
8658
8659
|
}
|
|
8659
|
-
}
|
|
8660
|
-
title: "Text to Speech"
|
|
8660
|
+
}
|
|
8661
8661
|
},
|
|
8662
8662
|
speaking ? "\u23F9" : "\u{1F50A}"
|
|
8663
|
-
), showPanel && !speaking && /* @__PURE__ */ React107.createElement("div", { className: "tts-panel" }, /* @__PURE__ */ React107.createElement("div", { className: "tts-panel-header" }, "Text to Speech"), /* @__PURE__ */ React107.createElement("label", { className: "tts-label" }, "Voice"), /* @__PURE__ */ React107.createElement(
|
|
8663
|
+
)), showPanel && !speaking && /* @__PURE__ */ React107.createElement("div", { className: "tts-panel" }, /* @__PURE__ */ React107.createElement("div", { className: "tts-panel-header" }, "Text to Speech"), /* @__PURE__ */ React107.createElement("label", { className: "tts-label" }, "Voice"), /* @__PURE__ */ React107.createElement(
|
|
8664
8664
|
"select",
|
|
8665
8665
|
{
|
|
8666
8666
|
className: "tts-select",
|
|
@@ -8682,7 +8682,7 @@ var TextToSpeech = forwardRef12(({ editor, onTextToSpeech }, ref) => {
|
|
|
8682
8682
|
), /* @__PURE__ */ React107.createElement("div", { className: "tts-info" }, editor && !editor.state.selection.empty ? "Will read selected text" : "Will read all editor text"), /* @__PURE__ */ React107.createElement("button", { className: "tts-speak-btn", onClick: () => {
|
|
8683
8683
|
handleSpeak();
|
|
8684
8684
|
setShowPanel(false);
|
|
8685
|
-
} }, "\u25B6 Speak")), speaking && /* @__PURE__ */ React107.createElement("div", { className: "tts-controls" }, paused ? /* @__PURE__ */ React107.createElement("button", { className: "toolbar-btn", onClick: handleResume, title: "
|
|
8685
|
+
} }, "\u25B6 Speak")), speaking && /* @__PURE__ */ React107.createElement("div", { className: "tts-controls" }, paused ? /* @__PURE__ */ React107.createElement(Tooltip, { title: "Resume", placement: "top" }, /* @__PURE__ */ React107.createElement("button", { className: "toolbar-btn", onClick: handleResume }, "\u25B6")) : /* @__PURE__ */ React107.createElement(Tooltip, { title: "Pause", placement: "top" }, /* @__PURE__ */ React107.createElement("button", { className: "toolbar-btn", onClick: handlePause }, "\u275A\u275A")), /* @__PURE__ */ React107.createElement(Tooltip, { title: "Stop", placement: "top" }, /* @__PURE__ */ React107.createElement("button", { className: "toolbar-btn", onClick: handleStop }, "\u25A0"))));
|
|
8686
8686
|
});
|
|
8687
8687
|
var TextToSpeech_default = TextToSpeech;
|
|
8688
8688
|
|
|
@@ -8801,7 +8801,7 @@ var SpeechToText = forwardRef13(({ editor, onSpeechToText }, ref) => {
|
|
|
8801
8801
|
}, []);
|
|
8802
8802
|
useImperativeHandle3(ref, () => ({ stop: stopListening }), [stopListening]);
|
|
8803
8803
|
if (!supported) {
|
|
8804
|
-
return /* @__PURE__ */ React108.createElement(
|
|
8804
|
+
return /* @__PURE__ */ React108.createElement(Tooltip, { title: "Speech recognition not supported in this browser", placement: "top" }, /* @__PURE__ */ React108.createElement("button", { className: "toolbar-btn", disabled: true }, "\u{1F3A4}"));
|
|
8805
8805
|
}
|
|
8806
8806
|
const LANGUAGES2 = [
|
|
8807
8807
|
{ code: "en-US", label: "English (US)" },
|
|
@@ -8823,7 +8823,7 @@ var SpeechToText = forwardRef13(({ editor, onSpeechToText }, ref) => {
|
|
|
8823
8823
|
{ code: "kn-IN", label: "Kannada" },
|
|
8824
8824
|
{ code: "ml-IN", label: "Malayalam" }
|
|
8825
8825
|
];
|
|
8826
|
-
return /* @__PURE__ */ React108.createElement("div", { className: "stt-wrapper", ref: panelRef }, /* @__PURE__ */ React108.createElement(
|
|
8826
|
+
return /* @__PURE__ */ React108.createElement("div", { className: "stt-wrapper", ref: panelRef }, /* @__PURE__ */ React108.createElement(Tooltip, { title: listening ? "Stop recording" : "Speech to Text", placement: "top" }, /* @__PURE__ */ React108.createElement(
|
|
8827
8827
|
"button",
|
|
8828
8828
|
{
|
|
8829
8829
|
className: `toolbar-btn ${listening ? "is-active stt-recording" : ""}`,
|
|
@@ -8833,11 +8833,10 @@ var SpeechToText = forwardRef13(({ editor, onSpeechToText }, ref) => {
|
|
|
8833
8833
|
} else {
|
|
8834
8834
|
setShowPanel(!showPanel);
|
|
8835
8835
|
}
|
|
8836
|
-
}
|
|
8837
|
-
title: listening ? "Stop recording" : "Speech to Text"
|
|
8836
|
+
}
|
|
8838
8837
|
},
|
|
8839
8838
|
"\u{1F3A4}"
|
|
8840
|
-
), showPanel && !listening && /* @__PURE__ */ React108.createElement("div", { className: "stt-panel" }, /* @__PURE__ */ React108.createElement("div", { className: "stt-panel-header" }, "Speech to Text"), /* @__PURE__ */ React108.createElement("label", { className: "stt-label" }, "Language"), /* @__PURE__ */ React108.createElement(
|
|
8839
|
+
)), showPanel && !listening && /* @__PURE__ */ React108.createElement("div", { className: "stt-panel" }, /* @__PURE__ */ React108.createElement("div", { className: "stt-panel-header" }, "Speech to Text"), /* @__PURE__ */ React108.createElement("label", { className: "stt-label" }, "Language"), /* @__PURE__ */ React108.createElement(
|
|
8841
8840
|
"select",
|
|
8842
8841
|
{
|
|
8843
8842
|
className: "stt-select",
|
|
@@ -8991,16 +8990,15 @@ var AICommands = ({ editor, onAICommand }) => {
|
|
|
8991
8990
|
setPreviousResults([]);
|
|
8992
8991
|
}, []);
|
|
8993
8992
|
if (!editor) return null;
|
|
8994
|
-
return /* @__PURE__ */ React109.createElement(React109.Fragment, null, /* @__PURE__ */ React109.createElement("div", { className: "ai-commands-wrapper", ref: panelRef }, /* @__PURE__ */ React109.createElement(
|
|
8993
|
+
return /* @__PURE__ */ React109.createElement(React109.Fragment, null, /* @__PURE__ */ React109.createElement("div", { className: "ai-commands-wrapper", ref: panelRef }, /* @__PURE__ */ React109.createElement(Tooltip, { title: "AI Commands", placement: "top" }, /* @__PURE__ */ React109.createElement(
|
|
8995
8994
|
"button",
|
|
8996
8995
|
{
|
|
8997
8996
|
className: `toolbar-btn ${open ? "is-active" : ""}`,
|
|
8998
|
-
onClick: () => setOpen(!open)
|
|
8999
|
-
title: "AI Commands"
|
|
8997
|
+
onClick: () => setOpen(!open)
|
|
9000
8998
|
},
|
|
9001
8999
|
/* @__PURE__ */ React109.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", stroke: "none" }, /* @__PURE__ */ React109.createElement("path", { d: "M9 2l1.5 3L14 6.5 10.5 8 9 11 7.5 8 4 6.5 7.5 5zM18 10l1 2 2 1-2 1-1 2-1-2-2-1 2-1zM5 17l1.5 3L10 21.5 6.5 23 5 26 3.5 23 0 21.5 3.5 20z" })),
|
|
9002
9000
|
/* @__PURE__ */ React109.createElement("span", { className: "dropdown-arrow" }, "\u25BE")
|
|
9003
|
-
), open && /* @__PURE__ */ React109.createElement("div", { className: "ai-commands-panel" }, /* @__PURE__ */ React109.createElement("div", { className: "ai-commands-header" }, "AI Commands"), /* @__PURE__ */ React109.createElement("div", { className: "ai-commands-list" }, AI_COMMANDS.map((cmd) => /* @__PURE__ */ React109.createElement(
|
|
9001
|
+
)), open && /* @__PURE__ */ React109.createElement("div", { className: "ai-commands-panel" }, /* @__PURE__ */ React109.createElement("div", { className: "ai-commands-header" }, "AI Commands"), /* @__PURE__ */ React109.createElement("div", { className: "ai-commands-list" }, AI_COMMANDS.map((cmd) => /* @__PURE__ */ React109.createElement(
|
|
9004
9002
|
"button",
|
|
9005
9003
|
{
|
|
9006
9004
|
key: cmd.id,
|
|
@@ -9017,16 +9015,15 @@ var AICommands = ({ editor, onAICommand }) => {
|
|
|
9017
9015
|
onChange: (e) => setPromptText(e.target.value),
|
|
9018
9016
|
rows: 3
|
|
9019
9017
|
}
|
|
9020
|
-
), /* @__PURE__ */ React109.createElement(
|
|
9018
|
+
), /* @__PURE__ */ React109.createElement(Tooltip, { title: "Run with custom prompt", placement: "top" }, /* @__PURE__ */ React109.createElement(
|
|
9021
9019
|
"button",
|
|
9022
9020
|
{
|
|
9023
9021
|
className: "ai-modal-robot-btn",
|
|
9024
9022
|
onClick: () => fetchAIResult(promptText, originalText),
|
|
9025
|
-
disabled: loading
|
|
9026
|
-
title: "Run with custom prompt"
|
|
9023
|
+
disabled: loading
|
|
9027
9024
|
},
|
|
9028
9025
|
/* @__PURE__ */ React109.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React109.createElement("rect", { x: "3", y: "11", width: "18", height: "10", rx: "2" }), /* @__PURE__ */ React109.createElement("circle", { cx: "9", cy: "16", r: "1" }), /* @__PURE__ */ React109.createElement("circle", { cx: "15", cy: "16", r: "1" }), /* @__PURE__ */ React109.createElement("path", { d: "M12 2v4" }), /* @__PURE__ */ React109.createElement("path", { d: "M8 7h8" }))
|
|
9029
|
-
))), /* @__PURE__ */ React109.createElement("div", { className: "ai-modal-actions" }, /* @__PURE__ */ React109.createElement(
|
|
9026
|
+
)))), /* @__PURE__ */ React109.createElement("div", { className: "ai-modal-actions" }, /* @__PURE__ */ React109.createElement(
|
|
9030
9027
|
"button",
|
|
9031
9028
|
{
|
|
9032
9029
|
className: "ai-modal-action-btn ai-modal-insert-btn",
|
|
@@ -9042,16 +9039,15 @@ var AICommands = ({ editor, onAICommand }) => {
|
|
|
9042
9039
|
disabled: loading || !resultText
|
|
9043
9040
|
},
|
|
9044
9041
|
"Insert After"
|
|
9045
|
-
), /* @__PURE__ */ React109.createElement(
|
|
9042
|
+
), /* @__PURE__ */ React109.createElement(Tooltip, { title: "Generate another response", placement: "top" }, /* @__PURE__ */ React109.createElement(
|
|
9046
9043
|
"button",
|
|
9047
9044
|
{
|
|
9048
9045
|
className: "ai-modal-action-btn ai-modal-refresh-btn",
|
|
9049
9046
|
onClick: handleRefresh,
|
|
9050
|
-
disabled: loading
|
|
9051
|
-
title: "Generate another response"
|
|
9047
|
+
disabled: loading
|
|
9052
9048
|
},
|
|
9053
9049
|
/* @__PURE__ */ React109.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React109.createElement("path", { d: "M21 2v6h-6" }), /* @__PURE__ */ React109.createElement("path", { d: "M3 12a9 9 0 0 1 15-6.7L21 8" }), /* @__PURE__ */ React109.createElement("path", { d: "M3 22v-6h6" }), /* @__PURE__ */ React109.createElement("path", { d: "M21 12a9 9 0 0 1-15 6.7L3 16" }))
|
|
9054
|
-
)), /* @__PURE__ */ React109.createElement("div", { className: "ai-modal-result-section" }, loading ? /* @__PURE__ */ React109.createElement("div", { className: "ai-modal-loading" }, /* @__PURE__ */ React109.createElement("span", { className: "ai-spinner" }), /* @__PURE__ */ React109.createElement("span", null, "Generating response...")) : /* @__PURE__ */ React109.createElement("div", { className: "ai-modal-result" }, resultText)), /* @__PURE__ */ React109.createElement("div", { className: "ai-modal-footer" }, /* @__PURE__ */ React109.createElement("button", { className: "ai-modal-cancel-btn", onClick: handleCancel }, "CANCEL")))),
|
|
9050
|
+
))), /* @__PURE__ */ React109.createElement("div", { className: "ai-modal-result-section" }, loading ? /* @__PURE__ */ React109.createElement("div", { className: "ai-modal-loading" }, /* @__PURE__ */ React109.createElement("span", { className: "ai-spinner" }), /* @__PURE__ */ React109.createElement("span", null, "Generating response...")) : /* @__PURE__ */ React109.createElement("div", { className: "ai-modal-result" }, resultText)), /* @__PURE__ */ React109.createElement("div", { className: "ai-modal-footer" }, /* @__PURE__ */ React109.createElement("button", { className: "ai-modal-cancel-btn", onClick: handleCancel }, "CANCEL")))),
|
|
9055
9051
|
document.body
|
|
9056
9052
|
));
|
|
9057
9053
|
};
|
|
@@ -9269,7 +9265,7 @@ var TranslateModal = ({ editor, onClose, onTranslate, initialSource, initialTarg
|
|
|
9269
9265
|
},
|
|
9270
9266
|
/* @__PURE__ */ React110.createElement("span", { className: "translate-code" }, lang.code),
|
|
9271
9267
|
/* @__PURE__ */ React110.createElement("span", { className: "translate-name" }, lang.name)
|
|
9272
|
-
)))), /* @__PURE__ */ React110.createElement("div", { className: "translate-swap" }, /* @__PURE__ */ React110.createElement("button", { className: "translate-swap-btn", onClick: handleSwap
|
|
9268
|
+
)))), /* @__PURE__ */ React110.createElement("div", { className: "translate-swap" }, /* @__PURE__ */ React110.createElement(Tooltip, { title: "Swap languages", placement: "top" }, /* @__PURE__ */ React110.createElement("button", { className: "translate-swap-btn", onClick: handleSwap }, "\u21C4"))), /* @__PURE__ */ React110.createElement("div", { className: "translate-col" }, /* @__PURE__ */ React110.createElement("div", { className: "translate-filter" }, /* @__PURE__ */ React110.createElement(
|
|
9273
9269
|
"input",
|
|
9274
9270
|
{
|
|
9275
9271
|
type: "text",
|
|
@@ -10151,16 +10147,15 @@ var Dropdown = ({ trigger, children, className = "", keepOpen = false }) => {
|
|
|
10151
10147
|
};
|
|
10152
10148
|
position();
|
|
10153
10149
|
}, [open]);
|
|
10154
|
-
return /* @__PURE__ */ React112.createElement("div", { className: `dropdown ${className}`, ref }, /* @__PURE__ */ React112.createElement(
|
|
10150
|
+
return /* @__PURE__ */ React112.createElement("div", { className: `dropdown ${className}`, ref }, /* @__PURE__ */ React112.createElement(Tooltip, { title: trigger.title || "", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10155
10151
|
"button",
|
|
10156
10152
|
{
|
|
10157
10153
|
className: `toolbar-btn ${trigger.className || ""}`,
|
|
10158
|
-
onClick: () => setOpen(!open)
|
|
10159
|
-
title: trigger.title
|
|
10154
|
+
onClick: () => setOpen(!open)
|
|
10160
10155
|
},
|
|
10161
10156
|
trigger.label,
|
|
10162
10157
|
/* @__PURE__ */ React112.createElement("span", { className: "dropdown-arrow" }, "\u25BE")
|
|
10163
|
-
), open && createPortal4(
|
|
10158
|
+
)), open && createPortal4(
|
|
10164
10159
|
/* @__PURE__ */ React112.createElement("div", { className: "rf-rte-wrapper rf-rte-dropdown-portal" }, /* @__PURE__ */ React112.createElement("div", { ref: menuRef, className: "dropdown-menu dropdown-menu-fixed", onClick: keepOpen ? void 0 : () => setOpen(false) }, typeof children === "function" ? children(() => setOpen(false)) : children)),
|
|
10165
10160
|
document.body
|
|
10166
10161
|
));
|
|
@@ -10406,16 +10401,14 @@ var ColorPickerPanel = ({ editor, onClose }) => {
|
|
|
10406
10401
|
onClick: () => setTab("text")
|
|
10407
10402
|
},
|
|
10408
10403
|
"Text"
|
|
10409
|
-
)), /* @__PURE__ */ React112.createElement("div", { className: "color-picker-grid" }, COLOR_PALETTE.map((color, i) => /* @__PURE__ */ React112.createElement(
|
|
10404
|
+
)), /* @__PURE__ */ React112.createElement("div", { className: "color-picker-grid" }, COLOR_PALETTE.map((color, i) => /* @__PURE__ */ React112.createElement(Tooltip, { key: i, title: color, placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10410
10405
|
"button",
|
|
10411
10406
|
{
|
|
10412
|
-
key: i,
|
|
10413
10407
|
className: `color-picker-swatch ${color === "#ffffff" ? "white-swatch" : ""}${activeColor && activeColor.toLowerCase() === color.toLowerCase() ? " swatch-active" : ""}`,
|
|
10414
10408
|
style: { background: color },
|
|
10415
|
-
onClick: () => applyColor(color)
|
|
10416
|
-
title: color
|
|
10409
|
+
onClick: () => applyColor(color)
|
|
10417
10410
|
}
|
|
10418
|
-
))), /* @__PURE__ */ React112.createElement("div", { className: "color-picker-footer" }, /* @__PURE__ */ React112.createElement("div", { className: "color-picker-preview", style: { background: activeColor || "#000" } }), /* @__PURE__ */ React112.createElement("button", { className: "color-picker-remove", onClick: removeColor
|
|
10411
|
+
)))), /* @__PURE__ */ React112.createElement("div", { className: "color-picker-footer" }, /* @__PURE__ */ React112.createElement("div", { className: "color-picker-preview", style: { background: activeColor || "#000" } }), /* @__PURE__ */ React112.createElement(Tooltip, { title: "Remove color", placement: "top" }, /* @__PURE__ */ React112.createElement("button", { className: "color-picker-remove", onClick: removeColor }, "\u2713"))));
|
|
10419
10412
|
};
|
|
10420
10413
|
var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTextToSpeech, onClose, onImageUpload, visibleButtons, isFullscreen, onToggleFullscreen }) => {
|
|
10421
10414
|
const [, setEditorState] = useState30(0);
|
|
@@ -10496,25 +10489,23 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10496
10489
|
setTimeout(() => setTranslateStatus(""), 2e3);
|
|
10497
10490
|
}, [editor, translateSource, translateTarget, onTranslate]);
|
|
10498
10491
|
if (!editor) return null;
|
|
10499
|
-
return /* @__PURE__ */ React112.createElement("div", { className: "toolbar" }, /* @__PURE__ */ React112.createElement("div", { className: `toolbar-row ${onClose ? "with-close" : ""}` }, (show("undo") || show("redo")) && /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, show("undo") && /* @__PURE__ */ React112.createElement(
|
|
10492
|
+
return /* @__PURE__ */ React112.createElement("div", { className: "toolbar" }, /* @__PURE__ */ React112.createElement("div", { className: `toolbar-row ${onClose ? "with-close" : ""}` }, (show("undo") || show("redo")) && /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, show("undo") && /* @__PURE__ */ React112.createElement(Tooltip, { title: "Undo (Ctrl+Z)", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10500
10493
|
"button",
|
|
10501
10494
|
{
|
|
10502
10495
|
className: "toolbar-btn",
|
|
10503
10496
|
onClick: () => editor.chain().focus().undo().run(),
|
|
10504
|
-
disabled: !editor.can().undo()
|
|
10505
|
-
title: "Undo (Ctrl+Z)"
|
|
10497
|
+
disabled: !editor.can().undo()
|
|
10506
10498
|
},
|
|
10507
10499
|
/* @__PURE__ */ React112.createElement(IconUndo, null)
|
|
10508
|
-
), show("redo") && /* @__PURE__ */ React112.createElement(
|
|
10500
|
+
)), show("redo") && /* @__PURE__ */ React112.createElement(Tooltip, { title: "Redo (Ctrl+Y)", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10509
10501
|
"button",
|
|
10510
10502
|
{
|
|
10511
10503
|
className: "toolbar-btn",
|
|
10512
10504
|
onClick: () => editor.chain().focus().redo().run(),
|
|
10513
|
-
disabled: !editor.can().redo()
|
|
10514
|
-
title: "Redo (Ctrl+Y)"
|
|
10505
|
+
disabled: !editor.can().redo()
|
|
10515
10506
|
},
|
|
10516
10507
|
/* @__PURE__ */ React112.createElement(IconRedo, null)
|
|
10517
|
-
)), show("ai") && /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, /* @__PURE__ */ React112.createElement(AICommands_default, { editor, onAICommand })), /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, show("paragraph") && /* @__PURE__ */ React112.createElement(
|
|
10508
|
+
))), show("ai") && /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, /* @__PURE__ */ React112.createElement(AICommands_default, { editor, onAICommand })), /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, show("paragraph") && /* @__PURE__ */ React112.createElement(
|
|
10518
10509
|
Dropdown,
|
|
10519
10510
|
{
|
|
10520
10511
|
trigger: {
|
|
@@ -10645,23 +10636,21 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10645
10636
|
keepOpen: true
|
|
10646
10637
|
},
|
|
10647
10638
|
(close) => /* @__PURE__ */ React112.createElement(ColorPickerPanel, { editor, onClose: close })
|
|
10648
|
-
), show("bold") && /* @__PURE__ */ React112.createElement(
|
|
10639
|
+
), show("bold") && /* @__PURE__ */ React112.createElement(Tooltip, { title: "Bold (Ctrl+B)", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10649
10640
|
"button",
|
|
10650
10641
|
{
|
|
10651
10642
|
className: `toolbar-btn ${editor.isActive("bold") ? "is-active" : ""}`,
|
|
10652
|
-
onClick: () => editor.chain().focus().toggleBold().run()
|
|
10653
|
-
title: "Bold (Ctrl+B)"
|
|
10643
|
+
onClick: () => editor.chain().focus().toggleBold().run()
|
|
10654
10644
|
},
|
|
10655
10645
|
/* @__PURE__ */ React112.createElement(IconBold, null)
|
|
10656
|
-
), show("italic") && /* @__PURE__ */ React112.createElement(
|
|
10646
|
+
)), show("italic") && /* @__PURE__ */ React112.createElement(Tooltip, { title: "Italic (Ctrl+I)", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10657
10647
|
"button",
|
|
10658
10648
|
{
|
|
10659
10649
|
className: `toolbar-btn ${editor.isActive("italic") ? "is-active" : ""}`,
|
|
10660
|
-
onClick: () => editor.chain().focus().toggleItalic().run()
|
|
10661
|
-
title: "Italic (Ctrl+I)"
|
|
10650
|
+
onClick: () => editor.chain().focus().toggleItalic().run()
|
|
10662
10651
|
},
|
|
10663
10652
|
/* @__PURE__ */ React112.createElement(IconItalic, null)
|
|
10664
|
-
), show("strike") && /* @__PURE__ */ React112.createElement(
|
|
10653
|
+
)), show("strike") && /* @__PURE__ */ React112.createElement(
|
|
10665
10654
|
Dropdown,
|
|
10666
10655
|
{
|
|
10667
10656
|
trigger: { label: /* @__PURE__ */ React112.createElement(IconStrike, null), title: "Text decoration", className: editor.isActive("strike") ? "is-active" : "" }
|
|
@@ -10686,15 +10675,14 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10686
10675
|
c.run();
|
|
10687
10676
|
}
|
|
10688
10677
|
} }, "\u2715 Clear formatting")
|
|
10689
|
-
), show("link") && /* @__PURE__ */ React112.createElement(
|
|
10678
|
+
), show("link") && /* @__PURE__ */ React112.createElement(Tooltip, { title: "Insert Link", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10690
10679
|
"button",
|
|
10691
10680
|
{
|
|
10692
10681
|
className: `toolbar-btn ${editor.isActive("link") ? "is-active" : ""}`,
|
|
10693
|
-
onClick: setLink
|
|
10694
|
-
title: "Insert Link"
|
|
10682
|
+
onClick: setLink
|
|
10695
10683
|
},
|
|
10696
10684
|
/* @__PURE__ */ React112.createElement(IconLink, null)
|
|
10697
|
-
), show("lineheight") && /* @__PURE__ */ React112.createElement(
|
|
10685
|
+
)), show("lineheight") && /* @__PURE__ */ React112.createElement(
|
|
10698
10686
|
Dropdown,
|
|
10699
10687
|
{
|
|
10700
10688
|
trigger: {
|
|
@@ -10721,15 +10709,14 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10721
10709
|
lh
|
|
10722
10710
|
);
|
|
10723
10711
|
})
|
|
10724
|
-
)), (show("ul") || show("ol")) && /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, show("ul") && /* @__PURE__ */ React112.createElement("div", { className: "list-split-btn" }, /* @__PURE__ */ React112.createElement(
|
|
10712
|
+
)), (show("ul") || show("ol")) && /* @__PURE__ */ React112.createElement("div", { className: "toolbar-group" }, show("ul") && /* @__PURE__ */ React112.createElement("div", { className: "list-split-btn" }, /* @__PURE__ */ React112.createElement(Tooltip, { title: editor.isActive("bulletList") ? "Disable Bullet List" : "Enable Bullet List", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10725
10713
|
"button",
|
|
10726
10714
|
{
|
|
10727
10715
|
className: `toolbar-btn ${editor.isActive("bulletList") ? "is-active" : ""}`,
|
|
10728
|
-
onClick: () => editor.chain().focus().toggleBulletList().run()
|
|
10729
|
-
title: editor.isActive("bulletList") ? "Disable Bullet List" : "Enable Bullet List"
|
|
10716
|
+
onClick: () => editor.chain().focus().toggleBulletList().run()
|
|
10730
10717
|
},
|
|
10731
10718
|
/* @__PURE__ */ React112.createElement(IconBulletList, null)
|
|
10732
|
-
), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "", title: "List style", className: "list-arrow-btn" }, keepOpen: true }, [
|
|
10719
|
+
)), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "", title: "List style", className: "list-arrow-btn" }, keepOpen: true }, [
|
|
10733
10720
|
{ label: "Default", style: null, icon: "\u2022" },
|
|
10734
10721
|
{ label: "Circle", style: "circle", icon: "\u25CB" },
|
|
10735
10722
|
{ label: "Dot", style: "disc", icon: "\u2219" },
|
|
@@ -10762,15 +10749,14 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10762
10749
|
/* @__PURE__ */ React112.createElement("span", { className: "bullet-style-icon" }, item.icon),
|
|
10763
10750
|
" ",
|
|
10764
10751
|
item.label
|
|
10765
|
-
)))), show("ol") && /* @__PURE__ */ React112.createElement("div", { className: "list-split-btn" }, /* @__PURE__ */ React112.createElement(
|
|
10752
|
+
)))), show("ol") && /* @__PURE__ */ React112.createElement("div", { className: "list-split-btn" }, /* @__PURE__ */ React112.createElement(Tooltip, { title: editor.isActive("orderedList") ? "Disable Ordered List" : "Enable Ordered List", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10766
10753
|
"button",
|
|
10767
10754
|
{
|
|
10768
10755
|
className: `toolbar-btn ${editor.isActive("orderedList") ? "is-active" : ""}`,
|
|
10769
|
-
onClick: () => editor.chain().focus().toggleOrderedList().run()
|
|
10770
|
-
title: editor.isActive("orderedList") ? "Disable Ordered List" : "Enable Ordered List"
|
|
10756
|
+
onClick: () => editor.chain().focus().toggleOrderedList().run()
|
|
10771
10757
|
},
|
|
10772
10758
|
/* @__PURE__ */ React112.createElement(IconOrderedList, null)
|
|
10773
|
-
), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "", title: "List style", className: "list-arrow-btn" }, keepOpen: true }, [
|
|
10759
|
+
)), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "", title: "List style", className: "list-arrow-btn" }, keepOpen: true }, [
|
|
10774
10760
|
{ label: "Default", style: "decimal", icon: "1." },
|
|
10775
10761
|
{ label: "Lower Alpha", style: "lower-alpha", icon: "a." },
|
|
10776
10762
|
{ label: "Lower Greek", style: "lower-greek", icon: "\u03B1." },
|
|
@@ -10830,7 +10816,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10830
10816
|
" ",
|
|
10831
10817
|
item.label
|
|
10832
10818
|
))
|
|
10833
|
-
), show("indent") && /* @__PURE__ */ React112.createElement(
|
|
10819
|
+
), show("indent") && /* @__PURE__ */ React112.createElement(Tooltip, { title: "Increase Indent", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10834
10820
|
"button",
|
|
10835
10821
|
{
|
|
10836
10822
|
className: "toolbar-btn",
|
|
@@ -10847,11 +10833,10 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10847
10833
|
});
|
|
10848
10834
|
return true;
|
|
10849
10835
|
}).run();
|
|
10850
|
-
}
|
|
10851
|
-
title: "Increase Indent"
|
|
10836
|
+
}
|
|
10852
10837
|
},
|
|
10853
10838
|
/* @__PURE__ */ React112.createElement(IconIndentIncrease, null)
|
|
10854
|
-
), show("outdent") && /* @__PURE__ */ React112.createElement(
|
|
10839
|
+
)), show("outdent") && /* @__PURE__ */ React112.createElement(Tooltip, { title: "Decrease Indent", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10855
10840
|
"button",
|
|
10856
10841
|
{
|
|
10857
10842
|
className: "toolbar-btn",
|
|
@@ -10868,35 +10853,31 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10868
10853
|
});
|
|
10869
10854
|
return true;
|
|
10870
10855
|
}).run();
|
|
10871
|
-
}
|
|
10872
|
-
title: "Decrease Indent"
|
|
10856
|
+
}
|
|
10873
10857
|
},
|
|
10874
10858
|
/* @__PURE__ */ React112.createElement(IconIndentDecrease, null)
|
|
10875
|
-
)), show("table") && /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: /* @__PURE__ */ React112.createElement(IconTable, null), title: "Insert Table" }, keepOpen: true }, (close) => /* @__PURE__ */ React112.createElement(TableGridSelector, { editor, onClose: close })), show("image") && /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: /* @__PURE__ */ React112.createElement(IconImage, null), title: "Insert Image" }, keepOpen: true }, (close) => /* @__PURE__ */ React112.createElement(ImagePanel, { editor, onClose: close, onImageUpload })), show("video") && /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: /* @__PURE__ */ React112.createElement(IconVideo, null), title: "Insert Video" }, keepOpen: true }, (close) => /* @__PURE__ */ React112.createElement(InsertPanel, { editor, onClose: close, mode: "video" })), show("cut") && /* @__PURE__ */ React112.createElement(
|
|
10859
|
+
))), show("table") && /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: /* @__PURE__ */ React112.createElement(IconTable, null), title: "Insert Table" }, keepOpen: true }, (close) => /* @__PURE__ */ React112.createElement(TableGridSelector, { editor, onClose: close })), show("image") && /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: /* @__PURE__ */ React112.createElement(IconImage, null), title: "Insert Image" }, keepOpen: true }, (close) => /* @__PURE__ */ React112.createElement(ImagePanel, { editor, onClose: close, onImageUpload })), show("video") && /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: /* @__PURE__ */ React112.createElement(IconVideo, null), title: "Insert Video" }, keepOpen: true }, (close) => /* @__PURE__ */ React112.createElement(InsertPanel, { editor, onClose: close, mode: "video" })), show("cut") && /* @__PURE__ */ React112.createElement(Tooltip, { title: "Cut (Ctrl+X)", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10876
10860
|
"button",
|
|
10877
10861
|
{
|
|
10878
10862
|
className: "toolbar-btn",
|
|
10879
|
-
onClick: () => document.execCommand("cut")
|
|
10880
|
-
title: "Cut (Ctrl+X)"
|
|
10863
|
+
onClick: () => document.execCommand("cut")
|
|
10881
10864
|
},
|
|
10882
10865
|
/* @__PURE__ */ React112.createElement(IconCut, null)
|
|
10883
|
-
), show("copy") && /* @__PURE__ */ React112.createElement(
|
|
10866
|
+
)), show("copy") && /* @__PURE__ */ React112.createElement(Tooltip, { title: "Copy selected text", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10884
10867
|
"button",
|
|
10885
10868
|
{
|
|
10886
10869
|
className: "toolbar-btn",
|
|
10887
|
-
onClick: handleCopy
|
|
10888
|
-
title: "Copy selected text"
|
|
10870
|
+
onClick: handleCopy
|
|
10889
10871
|
},
|
|
10890
10872
|
copySuccess ? /* @__PURE__ */ React112.createElement(IconCheck, null) : /* @__PURE__ */ React112.createElement(IconCopy, null)
|
|
10891
|
-
), show("paste") && /* @__PURE__ */ React112.createElement(
|
|
10873
|
+
)), show("paste") && /* @__PURE__ */ React112.createElement(Tooltip, { title: "Paste (Ctrl+V)", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10892
10874
|
"button",
|
|
10893
10875
|
{
|
|
10894
10876
|
className: "toolbar-btn",
|
|
10895
|
-
onClick: handlePaste
|
|
10896
|
-
title: "Paste (Ctrl+V)"
|
|
10877
|
+
onClick: handlePaste
|
|
10897
10878
|
},
|
|
10898
10879
|
/* @__PURE__ */ React112.createElement(IconPaste, null)
|
|
10899
|
-
), show("specialchars") && /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "\u03A9", title: "Special characters", className: "special-characters-btn" } }, /* @__PURE__ */ React112.createElement("div", { className: "char-grid" }, SPECIAL_CHARS.map((char) => /* @__PURE__ */ React112.createElement(
|
|
10880
|
+
)), show("specialchars") && /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "\u03A9", title: "Special characters", className: "special-characters-btn" } }, /* @__PURE__ */ React112.createElement("div", { className: "char-grid" }, SPECIAL_CHARS.map((char) => /* @__PURE__ */ React112.createElement(
|
|
10900
10881
|
"button",
|
|
10901
10882
|
{
|
|
10902
10883
|
key: char,
|
|
@@ -10928,23 +10909,21 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10928
10909
|
}
|
|
10929
10910
|
} }, "</>", " Inline Code"),
|
|
10930
10911
|
/* @__PURE__ */ React112.createElement("button", { className: "dropdown-item", onClick: () => editor.chain().focus().toggleCodeBlock().run() }, "{ }", " Code Block")
|
|
10931
|
-
), show("fullscreen") && /* @__PURE__ */ React112.createElement(
|
|
10912
|
+
), show("fullscreen") && /* @__PURE__ */ React112.createElement(Tooltip, { title: "Toggle Fullscreen", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10932
10913
|
"button",
|
|
10933
10914
|
{
|
|
10934
10915
|
className: `toolbar-btn ${isFullscreen ? "is-active" : ""}`,
|
|
10935
|
-
onClick: onToggleFullscreen
|
|
10936
|
-
title: "Toggle Fullscreen"
|
|
10916
|
+
onClick: onToggleFullscreen
|
|
10937
10917
|
},
|
|
10938
10918
|
/* @__PURE__ */ React112.createElement(IconFullscreen, null)
|
|
10939
|
-
), show("tts") && /* @__PURE__ */ React112.createElement(TextToSpeech_default, { ref: ttsRef, editor, onTextToSpeech }), show("stt") && /* @__PURE__ */ React112.createElement(SpeechToText_default, { ref: sttRef, editor, onSpeechToText }), show("translate") && /* @__PURE__ */ React112.createElement("div", { className: "translate-split-btn" }, /* @__PURE__ */ React112.createElement(
|
|
10919
|
+
)), show("tts") && /* @__PURE__ */ React112.createElement(TextToSpeech_default, { ref: ttsRef, editor, onTextToSpeech }), show("stt") && /* @__PURE__ */ React112.createElement(SpeechToText_default, { ref: sttRef, editor, onSpeechToText }), show("translate") && /* @__PURE__ */ React112.createElement("div", { className: "translate-split-btn" }, /* @__PURE__ */ React112.createElement(Tooltip, { title: "Translate selected text", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10940
10920
|
"button",
|
|
10941
10921
|
{
|
|
10942
10922
|
className: "toolbar-btn",
|
|
10943
|
-
onClick: handleQuickTranslate
|
|
10944
|
-
title: "Translate selected text"
|
|
10923
|
+
onClick: handleQuickTranslate
|
|
10945
10924
|
},
|
|
10946
10925
|
/* @__PURE__ */ React112.createElement(IconTranslate, null)
|
|
10947
|
-
), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "", title: "Translate options", className: "translate-arrow-btn" } }, /* @__PURE__ */ React112.createElement("button", { className: "dropdown-item", onClick: () => setShowTranslateModal(true) }, "Options")), translateStatus && /* @__PURE__ */ React112.createElement("span", { className: `translate-toast-popup ${translateStatus === "Please select the text" || translateStatus === "Translation failed" ? "error" : ""}` }, translateStatus)), show("todo") && /* @__PURE__ */ React112.createElement("div", { className: "todo-split-btn" }, /* @__PURE__ */ React112.createElement(
|
|
10926
|
+
)), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "", title: "Translate options", className: "translate-arrow-btn" } }, /* @__PURE__ */ React112.createElement("button", { className: "dropdown-item", onClick: () => setShowTranslateModal(true) }, "Options")), translateStatus && /* @__PURE__ */ React112.createElement("span", { className: `translate-toast-popup ${translateStatus === "Please select the text" || translateStatus === "Translation failed" ? "error" : ""}` }, translateStatus)), show("todo") && /* @__PURE__ */ React112.createElement("div", { className: "todo-split-btn" }, /* @__PURE__ */ React112.createElement(Tooltip, { title: todoEnabled ? "Disable Task List" : "Enable Task List", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
10948
10927
|
"button",
|
|
10949
10928
|
{
|
|
10950
10929
|
className: `toolbar-btn ${todoEnabled ? "is-active" : ""}`,
|
|
@@ -10985,11 +10964,10 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
10985
10964
|
}).run();
|
|
10986
10965
|
}
|
|
10987
10966
|
}
|
|
10988
|
-
}
|
|
10989
|
-
title: todoEnabled ? "Disable Task List" : "Enable Task List"
|
|
10967
|
+
}
|
|
10990
10968
|
},
|
|
10991
10969
|
/* @__PURE__ */ React112.createElement(IconTaskList, null)
|
|
10992
|
-
), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "", title: "Task status", className: "todo-arrow-btn" }, keepOpen: true }, ["todo", "working", "blocked", "resolved"].map((status) => {
|
|
10970
|
+
)), /* @__PURE__ */ React112.createElement(Dropdown, { trigger: { label: "", title: "Task status", className: "todo-arrow-btn" }, keepOpen: true }, ["todo", "working", "blocked", "resolved"].map((status) => {
|
|
10993
10971
|
const images = { todo: "https://storage.googleapis.com/rufous-com-bucket-1/static/images/todo-blank.svg", working: "https://storage.googleapis.com/rufous-com-bucket-1/static/images/working.svg", blocked: "https://storage.googleapis.com/rufous-com-bucket-1/static/images/blocked.svg", resolved: "https://storage.googleapis.com/rufous-com-bucket-1/static/images/closed.svg" };
|
|
10994
10972
|
const labels = { todo: "Todo", working: "Working", blocked: "Blocked", resolved: "Resolved" };
|
|
10995
10973
|
return /* @__PURE__ */ React112.createElement("button", { key: status, className: "dropdown-item task-status-item", onClick: () => {
|
|
@@ -11026,7 +11004,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
11026
11004
|
return true;
|
|
11027
11005
|
}).run();
|
|
11028
11006
|
} }, /* @__PURE__ */ React112.createElement("span", { className: `task-icon task-${status}` }, /* @__PURE__ */ React112.createElement("img", { src: images[status], alt: status })), " ", labels[status]);
|
|
11029
|
-
})))), onClose && /* @__PURE__ */ React112.createElement("div", { className: "toolbar-row-right" }, /* @__PURE__ */ React112.createElement(
|
|
11007
|
+
})))), onClose && /* @__PURE__ */ React112.createElement("div", { className: "toolbar-row-right" }, /* @__PURE__ */ React112.createElement(Tooltip, { title: "Close", placement: "top" }, /* @__PURE__ */ React112.createElement(
|
|
11030
11008
|
"button",
|
|
11031
11009
|
{
|
|
11032
11010
|
className: "toolbar-btn btn-cross",
|
|
@@ -11040,11 +11018,10 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
|
|
|
11040
11018
|
} catch {
|
|
11041
11019
|
}
|
|
11042
11020
|
onClose();
|
|
11043
|
-
}
|
|
11044
|
-
title: "Close"
|
|
11021
|
+
}
|
|
11045
11022
|
},
|
|
11046
11023
|
/* @__PURE__ */ React112.createElement(closeIcon_default, { color: "#a81c08" })
|
|
11047
|
-
)), showTranslateModal && /* @__PURE__ */ React112.createElement(
|
|
11024
|
+
))), showTranslateModal && /* @__PURE__ */ React112.createElement(
|
|
11048
11025
|
TranslateModal_default,
|
|
11049
11026
|
{
|
|
11050
11027
|
editor,
|
|
@@ -11128,15 +11105,14 @@ var ImagePropertiesModal = ({ editor, node, onClose }) => {
|
|
|
11128
11105
|
value: width,
|
|
11129
11106
|
onChange: (e) => handleWidthChange(e.target.value)
|
|
11130
11107
|
}
|
|
11131
|
-
), /* @__PURE__ */ React113.createElement(
|
|
11108
|
+
), /* @__PURE__ */ React113.createElement(Tooltip, { title: lockRatio ? "Unlock aspect ratio" : "Lock aspect ratio", placement: "top" }, /* @__PURE__ */ React113.createElement(
|
|
11132
11109
|
"button",
|
|
11133
11110
|
{
|
|
11134
11111
|
className: `lock-btn ${lockRatio ? "locked" : ""}`,
|
|
11135
|
-
onClick: () => setLockRatio(!lockRatio)
|
|
11136
|
-
title: lockRatio ? "Unlock aspect ratio" : "Lock aspect ratio"
|
|
11112
|
+
onClick: () => setLockRatio(!lockRatio)
|
|
11137
11113
|
},
|
|
11138
11114
|
lockRatio ? "\u{1F512}" : "\u{1F513}"
|
|
11139
|
-
), /* @__PURE__ */ React113.createElement(
|
|
11115
|
+
)), /* @__PURE__ */ React113.createElement(
|
|
11140
11116
|
"input",
|
|
11141
11117
|
{
|
|
11142
11118
|
type: "number",
|
|
@@ -11321,13 +11297,13 @@ var ImageToolbar = ({ editor }) => {
|
|
|
11321
11297
|
style: { position: "absolute", top: pos.top, left: pos.left, zIndex: 1e3 },
|
|
11322
11298
|
onMouseDown: (e) => e.preventDefault()
|
|
11323
11299
|
},
|
|
11324
|
-
/* @__PURE__ */ React113.createElement("button", { className: "img-tool-btn", onClick: handleDelete
|
|
11325
|
-
/* @__PURE__ */ React113.createElement("button", { className: "img-tool-btn", onClick: () => setShowModal(true)
|
|
11326
|
-
/* @__PURE__ */ React113.createElement("div", { className: "img-tool-copy-wrapper" }, /* @__PURE__ */ React113.createElement("button", { className: "img-tool-btn", onClick: handleCopy
|
|
11327
|
-
/* @__PURE__ */ React113.createElement("div", { className: "img-tool-dropdown" }, /* @__PURE__ */ React113.createElement("button", { className: "img-tool-btn", onClick: () => {
|
|
11300
|
+
/* @__PURE__ */ React113.createElement(Tooltip, { title: "Delete", placement: "top" }, /* @__PURE__ */ React113.createElement("button", { className: "img-tool-btn", onClick: handleDelete }, "\u{1F5D1}")),
|
|
11301
|
+
/* @__PURE__ */ React113.createElement(Tooltip, { title: "Edit properties", placement: "top" }, /* @__PURE__ */ React113.createElement("button", { className: "img-tool-btn", onClick: () => setShowModal(true) }, "\u270E")),
|
|
11302
|
+
/* @__PURE__ */ React113.createElement("div", { className: "img-tool-copy-wrapper" }, /* @__PURE__ */ React113.createElement(Tooltip, { title: "Copy image", placement: "top" }, /* @__PURE__ */ React113.createElement("button", { className: "img-tool-btn", onClick: handleCopy }, copyStatus ? "\u2713" : "\u{1F4CB}")), copyStatus && /* @__PURE__ */ React113.createElement("span", { className: "img-copy-toast" }, copyStatus)),
|
|
11303
|
+
/* @__PURE__ */ React113.createElement("div", { className: "img-tool-dropdown" }, /* @__PURE__ */ React113.createElement(Tooltip, { title: "Horizontal alignment", placement: "top" }, /* @__PURE__ */ React113.createElement("button", { className: "img-tool-btn", onClick: () => {
|
|
11328
11304
|
setShowAlign(!showAlign);
|
|
11329
11305
|
setShowVAlign(false);
|
|
11330
|
-
}
|
|
11306
|
+
} }, "\u2630 ", /* @__PURE__ */ React113.createElement("span", { className: "dropdown-arrow" }, "\u25BE"))), showAlign && /* @__PURE__ */ React113.createElement("div", { className: "img-tool-menu" }, ALIGNMENTS.map((a) => /* @__PURE__ */ React113.createElement("button", { key: a.value, className: "dropdown-item", onClick: () => setAlignmentVal(a.value) }, a.icon, " ", a.label))))
|
|
11331
11307
|
), showModal && /* @__PURE__ */ React113.createElement(
|
|
11332
11308
|
ImagePropertiesModal,
|
|
11333
11309
|
{
|
|
@@ -11410,15 +11386,14 @@ var VideoPropertiesModal = ({ editor, node, nodeType, onClose }) => {
|
|
|
11410
11386
|
value: width,
|
|
11411
11387
|
onChange: (e) => handleWidthChange(e.target.value)
|
|
11412
11388
|
}
|
|
11413
|
-
), /* @__PURE__ */ React114.createElement(
|
|
11389
|
+
), /* @__PURE__ */ React114.createElement(Tooltip, { title: lockRatio ? "Unlock aspect ratio" : "Lock aspect ratio", placement: "top" }, /* @__PURE__ */ React114.createElement(
|
|
11414
11390
|
"button",
|
|
11415
11391
|
{
|
|
11416
11392
|
className: `lock-btn ${lockRatio ? "locked" : ""}`,
|
|
11417
|
-
onClick: () => setLockRatio(!lockRatio)
|
|
11418
|
-
title: lockRatio ? "Unlock aspect ratio" : "Lock aspect ratio"
|
|
11393
|
+
onClick: () => setLockRatio(!lockRatio)
|
|
11419
11394
|
},
|
|
11420
11395
|
lockRatio ? "\u{1F512}" : "\u{1F513}"
|
|
11421
|
-
), /* @__PURE__ */ React114.createElement(
|
|
11396
|
+
)), /* @__PURE__ */ React114.createElement(
|
|
11422
11397
|
"input",
|
|
11423
11398
|
{
|
|
11424
11399
|
type: "number",
|
|
@@ -11545,13 +11520,13 @@ var VideoToolbar = ({ editor }) => {
|
|
|
11545
11520
|
style: { position: "absolute", top: pos.top, left: pos.left, zIndex: 1e3 },
|
|
11546
11521
|
onMouseDown: (e) => e.preventDefault()
|
|
11547
11522
|
},
|
|
11548
|
-
/* @__PURE__ */ React114.createElement("button", { className: "img-tool-btn", onClick: handleDelete
|
|
11549
|
-
/* @__PURE__ */ React114.createElement("button", { className: "img-tool-btn", onClick: () => setShowModal(true)
|
|
11550
|
-
/* @__PURE__ */ React114.createElement("div", { className: "img-tool-copy-wrapper" }, /* @__PURE__ */ React114.createElement("button", { className: "img-tool-btn", onClick: handleCopy
|
|
11551
|
-
/* @__PURE__ */ React114.createElement("div", { className: "img-tool-dropdown" }, /* @__PURE__ */ React114.createElement("button", { className: "img-tool-btn", onClick: () => {
|
|
11523
|
+
/* @__PURE__ */ React114.createElement(Tooltip, { title: "Delete", placement: "top" }, /* @__PURE__ */ React114.createElement("button", { className: "img-tool-btn", onClick: handleDelete }, "\u{1F5D1}")),
|
|
11524
|
+
/* @__PURE__ */ React114.createElement(Tooltip, { title: "Edit properties", placement: "top" }, /* @__PURE__ */ React114.createElement("button", { className: "img-tool-btn", onClick: () => setShowModal(true) }, "\u270E")),
|
|
11525
|
+
/* @__PURE__ */ React114.createElement("div", { className: "img-tool-copy-wrapper" }, /* @__PURE__ */ React114.createElement(Tooltip, { title: "Copy URL", placement: "top" }, /* @__PURE__ */ React114.createElement("button", { className: "img-tool-btn", onClick: handleCopy }, copyStatus ? "\u2713" : "\u{1F4CB}")), copyStatus && /* @__PURE__ */ React114.createElement("span", { className: "img-copy-toast" }, copyStatus)),
|
|
11526
|
+
/* @__PURE__ */ React114.createElement("div", { className: "img-tool-dropdown" }, /* @__PURE__ */ React114.createElement(Tooltip, { title: "Size presets", placement: "top" }, /* @__PURE__ */ React114.createElement("button", { className: "img-tool-btn", onClick: () => {
|
|
11552
11527
|
setShowSize(!showSize);
|
|
11553
11528
|
setShowAlign(false);
|
|
11554
|
-
}
|
|
11529
|
+
} }, /* @__PURE__ */ React114.createElement("span", { style: { fontSize: "11px" } }, node.attrs.width || 640, "x", node.attrs.height || 360), /* @__PURE__ */ React114.createElement("span", { className: "dropdown-arrow" }, "\u25BE"))), showSize && /* @__PURE__ */ React114.createElement("div", { className: "img-tool-menu" }, /* @__PURE__ */ React114.createElement("button", { className: "dropdown-item", onClick: () => {
|
|
11555
11530
|
handleResize("small");
|
|
11556
11531
|
setShowSize(false);
|
|
11557
11532
|
} }, "Small (320x180)"), /* @__PURE__ */ React114.createElement("button", { className: "dropdown-item", onClick: () => {
|
|
@@ -11564,10 +11539,10 @@ var VideoToolbar = ({ editor }) => {
|
|
|
11564
11539
|
handleResize("full");
|
|
11565
11540
|
setShowSize(false);
|
|
11566
11541
|
} }, "Full (854x480)"))),
|
|
11567
|
-
/* @__PURE__ */ React114.createElement("div", { className: "img-tool-dropdown" }, /* @__PURE__ */ React114.createElement("button", { className: "img-tool-btn", onClick: () => {
|
|
11542
|
+
/* @__PURE__ */ React114.createElement("div", { className: "img-tool-dropdown" }, /* @__PURE__ */ React114.createElement(Tooltip, { title: "Horizontal alignment", placement: "top" }, /* @__PURE__ */ React114.createElement("button", { className: "img-tool-btn", onClick: () => {
|
|
11568
11543
|
setShowAlign(!showAlign);
|
|
11569
11544
|
setShowSize(false);
|
|
11570
|
-
}
|
|
11545
|
+
} }, "\u2630 ", /* @__PURE__ */ React114.createElement("span", { className: "dropdown-arrow" }, "\u25BE"))), showAlign && /* @__PURE__ */ React114.createElement("div", { className: "img-tool-menu" }, ALIGNMENTS2.map((a) => /* @__PURE__ */ React114.createElement("button", { key: a.value, className: "dropdown-item", onClick: () => setAlignmentVal(a.value) }, a.icon, " ", a.label))))
|
|
11571
11546
|
), showModal && /* @__PURE__ */ React114.createElement(
|
|
11572
11547
|
VideoPropertiesModal,
|
|
11573
11548
|
{
|
|
@@ -11650,101 +11625,19 @@ var TableToolbar = ({ editor }) => {
|
|
|
11650
11625
|
style: { top: pos.top, left: pos.left },
|
|
11651
11626
|
onMouseDown: prevent
|
|
11652
11627
|
},
|
|
11653
|
-
/* @__PURE__ */ React115.createElement(
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
className: "rf-table-toolbar-btn",
|
|
11657
|
-
onClick: () => editor.chain().focus().addRowBefore().run(),
|
|
11658
|
-
title: "Insert row above"
|
|
11659
|
-
},
|
|
11660
|
-
/* @__PURE__ */ React115.createElement(IconAddRowBefore, null)
|
|
11661
|
-
),
|
|
11662
|
-
/* @__PURE__ */ React115.createElement(
|
|
11663
|
-
"button",
|
|
11664
|
-
{
|
|
11665
|
-
className: "rf-table-toolbar-btn",
|
|
11666
|
-
onClick: () => editor.chain().focus().addRowAfter().run(),
|
|
11667
|
-
title: "Insert row below"
|
|
11668
|
-
},
|
|
11669
|
-
/* @__PURE__ */ React115.createElement(IconAddRowAfter, null)
|
|
11670
|
-
),
|
|
11671
|
-
/* @__PURE__ */ React115.createElement(
|
|
11672
|
-
"button",
|
|
11673
|
-
{
|
|
11674
|
-
className: "rf-table-toolbar-btn rf-table-toolbar-btn-danger",
|
|
11675
|
-
onClick: () => editor.chain().focus().deleteRow().run(),
|
|
11676
|
-
title: "Delete row"
|
|
11677
|
-
},
|
|
11678
|
-
/* @__PURE__ */ React115.createElement(IconDeleteRow, null)
|
|
11679
|
-
),
|
|
11628
|
+
/* @__PURE__ */ React115.createElement(Tooltip, { title: "Insert row above", placement: "top" }, /* @__PURE__ */ React115.createElement("button", { className: "rf-table-toolbar-btn", onClick: () => editor.chain().focus().addRowBefore().run() }, /* @__PURE__ */ React115.createElement(IconAddRowBefore, null))),
|
|
11629
|
+
/* @__PURE__ */ React115.createElement(Tooltip, { title: "Insert row below", placement: "top" }, /* @__PURE__ */ React115.createElement("button", { className: "rf-table-toolbar-btn", onClick: () => editor.chain().focus().addRowAfter().run() }, /* @__PURE__ */ React115.createElement(IconAddRowAfter, null))),
|
|
11630
|
+
/* @__PURE__ */ React115.createElement(Tooltip, { title: "Delete row", placement: "top" }, /* @__PURE__ */ React115.createElement("button", { className: "rf-table-toolbar-btn rf-table-toolbar-btn-danger", onClick: () => editor.chain().focus().deleteRow().run() }, /* @__PURE__ */ React115.createElement(IconDeleteRow, null))),
|
|
11680
11631
|
/* @__PURE__ */ React115.createElement("span", { className: "rf-table-toolbar-sep" }),
|
|
11681
|
-
/* @__PURE__ */ React115.createElement(
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
className: "rf-table-toolbar-btn",
|
|
11685
|
-
onClick: () => editor.chain().focus().addColumnBefore().run(),
|
|
11686
|
-
title: "Insert column left"
|
|
11687
|
-
},
|
|
11688
|
-
/* @__PURE__ */ React115.createElement(IconAddColBefore, null)
|
|
11689
|
-
),
|
|
11690
|
-
/* @__PURE__ */ React115.createElement(
|
|
11691
|
-
"button",
|
|
11692
|
-
{
|
|
11693
|
-
className: "rf-table-toolbar-btn",
|
|
11694
|
-
onClick: () => editor.chain().focus().addColumnAfter().run(),
|
|
11695
|
-
title: "Insert column right"
|
|
11696
|
-
},
|
|
11697
|
-
/* @__PURE__ */ React115.createElement(IconAddColAfter, null)
|
|
11698
|
-
),
|
|
11699
|
-
/* @__PURE__ */ React115.createElement(
|
|
11700
|
-
"button",
|
|
11701
|
-
{
|
|
11702
|
-
className: "rf-table-toolbar-btn rf-table-toolbar-btn-danger",
|
|
11703
|
-
onClick: () => editor.chain().focus().deleteColumn().run(),
|
|
11704
|
-
title: "Delete column"
|
|
11705
|
-
},
|
|
11706
|
-
/* @__PURE__ */ React115.createElement(IconDeleteCol, null)
|
|
11707
|
-
),
|
|
11632
|
+
/* @__PURE__ */ React115.createElement(Tooltip, { title: "Insert column left", placement: "top" }, /* @__PURE__ */ React115.createElement("button", { className: "rf-table-toolbar-btn", onClick: () => editor.chain().focus().addColumnBefore().run() }, /* @__PURE__ */ React115.createElement(IconAddColBefore, null))),
|
|
11633
|
+
/* @__PURE__ */ React115.createElement(Tooltip, { title: "Insert column right", placement: "top" }, /* @__PURE__ */ React115.createElement("button", { className: "rf-table-toolbar-btn", onClick: () => editor.chain().focus().addColumnAfter().run() }, /* @__PURE__ */ React115.createElement(IconAddColAfter, null))),
|
|
11634
|
+
/* @__PURE__ */ React115.createElement(Tooltip, { title: "Delete column", placement: "top" }, /* @__PURE__ */ React115.createElement("button", { className: "rf-table-toolbar-btn rf-table-toolbar-btn-danger", onClick: () => editor.chain().focus().deleteColumn().run() }, /* @__PURE__ */ React115.createElement(IconDeleteCol, null))),
|
|
11708
11635
|
/* @__PURE__ */ React115.createElement("span", { className: "rf-table-toolbar-sep" }),
|
|
11709
|
-
/* @__PURE__ */ React115.createElement(
|
|
11710
|
-
|
|
11711
|
-
{
|
|
11712
|
-
className: "rf-table-toolbar-btn",
|
|
11713
|
-
onClick: () => editor.chain().focus().mergeCells().run(),
|
|
11714
|
-
disabled: !canMerge,
|
|
11715
|
-
title: "Merge cells"
|
|
11716
|
-
},
|
|
11717
|
-
/* @__PURE__ */ React115.createElement(IconMergeCells, null)
|
|
11718
|
-
),
|
|
11719
|
-
/* @__PURE__ */ React115.createElement(
|
|
11720
|
-
"button",
|
|
11721
|
-
{
|
|
11722
|
-
className: "rf-table-toolbar-btn",
|
|
11723
|
-
onClick: () => editor.chain().focus().splitCell().run(),
|
|
11724
|
-
disabled: !canSplit,
|
|
11725
|
-
title: "Split cell"
|
|
11726
|
-
},
|
|
11727
|
-
/* @__PURE__ */ React115.createElement(IconSplitCell, null)
|
|
11728
|
-
),
|
|
11636
|
+
/* @__PURE__ */ React115.createElement(Tooltip, { title: "Merge cells", placement: "top" }, /* @__PURE__ */ React115.createElement("button", { className: "rf-table-toolbar-btn", onClick: () => editor.chain().focus().mergeCells().run(), disabled: !canMerge }, /* @__PURE__ */ React115.createElement(IconMergeCells, null))),
|
|
11637
|
+
/* @__PURE__ */ React115.createElement(Tooltip, { title: "Split cell", placement: "top" }, /* @__PURE__ */ React115.createElement("button", { className: "rf-table-toolbar-btn", onClick: () => editor.chain().focus().splitCell().run(), disabled: !canSplit }, /* @__PURE__ */ React115.createElement(IconSplitCell, null))),
|
|
11729
11638
|
/* @__PURE__ */ React115.createElement("span", { className: "rf-table-toolbar-sep" }),
|
|
11730
|
-
/* @__PURE__ */ React115.createElement(
|
|
11731
|
-
|
|
11732
|
-
{
|
|
11733
|
-
className: `rf-table-toolbar-btn ${editor.isActive("tableHeader") ? "active" : ""}`,
|
|
11734
|
-
onClick: () => editor.chain().focus().toggleHeaderRow().run(),
|
|
11735
|
-
title: "Toggle header row"
|
|
11736
|
-
},
|
|
11737
|
-
/* @__PURE__ */ React115.createElement(IconToggleHeader, null)
|
|
11738
|
-
),
|
|
11739
|
-
/* @__PURE__ */ React115.createElement(
|
|
11740
|
-
"button",
|
|
11741
|
-
{
|
|
11742
|
-
className: "rf-table-toolbar-btn rf-table-toolbar-btn-danger",
|
|
11743
|
-
onClick: () => editor.chain().focus().deleteTable().run(),
|
|
11744
|
-
title: "Delete table"
|
|
11745
|
-
},
|
|
11746
|
-
/* @__PURE__ */ React115.createElement(IconDeleteTable, null)
|
|
11747
|
-
)
|
|
11639
|
+
/* @__PURE__ */ React115.createElement(Tooltip, { title: "Toggle header row", placement: "top" }, /* @__PURE__ */ React115.createElement("button", { className: `rf-table-toolbar-btn ${editor.isActive("tableHeader") ? "active" : ""}`, onClick: () => editor.chain().focus().toggleHeaderRow().run() }, /* @__PURE__ */ React115.createElement(IconToggleHeader, null))),
|
|
11640
|
+
/* @__PURE__ */ React115.createElement(Tooltip, { title: "Delete table", placement: "top" }, /* @__PURE__ */ React115.createElement("button", { className: "rf-table-toolbar-btn rf-table-toolbar-btn-danger", onClick: () => editor.chain().focus().deleteTable().run() }, /* @__PURE__ */ React115.createElement(IconDeleteTable, null)))
|
|
11748
11641
|
),
|
|
11749
11642
|
document.body
|
|
11750
11643
|
);
|