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.js CHANGED
@@ -1826,6 +1826,32 @@ const getNumberWithCommas = x => {
1826
1826
  return param;
1827
1827
  };
1828
1828
 
1829
+ // Function to calculate tooltip height based on text length
1830
+ const calculateTooltipOffset = function (text) {
1831
+ let isRegularCell = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1832
+ if (!text) return {
1833
+ offset: 60,
1834
+ height: 50
1835
+ };
1836
+ const tooltipWidth = 200;
1837
+ const avgCharWidth = 7; // Approximate character width in pixels
1838
+ const charsPerLine = Math.floor(tooltipWidth / avgCharWidth);
1839
+ const estimatedLines = Math.ceil(text.length / charsPerLine);
1840
+
1841
+ // Calculate tooltip height
1842
+ const lineHeight = 25; // Approximate line height
1843
+ const padding = 20; // Top + bottom padding
1844
+ const tooltipHeight = estimatedLines * lineHeight + padding;
1845
+
1846
+ // Base offset - smaller for regular cells
1847
+ const baseOffset = isRegularCell ? 40 : 60;
1848
+ const extraOffset = Math.max(0, (estimatedLines - 1) * lineHeight);
1849
+ return {
1850
+ offset: baseOffset + extraOffset,
1851
+ height: tooltipHeight
1852
+ };
1853
+ };
1854
+
1829
1855
  const NoDataFoundIcon = ({
1830
1856
  width = '66',
1831
1857
  height = '66'
@@ -34630,16 +34656,15 @@ styled.css`
34630
34656
  * • onApply(start,end) – callback, both numbers (inclusive)
34631
34657
  * • onCancel() – callback
34632
34658
  */
34633
- const WeeksCalendar = _ref => {
34634
- let {
34635
- year,
34636
- defaultStartWeek = null,
34637
- defaultEndWeek = null,
34638
- backgroundColor = "#066768",
34639
- hoverBackgroundColor = "#E6F0F0",
34640
- onApply,
34641
- onCancel
34642
- } = _ref;
34659
+ const WeeksCalendar = ({
34660
+ year,
34661
+ defaultStartWeek = null,
34662
+ defaultEndWeek = null,
34663
+ backgroundColor = "#066768",
34664
+ hoverBackgroundColor = "#E6F0F0",
34665
+ onApply,
34666
+ onCancel
34667
+ }) => {
34643
34668
  // state -------------------------------------------------
34644
34669
  const [startWeek, setStartWeek] = React$1.useState(defaultStartWeek);
34645
34670
  const [endWeek, setEndWeek] = React$1.useState(defaultEndWeek);
@@ -38003,7 +38028,7 @@ const TableHeader = ({
38003
38028
  // TableBody.styles.js
38004
38029
 
38005
38030
  // Shared tooltip styles
38006
- const tooltipStyles = styled.css`
38031
+ const tooltipStyles$1 = styled.css`
38007
38032
  /* CSS-only tooltip */
38008
38033
  &[data-tooltip]:hover::before {
38009
38034
  content: attr(data-tooltip);
@@ -38275,7 +38300,7 @@ const ButtonWrapper = styled__default["default"].div`
38275
38300
  display: inline-block;
38276
38301
  position: relative;
38277
38302
 
38278
- ${tooltipStyles}
38303
+ ${tooltipStyles$1}
38279
38304
  `;
38280
38305
  const SentStatus = styled__default["default"].div`
38281
38306
  display: flex;
@@ -38286,9 +38311,9 @@ const SentStatus = styled__default["default"].div`
38286
38311
  user-select: none;
38287
38312
  position: relative;
38288
38313
 
38289
- ${tooltipStyles}
38314
+ ${tooltipStyles$1}
38290
38315
  `;
38291
- const TrashIconWrapper = styled__default["default"].div`
38316
+ const TrashIconWrapper$1 = styled__default["default"].div`
38292
38317
  cursor: pointer;
38293
38318
  transition: color 0.2s ease;
38294
38319
  display: inline-flex;
@@ -38298,7 +38323,7 @@ const TrashIconWrapper = styled__default["default"].div`
38298
38323
  height: 100%;
38299
38324
  position: relative;
38300
38325
 
38301
- ${tooltipStyles}
38326
+ ${tooltipStyles$1}
38302
38327
 
38303
38328
  /* Override tooltip position to move left */
38304
38329
  &[data-tooltip]:hover::before {
@@ -38325,7 +38350,7 @@ const CommentIconWrapper = styled__default["default"].div`
38325
38350
  height: 100%;
38326
38351
  position: relative;
38327
38352
 
38328
- ${tooltipStyles}
38353
+ ${tooltipStyles$1}
38329
38354
 
38330
38355
  /* Override tooltip position to move left */
38331
38356
  &[data-tooltip]:hover::before {
@@ -38336,7 +38361,7 @@ const CommentIconWrapper = styled__default["default"].div`
38336
38361
  left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
38337
38362
  }
38338
38363
  `;
38339
- const DisabledTrashIconWrapper = styled__default["default"].div`
38364
+ const DisabledTrashIconWrapper$1 = styled__default["default"].div`
38340
38365
  display: inline-flex;
38341
38366
  align-items: center;
38342
38367
  justify-content: center;
@@ -38344,7 +38369,7 @@ const DisabledTrashIconWrapper = styled__default["default"].div`
38344
38369
  height: 100%;
38345
38370
  position: relative;
38346
38371
 
38347
- ${tooltipStyles}
38372
+ ${tooltipStyles$1}
38348
38373
 
38349
38374
  /* Override tooltip position to move left */
38350
38375
  &[data-tooltip]:hover::before {
@@ -38856,31 +38881,6 @@ const TableBody = ({
38856
38881
  // Determine if save button should be enabled
38857
38882
  const isSaveEnabled = hasUserInteracted && (commentText.length > 0 || hasInitialValue);
38858
38883
 
38859
- // Function to calculate tooltip height based on text length
38860
- const calculateTooltipOffset = (text, isRegularCell = false) => {
38861
- if (!text) return {
38862
- offset: 60,
38863
- height: 50
38864
- };
38865
- const tooltipWidth = 200;
38866
- const avgCharWidth = 7; // Approximate character width in pixels
38867
- const charsPerLine = Math.floor(tooltipWidth / avgCharWidth);
38868
- const estimatedLines = Math.ceil(text.length / charsPerLine);
38869
-
38870
- // Calculate tooltip height
38871
- const lineHeight = 25; // Approximate line height
38872
- const padding = 20; // Top + bottom padding
38873
- const tooltipHeight = estimatedLines * lineHeight + padding;
38874
-
38875
- // Base offset - smaller for regular cells
38876
- const baseOffset = isRegularCell ? 40 : 60;
38877
- const extraOffset = Math.max(0, (estimatedLines - 1) * lineHeight);
38878
- return {
38879
- offset: baseOffset + extraOffset,
38880
- height: tooltipHeight
38881
- };
38882
- };
38883
-
38884
38884
  // Helper function to format tag text
38885
38885
  const formatTagText = tag => {
38886
38886
  if (typeof tag !== 'string') return tag;
@@ -39100,7 +39100,7 @@ const TableBody = ({
39100
39100
  }
39101
39101
  const trashTooltipText = getTooltipText(value);
39102
39102
  if (value === 'ENABLED') {
39103
- return /*#__PURE__*/React__default["default"].createElement(TrashIconWrapper, {
39103
+ return /*#__PURE__*/React__default["default"].createElement(TrashIconWrapper$1, {
39104
39104
  $buttonColor: buttonColor,
39105
39105
  ref: el => {
39106
39106
  if (el && trashTooltipText) {
@@ -39126,7 +39126,7 @@ const TableBody = ({
39126
39126
  height: "18"
39127
39127
  }));
39128
39128
  } else if (value === 'DISABLED') {
39129
- return /*#__PURE__*/React__default["default"].createElement(DisabledTrashIconWrapper, {
39129
+ return /*#__PURE__*/React__default["default"].createElement(DisabledTrashIconWrapper$1, {
39130
39130
  ref: el => {
39131
39131
  if (el && trashTooltipText) {
39132
39132
  const rect = el.getBoundingClientRect();
@@ -42587,7 +42587,7 @@ const Table = props => {
42587
42587
  // Add displayName for better debugging
42588
42588
  Table.displayName = 'Table';
42589
42589
 
42590
- const Card = styled__default["default"].div`
42590
+ const Card = styled.styled.div`
42591
42591
  background: ${props => props.backgroundColor};
42592
42592
  border-radius: 8px;
42593
42593
  /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); */
@@ -42602,44 +42602,44 @@ const Card = styled__default["default"].div`
42602
42602
  cursor: not-allowed;
42603
42603
  }
42604
42604
  `;
42605
- const TitleContainer = styled__default["default"].div`
42605
+ const TitleContainer = styled.styled.div`
42606
42606
  display: flex;
42607
42607
  flex-direction: column;
42608
42608
  align-items: flex-start;
42609
42609
  `;
42610
- const SectionTitle$1 = styled__default["default"].div`
42610
+ const SectionTitle$1 = styled.styled.div`
42611
42611
  color: #212121;
42612
42612
  font-size: 18px;
42613
42613
  font-weight: 700;
42614
42614
  `;
42615
- const SubtitleContainer = styled__default["default"].div`
42615
+ const SubtitleContainer = styled.styled.div`
42616
42616
  display: flex;
42617
42617
  align-items: center;
42618
42618
  gap: 6px;
42619
42619
  color: #8B8989;
42620
42620
  `;
42621
- const Subtitle$1 = styled__default["default"].span`
42621
+ const Subtitle$1 = styled.styled.span`
42622
42622
  color: ${props => props.color};
42623
42623
  font-size: 14px;
42624
42624
  font-weight: 400;
42625
42625
  `;
42626
- const AddButtonContainer$1 = styled__default["default"].div`
42626
+ const AddButtonContainer$1 = styled.styled.div`
42627
42627
  display: flex;
42628
42628
  align-items: flex-start;
42629
42629
  `;
42630
42630
 
42631
42631
  // Vendor selection screen styles
42632
- styled__default["default"](Card)`
42632
+ styled.styled(Card)`
42633
42633
  display: flex;
42634
42634
  flex-direction: column;
42635
42635
  background: #faf9fb;
42636
42636
  padding: 0;
42637
42637
  overflow: hidden;
42638
42638
  `;
42639
- const VendorHeader$2 = styled__default["default"].div`
42639
+ const VendorHeader$2 = styled.styled.div`
42640
42640
  padding: 16px 24px;
42641
42641
  `;
42642
- styled__default["default"].button`
42642
+ styled.styled.button`
42643
42643
  border: none;
42644
42644
  background: none;
42645
42645
  font-size: 22px;
@@ -42648,7 +42648,7 @@ styled__default["default"].button`
42648
42648
  padding: 0 8px 0 0;
42649
42649
  margin-right: 4px;
42650
42650
  `;
42651
- styled__default["default"].input`
42651
+ styled.styled.input`
42652
42652
  margin: 16px;
42653
42653
  margin-bottom: 8px;
42654
42654
  padding: 10px 14px;
@@ -42657,16 +42657,16 @@ styled__default["default"].input`
42657
42657
  font-size: 15px;
42658
42658
  outline: none;
42659
42659
  `;
42660
- const VendorListWrapper$2 = styled__default["default"].div`
42660
+ const VendorListWrapper$2 = styled.styled.div`
42661
42661
  height: calc(100% - ${props => props.headerHeight}px);
42662
42662
  background: ${props => props.disabled ? '#f2f2f2' : '#fff'};
42663
42663
  width: 100%;
42664
42664
  overflow: auto;
42665
42665
  border-radius: 0 0 8px 8px;
42666
42666
  `;
42667
- const VendorList$2 = styled__default["default"].div`
42667
+ const VendorList$2 = styled.styled.div`
42668
42668
  `;
42669
- const VendorItem$1 = styled__default["default"].div`
42669
+ const VendorItem$1 = styled.styled.div`
42670
42670
  display: flex;
42671
42671
  align-items: center;
42672
42672
  justify-content: space-between;
@@ -42677,50 +42677,53 @@ const VendorItem$1 = styled__default["default"].div`
42677
42677
  &:hover {
42678
42678
  background: #f7f7fa;
42679
42679
  .trash-icon svg path {
42680
- fill: #B1B1B1;
42681
- }
42680
+ fill: #B1B1B1;
42681
+ }
42682
+ .trash-icon-disabled svg path {
42683
+ fill: #D9D9D9;
42684
+ }
42682
42685
  }
42683
42686
  `;
42684
- const VendorName$2 = styled__default["default"].div`
42687
+ const VendorName$2 = styled.styled.div`
42685
42688
  color: #212121;
42686
42689
  font-size: 16px;
42687
42690
  font-weight: 500;
42688
42691
  `;
42689
- styled__default["default"].div`
42692
+ styled.styled.div`
42690
42693
  color: #b0b0b0;
42691
42694
  font-size: 13px;
42692
42695
  margin-top: 2px;
42693
42696
  `;
42694
- const VendorChevron$1 = styled__default["default"].div`
42697
+ const VendorChevron$1 = styled.styled.div`
42695
42698
  align-items: center;
42696
42699
  display: flex;
42697
42700
  `;
42698
- const VendorNameAndPackagesContainer$1 = styled__default["default"].div`
42701
+ const VendorNameAndPackagesContainer$1 = styled.styled.div`
42699
42702
  display: flex;
42700
42703
  margin-left: 12px;
42701
42704
  flex-direction: column;
42702
42705
  align-items: flex-start;
42703
42706
  `;
42704
- const DotContainer = styled__default["default"].div`
42707
+ const DotContainer = styled.styled.div`
42705
42708
  text-align: center;
42706
42709
  margin-top: 10px;
42707
42710
  width: 40px;
42708
42711
  height: 100%;
42709
42712
  `;
42710
- const LineContainer = styled__default["default"].div`
42713
+ const LineContainer = styled.styled.div`
42711
42714
  display: flex;
42712
42715
  justify-content: space-between;
42713
42716
  align-items: center;
42714
42717
  width: 100%;
42715
42718
  `;
42716
- const ButtonContainer = styled__default["default"].div`
42719
+ const ButtonContainer = styled.styled.div`
42717
42720
  .ButtonContainer {
42718
42721
  label {
42719
42722
  white-space: nowrap;
42720
42723
  }
42721
42724
  }
42722
42725
  `;
42723
- const CustomTooltip = styled__default["default"](Tooltip$2)`
42726
+ const CustomTooltip = styled.styled(Tooltip$2)`
42724
42727
  .controls {
42725
42728
  padding: 12px 16px;
42726
42729
  font-size: 14px;
@@ -42728,20 +42731,74 @@ const CustomTooltip = styled__default["default"](Tooltip$2)`
42728
42731
  &::before {
42729
42732
  left: 90%;
42730
42733
  }
42731
- ${props => props.trashIcon && `width: 150px;
42732
- white-space: normal;
42733
- max-height: 50px;
42734
- margin-top: 8px;`}
42735
42734
  }
42736
42735
  `;
42737
- const Container$1 = styled__default["default"].div`
42736
+ const Container$1 = styled.styled.div`
42738
42737
  display: flex;
42739
42738
  align-items: center;
42740
42739
  justify-content: space-between;
42741
42740
  padding: 38px 0 20px;
42742
42741
  box-sizing: border-box;
42743
42742
  `;
42744
- const Trash$1 = styled__default["default"].div`
42743
+ const tooltipStyles = styled.css`
42744
+ /* CSS-only tooltip */
42745
+ &[data-tooltip]:hover::before {
42746
+ content: attr(data-tooltip);
42747
+ position: fixed;
42748
+ background-color: white;
42749
+ color: #333;
42750
+ padding: 10px 16px;
42751
+ border-radius: 4px;
42752
+ font-family: "Poppins", sans-serif;
42753
+ font-size: 14px;
42754
+ font-weight: 400;
42755
+ z-index: 1000;
42756
+ pointer-events: none;
42757
+ width: 200px;
42758
+ white-space: pre-wrap;
42759
+ word-wrap: break-word;
42760
+ line-height: 1.8;
42761
+ box-shadow:
42762
+ 0 -2px 8px rgba(0, 0, 0, 0.15),
42763
+ 0 2px 8px rgba(0, 0, 0, 0.15);
42764
+
42765
+ /* Position above the element - using dynamic offset */
42766
+ top: calc(var(--tooltip-top, 0px) - var(--tooltip-offset, 60px));
42767
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2);
42768
+ transform: translateX(-50%);
42769
+
42770
+ /* Add delay */
42771
+ opacity: 0;
42772
+ animation: showTooltip 0.3s ease-in-out 0.5s forwards;
42773
+ }
42774
+
42775
+ /* Tooltip arrow */
42776
+ &[data-tooltip]:hover::after {
42777
+ content: "";
42778
+ position: fixed;
42779
+ top: calc(
42780
+ var(--tooltip-top, 0px) - var(--tooltip-offset, 60px) +
42781
+ var(--tooltip-height, 50px)
42782
+ ); /* Use estimated tooltip height */
42783
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2);
42784
+ transform: translateX(-50%);
42785
+ border: 8px solid transparent;
42786
+ border-top-color: white;
42787
+ z-index: 1001;
42788
+ pointer-events: none;
42789
+
42790
+ /* Add delay */
42791
+ opacity: 0;
42792
+ animation: showTooltip 0.3s ease-in-out 0.5s forwards;
42793
+ }
42794
+
42795
+ @keyframes showTooltip {
42796
+ to {
42797
+ opacity: 1;
42798
+ }
42799
+ }
42800
+ `;
42801
+ const baseIconWrapperStyles = styled.css`
42745
42802
  display: flex;
