@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.
package/dist/index.js CHANGED
@@ -9065,18 +9065,57 @@ var renderColGroup = (rows) => {
9065
9065
  });
9066
9066
  const cols = [];
9067
9067
  for (let i = 0; i < maxCols; i++) {
9068
- cols.push(/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("col", { style: colWidths[i] ? { width: colWidths[i] } : { width: "auto" } }, `col-${i}`));
9068
+ cols.push(/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("col", { style: { width: colWidths[i] || "auto" } }, i));
9069
9069
  }
9070
9070
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("colgroup", { children: cols });
9071
9071
  };
9072
- var DefinitionTableRow = ({ cells, className }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: `border-neutral-light border-b ${className || ""}`, children: cells.map((cell, colIndex) => {
9072
+ var getHighlightColumnIndex = (rows, key) => {
9073
+ if (!key) return null;
9074
+ for (const row of rows) {
9075
+ let colIndex = 0;
9076
+ for (const cell of row.cells) {
9077
+ const span = cell.colSpan || 1;
9078
+ if (cell.key === key) return colIndex;
9079
+ colIndex += span;
9080
+ }
9081
+ }
9082
+ return null;
9083
+ };
9084
+ var DefinitionTableRow = ({
9085
+ cells,
9086
+ className,
9087
+ rowIndex = 0,
9088
+ rowCount = 0,
9089
+ highlightColumnIndex
9090
+ }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: clsx("border-neutral-light border-b", className), children: cells.map((cell, colIndex) => {
9073
9091
  const isFirstCell = colIndex === 0;
9074
- const combinedClassName = [isFirstCell ? FIRST_CELL_WIDTH_CLASS : "", clsx(DEFAULT_CELL_CLASSES, cell.className)].filter(Boolean).join(" ");
9092
+ const isHighlighted = colIndex === highlightColumnIndex;
9093
+ const isFirstRow = rowIndex === 0;
9094
+ const isLastRow = rowIndex === rowCount - 1;
9095
+ const borderHighlightClass = isHighlighted ? clsx(
9096
+ "border-l-[2px] border-r-[2px] border-primary-main bg-neutral-soft",
9097
+ isFirstRow && "border-t-[2px]",
9098
+ isLastRow && "border-b-[2px]"
9099
+ ) : "";
9100
+ const combinedClassName = clsx(
9101
+ DEFAULT_CELL_CLASSES,
9102
+ isFirstCell && FIRST_CELL_WIDTH_CLASS,
9103
+ cell.className,
9104
+ borderHighlightClass
9105
+ );
9075
9106
  let cellStyle;
9076
9107
  if (isFirstCell) {
9077
- cellStyle = { width: "120px", minWidth: "120px", maxWidth: "120px" };
9108
+ cellStyle = {
9109
+ width: "120px",
9110
+ minWidth: "120px",
9111
+ maxWidth: "120px"
9112
+ };
9078
9113
  } else if (cell.width && cell.width !== "auto") {
9079
- cellStyle = { width: cell.width, minWidth: cell.width, maxWidth: cell.width };
9114
+ cellStyle = {
9115
+ width: cell.width,
9116
+ minWidth: cell.width,
9117
+ maxWidth: cell.width
9118
+ };
9080
9119
  } else {
9081
9120
  cellStyle = { width: "100%" };
9082
9121
  }
@@ -9092,16 +9131,30 @@ var DefinitionTableRow = ({ cells, className }) => /* @__PURE__ */ (0, import_js
9092
9131
  colIndex
9093
9132
  );
9094
9133
  }) });
9095
- var DefinitionTable = (0, import_react18.forwardRef)(({ rows = [], footer, classNames }, ref) => {
9096
- const slots = (0, import_react18.useMemo)(() => DefinitionTableStyle(), []);
9097
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
9098
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("table", { className: slots.table({ class: classNames == null ? void 0 : classNames.table }), children: [
9134
+ var DefinitionTable = (0, import_react18.forwardRef)(
9135
+ ({ rows = [], footer, highlightColumnKey, classNames }, ref) => {
9136
+ const slots = (0, import_react18.useMemo)(() => DefinitionTableStyle(), []);
9137
+ const highlightColumnIndex = (0, import_react18.useMemo)(
9138
+ () => getHighlightColumnIndex(rows, highlightColumnKey),
9139
+ [rows, highlightColumnKey]
9140
+ );
9141
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, className: clsx(slots.base(), classNames == null ? void 0 : classNames.base), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("table", { className: clsx(slots.table(), classNames == null ? void 0 : classNames.table), children: [
9099
9142
  renderColGroup(rows),
9100
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DefinitionTableRow, { ...row, className: `${row.className || ""} ${i === 0 ? "first-row" : ""}` }, i)) })
9101
- ] }),
9102
- footer && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: footer })
9103
- ] });
9104
- });
9143
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
9144
+ DefinitionTableRow,
9145
+ {
9146
+ ...row,
9147
+ rowIndex: i,
9148
+ rowCount: rows.length,
9149
+ highlightColumnIndex,
9150
+ className: row.className
9151
+ },
9152
+ i
9153
+ )) }),
9154
+ footer && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tfoot", { children: footer })
9155
+ ] }) });
9156
+ }
9157
+ );
9105
9158
  DefinitionTable.displayName = "DefinitionTable";
