sag_components 2.0.0-beta156 → 2.0.0-beta158

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'
@@ -3592,6 +3618,7 @@ const TextFieldInput = styled.input`
3592
3618
 
3593
3619
  const SearchInput = props => {
3594
3620
  const {
3621
+ value,
3595
3622
  placeholder = 'Search',
3596
3623
  width = '100%',
3597
3624
  height = '40px',
@@ -3613,6 +3640,7 @@ const SearchInput = props => {
3613
3640
  })), /*#__PURE__*/React$1.createElement(TextFieldInput, {
3614
3641
  type: "search",
3615
3642
  id: "search-input",
3643
+ value: value,
3616
3644
  height: height,
3617
3645
  placeholder: placeholder,
3618
3646
  onChange: handleInputChange,
@@ -34620,16 +34648,15 @@ css`
34620
34648
  * • onApply(start,end) – callback, both numbers (inclusive)
34621
34649
  * • onCancel() – callback
34622
34650
  */
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;
34651
+ const WeeksCalendar = ({
34652
+ year,
34653
+ defaultStartWeek = null,
34654
+ defaultEndWeek = null,
34655
+ backgroundColor = "#066768",
34656
+ hoverBackgroundColor = "#E6F0F0",
34657
+ onApply,
34658
+ onCancel
34659
+ }) => {
34633
34660
  // state -------------------------------------------------
34634
34661
  const [startWeek, setStartWeek] = useState(defaultStartWeek);
34635
34662
  const [endWeek, setEndWeek] = useState(defaultEndWeek);
@@ -37993,7 +38020,7 @@ const TableHeader = ({
37993
38020
  // TableBody.styles.js
37994
38021
 
37995
38022
  // Shared tooltip styles
37996
- const tooltipStyles = css`
38023
+ const tooltipStyles$1 = css`
37997
38024
  /* CSS-only tooltip */
37998
38025
  &[data-tooltip]:hover::before {
37999
38026
  content: attr(data-tooltip);
@@ -38265,7 +38292,7 @@ const ButtonWrapper = styled.div`
38265
38292
  display: inline-block;
38266
38293
  position: relative;
38267
38294
 
38268
- ${tooltipStyles}
38295
+ ${tooltipStyles$1}
38269
38296
  `;
38270
38297
  const SentStatus = styled.div`
38271
38298
  display: flex;
@@ -38276,9 +38303,9 @@ const SentStatus = styled.div`
38276
38303
  user-select: none;
38277
38304
  position: relative;
38278
38305
 
38279
- ${tooltipStyles}
38306
+ ${tooltipStyles$1}
38280
38307
  `;
38281
- const TrashIconWrapper = styled.div`
38308
+ const TrashIconWrapper$1 = styled.div`
38282
38309
  cursor: pointer;
38283
38310
  transition: color 0.2s ease;
38284
38311
  display: inline-flex;
@@ -38288,7 +38315,7 @@ const TrashIconWrapper = styled.div`
38288
38315
  height: 100%;
38289
38316
  position: relative;
38290
38317
 
38291
- ${tooltipStyles}
38318
+ ${tooltipStyles$1}
38292
38319
 
38293
38320
  /* Override tooltip position to move left */
38294
38321
  &[data-tooltip]:hover::before {
@@ -38315,7 +38342,7 @@ const CommentIconWrapper = styled.div`
38315
38342
  height: 100%;
38316
38343
  position: relative;
38317
38344
 
38318
- ${tooltipStyles}
38345
+ ${tooltipStyles$1}
38319
38346
 
38320
38347
  /* Override tooltip position to move left */
38321
38348
  &[data-tooltip]:hover::before {
@@ -38326,7 +38353,7 @@ const CommentIconWrapper = styled.div`
38326
38353
  left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
38327
38354
  }
38328
38355
  `;
38329
- const DisabledTrashIconWrapper = styled.div`
38356
+ const DisabledTrashIconWrapper$1 = styled.div`
38330
38357
  display: inline-flex;
38331
38358
  align-items: center;
38332
38359
  justify-content: center;
@@ -38334,7 +38361,7 @@ const DisabledTrashIconWrapper = styled.div`
38334
38361
  height: 100%;
38335
38362
  position: relative;
38336
38363
 
38337
- ${tooltipStyles}
38364
+ ${tooltipStyles$1}
38338
38365
 
38339
38366
  /* Override tooltip position to move left */
38340
38367
  &[data-tooltip]:hover::before {
@@ -38846,31 +38873,6 @@ const TableBody = ({
38846
38873
  // Determine if save button should be enabled
38847
38874
  const isSaveEnabled = hasUserInteracted && (commentText.length > 0 || hasInitialValue);
38848
38875
 
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
38876
  // Helper function to format tag text
38875
38877
  const formatTagText = tag => {
38876
38878
  if (typeof tag !== 'string') return tag;
@@ -39090,7 +39092,7 @@ const TableBody = ({
39090
39092
  }
39091
39093
  const trashTooltipText = getTooltipText(value);
39092
39094
  if (value === 'ENABLED') {
39093
- return /*#__PURE__*/React$1.createElement(TrashIconWrapper, {
39095
+ return /*#__PURE__*/React$1.createElement(TrashIconWrapper$1, {
39094
39096
  $buttonColor: buttonColor,
39095
39097
  ref: el => {
39096
39098
  if (el && trashTooltipText) {
@@ -39116,7 +39118,7 @@ const TableBody = ({
39116
39118
  height: "18"
39117
39119
  }));
39118
39120
  } else if (value === 'DISABLED') {
39119
- return /*#__PURE__*/React$1.createElement(DisabledTrashIconWrapper, {
39121
+ return /*#__PURE__*/React$1.createElement(DisabledTrashIconWrapper$1, {
39120
39122
  ref: el => {
39121
39123
  if (el && trashTooltipText) {
39122
39124
  const rect = el.getBoundingClientRect();
@@ -42577,7 +42579,7 @@ const Table = props => {
42577
42579
  // Add displayName for better debugging
42578
42580
  Table.displayName = 'Table';
42579
42581
 
42580
- const Card = styled.div`
42582
+ const Card = styled$1.div`
42581
42583
  background: ${props => props.backgroundColor};
42582
42584
  border-radius: 8px;
42583
42585
  /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); */
@@ -42592,44 +42594,44 @@ const Card = styled.div`
42592
42594
  cursor: not-allowed;
42593
42595
  }
42594
42596
  `;
42595
- const TitleContainer = styled.div`
42597
+ const TitleContainer = styled$1.div`
42596
42598
  display: flex;
42597
42599
  flex-direction: column;
42598
42600
  align-items: flex-start;
42599
42601
  `;
42600
- const SectionTitle$1 = styled.div`
42602
+ const SectionTitle$1 = styled$1.div`
42601
42603
  color: #212121;
42602
42604
  font-size: 18px;
42603
42605
  font-weight: 700;
42604
42606
  `;
42605
- const SubtitleContainer = styled.div`
42607
+ const SubtitleContainer = styled$1.div`
42606
42608
  display: flex;
42607
42609
  align-items: center;
42608
42610
  gap: 6px;
42609
42611
  color: #8B8989;
42610
42612
  `;
42611
- const Subtitle$1 = styled.span`
42613
+ const Subtitle$1 = styled$1.span`
42612
42614
  color: ${props => props.color};
42613
42615
  font-size: 14px;
42614
42616
  font-weight: 400;
42615
42617
  `;
42616
- const AddButtonContainer$1 = styled.div`
42618
+ const AddButtonContainer$1 = styled$1.div`
42617
42619
  display: flex;
42618
42620
  align-items: flex-start;
42619
42621
  `;
42620
42622
 
42621
42623
  // Vendor selection screen styles
42622
- styled(Card)`
42624
+ styled$1(Card)`
42623
42625
  display: flex;
42624
42626
  flex-direction: column;
42625
42627
  background: #faf9fb;
42626
42628
  padding: 0;
42627
42629
  overflow: hidden;
42628
42630
  `;
42629
- const VendorHeader$2 = styled.div`
42631
+ const VendorHeader$2 = styled$1.div`
42630
42632
  padding: 16px 24px;
42631
42633
  `;
42632
- styled.button`
42634
+ styled$1.button`
42633
42635
  border: none;
42634
42636
  background: none;
42635
42637
  font-size: 22px;
@@ -42638,7 +42640,7 @@ styled.button`
42638
42640
  padding: 0 8px 0 0;
42639
42641
  margin-right: 4px;
42640
42642
  `;
42641
- styled.input`
42643
+ styled$1.input`
42642
42644
  margin: 16px;
42643
42645
  margin-bottom: 8px;
42644
42646
  padding: 10px 14px;
@@ -42647,16 +42649,16 @@ styled.input`
42647
42649
  font-size: 15px;
42648
42650
  outline: none;
42649
42651
  `;
42650
- const VendorListWrapper$2 = styled.div`
42652
+ const VendorListWrapper$2 = styled$1.div`
42651
42653
  height: calc(100% - ${props => props.headerHeight}px);
42652
42654
  background: ${props => props.disabled ? '#f2f2f2' : '#fff'};
42653
42655
  width: 100%;
42654
42656
  overflow: auto;
42655
42657
  border-radius: 0 0 8px 8px;
42656
42658
  `;
42657
- const VendorList$2 = styled.div`
42659
+ const VendorList$2 = styled$1.div`
42658
42660
  `;
42659
- const VendorItem$1 = styled.div`
42661
+ const VendorItem$1 = styled$1.div`
42660
42662
  display: flex;
42661
42663
  align-items: center;
42662
42664
  justify-content: space-between;
@@ -42667,50 +42669,53 @@ const VendorItem$1 = styled.div`
42667
42669
  &:hover {
42668
42670
  background: #f7f7fa;
42669
42671
  .trash-icon svg path {
42670
- fill: #B1B1B1;
42671
- }
42672
+ fill: #B1B1B1;
42673
+ }
42674
+ .trash-icon-disabled svg path {
42675
+ fill: #D9D9D9;
42676
+ }
42672
42677
  }
42673
42678
  `;
42674
- const VendorName$2 = styled.div`
42679
+ const VendorName$2 = styled$1.div`
42675
42680
  color: #212121;
42676
42681
  font-size: 16px;
42677
42682
  font-weight: 500;
42678
42683
  `;
42679
- styled.div`
42684
+ styled$1.div`
42680
42685
  color: #b0b0b0;
42681
42686
  font-size: 13px;
42682
42687
  margin-top: 2px;
42683
42688
  `;
42684
- const VendorChevron$1 = styled.div`
42689
+ const VendorChevron$1 = styled$1.div`
42685
42690
  align-items: center;
42686
42691
  display: flex;
42687
42692
  `;
42688
- const VendorNameAndPackagesContainer$1 = styled.div`
42693
+ const VendorNameAndPackagesContainer$1 = styled$1.div`
42689
42694
  display: flex;
42690
42695
  margin-left: 12px;
42691
42696
  flex-direction: column;
42692
42697
  align-items: flex-start;
42693
42698
  `;
42694
- const DotContainer = styled.div`
42699
+ const DotContainer = styled$1.div`
42695
42700
  text-align: center;
42696
42701
  margin-top: 10px;
42697
42702
  width: 40px;
42698
42703
  height: 100%;
42699
42704
  `;
42700
- const LineContainer = styled.div`
42705
+ const LineContainer = styled$1.div`
42701
42706
  display: flex;
42702
42707
  justify-content: space-between;
42703
42708
  align-items: center;
42704
42709
  width: 100%;
42705
42710
  `;
42706
- const ButtonContainer = styled.div`
42711
+ const ButtonContainer = styled$1.div`
42707
42712
  .ButtonContainer {
42708
42713
  label {
42709
42714
  white-space: nowrap;
42710
42715
  }
42711
42716
  }
42712
42717
  `;
42713
- const CustomTooltip = styled(Tooltip$2)`
42718
+ const CustomTooltip = styled$1(Tooltip$2)`
42714
42719
  .controls {
42715
42720
  padding: 12px 16px;
42716
42721
  font-size: 14px;
@@ -42718,20 +42723,74 @@ const CustomTooltip = styled(Tooltip$2)`
42718
42723
  &::before {
42719
42724
  left: 90%;
42720
42725
  }
42721
- ${props => props.trashIcon && `width: 150px;
42722
- white-space: normal;
42723
- max-height: 50px;
42724
- margin-top: 8px;`}
42725
42726
  }
42726
42727
  `;
42727
- const Container$1 = styled.div`
42728
+ const Container$1 = styled$1.div`
42728
42729
  display: flex;
42729
42730
  align-items: center;
42730
42731
  justify-content: space-between;
42731
42732
  padding: 38px 0 20px;
42732
42733
  box-sizing: border-box;
42733
42734
  `;
42734
- const Trash$1 = styled.div`
42735
+ const tooltipStyles = css`
42736
+ /* CSS-only tooltip */
42737
+ &[data-tooltip]:hover::before {
42738
+ content: attr(data-tooltip);
42739
+ position: fixed;
42740
+ background-color: white;
42741
+ color: #333;
42742
+ padding: 10px 16px;
42743
+ border-radius: 4px;
42744
+ font-family: "Poppins", sans-serif;
42745
+ font-size: 14px;
42746
+ font-weight: 400;
42747
+ z-index: 1000;
42748
+ pointer-events: none;
42749
+ width: 200px;
42750
+ white-space: pre-wrap;
42751
+ word-wrap: break-word;
42752
+ line-height: 1.8;
42753
+ box-shadow:
42754
+ 0 -2px 8px rgba(0, 0, 0, 0.15),
42755
+ 0 2px 8px rgba(0, 0, 0, 0.15);
42756
+
42757
+ /* Position above the element - using dynamic offset */
42758
+ top: calc(var(--tooltip-top, 0px) - var(--tooltip-offset, 60px));
42759
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2);
42760
+ transform: translateX(-50%);
42761
+
42762
+ /* Add delay */
42763
+ opacity: 0;
42764
+ animation: showTooltip 0.3s ease-in-out 0.5s forwards;
42765
+ }
42766
+
42767
+ /* Tooltip arrow */
42768
+ &[data-tooltip]:hover::after {
42769
+ content: "";
42770
+ position: fixed;
42771
+ top: calc(
42772
+ var(--tooltip-top, 0px) - var(--tooltip-offset, 60px) +
42773
+ var(--tooltip-height, 50px)
42774
+ ); /* Use estimated tooltip height */
42775
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2);
42776
+ transform: translateX(-50%);
42777
+ border: 8px solid transparent;
42778
+ border-top-color: white;
42779
+ z-index: 1001;
42780
+ pointer-events: none;
42781
+
42782
+ /* Add delay */
42783
+ opacity: 0;
42784
+ animation: showTooltip 0.3s ease-in-out 0.5s forwards;
42785
+ }
42786
+
42787
+ @keyframes showTooltip {
42788
+ to {
42789
+ opacity: 1;
42790
+ }
42791
+ }
42792
+ `;
42793
+ const baseIconWrapperStyles = css`
42735
42794
  display: flex;
42736
42795
  align-items: center;
42737
42796
  justify-content: center;
@@ -42739,9 +42798,6 @@ const Trash$1 = styled.div`
42739
42798
  height: 24px;
42740
42799
  padding: 0 12px;
42741
42800
  cursor: pointer;
42742
- ${props => props.disabled && `opacity: 0.5;
42743
- pointer-events: none;
42744
- user-select: none;`};
42745
42801
  svg {
42746
42802
  pointer-events: none;
42747
42803
  }
@@ -42749,6 +42805,23 @@ const Trash$1 = styled.div`
42749
42805
  svg path {
42750
42806
  fill: white;
42751
42807
  }
42808
+ `;
42809
+ const DisabledTrashIconWrapper = styled$1.div`
42810
+ ${baseIconWrapperStyles}
42811
+ ${tooltipStyles}
42812
+
42813
+ /* Tooltip customization */
42814
+ &[data-tooltip]:hover::before {
42815
+ text-align: left;
42816
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
42817
+ }
42818
+
42819
+ &[data-tooltip]:hover::after {
42820
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
42821
+ }
42822
+ `;
42823
+ const TrashIconWrapper = styled$1.div`
42824
+ ${baseIconWrapperStyles}
42752
42825
 
42753
42826
  &:hover {
42754
42827
  svg path {
@@ -52079,6 +52152,21 @@ const ItemManagerPanel = _ref => {
52079
52152
  setSelectedVendor(modifiedVendor);
52080
52153
  setScreen("subitem");
52081
52154
  };
52155
+ const setupTooltip = (el, tooltipText) => {
52156
+ if (el && tooltipText) {
52157
+ const rect = el.getBoundingClientRect();
52158
+ const {
52159
+ offset,
52160
+ height
52161
+ } = calculateTooltipOffset(tooltipText);
52162
+ el.style.setProperty('--tooltip-top', `${rect.top}px`);
52163
+ el.style.setProperty('--tooltip-left', `${rect.left}px`);
52164
+ el.style.setProperty('--tooltip-width', `${rect.width}px`);
52165
+ el.style.setProperty('--tooltip-offset', `${offset}px`);
52166
+ el.style.setProperty('--tooltip-height', `${height}px`);
52167
+ el.setAttribute('data-tooltip', tooltipText);
52168
+ }
52169
+ };
52082
52170
  const addNewPackage = (vendorName, packageName, component) => {
52083
52171
  setItemAndPackage(prev => {
52084
52172
  const vendorIndex = prev.findIndex(item => item.name === vendorName);
@@ -52302,27 +52390,22 @@ const ItemManagerPanel = _ref => {
52302
52390
  } else {
52303
52391
  return `${sentPackagesLength}/${packagesLength} sent`;
52304
52392
  }
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,
52393
+ })())), /*#__PURE__*/React$1.createElement(VendorChevron$1, null, /*#__PURE__*/React$1.createElement(ArrowRightFullIcon, null))), sentPackagesLength > 0 ? /*#__PURE__*/React$1.createElement(DisabledTrashIconWrapper, {
52394
+ className: "trash-icon-disabled",
52395
+ ref: el => setupTooltip(el, trashTooltipText)
52396
+ }, /*#__PURE__*/React$1.createElement(DisabledTrashIcon, {
52397
+ width: "22",
52398
+ height: "22"
52399
+ })) : /*#__PURE__*/React$1.createElement(TrashIconWrapper, {
52313
52400
  className: "trash-icon",
52314
- onClick: () => {
52401
+ onClick: e => {
52402
+ e.stopPropagation();
52315
52403
  onDeleteVendor(item);
52316
52404
  }
52317
- }, /*#__PURE__*/React$1.createElement("svg", {
52405
+ }, /*#__PURE__*/React$1.createElement(TrashIcon, {
52318
52406
  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
- })))));
52407
+ height: "18"
52408
+ })));
52326
52409
  }))));
52327
52410
  }
52328
52411
  };