@app-studio/web 0.9.48 → 0.9.50

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.
@@ -4921,17 +4921,28 @@ var getButtonVariants = function getButtonVariants(color, isLight, isThemeLight)
4921
4921
  borderStyle: 'solid',
4922
4922
  borderColor: 'transparent',
4923
4923
  _hover: {
4924
- opacity: 0.9,
4925
- color: textColor
4924
+ opacity: 0.9
4926
4925
  },
4927
4926
  _active: {
4928
- opacity: 0.95,
4929
- color: textColor
4927
+ opacity: 0.95
4930
4928
  },
4931
4929
  _focusVisible: {
4932
4930
  outline: 'none',
4933
- boxShadow: "0 0 0 2px rgba(255, 255, 255, 1), 0 0 0 4px " + color,
4934
- color: textColor
4931
+ boxShadow: "0 0 0 2px rgba(255, 255, 255, 1), 0 0 0 4px " + color
4932
+ },
4933
+ transition: 'background-color 0.2s ease, opacity 0.2s ease'
4934
+ },
4935
+ reversed: {
4936
+ backgroundColor: textColor,
4937
+ color: color,
4938
+ borderWidth: 1,
4939
+ borderStyle: 'solid',
4940
+ borderColor: textColor,
4941
+ _hover: {
4942
+ opacity: 0.9
4943
+ },
4944
+ _active: {
4945
+ opacity: 0.95
4935
4946
  },
4936
4947
  transition: 'background-color 0.2s ease, opacity 0.2s ease'
4937
4948
  },
@@ -4971,7 +4982,6 @@ var getButtonVariants = function getButtonVariants(color, isLight, isThemeLight)
4971
4982
  opacity: 0.9
4972
4983
  },
4973
4984
  _active: {
4974
- color: color,
4975
4985
  opacity: 0.95
4976
4986
  },
