@quillsql/react 2.16.22 → 2.16.23

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
@@ -1569,6 +1569,7 @@ var init_dateRangePickerUtils = __esm({
1569
1569
  };
1570
1570
  convertPresetOptionsToSelectableList = (customIntervals, defaultIntervals) => {
1571
1571
  const customLabelMap = /* @__PURE__ */ new Map();
1572
+ const displayLabelByValue = /* @__PURE__ */ new Map();
1572
1573
  defaultIntervals.forEach((interval2) => {
1573
1574
  if (interval2.customLabel) {
1574
1575
  customLabelMap.set(interval2.label, interval2.customLabel);
@@ -1738,11 +1739,14 @@ var init_dateRangePickerUtils = __esm({
1738
1739
  }
1739
1740
  ];
1740
1741
  }
1741
- if (interval2.customLabel && createdIntervals.length > 0) {
1742
- return createdIntervals.map((i) => ({
1743
- ...i,
1744
- label: interval2.customLabel
1745
- }));
1742
+ if (createdIntervals.length > 0) {
1743
+ const displayLabel = interval2.customLabel ?? interval2.label;
1744
+ createdIntervals.forEach((createdInterval) => {
1745
+ const canonicalValue = getLabelForCustomInterval(createdInterval).toUpperCase().replace(/ /g, "_");
1746
+ if (displayLabel && canonicalValue) {
1747
+ displayLabelByValue.set(canonicalValue, displayLabel);
1748
+ }
1749
+ });
1746
1750
  }
1747
1751
  return createdIntervals;
1748
1752
  });
@@ -1798,9 +1802,10 @@ var init_dateRangePickerUtils = __esm({
1798
1802
  customLabel2 = customLabelMap.get("This year") || customLabelMap.get("Yearly");
1799
1803
  }
1800
1804
  }
1805
+ const value2 = getLabelForSubInterval(currentSubInterval).toUpperCase().replace(/ /g, "_") ?? "";
1801
1806
  presets.push({
1802
- label: customLabel2 || baseLabel,
1803
- value: getLabelForSubInterval(currentSubInterval).toUpperCase().replace(/ /g, "_") ?? "",
1807
+ label: displayLabelByValue.get(value2) || customLabel2 || baseLabel,
1808
+ value: value2,
1804
1809
  startDate: set(/* @__PURE__ */ new Date(), {
1805
1810
  year: currentYear,
1806
1811
  month: currentSubInterval.startDate.month - 1,
@@ -1832,13 +1837,14 @@ var init_dateRangePickerUtils = __esm({
1832
1837
  }
1833
1838
  const dateRange = convertCustomIntervalToDateRange(option);
1834
1839
  const generatedLabel = getLabelForCustomInterval(option);
1840
+ const value = getLabelForCustomInterval(option).toUpperCase().replace(/ /g, "_") ?? "";
1835
1841
  const customLabel = customLabelMap.get(generatedLabel);
1836
- const finalLabel = customLabel || generatedLabel;
1842
+ const finalLabel = displayLabelByValue.get(value) || customLabel || generatedLabel;
1837
1843
  return [
1838
1844
  {
1839
1845
  label: finalLabel,
1840
1846
  // Value is option label in uppercase with spaces replaced by underscores
1841
- value: getLabelForCustomInterval(option).toUpperCase().replace(/ /g, "_") ?? "",
1847
+ value,
1842
1848
  startDate: dateRange.startDate,
1843
1849
  endDate: dateRange.endDate
1844
1850
  }
@@ -2034,7 +2040,10 @@ var init_dateRangePickerUtils = __esm({
2034
2040
  getRangeFromPresetOptions = (preset, presetOptions) => {
2035
2041
  const foundPreset = presetOptions.find((elem) => elem.value === preset);
2036
2042
  if (foundPreset) {
2037
- return { startDate: foundPreset?.startDate, endDate: foundPreset?.endDate };
2043
+ return {
2044
+ startDate: foundPreset.startDate ? startOfDay(foundPreset.startDate) : foundPreset.startDate,
2045
+ endDate: foundPreset.endDate ? endOfDay(foundPreset.endDate) : foundPreset.endDate
2046
+ };
2038
2047
  } else {
2039
2048
  return { startDate: null, endDate: null };
2040
2049
  }
@@ -32771,6 +32780,7 @@ import {
32771
32780
  import {
32772
32781
  startOfMonth as startOfMonth4,
32773
32782
  endOfMonth as endOfMonth2,
32783
+ endOfDay as endOfDay4,
32774
32784
  format as format7,
32775
32785
  eachDayOfInterval,
32776
32786
  subMonths as subMonths5,
@@ -33601,24 +33611,24 @@ function DayPicker({
33601
33611
  if (localStartDate && !localEndDate) {
33602
33612
  setLocalEndDate(date);
33603
33613
  updateDateFilter({
33604
- startDate: localStartDate,
33605
- endDate: date
33614
+ startDate: startOfDay6(localStartDate),
33615
+ endDate: endOfDay4(date)
33606
33616
  });
33607
33617
  setLocalPreset("");
33608
33618
  }
33609
33619
  if (localStartDate && localEndDate && isAfter2(date, localStartDate)) {
33610
33620
  setLocalEndDate(date);
33611
33621
  updateDateFilter({
33612
- startDate: localStartDate,
33613
- endDate: date
33622
+ startDate: startOfDay6(localStartDate),
33623
+ endDate: endOfDay4(date)
33614
33624
  });
33615
33625
  setLocalPreset("");
33616
33626
  }
33617
33627
  if (localStartDate && localEndDate && isBefore2(date, localStartDate)) {
33618
33628
  setLocalStartDate(date);
33619
33629
  updateDateFilter({
33620
- startDate: date,
33621
- endDate: localEndDate
33630
+ startDate: startOfDay6(date),
33631
+ endDate: endOfDay4(localEndDate)
33622
33632
  });
33623
33633
  setLocalPreset("");
33624
33634
  }
@@ -36136,17 +36146,41 @@ var useReportInternal = (reportId) => {
36136
36146
  import equal3 from "fast-deep-equal";
36137
36147
 
36138
36148
  // src/components/Chart/MapChart.tsx
36139
- import {
36140
- ComposableMap,
36141
- Geographies,
36142
- Geography,
36143
- useMapContext
36144
- } from "react-simple-maps";
36145
- import { useEffect as useEffect13, useMemo as useMemo12, useRef as useRef11, useState as useState16 } from "react";
36149
+ import React10, { useEffect as useEffect13, useMemo as useMemo12, useRef as useRef11, useState as useState16 } from "react";
36146
36150
  init_valueFormatter();
36151
+ import usStates10m from "us-atlas/states-10m.json";
36152
+ import worldCountries50m from "world-atlas/countries-50m.json";
36147
36153
  import { jsx as jsx46, jsxs as jsxs35 } from "react/jsx-runtime";
36148
- var statesUrl = "https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json";
36149
- var countriesUrl = "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-50m.json";
36154
+ var statesGeography = usStates10m;
36155
+ var countriesGeography = worldCountries50m;
36156
+ var getSimpleMapsImport = () => {
36157
+ const majorVersion = Number.parseInt(React10.version.split(".")[0] ?? "18", 10);
36158
+ if (majorVersion >= 19) {
36159
+ const react19Maps = "@vnedyalk0v/react19-simple-maps";
36160
+ return import(
36161
+ /* @vite-ignore */
36162
+ react19Maps
36163
+ ).catch(() => {
36164
+ return import("react-simple-maps");
36165
+ });
36166
+ }
36167
+ return import("react-simple-maps");
36168
+ };
36169
+ var useSimpleMapsModule = () => {
36170
+ const [simpleMapsModule, setSimpleMapsModule] = useState16();
36171
+ useEffect13(() => {
36172
+ let mounted = true;
36173
+ getSimpleMapsImport().then((module) => {
36174
+ if (mounted) {
36175
+ setSimpleMapsModule(module);
36176
+ }
36177
+ });
36178
+ return () => {
36179
+ mounted = false;
36180
+ };
36181
+ }, []);
36182
+ return simpleMapsModule;
36183
+ };
36150
36184
  var fipsToNames = {
36151
36185
  "01": { name: "Alabama", abbreviation: "AL" },
36152
36186
  "02": { name: "Alaska", abbreviation: "AK" },
@@ -36469,6 +36503,7 @@ function USMap({
36469
36503
  className,
36470
36504
  containerStyle
36471
36505
  }) {
36506
+ const simpleMaps = useSimpleMapsModule();
36472
36507
  const containerRef = useRef11(null);
36473
36508
  const [hoveredState, setHoveredState] = useState16(
36474
36509
  void 0
@@ -36537,6 +36572,9 @@ function USMap({
36537
36572
  }
36538
36573
  );
36539
36574
  }
36575
+ if (!simpleMaps) {
36576
+ return null;
36577
+ }
36540
36578
  return /* @__PURE__ */ jsxs35(
36541
36579
  "div",
36542
36580
  {
@@ -36551,9 +36589,10 @@ function USMap({
36551
36589
  position: "relative"
36552
36590
  },
36553
36591
  children: [
36554
- /* @__PURE__ */ jsx46(ComposableMap, { projection: "geoAlbersUsa", children: /* @__PURE__ */ jsx46(
36592
+ /* @__PURE__ */ jsx46(simpleMaps.ComposableMap, { projection: "geoAlbersUsa", children: /* @__PURE__ */ jsx46(
36555
36593
  MapLayout,
36556
36594
  {
36595
+ simpleMaps,
36557
36596
  hoveredRegion: hoveredState,
36558
36597
  setHoveredRegion: setHoveredState,
36559
36598
  setHoveredCoords,
@@ -36563,7 +36602,7 @@ function USMap({
36563
36602
  colorScale,
36564
36603
  onClickChartElement,
36565
36604
  regionNames: fipsToNames,
36566
- geographyUrl: statesUrl
36605
+ geographyUrl: statesGeography
36567
36606
  }
36568
36607
  ) }),
36569
36608
  hoveredCoords && hoveredState && /* @__PURE__ */ jsx46(
@@ -36660,6 +36699,7 @@ function WorldMap({
36660
36699
  className,
36661
36700
  containerStyle
36662
36701
  }) {
36702
+ const simpleMaps = useSimpleMapsModule();
36663
36703
  const containerRef = useRef11(null);
36664
36704
  const [hoveredCountry, setHoveredCountry] = useState16(
36665
36705
  void 0
@@ -36728,6 +36768,9 @@ function WorldMap({
36728
36768
  }
36729
36769
  );
36730
36770
  }
36771
+ if (!simpleMaps) {
36772
+ return null;
36773
+ }
36731
36774
  return /* @__PURE__ */ jsxs35(
36732
36775
  "div",
36733
36776
  {
@@ -36743,9 +36786,10 @@ function WorldMap({
36743
36786
  position: "relative"
36744
36787
  },
36745
36788
  children: [
36746
- /* @__PURE__ */ jsx46(ComposableMap, { projection: "geoEqualEarth", children: /* @__PURE__ */ jsx46(
36789
+ /* @__PURE__ */ jsx46(simpleMaps.ComposableMap, { projection: "geoEqualEarth", children: /* @__PURE__ */ jsx46(
36747
36790
  MapLayout,
36748
36791
  {
36792
+ simpleMaps,
36749
36793
  hoveredRegion: hoveredCountry,
36750
36794
  setHoveredRegion: setHoveredCountry,
36751
36795
  setHoveredCoords,
@@ -36754,7 +36798,7 @@ function WorldMap({
36754
36798
  measureField,
36755
36799
  colorScale,
36756
36800
  onClickChartElement,
36757
- geographyUrl: countriesUrl,
36801
+ geographyUrl: countriesGeography,
36758
36802
  regionNames: isoToNames
36759
36803
  }
36760
36804
  ) }),
@@ -36841,6 +36885,7 @@ function WorldMap({
36841
36885
  );
36842
36886
  }
36843
36887
  function MapLayout({
36888
+ simpleMaps,
36844
36889
  geographyUrl,
36845
36890
  hoveredRegion,
36846
36891
  setHoveredRegion,
@@ -36852,19 +36897,19 @@ function MapLayout({
36852
36897
  onClickChartElement,
36853
36898
  regionNames
36854
36899
  }) {
36855
- const { projection } = useMapContext();
36900
+ const { projection } = simpleMaps.useMapContext();
36856
36901
  const [geoCentroid, setGeoCentroid] = useState16(null);
36857
36902
  useEffect13(() => {
36858
36903
  import("d3-geo").then((geo) => {
36859
36904
  setGeoCentroid(() => geo.geoCentroid);
36860
36905
  });
36861
36906
  }, []);
36862
- return /* @__PURE__ */ jsx46(Geographies, { geography: geographyUrl, children: ({ geographies }) => geographies.map((geo, index) => {
36907
+ return /* @__PURE__ */ jsx46(simpleMaps.Geographies, { geography: geographyUrl, children: ({ geographies }) => geographies.map((geo, index) => {
36863
36908
  const regionData = mappedData[geo.id] ?? mappedData[regionNames[geo.id]?.abbreviation ?? ""] ?? mappedData[regionNames[geo.id]?.name ?? ""] ?? mappedData[regionNames[geo.id]?.abbreviation?.toLowerCase() ?? ""] ?? mappedData[regionNames[geo.id]?.name?.toLowerCase() ?? ""];
36864
36909
  const value = regionData ? parseFloat(regionData[measureField]) : null;
36865
36910
  const fill = value != null ? colorScale(value) : "#D6D6DA";
36866
36911
  return /* @__PURE__ */ jsx46(
36867
- Geography,
36912
+ simpleMaps.Geography,
36868
36913
  {
36869
36914
  geography: geo,
36870
36915
  fill,
@@ -41532,9 +41577,12 @@ function Dashboard({
41532
41577
  setFilterListAddFilterPopoverIsOpen
41533
41578
  ] = useState25(false);
41534
41579
  const presetOptions = useMemo16(() => {
41535
- return populatedDashboardFilters?.[0]?.filterType === "date_range" ? convertPresetOptionsToSelectableList(
41536
- populatedDashboardFilters[0].presetOptions ?? [],
41537
- populatedDashboardFilters[0].defaultPresetRanges ?? []
41580
+ const dashboardDateFilter = populatedDashboardFilters?.find(
41581
+ (filter) => filter.filterType === "date_range"
41582
+ );
41583
+ return dashboardDateFilter ? convertPresetOptionsToSelectableList(
41584
+ dashboardDateFilter.presetOptions ?? [],
41585
+ dashboardDateFilter.defaultPresetRanges ?? []
41538
41586
  ) : defaultOptionsV2;
41539
41587
  }, [populatedDashboardFilters]);
41540
41588
  const [filterValues, setFilterValues] = useState25({});
@@ -45633,7 +45681,7 @@ init_dataFetcher();
45633
45681
  init_dates();
45634
45682
 
45635
45683
  // src/components/QuillMultiSelectSectionList.tsx
45636
- import React13, {
45684
+ import React14, {
45637
45685
  useContext as useContext25,
45638
45686
  useMemo as useMemo20,
45639
45687
  useRef as useRef18,
@@ -45659,7 +45707,7 @@ function QuillMultiSelectSectionList({
45659
45707
  const modalRef = useRef18(null);
45660
45708
  const buttonRef = useRef18(null);
45661
45709
  const debounceTimeoutId = useRef18(null);
45662
- const [searchQuery, setSearchQuery] = React13.useState("");
45710
+ const [searchQuery, setSearchQuery] = React14.useState("");
45663
45711
  useOnClickOutside_default(
45664
45712
  modalRef,
45665
45713
  (event) => {
@@ -45676,10 +45724,10 @@ function QuillMultiSelectSectionList({
45676
45724
  onChange(updatedChangeEvent);
45677
45725
  }, 200);
45678
45726
  };
45679
- const optionsLength = React13.useMemo(() => {
45727
+ const optionsLength = React14.useMemo(() => {
45680
45728
  return Object.values(options).reduce((a, b) => a + b.length, 0);
45681
45729
  }, [options]);
45682
- const filteredItems = React13.useMemo(() => {
45730
+ const filteredItems = React14.useMemo(() => {
45683
45731
  const uuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/;
45684
45732
  const sample = Object.values(options).find((arr) => arr.length > 0)?.[0];
45685
45733
  if (!sample) {
@@ -45706,7 +45754,7 @@ function QuillMultiSelectSectionList({
45706
45754
  Object.entries(filteredOptions).filter(([, value2]) => !!value2?.length).sort(([key]) => key === owner ? -1 : 1)
45707
45755
  );
45708
45756
  }, [options, searchQuery]);
45709
- const filteredLength = React13.useMemo(() => {
45757
+ const filteredLength = React14.useMemo(() => {
45710
45758
  return Object.values(filteredItems).reduce((a, b) => a + b.length, 0);
45711
45759
  }, [filteredItems]);
45712
45760
  const selectedOptionsLabel = useMemo20(() => {
@@ -49032,7 +49080,7 @@ function ChartBuilder({
49032
49080
  )
49033
49081
  }
49034
49082
  ),
49035
- (showTableFormatOptions || isAdmin) && /* @__PURE__ */ jsxs48(
49083
+ (showTableFormatOptions || isAdmin || formData.chartType === "table" && !hideTableView) && /* @__PURE__ */ jsxs48(
49036
49084
  "div",
49037
49085
  {
49038
49086
  style: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.16.22",
3
+ "version": "2.16.23",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -36,10 +36,12 @@
36
36
  "date-fns-tz": "^2.0.0",
37
37
  "fast-deep-equal": "^3.1.3",
38
38
  "idb": "^8.0.3",
39
- "jspdf": "^3.0.1",
39
+ "jspdf": "^4.2.0",
40
40
  "react-day-picker": "^9.7.0",
41
41
  "react-simple-maps": "git+https://github.com/zcreativelabs/react-simple-maps.git#b322da59a76fa789de1de77165bbef6df9beb0ef",
42
- "recharts": "^2.13.0"
42
+ "recharts": "^3.7.0",
43
+ "us-atlas": "^3.0.1",
44
+ "world-atlas": "^2.0.2"
43
45
  },
44
46
  "devDependencies": {
45
47
  "@babel/cli": "^7.25.7",
@@ -47,7 +49,7 @@
47
49
  "@babel/preset-env": "^7.25.8",
48
50
  "@babel/preset-react": "^7.25.7",
49
51
  "@babel/preset-typescript": "^7.25.7",
50
- "@playwright/test": "^1.51.1",
52
+ "@playwright/test": "^1.55.1",
51
53
  "@repo/eslint-config": "*",
52
54
  "@repo/typescript-config": "*",
53
55
  "@types/big.js": "^6.2.2",
@@ -56,8 +58,8 @@
56
58
  "@types/eslint": "^8.56.1",
57
59
  "@types/node": "^20.10.6",
58
60
  "@types/pluralize": "^0.0.33",
59
- "@types/react": "^18",
60
- "@types/react-dom": "^18",
61
+ "@types/react": "^18 || ^19",
62
+ "@types/react-dom": "^18 || ^19",
61
63
  "@types/react-simple-maps": "^3.0.6",
62
64
  "babel-plugin-inline-dotenv": "^1.7.0",
63
65
  "concurrently": "^9.0.1",
@@ -66,8 +68,14 @@
66
68
  "typescript": "^5.3.3"
67
69
  },
68
70
  "peerDependencies": {
69
- "react": "^18",
70
- "react-dom": "^18"
71
+ "@vnedyalk0v/react19-simple-maps": "*",
72
+ "react": "^18 || ^19",
73
+ "react-dom": "^18 || ^19"
74
+ },
75
+ "peerDependenciesMeta": {
76
+ "@vnedyalk0v/react19-simple-maps": {
77
+ "optional": true
78
+ }
71
79
  },
72
80
  "access": "public"
73
81
  }