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.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'
@@ -3602,6 +3628,7 @@ const TextFieldInput = styled__default["default"].input`
3602
3628
 
3603
3629
  const SearchInput = props => {
3604
3630
  const {
3631
+ value,
3605
3632
  placeholder = 'Search',
3606
3633
  width = '100%',
3607
3634
  height = '40px',
@@ -3623,6 +3650,7 @@ const SearchInput = props => {
3623
3650
  })), /*#__PURE__*/React__default["default"].createElement(TextFieldInput, {
3624
3651
  type: "search",
3625
3652
  id: "search-input",
3653
+ value: value,
3626
3654
  height: height,
3627
3655
  placeholder: placeholder,
3628
3656
  onChange: handleInputChange,
@@ -34630,16 +34658,15 @@ styled.css`
34630
34658
  * • onApply(start,end) – callback, both numbers (inclusive)
34631
34659
  * • onCancel() – callback
34632
34660
  */
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;
34661
+ const WeeksCalendar = ({
34662
+ year,
34663
+ defaultStartWeek = null,
34664
+ defaultEndWeek = null,
34665
+ backgroundColor = "#066768",
34666
+ hoverBackgroundColor = "#E6F0F0",
34667
+ onApply,
34668
+ onCancel
34669
+ }) => {
34643
34670
  // state -------------------------------------------------
34644
34671
  const [startWeek, setStartWeek] = React$1.useState(defaultStartWeek);
34645
34672
  const [endWeek, setEndWeek] = React$1.useState(defaultEndWeek);
@@ -38003,7 +38030,7 @@ const TableHeader = ({
38003
38030
  // TableBody.styles.js
38004
38031
 
38005
38032
  // Shared tooltip styles
38006
- const tooltipStyles = styled.css`
38033
+ const tooltipStyles$1 = styled.css`
38007
38034
  /* CSS-only tooltip */
38008
38035
  &[data-tooltip]:hover::before {
38009
38036
  content: attr(data-tooltip);
@@ -38275,7 +38302,7 @@ const ButtonWrapper = styled__default["default"].div`
38275
38302
  display: inline-block;
38276
38303
  position: relative;
38277
38304
 
38278
- ${tooltipStyles}
38305
+ ${tooltipStyles$1}
38279
38306
  `;
38280
38307
  const SentStatus = styled__default["default"].div`
38281
38308
  display: flex;
@@ -38286,9 +38313,9 @@ const SentStatus = styled__default["default"].div`
38286
38313
  user-select: none;
38287
38314
  position: relative;
38288
38315
 
38289
- ${tooltipStyles}
38316
+ ${tooltipStyles$1}
38290
38317
  `;
38291
- const TrashIconWrapper = styled__default["default"].div`
38318
+ const TrashIconWrapper$1 = styled__default["default"].div`
38292
38319
  cursor: pointer;
38293
38320
  transition: color 0.2s ease;
38294
38321
  display: inline-flex;
@@ -38298,7 +38325,7 @@ const TrashIconWrapper = styled__default["default"].div`
38298
38325
  height: 100%;
38299
38326
  position: relative;
38300
38327
 
38301
- ${tooltipStyles}
38328
+ ${tooltipStyles$1}
38302
38329
 
38303
38330
  /* Override tooltip position to move left */
38304
38331
  &[data-tooltip]:hover::before {
@@ -38325,7 +38352,7 @@ const CommentIconWrapper = styled__default["default"].div`
38325
38352
  height: 100%;
38326
38353
  position: relative;
38327
38354
 
38328
- ${tooltipStyles}
38355
+ ${tooltipStyles$1}
38329
38356
 
38330
38357
  /* Override tooltip position to move left */
38331
38358
  &[data-tooltip]:hover::before {
@@ -38336,7 +38363,7 @@ const CommentIconWrapper = styled__default["default"].div`
38336
38363
  left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
38337
38364
  }
38338
38365
  `;
38339
- const DisabledTrashIconWrapper = styled__default["default"].div`
38366
+ const DisabledTrashIconWrapper$1 = styled__default["default"].div`
38340
38367
  display: inline-flex;
38341
38368
  align-items: center;
38342
38369
  justify-content: center;
@@ -38344,7 +38371,7 @@ const DisabledTrashIconWrapper = styled__default["default"].div`
38344
38371
  height: 100%;
38345
38372
  position: relative;
38346
38373
 
38347
- ${tooltipStyles}
38374
+ ${tooltipStyles$1}
38348
38375
 
38349
38376
  /* Override tooltip position to move left */
38350
38377
  &[data-tooltip]:hover::before {
@@ -38856,31 +38883,6 @@ const TableBody = ({
38856
38883
  // Determine if save button should be enabled
38857
38884
  const isSaveEnabled = hasUserInteracted && (commentText.length > 0 || hasInitialValue);
38858
38885
 
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
38886
  // Helper function to format tag text
38885
38887
  const formatTagText = tag => {
38886
38888
  if (typeof tag !== 'string') return tag;
@@ -39100,7 +39102,7 @@ const TableBody = ({
39100
39102
  }
39101
39103
  const trashTooltipText = getTooltipText(value);
39102
39104
  if (value === 'ENABLED') {
39103
- return /*#__PURE__*/React__default["default"].createElement(TrashIconWrapper, {
39105
+ return /*#__PURE__*/React__default["default"].createElement(TrashIconWrapper$1, {
39104
39106
  $buttonColor: buttonColor,
39105
39107
  ref: el => {
39106
39108
  if (el && trashTooltipText) {
@@ -39126,7 +39128,7 @@ const TableBody = ({
39126
39128
  height: "18"
39127
39129
  }));
39128
39130
  } else if (value === 'DISABLED') {
39129
- return /*#__PURE__*/React__default["default"].createElement(DisabledTrashIconWrapper, {
39131
+ return /*#__PURE__*/React__default["default"].createElement(DisabledTrashIconWrapper$1, {
39130
39132
  ref: el => {
39131
39133
  if (el && trashTooltipText) {
39132
39134
  const rect = el.getBoundingClientRect();
@@ -42587,7 +42589,7 @@ const Table = props => {
42587
42589
  // Add displayName for better debugging
42588
42590
  Table.displayName = 'Table';
42589
42591
 
42590
- const Card = styled__default["default"].div`
42592
+ const Card = styled.styled.div`
42591
42593
  background: ${props => props.backgroundColor};
42592
42594
  border-radius: 8px;
42593
42595
  /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); */
@@ -42602,44 +42604,44 @@ const Card = styled__default["default"].div`
42602
42604
  cursor: not-allowed;
42603
42605
  }
42604
42606
  `;
42605
- const TitleContainer = styled__default["default"].div`
42607
+ const TitleContainer = styled.styled.div`
42606
42608
  display: flex;
42607
42609
  flex-direction: column;
42608
42610
  align-items: flex-start;
42609
42611
  `;
42610
- const SectionTitle$1 = styled__default["default"].div`
42612
+ const SectionTitle$1 = styled.styled.div`
42611
42613
  color: #212121;
42612
42614
  font-size: 18px;
42613
42615
  font-weight: 700;
42614
42616
  `;
42615
- const SubtitleContainer = styled__default["default"].div`
42617
+ const SubtitleContainer = styled.styled.div`
42616
42618
  display: flex;
42617
42619
  align-items: center;
42618
42620
  gap: 6px;
42619
42621
  color: #8B8989;
42620
42622
  `;
42621
- const Subtitle$1 = styled__default["default"].span`
42623
+ const Subtitle$1 = styled.styled.span`
42622
42624
  color: ${props => props.color};
42623
42625
  font-size: 14px;
42624
42626
  font-weight: 400;
42625
42627
  `;
42626
- const AddButtonContainer$1 = styled__default["default"].div`
42628
+ const AddButtonContainer$1 = styled.styled.div`
42627
42629
  display: flex;
42628
42630
  align-items: flex-start;
42629
42631
  `;
42630
42632
 
42631
42633
  // Vendor selection screen styles
42632
- styled__default["default"](Card)`
42634
+ styled.styled(Card)`
42633
42635
  display: flex;
42634
42636
  flex-direction: column;
42635
42637
  background: #faf9fb;
42636
42638
  padding: 0;
42637
42639
  overflow: hidden;
42638
42640
  `;
42639
- const VendorHeader$2 = styled__default["default"].div`
42641
+ const VendorHeader$2 = styled.styled.div`
42640
42642
  padding: 16px 24px;
42641
42643
  `;
42642
- styled__default["default"].button`
42644
+ styled.styled.button`
42643
42645
  border: none;
42644
42646
  background: none;
42645
42647
  font-size: 22px;
@@ -42648,7 +42650,7 @@ styled__default["default"].button`
42648
42650
  padding: 0 8px 0 0;
42649
42651
  margin-right: 4px;
42650
42652
  `;
42651
- styled__default["default"].input`
42653
+ styled.styled.input`
42652
42654
  margin: 16px;
42653
42655
  margin-bottom: 8px;
42654
42656
  padding: 10px 14px;
@@ -42657,16 +42659,16 @@ styled__default["default"].input`
42657
42659
  font-size: 15px;
42658
42660
  outline: none;
42659
42661
  `;
42660
- const VendorListWrapper$2 = styled__default["default"].div`
42662
+ const VendorListWrapper$2 = styled.styled.div`
42661
42663
  height: calc(100% - ${props => props.headerHeight}px);
42662
42664
  background: ${props => props.disabled ? '#f2f2f2' : '#fff'};
42663
42665
  width: 100%;
42664
42666
  overflow: auto;
42665
42667
  border-radius: 0 0 8px 8px;
42666
42668
  `;
42667
- const VendorList$2 = styled__default["default"].div`
42669
+ const VendorList$2 = styled.styled.div`
42668
42670
  `;
42669
- const VendorItem$1 = styled__default["default"].div`
42671
+ const VendorItem$1 = styled.styled.div`
42670
42672
  display: flex;
42671
42673
  align-items: center;
42672
42674
  justify-content: space-between;
@@ -42677,50 +42679,53 @@ const VendorItem$1 = styled__default["default"].div`
42677
42679
  &:hover {
42678
42680
  background: #f7f7fa;
42679
42681
  .trash-icon svg path {
42680
- fill: #B1B1B1;
42681
- }
42682
+ fill: #B1B1B1;
42683
+ }
42684
+ .trash-icon-disabled svg path {
42685
+ fill: #D9D9D9;
42686
+ }
42682
42687
  }
42683
42688
  `;
42684
- const VendorName$2 = styled__default["default"].div`
42689
+ const VendorName$2 = styled.styled.div`
42685
42690
  color: #212121;
42686
42691
  font-size: 16px;
42687
42692
  font-weight: 500;
42688
42693
  `;
42689
- styled__default["default"].div`
42694
+ styled.styled.div`
42690
42695
  color: #b0b0b0;
42691
42696
  font-size: 13px;
42692
42697
  margin-top: 2px;
42693
42698
  `;
42694
- const VendorChevron$1 = styled__default["default"].div`
42699
+ const VendorChevron$1 = styled.styled.div`
42695
42700
  align-items: center;
42696
42701
  display: flex;
42697
42702
  `;
42698
- const VendorNameAndPackagesContainer$1 = styled__default["default"].div`
42703
+ const VendorNameAndPackagesContainer$1 = styled.styled.div`
42699
42704
  display: flex;
42700
42705
  margin-left: 12px;
42701
42706
  flex-direction: column;
42702
42707
  align-items: flex-start;
42703
42708
  `;
42704
- const DotContainer = styled__default["default"].div`
42709
+ const DotContainer = styled.styled.div`
42705
42710
  text-align: center;
42706
42711
  margin-top: 10px;
42707
42712
  width: 40px;
42708
42713
  height: 100%;
42709
42714
  `;
42710
- const LineContainer = styled__default["default"].div`
42715
+ const LineContainer = styled.styled.div`
42711
42716
  display: flex;
42712
42717
  justify-content: space-between;
42713
42718
  align-items: center;
42714
42719
  width: 100%;
42715
42720
  `;
42716
- const ButtonContainer = styled__default["default"].div`
42721
+ const ButtonContainer = styled.styled.div`
42717
42722
  .ButtonContainer {
42718
42723
  label {
42719
42724
  white-space: nowrap;
42720
42725
  }
42721
42726
  }
42722
42727
  `;
42723
- const CustomTooltip = styled__default["default"](Tooltip$2)`
42728
+ const CustomTooltip = styled.styled(Tooltip$2)`
42724
42729
  .controls {
42725
42730
  padding: 12px 16px;
42726
42731
  font-size: 14px;
@@ -42728,20 +42733,74 @@ const CustomTooltip = styled__default["default"](Tooltip$2)`
42728
42733
  &::before {
42729
42734
  left: 90%;
42730
42735
  }
42731
- ${props => props.trashIcon && `width: 150px;
42732
- white-space: normal;
42733
- max-height: 50px;
42734
- margin-top: 8px;`}
42735
42736
  }
42736
42737
  `;
42737
- const Container$1 = styled__default["default"].div`
42738
+ const Container$1 = styled.styled.div`
42738
42739
  display: flex;
42739
42740
  align-items: center;
42740
42741
  justify-content: space-between;
42741
42742
  padding: 38px 0 20px;
42742
42743
  box-sizing: border-box;
42743
42744
  `;
42744
- const Trash$1 = styled__default["default"].div`
42745
+ const tooltipStyles = styled.css`
42746
+ /* CSS-only tooltip */
42747
+ &[data-tooltip]:hover::before {
42748
+ content: attr(data-tooltip);
42749
+ position: fixed;
42750
+ background-color: white;
42751
+ color: #333;
42752
+ padding: 10px 16px;
42753
+ border-radius: 4px;
42754
+ font-family: "Poppins", sans-serif;
42755
+ font-size: 14px;
42756
+ font-weight: 400;
42757
+ z-index: 1000;
42758
+ pointer-events: none;
42759
+ width: 200px;
42760
+ white-space: pre-wrap;
42761
+ word-wrap: break-word;
42762
+ line-height: 1.8;
42763
+ box-shadow:
42764
+ 0 -2px 8px rgba(0, 0, 0, 0.15),
42765
+ 0 2px 8px rgba(0, 0, 0, 0.15);
42766
+
42767
+ /* Position above the element - using dynamic offset */
42768
+ top: calc(var(--tooltip-top, 0px) - var(--tooltip-offset, 60px));
42769
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2);
42770
+ transform: translateX(-50%);
42771
+
42772
+ /* Add delay */
42773
+ opacity: 0;
42774
+ animation: showTooltip 0.3s ease-in-out 0.5s forwards;
42775
+ }
42776
+
42777
+ /* Tooltip arrow */
42778
+ &[data-tooltip]:hover::after {
42779
+ content: "";
42780
+ position: fixed;
42781
+ top: calc(
42782
+ var(--tooltip-top, 0px) - var(--tooltip-offset, 60px) +
42783
+ var(--tooltip-height, 50px)
42784
+ ); /* Use estimated tooltip height */
42785
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2);
42786
+ transform: translateX(-50%);
42787
+ border: 8px solid transparent;
42788
+ border-top-color: white;
42789
+ z-index: 1001;
42790
+ pointer-events: none;
42791
+
42792
+ /* Add delay */
42793
+ opacity: 0;
42794
+ animation: showTooltip 0.3s ease-in-out 0.5s forwards;
42795
+ }
42796
+
42797
+ @keyframes showTooltip {
42798
+ to {
42799
+ opacity: 1;
42800
+ }
42801
+ }
42802
+ `;
42803
+ const baseIconWrapperStyles = styled.css`
42745
42804
  display: flex;
42746
42805
  align-items: center;
42747
42806
  justify-content: center;
@@ -42749,9 +42808,6 @@ const Trash$1 = styled__default["default"].div`
42749
42808
  height: 24px;
42750
42809
  padding: 0 12px;
42751
42810
  cursor: pointer;
42752
- ${props => props.disabled && `opacity: 0.5;
42753
- pointer-events: none;
42754
- user-select: none;`};
42755
42811
  svg {
42756
42812
  pointer-events: none;
42757
42813
  }
@@ -42759,6 +42815,23 @@ const Trash$1 = styled__default["default"].div`
42759
42815
  svg path {
42760
42816
  fill: white;
42761
42817
  }
42818
+ `;
42819
+ const DisabledTrashIconWrapper = styled.styled.div`
42820
+ ${baseIconWrapperStyles}
42821
+ ${tooltipStyles}
42822
+
42823
+ /* Tooltip customization */
42824
+ &[data-tooltip]:hover::before {
42825
+ text-align: left;
42826
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
42827
+ }
42828
+
42829
+ &[data-tooltip]:hover::after {
42830
+ left: calc(var(--tooltip-left, 0px) + var(--tooltip-width, 0px) / 2 - 50px);
42831
+ }
42832
+ `;
42833
+ const TrashIconWrapper = styled.styled.div`
42834
+ ${baseIconWrapperStyles}
42762
42835
 
42763
42836
  &:hover {
42764
42837
  svg path {
@@ -52089,6 +52162,21 @@ const ItemManagerPanel = _ref => {
52089
52162
  setSelectedVendor(modifiedVendor);
52090
52163
  setScreen("subitem");
52091
52164
  };
52165
+ const setupTooltip = (el, tooltipText) => {
52166
+ if (el && tooltipText) {
52167
+ const rect = el.getBoundingClientRect();
52168
+ const {
52169
+ offset,
52170
+ height
52171
+ } = calculateTooltipOffset(tooltipText);
52172
+ el.style.setProperty('--tooltip-top', `${rect.top}px`);
52173
+ el.style.setProperty('--tooltip-left', `${rect.left}px`);
52174
+ el.style.setProperty('--tooltip-width', `${rect.width}px`);
52175
+ el.style.setProperty('--tooltip-offset', `${offset}px`);
52176
+ el.style.setProperty('--tooltip-height', `${height}px`);
52177
+ el.setAttribute('data-tooltip', tooltipText);
52178
+ }
52179
+ };
52092
52180
  const addNewPackage = (vendorName, packageName, component) => {
52093
52181
  setItemAndPackage(prev => {
52094
52182
  const vendorIndex = prev.findIndex(item => item.name === vendorName);
@@ -52312,27 +52400,22 @@ const ItemManagerPanel = _ref => {
52312
52400
  } else {
52313
52401
  return `${sentPackagesLength}/${packagesLength} sent`;
52314
52402
  }
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,
52403
+ })())), /*#__PURE__*/React__default["default"].createElement(VendorChevron$1, null, /*#__PURE__*/React__default["default"].createElement(ArrowRightFullIcon, null))), sentPackagesLength > 0 ? /*#__PURE__*/React__default["default"].createElement(DisabledTrashIconWrapper, {
52404
+ className: "trash-icon-disabled",
52405
+ ref: el => setupTooltip(el, trashTooltipText)
52406
+ }, /*#__PURE__*/React__default["default"].createElement(DisabledTrashIcon, {
52407
+ width: "22",
52408
+ height: "22"
52409
+ })) : /*#__PURE__*/React__default["default"].createElement(TrashIconWrapper, {
52323
52410
  className: "trash-icon",
52324
- onClick: () => {
52411
+ onClick: e => {
52412
+ e.stopPropagation();
52325
52413
  onDeleteVendor(item);
52326
52414
  }
52327
- }, /*#__PURE__*/React__default["default"].createElement("svg", {
52415
+ }, /*#__PURE__*/React__default["default"].createElement(TrashIcon, {
52328
52416
  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
- })))));
52417
+ height: "18"
52418
+ })));
52336
52419
  }))));
52337
52420
  }
52338
52421
  };