4977
4987
  _focusVisible: {
@@ -4991,11 +5001,9 @@ var getButtonVariants = function getButtonVariants(color, isLight, isThemeLight)
4991
5001
  textDecorationThickness: '1px',
4992
5002
  textDecorationColor: color,
4993
5003
  _hover: {
4994
- color: color,
4995
5004
  opacity: 0.8
4996
5005
  },
4997
5006
  _active: {
4998
- color: color,
4999
5007
  opacity: 0.9
5000
5008
  },
5001
5009
  _focusVisible: {
@@ -6535,12 +6543,14 @@ var BarChart = _ref => {
6535
6543
  var groupWidth = chartWidth / barCount;
6536
6544
  var barWidth = groupWidth * 0.8 / seriesCount;
6537
6545
  var barSpacing = groupWidth * 0.2 / (seriesCount + 1);
6546
+ // Calculate effective max value
6547
+ var effectiveMaxValue = maxValue || 10;
6538
6548
  // Generate y-axis ticks
6539
6549
  var yAxisTicks = React.useMemo(() => {
6540
6550
  var tickCount = 5;
6541
6551
  var ticks = [];
6542
6552
  for (var i = 0; i <= tickCount; i++) {
6543
- var value = maxValue / tickCount * i;
6553
+ var value = effectiveMaxValue / tickCount * i;
6544
6554
  ticks.push(value);
6545
6555
  }
6546
6556
  return ticks;
@@ -6573,7 +6583,7 @@ var BarChart = _ref => {
6573
6583
  }
6574
6584
  }), label);
6575
6585
  }), yAxisTicks.map((tick, index) => {
6576
- var y = height - padding.bottom - tick / maxValue * chartHeight;
6586
+ var y = height - padding.bottom - tick / effectiveMaxValue * chartHeight;
6577
6587
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
6578
6588
  key: "y-tick-" + index
6579
6589
  }, /*#__PURE__*/React__default.createElement("text", Object.assign({
@@ -6595,7 +6605,7 @@ var BarChart = _ref => {
6595
6605
  }), data.series.map((series, seriesIndex) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
6596
6606
  key: "series-" + seriesIndex
6597
6607
  }, series.data.map((value, dataIndex) => {
6598
- var barHeight = value / maxValue * chartHeight * animationProgress;
6608
+ var barHeight = value / effectiveMaxValue * chartHeight * animationProgress;
6599
6609
  var x = padding.left + dataIndex * groupWidth + barSpacing * (seriesIndex + 1) + barWidth * seriesIndex;
6600
6610
  var y = height - padding.bottom - barHeight;
6601
6611
  var categoryLabel = data.labels[dataIndex];
@@ -6708,12 +6718,14 @@ var LineChart = _ref => {
6708
6718
  });
6709
6719
  return max;
6710
6720
  }, [data]);
6721
+ // Calculate effective max value
6722
+ var effectiveMaxValue = maxValue || 10;
6711
6723
  // Generate y-axis ticks
6712
6724
  var yAxisTicks = React.useMemo(() => {
6713
6725
  var tickCount = 5;
6714
6726
  var ticks = [];
6715
6727
  for (var i = 0; i <= tickCount; i++) {
6716
- var value = maxValue / tickCount * i;
6728
+ var value = effectiveMaxValue / tickCount * i;
6717
6729
  ticks.push(value);
6718
6730
  }
6719
6731
  return ticks;
@@ -6722,7 +6734,7 @@ var LineChart = _ref => {
6722
6734
  var generatePath = series => {
6723
6735
  var points = series.map((value, index) => {
6724
6736
  var x = padding.left + index / (data.labels.length - 1) * chartWidth;
6725
- var y = height - padding.bottom - value / maxValue * chartHeight * animationProgress;
6737
+ var y = height - padding.bottom - value / effectiveMaxValue * chartHeight * animationProgress;
6726
6738
  return x + "," + y;
6727
6739
  });
6728
6740
  return "M " + points.join(' L ');
@@ -6734,7 +6746,7 @@ var LineChart = _ref => {
6734
6746
  var baseY = height - padding.bottom;
6735
6747
  var points = series.map((value, index) => {
6736
6748
  var x = padding.left + index / (data.labels.length - 1) * chartWidth;
6737
- var y = height - padding.bottom - value / maxValue * chartHeight * animationProgress;
6749
+ var y = height - padding.bottom - value / effectiveMaxValue * chartHeight * animationProgress;
6738
6750
  return x + "," + y;
6739
6751
  });
6740
6752
  return "M " + startX + "," + baseY + " L " + points.join(' L ') + " L " + endX + "," + baseY + " Z";
@@ -6767,7 +6779,7 @@ var LineChart = _ref => {
6767
6779
  }
6768
6780
  }), label);
6769
6781
  }), yAxisTicks.map((tick, index) => {
6770
- var y = height - padding.bottom - tick / maxValue * chartHeight;
6782
+ var y = height - padding.bottom - tick / effectiveMaxValue * chartHeight;
6771
6783
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
6772
6784
  key: "y-tick-" + index
6773
6785
  }, /*#__PURE__*/React__default.createElement("text", Object.assign({
@@ -6799,7 +6811,7 @@ var LineChart = _ref => {
6799
6811
  stroke: lineColor
6800
6812
  }, LineStyles, views == null ? void 0 : views.line)), series.data.map((value, dataIndex) => {
6801
6813
  var x = padding.left + dataIndex / (data.labels.length - 1) * chartWidth;
6802
- var y = height - padding.bottom - value / maxValue * chartHeight * animationProgress;
6814
+ var y = height - padding.bottom - value / effectiveMaxValue * chartHeight * animationProgress;
6803
6815
  var categoryLabel = data.labels[dataIndex];
6804
6816
  var categoryTotal = data.series.reduce((sum, currentSeries) => {
6805
6817
  var seriesValue = currentSeries.data[dataIndex];
@@ -6931,6 +6943,22 @@ var PieChart = _ref => {
6931
6943
  }, [dataPoints]);
6932
6944
  // Generate pie slices
6933
6945
  var slices = React.useMemo(() => {
6946
+ if (total === 0) {
6947
+ // Return a single placeholder slice
6948
+ var path = isDonut ? ["M " + centerX + " " + (centerY - radius), "A " + radius + " " + radius + " 0 1 1 " + centerX + " " + (centerY + radius), "A " + radius + " " + radius + " 0 1 1 " + centerX + " " + (centerY - radius), "M " + centerX + " " + (centerY - donutRadius), "A " + donutRadius + " " + donutRadius + " 0 1 0 " + centerX + " " + (centerY + donutRadius), "A " + donutRadius + " " + donutRadius + " 0 1 0 " + centerX + " " + (centerY - donutRadius), 'Z'].join(' ') : ["M " + centerX + " " + centerY, "M " + centerX + " " + (centerY - radius), "A " + radius + " " + radius + " 0 1 1 " + centerX + " " + (centerY + radius), "A " + radius + " " + radius + " 0 1 1 " + centerX + " " + (centerY - radius), 'Z'].join(' ');
6949
+ return [{
6950
+ path,
6951
+ color: '#E2E8F0',
6952
+ label: 'Total',
6953
+ value: 0,
6954
+ percentage: '0%',
6955
+ labelX: centerX,
6956
+ labelY: centerY,
6957
+ startAngle: 0,
6958
+ endAngle: Math.PI * 2,
6959
+ index: -1
6960
+ }];
6961
+ }
6934
6962
  var result = [];
6935
6963
  var startAngle = -Math.PI / 2; // Start from top (12 o'clock position)
6936
6964
  for (var i = 0; i < dataPoints.length; i++) {
@@ -6951,13 +6979,13 @@ var PieChart = _ref => {
6951
6979
  // Create arc flag
6952
6980
  var largeArcFlag = angle > Math.PI ? 1 : 0;
6953
6981
  // Create path
6954
- var path = void 0;
6982
+ var _path = void 0;
6955
6983
  if (isDonut) {
6956
6984
  // Donut slice path
6957
- path = ["M " + startX + " " + startY, "A " + radius + " " + radius + " 0 " + largeArcFlag + " 1 " + endX + " " + endY, "L " + innerEndX + " " + innerEndY, "A " + donutRadius + " " + donutRadius + " 0 " + largeArcFlag + " 0 " + innerStartX + " " + innerStartY, 'Z'].join(' ');
6985
+ _path = ["M " + startX + " " + startY, "A " + radius + " " + radius + " 0 " + largeArcFlag + " 1 " + endX + " " + endY, "L " + innerEndX + " " + innerEndY, "A " + donutRadius + " " + donutRadius + " 0 " + largeArcFlag + " 0 " + innerStartX + " " + innerStartY, 'Z'].join(' ');
6958
6986
  } else {
6959
6987
  // Regular pie slice path
6960
- path = ["M " + centerX + " " + centerY, "L " + startX + " " + startY, "A " + radius + " " + radius + " 0 " + largeArcFlag + " 1 " + endX + " " + endY, 'Z'].join(' ');
6988
+ _path = ["M " + centerX + " " + centerY, "L " + startX + " " + startY, "A " + radius + " " + radius + " 0 " + largeArcFlag + " 1 " + endX + " " + endY, 'Z'].join(' ');
6961
6989
  }
6962
6990
  // Calculate label position
6963
6991
  var labelAngle = startAngle + angle / 2;
@@ -6971,7 +6999,7 @@ var PieChart = _ref => {
6971
6999
  // Resolve the color through the theme system
6972
7000
  var resolvedColor = getColor(colorValue);
6973
7001
  result.push({
6974
- path,
7002
+ path: _path,
6975
7003
  color: resolvedColor,
6976
7004
  label: dataPoints[i].label,
6977
7005
  value: dataPoints[i].value,
@@ -7078,19 +7106,24 @@ var PieChart = _ref => {
7078
7106
  showTooltip(x, y, tooltipContent);
7079
7107
  };
7080
7108
  var handleClick = () => {
7081
- if (onSliceClick) {
7109
+ if (slice.index !== -1 && onSliceClick) {
7082
7110
  onSliceClick(dataPoints[slice.index], slice.index);
7083
7111
  }
7084
7112
  };
7113
+ var isPlaceholder = slice.index === -1;
7085
7114
  return /*#__PURE__*/React__default.createElement("g", {
7086
7115
  key: "slice-" + index
7087
7116
  }, /*#__PURE__*/React__default.createElement("path", Object.assign({
7088
7117
  d: slice.path,
7089
7118
  fill: slice.color,
7090
- onMouseEnter: handleMouseEnter,
7091
- onMouseLeave: hideTooltip,
7119
+ onMouseEnter: !isPlaceholder ? handleMouseEnter : undefined,
7120
+ onMouseLeave: !isPlaceholder ? hideTooltip : undefined,
7092
7121
  onClick: handleClick
7093
- }, PieSliceStyles, views == null ? void 0 : views.pie)), slice.endAngle - slice.startAngle > 0.2 && (/*#__PURE__*/React__default.createElement("text", {
7122
+ }, PieSliceStyles, {
7123
+ style: Object.assign({}, PieSliceStyles == null ? void 0 : PieSliceStyles.style, {
7124
+ cursor: isPlaceholder ? 'default' : 'pointer'
7125
+ })
7126
+ }, views == null ? void 0 : views.pie)), !isPlaceholder && slice.endAngle - slice.startAngle > 0.2 && (/*#__PURE__*/React__default.createElement("text", {
7094
7127
  x: slice.labelX,
7095
7128
  y: slice.labelY,
7096
7129
  textAnchor: "middle",