sag_components 2.0.0-beta156 → 2.0.0-beta157

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.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import React$1, { useState, useRef, useEffect, useMemo, useCallback, useImperativeHandle } from 'react';
2
- import styled, { keyframes, css } from 'styled-components';
2
+ import styled, { keyframes, css, styled as styled$1 } from 'styled-components';
3
3
  import { ResponsiveContainer, PieChart as PieChart$1, Pie, Cell, Tooltip as Tooltip$3, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Bar, LabelList, ReferenceLine, LineChart, Line, AreaChart as AreaChart$1, Legend, Area, ScatterChart, ZAxis, Scatter, Brush, ComposedChart } from 'recharts';
4
4
  import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
5
5
  import { motion, AnimatePresence } from 'framer-motion';
@@ -1816,6 +1816,32 @@ const getNumberWithCommas = x => {
1816
1816
  return param;
1817
1817
  };
1818
1818
 
1819
+ // Function to calculate tooltip height based on text length
1820
+ const calculateTooltipOffset = function (text) {
1821
+ let isRegularCell = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1822
+ if (!text) return {
1823
+ offset: 60,
1824
+ height: 50
1825
+ };
1826
+ const tooltipWidth = 200;
1827
+ const avgCharWidth = 7; // Approximate character width in pixels
1828
+ const charsPerLine = Math.floor(tooltipWidth / avgCharWidth);
1829
+ const estimatedLines = Math.ceil(text.length / charsPerLine);
1830
+
1831
+ // Calculate tooltip height
1832
+ const lineHeight = 25; // Approximate line height
1833
+ const padding = 20; // Top + bottom padding
1834
+ const tooltipHeight = estimatedLines * lineHeight + padding;
1835
+
1836
+ // Base offset - smaller for regular cells
1837
+ const baseOffset = isRegularCell ? 40 : 60;
1838
+ const extraOffset = Math.max(0, (estimatedLines - 1) * lineHeight);
1839
+ return {
1840
+ offset: baseOffset + extraOffset,
1841
+ height: tooltipHeight
1842
+ };
1843
+ };
1844
+
1819
1845
  const NoDataFoundIcon = ({
1820
1846
  width = '66',
1821
1847
  height = '66'
@@ -34620,16 +34646,15 @@ css`
34620
34646
  * • onApply(start,end) – callback, both numbers (inclusive)
34621
34647
  * • onCancel() – callback
34622
34648
  */
34623
- const WeeksCalendar = _ref => {
34624
- let {
34625
- year,
34626
- defaultStartWeek = null,
34627
- defaultEndWeek = null,
34628
- backgroundColor = "#066768",
34629
- hoverBackgroundColor = "#E6F0F0",
34630
- onApply,
34631
- onCancel
34632
- } = _ref;
34649
+ const WeeksCalendar = ({
34650
+ year,
34651
+ defaultStartWeek = null,
34652
+ defaultEndWeek = null,
34653
+ backgroundColor = "#066768",
34654
+ hoverBackgroundColor = "#E6F0F0",
34655
+ onApply,
34656
+ onCancel
34657
+ }) => {
34633
34658
  // state -------------------------------------------------
34634
34659
  const [startWeek, setStartWeek] = useState(defaultStartWeek);
34635
34660
  const [endWeek, setEndWeek] = useState(defaultEndWeek);
@@ -37993,7 +38018,7 @@ const TableHeader = ({
37993
38018
  // TableBody.styles.js
37994
38019
 
37995
38020
  // Shared tooltip styles
37996
- const tooltipStyles = css`
38021
+ const tooltipStyles$1 = css`
37997
38022
  /* CSS-only tooltip */
37998
38023
  &[data-tooltip]:hover::before {
37999
38024
  content: attr(data-tooltip);
@@ -38265,7 +38290,7 @@ const ButtonWrapper = styled.div`
38265
38290
  display: inline-block;
38266
38291
  position: relative;
38267
38292
 
38268
- ${tooltipStyles}
38293
+ ${tooltipStyles$1}
38269
38294
  `;
38270
38295
  const SentStatus = styled.div`
38271
38296
  display: flex;
@@ -38276,9 +38301,9 @@ const SentStatus = styled.div`
38276
38301
  user-select: none;
38277
38302
  position: relative;
38278
38303
 
38279
- ${tooltipStyles}
38304
+ ${tooltipStyles$1}
38280
38305
  `;
38281
- const TrashIconWrapper = styled.div`
38306
+ const TrashIconWrapper$1 = styled.div`
38282
38307
  cursor: pointer;
38283
38308
  transition: color 0.2s ease;
38284
38309
  display: inline-flex;
@@ -38288,7 +38313,7 @@ const TrashIconWrapper = styled.div`
38288
38313
  height: 100%;
38289
38314
  position: relative;
38290
38315
 
38291
- ${tooltipStyles}
38316
+ ${tooltipStyles$1}
38292
38317
 
38293
38318
  /* Override tooltip position to move left */
38294
38319
  &[data-tooltip]:hover::before {
@@ -38315,7 +38340,7 @@ const CommentIconWrapper = styled.div`
38315
38340
  height: 100%;
38316
38341
  position: relative;
38317
38342
 
38318
- ${tooltipStyles}
38343
+ ${tooltipStyles$1}
38319
38344
 
38320
38345
  /* Override tooltip position to move left */
38321
38346
  &[data-tooltip]:hover::before {
@@ -38326,7 +38351,7 @@ const CommentIconWrapper = styled.div`
38326
38351
  left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
38327
38352
  }
38328
38353
  `;
38329
- const DisabledTrashIconWrapper = styled.div`
38354
+ const DisabledTrashIconWrapper$1 = styled.div`
38330
38355
  display: inline-flex;
38331
38356
  align-items: center;
38332
38357
  justify-content: center;
@@ -38334,7 +38359,7 @@ const DisabledTrashIconWrapper = styled.div`
38334
38359
  height: 100%;
38335
38360
  position: relative;
38336
38361
 
38337
- ${tooltipStyles}
38362
+ ${tooltipStyles$1}
38338
38363
 
38339
38364
  /* Override tooltip position to move left */
38340
38365
  &[data-tooltip]:hover::before {
@@ -38846,31 +38871,6 @@ const TableBody = ({
38846
38871
  // Determine if save button should be enabled
38847
38872
  const isSaveEnabled = hasUserInteracted && (commentText.length > 0 || hasInitialValue);
38848
38873
 
38849
- // Function to calculate tooltip height based on text length
38850
- const calculateTooltipOffset = (text, isRegularCell = false) => {
38851
- if (!text) return {
38852
- offset: 60,
38853
- height: 50
38854
- };
38855
- const tooltipWidth = 200;
38856
- const avgCharWidth = 7; // Approximate character width in pixels
38857
- const charsPerLine = Math.floor(tooltipWidth / avgCharWidth);
38858
- const estimatedLines = Math.ceil(text.length / charsPerLine);
38859
-
38860
- // Calculate tooltip height
38861
- const lineHeight = 25; // Approximate line height
38862
- const padding = 20; // Top + bottom padding
38863
- const tooltipHeight = estimatedLines * lineHeight + padding;
38864
-
38865
- // Base offset - smaller for regular cells
38866
- const baseOffset = isRegularCell ? 40 : 60;
38867
- const extraOffset = Math.max(0, (estimatedLines - 1) * lineHeight);
38868
- return {
38869
- offset: baseOffset + extraOffset,
38870
- height: tooltipHeight
38871
- };
38872
- };
38873
-
38874
38874
  // Helper function to format tag text
38875
38875
  const formatTagText = tag => {
38876
38876
  if (typeof tag !== 'string') return tag;
@@ -39090,7 +39090,7 @@ const TableBody = ({
39090
39090
  }
39091
39091
  const trashTooltipText = getTooltipText(value);
39092
39092
  if (value === 'ENABLED') {
39093
- return /*#__PURE__*/React$1.createElement(TrashIconWrapper, {
39093
+ return /*#__PURE__*/React$1.createElement(TrashIconWrapper$1, {
39094
39094
  $buttonColor: buttonColor,
39095
39095
  ref: el => {
39096
39096
  if (el && trashTooltipText) {
@@ -39116,7 +39116,7 @@ const TableBody = ({
39116
39116
  height: "18"
39117
39117
  }));
39118
39118
  } else if (value === 'DISABLED') {
39119
- return /*#__PURE__*/React$1.createElement(DisabledTrashIconWrapper, {
39119
+ return /*#__PURE__*/React$1.createElement(DisabledTrashIconWrapper$1, {
39120
39120
  ref: el => {
39121
39121
  if (el && trashTooltipText) {
39122
39122
  const rect = el.getBoundingClientRect();
@@ -42577,7 +42577,7 @@ const Table = props => {
42577
42577
  // Add displayName for better debugging
42578
42578
  Table.displayName = 'Table';
42579
42579
 
42580
- const Card = styled.div`
42580
+ const Card = styled$1.div`
42581
42581
  background: ${props => props.backgroundColor};
42582
42582
  border-radius: 8px;
42583
42583
  /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); */
@@ -42592,44 +42592,44 @@ const Card = styled.div`
42592
42592
  cursor: not-allowed;
42593
42593
  }
42594
42594
  `;
42595
- const TitleContainer = styled.div`
42595
+ const TitleContainer = styled$1.div`
42596
42596
  display: flex;
42597
42597
  flex-direction: column;
42598
42598
  align-items: flex-start;
42599
42599
  `;
42600
- const SectionTitle$1 = styled.div`
42600
+ const SectionTitle$1 = styled$1.div`
42601
42601
  color: #212121;
42602
42602
  font-size: 18px;
42603
42603
  font-weight: 700;
42604
42604
  `;
42605
- const SubtitleContainer = styled.div`
42605
+ const SubtitleContainer = styled$1.div`
42606
42606
  display: flex;
42607
42607
  align-items: center;
42608
42608
  gap: 6px;
42609
42609
  color: #8B8989;
42610
42610
  `;
42611
- const Subtitle$1 = styled.span`
42611
+ const Subtitle$1 = styled$1.span`
42612
42612
  color: ${props => props.color};
42613
42613
  font-size: 14px;
42614
42614
  font-weight: 400;
42615
42615
  `;
42616
- const AddButtonContainer$1 = styled.div`
42616
+ const AddButtonContainer$1 = styled$1.div`
42617
42617
  display: flex;
42618
42618
  align-items: flex-start;
42619
42619
  `;
42620
42620
 
42621
42621
  // Vendor selection screen styles
42622
- styled(Card)`
42622
+ styled$1(Card)`
42623
42623
  display: flex;
42624
42624
  flex-direction: column;
42625
42625
  background: #faf9fb;
42626
42626
  padding: 0;
42627
42627
  overflow: hidden;
42628
42628
  `;
42629
- const VendorHeader$2 = styled.div`
42629
+ const VendorHeader$2 = styled$1.div`
42630
42630
  padding: 16px 24px;
42631
42631
  `;
42632
- styled.button`
42632
+ styled$1.button`
42633
42633
  border: none;
42634
42634
  background: none;
42635
42635
  font-size: 22px;
@@ -42638,7 +42638,7 @@ styled.button`
42638
42638
  padding: 0 8px 0 0;
42639
42639
  margin-right: 4px;
42640
42640
  `;
42641
- styled.input`
42641
+ styled$1.input`
42642
42642
  margin: 16px;
42643
42643
  margin-bottom: 8px;
42644
42644
  padding: 10px 14px;
@@ -42647,16 +42647,16 @@ styled.input`
42647
42647
  font-size: 15px;
42648
42648
  outline: none;
42649
42649
  `;
42650
- const VendorListWrapper$2 = styled.div`
42650
+ const VendorListWrapper$2 = styled$1.div`
42651
42651
  height: calc(100% - ${props => props.headerHeight}px);
42652
42652
  background: ${props => props.disabled ? '#f2f2f2' : '#fff'};
42653
42653
  width: 100%;
42654
42654
  overflow: auto;
42655
42655
  border-radius: 0 0 8px 8px;
42656
42656
  `;
42657
- const VendorList$2 = styled.div`
42657
+ const VendorList$2 = styled$1.div`
42658
42658
  `;
42659
- const VendorItem$1 = styled.div`
42659
+ const VendorItem$1 = styled$1.div`
42660
42660
  display: flex;
42661
42661
  align-items: center;
42662
42662
  justify-content: space-between;
@@ -42667,50 +42667,53 @@ const VendorItem$1 = styled.div`
42667
42667
  &:hover {
42668
42668
  background: #f7f7fa;
42669
42669
  .trash-icon svg path {
42670
- fill: #B1B1B1;
42671
- }
42670
+ fill: #B1B1B1;
42671
+ }
42672
+ .trash-icon-disabled svg path {
42673
+ fill: #D9D9D9;
42674
+ }
42672
42675
  }
42673
42676
  `;
42674
- const VendorName$2 = styled.div`
42677
+ const VendorName$2 = styled$1.div`
42675
42678
  color: #212121;
42676
42679
  font-size: 16px;
42677
42680
  font-weight: 500;
42678
42681
  `;
42679
- styled.div`
42682
+ styled$1.div`
42680
42683
  color: #b0b0b0;
42681
42684
  font-size: 13px;
42682
42685
  margin-top: 2px;
42683
42686
  `;
42684
- const VendorChevron$1 = styled.div`
42687
+ const VendorChevron$1 = styled$1.div`
42685
42688
  align-items: center;
42686
42689
  display: flex;
42687
42690
  `;
42688
- const VendorNameAndPackagesContainer$1 = styled.div`
42691
+ const VendorNameAndPackagesContainer$1 = styled$1.div`
42689
42692
  display: flex;
42690
42693
  margin-left: 12px;
42691
42694
  flex-direction: column;
42692
42695
  align-items: flex-start;
42693
42696
  `;
42694
- const DotContainer = styled.div`
42697
+ const DotContainer = styled$1.div`
42695
42698
  text-align: center;
42696
42699
  margin-top: 10px;
42697
42700
  width: 40px;
42698
42701
  height: 100%;
42699
42702
  `;
42700
- const LineContainer = styled.div`
42703
+ const LineContainer = styled$1.div`
42701
42704
  display: flex;
42702
42705
  justify-content: space-between;
42703
42706
  align-items: center;
42704
42707
  width: 100%;
42705
42708
  `;
42706
- const ButtonContainer = styled.div`
42709
+ const ButtonContainer = styled$1.div`
42707
42710
  .ButtonContainer {
42708
42711
  label {
42709
42712
  white-space: nowrap;
42710
42713
  }
42711
42714
  }
42712
42715
  `;
42713
- const CustomTooltip = styled(Tooltip$2)`
42716
+ const CustomTooltip = styled$1(Tooltip$2)`
42714
42717
  .controls {
42715
42718
  padding: 12px 16px;
42716
42719
  font-size: 14px;
@@ -42718,20 +42721,74 @@ const CustomTooltip = styled(Tooltip$2)`
42718
42721
  &::before {
42719
42722
  left: 90%;
42720
42723
  }
42721
- ${props => props.trashIcon && `width: 150px;
42722
- white-space: normal;
42723
- max-height: 50px;
42724
- margin-top: 8px;`}
42725
42724
  }
42726
42725
  `;
42727
- const Container$1 = styled.div`
42726
+ const Container$1 = styled$1.div`
42728
42727
  display: flex;
42729
42728
  align-items: center;
42730
42729
  justify-content: space-between;
42731
42730
  padding: 38px 0 20px;
42732
42731
  box-sizing: border-box;
42733
42732
  `;
42734
- const Trash$1 = styled.div`
42733
+ const tooltipStyles = css`
42734
+ /* CSS-only tooltip */
42735
+ &[data-tooltip]:hover::before {
42736
+ content: attr(data-tooltip);
42737
+ position: fixed;
42738
+ background-color: white;
42739
+ color: #333;
42740
+ padding: 10px 16px;
42741
+ border-radius: 4px;
42742
+ font-family: "Poppins", sans-serif;
42743
+ font-size: 14px;
42744
+ font-weight: 400;
42745
+ z-index: 1000;
42746
+ pointer-events: none;
42747
+ width: 200px;
42748
+ white-space: pre-wrap;
42749
+ word-wrap: break-word;
42750
+ line-height: 1.8;
42751
+ box-shadow:
42752
+ 0 -2px 8px rgba(0, 0, 0, 0.15),
42753
+ 0 2px 8px rgba(0, 0, 0, 0.15);
42754
+
42755
+ /* Position above the element - using dynamic offset */
42756
+ top: calc(var(--tooltip-top, 0px) - var(--tooltip-offset, 60px));
42757
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2);
42758
+ transform: translateX(-50%);
42759
+
42760
+ /* Add delay */
42761
+ opacity: 0;
42762
+ animation: showTooltip 0.3s ease-in-out 0.5s forwards;
42763
+ }
42764
+
42765
+ /* Tooltip arrow */
42766
+ &[data-tooltip]:hover::after {
42767
+ content: "";
42768
+ position: fixed;
42769
+ top: calc(
42770
+ var(--tooltip-top, 0px) - var(--tooltip-offset, 60px) +
42771
+ var(--tooltip-height, 50px)
42772
+ ); /* Use estimated tooltip height */
42773
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2);
42774
+ transform: translateX(-50%);
42775
+ border: 8px solid transparent;
42776
+ border-top-color: white;
42777
+ z-index: 1001;
42778
+ pointer-events: none;
42779
+
42780
+ /* Add delay */
42781
+ opacity: 0;
42782
+ animation: showTooltip 0.3s ease-in-out 0.5s forwards;
42783
+ }
42784
+
42785
+ @keyframes showTooltip {
42786
+ to {
42787
+ opacity: 1;
42788
+ }
42789
+ }
42790
+ `;
42791
+ const baseIconWrapperStyles = css`
42735
42792
  display: flex;