42746
42803
  align-items: center;
42747
42804
  justify-content: center;
@@ -42749,9 +42806,6 @@ const Trash$1 = styled__default["default"].div`
42749
42806
  height: 24px;
42750
42807
  padding: 0 12px;
42751
42808
  cursor: pointer;
42752
- ${props => props.disabled && `opacity: 0.5;
42753
- pointer-events: none;
42754
- user-select: none;`};
42755
42809
  svg {
42756
42810
  pointer-events: none;
42757
42811
  }
@@ -42759,6 +42813,23 @@ const Trash$1 = styled__default["default"].div`
42759
42813
  svg path {
42760
42814
  fill: white;
42761
42815
  }
42816
+ `;
42817
+ const DisabledTrashIconWrapper = styled.styled.div`
42818
+ ${baseIconWrapperStyles}
42819
+ ${tooltipStyles}
42820
+
42821
+ /* Tooltip customization */
42822
+ &[data-tooltip]:hover::before {
42823
+ text-align: left;
42824
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
42825
+ }
42826
+
42827
+ &[data-tooltip]:hover::after {
42828
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
42829
+ }
42830
+ `;
42831
+ const TrashIconWrapper = styled.styled.div`
42832
+ ${baseIconWrapperStyles}
42762
42833
 
42763
42834
  &:hover {
42764
42835
  svg path {
@@ -52089,6 +52160,21 @@ const ItemManagerPanel = _ref => {
52089
52160
  setSelectedVendor(modifiedVendor);
52090
52161
  setScreen("subitem");
52091
52162
  };
52163
+ const setupTooltip = (el, tooltipText) => {
52164
+ if (el && tooltipText) {
52165
+ const rect = el.getBoundingClientRect();
52166
+ const {
52167
+ offset,
52168
+ height
52169
+ } = calculateTooltipOffset(tooltipText);
52170
+ el.style.setProperty('--tooltip-top', `${rect.top}px`);
52171
+ el.style.setProperty('--tooltip-left', `${rect.left}px`);
52172
+ el.style.setProperty('--tooltip-width', `${rect.width}px`);
52173
+ el.style.setProperty('--tooltip-offset', `${offset}px`);
52174
+ el.style.setProperty('--tooltip-height', `${height}px`);
52175
+ el.setAttribute('data-tooltip', tooltipText);
52176
+ }
52177
+ };
52092
52178
  const addNewPackage = (vendorName, packageName, component) => {
52093
52179
  setItemAndPackage(prev => {
52094
52180
  const vendorIndex = prev.findIndex(item => item.name === vendorName);
@@ -52312,27 +52398,22 @@ const ItemManagerPanel = _ref => {
52312
52398
  } else {
52313
52399
  return `${sentPackagesLength}/${packagesLength} sent`;
52314
52400
  }
52315
- })())), /*#__PURE__*/React__default["default"].createElement(VendorChevron$1, null, /*#__PURE__*/React__default["default"].createElement(ArrowRightFullIcon, null))), /*#__PURE__*/React__default["default"].createElement(CustomTooltip, {
52316
- hideTooltip: !sentPackagesLength > 0,
52317
- content: trashTooltipText,
52318
- topFactor: 2,
52319
- direction: "left",
52320
- trashIcon: true
52321
- }, /*#__PURE__*/React__default["default"].createElement(Trash$1, {
52322
- disabled: sentPackagesLength > 0,
52401
+ })())), /*#__PURE__*/React__default["default"].createElement(VendorChevron$1, null, /*#__PURE__*/React__default["default"].createElement(ArrowRightFullIcon, null))), sentPackagesLength > 0 ? /*#__PURE__*/React__default["default"].createElement(DisabledTrashIconWrapper, {
52402
+ className: "trash-icon-disabled",
52403
+ ref: el => setupTooltip(el, trashTooltipText)
52404
+ }, /*#__PURE__*/React__default["default"].createElement(DisabledTrashIcon, {
52405
+ width: "22",
52406
+ height: "22"
52407
+ })) : /*#__PURE__*/React__default["default"].createElement(TrashIconWrapper, {
52323
52408
  className: "trash-icon",
52324
- onClick: () => {
52409
+ onClick: e => {
52410
+ e.stopPropagation();
52325
52411
  onDeleteVendor(item);
52326
52412
  }
52327
- }, /*#__PURE__*/React__default["default"].createElement("svg", {
52413
+ }, /*#__PURE__*/React__default["default"].createElement(TrashIcon, {
52328
52414
  width: "14",
52329
- height: "18",
52330
- viewBox: "0 0 14 18",
52331
- fill: "none",
52332
- xmlns: "http://www.w3.org/2000/svg"
52333
- }, /*#__PURE__*/React__default["default"].createElement("path", {
52334
- d: "M1 16C1 17.1 1.9 18 3 18H11C12.1 18 13 17.1 13 16V4H1V16ZM14 1H10.5L9.5 0H4.5L3.5 1H0V3H14V1Z"
52335
- })))));
52415
+ height: "18"
52416
+ })));
52336
52417
  }))));
52337
52418
  }
52338
52419
  };