cr-ui-lib 1.1.116 → 1.1.118

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.d.mts CHANGED
@@ -254,9 +254,10 @@ declare type SingleSelectDropdownProps = {
254
254
  selectedColorDropdownItem?: string;
255
255
  uniqueSearch?: boolean;
256
256
  emptyMessageClass?: string;
257
+ marginTopDropdown?: number;
257
258
  };
258
259
  declare function SingleSelectDropdown({ label, value, onChange, options, placeholder, onScrollToEnd, onSearch, hasMore, isLoading, searchable, searchDebounceMs, requiresSearch, minSearchLength, emptyMessage, loadingMessage, searchPlaceholder, disabled, hasIcon, buttonClass, labelClass, displayItemClass, displayMainClass, hasSearchIcon, searchInputClass, placeholderSearchClass, usePortal, // default true
259
- iconClass, placeholderClass, displayContainerClass, selectedColorDropdownItem, uniqueSearch, emptyMessageClass, }: SingleSelectDropdownProps): JSX.Element;
260
+ iconClass, placeholderClass, displayContainerClass, selectedColorDropdownItem, uniqueSearch, emptyMessageClass, marginTopDropdown }: SingleSelectDropdownProps): JSX.Element;
260
261
 
261
262
  interface SelectionButton {
262
263
  data: string[];
package/dist/index.d.ts CHANGED
@@ -254,9 +254,10 @@ declare type SingleSelectDropdownProps = {
254
254
  selectedColorDropdownItem?: string;
255
255
  uniqueSearch?: boolean;
256
256
  emptyMessageClass?: string;
257
+ marginTopDropdown?: number;
257
258
  };
258
259
  declare function SingleSelectDropdown({ label, value, onChange, options, placeholder, onScrollToEnd, onSearch, hasMore, isLoading, searchable, searchDebounceMs, requiresSearch, minSearchLength, emptyMessage, loadingMessage, searchPlaceholder, disabled, hasIcon, buttonClass, labelClass, displayItemClass, displayMainClass, hasSearchIcon, searchInputClass, placeholderSearchClass, usePortal, // default true
259
- iconClass, placeholderClass, displayContainerClass, selectedColorDropdownItem, uniqueSearch, emptyMessageClass, }: SingleSelectDropdownProps): JSX.Element;
260
+ iconClass, placeholderClass, displayContainerClass, selectedColorDropdownItem, uniqueSearch, emptyMessageClass, marginTopDropdown }: SingleSelectDropdownProps): JSX.Element;
260
261
 
