dp-widgets-framework 1.7.5 → 1.7.7

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.
Files changed (3) hide show
  1. package/dist/index.esm.js +330 -179
  2. package/dist/index.js +329 -178
  3. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -7,7 +7,7 @@ import * as LabelPrimitive from '@radix-ui/react-label';
7
7
  import { cva } from 'class-variance-authority';
8
8
  import * as SwitchPrimitives from '@radix-ui/react-switch';
9
9
  import * as SelectPrimitive from '@radix-ui/react-select';
10
- import { ChevronDown, ChevronUp, Check, AlertCircle, MoveUp, MoveDown, Trash2, Plus, Bot, Type, Layout, LayoutGrid, BarChart as BarChart$1, Filter, Search, ArrowUp, ArrowDown, ChevronRight, RefreshCw, Loader2, Download, Send, X, AlignVerticalSpaceAround, LineChart as LineChart$1, PieChart as PieChart$1, Table, SlidersHorizontal, GripHorizontal, Edit, MessageCircleX, ChevronLeft, Maximize2, Grid3X3, Edit2 } from 'lucide-react';
10
+ import { ChevronDown, ChevronUp, Check, AlertCircle, MoveUp, MoveDown, Trash2, Plus, Bot, Type, Layout, LayoutGrid, BarChart as BarChart$1, Filter, Search, ArrowUp, ArrowDown, ChevronRight, RefreshCw, Loader2, Download, MessageCircleX, Send, X, AlignVerticalSpaceAround, LineChart as LineChart$1, PieChart as PieChart$1, Table, SlidersHorizontal, GripHorizontal, Edit, ChevronLeft, Maximize2, Grid3X3, Edit2 } from 'lucide-react';
11
11
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
12
12
  import { Slot, createSlot, createSlottable } from '@radix-ui/react-slot';
13
13
  import { debounce as debounce$1 } from 'lodash';
@@ -3603,10 +3603,6 @@ const oppositeSideMap = {
3603
3603
  bottom: 'top',
3604
3604
  top: 'bottom'
3605
3605
  };
3606
- const oppositeAlignmentMap = {
3607
- start: 'end',
3608
- end: 'start'
3609
- };
3610
3606
  function clamp(start, value, end) {
3611
3607
  return max(start, min(value, end));
3612
3608
  }
