sag_components 2.0.0-beta173 → 2.0.0-beta174

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
@@ -10429,23 +10429,24 @@ const QuarterPopupPicker = ({
10429
10429
  };
10430
10430
 
10431
10431
  /* eslint-disable import/no-extraneous-dependencies */
10432
- const QuarterPicker = ({
10433
- availableQuarters,
10434
- // ["Q1-2024"]
10435
- label,
10436
- onChange,
10437
- borderRadius,
10438
- required,
10439
- width,
10440
- height,
10441
- placeholder,
10442
- disabled,
10443
- borderColor,
10444
- borderColorFocus,
10445
- textColor,
10446
- selectedValue,
10447
- startYear
10448
- }) => {
10432
+ const QuarterPicker = _ref => {
10433
+ let {
10434
+ availableQuarters,
10435
+ // ["Q1-2024"]
10436
+ label,
10437
+ onChange,
10438
+ borderRadius,
10439
+ required,
10440
+ width,
10441
+ height,
10442
+ placeholder,
10443
+ disabled,
10444
+ borderColor,
10445
+ borderColorFocus,
10446
+ textColor,
10447
+ selectedValue,
10448
+ startYear
10449
+ } = _ref;
10449
10450
  const [isFocused, setIsFocused] = useState(false);
10450
10451
  const [isOpen, setIsOpen] = useState(false);
10451
10452
  const [value, setValue] = useState('');
@@ -10887,22 +10888,23 @@ const MonthPopupPicker = ({
10887
10888
  };
10888
10889
 
10889
10890
  /* eslint-disable import/no-extraneous-dependencies */
10890
- const MonthPicker = ({
10891
- availableMonths,
10892
- label,
10893
- onChange,
10894
- borderRadius,
10895
- required,
10896
- width,
10897
- height,
10898
- placeholder,
10899
- disabled,
10900
- borderColor,
10901
- borderColorFocus,
10902
- textColor,
10903
- selectedValue,
10904
- startYear
10905
- }) => {
10891
+ const MonthPicker = _ref => {
10892
+ let {
10893
+ availableMonths,
10894
+ label,
10895
+ onChange,
10896
+ borderRadius,
10897
+ required,
10898
+ width,
10899
+ height,
10900
+ placeholder,
10901
+ disabled,
10902
+ borderColor,
10903
+ borderColorFocus,
10904
+ textColor,
10905
+ selectedValue,
10906
+ startYear
10907
+ } = _ref;
10906
10908
  const [isFocused, setIsFocused] = useState(false);
10907
10909
  const [isOpen, setIsOpen] = useState(false);
10908
10910
  const [value, setValue] = useState('');
@@ -38731,13 +38733,13 @@ const ExpandedContent = styled.div`
38731
38733
  `;
38732
38734
 
38733
38735
  // DROPDOWN STYLES
38734
- const DropdownContainer$1 = styled.div`
38736
+ styled.div`
38735
38737
  position: relative;
38736
38738
  display: inline-block;
38737
38739
  width: 100%;
38738
38740
  font-family: "Poppins", sans-serif;
38739
38741
  `;
38740
- const DropdownButton$1 = styled.button`
38742
+ styled.button`
38741
38743
  display: flex;
38742
38744
  align-items: center;
38743
38745
  justify-content: space-between;
@@ -38770,7 +38772,7 @@ const DropdownButton$1 = styled.button`
38770
38772
  flex: 1;
38771
38773
  }
38772
38774
  `;
38773
- const DropdownIcon = styled.div`
38775
+ styled.div`
38774
38776
  display: flex;
38775
38777
  align-items: center;
38776
38778
  justify-content: center;
@@ -38785,7 +38787,7 @@ const DropdownIcon = styled.div`
38785
38787
  transform: rotate(180deg);
38786
38788
  `}
38787
38789
  `;
38788
- const DropdownMenu = styled.div`
38790
+ styled.div`
38789
38791
  position: absolute;
38790
38792
  top: calc(100%);
38791
38793
  left: 0;
@@ -38818,7 +38820,7 @@ const DropdownMenu = styled.div`
38818
38820
  background: #94a3b8;
38819
38821
  }
38820
38822
  `;
38821
- const DropdownOption = styled.div`
38823
+ styled.div`
38822
38824
  display: flex;
38823
38825
  align-items: center;
38824
38826
  justify-content: space-between;
@@ -39066,6 +39068,177 @@ const DisabledTrashIcon = ({
39066
39068
  }));
39067
39069
  };
39068
39070
 
39071
+ // DROPDOWN STYLES
39072
+ const DropdownContainer$1 = styled.div`
39073
+ position: relative;
39074
+ display: inline-block;
39075
+ width: 100%;
39076
+ font-family: "Poppins", sans-serif;
39077
+ `;
39078
+ const DropdownButton$1 = styled.button`
39079
+ display: flex;
39080
+ align-items: center;
39081
+ justify-content: space-between;
39082
+ width: 100%;
39083
+ min-width: 120px;
39084
+ background-color: ${props => props.$isRowFocused || props.$isRowHovered ? props.$selectedColor : "white"};
39085
+ border: none;
39086
+ border-radius: 0;
39087
+ font-family: "Poppins", sans-serif;
39088
+ font-size: 14px;
39089
+ font-weight: 400;
39090
+ color: #212121;
39091
+ cursor: pointer;
39092
+ transition: all 0.2s ease;
39093
+
39094
+ &:hover {
39095
+ background-color: #D1E7E7;
39096
+ }
39097
+
39098
+ &:focus {
39099
+ outline: none;
39100
+ background-color: #E6F0F0;
39101
+ }
39102
+
39103
+ span {
39104
+ overflow: hidden;
39105
+ text-overflow: ellipsis;
39106
+ white-space: nowrap;
39107
+ text-align: left;
39108
+ flex: 1;
39109
+ }
39110
+ `;
39111
+ const DropdownIcon = styled.div`
39112
+ display: flex;
39113
+ align-items: center;
39114
+ justify-content: center;
39115
+ width: 20px;
39116
+ height: 20px;
39117
+ background-color: ${props => props.$isRowFocused || props.$isRowHovered ? '#B4D1D2' : 'white'};
39118
+ border-radius: 4px;
39119
+ margin-left: 8px;
39120
+ transition: all 0.2s ease;
39121
+
39122
+ ${props => props.$isOpen && `
39123
+ transform: rotate(180deg);
39124
+ `}
39125
+ `;
39126
+ const DropdownMenu = styled.div`
39127
+ position: absolute;
39128
+ top: calc(100%);
39129
+ left: 0;
39130
+ right: 0;
39131
+ z-index: 1000;
39132
+ background-color: white;
39133
+ border: none;
39134
+ border-radius: 0;
39135
+ box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
39136
+ font-family: "Poppins", sans-serif;
39137
+ max-height: ${props => props.$maxDropdownHeight || '200px'};
39138
+ overflow-y: auto;
39139
+ padding: 16px;
39140
+
39141
+ /* Custom scrollbar */
39142
+ &::-webkit-scrollbar {
39143
+ width: 4px;
39144
+ }
39145
+
39146
+ &::-webkit-scrollbar-track {
39147
+ background: transparent;
39148
+ }
39149
+
39150
+ &::-webkit-scrollbar-thumb {
39151
+ background: #cbd5e1;
39152
+ border-radius: 2px;
39153
+ }
39154
+
39155
+ &::-webkit-scrollbar-thumb:hover {
39156
+ background: #94a3b8;
39157
+ }
39158
+ `;
39159
+ const DropdownOption = styled.div`
39160
+ display: flex;
39161
+ align-items: center;
39162
+ justify-content: space-between;
39163
+ padding: 8px;
39164
+ font-size: 14px;
39165
+ font-weight: 400;
39166
+ color: #374151;
39167
+ cursor: pointer;
39168
+ transition: all 0.15s ease;
39169
+ border-radius: 0;
39170
+ border-left: 3px solid transparent;
39171
+ background-color: white;
39172
+
39173
+ &:hover {
39174
+ background-color: #E6F0F0;
39175
+ }
39176
+
39177
+ ${props => props.$isSelected && `
39178
+ background-color: #B4D1D2;
39179
+ color: #374151;
39180
+ font-weight: 500;
39181
+ border-left: 3px solid #066768;
39182
+
39183
+ &:hover {
39184
+ background-color: #A3C9CA;
39185
+ }
39186
+ `}
39187
+ `;
39188
+
39189
+ const Dropdown = ({
39190
+ isOpen,
39191
+ options,
39192
+ selectedValue,
39193
+ displayText,
39194
+ onToggle,
39195
+ onOptionSelect,
39196
+ maxDropdownHeight,
39197
+ isRowFocused = false,
39198
+ isRowHovered = false,
39199
+ selectedColor
39200
+ }) => {
39201
+ return /*#__PURE__*/React$1.createElement(DropdownContainer$1, null, /*#__PURE__*/React$1.createElement(DropdownButton$1, {
39202
+ onClick: onToggle,
39203
+ $isOpen: isOpen,
39204
+ $isRowFocused: isRowFocused,
39205
+ $selectedColor: selectedColor
39206
+ }, /*#__PURE__*/React$1.createElement("span", null, displayText), /*#__PURE__*/React$1.createElement(DropdownIcon, {
39207
+ $isOpen: isOpen,
39208
+ $isRowFocused: isRowFocused,
39209
+ $isRowHovered: isRowHovered
39210
+ }, /*#__PURE__*/React$1.createElement(MenuItemOpenIcon, {
39211
+ width: "10",
39212
+ height: "6",
39213
+ color: "#212121"
39214
+ }))), isOpen && /*#__PURE__*/React$1.createElement(DropdownMenu, {
39215
+ $maxDropdownHeight: maxDropdownHeight
39216
+ }, options.map((option, index) => /*#__PURE__*/React$1.createElement(DropdownOption, {
39217
+ key: index,
39218
+ onClick: e => onOptionSelect(option, e),
39219
+ $isSelected: option.value === selectedValue
39220
+ }, /*#__PURE__*/React$1.createElement("span", null, option.label), option.value === selectedValue && /*#__PURE__*/React$1.createElement(OkIcon, {
39221
+ width: "24",
39222
+ height: "24",
39223
+ color: "#066768"
39224
+ })))));
39225
+ };
39226
+ Dropdown.propTypes = {
39227
+ isOpen: PropTypes.bool.isRequired,
39228
+ options: PropTypes.arrayOf(PropTypes.shape({
39229
+ value: PropTypes.string.isRequired,
39230
+ label: PropTypes.string.isRequired
39231
+ })).isRequired,
39232
+ selectedValue: PropTypes.string,
39233
+ displayText: PropTypes.string.isRequired,
39234
+ onToggle: PropTypes.func.isRequired,
39235
+ onOptionSelect: PropTypes.func.isRequired,
39236
+ maxDropdownHeight: PropTypes.string,
39237
+ isRowFocused: PropTypes.bool,
39238
+ isRowHovered: PropTypes.bool,
39239
+ selectedColor: PropTypes.string
39240
+ };
39241
+
39069
39242
  // TableBody.jsx
39070
39243
  const TableBody = ({
39071
39244
  columns,
@@ -39455,30 +39628,18 @@ const TableBody = ({
39455
39628
  // Find the current selected option to display its label
39456
39629
  const currentOption = dropdownOptions.find(option => option.value === value);
39457
39630
  const displayText = currentOption ? currentOption.label : value || 'Select...';
39458
- return /*#__PURE__*/React$1.createElement(DropdownContainer$1, null, /*#__PURE__*/React$1.createElement(DropdownButton$1, {
39459
- onClick: e => handleDropdownClick(rowIndex, column.key, e),
39460
- $isOpen: isOpen,
39461
- $isRowFocused: focusedRowIndex === rowIndex,
39462
- $selectedColor: selectedColor
39463
- }, /*#__PURE__*/React$1.createElement("span", null, displayText), /*#__PURE__*/React$1.createElement(DropdownIcon, {
39464
- $isOpen: isOpen,
39465
- $isRowFocused: focusedRowIndex === rowIndex,
39466
- $isRowHovered: hoveredRowIndex === rowIndex
39467
- }, /*#__PURE__*/React$1.createElement(MenuItemOpenIcon, {
39468
- width: "10",
39469
- height: "6",
39470
- color: "#212121"
39471
- }))), isOpen && /*#__PURE__*/React$1.createElement(DropdownMenu, {
39472
- $maxDropdownHeight: maxDropdownHeight
39473
- }, dropdownOptions.map((option, index) => /*#__PURE__*/React$1.createElement(DropdownOption, {
39474
- key: index,
39475
- onClick: e => handleDropdownOptionClick(row, rowIndex, column.key, option, e),
39476
- $isSelected: option.value === value
39477
- }, /*#__PURE__*/React$1.createElement("span", null, option.label), option.value === value && /*#__PURE__*/React$1.createElement(OkIcon, {
39478
- width: "24",
39479
- height: "24",
39480
- color: "#066768"
39481
- })))));
39631
+ return /*#__PURE__*/React$1.createElement(Dropdown, {
39632
+ isOpen: isOpen,
39633
+ options: dropdownOptions,
39634
+ selectedValue: value,
39635
+ displayText: displayText,
39636
+ onToggle: e => handleDropdownClick(rowIndex, column.key, e),
39637
+ onOptionSelect: (option, e) => handleDropdownOptionClick(row, rowIndex, column.key, option, e),
39638
+ maxDropdownHeight: maxDropdownHeight,
39639
+ isRowFocused: focusedRowIndex === rowIndex,
39640
+ isRowHovered: hoveredRowIndex === rowIndex,
39641
+ selectedColor: selectedColor
39642
+ });
39482
39643
  default:
39483
39644
  // Treat default as text
39484
39645
  return value.toString();
@@ -39519,9 +39680,9 @@ const TableBody = ({
39519
39680
  [dropdownKey]: false
39520
39681
  }));
39521
39682
 
39522
- // Fire the onDropdownSelected event
39683
+ // Fire the onDropdownSelected event with columnKey instead of columnName
39523
39684
  if (onDropdownSelected) {
39524
- onDropdownSelected(row, selectedOption);
39685
+ onDropdownSelected(row, selectedOption, columnKey);
39525
39686
  }
39526
39687
  };
39527
39688