@secondstaxorg/sscomp 2.0.14 → 2.0.16

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
@@ -18412,8 +18412,6 @@ const ErrorMessage$5 = styled.p`
18412
18412
  `;
18413
18413
 
18414
18414
  const _jsxFileName$13 = "D:\\SSX\\Project\\Component Library\\sscomp\\src\\components\\DatePicker\\DatePicker.tsx"; function _optionalChain$C(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
18415
- // import '../../styles/typography.css'
18416
-
18417
18415
 
18418
18416
  /**
18419
18417
  * Component for picking date
@@ -18495,6 +18493,8 @@ const DatePicker = (props) => {
18495
18493
  });
18496
18494
  }, [isCalendarOpen]);
18497
18495
 
18496
+ const options = {day: '2-digit', month: 'short', year: 'numeric'};
18497
+
18498
18498
  const style = {
18499
18499
  display: 'flex',
18500
18500
  flexDirection: 'column',
@@ -18514,13 +18514,13 @@ const DatePicker = (props) => {
18514
18514
  style: {width: width ? width : '100%'}, __self: undefined, __source: {fileName: _jsxFileName$13, lineNumber: 104}}
18515
18515
  , React$1.createElement(InputField$5, { ref: ddRef, className: `date-picker-field ${validationStatus} ${isCalendarOpen ? 'focused' : ''}`, __self: undefined, __source: {fileName: _jsxFileName$13, lineNumber: 106}}
18516
18516
  , React$1.createElement('input', { type: "text", className: "sr-only", required: required,
18517
- value: !selectedDate ? '' : selectedDate , onChange: () => {
18517
+ value: !selectedDate ? '' : selectedDate ,onChange: () => {
18518
18518
  }, onInvalid: () => {
18519
18519
  setValidationStatus('error');
18520
18520
  }, __self: undefined, __source: {fileName: _jsxFileName$13, lineNumber: 107}})
18521
18521
  , React$1.createElement('input', {
18522
18522
  type: "text",
18523
- value: selectedDate ? new Date(selectedDate).toLocaleDateString() : '',
18523
+ value: selectedDate ? selectedDate.toLocaleDateString('en-GB', options) : '',
18524
18524
  readOnly: true,
18525
18525
  placeholder: `${placeholder ? placeholder : _optionalChain$C([labelOverrides, 'optionalAccess', _ => _.placeholder]) || 'Select date'}`,
18526
18526
  onClick: () => {
@@ -18705,9 +18705,9 @@ const Calendar = ({onChange,selected,disablePastDaysProp,disableFutureDaysProp,n
18705
18705
  for (let day = 1; day <= daysInMonth; day++) {
18706
18706
  const isSelected =
18707
18707
  selected &&
18708
- new Date(selected).getTime() === day &&
18709
- new Date(selected).getMonth() === month &&
18710
- new Date(selected).getFullYear() === year;
18708
+ selected.getDate() === day &&
18709
+ selected.getMonth() === month &&
18710
+ selected.getFullYear() === year;
18711
18711
  const isCurrentDay =
18712
18712
  day === today && month === td.getMonth() && year === td.getFullYear();
18713
18713
  const isPastDay =
@@ -27142,10 +27142,10 @@ const Selector = (props) => {
27142
27142
  }
27143
27143
  }else {
27144
27144
  //remove the object for other when the field is cleared
27145
- setSelectedOptions(selectedOptions.filter((item) => item.label !== 'Other'));
27146
-
27147
- selectedItem(null);
27148
- setSelectedOptions([]);
27145
+ if(selectedOptions && selectedOptions.length > 0 && selectedOptions[0].label== 'Other'){
27146
+ setSelectedOptions([]);
27147
+ selectedItem(null);
27148
+ }
27149
27149
  }
27150
27150
  }
27151
27151
  },[otherVal]);