9106
9159
  var definition_table_default = DefinitionTable;
9107
9160
  var DefinitionTableStyle = tv({
@@ -12262,7 +12315,7 @@ var CircularProgress = (0, import_react38.forwardRef)((originalProps, ref) => {
12262
12315
  cx: size / 2,
12263
12316
  cy: size / 2,
12264
12317
  r: OUTER_RADIUS + BORDER_MARGIN,
12265
- fill: "none",
12318
+ fill: "#fff",
12266
12319
  stroke: "#DFE2E7",
12267
12320
  strokeWidth: "1"
12268
12321
  }
@@ -12511,19 +12564,34 @@ var import_jsx_runtime43 = require("react/jsx-runtime");
12511
12564
  var BarChartComponent = (0, import_react40.forwardRef)((originalProps, ref) => {
12512
12565
  const [props, variantProps] = mapPropsVariants(originalProps, barChartStyle.variantKeys);
12513
12566
  const {
12514
- data,
12567
+ data = [],
12515
12568
  label,
12516
12569
  classNames,
12517
12570
  yAxisTicks = [0, 20, 40, 60, 80, 100],
12518
12571
  yAxisTickFormatter = (value) => `${value}`,
12519
12572
  yAxisDomain = [-6, 110],
12520
- customTooltip
12573
+ tooltipFormatter
12521
12574
  } = { ...props, ...variantProps };
12522
12575
  const slots = (0, import_react40.useMemo)(() => barChartStyle({ ...variantProps }), [variantProps]);
12523
12576
  const [tickPositions, setTickPositions] = (0, import_react40.useState)([]);
12524
12577
  const tickRef = (0, import_react40.useRef)([]);
12525
- const CustomBarShape = (barProps) => {
12526
- const { x, y, width, height, fill } = barProps;
12578
+ const [tooltipState, setTooltipState] = (0, import_react40.useState)(null);
12579
+ const handleMouseEnter = (e, dataKey) => {
12580
+ if (!tooltipFormatter) return;
12581
+ const { payload, x, y } = e;
12582
+ if (!payload || !payload[dataKey]) return;
12583
+ setTooltipState({
12584
+ x,
12585
+ y,
12586
+ value: payload[dataKey],
12587
+ dataKey,
12588
+ label: payload.title
12589
+ });
12590
+ };
12591
+ const handleMouseLeave = () => {
12592
+ setTooltipState(null);
12593
+ };
12594
+ const CustomBarShape = ({ x, y, width, height, fill }) => {
12527
12595
  const radius = 5;
12528
12596
  const extraHeight = 10;
12529
12597
  const adjustedHeight = height + extraHeight;
@@ -12538,9 +12606,7 @@ var BarChartComponent = (0, import_react40.forwardRef)((originalProps, ref) => {
12538
12606
  ) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("rect", { x, y, width, height: 0, fill });
12539
12607
  };
12540
12608
  const CustomTick = ({ x, y, payload }) => {
12541
- if (x !== void 0) {
12542
- tickRef.current.push(x);
12543
- }
12609
+ if (x !== void 0) tickRef.current.push(x);
12544
12610
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12545
12611
  "text",
12546
12612
  {
@@ -12555,28 +12621,20 @@ var BarChartComponent = (0, import_react40.forwardRef)((originalProps, ref) => {
12555
12621
  }
12556
12622
  );
12557
12623
  };
12558
- const CustomYAxisTick = ({ x, y, payload }) => {
12559
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12560
- "text",
12561
- {
12562
- x: x - 10,
12563
- y,
12564
- textAnchor: "middle",
12565
- fontSize: 12,
12566
- fontWeight: 700,
12567
- fill: "currentColor",
12568
- className: "text-body-foreground",
12569
- dy: 4,
12570
- children: yAxisTickFormatter(payload.value)
12571
- }
12572
- );
12573
- };
12574
- const CustomTooltip = ({ active, payload, label: label2 }) => {
12575
- if (customTooltip && active && payload && payload.length) {
12576
- return customTooltip({ active, payload, label: label2 });
12624
+ const CustomYAxisTick = ({ x, y, payload }) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12625
+ "text",
12626
+ {
12627
+ x: x - 10,
12628
+ y,
12629
+ textAnchor: "middle",
12630
+ fontSize: 12,
12631
+ fontWeight: 700,
12632
+ fill: "currentColor",
12633
+ className: "text-body-foreground",
12634
+ dy: 4,
12635
+ children: yAxisTickFormatter(payload.value)
12577
12636
  }
12578
- return null;
12579
- };
12637
+ );
12580
12638
  (0, import_react40.useEffect)(() => {
12581
12639
  const raf = requestAnimationFrame(() => {
12582
12640
  const unique = [...new Set(tickRef.current)].sort((a, b) => a - b);
@@ -12644,13 +12702,52 @@ var BarChartComponent = (0, import_react40.forwardRef)((originalProps, ref) => {
12644
12702
  domain: yAxisDomain
12645
12703
  }
12646
12704
  ),
12647
- customTooltip && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_recharts3.Tooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CustomTooltip, {}), cursor: { fill: "transparent" } }),
12648
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_recharts3.Bar, { dataKey: "blue", fill: "url(#blueGradient)", width: 20, shape: CustomBarShape }),
12649
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_recharts3.Bar, { dataKey: "green", fill: "url(#greenGradient)", width: 20, shape: CustomBarShape }),
12650
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_recharts3.Bar, { dataKey: "pink", fill: "url(#pinkGradient)", width: 20, shape: CustomBarShape })
12705
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12706
+ import_recharts3.Bar,
12707
+ {
12708
+ dataKey: "blue",
12709
+ fill: "url(#blueGradient)",
12710
+ shape: CustomBarShape,
12711
+ onMouseEnter: (e) => handleMouseEnter(e, "blue"),
12712
+ onMouseLeave: handleMouseLeave
12713
+ }
12714
+ ),
12715
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12716
+ import_recharts3.Bar,
12717
+ {
12718
+ dataKey: "green",
12719
+ fill: "url(#greenGradient)",
12720
+ shape: CustomBarShape,
12721
+ onMouseEnter: (e) => handleMouseEnter(e, "green"),
12722
+ onMouseLeave: handleMouseLeave
12723
+ }
12724
+ ),
12725
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12726
+ import_recharts3.Bar,
12727
+ {
12728
+ dataKey: "pink",
12729
+ fill: "url(#pinkGradient)",
12730
+ shape: CustomBarShape,
12731
+ onMouseEnter: (e) => handleMouseEnter(e, "pink"),
12732
+ onMouseLeave: handleMouseLeave
12733
+ }
12734
+ )
12651
12735
  ]
12652
12736
  }
