@raystack/apsara 0.20.0 → 0.20.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../calendar/date-picker.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAOlE,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,aAAa,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,EACzB,IAAY,EACZ,UAAyB,EACzB,WAA0B,EAC1B,cAAc,EACd,aAAa,EACb,KAAkB,EAClB,QAAmB,GACpB,EAAE,eAAe,2CAmIjB"}
1
+ {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../calendar/date-picker.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAOlE,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,aAAa,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAED,wBAAgB,UAAU,CAAC,EACzB,IAAY,EACZ,UAAyB,EACzB,WAA0B,EAC1B,cAAc,EACd,aAAa,EACb,KAAkB,EAClB,QAAmB,GACpB,EAAE,eAAe,2CAyIjB"}
package/dist/index.cjs CHANGED
@@ -28163,6 +28163,10 @@ function DatePicker({ side = "top", dateFormat = "DD/MM/YYYY", placeholder = "DD
28163
28163
  const textFieldRef = React.useRef(null);
28164
28164
  const contentRef = React.useRef(null);
28165
28165
  const isInputFieldFocused = React.useRef(false);
28166
+ const calendarValRef = React.useRef(value);
28167
+ React.useEffect(() => {
28168
+ calendarValRef.current = calendarVal;
28169
+ }, [calendarVal]);
28166
28170
  function isElementOutside(el) {
28167
28171
  return !isDropdownOpenRef.current && // Month and Year dropdown from Date picker
28168
28172
  !textFieldRef.current?.contains(el) && // TextField
@@ -28175,12 +28179,12 @@ function DatePicker({ side = "top", dateFormat = "DD/MM/YYYY", placeholder = "DD
28175
28179
  }, []);
28176
28180
  function registerEventListeners() {
28177
28181
  isInputFieldFocused.current = true;
28178
- document.addEventListener('mouseup', handleMouseDown, true);
28182
+ document.addEventListener('mouseup', handleMouseDown);
28179
28183
  }
28180
28184
  function removeEventListeners() {
28181
28185
  isInputFieldFocused.current = false;
28182
28186
  setShowCalendar(false);
28183
- const updatedVal = dayjs(calendarVal).format(dateFormat);
28187
+ const updatedVal = dayjs(calendarValRef.current).format(dateFormat);
28184
28188
  if (textFieldRef.current)
28185
28189
  textFieldRef.current.value = updatedVal;
28186
28190
  if (inputState === undefined)
@@ -28190,6 +28194,7 @@ function DatePicker({ side = "top", dateFormat = "DD/MM/YYYY", placeholder = "DD
28190
28194
  const handleSelect = (day) => {
28191
28195
  onSelect(day);
28192
28196
  setCalendarVal(day);
28197
+ calendarValRef.current = day;
28193
28198
  setInputState(undefined);
28194
28199
  removeEventListeners();
28195
28200
  };