@deepnoid/ui 0.1.126 → 0.1.127

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.
@@ -434,7 +434,7 @@ var CircularProgress = (0, import_react.forwardRef)((originalProps, ref) => {
434
434
  cx: size / 2,
435
435
  cy: size / 2,
436
436
  r: OUTER_RADIUS + BORDER_MARGIN,
437
- fill: "none",
437
+ fill: "#fff",
438
438
  stroke: "#DFE2E7",
439
439
  strokeWidth: "1"
440
440
  }
@@ -763,19 +763,34 @@ var import_jsx_runtime4 = require("react/jsx-runtime");
763
763
  var BarChartComponent = (0, import_react3.forwardRef)((originalProps, ref) => {
764
764
  const [props, variantProps] = mapPropsVariants(originalProps, barChartStyle.variantKeys);
765
765
  const {
766
- data,
766
+ data = [],
767
767
  label,
768
768
  classNames,
769
769
  yAxisTicks = [0, 20, 40, 60, 80, 100],
770
770
  yAxisTickFormatter = (value) => `${value}`,
771
771
  yAxisDomain = [-6, 110],
772
- customTooltip
772
+ tooltipFormatter
773
773
  } = { ...props, ...variantProps };
774
774
  const slots = (0, import_react3.useMemo)(() => barChartStyle({ ...variantProps }), [variantProps]);
775
775
  const [tickPositions, setTickPositions] = (0, import_react3.useState)([]);
776
776
  const tickRef = (0, import_react3.useRef)([]);
777
- const CustomBarShape = (barProps) => {
778
- const { x, y, width, height, fill } = barProps;
777
+ const [tooltipState, setTooltipState] = (0, import_react3.useState)(null);
778
+ const handleMouseEnter = (e, dataKey) => {
779
+ if (!tooltipFormatter) return;
780
+ const { payload, x, y } = e;
781
+ if (!payload || !payload[dataKey]) return;
782
+ setTooltipState({
783
+ x,
784
+ y,
785
+ value: payload[dataKey],
786
+ dataKey,
787
+ label: payload.title
788
+ });
789
+ };
790
+ const handleMouseLeave = () => {
791
+ setTooltipState(null);
792
+ };
793
+ const CustomBarShape = ({ x, y, width, height, fill }) => {
779
794
  const radius = 5;
780
795
  const extraHeight = 10;
781
796
  const adjustedHeight = height + extraHeight;
@@ -790,9 +805,7 @@ var BarChartComponent = (0, import_react3.forwardRef)((originalProps, ref) => {
790
805
  ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x, y, width, height: 0, fill });
791
806
  };
792
807
  const CustomTick = ({ x, y, payload }) => {
793
- if (x !== void 0) {
794
- tickRef.current.push(x);
795
- }
808
+ if (x !== void 0) tickRef.current.push(x);
796
809
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
797
810
  "text",
798
811
  {
@@ -807,28 +820,20 @@ var BarChartComponent = (0, import_react3.forwardRef)((originalProps, ref) => {
807
820
  }
808
821
  );
809
822
  };
810
- const CustomYAxisTick = ({ x, y, payload }) => {
811
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
812
- "text",
813
- {
814
- x: x - 10,
815
- y,
816
- textAnchor: "middle",
817
- fontSize: 12,
818
- fontWeight: 700,
819
- fill: "currentColor",
820
- className: "text-body-foreground",
821
- dy: 4,
822
- children: yAxisTickFormatter(payload.value)
823
- }
824
- );
825
- };
826
- const CustomTooltip = ({ active, payload, label: label2 }) => {
827
- if (customTooltip && active && payload && payload.length) {
828
- return customTooltip({ active, payload, label: label2 });
823
+ const CustomYAxisTick = ({ x, y, payload }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
824
+ "text",
825
+ {
826
+ x: x - 10,
827
+ y,
828
+ textAnchor: "middle",
829
+ fontSize: 12,
830
+ fontWeight: 700,
831
+ fill: "currentColor",
832
+ className: "text-body-foreground",
833
+ dy: 4,
834
+ children: yAxisTickFormatter(payload.value)
829
835
  }
830
- return null;
831
- };
836
+ );
832
837
  (0, import_react3.useEffect)(() => {
833
838
  const raf = requestAnimationFrame(() => {
834
839
  const unique = [...new Set(tickRef.current)].sort((a, b) => a - b);
@@ -896,13 +901,52 @@ var BarChartComponent = (0, import_react3.forwardRef)((originalProps, ref) => {
896
901
  domain: yAxisDomain
897
902
  }
898
903
  ),
899
- customTooltip && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Tooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CustomTooltip, {}), cursor: { fill: "transparent" } }),
900
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Bar, { dataKey: "blue", fill: "url(#blueGradient)", width: 20, shape: CustomBarShape }),
901
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Bar, { dataKey: "green", fill: "url(#greenGradient)", width: 20, shape: CustomBarShape }),
902
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Bar, { dataKey: "pink", fill: "url(#pinkGradient)", width: 20, shape: CustomBarShape })
904
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
905
+ import_recharts3.Bar,
906
+ {
907
+ dataKey: "blue",
908
+ fill: "url(#blueGradient)",
909
+ shape: CustomBarShape,
910
+ onMouseEnter: (e) => handleMouseEnter(e, "blue"),
911
+ onMouseLeave: handleMouseLeave
912
+ }
913
+ ),
914
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
915
+ import_recharts3.Bar,
916
+ {
917
+ dataKey: "green",
918
+ fill: "url(#greenGradient)",
919
+ shape: CustomBarShape,
920
+ onMouseEnter: (e) => handleMouseEnter(e, "green"),
921
+ onMouseLeave: handleMouseLeave
922
+ }
923
+ ),
924
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
925
+ import_recharts3.Bar,
926
+ {
927
+ dataKey: "pink",
928
+ fill: "url(#pinkGradient)",
929
+ shape: CustomBarShape,
930
+ onMouseEnter: (e) => handleMouseEnter(e, "pink"),
931
+ onMouseLeave: handleMouseLeave
932
+ }
933
+ )
903
934
  ]
