sag_components 2.0.0-beta343 → 2.0.0-beta344
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 +113 -83
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +113 -83
- package/dist/index.js.map +1 -1
- package/dist/types/icons/CalendarIcon.d.ts +3 -5
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -636,21 +636,41 @@ const ChervronLeftIcon = _ref => {
|
|
|
636
636
|
|
|
637
637
|
const CalendarIcon = _ref => {
|
|
638
638
|
let {
|
|
639
|
-
clicked,
|
|
640
639
|
width = "14",
|
|
641
640
|
height = "14",
|
|
642
|
-
|
|
643
|
-
color
|
|
641
|
+
color = "#212121"
|
|
644
642
|
} = _ref;
|
|
645
643
|
return /*#__PURE__*/React$1.createElement("svg", {
|
|
646
644
|
width: width,
|
|
647
645
|
height: height,
|
|
648
|
-
viewBox: "0 0
|
|
646
|
+
viewBox: "0 0 24 24",
|
|
649
647
|
fill: "none",
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
648
|
+
stroke: color,
|
|
649
|
+
strokeWidth: "2",
|
|
650
|
+
strokeLinecap: "round",
|
|
651
|
+
strokeLinejoin: "round"
|
|
652
|
+
}, /*#__PURE__*/React$1.createElement("rect", {
|
|
653
|
+
x: "3",
|
|
654
|
+
y: "4",
|
|
655
|
+
width: "18",
|
|
656
|
+
height: "18",
|
|
657
|
+
rx: "2",
|
|
658
|
+
ry: "2"
|
|
659
|
+
}), /*#__PURE__*/React$1.createElement("line", {
|
|
660
|
+
x1: "16",
|
|
661
|
+
y1: "2",
|
|
662
|
+
x2: "16",
|
|
663
|
+
y2: "6"
|
|
664
|
+
}), /*#__PURE__*/React$1.createElement("line", {
|
|
665
|
+
x1: "8",
|
|
666
|
+
y1: "2",
|
|
667
|
+
x2: "8",
|
|
668
|
+
y2: "6"
|
|
669
|
+
}), /*#__PURE__*/React$1.createElement("line", {
|
|
670
|
+
x1: "3",
|
|
671
|
+
y1: "10",
|
|
672
|
+
x2: "21",
|
|
673
|
+
y2: "10"
|
|
654
674
|
}));
|
|
655
675
|
};
|
|
656
676
|
|
|
@@ -9015,28 +9035,27 @@ const IconContainer$5 = styled.div`
|
|
|
9015
9035
|
cursor: pointer;
|
|
9016
9036
|
`;
|
|
9017
9037
|
|
|
9018
|
-
const DropdownSingleNew =
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
} = _ref;
|
|
9038
|
+
const DropdownSingleNew = ({
|
|
9039
|
+
label,
|
|
9040
|
+
labelEmptyValue,
|
|
9041
|
+
options,
|
|
9042
|
+
selectedValue,
|
|
9043
|
+
onChange,
|
|
9044
|
+
required,
|
|
9045
|
+
disabled,
|
|
9046
|
+
width,
|
|
9047
|
+
height,
|
|
9048
|
+
minHeight,
|
|
9049
|
+
withMarginBottom = true,
|
|
9050
|
+
error,
|
|
9051
|
+
errorMessage,
|
|
9052
|
+
xIconShow,
|
|
9053
|
+
labelColor,
|
|
9054
|
+
showLabelOnTop,
|
|
9055
|
+
orderBy,
|
|
9056
|
+
placeHolder = "",
|
|
9057
|
+
elementType
|
|
9058
|
+
}) => {
|
|
9040
9059
|
const [isFocused, setIsFocused] = useState(false);
|
|
9041
9060
|
const [showOptions, setShowOptions] = useState(false);
|
|
9042
9061
|
const [showAbove, setShowAbove] = useState(false);
|
|
@@ -9571,29 +9590,28 @@ const IconContainer$4 = styled.div`
|
|
|
9571
9590
|
cursor: pointer;
|
|
9572
9591
|
`;
|
|
9573
9592
|
|
|
9574
|
-
const DropdownMultiNew =
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
} = _ref;
|
|
9593
|
+
const DropdownMultiNew = ({
|
|
9594
|
+
label,
|
|
9595
|
+
labelEmptyValue,
|
|
9596
|
+
options,
|
|
9597
|
+
selectedValue,
|
|
9598
|
+
onChange,
|
|
9599
|
+
required,
|
|
9600
|
+
disabled,
|
|
9601
|
+
width,
|
|
9602
|
+
height,
|
|
9603
|
+
minHeight,
|
|
9604
|
+
withMarginBottom = true,
|
|
9605
|
+
error,
|
|
9606
|
+
errorMessage,
|
|
9607
|
+
labelColor,
|
|
9608
|
+
xIconShow,
|
|
9609
|
+
checkBoxColor,
|
|
9610
|
+
showLabelOnTop,
|
|
9611
|
+
orderBy,
|
|
9612
|
+
elementType,
|
|
9613
|
+
showSelectAll = false
|
|
9614
|
+
}) => {
|
|
9597
9615
|
const [isFocused, setIsFocused] = useState(false);
|
|
9598
9616
|
const [showOptions, setShowOptions] = useState(false);
|
|
9599
9617
|
const [showAbove, setShowAbove] = useState(false);
|
|
@@ -10240,9 +10258,12 @@ const DatePicker = ({
|
|
|
10240
10258
|
if (value === '' || value === undefined) {
|
|
10241
10259
|
setStartDate(null);
|
|
10242
10260
|
setEndDate(null);
|
|
10261
|
+
setCurrentStartDate(new Date());
|
|
10243
10262
|
} else {
|
|
10244
|
-
|
|
10263
|
+
const parsedStart = new Date(startDateValue);
|
|
10264
|
+
setStartDate(parsedStart);
|
|
10245
10265
|
setEndDate(new Date(endDateValue));
|
|
10266
|
+
setCurrentStartDate(parsedStart);
|
|
10246
10267
|
}
|
|
10247
10268
|
}, [value, isOpen]);
|
|
10248
10269
|
const renderDatePicker = () => {
|
|
@@ -10356,48 +10377,61 @@ const RangePicker = _ref => {
|
|
|
10356
10377
|
const [startDateValue, setStartDateValue] = useState(null); // Added value state
|
|
10357
10378
|
const [endDateValue, setEndDateValue] = useState(null); // Added value state
|
|
10358
10379
|
|
|
10359
|
-
const
|
|
10360
|
-
const [hoverOptionsContainer, setHoverOptionsContainer] = useState(false);
|
|
10361
|
-
const inputRef = useRef(null);
|
|
10380
|
+
const containerRef = useRef(null);
|
|
10362
10381
|
useEffect(() => {
|
|
10363
10382
|
const handleClickOutside = event => {
|
|
10364
|
-
if (
|
|
10383
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
10365
10384
|
setIsFocused(false);
|
|
10385
|
+
setIsOpen(false);
|
|
10366
10386
|
}
|
|
10367
10387
|
};
|
|
10368
|
-
|
|
10369
|
-
// Add event listener for clicks on the document
|
|
10370
10388
|
document.addEventListener('mousedown', handleClickOutside);
|
|
10371
|
-
|
|
10372
|
-
// Cleanup event listener on component unmount
|
|
10373
10389
|
return () => {
|
|
10374
10390
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
10375
10391
|
};
|
|
10376
10392
|
}, []);
|
|
10377
10393
|
useEffect(() => {
|
|
10378
|
-
if (selectedValue
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
const
|
|
10394
|
+
if (!selectedValue) return;
|
|
10395
|
+
if (selectedValue.includes(' - ')) {
|
|
10396
|
+
// DD/MM/YYYY - DD/MM/YYYY format
|
|
10397
|
+
const parts = selectedValue.split(' - ');
|
|
10398
|
+
if (parts.length !== 2) return;
|
|
10399
|
+
const startDate = moment(parts[0].trim(), 'DD/MM/YYYY', true);
|
|
10400
|
+
const endDate = moment(parts[1].trim(), 'DD/MM/YYYY', true);
|
|
10401
|
+
if (!startDate.isValid() || !endDate.isValid()) return;
|
|
10402
|
+
setStartDateValue(startDate.format('MM/DD/YYYY'));
|
|
10403
|
+
setEndDateValue(endDate.format('MM/DD/YYYY'));
|
|
10404
|
+
setValue(selectedValue);
|
|
10405
|
+
} else if (selectedValue.includes('-')) {
|
|
10406
|
+
// MM/DD/YYYY-MM/DD/YYYY format
|
|
10407
|
+
const parts = selectedValue.split('-');
|
|
10408
|
+
if (parts.length !== 2) return;
|
|
10409
|
+
const startDate = new Date(parts[0].trim());
|
|
10410
|
+
const endDate = new Date(parts[1].trim());
|
|
10411
|
+
if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) return;
|
|
10382
10412
|
setStartDateValue(moment(startDate).format('MM/DD/YYYY'));
|
|
10383
10413
|
setEndDateValue(moment(endDate).format('MM/DD/YYYY'));
|
|
10384
10414
|
setValue(selectedValue);
|
|
10385
10415
|
}
|
|
10386
10416
|
}, [selectedValue]);
|
|
10387
|
-
|
|
10388
|
-
if (!
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10417
|
+
const getDisplayValue = val => {
|
|
10418
|
+
if (!val) return '';
|
|
10419
|
+
if (val.includes(' - ')) return val; // already DD/MM/YYYY - DD/MM/YYYY
|
|
10420
|
+
const parts = val.split('-');
|
|
10421
|
+
if (parts.length !== 2) return val;
|
|
10422
|
+
const start = moment(parts[0].trim(), 'MM/DD/YYYY', true);
|
|
10423
|
+
const end = moment(parts[1].trim(), 'MM/DD/YYYY', true);
|
|
10424
|
+
if (!start.isValid() || !end.isValid()) return val;
|
|
10425
|
+
return `${start.format('DD/MM/YYYY')} - ${end.format('DD/MM/YYYY')}`;
|
|
10426
|
+
};
|
|
10393
10427
|
const onChangeDate = (startDate, endDate) => {
|
|
10394
10428
|
if (startDate && endDate) {
|
|
10395
10429
|
setIsOpen(!isOpen);
|
|
10396
10430
|
setIsFocused(false);
|
|
10397
10431
|
setStartDateValue(startDate);
|
|
10398
10432
|
setEndDateValue(endDate);
|
|
10399
|
-
onChange(`${moment(startDate).format('MM/DD/YYYY')}
|
|
10400
|
-
setValue(`${moment(startDate).format('MM/DD/YYYY')}
|
|
10433
|
+
onChange(`${moment(startDate).format('MM/DD/YYYY')}-${moment(endDate).format('MM/DD/YYYY')}`);
|
|
10434
|
+
setValue(`${moment(startDate).format('MM/DD/YYYY')}-${moment(endDate).format('MM/DD/YYYY')}`);
|
|
10401
10435
|
}
|
|
10402
10436
|
};
|
|
10403
10437
|
const onChangeEvent = e => {
|
|
@@ -10422,6 +10456,7 @@ const RangePicker = _ref => {
|
|
|
10422
10456
|
};
|
|
10423
10457
|
return /*#__PURE__*/React$1.createElement(RangePickerContainer, {
|
|
10424
10458
|
className: "RangePickerContainer",
|
|
10459
|
+
ref: containerRef,
|
|
10425
10460
|
onClick: handleFocus,
|
|
10426
10461
|
width: width,
|
|
10427
10462
|
height: height
|
|
@@ -10432,22 +10467,19 @@ const RangePicker = _ref => {
|
|
|
10432
10467
|
disabled: disabled,
|
|
10433
10468
|
textColor: textColor,
|
|
10434
10469
|
borderColor: borderColor,
|
|
10435
|
-
borderColorFocus: borderColorFocus
|
|
10436
|
-
onMouseEnter: () => setHoverInputContainer(true),
|
|
10437
|
-
onMouseLeave: () => setHoverInputContainer(false)
|
|
10470
|
+
borderColorFocus: borderColorFocus
|
|
10438
10471
|
}, /*#__PURE__*/React$1.createElement(StyledLabel$3, {
|
|
10439
10472
|
className: "StyledLabel",
|
|
10440
10473
|
onClick: handleFocus,
|
|
10441
10474
|
isFocused: isFocused,
|
|
10442
|
-
hasValue: value,
|
|
10475
|
+
hasValue: getDisplayValue(value),
|
|
10443
10476
|
disabled: disabled,
|
|
10444
10477
|
textColor: textColor,
|
|
10445
10478
|
borderColor: borderColor,
|
|
10446
10479
|
borderColorFocus: borderColorFocus
|
|
10447
10480
|
}, label, required && /*#__PURE__*/React$1.createElement(RequiredIndicator$3, null, "*")), /*#__PURE__*/React$1.createElement(StyledInput$6, {
|
|
10448
10481
|
className: "StyledInput",
|
|
10449
|
-
|
|
10450
|
-
value: value,
|
|
10482
|
+
value: getDisplayValue(value),
|
|
10451
10483
|
isFocused: isFocused,
|
|
10452
10484
|
onChange: onChangeEvent,
|
|
10453
10485
|
onFocus: handleFocus,
|
|
@@ -10470,9 +10502,7 @@ const RangePicker = _ref => {
|
|
|
10470
10502
|
className: "Calendar",
|
|
10471
10503
|
fill: calendarIconColor
|
|
10472
10504
|
}))), /*#__PURE__*/React$1.createElement(OptionsContainer$5, {
|
|
10473
|
-
className: "OptionsContainer"
|
|
10474
|
-
onMouseEnter: () => setHoverOptionsContainer(true),
|
|
10475
|
-
onMouseLeave: () => setHoverOptionsContainer(false)
|
|
10505
|
+
className: "OptionsContainer"
|
|
10476
10506
|
}, /*#__PURE__*/React$1.createElement(DatePicker, {
|
|
10477
10507
|
className: "DatePicker",
|
|
10478
10508
|
isOpen: isOpen,
|