@rufous/ui 0.3.22 → 0.3.24

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.js CHANGED
@@ -4472,8 +4472,57 @@ import {
4472
4472
  ArrowDown,
4473
4473
  Trash2,
4474
4474
  Plus,
4475
- ChevronsUpDown
4475
+ ChevronsUpDown,
4476
+ Layers
4476
4477
  } from "lucide-react";
4478
+ function getAllGroupIds(rows, fields, getKey, depth = 0, parentId = "") {
4479
+ if (!fields.length || !rows.length) return [];
4480
+ const [field, ...rest] = fields;
4481
+ const buckets = /* @__PURE__ */ new Map();
4482
+ rows.forEach((row) => {
4483
+ const k = getKey(row, field) || "(Blank)";
4484
+ if (!buckets.has(k)) buckets.set(k, []);
4485
+ buckets.get(k).push(row);
4486
+ });
4487
+ const out = [];
4488
+ buckets.forEach((children, k) => {
4489
+ const id = `${parentId}::${field}::${k}`;
4490
+ out.push({ id, field, key: k, depth, count: children.length });
4491
+ if (rest.length) out.push(...getAllGroupIds(children, rest, getKey, depth + 1, id));
4492
+ });
4493
+ return out;
4494
+ }
4495
+ function buildFlatEntries(rows, fields, getKey, expanded, depth = 0, parentId = "") {
4496
+ if (!fields.length) return rows.map((row) => ({ kind: "data", row, depth }));
4497
+ const [field, ...rest] = fields;
4498
+ const buckets = /* @__PURE__ */ new Map();
4499
+ rows.forEach((row) => {
4500
+ const k = getKey(row, field) || "(Blank)";
4501
+ if (!buckets.has(k)) buckets.set(k, []);
4502
+ buckets.get(k).push(row);
4503
+ });
4504
+ const out = [];
4505
+ buckets.forEach((children, k) => {
4506
+ const id = `${parentId}::${field}::${k}`;
4507
+ out.push({ kind: "group", id, field, key: k, depth, leafCount: children.length });
4508
+ if (expanded.has(id)) {
4509
+ out.push(...buildFlatEntries(children, rest, getKey, expanded, depth + 1, id));
4510
+ }
4511
+ });
4512
+ return out;
4513
+ }
4514
+ function buildTreeEntries(rows, getChildren, expanded, depth = 0) {
4515
+ const out = [];
4516
+ rows.forEach((row) => {
4517
+ const children = getChildren(row) ?? [];
4518
+ const hasChildren = children.length > 0;
4519
+ out.push({ kind: "data", row, depth, hasChildren });
4520
+ if (hasChildren && expanded.has(row.id)) {
4521
+ out.push(...buildTreeEntries(children, getChildren, expanded, depth + 1));
4522
+ }
4523
+ });
4524
+ return out;
4525
+ }
4477
4526
  function FilterSelect({
4478
4527
  value,
4479
4528
  onChange,
@@ -4571,7 +4620,21 @@ function DataGrid({
4571
4620
  searchableColumns,
4572
4621
  onSearchChange,
4573
4622
  onFiltersChange,
4574
- hideTopExport = false
4623
+ initialFilters,
4624
+ toolbarOptions,
4625
+ customToolbar,
4626
+ customFooter,
4627
+ hideTopExport = false,
4628
+ rowGroupingModel,
4629
+ defaultRowGroupingModel,
4630
+ onRowGroupingModelChange,
4631
+ rowGroupingColumnMode = "single",
4632
+ groupingColDef,
4633
+ defaultGroupingExpansionDepth = 0,
4634
+ isGroupExpandedByDefault,
4635
+ disableRowGrouping = false,
4636
+ treeData = false,
4637
+ getChildRows
4575
4638
  }) {
4576
4639
  const sxClass = useSx(sx);
4577
4640
  const [editingCell, setEditingCell] = useState9(null);
@@ -4631,10 +4694,46 @@ function DataGrid({
4631
4694
  const [focusFilterIdx, setFocusFilterIdx] = useState9(-1);
4632
4695
  const filterableColumnsProp = initialColumnsProp.filter((c) => c.filterable !== false);
4633
4696
  const initialFilterCol = String(filterableColumnsProp[0]?.field || filterableColumnsProp[0]?.key || "");
4634
- const [advancedFilters, setAdvancedFilters] = useState9([
4635
- { column: initialFilterCol, operator: getDefaultOperator(filterableColumnsProp[0]?.type), value: "", logic: "AND" }
4636
- ]);
4697
+ const [advancedFilters, setAdvancedFilters] = useState9(() => {
4698
+ if (initialFilters && initialFilters.length > 0) return initialFilters;
4699
+ return [{ column: initialFilterCol, operator: getDefaultOperator(filterableColumnsProp[0]?.type), value: "", logic: "AND" }];
4700
+ });
4637
4701
  const [colSearch, setColSearch] = useState9("");
4702
+ const [internalGroupingModel, setInternalGroupingModel] = useState9(
4703
+ defaultRowGroupingModel ?? []
4704
+ );
4705
+ const activeGroupingModel = rowGroupingModel ?? internalGroupingModel;
4706
+ const isGroupingActive = activeGroupingModel.length > 0;
4707
+ const setGroupingModel = (model) => {
4708
+ if (!rowGroupingModel) setInternalGroupingModel(model);
4709
+ onRowGroupingModelChange?.(model);
4710
+ };
4711
+ const addToGrouping = (field) => {
4712
+ if (activeGroupingModel.includes(field)) return;
4713
+ setGroupingModel([...activeGroupingModel, field]);
4714
+ };
4715
+ const removeFromGrouping = (field) => {
4716
+ setGroupingModel(activeGroupingModel.filter((f) => f !== field));
4717
+ };
4718
+ const [expandedGroups, setExpandedGroups] = useState9(/* @__PURE__ */ new Set());
4719
+ const prevGroupModelKeyRef = useRef10("");
4720
+ const toggleGroup = (groupId) => {
4721
+ setExpandedGroups((prev) => {
4722
+ const next = new Set(prev);
4723
+ if (next.has(groupId)) next.delete(groupId);
4724
+ else next.add(groupId);
4725
+ return next;
4726
+ });
4727
+ };
4728
+ const [treeExpandedRows, setTreeExpandedRows] = useState9(/* @__PURE__ */ new Set());
4729
+ const toggleTreeRow = (id) => {
4730
+ setTreeExpandedRows((prev) => {
4731
+ const next = new Set(prev);
4732
+ if (next.has(id)) next.delete(id);
4733
+ else next.add(id);
4734
+ return next;
4735
+ });
4736
+ };
4638
4737
  useEffect9(() => {
4639
4738
  const handleMouseMove = (e) => {
4640
4739
  if (!resizingColumn) return;
@@ -4677,6 +4776,13 @@ function DataGrid({
4677
4776
  return next;
4678
4777
  });
4679
4778
  }, [initialColumnsProp]);
4779
+ const getGroupValue = (item, field) => {
4780
+ const col = resolvedColumns.find((c) => String(c.field) === field || String(c.key) === field);
4781
+ const raw = item[field];
4782
+ if (col?.groupingValueGetter) return String(col.groupingValueGetter(raw, item) ?? "");
4783
+ if (col?.valueGetter) return String(col.valueGetter({ value: raw, row: item, field }) ?? "");
4784
+ return raw == null ? "" : String(raw);
4785
+ };
4680
4786
  const onFiltersChangeRef = useRef10(onFiltersChange);
4681
4787
  useEffect9(() => {
4682
4788
  onFiltersChangeRef.current = onFiltersChange;
@@ -4864,14 +4970,36 @@ function DataGrid({
4864
4970
  return 0;
4865
4971
  });
4866
4972
  }, [filteredData, sortField, sortDirection, resolvedColumns]);
4973
+ useEffect9(() => {
4974
+ const key = activeGroupingModel.join("\0");
4975
+ if (key === prevGroupModelKeyRef.current) return;
4976
+ prevGroupModelKeyRef.current = key;
4977
+ if (!activeGroupingModel.length) {
4978
+ setExpandedGroups(/* @__PURE__ */ new Set());
4979
+ return;
4980
+ }
4981
+ const allGroups = getAllGroupIds(sortedData, activeGroupingModel, getGroupValue);
4982
+ setExpandedGroups(new Set(
4983
+ allGroups.filter((g) => isGroupExpandedByDefault ? isGroupExpandedByDefault({ id: g.id, field: g.field, key: g.key, depth: g.depth, count: g.count }) : defaultGroupingExpansionDepth === -1 || g.depth < defaultGroupingExpansionDepth).map((g) => g.id)
4984
+ ));
4985
+ }, [activeGroupingModel.join("\0")]);
4986
+ const resolveChildren = getChildRows ?? ((row) => row.children ?? null);
4987
+ const flatEntries = useMemo2(() => {
4988
+ if (treeData) {
4989
+ return buildTreeEntries(sortedData, resolveChildren, treeExpandedRows);
4990
+ }
4991
+ if (!isGroupingActive) return null;
4992
+ return buildFlatEntries(sortedData, activeGroupingModel, getGroupValue, expandedGroups);
4993
+ }, [treeData, isGroupingActive, sortedData, activeGroupingModel.join("\0"), expandedGroups, treeExpandedRows]);
4867
4994
  const isServer = paginationMode === "server";
4868
- const totalRows = isServer ? rowCount ?? data.length : filteredData.length;
4995
+ const totalRows = isServer ? rowCount ?? data.length : flatEntries ? flatEntries.length : filteredData.length;
4869
4996
  const totalPages = Math.max(1, Math.ceil(totalRows / activePageSize));
4870
- const paginatedData = useMemo2(() => {
4871
- if (isServer) return data;
4997
+ const displayRows = useMemo2(() => {
4998
+ if (isServer) return data.map((row) => ({ kind: "data", row, depth: 0 }));
4999
+ const source = flatEntries ?? sortedData.map((row) => ({ kind: "data", row, depth: 0 }));
4872
5000
  const start = (activePage - 1) * activePageSize;
4873
- return sortedData.slice(start, start + activePageSize);
4874
- }, [isServer, data, sortedData, activePage, activePageSize]);
5001
+ return source.slice(start, start + activePageSize);
5002
+ }, [isServer, data, flatEntries, sortedData, activePage, activePageSize]);
4875
5003
  const handleExport = () => {
4876
5004
  const exportableCols = resolvedColumns.filter((c) => !c.hidden && c.isExportable !== false);
4877
5005
  const headers = exportableCols.map((c) => c.headerName).join(",");
@@ -4921,8 +5049,57 @@ function DataGrid({
4921
5049
  const left = resolvedColumns.filter((c) => !c.hidden && c.pinned === "left");
4922
5050
  const mid = resolvedColumns.filter((c) => !c.hidden && !c.pinned);
4923
5051
  const right = resolvedColumns.filter((c) => !c.hidden && c.pinned === "right");
4924
- return [...left, ...mid, ...right];
4925
- }, [resolvedColumns]);
5052
+ const dataCols = [...left, ...mid, ...right];
5053
+ if (treeData) {
5054
+ const treeCol = {
5055
+ key: "__tree__",
5056
+ field: "__tree__",
5057
+ header: "",
5058
+ headerName: "",
5059
+ width: 44,
5060
+ sortable: false,
5061
+ filterable: false,
5062
+ disableColumnMenu: true,
5063
+ hideable: false
5064
+ };
5065
+ return [treeCol, ...dataCols];
5066
+ }
5067
+ if (!isGroupingActive) return dataCols;
5068
+ if (rowGroupingColumnMode === "multiple") {
5069
+ const groupCols = activeGroupingModel.map((gField, i) => {
5070
+ const src = resolvedColumns.find((c) => String(c.field) === gField || String(c.key) === gField);
5071
+ const def2 = typeof groupingColDef === "function" ? groupingColDef(gField) : groupingColDef;
5072
+ return {
5073
+ key: `__group_${i}__`,
5074
+ field: `__group_${i}__`,
5075
+ header: def2?.headerName ?? src?.header ?? src?.headerName ?? gField,
5076
+ headerName: def2?.headerName ?? src?.header ?? src?.headerName ?? gField,
5077
+ width: def2?.width ?? 160,
5078
+ sortable: false,
5079
+ filterable: false,
5080
+ disableColumnMenu: true,
5081
+ hideable: false,
5082
+ __groupField: gField,
5083
+ __groupIndex: i
5084
+ };
5085
+ });
5086
+ return [...groupCols, ...dataCols];
5087
+ }
5088
+ const def = typeof groupingColDef === "function" ? groupingColDef(activeGroupingModel[0]) : groupingColDef;
5089
+ const singleSrc = resolvedColumns.find((c) => String(c.field) === activeGroupingModel[0] || String(c.key) === activeGroupingModel[0]);
5090
+ const singleGroupCol = {
5091
+ key: "__group__",
5092
+ field: "__group__",
5093
+ header: def?.headerName ?? (activeGroupingModel.length === 1 ? singleSrc?.header ?? singleSrc?.headerName ?? "Group" : "Group"),
5094
+ headerName: def?.headerName ?? (activeGroupingModel.length === 1 ? singleSrc?.header ?? singleSrc?.headerName ?? "Group" : "Group"),
5095
+ width: def?.width ?? 200,
5096
+ sortable: false,
5097
+ filterable: false,
5098
+ disableColumnMenu: true,
5099
+ hideable: false
5100
+ };
5101
+ return [singleGroupCol, ...dataCols];
5102
+ }, [resolvedColumns, isGroupingActive, activeGroupingModel, rowGroupingColumnMode, groupingColDef]);
4926
5103
  const getLeftOffset = (col, idx) => {
4927
5104
  if (col.pinned !== "left") return void 0;
4928
5105
  let offset2 = 0;
@@ -4957,7 +5134,14 @@ function DataGrid({
4957
5134
  };
4958
5135
  const activeMenuCol = activeMenu ? resolvedColumns.find((c) => String(c.field) === activeMenu) : null;
4959
5136
  const alignClass = (align) => align === "center" ? "dg-slot--center" : align === "right" ? "dg-slot--right" : "dg-slot--left";
4960
- 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(
5137
+ const tOpts = toolbarOptions ?? {};
5138
+ const showSearch = !tOpts.hideSearch;
5139
+ const showFilterBtn = !tOpts.hideFilter;
5140
+ const showColumnsBtn = !tOpts.hideColumns;
5141
+ const showExportBtn = !tOpts.hideExport && !hideTopExport;
5142
+ const showTitle = !tOpts.hideTitle;
5143
+ const showRecordCount = !tOpts.hideRecordCount;
5144
+ return /* @__PURE__ */ React75.createElement("div", { className: ["dg-root", sxClass, className].filter(Boolean).join(" ") }, !tOpts.hideHeader && /* @__PURE__ */ React75.createElement("div", { className: `dg-header${customToolbar ? " dg-header--custom" : ""}` }, !customToolbar && (showTitle || showRecordCount) && /* @__PURE__ */ React75.createElement("div", { className: "dg-header-info" }, showTitle && /* @__PURE__ */ React75.createElement("h2", null, title), showRecordCount && /* @__PURE__ */ React75.createElement("p", null, filteredData.length, " total records")), /* @__PURE__ */ React75.createElement("div", { className: "dg-header-actions" }, customToolbar ?? /* @__PURE__ */ React75.createElement(React75.Fragment, null, showSearch && /* @__PURE__ */ React75.createElement("div", { className: "dg-search-wrap" }, /* @__PURE__ */ React75.createElement(Search, { size: 15 }), /* @__PURE__ */ React75.createElement(
4961
5145
  "input",
4962
5146
  {
4963
5147
  className: "dg-search",
@@ -4968,23 +5152,35 @@ function DataGrid({
4968
5152
  setCurrentPage(1);
4969
5153
  }
4970
5154
  }
4971
- )), /* @__PURE__ */ React75.createElement(Tooltip, { title: "Filters", placement: "top" }, /* @__PURE__ */ React75.createElement(
5155
+ )), showFilterBtn && /* @__PURE__ */ React75.createElement(Tooltip, { title: "Filters", placement: "top" }, /* @__PURE__ */ React75.createElement(
4972
5156
  "button",
4973
5157
  {
4974
5158
  className: `dg-icon-btn ${hasActiveFilters ? "active" : ""}`,
4975
5159
  onClick: () => setShowAdvancedFilter(true)
4976
5160
  },
4977
5161
  /* @__PURE__ */ React75.createElement(Filter, { size: 16 })
4978
- )), /* @__PURE__ */ React75.createElement(Tooltip, { title: "Manage Columns", placement: "top" }, /* @__PURE__ */ React75.createElement(
5162
+ )), showColumnsBtn && /* @__PURE__ */ React75.createElement(Tooltip, { title: "Manage Columns", placement: "top" }, /* @__PURE__ */ React75.createElement(
4979
5163
  "button",
4980
5164
  {
4981
5165
  className: "dg-icon-btn",
4982
5166
  onClick: () => setShowManageColumns(true)
4983
5167
  },
4984
5168
  /* @__PURE__ */ React75.createElement(Columns, { size: 16 })
4985
- )), !hideTopExport && /* @__PURE__ */ React75.createElement("button", { className: "dg-action-btn", onClick: handleExport }, /* @__PURE__ */ React75.createElement(Download, { size: 14 }), " Export CSV"), headerActions && /* @__PURE__ */ React75.createElement("div", { className: `dg-header-slot ${alignClass(headerActions.align)}` }, headerActions.content))), /* @__PURE__ */ React75.createElement("div", { className: `dg-toolbar ${alignClass(toolbarContent?.align)}` }, toolbarContent?.content || ""), /* @__PURE__ */ React75.createElement("div", { className: `dg-table-wrap${paginatedData.length === 0 && !loading ? " dg-table-wrap--empty" : ""}` }, loading && /* @__PURE__ */ React75.createElement("div", { className: "dg-loading-overlay" }, /* @__PURE__ */ React75.createElement("div", { className: "dg-loading-spinner" })), /* @__PURE__ */ React75.createElement("table", { className: "dg-table" }, /* @__PURE__ */ React75.createElement("thead", null, /* @__PURE__ */ React75.createElement("tr", null, visibleColumns.map((col, idx) => {
5169
+ )), showExportBtn && /* @__PURE__ */ React75.createElement("button", { className: "dg-action-btn", onClick: handleExport }, /* @__PURE__ */ React75.createElement(Download, { size: 14 }), " Export CSV")), headerActions && /* @__PURE__ */ React75.createElement("div", { className: `dg-header-slot ${alignClass(headerActions.align)}` }, headerActions.content))), !tOpts.hideHeader && /* @__PURE__ */ React75.createElement("div", { className: `dg-toolbar ${alignClass(toolbarContent?.align)}` }, toolbarContent?.content || ""), isGroupingActive && /* @__PURE__ */ React75.createElement("div", { className: "dg-grouping-bar" }, /* @__PURE__ */ React75.createElement("span", { className: "dg-grouping-bar-label" }, "Grouped by"), activeGroupingModel.map((gField) => {
5170
+ const col = resolvedColumns.find((c) => String(c.field) === gField || String(c.key) === gField);
5171
+ return /* @__PURE__ */ React75.createElement("div", { key: gField, className: "dg-group-chip" }, /* @__PURE__ */ React75.createElement(Layers, { size: 11 }), /* @__PURE__ */ React75.createElement("span", null, col?.header ?? col?.headerName ?? gField), !disableRowGrouping && /* @__PURE__ */ React75.createElement(
5172
+ "button",
5173
+ {
5174
+ className: "dg-group-chip-remove",
5175
+ onClick: () => removeFromGrouping(gField),
5176
+ title: `Remove grouping by ${col?.header ?? gField}`
5177
+ },
5178
+ /* @__PURE__ */ React75.createElement(X2, { size: 10 })
5179
+ ));
5180
+ })), /* @__PURE__ */ React75.createElement("div", { className: `dg-table-wrap${filteredData.length === 0 && !loading ? " dg-table-wrap--empty" : ""} ${tOpts.hideHeader ? "rm-top-border" : ""} ${tOpts.hideFooter ? "rm-bottom-border" : ""}` }, loading && /* @__PURE__ */ React75.createElement("div", { className: "dg-loading-overlay" }, /* @__PURE__ */ React75.createElement("div", { className: "dg-loading-spinner" })), /* @__PURE__ */ React75.createElement("table", { className: "dg-table" }, /* @__PURE__ */ React75.createElement("thead", null, /* @__PURE__ */ React75.createElement("tr", null, visibleColumns.map((col, idx) => {
4986
5181
  const colField = String(col.field);
4987
- const width = columnWidths[colField] || 200;
5182
+ const colNativeWidth = col.width ? typeof col.width === "number" ? col.width : parseInt(String(col.width)) : 200;
5183
+ const width = columnWidths[colField] || colNativeWidth;
4988
5184
  const leftOffset = getLeftOffset(col, idx);
4989
5185
  const rightOffset = getRightOffset(col, idx);
4990
5186
  const isSorted = sortField === col.field;
@@ -5035,79 +5231,150 @@ function DataGrid({
5035
5231
  }
5036
5232
  )))
5037
5233
  );
5038
- }), actions && /* @__PURE__ */ React75.createElement("th", { style: { width: 0, padding: 0 } }))), /* @__PURE__ */ React75.createElement("tbody", null, paginatedData.length > 0 && paginatedData.map((item) => /* @__PURE__ */ React75.createElement("tr", { key: item.id, className: "dg-tbody-row", onDoubleClick: () => onRowDoubleClick?.(item) }, visibleColumns.map((col, idx) => {
5039
- const colField = String(col.field);
5040
- const width = columnWidths[colField] || 200;
5041
- const leftOffset = getLeftOffset(col, idx);
5042
- const rightOffset = getRightOffset(col, idx);
5043
- return /* @__PURE__ */ React75.createElement(
5044
- "td",
5045
- {
5046
- key: `${item.id}-${colField}`,
5047
- className: `dg-td${col.pinned === "left" ? " pinned-left" : col.pinned === "right" ? " pinned-right" : ""}${col.editable ? " dg-td--editable" : ""} ${col.cellClassName || ""}`,
5048
- style: { width, minWidth: width, maxWidth: width, left: leftOffset, right: rightOffset, flex: col.flex },
5049
- onDoubleClick: () => onCellDoubleClick?.({ row: item, field: colField, value: item[col.field || ""] }),
5050
- onClick: col.editable ? () => {
5051
- const field = String(col.field);
5052
- const rawValue = item[col.field || ""];
5053
- const value = col.valueGetter ? col.valueGetter({ value: rawValue, row: item, field }) : rawValue;
5054
- setEditingCell({ rowId: item.id, field, value });
5055
- } : void 0
5056
- },
5057
- (() => {
5058
- const field = String(col.field);
5059
- const rawValue = item[col.field || ""];
5060
- let value = col.valueGetter ? col.valueGetter({ value: rawValue, row: item, field }) : rawValue;
5061
- if (col.editable && editingCell?.rowId === item.id && editingCell?.field === field) {
5062
- const inputType = col.type === "number" ? "number" : col.type === "date" ? "date" : "text";
5063
- const commit = (finalValue) => {
5064
- setEditingCell(null);
5065
- col.onEnter?.({ value: finalValue, row: item, field });
5066
- };
5067
- return /* @__PURE__ */ React75.createElement(
5068
- "input",
5234
+ }), actions && /* @__PURE__ */ React75.createElement("th", { style: { width: 0, padding: 0 } }))), /* @__PURE__ */ React75.createElement("tbody", null, displayRows.length > 0 && displayRows.map((entry) => {
5235
+ if (entry.kind === "group") {
5236
+ const isExpanded = expandedGroups.has(entry.id);
5237
+ const colDef = typeof groupingColDef === "function" ? groupingColDef(entry.field) : groupingColDef;
5238
+ const fieldLabel = resolvedColumns.find(
5239
+ (c) => String(c.field) === entry.field || String(c.key) === entry.field
5240
+ )?.header ?? entry.field;
5241
+ const totalCols = visibleColumns.length + (actions ? 1 : 0);
5242
+ return /* @__PURE__ */ React75.createElement("tr", { key: entry.id, className: "dg-group-row" }, /* @__PURE__ */ React75.createElement("td", { colSpan: totalCols, className: "dg-group-cell" }, /* @__PURE__ */ React75.createElement(
5243
+ "div",
5244
+ {
5245
+ className: "dg-group-cell-inner",
5246
+ style: { paddingLeft: entry.depth * 20 },
5247
+ onClick: () => toggleGroup(entry.id)
5248
+ },
5249
+ /* @__PURE__ */ React75.createElement("button", { className: "dg-group-toggle", onClick: (e) => {
5250
+ e.stopPropagation();
5251
+ toggleGroup(entry.id);
5252
+ } }, isExpanded ? /* @__PURE__ */ React75.createElement(ChevronDown, { size: 15 }) : /* @__PURE__ */ React75.createElement(ChevronRight, { size: 15 })),
5253
+ activeGroupingModel.length > 1 && /* @__PURE__ */ React75.createElement("span", { className: "dg-group-field-label" }, fieldLabel, ":"),
5254
+ colDef?.renderCell ? colDef.renderCell({ groupKey: entry.key, field: entry.field, depth: entry.depth, leafCount: entry.leafCount }) : /* @__PURE__ */ React75.createElement("span", { className: "dg-group-key" }, entry.key),
5255
+ !colDef?.hideDescendantCount && /* @__PURE__ */ React75.createElement("span", { className: "dg-group-count" }, entry.leafCount)
5256
+ )));
5257
+ }
5258
+ const item = entry.row;
5259
+ const rowDepth = entry.depth;
5260
+ return /* @__PURE__ */ React75.createElement("tr", { key: item.id, className: "dg-tbody-row", onDoubleClick: () => onRowDoubleClick?.(item) }, visibleColumns.map((col, idx) => {
5261
+ const colField = String(col.field);
5262
+ if (colField === "__tree__") {
5263
+ const treeColWidth = columnWidths["__tree__"] || 44;
5264
+ const isExpanded = treeExpandedRows.has(item.id);
5265
+ return /* @__PURE__ */ React75.createElement(
5266
+ "td",
5267
+ {
5268
+ key: `${item.id}-__tree__`,
5269
+ className: "dg-tree-cell",
5270
+ style: { width: treeColWidth, minWidth: treeColWidth, maxWidth: treeColWidth }
5271
+ },
5272
+ /* @__PURE__ */ React75.createElement("div", { className: "dg-tree-cell-inner", style: { paddingLeft: rowDepth * 20 } }, entry.hasChildren ? /* @__PURE__ */ React75.createElement(
5273
+ "button",
5069
5274
  {
5070
- className: "dg-cell-editor",
5071
- type: inputType,
5072
- autoFocus: true,
5073
- defaultValue: editingCell.value ?? "",
5074
- onClick: (e) => e.stopPropagation(),
5075
- onKeyDown: (e) => {
5076
- if (e.key === "Enter") commit(e.target.value);
5077
- if (e.key === "Escape") setEditingCell(null);
5078
- },
5079
- onBlur: (e) => {
5080
- const finalValue = e.target.value;
5081
- setEditingCell(null);
5082
- col.onBlur?.({ value: finalValue, row: item, field });
5275
+ className: "dg-group-toggle",
5276
+ onClick: (e) => {
5277
+ e.stopPropagation();
5278
+ toggleTreeRow(item.id);
5083
5279
  }
5084
- }
5085
- );
5086
- }
5087
- const formattedValue = col.valueFormatter ? col.valueFormatter({ value, row: item, field }) : value;
5088
- if (col.renderCell) {
5089
- return col.renderCell({ value, row: item, field });
5090
- }
5091
- if (col.render) {
5092
- return col.render(value, item);
5280
+ },
5281
+ isExpanded ? /* @__PURE__ */ React75.createElement(ChevronDown, { size: 15 }) : /* @__PURE__ */ React75.createElement(ChevronRight, { size: 15 })
5282
+ ) : /* @__PURE__ */ React75.createElement("span", { style: { display: "inline-block", width: 22 } }))
5283
+ );
5284
+ }
5285
+ if (colField === "__group__" || colField.startsWith("__group_")) {
5286
+ const colDef = typeof groupingColDef === "function" ? groupingColDef(colField) : groupingColDef;
5287
+ const leafField = colDef?.leafField;
5288
+ let leafContent = null;
5289
+ if (leafField) {
5290
+ const leafCol = resolvedColumns.find((c) => String(c.field) === leafField || String(c.key) === leafField);
5291
+ if (leafCol) {
5292
+ const raw = item[String(leafCol.field)];
5293
+ let val = leafCol.valueGetter ? leafCol.valueGetter({ value: raw, row: item, field: leafField }) : raw;
5294
+ if (leafCol.valueFormatter) val = leafCol.valueFormatter({ value: val, row: item, field: leafField });
5295
+ if (leafCol.renderCell) leafContent = leafCol.renderCell({ value: val, row: item, field: leafField });
5296
+ else leafContent = val == null ? "" : String(val);
5297
+ }
5093
5298
  }
5094
- return String(formattedValue ?? "");
5095
- })()
5096
- );
5097
- }), actions && /* @__PURE__ */ React75.createElement("td", { className: "dg-row-actions-cell" }, (() => {
5098
- const resolvedActions = typeof actions === "function" ? actions(item) : actions;
5099
- const visibleActions = resolvedActions.filter((a) => !a.show || a.show(item));
5100
- if (visibleActions.length === 0) return null;
5101
- 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(
5102
- "button",
5103
- {
5104
- className: "dg-row-action-btn",
5105
- style: { color: action.color || "var(--text-secondary)" },
5106
- onClick: () => action.onClick(item)
5107
- },
5108
- action.icon
5109
- )))));
5110
- })()))))), paginatedData.length === 0 && /* @__PURE__ */ React75.createElement("div", { className: "dg-empty-state" }, /* @__PURE__ */ React75.createElement("svg", { className: "dg-empty-icon", viewBox: "0 0 200 160", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React75.createElement("rect", { x: "20", y: "30", width: "160", height: "100", rx: "8", fill: "var(--hover-color)", stroke: "var(--border-color)", strokeWidth: "1.5" }), /* @__PURE__ */ React75.createElement("rect", { x: "20", y: "30", width: "160", height: "28", rx: "8", fill: "var(--border-color)", opacity: "0.5" }), /* @__PURE__ */ React75.createElement("rect", { x: "20", y: "50", width: "160", height: "8", rx: "0", fill: "var(--border-color)", opacity: "0.5" }), /* @__PURE__ */ React75.createElement("line", { x1: "72", y1: "30", x2: "72", y2: "130", stroke: "var(--border-color)", strokeWidth: "1" }), /* @__PURE__ */ React75.createElement("line", { x1: "128", y1: "30", x2: "128", y2: "130", stroke: "var(--border-color)", strokeWidth: "1" }), /* @__PURE__ */ React75.createElement("line", { x1: "20", y1: "78", x2: "180", y2: "78", stroke: "var(--border-color)", strokeWidth: "1" }), /* @__PURE__ */ React75.createElement("line", { x1: "20", y1: "104", x2: "180", y2: "104", stroke: "var(--border-color)", strokeWidth: "1" }), /* @__PURE__ */ React75.createElement("rect", { x: "32", y: "87", width: "28", height: "6", rx: "3", fill: "var(--border-color)", opacity: "0.4" }), /* @__PURE__ */ React75.createElement("rect", { x: "84", y: "87", width: "28", height: "6", rx: "3", fill: "var(--border-color)", opacity: "0.4" }), /* @__PURE__ */ React75.createElement("rect", { x: "140", y: "87", width: "28", height: "6", rx: "3", fill: "var(--border-color)", opacity: "0.4" }), /* @__PURE__ */ React75.createElement("rect", { x: "32", y: "113", width: "20", height: "6", rx: "3", fill: "var(--border-color)", opacity: "0.3" }), /* @__PURE__ */ React75.createElement("rect", { x: "84", y: "113", width: "32", height: "6", rx: "3", fill: "var(--border-color)", opacity: "0.3" }), /* @__PURE__ */ React75.createElement("rect", { x: "140", y: "113", width: "20", height: "6", rx: "3", fill: "var(--border-color)", opacity: "0.3" }), /* @__PURE__ */ React75.createElement("circle", { cx: "148", cy: "108", r: "26", fill: "var(--surface-color)", stroke: "var(--border-color)", strokeWidth: "1.5" }), /* @__PURE__ */ React75.createElement("circle", { cx: "145", cy: "105", r: "10", stroke: "var(--text-secondary)", strokeWidth: "2.5", opacity: "0.5" }), /* @__PURE__ */ React75.createElement("line", { x1: "152", y1: "113", x2: "161", y2: "122", stroke: "var(--text-secondary)", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.5" }), /* @__PURE__ */ React75.createElement("line", { x1: "141", y1: "101", x2: "149", y2: "109", stroke: "var(--text-secondary)", strokeWidth: "2", strokeLinecap: "round", opacity: "0.5" }), /* @__PURE__ */ React75.createElement("line", { x1: "149", y1: "101", x2: "141", y2: "109", stroke: "var(--text-secondary)", strokeWidth: "2", strokeLinecap: "round", opacity: "0.5" })), /* @__PURE__ */ React75.createElement("p", { className: "dg-empty-title" }, "No data found"), /* @__PURE__ */ React75.createElement("p", { className: "dg-empty-subtitle" }, filterText || hasActiveFilters ? "Try adjusting your search or filters" : "No records to display"))), pagination && /* @__PURE__ */ React75.createElement("div", { className: "dg-pagination" }, /* @__PURE__ */ React75.createElement("div", { className: "dg-page-info" }, /* @__PURE__ */ React75.createElement(Tooltip, { title: "Export CSV", placement: "top" }, /* @__PURE__ */ React75.createElement("button", { className: "dg-icon-btn", onClick: handleExport }, /* @__PURE__ */ React75.createElement(Download, { size: 14 }))), /* @__PURE__ */ React75.createElement("div", { className: "dg-per-page" }, /* @__PURE__ */ React75.createElement("span", null, "Rows per page:"), /* @__PURE__ */ React75.createElement(
5299
+ const groupColWidth = columnWidths[colField] || 200;
5300
+ return /* @__PURE__ */ React75.createElement(
5301
+ "td",
5302
+ {
5303
+ key: `${item.id}-${colField}`,
5304
+ className: "dg-group-leaf-cell",
5305
+ style: { width: groupColWidth, minWidth: groupColWidth, maxWidth: groupColWidth, paddingLeft: rowDepth * 20 + 32 }
5306
+ },
5307
+ leafContent
5308
+ );
5309
+ }
5310
+ const width = columnWidths[colField] || 200;
5311
+ const leftOffset = getLeftOffset(col, idx);
5312
+ const rightOffset = getRightOffset(col, idx);
5313
+ return /* @__PURE__ */ React75.createElement(
5314
+ "td",
5315
+ {
5316
+ key: `${item.id}-${colField}`,
5317
+ className: `dg-td${col.pinned === "left" ? " pinned-left" : col.pinned === "right" ? " pinned-right" : ""}${col.editable ? " dg-td--editable" : ""} ${col.cellClassName || ""}`,
5318
+ style: { width, minWidth: width, maxWidth: width, left: leftOffset, right: rightOffset, flex: col.flex },
5319
+ onDoubleClick: () => onCellDoubleClick?.({ row: item, field: colField, value: item[col.field || ""] }),
5320
+ onClick: col.editable ? () => {
5321
+ const field = String(col.field);
5322
+ const rawValue = item[col.field || ""];
5323
+ const value = col.valueGetter ? col.valueGetter({ value: rawValue, row: item, field }) : rawValue;
5324
+ setEditingCell({ rowId: item.id, field, value });
5325
+ } : void 0
5326
+ },
5327
+ (() => {
5328
+ const field = String(col.field);
5329
+ const rawValue = item[col.field || ""];
5330
+ let value = col.valueGetter ? col.valueGetter({ value: rawValue, row: item, field }) : rawValue;
5331
+ if (col.editable && editingCell?.rowId === item.id && editingCell?.field === field) {
5332
+ const inputType = col.type === "number" ? "number" : col.type === "date" ? "date" : "text";
5333
+ const commit = (finalValue) => {
5334
+ setEditingCell(null);
5335
+ col.onEnter?.({ value: finalValue, row: item, field });
5336
+ };
5337
+ return /* @__PURE__ */ React75.createElement(
5338
+ "input",
5339
+ {
5340
+ className: "dg-cell-editor",
5341
+ type: inputType,
5342
+ autoFocus: true,
5343
+ defaultValue: editingCell.value ?? "",
5344
+ onClick: (e) => e.stopPropagation(),
5345
+ onKeyDown: (e) => {
5346
+ if (e.key === "Enter") commit(e.target.value);
5347
+ if (e.key === "Escape") setEditingCell(null);
5348
+ },
5349
+ onBlur: (e) => {
5350
+ const finalValue = e.target.value;
5351
+ setEditingCell(null);
5352
+ col.onBlur?.({ value: finalValue, row: item, field });
5353
+ }
5354
+ }
5355
+ );
5356
+ }
5357
+ const formattedValue = col.valueFormatter ? col.valueFormatter({ value, row: item, field }) : value;
5358
+ if (col.renderCell) return col.renderCell({ value, row: item, field });
5359
+ if (col.render) return col.render(value, item);
5360
+ return String(formattedValue ?? "");
5361
+ })()
5362
+ );
5363
+ }), actions && /* @__PURE__ */ React75.createElement("td", { className: "dg-row-actions-cell" }, (() => {
5364
+ const resolvedActions = typeof actions === "function" ? actions(item) : actions;
5365
+ const visibleActions = resolvedActions.filter((a) => !a.show || a.show(item));
5366
+ if (visibleActions.length === 0) return null;
5367
+ 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(
5368
+ "button",
5369
+ {
5370
+ className: "dg-row-action-btn",
5371
+ style: { color: action.color || "var(--text-secondary)" },
5372
+ onClick: () => action.onClick(item)
5373
+ },
5374
+ action.icon
5375
+ )))));
5376
+ })()));
5377
+ }))), filteredData.length === 0 && /* @__PURE__ */ React75.createElement("div", { className: "dg-empty-state" }, /* @__PURE__ */ React75.createElement("svg", { className: "dg-empty-icon", viewBox: "0 0 200 160", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React75.createElement("rect", { x: "20", y: "30", width: "160", height: "100", rx: "8", fill: "var(--hover-color)", stroke: "var(--border-color)", strokeWidth: "1.5" }), /* @__PURE__ */ React75.createElement("rect", { x: "20", y: "30", width: "160", height: "28", rx: "8", fill: "var(--border-color)", opacity: "0.5" }), /* @__PURE__ */ React75.createElement("rect", { x: "20", y: "50", width: "160", height: "8", rx: "0", fill: "var(--border-color)", opacity: "0.5" }), /* @__PURE__ */ React75.createElement("line", { x1: "72", y1: "30", x2: "72", y2: "130", stroke: "var(--border-color)", strokeWidth: "1" }), /* @__PURE__ */ React75.createElement("line", { x1: "128", y1: "30", x2: "128", y2: "130", stroke: "var(--border-color)", strokeWidth: "1" }), /* @__PURE__ */ React75.createElement("line", { x1: "20", y1: "78", x2: "180", y2: "78", stroke: "var(--border-color)", strokeWidth: "1" }), /* @__PURE__ */ React75.createElement("line", { x1: "20", y1: "104", x2: "180", y2: "104", stroke: "var(--border-color)", strokeWidth: "1" }), /* @__PURE__ */ React75.createElement("rect", { x: "32", y: "87", width: "28", height: "6", rx: "3", fill: "var(--border-color)", opacity: "0.4" }), /* @__PURE__ */ React75.createElement("rect", { x: "84", y: "87", width: "28", height: "6", rx: "3", fill: "var(--border-color)", opacity: "0.4" }), /* @__PURE__ */ React75.createElement("rect", { x: "140", y: "87", width: "28", height: "6", rx: "3", fill: "var(--border-color)", opacity: "0.4" }), /* @__PURE__ */ React75.createElement("rect", { x: "32", y: "113", width: "20", height: "6", rx: "3", fill: "var(--border-color)", opacity: "0.3" }), /* @__PURE__ */ React75.createElement("rect", { x: "84", y: "113", width: "32", height: "6", rx: "3", fill: "var(--border-color)", opacity: "0.3" }), /* @__PURE__ */ React75.createElement("rect", { x: "140", y: "113", width: "20", height: "6", rx: "3", fill: "var(--border-color)", opacity: "0.3" }), /* @__PURE__ */ React75.createElement("circle", { cx: "148", cy: "108", r: "26", fill: "var(--surface-color)", stroke: "var(--border-color)", strokeWidth: "1.5" }), /* @__PURE__ */ React75.createElement("circle", { cx: "145", cy: "105", r: "10", stroke: "var(--text-secondary)", strokeWidth: "2.5", opacity: "0.5" }), /* @__PURE__ */ React75.createElement("line", { x1: "152", y1: "113", x2: "161", y2: "122", stroke: "var(--text-secondary)", strokeWidth: "2.5", strokeLinecap: "round", opacity: "0.5" }), /* @__PURE__ */ React75.createElement("line", { x1: "141", y1: "101", x2: "149", y2: "109", stroke: "var(--text-secondary)", strokeWidth: "2", strokeLinecap: "round", opacity: "0.5" }), /* @__PURE__ */ React75.createElement("line", { x1: "149", y1: "101", x2: "141", y2: "109", stroke: "var(--text-secondary)", strokeWidth: "2", strokeLinecap: "round", opacity: "0.5" })), /* @__PURE__ */ React75.createElement("p", { className: "dg-empty-title" }, "No data found"), /* @__PURE__ */ React75.createElement("p", { className: "dg-empty-subtitle" }, filterText || hasActiveFilters ? "Try adjusting your search or filters" : "No records to display"))), customFooter ? /* @__PURE__ */ React75.createElement("div", { className: "dg-pagination dg-pagination--custom" }, customFooter) : pagination && !tOpts.hideFooter && /* @__PURE__ */ React75.createElement("div", { className: "dg-pagination" }, /* @__PURE__ */ React75.createElement("div", { className: "dg-page-info" }, /* @__PURE__ */ React75.createElement(Tooltip, { title: "Export CSV", placement: "top" }, /* @__PURE__ */ React75.createElement("button", { className: "dg-icon-btn", onClick: handleExport }, /* @__PURE__ */ React75.createElement(Download, { size: 14 }))), /* @__PURE__ */ React75.createElement("div", { className: "dg-per-page" }, /* @__PURE__ */ React75.createElement("span", null, "Rows per page:"), /* @__PURE__ */ React75.createElement(
5111
5378
  FilterSelect,
5112
5379
  {
5113
5380
  placement: "top",
@@ -5148,6 +5415,17 @@ function DataGrid({
5148
5415
  setShowAdvancedFilter(true);
5149
5416
  setActiveMenu(null);
5150
5417
  } }, /* @__PURE__ */ React75.createElement(Filter, { size: 14 }), " Filter\u2026"),
5418
+ !disableRowGrouping && activeMenuCol?.groupable !== false && (() => {
5419
+ const gField = String(activeMenuCol?.field ?? "");
5420
+ const isGrouped = activeGroupingModel.includes(gField);
5421
+ return isGrouped ? /* @__PURE__ */ React75.createElement("button", { className: "dg-menu-item", onClick: () => {
5422
+ removeFromGrouping(gField);
5423
+ setActiveMenu(null);
5424
+ } }, /* @__PURE__ */ React75.createElement(Layers, { size: 14 }), " Ungroup") : /* @__PURE__ */ React75.createElement("button", { className: "dg-menu-item", onClick: () => {
5425
+ addToGrouping(gField);
5426
+ setActiveMenu(null);
5427
+ } }, /* @__PURE__ */ React75.createElement(Layers, { size: 14 }), " Group by");
5428
+ })(),
5151
5429
  /* @__PURE__ */ React75.createElement("button", { className: "dg-menu-item", onClick: () => toggleHide(activeMenu) }, /* @__PURE__ */ React75.createElement(EyeOff, { size: 14 }), " Hide column"),
5152
5430
  /* @__PURE__ */ React75.createElement("button", { className: "dg-menu-item", onClick: () => {
5153
5431
  setShowManageColumns(true);
@@ -9480,7 +9758,7 @@ function UserSelectionField({
9480
9758
  }
9481
9759
 
9482
9760
  // lib/SmartSelect/SmartSelect.tsx
9483
- import React108, { useCallback as useCallback11, useEffect as useEffect21, useMemo as useMemo3, useRef as useRef25 } from "react";
9761
+ import React108, { useCallback as useCallback11, useEffect as useEffect21, useMemo as useMemo3, useRef as useRef25, useState as useState26 } from "react";
9484
9762
  var CheckIcon3 = () => /* @__PURE__ */ React108.createElement("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }, /* @__PURE__ */ React108.createElement("polyline", { points: "20 6 9 17 4 12" }));
9485
9763
  function flattenTree(options, getChildren, depth = 0) {
9486
9764
  return options.flatMap((opt) => [
@@ -9536,6 +9814,14 @@ function SmartSelect({
9536
9814
  useEffect21(() => () => {
9537
9815
  if (debounceTimer.current) clearTimeout(debounceTimer.current);
9538
9816
  }, []);
9817
+ const [inputValue, setInputValue] = useState26(
9818
+ () => !multiple && value != null ? getOptionLabel(value) : ""
9819
+ );
9820
+ useEffect21(() => {
9821
+ if (!multiple) {
9822
+ setInputValue(value != null ? getOptionLabel(value) : "");
9823
+ }
9824
+ }, [value, multiple, getOptionLabel]);
9539
9825
  const getValue = useCallback11(
9540
9826
  (o) => getOptionValue ? getOptionValue(o) : String(getOptionLabel(o)),
9541
9827
  [getOptionValue, getOptionLabel]
@@ -9566,14 +9852,15 @@ function SmartSelect({
9566
9852
  }
9567
9853
  return value != null ? /* @__PURE__ */ new Set([getValue(value)]) : /* @__PURE__ */ new Set();
9568
9854
  }, [multiple, value, getValue]);
9569
- const handleInputChange = useCallback11((_, inputValue) => {
9855
+ const handleInputChange = useCallback11((_, inputValue2) => {
9856
+ setInputValue(inputValue2);
9570
9857
  if (!onSearchChange) return;
9571
9858
  if (debounceTimer.current) clearTimeout(debounceTimer.current);
9572
- if (!inputValue) {
9859
+ if (!inputValue2) {
9573
9860
  onSearchChange("", 0);
9574
9861
  return;
9575
9862
  }
9576
- const q = inputValue.toLowerCase();
9863
+ const q = inputValue2.toLowerCase();
9577
9864
  let localCount = 0;
9578
9865
  for (const opt of flatOptionsList) {
9579
9866
  if (getOptionLabel(opt).toLowerCase().includes(q) || (getOptionSubLabel?.(opt) ?? "").toLowerCase().includes(q)) {
@@ -9584,10 +9871,10 @@ function SmartSelect({
9584
9871
  if (localCount >= searchThreshold) return;
9585
9872
  const needed = searchThreshold - localCount;
9586
9873
  if (debounceMs <= 0) {
9587
- onSearchChange(inputValue, needed);
9874
+ onSearchChange(inputValue2, needed);
9588
9875
  } else {
9589
9876
  debounceTimer.current = setTimeout(() => {
9590
- onSearchChange(inputValue, needed);
9877
+ onSearchChange(inputValue2, needed);
9591
9878
  }, debounceMs);
9592
9879
  }
9593
9880
  }, [onSearchChange, debounceMs, searchThreshold, flatOptionsList, getOptionLabel, getOptionSubLabel]);
@@ -9666,13 +9953,13 @@ function SmartSelect({
9666
9953
  /* @__PURE__ */ React108.createElement("span", { className: "rf-select__option-check", "aria-hidden": "true" }, /* @__PURE__ */ React108.createElement(CheckIcon3, null))
9667
9954
  );
9668
9955
  }, [depthMap, getValue, getOptionLabel, getOptionSubLabel, selectedKeys]);
9669
- const computedFilterOptions = useCallback11((opts, inputValue) => {
9670
- if (filterOptionsProp) return filterOptionsProp(opts, inputValue);
9956
+ const computedFilterOptions = useCallback11((opts, inputValue2) => {
9957
+ if (filterOptionsProp) return filterOptionsProp(opts, inputValue2);
9671
9958
  if (multiple) {
9672
9959
  const selected = opts.filter((o) => selectedKeys.has(getValue(o)));
9673
9960
  const unselected = opts.filter((o) => !selectedKeys.has(getValue(o)));
9674
- if (!inputValue) return [...selected, ...unselected];
9675
- const q2 = inputValue.toLowerCase();
9961
+ if (!inputValue2) return [...selected, ...unselected];
9962
+ const q2 = inputValue2.toLowerCase();
9676
9963
  const filteredUnselected = unselected.filter(
9677
9964
  (opt) => getOptionLabel(opt).toLowerCase().includes(q2) || (getOptionSubLabel?.(opt) ?? "").toLowerCase().includes(q2)
9678
9965
  ).slice(0, searchThreshold);
@@ -9680,7 +9967,7 @@ function SmartSelect({
9680
9967
  }
9681
9968
  if (value != null) {
9682
9969
  const selectedLabel = getOptionLabel(value);
9683
- if (inputValue === selectedLabel) {
9970
+ if (inputValue2 === selectedLabel) {
9684
9971
  const selectedKey = getValue(value);
9685
9972
  return [
9686
9973
  ...opts.filter((o) => getValue(o) === selectedKey),
@@ -9688,8 +9975,8 @@ function SmartSelect({
9688
9975
  ];
9689
9976
  }
9690
9977
  }
9691
- if (!inputValue) return opts;
9692
- const q = inputValue.toLowerCase();
9978
+ if (!inputValue2) return opts;
9979
+ const q = inputValue2.toLowerCase();
9693
9980
  return opts.filter(
9694
9981
  (opt) => getOptionLabel(opt).toLowerCase().includes(q) || (getOptionSubLabel?.(opt) ?? "").toLowerCase().includes(q)
9695
9982
  ).slice(0, searchThreshold);
@@ -9700,6 +9987,7 @@ function SmartSelect({
9700
9987
  options: displayOptions,
9701
9988
  value: value ?? (multiple ? [] : null),
9702
9989
  onChange: handleChange,
9990
+ inputValue: multiple ? void 0 : inputValue,
9703
9991
  onInputChange: handleInputChange,
9704
9992
  multiple,
9705
9993
  limitTags,
@@ -9726,7 +10014,7 @@ function SmartSelect({
9726
10014
  }
9727
10015
 
9728
10016
  // lib/RufousTextEditor/RufousTextEditor.tsx
9729
- import React119, { useMemo as useMemo5, useCallback as useCallback16, useState as useState35, useRef as useRef33, useEffect as useEffect30 } from "react";
10017
+ import React119, { useMemo as useMemo5, useCallback as useCallback16, useState as useState36, useRef as useRef33, useEffect as useEffect30 } from "react";
9730
10018
  import { createPortal as createPortal8 } from "react-dom";
9731
10019
  import { useEditor, EditorContent, EditorContext, FloatingMenu, BubbleMenu } from "@tiptap/react";
9732
10020
  import StarterKit from "@tiptap/starter-kit";
@@ -9752,9 +10040,9 @@ import { ReactRenderer } from "@tiptap/react";
9752
10040
  import tippy from "tippy.js";
9753
10041
 
9754
10042
  // lib/RufousTextEditor/MentionList.tsx
9755
- import React109, { forwardRef as forwardRef11, useEffect as useEffect22, useImperativeHandle, useState as useState26 } from "react";
10043
+ import React109, { forwardRef as forwardRef11, useEffect as useEffect22, useImperativeHandle, useState as useState27 } from "react";
9756
10044
  var MentionList = forwardRef11((props, ref) => {
9757
- const [selectedIndex, setSelectedIndex] = useState26(0);
10045
+ const [selectedIndex, setSelectedIndex] = useState27(0);
9758
10046
  const selectItem = (index) => {
9759
10047
  const item = props.items[index];
9760
10048
  if (item) {
@@ -9848,18 +10136,18 @@ function createMentionSuggestion(users) {
9848
10136
  }
9849
10137
 
9850
10138
  // lib/RufousTextEditor/Toolbar.tsx
9851
- import React115, { useState as useState31, useRef as useRef29, useEffect as useEffect26, useCallback as useCallback15 } from "react";
10139
+ import React115, { useState as useState32, useRef as useRef29, useEffect as useEffect26, useCallback as useCallback15 } from "react";
9852
10140
  import { createPortal as createPortal4 } from "react-dom";
9853
10141
 
9854
10142
  // lib/RufousTextEditor/TextToSpeech.tsx
9855
- import React110, { useState as useState27, useEffect as useEffect23, useRef as useRef26, useCallback as useCallback12, forwardRef as forwardRef12, useImperativeHandle as useImperativeHandle2 } from "react";
10143
+ import React110, { useState as useState28, useEffect as useEffect23, useRef as useRef26, useCallback as useCallback12, forwardRef as forwardRef12, useImperativeHandle as useImperativeHandle2 } from "react";
9856
10144
  var TextToSpeech = forwardRef12(({ editor, onTextToSpeech }, ref) => {
9857
- const [speaking, setSpeaking] = useState27(false);
9858
- const [paused, setPaused] = useState27(false);
9859
- const [voices, setVoices] = useState27([]);
9860
- const [selectedVoice, setSelectedVoice] = useState27("");
9861
- const [rate, setRate] = useState27(1);
9862
- const [showPanel, setShowPanel] = useState27(false);
10145
+ const [speaking, setSpeaking] = useState28(false);
10146
+ const [paused, setPaused] = useState28(false);
10147
+ const [voices, setVoices] = useState28([]);
10148
+ const [selectedVoice, setSelectedVoice] = useState28("");
10149
+ const [rate, setRate] = useState28(1);
10150
+ const [showPanel, setShowPanel] = useState28(false);
9863
10151
  const utteranceRef = useRef26(null);
9864
10152
  const panelRef = useRef26(null);
9865
10153
  useEffect23(() => {
@@ -9997,12 +10285,12 @@ var TextToSpeech = forwardRef12(({ editor, onTextToSpeech }, ref) => {
9997
10285
  var TextToSpeech_default = TextToSpeech;
9998
10286
 
9999
10287
  // lib/RufousTextEditor/SpeechToText.tsx
10000
- import React111, { useState as useState28, useRef as useRef27, useCallback as useCallback13, useEffect as useEffect24, forwardRef as forwardRef13, useImperativeHandle as useImperativeHandle3 } from "react";
10288
+ import React111, { useState as useState29, useRef as useRef27, useCallback as useCallback13, useEffect as useEffect24, forwardRef as forwardRef13, useImperativeHandle as useImperativeHandle3 } from "react";
10001
10289
  var SpeechToText = forwardRef13(({ editor, onSpeechToText }, ref) => {
10002
- const [listening, setListening] = useState28(false);
10003
- const [showPanel, setShowPanel] = useState28(false);
10004
- const [language, setLanguage] = useState28("en-US");
10005
- const [interim, setInterim] = useState28("");
10290
+ const [listening, setListening] = useState29(false);
10291
+ const [showPanel, setShowPanel] = useState29(false);
10292
+ const [language, setLanguage] = useState29("en-US");
10293
+ const [interim, setInterim] = useState29("");
10006
10294
  const recognitionRef = useRef27(null);
10007
10295
  const panelRef = useRef27(null);
10008
10296
  const isListeningRef = useRef27(false);
@@ -10159,7 +10447,7 @@ var SpeechToText = forwardRef13(({ editor, onSpeechToText }, ref) => {
10159
10447
  var SpeechToText_default = SpeechToText;
10160
10448
 
10161
10449
  // lib/RufousTextEditor/AICommands.tsx
10162
- import React112, { useState as useState29, useRef as useRef28, useEffect as useEffect25, useCallback as useCallback14 } from "react";
10450
+ import React112, { useState as useState30, useRef as useRef28, useEffect as useEffect25, useCallback as useCallback14 } from "react";
10163
10451
  import { createPortal as createPortal2 } from "react-dom";
10164
10452
  var AI_COMMANDS = [
10165
10453
  { id: "improve", label: "Improve writing", prompt: "Improve the following text to make it clearer, more engaging, and well-structured. Return only the improved text, no explanations." },
@@ -10207,14 +10495,14 @@ var callOpenAI = async (prompt, text, previousResults = []) => {
10207
10495
  return data.choices?.[0]?.message?.content?.trim() || "";
10208
10496
  };
10209
10497
  var AICommands = ({ editor, onAICommand }) => {
10210
- const [open, setOpen] = useState29(false);
10211
- const [showModal, setShowModal] = useState29(false);
10212
- const [loading, setLoading] = useState29(false);
10213
- const [promptText, setPromptText] = useState29("");
10214
- const [resultText, setResultText] = useState29("");
10215
- const [originalText, setOriginalText] = useState29("");
10216
- const [selectionRange, setSelectionRange] = useState29(null);
10217
- const [previousResults, setPreviousResults] = useState29([]);
10498
+ const [open, setOpen] = useState30(false);
10499
+ const [showModal, setShowModal] = useState30(false);
10500
+ const [loading, setLoading] = useState30(false);
10501
+ const [promptText, setPromptText] = useState30("");
10502
+ const [resultText, setResultText] = useState30("");
10503
+ const [originalText, setOriginalText] = useState30("");
10504
+ const [selectionRange, setSelectionRange] = useState30(null);
10505
+ const [previousResults, setPreviousResults] = useState30([]);
10218
10506
  const panelRef = useRef28(null);
10219
10507
  useEffect25(() => {
10220
10508
  const handleClick = (e) => {
@@ -10364,7 +10652,7 @@ var AICommands = ({ editor, onAICommand }) => {
10364
10652
  var AICommands_default = AICommands;
10365
10653
 
10366
10654
  // lib/RufousTextEditor/TranslateModal.tsx
10367
- import React113, { useState as useState30, useMemo as useMemo4 } from "react";
10655
+ import React113, { useState as useState31, useMemo as useMemo4 } from "react";
10368
10656
  import { createPortal as createPortal3 } from "react-dom";
10369
10657
  var LANGUAGES = [
10370
10658
  { code: "af", name: "Afrikaans" },
@@ -10504,12 +10792,12 @@ async function translateText(text, sourceLang, targetLang) {
10504
10792
  return null;
10505
10793
  }
10506
10794
  var TranslateModal = ({ editor, onClose, onTranslate, initialSource, initialTarget, onLangChange }) => {
10507
- const [sourceLang, setSourceLang] = useState30(initialSource || "en");
10508
- const [targetLang, setTargetLang] = useState30(initialTarget || "hi");
10509
- const [sourceFilter, setSourceFilter] = useState30("");
10510
- const [targetFilter, setTargetFilter] = useState30("");
10511
- const [translating, setTranslating] = useState30(false);
10512
- const [error, setError] = useState30("");
10795
+ const [sourceLang, setSourceLang] = useState31(initialSource || "en");
10796
+ const [targetLang, setTargetLang] = useState31(initialTarget || "hi");
10797
+ const [sourceFilter, setSourceFilter] = useState31("");
10798
+ const [targetFilter, setTargetFilter] = useState31("");
10799
+ const [translating, setTranslating] = useState31(false);
10800
+ const [error, setError] = useState31("");
10513
10801
  const filteredSource = useMemo4(() => LANGUAGES.filter(
10514
10802
  (l) => l.name.toLowerCase().includes(sourceFilter.toLowerCase()) || l.code.toLowerCase().includes(sourceFilter.toLowerCase())
10515
10803
  ), [sourceFilter]);
@@ -11413,7 +11701,7 @@ var SPECIAL_CHARS = [
11413
11701
  "\xA2"
11414
11702
  ];
11415
11703
  var Dropdown = ({ trigger, children, className = "", keepOpen = false }) => {
11416
- const [open, setOpen] = useState31(false);
11704
+ const [open, setOpen] = useState32(false);
11417
11705
  const ref = useRef29(null);
11418
11706
  const menuRef = useRef29(null);
11419
11707
  useEffect26(() => {
@@ -11471,8 +11759,8 @@ var Dropdown = ({ trigger, children, className = "", keepOpen = false }) => {
11471
11759
  ));
11472
11760
  };
11473
11761
  var InsertPanel = ({ editor, onClose, mode = "video" }) => {
11474
- const [activeTab, setActiveTab] = useState31("link");
11475
- const [url, setUrl] = useState31("");
11762
+ const [activeTab, setActiveTab] = useState32("link");
11763
+ const [url, setUrl] = useState32("");
11476
11764
  const extractIframeSrc = (html) => {
11477
11765
  const match = html.match(/<iframe[^>]+src=["']([^"']+)["']/);
11478
11766
  return match ? match[1] : null;
@@ -11542,9 +11830,9 @@ var InsertPanel = ({ editor, onClose, mode = "video" }) => {
11542
11830
  ), /* @__PURE__ */ React115.createElement("button", { className: "insert-panel-btn", onClick: handleInsert }, "Insert"));
11543
11831
  };
11544
11832
  var ImagePanel = ({ editor, onClose, onImageUpload }) => {
11545
- const [activeTab, setActiveTab] = useState31("upload");
11546
- const [url, setUrl] = useState31("");
11547
- const [isDragging, setIsDragging] = useState31(false);
11833
+ const [activeTab, setActiveTab] = useState32("upload");
11834
+ const [url, setUrl] = useState32("");
11835
+ const [isDragging, setIsDragging] = useState32(false);
11548
11836
  const fileInputRef = useRef29(null);
11549
11837
  const getBase64 = (file) => {
11550
11838
  return new Promise((resolve, reject) => {
@@ -11635,8 +11923,8 @@ var ImagePanel = ({ editor, onClose, onImageUpload }) => {
11635
11923
  };
11636
11924
  var MAX_GRID = 10;
11637
11925
  var TableGridSelector = ({ editor, onClose }) => {
11638
- const [hoverRow, setHoverRow] = useState31(0);
11639
- const [hoverCol, setHoverCol] = useState31(0);
11926
+ const [hoverRow, setHoverRow] = useState32(0);
11927
+ const [hoverCol, setHoverCol] = useState32(0);
11640
11928
  const handleInsert = () => {
11641
11929
  if (!editor || hoverRow === 0 || hoverCol === 0) return;
11642
11930
  editor.chain().focus().insertTable({ rows: hoverRow, cols: hoverCol, withHeaderRow: true }).run();
@@ -11674,9 +11962,9 @@ var TableGridSelector = ({ editor, onClose }) => {
11674
11962
  )));
11675
11963
  };
11676
11964
  var ColorPickerPanel = ({ editor, onClose }) => {
11677
- const [tab, setTab] = useState31("background");
11678
- const [activeBg, setActiveBg] = useState31(() => editor.getAttributes("highlight").color || null);
11679
- const [activeText, setActiveText] = useState31(() => editor.getAttributes("textStyle").color || null);
11965
+ const [tab, setTab] = useState32("background");
11966
+ const [activeBg, setActiveBg] = useState32(() => editor.getAttributes("highlight").color || null);
11967
+ const [activeText, setActiveText] = useState32(() => editor.getAttributes("textStyle").color || null);
11680
11968
  const activeColor = tab === "background" ? activeBg : activeText;
11681
11969
  const applyColor = (color) => {
11682
11970
  if (tab === "background") {
@@ -11721,8 +12009,8 @@ var ColorPickerPanel = ({ editor, onClose }) => {
11721
12009
  )))), /* @__PURE__ */ React115.createElement("div", { className: "color-picker-footer" }, /* @__PURE__ */ React115.createElement("div", { className: "color-picker-preview", style: { background: activeColor || "#000" } }), /* @__PURE__ */ React115.createElement(Tooltip, { title: "Remove color", placement: "top" }, /* @__PURE__ */ React115.createElement("button", { className: "color-picker-remove", onClick: removeColor }, "\u2713"))));
11722
12010
  };
11723
12011
  var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTextToSpeech, onClose, onImageUpload, visibleButtons, isFullscreen, onToggleFullscreen }) => {
11724
- const [, setEditorState] = useState31(0);
11725
- const [todoEnabled, setTodoEnabled] = useState31(false);
12012
+ const [, setEditorState] = useState32(0);
12013
+ const [todoEnabled, setTodoEnabled] = useState32(false);
11726
12014
  const ttsRef = useRef29(null);
11727
12015
  const sttRef = useRef29(null);
11728
12016
  const show = (id) => !visibleButtons || visibleButtons.has(id);
@@ -11736,11 +12024,11 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
11736
12024
  if (!editor) return;
11737
12025
  editor.chain().focus().insertContent(char).run();
11738
12026
  }, [editor]);
11739
- const [copySuccess, setCopySuccess] = useState31(false);
11740
- const [translateSource, setTranslateSource] = useState31("en");
11741
- const [translateTarget, setTranslateTarget] = useState31("hi");
11742
- const [translateStatus, setTranslateStatus] = useState31("");
11743
- const [showTranslateModal, setShowTranslateModal] = useState31(false);
12027
+ const [copySuccess, setCopySuccess] = useState32(false);
12028
+ const [translateSource, setTranslateSource] = useState32("en");
12029
+ const [translateTarget, setTranslateTarget] = useState32("hi");
12030
+ const [translateStatus, setTranslateStatus] = useState32("");
12031
+ const [showTranslateModal, setShowTranslateModal] = useState32(false);
11744
12032
  const handleCopy = useCallback15(async () => {
11745
12033
  if (!editor) return;
11746
12034
  const { from, to, empty } = editor.state.selection;
@@ -12349,7 +12637,7 @@ var Toolbar = ({ editor, setLink, onAICommand, onTranslate, onSpeechToText, onTe
12349
12637
  var Toolbar_default = Toolbar;
12350
12638
 
12351
12639
  // lib/RufousTextEditor/ImageToolbar.tsx
12352
- import React116, { useState as useState32, useEffect as useEffect27, useRef as useRef30 } from "react";
12640
+ import React116, { useState as useState33, useEffect as useEffect27, useRef as useRef30 } from "react";
12353
12641
  import { createPortal as createPortal5 } from "react-dom";
12354
12642
  var ALIGNMENTS = [
12355
12643
  { value: "left", label: "Left", icon: "\u2630" },
@@ -12357,17 +12645,17 @@ var ALIGNMENTS = [
12357
12645
  { value: "right", label: "Right", icon: "\u2263" }
12358
12646
  ];
12359
12647
  var ImagePropertiesModal = ({ editor, node, onClose }) => {
12360
- const [activeTab, setActiveTab] = useState32("image");
12361
- const [src, setSrc] = useState32(node?.attrs?.src || "");
12362
- const [title, setTitle] = useState32(node?.attrs?.title || "");
12363
- const [alt, setAlt] = useState32(node?.attrs?.alt || "");
12364
- const [link, setLink] = useState32("");
12365
- const [openInNewTab, setOpenInNewTab] = useState32(false);
12366
- const [width, setWidth] = useState32("");
12367
- const [height, setHeight] = useState32("");
12368
- const [lockRatio, setLockRatio] = useState32(true);
12369
- const [naturalWidth, setNaturalWidth] = useState32(0);
12370
- const [naturalHeight, setNaturalHeight] = useState32(0);
12648
+ const [activeTab, setActiveTab] = useState33("image");
12649
+ const [src, setSrc] = useState33(node?.attrs?.src || "");
12650
+ const [title, setTitle] = useState33(node?.attrs?.title || "");
12651
+ const [alt, setAlt] = useState33(node?.attrs?.alt || "");
12652
+ const [link, setLink] = useState33("");
12653
+ const [openInNewTab, setOpenInNewTab] = useState33(false);
12654
+ const [width, setWidth] = useState33("");
12655
+ const [height, setHeight] = useState33("");
12656
+ const [lockRatio, setLockRatio] = useState33(true);
12657
+ const [naturalWidth, setNaturalWidth] = useState33(0);
12658
+ const [naturalHeight, setNaturalHeight] = useState33(0);
12371
12659
  useEffect27(() => {
12372
12660
  if (src) {
12373
12661
  const img = new window.Image();
@@ -12486,11 +12774,11 @@ var ImagePropertiesModal = ({ editor, node, onClose }) => {
12486
12774
  ), "Open link in new tab")) : /* @__PURE__ */ React116.createElement(React116.Fragment, null, /* @__PURE__ */ React116.createElement("label", { className: "modal-label" }, "CSS Class"), /* @__PURE__ */ React116.createElement("input", { type: "text", className: "modal-input", placeholder: "e.g. rounded shadow" }), /* @__PURE__ */ React116.createElement("label", { className: "modal-label" }, "Inline Style"), /* @__PURE__ */ React116.createElement("input", { type: "text", className: "modal-input", placeholder: "e.g. border: 1px solid #ccc" }))))), /* @__PURE__ */ React116.createElement("div", { className: "modal-footer" }, /* @__PURE__ */ React116.createElement("div", { className: "modal-footer-left" }, /* @__PURE__ */ React116.createElement("button", { className: "modal-btn-cancel", onClick: onClose }, "Cancel"), /* @__PURE__ */ React116.createElement("button", { className: "modal-btn-delete", onClick: handleDelete }, "Delete")), /* @__PURE__ */ React116.createElement("button", { className: "modal-btn-apply", onClick: handleApply }, "Apply"))));
12487
12775
  };
12488
12776
  var ImageToolbar = ({ editor }) => {
12489
- const [showModal, setShowModal] = useState32(false);
12490
- const [showAlign, setShowAlign] = useState32(false);
12491
- const [showVAlign, setShowVAlign] = useState32(false);
12492
- const [copyStatus, setCopyStatus] = useState32("");
12493
- const [pos, setPos] = useState32(null);
12777
+ const [showModal, setShowModal] = useState33(false);
12778
+ const [showAlign, setShowAlign] = useState33(false);
12779
+ const [showVAlign, setShowVAlign] = useState33(false);
12780
+ const [copyStatus, setCopyStatus] = useState33("");
12781
+ const [pos, setPos] = useState33(null);
12494
12782
  const toolbarRef = useRef30(null);
12495
12783
  useEffect27(() => {
12496
12784
  if (!editor) return;
@@ -12628,7 +12916,7 @@ var ImageToolbar = ({ editor }) => {
12628
12916
  var ImageToolbar_default = ImageToolbar;
12629
12917
 
12630
12918
  // lib/RufousTextEditor/VideoToolbar.tsx
12631
- import React117, { useState as useState33, useEffect as useEffect28, useRef as useRef31 } from "react";
12919
+ import React117, { useState as useState34, useEffect as useEffect28, useRef as useRef31 } from "react";
12632
12920
  import { createPortal as createPortal6 } from "react-dom";
12633
12921
  var ALIGNMENTS2 = [
12634
12922
  { value: "left", label: "Left", icon: "\u2630" },
@@ -12637,10 +12925,10 @@ var ALIGNMENTS2 = [
12637
12925
  ];
12638
12926
  var VIDEO_TYPES = ["youtube", "video"];
12639
12927
  var VideoPropertiesModal = ({ editor, node, nodeType, onClose }) => {
12640
- const [src, setSrc] = useState33(node?.attrs?.src || "");
12641
- const [width, setWidth] = useState33(String(node?.attrs?.width || 640));
12642
- const [height, setHeight] = useState33(String(node?.attrs?.height || 360));
12643
- const [lockRatio, setLockRatio] = useState33(true);
12928
+ const [src, setSrc] = useState34(node?.attrs?.src || "");
12929
+ const [width, setWidth] = useState34(String(node?.attrs?.width || 640));
12930
+ const [height, setHeight] = useState34(String(node?.attrs?.height || 360));
12931
+ const [lockRatio, setLockRatio] = useState34(true);
12644
12932
  const handleWidthChange = (val) => {
12645
12933
  setWidth(val);
12646
12934
  if (lockRatio) {
@@ -12738,11 +13026,11 @@ var VideoPropertiesModal = ({ editor, node, nodeType, onClose }) => {
12738
13026
  )))), /* @__PURE__ */ React117.createElement("div", { className: "modal-footer" }, /* @__PURE__ */ React117.createElement("div", { className: "modal-footer-left" }, /* @__PURE__ */ React117.createElement("button", { className: "modal-btn-cancel", onClick: onClose }, "Cancel"), /* @__PURE__ */ React117.createElement("button", { className: "modal-btn-delete", onClick: handleDelete }, "Delete")), /* @__PURE__ */ React117.createElement("button", { className: "modal-btn-apply", onClick: handleApply }, "Apply"))));
12739
13027
  };
12740
13028
  var VideoToolbar = ({ editor }) => {
12741
- const [showModal, setShowModal] = useState33(false);
12742
- const [showSize, setShowSize] = useState33(false);
12743
- const [showAlign, setShowAlign] = useState33(false);
12744
- const [copyStatus, setCopyStatus] = useState33("");
12745
- const [pos, setPos] = useState33(null);
13029
+ const [showModal, setShowModal] = useState34(false);
13030
+ const [showSize, setShowSize] = useState34(false);
13031
+ const [showAlign, setShowAlign] = useState34(false);
13032
+ const [copyStatus, setCopyStatus] = useState34("");
13033
+ const [pos, setPos] = useState34(null);
12746
13034
  const toolbarRef = useRef31(null);
12747
13035
  useEffect28(() => {
12748
13036
  if (!editor) return;
@@ -12868,7 +13156,7 @@ var VideoToolbar = ({ editor }) => {
12868
13156
  var VideoToolbar_default = VideoToolbar;
12869
13157
 
12870
13158
  // lib/RufousTextEditor/TableToolbar.tsx
12871
- import React118, { useState as useState34, useEffect as useEffect29, useRef as useRef32 } from "react";
13159
+ import React118, { useState as useState35, useEffect as useEffect29, useRef as useRef32 } from "react";
12872
13160
  import { createPortal as createPortal7 } from "react-dom";
12873
13161
  var IconAddRowBefore = () => /* @__PURE__ */ React118.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React118.createElement("path", { d: "M20 3H4c-.55 0-1 .45-1 1v16c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1zm-1 8H5V5h14v6zm0 8H5v-6h14v6z" }), /* @__PURE__ */ React118.createElement("path", { d: "M9 6h2v1.5h1.5v2H11V11H9V9.5H7.5v-2H9z" }));
12874
13162
  var IconAddRowAfter = () => /* @__PURE__ */ React118.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React118.createElement("path", { d: "M20 3H4c-.55 0-1 .45-1 1v16c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1zm-1 8H5V5h14v6zm0 8H5v-6h14v6z" }), /* @__PURE__ */ React118.createElement("path", { d: "M9 14h2v1.5h1.5v2H11V19H9v-1.5H7.5v-2H9z" }));
@@ -12881,7 +13169,7 @@ var IconMergeCells = () => /* @__PURE__ */ React118.createElement("svg", { width
12881
13169
  var IconSplitCell = () => /* @__PURE__ */ React118.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React118.createElement("path", { d: "M3 3h18v18H3V3zm2 2v5h6V5H5zm8 0v5h6V5h-6zM5 13v6h6v-6H5zm8 0v6h6v-6h-6z" }));
12882
13170
  var IconToggleHeader = () => /* @__PURE__ */ React118.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "currentColor" }, /* @__PURE__ */ React118.createElement("path", { d: "M3 3h18v18H3V3zm2 2v4h14V5H5zm0 6v8h14v-8H5z" }), /* @__PURE__ */ React118.createElement("rect", { x: "5", y: "5", width: "14", height: "4", opacity: "0.4" }));
12883
13171
  var TableToolbar = ({ editor }) => {
12884
- const [pos, setPos] = useState34(null);
13172
+ const [pos, setPos] = useState35(null);
12885
13173
  const toolbarRef = useRef32(null);
12886
13174
  useEffect29(() => {
12887
13175
  if (!editor) return;
@@ -13248,13 +13536,13 @@ var RufousTextEditor = ({
13248
13536
  };
13249
13537
  }, [editor]);
13250
13538
  const setLinkRef = useRef33(null);
13251
- const [linkModalOpen, setLinkModalOpen] = useState35(false);
13252
- const [linkUrl, setLinkUrl] = useState35("");
13253
- const [linkText, setLinkText] = useState35("");
13254
- const [linkClassName, setLinkClassName] = useState35("");
13255
- const [linkNewTab, setLinkNewTab] = useState35(true);
13256
- const [linkNoFollow, setLinkNoFollow] = useState35(true);
13257
- const [linkSelection, setLinkSelection] = useState35(null);
13539
+ const [linkModalOpen, setLinkModalOpen] = useState36(false);
13540
+ const [linkUrl, setLinkUrl] = useState36("");
13541
+ const [linkText, setLinkText] = useState36("");
13542
+ const [linkClassName, setLinkClassName] = useState36("");
13543
+ const [linkNewTab, setLinkNewTab] = useState36(true);
13544
+ const [linkNoFollow, setLinkNoFollow] = useState36(true);
13545
+ const [linkSelection, setLinkSelection] = useState36(null);
13258
13546
  const setLink = useCallback16(() => {
13259
13547
  if (!editor) return;
13260
13548
  const attrs = editor.getAttributes("link");
@@ -13380,7 +13668,7 @@ var RufousTextEditor = ({
13380
13668
  setLinkSelection(null);
13381
13669
  editor?.chain().focus().run();
13382
13670
  }, [editor]);
13383
- const [saveStatus, setSaveStatus] = useState35("");
13671
+ const [saveStatus, setSaveStatus] = useState36("");
13384
13672
  const handleSave = useCallback16(() => {
13385
13673
  if (!editor || !onSaveProp) return;
13386
13674
  onSaveProp(editor.getHTML(), editor.getJSON());
@@ -13392,7 +13680,7 @@ var RufousTextEditor = ({
13392
13680
  onExportProp(editor.getHTML(), editor.getJSON());
13393
13681
  }, [editor, onExportProp]);
13394
13682
  const providerValue = useMemo5(() => ({ editor }), [editor]);
13395
- const [isFullscreen, setIsFullscreen] = useState35(false);
13683
+ const [isFullscreen, setIsFullscreen] = useState36(false);
13396
13684
  const toggleFullscreen = useCallback16(() => setIsFullscreen((prev) => !prev), []);
13397
13685
  const wrapperJsx = /* @__PURE__ */ React119.createElement(
13398
13686
  "div",
@@ -13715,10 +14003,10 @@ function getCitiesByName(name, exact = false) {
13715
14003
  }
13716
14004
 
13717
14005
  // lib/utils/useLocationSearch.ts
13718
- import { useState as useState36, useEffect as useEffect31, useRef as useRef34, useCallback as useCallback17 } from "react";
14006
+ import { useState as useState37, useEffect as useEffect31, useRef as useRef34, useCallback as useCallback17 } from "react";
13719
14007
  function useDebounced(searcher, debounceMs) {
13720
- const [query, setQuery] = useState36("");
13721
- const [results, setResults] = useState36([]);
14008
+ const [query, setQuery] = useState37("");
14009
+ const [results, setResults] = useState37([]);
13722
14010
  const timer = useRef34(null);
13723
14011
  useEffect31(() => () => {
13724
14012
  if (timer.current) clearTimeout(timer.current);