904
935
  }
905
- ) })
936
+ ) }),
937
+ tooltipFormatter && tooltipState && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
938
+ "div",
939
+ {
940
+ style: {
941
+ position: "absolute",
942
+ left: tooltipState.x + 20,
943
+ top: tooltipState.y - 20,
944
+ transform: "translateX(-50%)",
945
+ pointerEvents: "none"
946
+ },
947
+ children: tooltipFormatter(tooltipState)
948
+ }
949
+ )
906
950
  ] });
907
951
  });
908
952
  BarChartComponent.displayName = "barChart";
@@ -913,9 +957,7 @@ var barChartStyle = tv({
913
957
  label: ["text-md", "font-bold", "text-body-foreground"]
914
958
  },
915
959
  variants: {},
916
- defaultVariants: {
917
- color: "primary"
918
- }
960
+ defaultVariants: {}
919
961
  });
920
962
 
921
963
  // src/components/charts/radarChart.tsx
@@ -7,10 +7,10 @@ import "../../chunk-DQRAFUDA.mjs";
7
7
  import "../../chunk-M37VBNB3.mjs";
8
8
  import {
9
9
  barChart_default
10
- } from "../../chunk-WNNOVISA.mjs";
10
+ } from "../../chunk-FQJD2IY3.mjs";
11
11
  import {
12
12
  circularProgress_default
13
- } from "../../chunk-5XW5QDIW.mjs";
13
+ } from "../../chunk-NCK5E2NL.mjs";
14
14
  import {
15
15
  radarChart_default
16
16
  } from "../../chunk-OEFILEL3.mjs";
@@ -5,6 +5,7 @@ import { ReactNode } from 'react';
5
5
  import { SlotsToClasses } from '../../utils/types.mjs';
6
6
 