42736
42793
  align-items: center;
42737
42794
  justify-content: center;
@@ -42739,9 +42796,6 @@ const Trash$1 = styled.div`
42739
42796
  height: 24px;
42740
42797
  padding: 0 12px;
42741
42798
  cursor: pointer;
42742
- ${props => props.disabled && `opacity: 0.5;
42743
- pointer-events: none;
42744
- user-select: none;`};
42745
42799
  svg {
42746
42800
  pointer-events: none;
42747
42801
  }
@@ -42749,6 +42803,23 @@ const Trash$1 = styled.div`
42749
42803
  svg path {
42750
42804
  fill: white;
42751
42805
  }
42806
+ `;
42807
+ const DisabledTrashIconWrapper = styled$1.div`
42808
+ ${baseIconWrapperStyles}
42809
+ ${tooltipStyles}
42810
+
42811
+ /* Tooltip customization */
42812
+ &[data-tooltip]:hover::before {
42813
+ text-align: left;
42814
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
42815
+ }
42816
+
42817
+ &[data-tooltip]:hover::after {
42818
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
42819
+ }
42820
+ `;
42821
+ const TrashIconWrapper = styled$1.div`
42822
+ ${baseIconWrapperStyles}
42752
42823
 
42753
42824
  &:hover {
42754
42825
  svg path {
@@ -52079,6 +52150,21 @@ const ItemManagerPanel = _ref => {
52079
52150
  setSelectedVendor(modifiedVendor);
52080
52151
  setScreen("subitem");
52081
52152
  };
52153
+ const setupTooltip = (el, tooltipText) => {
52154
+ if (el && tooltipText) {
52155
+ const rect = el.getBoundingClientRect();
52156
+ const {
52157
+ offset,
52158
+ height
52159
+ } = calculateTooltipOffset(tooltipText);
52160
+ el.style.setProperty('--tooltip-top', `${rect.top}px`);
52161
+ el.style.setProperty('--tooltip-left', `${rect.left}px`);
52162
+ el.style.setProperty('--tooltip-width', `${rect.width}px`);
52163
+ el.style.setProperty('--tooltip-offset', `${offset}px`);
52164
+ el.style.setProperty('--tooltip-height', `${height}px`);
52165
+ el.setAttribute('data-tooltip', tooltipText);
52166
+ }
52167
+ };
52082
52168
  const addNewPackage = (vendorName, packageName, component) => {
52083
52169
  setItemAndPackage(prev => {
52084
52170
  const vendorIndex = prev.findIndex(item => item.name === vendorName);
@@ -52302,27 +52388,22 @@ const ItemManagerPanel = _ref => {
52302
52388
  } else {
52303
52389
  return `${sentPackagesLength}/${packagesLength} sent`;
52304
52390
  }
52305
- })())), /*#__PURE__*/React$1.createElement(VendorChevron$1, null, /*#__PURE__*/React$1.createElement(ArrowRightFullIcon, null))), /*#__PURE__*/React$1.createElement(CustomTooltip, {
52306
- hideTooltip: !sentPackagesLength > 0,
52307
- content: trashTooltipText,
52308
- topFactor: 2,
52309
- direction: "left",
52310
- trashIcon: true
52311
- }, /*#__PURE__*/React$1.createElement(Trash$1, {
52312
- disabled: sentPackagesLength > 0,
52391
+ })())), /*#__PURE__*/React$1.createElement(VendorChevron$1, null, /*#__PURE__*/React$1.createElement(ArrowRightFullIcon, null))), sentPackagesLength > 0 ? /*#__PURE__*/React$1.createElement(DisabledTrashIconWrapper, {
52392
+ className: "trash-icon-disabled",
52393
+ ref: el => setupTooltip(el, trashTooltipText)
52394
+ }, /*#__PURE__*/React$1.createElement(DisabledTrashIcon, {
52395
+ width: "22",
52396
+ height: "22"
52397
+ })) : /*#__PURE__*/React$1.createElement(TrashIconWrapper, {
52313
52398
  className: "trash-icon",
52314
- onClick: () => {
52399
+ onClick: e => {
52400
+ e.stopPropagation();
52315
52401
  onDeleteVendor(item);
52316
52402
  }
52317
- }, /*#__PURE__*/React$1.createElement("svg", {
52403
+ }, /*#__PURE__*/React$1.createElement(TrashIcon, {
52318
52404
  width: "14",
52319
- height: "18",
52320
- viewBox: "0 0 14 18",
52321
- fill: "none",
52322
- xmlns: "http://www.w3.org/2000/svg"
52323
- }, /*#__PURE__*/React$1.createElement("path", {
52324
- d: "M1 16C1 17.1 1.9 18 3 18H11C12.1 18 13 17.1 13 16V4H1V16ZM14 1H10.5L9.5 0H4.5L3.5 1H0V3H14V1Z"
52325
- })))));
52405
+ height: "18"
52406
+ })));
52326
52407
  }))));
52327
52408
  }
52328
52409
  };