qlu-20-ui-library 1.10.16 → 1.10.18

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.
@@ -6,7 +6,7 @@ interface DropDownButtonProps {
6
6
  width?: string;
7
7
  disabled?: boolean;
8
8
  dataCy?: string;
9
- whiteListedRef?: React.RefObject<HTMLDivElement>;
9
+ whiteListedRef?: React.RefObject<HTMLDivElement | null>;
10
10
  isOpen?: boolean;
11
11
  handleOpen?: (isOpen: boolean) => void;
12
12
  customRootElem?: HTMLDivElement;
@@ -65,7 +65,7 @@ function AreaChart({ values, valuesFormatter = formatterForUSD, xStepSize, yStep
65
65
  },
66
66
  label: function (context) {
67
67
  const label = context.parsed.y;
68
- return formatterForUSD.format(label);
68
+ return label ? formatterForUSD.format(label) : "$0";
69
69
  },
70
70
  },
71
71
  bodyColor: "#FF8D4E",
@@ -9,7 +9,7 @@ function BarLineChart({ values, view = "both", showLegend = true, valuesFormatte
9
9
  transformedValues.forEach((value) => {
10
10
  transformedLabels.push([value.key.split("\n")]);
11
11
  });
12
- const maxValue = Math.max(...transformedValues.map(v => v.value));
12
+ const maxValue = Math.max(...transformedValues.map((v) => v.value));
13
13
  const minVisiblePercentage = 0.07;
14
14
  const options = {
15
15
  responsive: true,
@@ -107,12 +107,12 @@ function BarLineChart({ values, view = "both", showLegend = true, valuesFormatte
107
107
  if (context.dataset.type === "bar") {
108
108
  const barDataset = context.dataset;
109
109
  const realValue = barDataset.realData?.[context.dataIndex] ?? context.parsed.y;
110
- return valuesFormatter.format(realValue);
110
+ return realValue ? valuesFormatter.format(realValue) : "$0";
111
111
  }
112
112
  if (context.dataset.type === "line") {
113
113
  const lineDataset = context.dataset;
114
114
  const realValue = lineDataset.realData?.[context.dataIndex] ?? context.parsed.y;
115
- return valuesFormatter.format(realValue);
115
+ return realValue ? valuesFormatter.format(realValue) : "$0";
116
116
  }
117
117
  },
118
118
  },
@@ -146,13 +146,13 @@ function BarLineChart({ values, view = "both", showLegend = true, valuesFormatte
146
146
  };
147
147
  const lineData = {
148
148
  type: "line",
149
- data: transformedValues.map(val => {
149
+ data: transformedValues.map((val) => {
150
150
  const actualValue = val.value;
151
151
  return actualValue < maxValue * minVisiblePercentage && actualValue !== 0
152
152
  ? maxValue * minVisiblePercentage
153
153
  : actualValue;
154
154
  }),
155
- realData: transformedValues.map(val => val.value),
155
+ realData: transformedValues.map((val) => val.value),
156
156
  pointBackgroundColor: "#331C10",
157
157
  pointRadius: (context) => {
158
158
  if (startsFromZeroVariant) {
@@ -191,14 +191,14 @@ function BarLineChart({ values, view = "both", showLegend = true, valuesFormatte
191
191
  };
192
192
  const barData = {
193
193
  type: "bar",
194
- data: transformedValues.map(val => {
194
+ data: transformedValues.map((val) => {
195
195
  const actualValue = val.value;
196
196
  // If the value is very small compared to max, boost it to minimum visible height
197
197
  return actualValue < maxValue * minVisiblePercentage && actualValue !== 0
198
198
  ? maxValue * minVisiblePercentage
199
199
  : actualValue;
200
200
  }),
201
- realData: transformedValues.map(val => val.value),
201
+ realData: transformedValues.map((val) => val.value),
202
202
  label: "",
203
203
  borderWidth: 1,
204
204
  backgroundColor: (context) => {
@@ -4,15 +4,15 @@ import clsx from "clsx";
4
4
  const CustomDayContent = (props) => {
5
5
  const event = props.eventsData?.find((entry) => {
6
6
  const date = new Date(entry.date);
7
- return (date.getDate() === props.date.getDate() &&
8
- date.getMonth() === props.date.getMonth() &&
9
- date.getFullYear() === props.date.getFullYear());
7
+ return (date.getDate() === props.day.date.getDate() &&
8
+ date.getMonth() === props.day.date.getMonth() &&
9
+ date.getFullYear() === props.day.date.getFullYear());
10
10
  });
11
- const isDisabled = props.date.getTime() > new Date().getTime();
11
+ const isDisabled = props.day.date.getTime() > new Date().getTime();
12
12
  const dayCellClasses = clsx({
13
13
  "daypicker-day-cell-content": true,
14
14
  disabled: isDisabled,
15
15
  });
16
- return (_jsx(Tooltip, { content: event?.name || "", toolTipPosition: "top", isDisabled: !event, children: _jsxs("span", { className: dayCellClasses, children: [props.date.getDate(), !!event && _jsx("span", { className: "event-dot" })] }) }));
16
+ return (_jsx(Tooltip, { content: event?.name || "", toolTipPosition: "top", isDisabled: !event, children: _jsxs("span", { className: dayCellClasses, children: [props.day.date.getDate(), !!event && _jsx("span", { className: "event-dot" })] }) }));
17
17
  };
18
18
  export default CustomDayContent;
@@ -26,14 +26,15 @@ function DatePicker({ onDateSelected, initialValue, eventsData, timezone, custom
26
26
  newDate.setMonth(selectedMonth.getMonth() + 1);
27
27
  setSelectedMonth(newDate);
28
28
  };
29
- const formatCaption = (date) => {
30
- const months = date.toLocaleString("en-US", { month: "long" });
31
- return (_jsxs("div", { className: "datePicker-customCaption", children: [_jsx("span", { className: "datePicker-prevMonthArrow", onClick: handlePrevMonthClick, children: _jsx(GetSvgIcon, { iconType: "arrowLeft", iconSize: "32" }) }), months, " ", date.getFullYear(), _jsx("span", { className: "datePicker-nextMonthArrow", onClick: handleNextMonthClick, children: _jsx(GetSvgIcon, { iconType: "arrowRight", iconSize: "32" }) })] }));
32
- };
33
29
  const formatWeekday = (date) => {
34
30
  const weekdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
35
31
  return weekdays[date.getDay()];
36
32
  };
33
+ const CustomCaption = ({ calendarMonth, displayIndex, ...props }) => {
34
+ const displayMonth = calendarMonth.date;
35
+ const months = displayMonth.toLocaleString("en-US", { month: "long" });
36
+ return (_jsxs("div", { className: "datePicker-customCaption", ...props, children: [_jsx("span", { className: "datePicker-prevMonthArrow", onClick: handlePrevMonthClick, children: _jsx(GetSvgIcon, { iconType: "arrowLeft", iconSize: "32" }) }), months, " ", displayMonth.getFullYear(), _jsx("span", { className: "datePicker-nextMonthArrow", onClick: handleNextMonthClick, children: _jsx(GetSvgIcon, { iconType: "arrowRight", iconSize: "32" }) })] }));
37
+ };
37
38
  const [dropdownPosition, setDropdownPosition] = useState({ x: 0, y: 0, direction: "top" });
38
39
  const dropdownRef = useRef(null);
39
40
  const mainRef = useRef(null);
@@ -105,8 +106,9 @@ function DatePicker({ onDateSelected, initialValue, eventsData, timezone, custom
105
106
  setSelectedDate(props[0]);
106
107
  onDateSelected(props[0]);
107
108
  }
108
- }, footer: footer, formatters: { formatCaption, formatWeekdayName: formatWeekday }, showOutsideDays: true, components: {
109
- DayContent: (props) => (_jsx(CustomDayContent, { date: props.date, displayMonth: props.displayMonth, eventsData: eventsData })),
109
+ }, footer: footer, formatters: { formatWeekdayName: formatWeekday }, showOutsideDays: true, components: {
110
+ MonthCaption: CustomCaption,
111
+ Day: (props) => (_jsx(CustomDayContent, { day: props.day, modifiers: props.modifiers, eventsData: eventsData })),
110
112
  }, classNames: { day: "datepicker-day-cell" } }) }), customRootElem || document.body)] }));
111
113
  }
112
114
  export default DatePicker;
@@ -7,7 +7,7 @@ interface DropDownButtonProps {
7
7
  width?: string;
8
8
  disabled?: boolean;
9
9
  dataCy?: string;
10
- whiteListedRef?: React.RefObject<HTMLDivElement>;
10
+ whiteListedRef?: React.RefObject<HTMLDivElement | null>;
11
11
  isOpen?: boolean;
12
12
  handleOpen?: (isOpen: boolean) => void;
13
13
  customRootElem?: HTMLDivElement;
@@ -3,10 +3,10 @@ import Tooltip from "../Tooltip";
3
3
  const CustomDayContent = (props) => {
4
4
  const event = props.eventsData?.find((entry) => {
5
5
  const date = new Date(entry.date);
6
- return (date.getDate() === props.date.getDate() &&
7
- date.getMonth() === props.date.getMonth() &&
8
- date.getFullYear() === props.date.getFullYear());
6
+ return (date.getDate() === props.day.date.getDate() &&
7
+ date.getMonth() === props.day.date.getMonth() &&
8
+ date.getFullYear() === props.day.date.getFullYear());
9
9
  });
10
- return (_jsx(Tooltip, { content: event?.name || "", toolTipPosition: "top", isDisabled: !event, children: _jsxs("span", { className: "daypicker-day-cell-content", children: [props.date.getDate(), !!event && _jsx("span", { className: "event-dot" })] }) }));
10
+ return (_jsx(Tooltip, { content: event?.name || "", toolTipPosition: "top", isDisabled: !event, children: _jsxs("span", { className: "daypicker-day-cell-content", children: [props.day.date.getDate(), !!event && _jsx("span", { className: "event-dot" })] }) }));
11
11
  };
12
12
  export default CustomDayContent;
@@ -26,9 +26,10 @@ const DatePicker = ({ disabledUntil, disableWeekends = false, onDateSelected, in
26
26
  newDate.setMonth(selectedMonth.getMonth() + 1);
27
27
  setSelectedMonth(newDate);
28
28
  };
29
- const formatCaption = (date) => {
30
- const months = date.toLocaleString("en-US", { month: "long" });
31
- return (_jsxs("div", { className: "datePicker-customCaption", children: [_jsx("span", { className: "datePicker-prevMonthArrow", onClick: handlePrevMonthClick, children: _jsx(GetSvgIcon, { iconType: "arrowLeft", iconSize: "32" }) }), months, " ", date.getFullYear(), _jsx("span", { className: "datePicker-nextMonthArrow", onClick: handleNextMonthClick, children: _jsx(GetSvgIcon, { iconType: "arrowRight", iconSize: "32" }) })] }));
29
+ const CustomCaption = ({ calendarMonth, displayIndex, ...props }) => {
30
+ const displayMonth = calendarMonth.date;
31
+ const months = displayMonth.toLocaleString("en-US", { month: "long" });
32
+ return (_jsxs("div", { className: "datePicker-customCaption", ...props, children: [_jsx("span", { className: "datePicker-prevMonthArrow", onClick: handlePrevMonthClick, children: _jsx(GetSvgIcon, { iconType: "arrowLeft", iconSize: "32" }) }), months, " ", displayMonth.getFullYear(), _jsx("span", { className: "datePicker-nextMonthArrow", onClick: handleNextMonthClick, children: _jsx(GetSvgIcon, { iconType: "arrowRight", iconSize: "32" }) })] }));
32
33
  };
33
34
  const formatWeekday = (date) => {
34
35
  const weekdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
@@ -120,8 +121,9 @@ const DatePicker = ({ disabledUntil, disableWeekends = false, onDateSelected, in
120
121
  }, selected: selectedDate, onSelect: (...props) => {
121
122
  props?.[3]?.stopPropagation?.();
122
123
  setSelectedDate(props[0]);
123
- }, footer: footer, formatters: { formatCaption, formatWeekdayName: formatWeekday }, showOutsideDays: true, components: {
124
- DayContent: (props) => (_jsx(CustomDayContent, { date: props.date, displayMonth: props.displayMonth, eventsData: eventsData })),
124
+ }, footer: footer, formatters: { formatWeekdayName: formatWeekday }, showOutsideDays: true, components: {
125
+ MonthCaption: CustomCaption,
126
+ Day: (props) => (_jsx(CustomDayContent, { day: props.day, modifiers: props.modifiers, eventsData: eventsData })),
125
127
  }, classNames: { day: "datepicker-day-cell" } }) }), customRootElem || rootElem.current)] }));
126
128
  };
127
129
  export default DatePicker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qlu-20-ui-library",
3
- "version": "1.10.16",
3
+ "version": "1.10.18",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -9,7 +9,7 @@
9
9
  "preview": "vite preview",
10
10
  "storybook": "storybook dev -p 6006",
11
11
  "build-storybook": "storybook build",
12
- "local": "rimraf dist && tsc && vite build && npm pack",
12
+ "local": "tsc && vite build && npm pack",
13
13
  "deployment": "rm -rf dist/* && tsc && vite build",
14
14
  "changeset": "changeset"
15
15
  },