7
7
  type DefinitionTableRowCell = {
8
+ key?: string;
8
9
  content: ReactNode;
9
10
  className?: string;
10
11
  colSpan?: number;
@@ -18,6 +19,7 @@ type DefinitionTableRow = {
18
19
  interface DefinitionTableProps {
19
20
  rows: DefinitionTableRow[];
20
21
  footer?: ReactNode;
22
+ highlightColumnKey?: string;
21
23
  classNames?: SlotsToClasses<DefinitionTableSlots>;
22
24
  }
23
25
  declare const DefinitionTable: react.ForwardRefExoticComponent<DefinitionTableProps & react.RefAttributes<HTMLDivElement>>;
@@ -5,6 +5,7 @@ import { ReactNode } from 'react';
5
5
  import { SlotsToClasses } from '../../utils/types.js';
6
6
 
7
7
  type DefinitionTableRowCell = {
8
+ key?: string;
8
9
  content: ReactNode;
9
10
  className?: string;
10
11
  colSpan?: number;
@@ -18,6 +19,7 @@ type DefinitionTableRow = {
18
19
  interface DefinitionTableProps {
19
20
  rows: DefinitionTableRow[];
20
21
  footer?: ReactNode;
22
+ highlightColumnKey?: string;
21
23
  classNames?: SlotsToClasses<DefinitionTableSlots>;
22
24
  }
23
25
  declare const DefinitionTable: react.ForwardRefExoticComponent<DefinitionTableProps & react.RefAttributes<HTMLDivElement>>;
@@ -414,18 +414,57 @@ var renderColGroup = (rows) => {
414
414
  });
415
415
  const cols = [];
416
416
  for (let i = 0; i < maxCols; i++) {
417
- cols.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("col", { style: colWidths[i] ? { width: colWidths[i] } : { width: "auto" } }, `col-${i}`));
417
+ cols.push(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("col", { style: { width: colWidths[i] || "auto" } }, i));
418
418
  }
419
419
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("colgroup", { children: cols });
420
420
  };
421
- var DefinitionTableRow = ({ cells, className }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { className: `border-neutral-light border-b ${className || ""}`, children: cells.map((cell, colIndex) => {
421
+ var getHighlightColumnIndex = (rows, key) => {
422
+ if (!key) return null;
423
+ for (const row of rows) {
424
+ let colIndex = 0;
425
+ for (const cell of row.cells) {
426
+ const span = cell.colSpan || 1;
427
+ if (cell.key === key) return colIndex;
428
+ colIndex += span;
429
+ }
430
+ }
431
+ return null;
432
+ };
433
+ var DefinitionTableRow = ({
434
+ cells,
435
+ className,
436
+ rowIndex = 0,
437
+ rowCount = 0,
438
+ highlightColumnIndex
439
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { className: clsx("border-neutral-light border-b", className), children: cells.map((cell, colIndex) => {
422
440
  const isFirstCell = colIndex === 0;
423
- const combinedClassName = [isFirstCell ? FIRST_CELL_WIDTH_CLASS : "", clsx(DEFAULT_CELL_CLASSES, cell.className)].filter(Boolean).join(" ");
441
+ const isHighlighted = colIndex === highlightColumnIndex;
442
+ const isFirstRow = rowIndex === 0;
443
+ const isLastRow = rowIndex === rowCount - 1;
444
+ const borderHighlightClass = isHighlighted ? clsx(
445
+ "border-l-[2px] border-r-[2px] border-primary-main bg-neutral-soft",
446
+ isFirstRow && "border-t-[2px]",
447
+ isLastRow && "border-b-[2px]"
448
+ ) : "";
449
+ const combinedClassName = clsx(
450
+ DEFAULT_CELL_CLASSES,
451
+ isFirstCell && FIRST_CELL_WIDTH_CLASS,
452
+ cell.className,
453
+ borderHighlightClass
454
+ );
424
455
  let cellStyle;
425
456
  if (isFirstCell) {
426
- cellStyle = { width: "120px", minWidth: "120px", maxWidth: "120px" };
457
+ cellStyle = {
458
+ width: "120px",
459
+ minWidth: "120px",
460
+ maxWidth: "120px"
461
+ };
427
462
  } else if (cell.width && cell.width !== "auto") {
428
- cellStyle = { width: cell.width, minWidth: cell.width, maxWidth: cell.width };
463
+ cellStyle = {
464
+ width: cell.width,
465
+ minWidth: cell.width,
466
+ maxWidth: cell.width
467
+ };
429
468
  } else {
430
469
  cellStyle = { width: "100%" };
431
470
  }
@@ -441,16 +480,30 @@ var DefinitionTableRow = ({ cells, className }) => /* @__PURE__ */ (0, import_js
441
480
  colIndex
442
481
  );
443
482
  }) });
444
- var DefinitionTable = (0, import_react.forwardRef)(({ rows = [], footer, classNames }, ref) => {
445
- const slots = (0, import_react.useMemo)(() => DefinitionTableStyle(), []);
446
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
447
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: slots.table({ class: classNames == null ? void 0 : classNames.table }), children: [
483
+ var DefinitionTable = (0, import_react.forwardRef)(
484
+ ({ rows = [], footer, highlightColumnKey, classNames }, ref) => {
485
+ const slots = (0, import_react.useMemo)(() => DefinitionTableStyle(), []);
486
+ const highlightColumnIndex = (0, import_react.useMemo)(
487
+ () => getHighlightColumnIndex(rows, highlightColumnKey),
488
+ [rows, highlightColumnKey]
489
+ );
490
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: clsx(slots.base(), classNames == null ? void 0 : classNames.base), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: clsx(slots.table(), classNames == null ? void 0 : classNames.table), children: [
448
491
  renderColGroup(rows),
449
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefinitionTableRow, { ...row, className: `${row.className || ""} ${i === 0 ? "first-row" : ""}` }, i)) })
450
- ] }),
451
- footer && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: footer })
452
- ] });
453
- });
492
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
493
+ DefinitionTableRow,
494
+ {
495
+ ...row,
496
+ rowIndex: i,
497
+ rowCount: rows.length,
498
+ highlightColumnIndex,
499
+ className: row.className
500
+ },
501
+ i
502
+ )) }),
503
+ footer && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tfoot", { children: footer })
504
+ ] }) });
505
+ }
506
+ );
454
507
  DefinitionTable.displayName = "DefinitionTable";