12653
- ) })
12737
+ ) }),
12738
+ tooltipFormatter && tooltipState && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12739
+ "div",
12740
+ {
12741
+ style: {
12742
+ position: "absolute",
12743
+ left: tooltipState.x + 20,
12744
+ top: tooltipState.y - 20,
12745
+ transform: "translateX(-50%)",
12746
+ pointerEvents: "none"
12747
+ },
12748
+ children: tooltipFormatter(tooltipState)
12749
+ }
12750
+ )
12654
12751
  ] });
12655
12752
  });
12656
12753
  BarChartComponent.displayName = "barChart";
@@ -12661,9 +12758,7 @@ var barChartStyle = tv({
12661
12758
  label: ["text-md", "font-bold", "text-body-foreground"]
12662
12759
  },
12663
12760
  variants: {},
12664
- defaultVariants: {
12665
- color: "primary"
12666
- }
12761
+ defaultVariants: {}
12667
12762
  });
12668
12763
 
12669
12764
  // src/components/charts/radarChart.tsx
package/dist/index.mjs CHANGED
@@ -1,10 +1,8 @@
1
1
  "use client";
2
- import "./chunk-HIE2YRGA.mjs";
2
+ import "./chunk-MBLZYQCN.mjs";
3
3
  import {
4
- tooltip_default
5
- } from "./chunk-YGOX6FBU.mjs";
6
- import "./chunk-ZMOAFSYE.mjs";
7
- import "./chunk-WSIADHVC.mjs";
4
+ tree_default
5
+ } from "./chunk-JC6635TJ.mjs";
8
6
  import "./chunk-LUWGOKLG.mjs";
