sag_components 2.0.0-beta196 → 2.0.0-beta198

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
@@ -10579,23 +10579,24 @@ const QuarterPopupPicker = ({
10579
10579
  };
10580
10580
 
10581
10581
  /* eslint-disable import/no-extraneous-dependencies */
10582
- const QuarterPicker = ({
10583
- availableQuarters,
10584
- // ["Q1-2024"]
10585
- label,
10586
- onChange,
10587
- borderRadius,
10588
- required,
10589
- width,
10590
- height,
10591
- placeholder,
10592
- disabled,
10593
- borderColor,
10594
- borderColorFocus,
10595
- textColor,
10596
- selectedValue,
10597
- startYear
10598
- }) => {
10582
+ const QuarterPicker = _ref => {
10583
+ let {
10584
+ availableQuarters,
10585
+ // ["Q1-2024"]
10586
+ label,
10587
+ onChange,
10588
+ borderRadius,
10589
+ required,
10590
+ width,
10591
+ height,
10592
+ placeholder,
10593
+ disabled,
10594
+ borderColor,
10595
+ borderColorFocus,
10596
+ textColor,
10597
+ selectedValue,
10598
+ startYear
10599
+ } = _ref;
10599
10600
  const [isFocused, setIsFocused] = useState(false);
10600
10601
  const [isOpen, setIsOpen] = useState(false);
10601
10602
  const [value, setValue] = useState('');
@@ -11037,22 +11038,23 @@ const MonthPopupPicker = ({
11037
11038
  };
11038
11039
 
11039
11040
  /* eslint-disable import/no-extraneous-dependencies */
11040
- const MonthPicker = ({
11041
- availableMonths,
11042
- label,
11043
- onChange,
11044
- borderRadius,
11045
- required,
11046
- width,
11047
- height,
11048
- placeholder,
11049
- disabled,
11050
- borderColor,
11051
- borderColorFocus,
11052
- textColor,
11053
- selectedValue,
11054
- startYear
11055
- }) => {
11041
+ const MonthPicker = _ref => {
11042
+ let {
11043
+ availableMonths,
11044
+ label,
11045
+ onChange,
11046
+ borderRadius,
11047
+ required,
11048
+ width,
11049
+ height,
11050
+ placeholder,
11051
+ disabled,
11052
+ borderColor,
11053
+ borderColorFocus,
11054
+ textColor,
11055
+ selectedValue,
11056
+ startYear
11057
+ } = _ref;
11056
11058
  const [isFocused, setIsFocused] = useState(false);
11057
11059
  const [isOpen, setIsOpen] = useState(false);
11058
11060
  const [value, setValue] = useState('');
@@ -34874,17 +34876,18 @@ css`
34874
34876
  * • onApply(start,end) — callback, both numbers (inclusive)
34875
34877
  * • onCancel() — callback
34876
34878
  */
34877
- const WeeksCalendar = ({
34878
- year,
34879
- defaultStartWeek = null,
34880
- defaultEndWeek = null,
34881
- backgroundColor = "#066768",
34882
- hoverBackgroundColor = "#E6F0F0",
34883
- allowedWeekRange = null,
34884
- // New prop for range restriction
34885
- onApply,
34886
- onCancel
34887
- }) => {
34879
+ const WeeksCalendar = _ref => {
34880
+ let {
34881
+ year,
34882
+ defaultStartWeek = null,
34883
+ defaultEndWeek = null,
34884
+ backgroundColor = "#066768",
34885
+ hoverBackgroundColor = "#E6F0F0",
34886
+ allowedWeekRange = null,
34887
+ // New prop for range restriction
34888
+ onApply,
34889
+ onCancel
34890
+ } = _ref;
34888
34891
  // state -------------------------------------------------
34889
34892
  const [startWeek, setStartWeek] = useState(defaultStartWeek);
34890
34893
  const [endWeek, setEndWeek] = useState(defaultEndWeek);
@@ -35023,28 +35026,22 @@ const StyledInput$1 = styled.input`
35023
35026
  box-sizing: border-box;
35024
35027
  color: ${props => props.disabled ? '#888' : (props.isFocused || props.value ? props.textColor : '#757575') || '#333'};
35025
35028
  cursor: ${props => props.disabled ? 'not-allowed' : 'text'};
35026
-
35027
- &:disabled {
35028
- background-color: #f5f5f5;
35029
- cursor: not-allowed;
35030
- }
35031
35029
  `;
35032
35030
  const StyledLabel = styled.label`
35033
35031
  font-size: 14px;
35032
+ /* width: ${props => props.isFocused || props.hasValue ? 'auto' : '150px'}; */
35034
35033
  color: ${props => props.disabled ? '#888' : (props.isFocused || props.hasValue ? props.borderColorFocus : '#757575') || '#333'};
35035
35034
  position: absolute;
35036
35035
  top: ${props => props.isFocused || props.hasValue ? '0px' : '50%'};
35037
35036
  left: 15px;
35038
35037
  background-color: ${props => props.isFocused || props.hasValue ? 'white' : 'transparent'};
35039
35038
  transform: translateY(-50%);
35040
- transition: top 0.3s ease, font-size 0.3s ease, color 0.3s ease;
35039
+ transition: top 0.3s ease, font-size 0.3s ease;
35041
35040
  display: flex;
35042
35041
  font-weight: 400;
35043
35042
  align-items: center;
35044
35043
  box-sizing: border-box;
35045
- cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
35046
- padding: 0 4px;
35047
- z-index: 1;
35044
+ cursor: pointer;
35048
35045
  `;
35049
35046
  const RequiredIndicator = styled.span`
35050
35047
  color: red;
@@ -35060,13 +35057,9 @@ const OptionsContainer = styled.div`
35060
35057
  z-index: 999;
35061
35058
  ${props => props.showAbove ? `
35062
35059
  bottom: 100%;
35063
- margin-bottom: 4px;
35064
35060
  ` : `
35065
35061
  top: 100%;
35066
- margin-top: 4px;
35067
35062
  `}
35068
- left: 0;
35069
- right: 0;
35070
35063
  `;
35071
35064
  const InputContainer$1 = styled.div`
35072
35065
  display: flex;
@@ -35079,22 +35072,20 @@ const InputContainer$1 = styled.div`
35079
35072
  width: 100%;
35080
35073
  height: 100%;
35081
35074
  box-sizing: border-box;
35082
- background-color: ${props => props.disabled ? '#f5f5f5' : 'transparent'};
35083
- border: 1px solid ${props => props.disabled ? '#bdbdbd' : props.error ? 'red' : '#B1B1B1'};
35075
+ background-color: transparent;
35076
+ border: 1px solid ${props => props.disabled ? '#bdbdbd' : props.error ? 'red' : '#B1B1B1'};
35084
35077
  font-weight: 400;
35085
35078
  font-size: 14px;
35086
35079
  border-radius: 12px;
35087
35080
  outline: none;
35088
35081
  color: ${props => props.disabled ? '#888' : '#212121'};
35089
- position: relative;
35090
- transition: border-color 0.3s ease, background-color 0.3s ease;
35091
35082
 
35092
35083
  &:hover {
35093
35084
  border: 1px solid ${props => props.disabled ? '#bdbdbd' : props.error ? 'red' : props.borderColorFocus || '#212121'};
35094
35085
  cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
35095
35086
  }
35096
35087
 
35097
- &:focus-within {
35088
+ &:focus {
35098
35089
  border: 1px solid ${props => props.disabled ? '#bdbdbd' : props.error ? 'red' : props.borderColorFocus || '#212121'};
35099
35090
  }
35100
35091
  `;
@@ -35104,11 +35095,6 @@ const CalendarDiv = styled.div`
35104
35095
  right: 10px;
35105
35096
  display: flex;
35106
35097
  align-items: center;
35107
- cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
35108
-
35109
- svg {
35110
- transition: fill 0.3s ease;
35111
- }
35112
35098
  `;
35113
35099
 
35114
35100
  // src/components/WeeksPicker/WeeksPicker.jsx
@@ -40092,6 +40078,13 @@ const TableBody = /*#__PURE__*/forwardRef(({
40092
40078
  onCheckboxClick = () => {},
40093
40079
  onHeaderCheckboxClick = () => {}
40094
40080
  }, ref) => {
40081
+ // MOVE ALL VALIDATION TO THE VERY TOP BEFORE ANY HOOKS
40082
+ if (!Array.isArray(data) || !Array.isArray(columns)) {
40083
+ console.warn("TableBody: Invalid data or columns prop");
40084
+ return null;
40085
+ }
40086
+
40087
+ // NOW ALL THE HOOKS CAN BE CALLED SAFELY
40095
40088
  const [hoveredRowIndex, setHoveredRowIndex] = useState(null);
40096
40089
  const [focusedRowIndex, setFocusedRowIndex] = useState(null);
40097
40090
  const [isCommentModalOpen, setIsCommentModalOpen] = useState(false);
@@ -40104,12 +40097,6 @@ const TableBody = /*#__PURE__*/forwardRef(({
40104
40097
  const [hasUserInteracted, setHasUserInteracted] = useState(false);
40105
40098
  const [hasInitialValue, setHasInitialValue] = useState(false);
40106
40099
 
40107
- // Early return for invalid data
40108
- if (!Array.isArray(data) || !Array.isArray(columns)) {
40109
- console.warn("TableBody: Invalid data or columns prop");
40110
- return null;
40111
- }
40112
-
40113
40100
  // Expose methods to parent component via ref
40114
40101
  useImperativeHandle(ref, () => ({
40115
40102
  clearFocus: () => {
@@ -40682,7 +40669,7 @@ const TableBody = /*#__PURE__*/forwardRef(({
40682
40669
  };
40683
40670
  }, []);
40684
40671
 
40685
- // Return null if no data
40672
+ // HANDLE SPECIAL CASE: EMPTY DATA AFTER ALL HOOKS
40686
40673
  if (data.length === 0) {
40687
40674
  return /*#__PURE__*/React$1.createElement(StyledTableBody, {
40688
40675
  ref: ref
@@ -54556,10 +54543,11 @@ const DropdownList = styled.ul`
54556
54543
  `}
54557
54544
  `;
54558
54545
  const SectionDiv = styled.div`
54559
- ${({
54560
- $showBorder,
54561
- margin
54562
- }) => {
54546
+ ${_ref => {
54547
+ let {
54548
+ $showBorder,
54549
+ margin
54550
+ } = _ref;
54563
54551
  switch ($showBorder) {
54564
54552
  case 'Template Offer':
54565
54553
  return css`border-top: 1px solid #e6e2e2ff;
@@ -54744,15 +54732,16 @@ function validateField(value, param) {
54744
54732
  if (param.type === 'percent' && Number(value) > 100) return 'Max 100%';
54745
54733
  return null;
54746
54734
  }
54747
- const OverlayTemplateDialog = ({
54748
- open,
54749
- onClose,
54750
- onApply,
54751
- template,
54752
- params,
54753
- buttonColor = '#1db6ab',
54754
- buttonHoverColor = '#066768'
54755
- }) => {
54735
+ const OverlayTemplateDialog = _ref => {
54736
+ let {
54737
+ open,
54738
+ onClose,
54739
+ onApply,
54740
+ template,
54741
+ params,
54742
+ buttonColor = '#1db6ab',
54743
+ buttonHoverColor = '#066768'
54744
+ } = _ref;
54756
54745
  const [fields, setFields] = useState(() => params.map(() => ''));
54757
54746
  const [touched, setTouched] = useState(() => params.map(() => false));
54758
54747
  if (!open) return null;