455
508
  var definition_table_default = DefinitionTable;
456
509
  var DefinitionTableStyle = tv({
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  definition_table_default
4
- } from "../../chunk-SJNXRXV5.mjs";
4
+ } from "../../chunk-WC5PVVT6.mjs";
5
5
  import "../../chunk-76QIZILI.mjs";
6
6
  import "../../chunk-27Y6K5NK.mjs";
7
7
  import "../../chunk-AC6TWLRT.mjs";
@@ -6719,18 +6719,57 @@ var renderColGroup = (rows) => {
6719
6719
  });
6720
6720
  const cols = [];
6721
6721
  for (let i = 0; i < maxCols; i++) {
6722
- cols.push(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("col", { style: colWidths[i] ? { width: colWidths[i] } : { width: "auto" } }, `col-${i}`));
6722
+ cols.push(/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("col", { style: { width: colWidths[i] || "auto" } }, i));
6723
6723
  }
6724
6724
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("colgroup", { children: cols });
6725
6725
  };
6726
- var DefinitionTableRow = ({ cells, className }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tr", { className: `border-neutral-light border-b ${className || ""}`, children: cells.map((cell, colIndex) => {
6726
+ var getHighlightColumnIndex = (rows, key) => {
6727
+ if (!key) return null;
6728
+ for (const row of rows) {
6729
+ let colIndex = 0;
6730
+ for (const cell of row.cells) {
6731
+ const span = cell.colSpan || 1;
6732
+ if (cell.key === key) return colIndex;
6733
+ colIndex += span;
6734
+ }
6735
+ }
6736
+ return null;
6737
+ };
6738
+ var DefinitionTableRow = ({
6739
+ cells,
6740
+ className,
6741
+ rowIndex = 0,
6742
+ rowCount = 0,
6743
+ highlightColumnIndex
6744
+ }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tr", { className: clsx("border-neutral-light border-b", className), children: cells.map((cell, colIndex) => {
6727
6745
  const isFirstCell = colIndex === 0;
6728
- const combinedClassName = [isFirstCell ? FIRST_CELL_WIDTH_CLASS : "", clsx(DEFAULT_CELL_CLASSES, cell.className)].filter(Boolean).join(" ");
6746
+ const isHighlighted = colIndex === highlightColumnIndex;
6747
+ const isFirstRow = rowIndex === 0;
6748
+ const isLastRow = rowIndex === rowCount - 1;
6749
+ const borderHighlightClass = isHighlighted ? clsx(
6750
+ "border-l-[2px] border-r-[2px] border-primary-main bg-neutral-soft",
6751
+ isFirstRow && "border-t-[2px]",
6752
+ isLastRow && "border-b-[2px]"
6753
+ ) : "";
6754
+ const combinedClassName = clsx(
6755
+ DEFAULT_CELL_CLASSES,
6756
+ isFirstCell && FIRST_CELL_WIDTH_CLASS,
6757
+ cell.className,
6758
+ borderHighlightClass
6759
+ );
6729
6760
  let cellStyle;
6730
6761
  if (isFirstCell) {
6731
- cellStyle = { width: "120px", minWidth: "120px", maxWidth: "120px" };
6762
+ cellStyle = {
6763
+ width: "120px",
6764
+ minWidth: "120px",
6765
+ maxWidth: "120px"
6766
+ };
6732
6767
  } else if (cell.width && cell.width !== "auto") {
6733
- cellStyle = { width: cell.width, minWidth: cell.width, maxWidth: cell.width };
6768
+ cellStyle = {
6769
+ width: cell.width,
6770
+ minWidth: cell.width,
6771
+ maxWidth: cell.width
6772
+ };
6734
6773
  } else {
6735
6774
  cellStyle = { width: "100%" };
6736
6775
  }
@@ -6746,16 +6785,30 @@ var DefinitionTableRow = ({ cells, className }) => /* @__PURE__ */ (0, import_js
6746
6785
  colIndex
6747
6786
  );
6748
6787
  }) });