261
262
  interface SelectionButton {
262
263
  data: string[];
package/dist/index.js CHANGED
@@ -2025,9 +2025,8 @@ var DateRangePicker = ({
2025
2025
  );
2026
2026
  const [endDate, setEndDate] = React.useState(getInitialEndDate());
2027
2027
  const [leftMonth, setLeftMonth] = React.useState(() => {
2028
- const prevMonth = /* @__PURE__ */ new Date();
2029
- prevMonth.setMonth(prevMonth.getMonth() - 1);
2030
- return prevMonth;
2028
+ const now = /* @__PURE__ */ new Date();
2029
+ return new Date(now.getFullYear(), now.getMonth() - 1, 1);
2031
2030
  });
2032
2031
  const [rightMonth, setRightMonth] = React.useState(/* @__PURE__ */ new Date());
2033
2032
  const [hoveredDate, setHoveredDate] = React.useState(null);
@@ -2140,11 +2139,17 @@ var DateRangePicker = ({
2140
2139
  ];
2141
2140
  React.useEffect(() => {
2142
2141
  if (previousLabelRef.current === "" && end_date !== "" && start_date !== "") {
2143
- setLeftMonth(new Date(start_date));
2144
- setRightMonth(new Date(end_date));
2145
- setStartDate(new Date(start_date));
2146
- setEndDate(new Date(end_date));
2147
- if (new Date(end_date) < /* @__PURE__ */ new Date() && previousLabelRef.current !== "") {
2142
+ const parsedStart = new Date(start_date);
2143
+ const parsedEnd = new Date(end_date);
2144
+ if (parsedStart.getMonth() === parsedEnd.getMonth() && parsedStart.getFullYear() === parsedEnd.getFullYear()) {
2145
+ setLeftMonth(new Date(parsedEnd.getFullYear(), parsedEnd.getMonth() - 1, 1));
2146
+ } else {
2147
+ setLeftMonth(parsedStart);
2148
+ }
2149
+ setRightMonth(parsedEnd);
2150
+ setStartDate(parsedStart);
2151
+ setEndDate(parsedEnd);
2152
+ if (parsedEnd < /* @__PURE__ */ new Date() && previousLabelRef.current !== "") {
2148
2153
  setLabel("Custom Range");
2149
2154
  }
2150
2155
  }
@@ -2686,7 +2691,7 @@ var DateRangePicker = ({
2686
2691
  setLeftCalendarView("day");
2687
2692
  setRightCalendarView("day");
2688
2693
  setLeftMonth(
2689
- originalStart ? new Date(originalStart.getFullYear(), originalStart.getMonth(), 1) : new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() - 1))
2694
+ originalStart ? new Date(originalStart.getFullYear(), originalStart.getMonth(), 1) : new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth() - 1, 1)
2690
2695
  );
2691
2696
  setRightMonth(
2692
2697
  originalEnd ? new Date(originalEnd.getFullYear(), originalEnd.getMonth(), 1) : /* @__PURE__ */ new Date()
@@ -2800,9 +2805,9 @@ var DateRangePicker = ({
2800
2805
  setStartDate(null);
2801
2806
  setEndDate(null);
2802
2807
  setRightMonth(/* @__PURE__ */ new Date());
2803
- const prev = /* @__PURE__ */ new Date();
2804
- prev.setMonth(prev.getMonth() - 1);
2805
- setLeftMonth(prev);
2808
+ const now = /* @__PURE__ */ new Date();
2809
+ setRightMonth(now);
2810
+ setLeftMonth(new Date(now.getFullYear(), now.getMonth() - 1, 1));
2806
2811
  setLeftCalendarView("day");
2807
2812
  setRightCalendarView("day");
2808
2813
  },
@@ -3497,7 +3502,8 @@ function SingleSelectDropdown({
3497
3502
  displayContainerClass = "",
3498
3503
  selectedColorDropdownItem = "text-[#131414]",
3499
3504
  uniqueSearch = false,
3500
- emptyMessageClass = "px-2 py-2 text-sm text-gray-500"
3505
+ emptyMessageClass = "px-2 py-2 text-sm text-gray-500",
3506
+ marginTopDropdown = 4
3501
3507
  }) {
3502
3508
  const [isOpen, setIsOpen] = React.useState(false);
3503
3509
  const [searchTerm, setSearchTerm] = React.useState("");
@@ -3643,7 +3649,7 @@ function SingleSelectDropdown({
3643
3649
  ref: portalRef,
3644
3650
  style: usePortal ? {
3645
3651
  position: "absolute",
3646
- top: `${dropdownPosition.top + 4}px`,
3652
+ top: `${dropdownPosition.top + marginTopDropdown}px`,
3647
3653
  left: `${dropdownPosition.left}px`,
3648
3654
  width: `${dropdownPosition.width}px`,
3649
3655
  // Add a zIndex to ensure it floats above other content
@@ -3652,7 +3658,7 @@ function SingleSelectDropdown({
3652
3658
  position: "absolute",
3653
3659
  top: "100%",
3654
3660
  left: 0,
3655
- marginTop: "4px",
3661
+ marginTop: `${marginTopDropdown}px`,
3656
3662
  width: "100%",
3657
3663
  zIndex: 99
3658
3664
  },