@@ -3625,9 +3621,9 @@ function getOppositeAxis(axis) {
3625
3621
  function getAxisLength(axis) {
3626
3622
  return axis === 'y' ? 'height' : 'width';
3627
3623
  }
3628
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
3629
3624
  function getSideAxis(placement) {
3630
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
3625
+ const firstChar = placement[0];
3626
+ return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
3631
3627
  }
3632
3628
  function getAlignmentAxis(placement) {
3633
3629
  return getOppositeAxis(getSideAxis(placement));
@@ -3650,7 +3646,7 @@ function getExpandedPlacements(placement) {
3650
3646
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
3651
3647
  }
3652
3648
  function getOppositeAlignmentPlacement(placement) {
3653
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
3649
+ return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
3654
3650
  }
3655
3651
  const lrPlacement = ['left', 'right'];
3656
3652
  const rlPlacement = ['right', 'left'];
@@ -3681,7 +3677,8 @@ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
3681
3677
  return list;
3682
3678
  }
3683
3679
  function getOppositePlacement(placement) {
3684
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
3680
+ const side = getSide(placement);
3681
+ return oppositeSideMap[side] + placement.slice(side.length);
3685
3682
  }
3686
3683
  function expandPaddingObject(padding) {
3687
3684
  return {
@@ -3840,6 +3837,9 @@ async function detectOverflow(state, options) {
3840
3837
  };
3841
3838
  }
3842
3839
 
3840
+ // Maximum number of resets that can occur before bailing to avoid infinite reset loops.
3841
+ const MAX_RESET_COUNT = 50;
3842
+
3843
3843
  /**
3844
3844
  * Computes the `x` and `y` coordinates that will place the floating element
3845
3845
  * next to a given reference element.
@@ -3854,7 +3854,10 @@ const computePosition$1 = async (reference, floating, config) => {
3854
3854
  middleware = [],
3855
3855
  platform
3856
3856
  } = config;
3857
- const validMiddleware = middleware.filter(Boolean);
3857
+ const platformWithDetectOverflow = platform.detectOverflow ? platform : {
3858
+ ...platform,
3859
+ detectOverflow
3860
+ };
3858
3861
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
3859
3862
  let rects = await platform.getElementRects({
3860
3863
  reference,
@@ -3866,14 +3869,17 @@ const computePosition$1 = async (reference, floating, config) => {
3866
3869
  y
3867
3870
  } = computeCoordsFromPlacement(rects, placement, rtl);
3868
3871
  let statefulPlacement = placement;
3869
- let middlewareData = {};
3870
3872
  let resetCount = 0;
3871
- for (let i = 0; i < validMiddleware.length; i++) {
3872
- var _platform$detectOverf;
3873
+ const middlewareData = {};
3874
+ for (let i = 0; i < middleware.length; i++) {
3875
+ const currentMiddleware = middleware[i];
3876
+ if (!currentMiddleware) {
3877
+ continue;
3878
+ }
3873
3879
  const {
3874
3880
  name,
3875
3881
  fn
3876
- } = validMiddleware[i];
3882
+ } = currentMiddleware;
3877
3883
  const {
3878
3884
  x: nextX,
3879
3885
  y: nextY,
@@ -3887,10 +3893,7 @@ const computePosition$1 = async (reference, floating, config) => {
3887
3893
  strategy,
3888
3894
  middlewareData,
3889
3895
  rects,
3890
- platform: {
3891
- ...platform,
3892
- detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
3893
- },
3896
+ platform: platformWithDetectOverflow,
3894
3897
  elements: {
3895
3898
  reference,
3896
3899
  floating
@@ -3898,14 +3901,11 @@ const computePosition$1 = async (reference, floating, config) => {
3898
3901
  });
3899
3902
  x = nextX != null ? nextX : x;
3900
3903
  y = nextY != null ? nextY : y;
3901
- middlewareData = {
3902
- ...middlewareData,
3903
- [name]: {
3904
- ...middlewareData[name],
3905
- ...data
3906
- }
3904
+ middlewareData[name] = {
3905
+ ...middlewareData[name],
3906
+ ...data
3907
3907
  };
3908
- if (reset && resetCount <= 50) {
3908
+ if (reset && resetCount < MAX_RESET_COUNT) {
3909
3909
  resetCount++;
3910
3910
  if (typeof reset === 'object') {
3911
3911
  if (reset.placement) {
@@ -4580,7 +4580,6 @@ function isShadowRoot(value) {
4580
4580
  }
4581
4581
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
4582
4582
  }
4583
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
4584
4583
  function isOverflowElement(element) {
4585
4584
  const {
4586
4585
  overflow,
@@ -4588,32 +4587,35 @@ function isOverflowElement(element) {
4588
4587
  overflowY,
4589
4588
  display
4590
4589
  } = getComputedStyle$2(element);
4591
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
4590
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
4592
4591
  }
4593
- const tableElements$1 = /*#__PURE__*/new Set(['table', 'td', 'th']);
4594
4592
  function isTableElement(element) {
4595
- return tableElements$1.has(getNodeName(element));
4593
+ return /^(table|td|th)$/.test(getNodeName(element));
4596
4594
  }
4597
- const topLayerSelectors = [':popover-open', ':modal'];
4598
4595
  function isTopLayer(element) {
4599
- return topLayerSelectors.some(selector => {
4600
- try {
4601
- return element.matches(selector);
4602
- } catch (_e) {
4603
- return false;
4596
+ try {
4597
+ if (element.matches(':popover-open')) {
4598
+ return true;
4604
4599
  }
4605
- });
4600
+ } catch (_e) {
4601
+ // no-op
4602
+ }
4603
+ try {
4604
+ return element.matches(':modal');
4605
+ } catch (_e) {
4606
+ return false;
4607
+ }
4606
4608
  }
4607
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
4608
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
4609
- const containValues = ['paint', 'layout', 'strict', 'content'];
4609
+ const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
4610
+ const containRe = /paint|layout|strict|content/;
4611
+ const isNotNone = value => !!value && value !== 'none';
4612
+ let isWebKitValue;
4610
4613
  function isContainingBlock(elementOrCss) {
4611
- const webkit = isWebKit();
4612
4614
  const css = isElement(elementOrCss) ? getComputedStyle$2(elementOrCss) : elementOrCss;
4613
4615
 
4614
4616
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
4615
4617
  // https://drafts.csswg.org/css-transforms-2/#individual-transforms
4616
- return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
4618
+ return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
4617
4619
  }
4618
4620
  function getContainingBlock(element) {
4619
4621
  let currentNode = getParentNode(element);
@@ -4628,12 +4630,13 @@ function getContainingBlock(element) {
4628
4630
  return null;
4629
4631
  }
4630
4632
  function isWebKit() {
4631
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
4632
- return CSS.supports('-webkit-backdrop-filter', 'none');
4633
+ if (isWebKitValue == null) {
4634
+ isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
4635
+ }
4636
+ return isWebKitValue;
4633
4637
  }
4634
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
4635
4638
  function isLastTraversableNode(node) {
4636
- return lastTraversableNodeNames.has(getNodeName(node));
4639
+ return /^(html|body|#document)$/.test(getNodeName(node));
4637
4640
  }
4638
4641
  function getComputedStyle$2(element) {
4639
4642
  return getWindow(element).getComputedStyle(element);
@@ -4689,8 +4692,9 @@ function getOverflowAncestors(node, list, traverseIframes) {
4689
4692
  if (isBody) {
4690
4693
  const frameElement = getFrameElement(win);
4691
4694
  return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
4695
+ } else {
4696
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
4692
4697
  }
4693
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
4694
4698
  }
4695
4699
  function getFrameElement(win) {
4696
4700
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
@@ -4867,7 +4871,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
4867
4871
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
4868
4872
  scroll = getNodeScroll(offsetParent);
4869
4873
  }
4870
- if (isHTMLElement(offsetParent)) {
4874
+ if (isOffsetParentAnElement) {
4871
4875
  const offsetRect = getBoundingClientRect(offsetParent);
4872
4876
  scale = getScale(offsetParent);
4873
4877
  offsets.x = offsetRect.x + offsetParent.clientLeft;
@@ -4955,7 +4959,6 @@ function getViewportRect(element, strategy) {
4955
4959
  };
4956
4960
  }
4957
4961
 
4958
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
4959
4962
  // Returns the inner client rect, subtracting scrollbars if present.
4960
4963
  function getInnerBoundingClientRect(element, strategy) {
4961
4964
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
@@ -5020,7 +5023,7 @@ function getClippingElementAncestors(element, cache) {
5020
5023
  if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
5021
5024
  currentContainingBlockComputedStyle = null;
5022
5025
  }
5023
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
5026
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
5024
5027
  if (shouldDropCurrentNode) {
5025
5028
  // Drop non-containing blocks.
5026
5029
  result = result.filter(ancestor => ancestor !== currentNode);
@@ -5045,20 +5048,23 @@ function getClippingRect(_ref) {
5045
5048
  } = _ref;
5046
5049
  const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
5047
5050
  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
5048
- const firstClippingAncestor = clippingAncestors[0];
5049
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
5050
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
5051
- accRect.top = max(rect.top, accRect.top);
5052
- accRect.right = min(rect.right, accRect.right);
5053
- accRect.bottom = min(rect.bottom, accRect.bottom);
5054
- accRect.left = max(rect.left, accRect.left);
5055
- return accRect;
5056
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
5051
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
5052
+ let top = firstRect.top;
5053
+ let right = firstRect.right;
5054
+ let bottom = firstRect.bottom;
5055
+ let left = firstRect.left;
5056
+ for (let i = 1; i < clippingAncestors.length; i++) {
5057
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
5058
+ top = max(rect.top, top);
5059
+ right = min(rect.right, right);
5060
+ bottom = min(rect.bottom, bottom);
5061
+ left = max(rect.left, left);
5062
+ }
5057
5063
  return {
5058
- width: clippingRect.right - clippingRect.left,
5059
- height: clippingRect.bottom - clippingRect.top,
5060
- x: clippingRect.left,
5061
- y: clippingRect.top
5064
+ width: right - left,
5065
+ height: bottom - top,
5066
+ x: left,
5067
+ y: top
5062
5068
  };
5063
5069
  }
5064
5070
 
@@ -5309,7 +5315,7 @@ function autoUpdate(reference, floating, update, options) {
5309
5315
  animationFrame = false
5310
5316
  } = options;
5311
5317
  const referenceEl = unwrapElement(reference);
5312
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
5318
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
5313
5319
  ancestors.forEach(ancestor => {
5314
5320
  ancestorScroll && ancestor.addEventListener('scroll', update, {
5315
5321
  passive: true
@@ -5322,7 +5328,7 @@ function autoUpdate(reference, floating, update, options) {
5322
5328
  if (elementResize) {
5323
5329
  resizeObserver = new ResizeObserver(_ref => {
5324
5330
  let [firstEntry] = _ref;
5325
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
5331
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
5326
5332
  // Prevent update loops when using the `size` middleware.
5327
5333
  // https://github.com/floating-ui/floating-ui/issues/1740
5328
5334
  resizeObserver.unobserve(floating);
@@ -5337,7 +5343,9 @@ function autoUpdate(reference, floating, update, options) {
5337
5343
  if (referenceEl && !animationFrame) {
5338
5344
  resizeObserver.observe(referenceEl);
5339
5345
  }
5340
- resizeObserver.observe(floating);
5346
+ if (floating) {
5347
+ resizeObserver.observe(floating);
5348
+ }
5341
5349
  }
5342
5350
  let frameId;
5343
5351
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
@@ -5719,28 +5727,39 @@ const arrow$1 = options => {
5719
5727
  * object may be passed.
5720
5728
  * @see https://floating-ui.com/docs/offset
5721
5729
  */
5722
- const offset = (options, deps) => ({
5723
- ...offset$1(options),
5724
- options: [options, deps]
5725
- });
5730
+ const offset = (options, deps) => {
5731
+ const result = offset$1(options);
5732
+ return {
5733
+ name: result.name,
5734
+ fn: result.fn,
5735
+ options: [options, deps]
5736
+ };
5737
+ };
5726
5738
 
5727
5739
  /**
5728
5740
  * Optimizes the visibility of the floating element by shifting it in order to
5729
5741
  * keep it in view when it will overflow the clipping boundary.
5730
5742
  * @see https://floating-ui.com/docs/shift
5731
5743
  */
5732
- const shift = (options, deps) => ({
5733
- ...shift$1(options),
5734
- options: [options, deps]
5735
- });
5744
+ const shift = (options, deps) => {
5745
+ const result = shift$1(options);
5746
+ return {
5747
+ name: result.name,
5748
+ fn: result.fn,
5749
+ options: [options, deps]
5750
+ };
5751
+ };
5736
5752
 
5737
5753
  /**
5738
5754
  * Built-in `limiter` that will stop `shift()` at a certain point.
5739
5755
  */
5740
- const limitShift = (options, deps) => ({
5741
- ...limitShift$1(options),
5742
- options: [options, deps]
5743
- });
5756
+ const limitShift = (options, deps) => {
5757
+ const result = limitShift$1(options);
5758
+ return {
5759
+ fn: result.fn,
5760
+ options: [options, deps]
5761
+ };
5762
+ };
5744
5763
 
5745
5764
  /**
5746
5765
  * Optimizes the visibility of the floating element by flipping the `placement`
@@ -5748,10 +5767,14 @@ const limitShift = (options, deps) => ({
5748
5767
  * clipping boundary. Alternative to `autoPlacement`.
5749
5768
  * @see https://floating-ui.com/docs/flip
5750
5769
  */
5751
- const flip = (options, deps) => ({
5752
- ...flip$1(options),
5753
- options: [options, deps]
5754
- });
5770
+ const flip = (options, deps) => {
5771
+ const result = flip$1(options);
5772
+ return {
5773
+ name: result.name,
5774
+ fn: result.fn,
5775
+ options: [options, deps]
5776
+ };
5777
+ };
5755
5778
 
5756
5779
  /**
5757
5780
  * Provides data that allows you to change the size of the floating element —
@@ -5759,20 +5782,28 @@ const flip = (options, deps) => ({
5759
5782
  * width of the reference element.
5760
5783
  * @see https://floating-ui.com/docs/size
5761
5784
  */
5762
- const size = (options, deps) => ({
5763
- ...size$1(options),
5764
- options: [options, deps]
5765
- });
5785
+ const size = (options, deps) => {
5786
+ const result = size$1(options);
5787
+ return {
5788
+ name: result.name,
5789
+ fn: result.fn,
5790
+ options: [options, deps]
5791
+ };
5792
+ };
5766
5793
 
5767
5794
  /**
5768
5795
  * Provides data to hide the floating element in applicable situations, such as
5769
5796
  * when it is not in the same clipping context as the reference element.
5770
5797
  * @see https://floating-ui.com/docs/hide
5771
5798
  */
5772
- const hide = (options, deps) => ({
5773
- ...hide$1(options),
5774
- options: [options, deps]
5775
- });
5799
+ const hide = (options, deps) => {
5800
+ const result = hide$1(options);
5801
+ return {
5802
+ name: result.name,
5803
+ fn: result.fn,
5804
+ options: [options, deps]
5805
+ };
5806
+ };
5776
5807
 
5777
5808
  /**
5778
5809
  * Provides data to position an inner element of the floating element so that it
@@ -5780,10 +5811,14 @@ const hide = (options, deps) => ({
5780
5811
  * This wraps the core `arrow` middleware to allow React refs as the element.
5781
5812
  * @see https://floating-ui.com/docs/arrow
5782
5813
  */
5783
- const arrow = (options, deps) => ({
5784
- ...arrow$1(options),
5785
- options: [options, deps]
5786
- });
5814
+ const arrow = (options, deps) => {
5815
+ const result = arrow$1(options);
5816
+ return {
5817
+ name: result.name,
5818
+ fn: result.fn,
5819
+ options: [options, deps]
5820
+ };
5821
+ };
5787
5822
 
5788
5823
  // src/arrow.tsx
5789
5824
  var NAME$1 = "Arrow";
@@ -20120,15 +20155,17 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20120
20155
  afterDatasetsDraw(chart) {
20121
20156
  if (!(content == null ? void 0 : content.showLabels)) return;
20122
20157
  const { ctx } = chart;
20158
+ const chartHeight = chart.height;
20159
+ const fontSize = Math.max(11, Math.min(14, Math.floor(chartHeight * 0.025)));
20123
20160
  chart.data.datasets.forEach((dataset, i) => {
20124
20161
  const meta = chart.getDatasetMeta(i);
20125
20162
  meta.data.forEach((bar, index) => {
20126
20163
  const value = dataset.data[index];
20127
20164
  ctx.save();
20128
- ctx.font = "12px sans-serif";
20165
+ ctx.font = `bold ${fontSize}px sans-serif`;
20129
20166
  ctx.textAlign = "center";
20130
- ctx.fillStyle = "black";
20131
- ctx.fillText(value, bar.x, bar.y - 5);
20167
+ ctx.fillStyle = "#0F172A";
20168
+ ctx.fillText(value, bar.x, bar.y - 8);
20132
20169
  ctx.restore();
20133
20170
  });
20134
20171
  });
@@ -20148,10 +20185,10 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20148
20185
  indexAxis: orientation === "horizontal" ? "y" : "x",
20149
20186
  layout: {
20150
20187
  padding: {
20151
- bottom: 0,
20152
- top: 0,
20153
- left: 0,
20154
- right: 0
20188
+ bottom: 8,
20189
+ top: 24,
20190
+ left: 4,
20191
+ right: 16
20155
20192
  }
20156
20193
  },
20157
20194
  plugins: {
@@ -20163,8 +20200,12 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20163
20200
  return false;
20164
20201
  }),
20165
20202
  labels: {
20166
- boxWidth: 12,
20167
- boxHeight: 12
20203
+ boxWidth: 16,
20204
+ boxHeight: 16,
20205
+ padding: 16,
20206
+ font: { size: 13, weight: "normal" },
20207
+ usePointStyle: true,
20208
+ pointStyle: "rect"
20168
20209
  },
20169
20210
  position: "bottom"
20170
20211
  },
@@ -20175,12 +20216,21 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20175
20216
  display: true,
20176
20217
  text: title,
20177
20218
  font: {
20178
- size: 18,
20219
+ size: 16,
20179
20220
  weight: "bold"
20180
20221
  },
20181
- color: "#0F172A"
20222
+ color: "#0F172A",
20223
+ padding: 16
20182
20224
  },
20183
20225
  tooltip: {
20226
+ mode: "index",
20227
+ intersect: false,
20228
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
20229
+ titleFont: { size: 13, weight: "bold" },
20230
+ bodyFont: { size: 12 },
20231
+ padding: 12,
20232
+ borderColor: "#ccc",
20233
+ borderWidth: 1,
20184
20234
  callbacks: {
20185
20235
  label: function(context) {
20186
20236
  var _a2, _b2;
@@ -20194,23 +20244,40 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20194
20244
  x: {
20195
20245
  title: {
20196
20246
  display: !!x_axis_title,
20197
- text: x_axis_title
20247
+ text: x_axis_title,
20248
+ font: { size: 13, weight: "bold" },
20249
+ padding: 8
20250
+ },
20251
+ ticks: {
20252
+ autoSkip: true,
20253
+ maxRotation: 45,
20254
+ minRotation: 0,
20255
+ font: { size: 12 },
20256
+ maxTicksLimit: 12
20198
20257
  },
20199
- ticks: { autoSkip: false, maxRotation: 45, minRotation: 0 }
20258
+ grid: {
20259
+ color: "rgba(0, 0, 0, 0.05)"
20260
+ }
20200
20261
  },
20201
20262
  y: {
20202
20263
  title: {
20203
20264
  display: true,
20204
- text: y_axis_title || ((data == null ? void 0 : data.datasets) && ((_a = data == null ? void 0 : data.datasets) == null ? void 0 : _a.length) === 1 ? (_b = data == null ? void 0 : data.datasets) == null ? void 0 : _b[0].label : getAxisLabel(units != null ? units : ""))
20265
+ text: y_axis_title || ((data == null ? void 0 : data.datasets) && ((_a = data == null ? void 0 : data.datasets) == null ? void 0 : _a.length) === 1 ? (_b = data == null ? void 0 : data.datasets) == null ? void 0 : _b[0].label : getAxisLabel(units != null ? units : "")),
20266
+ font: { size: 13, weight: "bold" },
20267
+ padding: 12
20205
20268
  },
20206
20269
  beginAtZero: true,
20207
20270
  ticks: {
20271
+ font: { size: 12 },
20208
20272
  callback: function(value) {
20209
20273
  if (units === "$") {
20210
20274
  return `${units}${formatValue(value)}`;
20211
20275
  }
20212
20276
  return units ? `${formatValue(value)} ${(units == null ? void 0 : units.length) < 3 ? units : ""}` : value;
20213
20277
  }
20278
+ },
20279
+ grid: {
20280
+ color: "rgba(0, 0, 0, 0.05)"
20214
20281
  }
20215
20282
  }
20216
20283
  }
@@ -21589,10 +21656,10 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21589
21656
  maintainAspectRatio: false,
21590
21657
  layout: {
21591
21658
  padding: {
21592
- bottom: 0,
21593
- top: 0,
21594
- left: 0,
21595
- right: 0
21659
+ bottom: 8,
21660
+ top: 8,
21661
+ left: 4,
21662
+ right: 16
21596
21663
  }
21597
21664
  },
21598
21665
  plugins: {
@@ -21604,8 +21671,12 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21604
21671
  return false;
21605
21672
  }),
21606
21673
  labels: {
21607
- boxWidth: 12,
21608
- boxHeight: 12
21674
+ boxWidth: 16,
21675
+ boxHeight: 16,
21676
+ padding: 16,
21677
+ font: { size: 13, weight: "normal" },
21678
+ usePointStyle: true,
21679
+ pointStyle: "circle"
21609
21680
  },
21610
21681
  position: "bottom"
21611
21682
  },
@@ -21629,12 +21700,21 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21629
21700
  display: true,
21630
21701
  text: title,
21631
21702
  font: {
21632
- size: 18,
21703
+ size: 16,
21633
21704
  weight: "bold"
21634
21705
  },
21635
- color: "#0F172A"
21706
+ color: "#0F172A",
21707
+ padding: 16
21636
21708
  },
21637
21709
  tooltip: {
21710
+ mode: "index",
21711
+ intersect: false,
21712
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
21713
+ titleFont: { size: 13, weight: "bold" },
21714
+ bodyFont: { size: 12 },
21715
+ padding: 12,
21716
+ borderColor: "#ccc",
21717
+ borderWidth: 1,
21638
21718
  callbacks: {
21639
21719
  label: function(context) {
21640
21720
  var _a2;
@@ -21648,26 +21728,43 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21648
21728
  x: {
21649
21729
  title: {
21650
21730
  display: !!x_axis_title,
21651
- text: x_axis_title
21731
+ text: x_axis_title,
21732
+ font: { size: 13, weight: "bold" },
21733
+ padding: 8
21652
21734
  },
21653
- ticks: { autoSkip: true, maxTicksLimit: 8, maxRotation: 45, minRotation: 0 }
21735
+ ticks: {
21736
+ autoSkip: true,
21737
+ maxRotation: 45,
21738
+ minRotation: 0,
21739
+ font: { size: 12 },
21740
+ maxTicksLimit: 10
21741
+ },
21742
+ grid: {
21743
+ color: "rgba(0, 0, 0, 0.05)"
21744
+ }
21654
21745
  },
21655
21746
  y: {
21656
21747
  title: {
21657
21748
  display: true,
21658
- text: y_axis_title || ((data == null ? void 0 : data.datasets) && ((_a = data == null ? void 0 : data.datasets) == null ? void 0 : _a.length) === 1 ? (_b = data == null ? void 0 : data.datasets) == null ? void 0 : _b[0].label : getAxisLabel(units != null ? units : ""))
21749
+ text: y_axis_title || ((data == null ? void 0 : data.datasets) && ((_a = data == null ? void 0 : data.datasets) == null ? void 0 : _a.length) === 1 ? (_b = data == null ? void 0 : data.datasets) == null ? void 0 : _b[0].label : getAxisLabel(units != null ? units : "")),
21750
+ font: { size: 13, weight: "bold" },
21751
+ padding: 12
21659
21752
  },
21660
21753
  beginAtZero: true,
21661
21754
  ticks: {
21755
+ font: { size: 12 },
21662
21756
  callback: function(value) {
21663
21757
  return units ? `${formatValue(value)} ${units}` : value;
21664
21758
  }
21759
+ },
21760
+ grid: {
21761
+ color: "rgba(0, 0, 0, 0.05)"
21665
21762
  }
21666
21763
  }
21667
21764
  },
21668
21765
  elements: {
21669
21766
  line: {
21670
- tension: 0.1
21767
+ tension: 0.3
21671
21768
  },
21672
21769
  point: {
21673
21770
  radius: 4
@@ -22475,8 +22572,12 @@ const PieChart = (props) => {
22475
22572
  plugins: {
22476
22573
  legend: {
22477
22574
  labels: {
22478
- boxWidth: 4,
22479
- boxHeight: 4
22575
+ boxWidth: 16,
22576
+ boxHeight: 16,
22577
+ padding: 12,
22578
+ font: { size: 13, weight: "normal" },
22579
+ usePointStyle: true,
22580
+ pointStyle: "circle"
22480
22581
  },
22481
22582
  position: "bottom"
22482
22583
  },
@@ -22493,19 +22594,21 @@ const PieChart = (props) => {
22493
22594
  const percent = value / total * 100;
22494
22595
  return percent >= 5 ? `${(_a = ctx.chart.data.labels) == null ? void 0 : _a[ctx.dataIndex]} ${value}` : "";
22495
22596
  },
22496
- color: "black",
22497
- stretch: 15,
22597
+ color: "#0F172A",
22598
+ stretch: 25,
22599
+ padding: 4,
22498
22600
  font: {
22499
22601
  resizable: true,
22500
- minSize: 12,
22501
- maxSize: 18
22602
+ minSize: 11,
22603
+ maxSize: 14,
22604
+ weight: "bold"
22502
22605
  },
22503
22606
  backgroundColor: (ctx) => {
22504
22607
  const dataset = ctx.dataset.data;
22505
22608
  const total = dataset.reduce((a, b) => a + b, 0);
22506
22609
  const value = dataset[ctx.dataIndex];
22507
22610
  const percent = value / total * 100;
22508
- return percent >= 5 ? "rgba(255,255,255,0.7)" : "transparent";
22611
+ return percent >= 5 ? "rgba(255,255,255,0.85)" : "transparent";
22509
22612
  }
22510
22613
  },
22511
22614
  datalabels: {
@@ -22515,12 +22618,22 @@ const PieChart = (props) => {
22515
22618
  display: true,
22516
22619
  text: title,
22517
22620
  font: {
22518
- size: 18,
22621
+ size: 16,
22519
22622
  weight: "bold"
22520
22623
  },
22521
- color: "#0F172A"
22624
+ color: "#0F172A",
22625
+ padding: {
22626
+ bottom: 28,
22627
+ top: 0
22628
+ }
22522
22629
  },
22523
22630
  tooltip: {
22631
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
22632
+ titleFont: { size: 13, weight: "bold" },
22633
+ bodyFont: { size: 12 },
22634
+ padding: 12,
22635
+ borderColor: "#ccc",
22636
+ borderWidth: 1,
22524
22637
  callbacks: {
22525
22638
  label: function(context) {
22526
22639
  const value = context.parsed;
@@ -22531,10 +22644,10 @@ const PieChart = (props) => {
22531
22644
  },
22532
22645
  layout: {
22533
22646
  padding: {
22534
- bottom: 0,
22535
- top: 0,
22536
- left: 0,
22537
- right: 0
22647
+ bottom: 4,
22648
+ top: 24,
22649
+ left: 4,
22650
+ right: 4
22538
22651
  }
22539
22652
  }
22540
22653
  };
@@ -36903,7 +37016,7 @@ const own$2 = {}.hasOwnProperty;
36903
37016
  * mdast tree.
36904
37017
  */
36905
37018
  function fromMarkdown(value, encoding, options) {
36906
- if (typeof encoding !== 'string') {
37019
+ if (encoding && typeof encoding === 'object') {
36907
37020
  options = encoding;
36908
37021
  encoding = undefined;
36909
37022
  }
@@ -44634,7 +44747,9 @@ function CopilotKitChatbot({
44634
44747
  onResetReady,
44635
44748
  widgetIds,
44636
44749
  datasetId,
44637
- dashboardName
44750
+ dashboardName,
44751
+ onClearChat,
44752
+ isClearing = false
44638
44753
  }) {
44639
44754
  var _a, _b, _c, _d;
44640
44755
  const { threadId, setThreadId } = useCopilotContext();
@@ -44743,25 +44858,46 @@ function CopilotKitChatbot({
44743
44858
  /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-medium", children: widget.title })
44744
44859
  ] }) }),
44745
44860
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 h-full flex flex-col", children: [
44746
- chatMessages.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start px-4 py-2 border-b border-gray-100", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
44747
- "button",
44748
- {
44749
- onClick: handleExport,
44750
- disabled: isExporting,
44751
- className: cn(
44752
- "flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md",
44753
- "bg-gray-100 border border-gray-200",
44754
- "text-gray-700 hover:bg-gray-200 hover:border-gray-300",
44755
- "disabled:opacity-50 disabled:cursor-not-allowed",
44756
- "transition-colors duration-150"
44757
- ),
44758
- title: "Export conversation as PDF",
44759
- children: [
44760
- isExporting ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Download, { className: "h-3.5 w-3.5" }),
44761
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Export PDF" })
44762
- ]
44763
- }
44764
- ) }),
44861
+ chatMessages.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-start gap-2 px-4 py-2 border-b border-gray-100", children: [
44862
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
44863
+ "button",
44864
+ {
44865
+ onClick: handleExport,
44866
+ disabled: isExporting,
44867
+ className: cn(
44868
+ "flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md",
44869
+ "bg-gray-100 border border-gray-200",
44870
+ "text-gray-700 hover:bg-gray-200 hover:border-gray-300",
44871
+ "disabled:opacity-50 disabled:cursor-not-allowed",
44872
+ "transition-colors duration-150"
44873
+ ),
44874
+ title: "Export conversation as PDF",
44875
+ children: [
44876
+ isExporting ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Download, { className: "h-3.5 w-3.5" }),
44877
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Export PDF" })
44878
+ ]
44879
+ }
44880
+ ),
44881
+ onClearChat && /* @__PURE__ */ jsxRuntimeExports.jsxs(
44882
+ "button",
44883
+ {
44884
+ onClick: onClearChat,
44885
+ disabled: isClearing,
44886
+ className: cn(
44887
+ "flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md",
44888
+ "bg-gray-100 border border-gray-200",
44889
+ "text-gray-700 hover:bg-gray-200 hover:border-gray-300",
44890
+ "disabled:opacity-50 disabled:cursor-not-allowed",
44891
+ "transition-colors duration-150"
44892
+ ),
44893
+ title: "Clear chat conversation",
44894
+ children: [
44895
+ isClearing ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(MessageCircleX, { className: "h-3.5 w-3.5" }),
44896
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Clear Chat" })
44897
+ ]
44898
+ }
44899
+ )
44900
+ ] }),
44765
44901
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto p-4 space-y-4", children: chatMessages.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-gray-500 text-xs mt-8", children: ((_b = widget.config) == null ? void 0 : _b.copilotInitialMessage) || ((_c = widget.config) == null ? void 0 : _c.placeholder) || "How can I help you today?" }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
44766
44902
  chatMessages.map((message) => /* @__PURE__ */ jsxRuntimeExports.jsx(
44767
44903
  "div",
@@ -44838,7 +44974,9 @@ function ChatbotWidget({
44838
44974
  onResetReady,
44839
44975
  widgetIds,
44840
44976
  datasetId,
44841
- dashboardName
44977
+ dashboardName,
44978
+ onClearChat,
44979
+ isClearing = false
44842
44980
  }) {
44843
44981
  var _a, _b;
44844
44982
  const styles = getStyleValues$4((_a = widget.config) == null ? void 0 : _a.styles);
@@ -44863,7 +45001,9 @@ function ChatbotWidget({
44863
45001
  onResetReady,
44864
45002
  widgetIds,
44865
45003
  datasetId,
44866
- dashboardName
45004
+ dashboardName,
45005
+ onClearChat,
45006
+ isClearing
44867
45007
  }
44868
45008
  )
44869
45009
  }
@@ -45445,7 +45585,7 @@ function FiltersContent({
45445
45585
  ] }) : "Apply Filters"
45446
45586
  }
45447
45587
  ) }) }),
45448
- isEditing && /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "top", children: "Save the layout first to apply filters" })
45588
+ isEditing && /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "top", children: "Exit edit mode by saving or canceling your layout changes to apply filters" })
45449
45589
  ] }) })
