@banyan_cloud/roots 2.0.10 → 2.0.11

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/esm/index.js CHANGED
@@ -16156,16 +16156,23 @@ var BasePieChart = function BasePieChart(props) {
16156
16156
  hoverBorderWidth = props.hoverBorderWidth,
16157
16157
  dataSetOptions = props.dataSetOptions,
16158
16158
  extra = props.extra;
16159
- var _useState = useState([]),
16159
+ var _useState = useState(customLabel),
16160
16160
  _useState2 = _slicedToArray(_useState, 2),
16161
- excludedIndices = _useState2[0],
16162
- setExcludedIndices = _useState2[1];
16163
- var _useState3 = useState(null),
16161
+ modCustomLabel = _useState2[0],
16162
+ setModCustomLabel = _useState2[1];
16163
+ var _useState3 = useState([]),
16164
16164
  _useState4 = _slicedToArray(_useState3, 2),
16165
- hoveredIndex = _useState4[0],
16166
- setHoveredIndex = _useState4[1]; // Track the hovered legend index
16165
+ excludedIndices = _useState4[0],
16166
+ setExcludedIndices = _useState4[1];
16167
+ var _useState5 = useState(null),
16168
+ _useState6 = _slicedToArray(_useState5, 2),
16169
+ hoveredIndex = _useState6[0],
16170
+ setHoveredIndex = _useState6[1]; // Track the hovered legend index
16167
16171
  var legendRef = useRef(null); // Reference to hold the custom legend
16168
16172
 
16173
+ useEffect(function () {
16174
+ setModCustomLabel(customLabel);
16175
+ }, [customLabel === null || customLabel === void 0 ? void 0 : customLabel.id]);
16169
16176
  if (loading || fallback) {
16170
16177
  return /*#__PURE__*/jsx(ChartSkeleton$1, {
16171
16178
  theme: theme,
@@ -16366,7 +16373,7 @@ var BasePieChart = function BasePieChart(props) {
16366
16373
  var centerTextPlugin = {
16367
16374
  id: 'centerText',
16368
16375
  afterDatasetsDraw: function afterDatasetsDraw(chart) {
16369
- var _customLabel$valueSty, _customLabel$valueSty2, _customLabel$valueSty3, _customLabel$margin, _customLabel$labelSty, _customLabel$labelSty2, _customLabel$labelSty3, _customLabel$labelSty4, _customLabel$labelSty5;
16376
+ var _modCustomLabel$value, _modCustomLabel$value2, _modCustomLabel$value3, _modCustomLabel$margi, _modCustomLabel$label, _modCustomLabel$label2, _modCustomLabel$label3, _modCustomLabel$label4, _modCustomLabel$label5;
16370
16377
  var ctx = chart.ctx,
16371
16378
  _chart$chartArea = chart.chartArea,
16372
16379
  left = _chart$chartArea.left,
@@ -16376,32 +16383,32 @@ var BasePieChart = function BasePieChart(props) {
16376
16383
  ctx.save();
16377
16384
 
16378
16385
  // Center text styling and positioning
16379
- ctx.font = "".concat(customLabel === null || customLabel === void 0 || (_customLabel$valueSty = customLabel.valueStyles) === null || _customLabel$valueSty === void 0 ? void 0 : _customLabel$valueSty.fontStyle, " ").concat(customLabel === null || customLabel === void 0 || (_customLabel$valueSty2 = customLabel.valueStyles) === null || _customLabel$valueSty2 === void 0 ? void 0 : _customLabel$valueSty2.fontSize, " Poppins");
16386
+ ctx.font = "".concat(modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$value = modCustomLabel.valueStyles) === null || _modCustomLabel$value === void 0 ? void 0 : _modCustomLabel$value.fontStyle, " ").concat(modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$value2 = modCustomLabel.valueStyles) === null || _modCustomLabel$value2 === void 0 ? void 0 : _modCustomLabel$value2.fontSize, " Poppins");
16380
16387
  ctx.textAlign = 'center';
16381
16388
  ctx.textBaseline = 'middle';
16382
- ctx.fillStyle = customLabel === null || customLabel === void 0 || (_customLabel$valueSty3 = customLabel.valueStyles) === null || _customLabel$valueSty3 === void 0 ? void 0 : _customLabel$valueSty3.color;
16389
+ ctx.fillStyle = modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$value3 = modCustomLabel.valueStyles) === null || _modCustomLabel$value3 === void 0 ? void 0 : _modCustomLabel$value3.color;
16383
16390
 
16384
16391
  // Calculate the center position of the chart
16385
16392
  var centerX = (left + right) / 2;
16386
16393
  var centerY = (top + bottom) / 2;
16387
16394
 
16388
16395
  // Render the center text
16389
- ctx.fillText("".concat(customLabel === null || customLabel === void 0 ? void 0 : customLabel.id), centerX, centerY);
16396
+ ctx.fillText("".concat(modCustomLabel === null || modCustomLabel === void 0 ? void 0 : modCustomLabel.id), centerX, centerY);
16390
16397
 
16391
16398
  // Render the compliance title with bottom margin
16392
- var titleBottomMargin = (_customLabel$margin = customLabel.margin) !== null && _customLabel$margin !== void 0 ? _customLabel$margin : 10; // Adjust this value for bottom margin
16393
- var position = (_customLabel$labelSty = customLabel === null || customLabel === void 0 || (_customLabel$labelSty2 = customLabel.labelStyles) === null || _customLabel$labelSty2 === void 0 ? void 0 : _customLabel$labelSty2.position) !== null && _customLabel$labelSty !== void 0 ? _customLabel$labelSty : 5;
16399
+ var titleBottomMargin = (_modCustomLabel$margi = modCustomLabel.margin) !== null && _modCustomLabel$margi !== void 0 ? _modCustomLabel$margi : 10; // Adjust this value for bottom margin
16400
+ var position = (_modCustomLabel$label = modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$label2 = modCustomLabel.labelStyles) === null || _modCustomLabel$label2 === void 0 ? void 0 : _modCustomLabel$label2.position) !== null && _modCustomLabel$label !== void 0 ? _modCustomLabel$label : 5;
16394
16401
  var titleYPosition = centerY + position; // Default title Y position
16395
- ctx.font = "".concat(customLabel === null || customLabel === void 0 || (_customLabel$labelSty3 = customLabel.labelStyles) === null || _customLabel$labelSty3 === void 0 ? void 0 : _customLabel$labelSty3.fontStyle, " ").concat(customLabel === null || customLabel === void 0 || (_customLabel$labelSty4 = customLabel.labelStyles) === null || _customLabel$labelSty4 === void 0 ? void 0 : _customLabel$labelSty4.fontSize, " Poppins"); // Title font style
16396
- ctx.fillStyle = "".concat(customLabel === null || customLabel === void 0 || (_customLabel$labelSty5 = customLabel.labelStyles) === null || _customLabel$labelSty5 === void 0 ? void 0 : _customLabel$labelSty5.color); // Title text color (gray)
16397
- ctx.fillText("".concat(customLabel === null || customLabel === void 0 ? void 0 : customLabel.title), centerX, titleYPosition + titleBottomMargin);
16402
+ ctx.font = "".concat(modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$label3 = modCustomLabel.labelStyles) === null || _modCustomLabel$label3 === void 0 ? void 0 : _modCustomLabel$label3.fontStyle, " ").concat(modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$label4 = modCustomLabel.labelStyles) === null || _modCustomLabel$label4 === void 0 ? void 0 : _modCustomLabel$label4.fontSize, " Poppins"); // Title font style
16403
+ ctx.fillStyle = "".concat(modCustomLabel === null || modCustomLabel === void 0 || (_modCustomLabel$label5 = modCustomLabel.labelStyles) === null || _modCustomLabel$label5 === void 0 ? void 0 : _modCustomLabel$label5.color); // Title text color (gray)
16404
+ ctx.fillText("".concat(modCustomLabel === null || modCustomLabel === void 0 ? void 0 : modCustomLabel.title), centerX, titleYPosition + titleBottomMargin);
16398
16405
 
16399
16406
  // Render compliance strip if `complianceStrip` is true
16400
16407
  if (strip) {
16401
16408
  var _strip$stripSize, _strip$stripWidth, _strip$startColor, _strip$endColor;
16402
16409
  var stripRadius = (_strip$stripSize = strip === null || strip === void 0 ? void 0 : strip.stripSize) !== null && _strip$stripSize !== void 0 ? _strip$stripSize : 35; // Radius for the outer ring
16403
16410
  var stripThickness = (_strip$stripWidth = strip === null || strip === void 0 ? void 0 : strip.stripWidth) !== null && _strip$stripWidth !== void 0 ? _strip$stripWidth : 7; // Thickness of the strip
16404
- var compliancePercentage = customLabel === null || customLabel === void 0 ? void 0 : customLabel.value; // Set compliance percentage
16411
+ var compliancePercentage = modCustomLabel === null || modCustomLabel === void 0 ? void 0 : modCustomLabel.value; // Set compliance percentage
16405
16412
 
16406
16413
  // Fixed start and end angles
16407
16414
  var startAngle = 130 * Math.PI / 180; // Convert degrees to radians
@@ -16452,7 +16459,6 @@ var BasePieChart = function BasePieChart(props) {
16452
16459
  // Return the first color stop as fallback
16453
16460
  return (colorStops === null || colorStops === void 0 ? void 0 : colorStops[0]) || '#000'; // Fallback to black
16454
16461
  }) : [];
16455
- console.log(legendColors);
16456
16462
  var customLegendPlugin = {
16457
16463
  id: 'customLegend',
16458
16464
  afterUpdate: function afterUpdate(chart) {
@@ -16515,7 +16521,7 @@ var BasePieChart = function BasePieChart(props) {
16515
16521
  children: [/*#__PURE__*/jsx(Pie, _objectSpread2({
16516
16522
  data: data,
16517
16523
  options: _objectSpread2({}, options),
16518
- plugins: [customLabel && centerTextPlugin, (legend === null || legend === void 0 ? void 0 : legend.icon) && (legend === null || legend === void 0 ? void 0 : legend.display) && customLegendPlugin].filter(Boolean)
16524
+ plugins: [modCustomLabel && centerTextPlugin, (legend === null || legend === void 0 ? void 0 : legend.icon) && (legend === null || legend === void 0 ? void 0 : legend.display) && customLegendPlugin].filter(Boolean)
16519
16525
  }, extra)), (legend === null || legend === void 0 ? void 0 : legend.icon) && (legend === null || legend === void 0 ? void 0 : legend.display) && /*#__PURE__*/jsx("ul", {
16520
16526
  style: _objectSpread2({}, legend === null || legend === void 0 ? void 0 : legend.legendStyles),
16521
16527
  ref: legendRef