@@ -36,22 +36,22 @@
36
36
  "chart.js": "^4.3.0",
37
37
  "react-chartjs-2": "^5.2.0",
38
38
  "react-datepicker": "^7.5.0",
39
- "react-day-picker": "^8.8.1",
39
+ "react-day-picker": "^9.11.3",
40
40
  "react-flags-select": "^2.2.3",
41
- "react-loader-spinner": "^6.1.6",
41
+ "react-loader-spinner": "^8.0.0",
42
42
  "react-modal": "^3.16.3",
43
43
  "react-table": "^7.8.0",
44
- "react-toastify": "^10.0.6",
45
- "react-tooltip": "^5.28.0",
46
- "recharts": "^2.13.3",
44
+ "react-toastify": "10.0.6",
45
+ "react-tooltip": "^5.30.0",
46
+ "recharts": "^2.15.0",
47
47
  "sass": "^1.89.2",
48
48
  "tiptap-extension-font-size": "^1.2.0",
49
49
  "uuid": "^11.0.3",
50
50
  "vite-plugin-dts": "^2.3.0"
51
51
  },
52
52
  "peerDependencies": {
53
- "react": "18.2.0",
54
- "react-dom": "18.2.0"
53
+ "react": "^18.2.0 || ^19.0.0",
54
+ "react-dom": "^18.2.0 || ^19.0.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@changesets/cli": "^2.29.5",