45450
45590
  ] }) })
45451
45591
  ] });
@@ -45754,7 +45894,7 @@ var __spreadValues$8 = (a, b) => {
45754
45894
  };
45755
45895
  var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
45756
45896
  const CHART_REFRESH_TIMEOUT$3 = 3e3;
45757
- const DEFAULT_COLORS$2 = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
45897
+ const DEFAULT_COLORS$2 = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
45758
45898
  const clearChat$3 = async (widgetBackendUrl, widgetId) => {
45759
45899
  if (!widgetBackendUrl || !widgetId) return;
45760
45900
  console.log("clearChat called for widgetId:", widgetId);
@@ -46147,7 +46287,7 @@ var __spreadValues$7 = (a, b) => {
46147
46287
  };
46148
46288
  var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
46149
46289
  const CHART_REFRESH_TIMEOUT$2 = 3e3;
46150
- const DEFAULT_COLORS$1 = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
46290
+ const DEFAULT_COLORS$1 = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
46151
46291
  const clearChat$2 = async (widgetBackendUrl, widgetId) => {
46152
46292
  if (!widgetBackendUrl || !widgetId) return;
46153
46293
  console.log("clearChat called for widgetId:", widgetId);
@@ -46572,7 +46712,7 @@ var __spreadValues$6 = (a, b) => {
46572
46712
  };
46573
46713
  var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
46574
46714
  const CHART_REFRESH_TIMEOUT$1 = 3e3;
46575
- const DEFAULT_COLORS = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
46715
+ const DEFAULT_COLORS = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
46576
46716
  const clearChat$1 = async (widgetBackendUrl, widgetId) => {
46577
46717
  if (!widgetBackendUrl || !widgetId) return;
46578
46718
  console.log("clearChat called for widgetId:", widgetId);
@@ -46764,11 +46904,23 @@ function SeriesBarChartComponent({
46764
46904
  }
46765
46905
  const transformedData = {
46766
46906
  labels,
46767
- datasets: series.map((seriesItem, index) => ({
46768
- label: seriesItem.name,
46769
- data: seriesItem.values,
46770
- backgroundColor: (seriesItem == null ? void 0 : seriesItem.colors) || (seriesItem == null ? void 0 : seriesItem.color) || finalColors[index % finalColors.length]
46771
- }))
46907
+ datasets: series.map((seriesItem, index) => {
46908
+ const color = (seriesItem == null ? void 0 : seriesItem.colors) || (seriesItem == null ? void 0 : seriesItem.color) || finalColors[index % finalColors.length];
46909
+ return {
46910
+ label: seriesItem.name,
46911
+ data: seriesItem.values,
46912
+ borderColor: color,
46913
+ backgroundColor: color + "26",
46914
+ // 15% opacity for subtle fill under curve
46915
+ borderWidth: 2.5,
46916
+ fill: false,
46917
+ pointRadius: 4,
46918
+ pointHoverRadius: 6,
46919
+ pointBackgroundColor: color,
46920
+ pointBorderColor: "#ffffff",
46921
+ pointBorderWidth: 2
46922
+ };
46923
+ })
46772
46924
  };
46773
46925
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
46774
46926
  SeriesLineChart,
@@ -47383,7 +47535,9 @@ function WidgetRenderer({
47383
47535
  pageId,
47384
47536
  onApplyFilters,
47385
47537
  isEditing = false,
47386
- dashboardName
47538
+ dashboardName,
47539
+ onClearChat,
47540
+ isClearing
47387
47541
  }) {
47388
47542
  const handleConfigUpdate = (config) => {
47389
47543
  if (onConfigUpdate) {
@@ -47415,7 +47569,7 @@ function WidgetRenderer({
47415
47569
  }
47416
47570
  );
47417
47571
  case "chatbot":
47418
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ChatbotWidget, { widget, showHeader: false, widgetBackendUrl, onResetReady, widgetIds, datasetId, dashboardName });
47572
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ChatbotWidget, { widget, showHeader: false, widgetBackendUrl, onResetReady, widgetIds, datasetId, dashboardName, onClearChat: onClearChat ? () => onClearChat(widget.id) : void 0, isClearing: isClearing === widget.id });
47419
47573
  case "filters":
47420
47574
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
47421
47575
  FiltersWidget,
@@ -48295,11 +48449,11 @@ function WidgetDashboard({
48295
48449
  const [internalSelectedWidget, setInternalSelectedWidget] = useState(selectedWidget);
48296
48450
  const [currentLayouts, setCurrentLayouts] = useState(defaultLayouts);
48297
48451
  const [draftLayouts, setDraftLayouts] = useState(defaultLayouts);
48298
- const [visibleClearButton, setVisibleClearButton] = useState("");
48299
48452
  const [showEditModal, setShowEditModal] = useState(false);
48300
48453
  const [editInitialQuery, setEditInitialQuery] = useState("");
48301
48454
  const [editingWidget, setEditingWidget] = useState(null);
48302
48455
  const [widgetResetFunctions, setWidgetResetFunctions] = useState(/* @__PURE__ */ new Map());
48456
+ const [clearingChatWidget, setClearingChatWidget] = useState("");
48303
48457
  const displayWidgets = React__default.useMemo(() => {
48304
48458
  if (focusWidgetId) {
48305
48459
  return widgets.filter((w) => w.id === focusWidgetId);
@@ -48465,6 +48619,7 @@ function WidgetDashboard({
48465
48619
  }, []);
48466
48620
  const handleClearChat = async (widgetId) => {
48467
48621
  try {
48622
+ setClearingChatWidget(widgetId);
48468
48623
  const response = await fetch(getApiUrl("/api/clear-chat"), {
48469
48624
  method: "POST",
48470
48625
  headers: {
@@ -48486,6 +48641,8 @@ function WidgetDashboard({
48486
48641
  }
48487
48642
  } catch (error) {
48488
48643
  console.error("Error clearing chat:", error);
48644
+ } finally {
48645
+ setClearingChatWidget("");
48489
48646
  }
48490
48647
  };
48491
48648
  const loadData = useCallback(async () => {
@@ -49015,10 +49172,10 @@ function WidgetDashboard({
49015
49172
  const filterStatus = w.type === "agent" ? getWidgetFilterStatus(w.id) : null;
49016
49173
  const badgeInfo = filterStatus ? getFilterStatusBadge(filterStatus.status) : null;
49017
49174
  const isFocusMode = focusWidgetId && w.id === focusWidgetId;
49018
- const widgetBaseStyles = "rounded-xl border border-gray-200 !bg-white";
49019
- const widgetHoverStyles = isEditing ? "hover:border-primary-500 hover:shadow-lg transition-all duration-200" : "";
49020
- const widgetShadow = "shadow-[0_2px_8px_-2px_rgba(0,0,0,0.15)]";
49021
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { "data-widget-id": w.id, className: `${w.type === "text" || w.type === "spacer" ? `${((_b = (_a = w == null ? void 0 : w.config) == null ? void 0 : _a.content) == null ? void 0 : _b.divider) === "yes" && "border-b border-gray-300"} ${isEditing ? `${widgetBaseStyles} ${widgetShadow} ${widgetHoverStyles}` : "flex items-center"}` : `${widgetBaseStyles} ${widgetShadow} ${widgetHoverStyles} p-4 ${isEditing ? "pb-14" : "pb-5"}`} ${isFocusMode ? "h-full" : ""} relative`, children: [
49175
+ const widgetBaseStyles = "rounded-xl border-2 border-gray-300 !bg-white";
49176
+ const widgetHoverStyles = "hover:border-primary-500 hover:shadow-lg transition-all duration-200 cursor-pointer";
49177
+ const widgetShadow = "shadow-[0_4px_12px_-2px_rgba(0,0,0,0.2)]";
49178
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { "data-widget-id": w.id, className: `${w.type === "text" || w.type === "spacer" ? `${((_b = (_a = w == null ? void 0 : w.config) == null ? void 0 : _a.content) == null ? void 0 : _b.divider) === "yes" && "border-b border-gray-300"} ${isEditing ? `${widgetBaseStyles} ${widgetShadow} ${widgetHoverStyles}` : "flex items-center"}` : `${widgetBaseStyles} ${widgetShadow} ${widgetHoverStyles} p-4 ${isEditing ? "pb-14" : "pb-5"}`} ${isFocusMode ? "h-full" : ""} relative overflow-hidden`, children: [
49022
49179
  w.type === "agent" && badgeInfo && !isApplyingFilters && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-2 right-2 z-10", title: (filterStatus == null ? void 0 : filterStatus.reason) || (filterStatus == null ? void 0 : filterStatus.error) || "", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Badge, { variant: badgeInfo.variant, className: "text-[10px] px-2 py-0.5 gap-1", children: [
49023
49180
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: badgeInfo.icon }),
49024
49181
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: badgeInfo.label })
@@ -49045,13 +49202,7 @@ function WidgetDashboard({
49045
49202
  w.type !== "spacer" && w.type !== "chatbot" && /* @__PURE__ */ jsxRuntimeExports.jsx(Edit, { onClick: () => onClickSettings && onClickSettings(w), className: "w-5 h-5 text-gray-600" })
49046
49203
  ] })
49047
49204
  ] }),
49048
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${(w == null ? void 0 : w.type) === "text" || (w == null ? void 0 : w.type) === "spacer" ? `${isEditing ? "px-4" : ""}` : "h-full"} w-full relative`, children: [
49049
- (w == null ? void 0 : w.type) === "chatbot" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative z-50", children: [
49050
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { onClick: () => handleClearChat(w == null ? void 0 : w.id), onMouseOver: () => setVisibleClearButton(w == null ? void 0 : w.id), onMouseLeave: () => setVisibleClearButton(""), className: "absolute top-[12px] right-0 z-40 flex align-middle justify-center gap-2 text-sm px-4 py-2 border-primary-300 rounded-l-sm w-fit bg-primary-700 text-white cursor-pointer shadow-md transition-all", children: /* @__PURE__ */ jsxRuntimeExports.jsx(MessageCircleX, { className: "w-5 h-5" }) }),
49051
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `absolute top-[56px] right-[16px] z-50 w-max py-1 text-xs px-2 rounded-sm text-white bg-gray-950 ${visibleClearButton === (w == null ? void 0 : w.id) ? "block" : "hidden"}`, children: "Clear Chat" })
49052
- ] }),
49053
- /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetRenderer, { widget: w, widgetBackendUrl, onResetReady: handleResetReady, widgetIds: widgets.filter((widget) => widget.type !== "chatbot").map((widget) => widget.id), datasetId, pageId, onApplyFilters, isEditing, dashboardName: ((_c = pageData == null ? void 0 : pageData.basic) == null ? void 0 : _c.title) || (pageData == null ? void 0 : pageData.name) || (pageData == null ? void 0 : pageData.title) })
49054
- ] })
49205
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${(w == null ? void 0 : w.type) === "text" || (w == null ? void 0 : w.type) === "spacer" ? `${isEditing ? "px-4" : ""}` : "h-full"} w-full relative`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetRenderer, { widget: w, widgetBackendUrl, onResetReady: handleResetReady, widgetIds: widgets.filter((widget) => widget.type !== "chatbot").map((widget) => widget.id), datasetId, pageId, onApplyFilters, isEditing, dashboardName: ((_c = pageData == null ? void 0 : pageData.basic) == null ? void 0 : _c.title) || (pageData == null ? void 0 : pageData.name) || (pageData == null ? void 0 : pageData.title), onClearChat: handleClearChat, isClearing: clearingChatWidget }) })
49055
49206
  ] }, w.id);
49056
49207
  })
49057
49208
  }
@@ -49346,7 +49497,7 @@ function PresentationMode({
49346
49497
  }
49347
49498
  )
49348
49499
  ] }),
49349
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 bg-white p-6 min-h-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full w-full rounded-xl border border-gray-200 bg-white shadow-sm overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
49500
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 bg-white p-6 min-h-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full w-full rounded-xl border-2 border-gray-300 bg-white shadow-[0_4px_12px_-2px_rgba(0,0,0,0.2)] overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
49350
49501
  WidgetRenderer,
49351
49502
  {
49352
49503
  widget: currentFocusWidget,