9
7
  import {
10
8
  ToastProvider,
@@ -14,17 +12,20 @@ import "./chunk-ZOTHPHXA.mjs";
14
12
  import {
15
13
  toast_default
16
14
  } from "./chunk-5R3ARH2N.mjs";
17
- import "./chunk-MBLZYQCN.mjs";
15
+ import "./chunk-HIE2YRGA.mjs";
18
16
  import {
19
- tree_default
20
- } from "./chunk-JC6635TJ.mjs";
17
+ tooltip_default
18
+ } from "./chunk-YGOX6FBU.mjs";
19
+ import "./chunk-ZMOAFSYE.mjs";
20
+ import "./chunk-WSIADHVC.mjs";
21
21
  import "./chunk-DX3KXNP6.mjs";
22
- import {
23
- definition_table_default
24
- } from "./chunk-SJNXRXV5.mjs";
25
22
  import {
26
23
  table_default
27
24
  } from "./chunk-ANILRUAS.mjs";
25
+ import "./chunk-3MY6LO7N.mjs";
26
+ import {
27
+ tabs_default
28
+ } from "./chunk-BBRPAQON.mjs";
28
29
  import "./chunk-RRAZM5D3.mjs";
29
30
  import {
30
31
  textarea_default
@@ -37,10 +38,9 @@ import "./chunk-LVFI2NOH.mjs";
37
38
  import {
38
39
  switch_default
39
40
  } from "./chunk-AGE57VDD.mjs";
40
- import "./chunk-3MY6LO7N.mjs";
41
41
  import {
42
- tabs_default
43
- } from "./chunk-BBRPAQON.mjs";
42
+ definition_table_default
43
+ } from "./chunk-WC5PVVT6.mjs";
44
44
  import "./chunk-TPFN22HR.mjs";
45
45
  import {
46
46
  radio_default
@@ -106,10 +106,10 @@ import {
106
106
  } from "./chunk-M37VBNB3.mjs";
107
107
  import {
108
108
  barChart_default
109
- } from "./chunk-WNNOVISA.mjs";
109
+ } from "./chunk-FQJD2IY3.mjs";
110
110
  import {
111
111
  circularProgress_default
112
- } from "./chunk-5XW5QDIW.mjs";
112
+ } from "./chunk-NCK5E2NL.mjs";
113
113
  import {
114
114
  radarChart_default
115
115
  } from "./chunk-OEFILEL3.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnoid/ui",