6749
- var DefinitionTable = (0, import_react6.forwardRef)(({ rows = [], footer, classNames }, ref) => {
6750
- const slots = (0, import_react6.useMemo)(() => DefinitionTableStyle(), []);
6751
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
6752
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("table", { className: slots.table({ class: classNames == null ? void 0 : classNames.table }), children: [
6788
+ var DefinitionTable = (0, import_react6.forwardRef)(
6789
+ ({ rows = [], footer, highlightColumnKey, classNames }, ref) => {
6790
+ const slots = (0, import_react6.useMemo)(() => DefinitionTableStyle(), []);
6791
+ const highlightColumnIndex = (0, import_react6.useMemo)(
6792
+ () => getHighlightColumnIndex(rows, highlightColumnKey),
6793
+ [rows, highlightColumnKey]
6794
+ );
6795
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ref, className: clsx(slots.base(), classNames == null ? void 0 : classNames.base), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("table", { className: clsx(slots.table(), classNames == null ? void 0 : classNames.table), children: [
6753
6796
  renderColGroup(rows),
6754
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DefinitionTableRow, { ...row, className: `${row.className || ""} ${i === 0 ? "first-row" : ""}` }, i)) })
6755
- ] }),
6756
- footer && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { children: footer })
6757
- ] });
6758
- });
6797
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6798
+ DefinitionTableRow,
6799
+ {
6800
+ ...row,
6801
+ rowIndex: i,
6802
+ rowCount: rows.length,
6803
+ highlightColumnIndex,
6804
+ className: row.className
6805
+ },
6806
+ i
6807
+ )) }),
6808
+ footer && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tfoot", { children: footer })
6809
+ ] }) });
6810
+ }
6811
+ );
6759
6812
  DefinitionTable.displayName = "DefinitionTable";
6760
6813
  var definition_table_default = DefinitionTable;
6761
6814
  var DefinitionTableStyle = tv({
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import "../../chunk-DX3KXNP6.mjs";
3
- import {
4
- definition_table_default
5
- } from "../../chunk-SJNXRXV5.mjs";
6
3
  import {
7
4
  table_default
8
5
  } from "../../chunk-ANILRUAS.mjs";
9
6
  import "../../chunk-MZ76AA76.mjs";
10
7
  import "../../chunk-6PN3DGOE.mjs";
8
+ import {
9
+ definition_table_default
10
+ } from "../../chunk-WC5PVVT6.mjs";
11
11
  import "../../chunk-7B7LRG5J.mjs";
12
12
  import "../../chunk-IBYQBC6D.mjs";
13
13
  import "../../chunk-F3HENRVM.mjs";