3
- "version": "0.1.126",
3
+ "version": "0.1.127",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -1,85 +0,0 @@
1
- "use client";
2
- import {
3
- tv
4
- } from "./chunk-76QIZILI.mjs";
5
- import {
6
- clsx
7
- } from "./chunk-27Y6K5NK.mjs";
8
-
9
- // src/components/table/definition-table.tsx
10
- import { forwardRef, useMemo } from "react";
11
- import { jsx, jsxs } from "react/jsx-runtime";
12
- var DEFAULT_CELL_CLASSES = "px-[10px] py-[8px] text-md border-r border-neutral-light h-[50px]";
13
- var FIRST_CELL_WIDTH_CLASS = "w-[120px] font-bold text-md text-body-foreground";
14
- var renderColGroup = (rows) => {
15
- let maxCols = 0;
16
- const colWidths = [];
17
- rows.forEach((row) => {
18
- let currentColCount = 0;
19
- row.cells.forEach((cell) => {
20
- currentColCount += cell.colSpan || 1;
21
- });
22
- maxCols = Math.max(maxCols, currentColCount);
23
- });
24
- colWidths[0] = "120px";
25
- rows.forEach((row) => {
26
- let colIndex = 0;
27
- row.cells.forEach((cell) => {
28
- const span = cell.colSpan || 1;
29
- if (colIndex > 0 && cell.width && cell.width !== "auto" && colIndex < maxCols) {
30
- colWidths[colIndex] = cell.width;
31
- }
32
- colIndex += span;
33
- });
34
- });
35
- const cols = [];
36
- for (let i = 0; i < maxCols; i++) {
37
- cols.push(/* @__PURE__ */ jsx("col", { style: colWidths[i] ? { width: colWidths[i] } : { width: "auto" } }, `col-${i}`));
38
- }
39
- return /* @__PURE__ */ jsx("colgroup", { children: cols });
40
- };
41
- var DefinitionTableRow = ({ cells, className }) => /* @__PURE__ */ jsx("tr", { className: `border-neutral-light border-b ${className || ""}`, children: cells.map((cell, colIndex) => {
42
- const isFirstCell = colIndex === 0;
43
- const combinedClassName = [isFirstCell ? FIRST_CELL_WIDTH_CLASS : "", clsx(DEFAULT_CELL_CLASSES, cell.className)].filter(Boolean).join(" ");
44
- let cellStyle;
45
- if (isFirstCell) {
46
- cellStyle = { width: "120px", minWidth: "120px", maxWidth: "120px" };
47
- } else if (cell.width && cell.width !== "auto") {
48
- cellStyle = { width: cell.width, minWidth: cell.width, maxWidth: cell.width };
49
- } else {
50
- cellStyle = { width: "100%" };
51
- }
52
- return /* @__PURE__ */ jsx(
53
- "td",
54
- {
55
- className: combinedClassName,
56
- colSpan: cell.colSpan,
57
- rowSpan: cell.rowSpan,
58
- style: { ...cellStyle, height: "50px" },
59
- children: cell.content
60
- },
61
- colIndex
62
- );
63
- }) });
64
- var DefinitionTable = forwardRef(({ rows = [], footer, classNames }, ref) => {
65
- const slots = useMemo(() => DefinitionTableStyle(), []);
66
- return /* @__PURE__ */ jsxs("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
67
- /* @__PURE__ */ jsxs("table", { className: slots.table({ class: classNames == null ? void 0 : classNames.table }), children: [
68
- renderColGroup(rows),
69
- /* @__PURE__ */ jsx("tbody", { children: rows.map((row, i) => /* @__PURE__ */ jsx(DefinitionTableRow, { ...row, className: `${row.className || ""} ${i === 0 ? "first-row" : ""}` }, i)) })
70
- ] }),
71
- footer && /* @__PURE__ */ jsx("div", { children: footer })
72
- ] });
73
- });
74
- DefinitionTable.displayName = "DefinitionTable";
75
- var definition_table_default = DefinitionTable;
76
- var DefinitionTableStyle = tv({
77
- slots: {
78
- base: ["flex", "flex-col", "gap-[30px]"],
79
- table: ["w-full", "table-auto", "border", "border-neutral-light"]
80
- }
81
- });
82
-
83
- export {
84
- definition_table_default
85
- };