@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.cjs CHANGED
@@ -1534,6 +1534,7 @@ var init_dateRangePickerUtils = __esm({
1534
1534
  };
1535
1535
  convertPresetOptionsToSelectableList = (customIntervals, defaultIntervals) => {
1536
1536
  const customLabelMap = /* @__PURE__ */ new Map();
1537
+ const displayLabelByValue = /* @__PURE__ */ new Map();
1537
1538
  defaultIntervals.forEach((interval2) => {
1538
1539
  if (interval2.customLabel) {
1539
1540
  customLabelMap.set(interval2.label, interval2.customLabel);
@@ -1703,11 +1704,14 @@ var init_dateRangePickerUtils = __esm({
1703
1704
  }
1704
1705
  ];
1705
1706
  }
1706
- if (interval2.customLabel && createdIntervals.length > 0) {
1707
- return createdIntervals.map((i) => ({
1708
- ...i,
1709
- label: interval2.customLabel
1710
- }));
1707
+ if (createdIntervals.length > 0) {
1708
+ const displayLabel = interval2.customLabel ?? interval2.label;
1709
+ createdIntervals.forEach((createdInterval) => {
1710
+ const canonicalValue = getLabelForCustomInterval(createdInterval).toUpperCase().replace(/ /g, "_");
1711
+ if (displayLabel && canonicalValue) {
1712
+ displayLabelByValue.set(canonicalValue, displayLabel);
1713
+ }
1714
+ });
1711
1715
  }
1712
1716
  return createdIntervals;
1713
1717
  });
@@ -1763,9 +1767,10 @@ var init_dateRangePickerUtils = __esm({
1763
1767
  customLabel2 = customLabelMap.get("This year") || customLabelMap.get("Yearly");
1764
1768
  }
1765
1769
  }
1770
+ const value2 = getLabelForSubInterval(currentSubInterval).toUpperCase().replace(/ /g, "_") ?? "";
1766
1771
  presets.push({
1767
- label: customLabel2 || baseLabel,
1768
- value: getLabelForSubInterval(currentSubInterval).toUpperCase().replace(/ /g, "_") ?? "",
1772
+ label: displayLabelByValue.get(value2) || customLabel2 || baseLabel,
1773
+ value: value2,
1769
1774
  startDate: (0, import_date_fns2.set)(/* @__PURE__ */ new Date(), {
1770
1775
  year: currentYear,
1771
1776
  month: currentSubInterval.startDate.month - 1,
@@ -1797,13 +1802,14 @@ var init_dateRangePickerUtils = __esm({
1797
1802
  }
1798
1803
  const dateRange = convertCustomIntervalToDateRange(option);
1799
1804
  const generatedLabel = getLabelForCustomInterval(option);
1805
+ const value = getLabelForCustomInterval(option).toUpperCase().replace(/ /g, "_") ?? "";
1800
1806
  const customLabel = customLabelMap.get(generatedLabel);
1801
- const finalLabel = customLabel || generatedLabel;
1807
+ const finalLabel = displayLabelByValue.get(value) || customLabel || generatedLabel;
1802
1808
  return [
1803
1809
  {
1804
1810
  label: finalLabel,
1805
1811
  // Value is option label in uppercase with spaces replaced by underscores
1806
- value: getLabelForCustomInterval(option).toUpperCase().replace(/ /g, "_") ?? "",
1812
+ value,
1807
1813
  startDate: dateRange.startDate,
1808
1814
  endDate: dateRange.endDate
1809
1815
  }
@@ -1999,7 +2005,10 @@ var init_dateRangePickerUtils = __esm({
1999
2005
  getRangeFromPresetOptions = (preset, presetOptions) => {
2000
2006
  const foundPreset = presetOptions.find((elem) => elem.value === preset);
2001
2007
  if (foundPreset) {
2002
- return { startDate: foundPreset?.startDate, endDate: foundPreset?.endDate };
2008
+ return {
2009
+ startDate: foundPreset.startDate ? (0, import_date_fns2.startOfDay)(foundPreset.startDate) : foundPreset.startDate,
2010
+ endDate: foundPreset.endDate ? (0, import_date_fns2.endOfDay)(foundPreset.endDate) : foundPreset.endDate
2011
+ };
2003
2012
  } else {
2004
2013
  return { startDate: null, endDate: null };
2005
2014
  }
@@ -33508,24 +33517,24 @@ function DayPicker({
33508
33517
  if (localStartDate && !localEndDate) {
33509
33518
  setLocalEndDate(date);
33510
33519
  updateDateFilter({
33511
- startDate: localStartDate,
33512
- endDate: date
33520
+ startDate: (0, import_date_fns13.startOfDay)(localStartDate),
33521
+ endDate: (0, import_date_fns13.endOfDay)(date)
33513
33522
  });
33514
33523
  setLocalPreset("");
33515
33524
  }
33516
33525
  if (localStartDate && localEndDate && (0, import_date_fns13.isAfter)(date, localStartDate)) {
33517
33526
  setLocalEndDate(date);
33518
33527
  updateDateFilter({
33519
- startDate: localStartDate,
33520
- endDate: date
33528
+ startDate: (0, import_date_fns13.startOfDay)(localStartDate),
33529
+ endDate: (0, import_date_fns13.endOfDay)(date)
33521
33530
  });
33522
33531
  setLocalPreset("");
33523
33532
  }
33524
33533
  if (localStartDate && localEndDate && (0, import_date_fns13.isBefore)(date, localStartDate)) {
33525
33534
  setLocalStartDate(date);
33526
33535
  updateDateFilter({
33527
- startDate: date,
33528
- endDate: localEndDate
33536
+ startDate: (0, import_date_fns13.startOfDay)(date),
33537
+ endDate: (0, import_date_fns13.endOfDay)(localEndDate)
33529
33538
  });
33530
33539
  setLocalPreset("");
33531
33540
  }
@@ -36032,12 +36041,41 @@ var useReportInternal = (reportId) => {
36032
36041
  var import_fast_deep_equal3 = __toESM(require("fast-deep-equal"), 1);
36033
36042
 
36034
36043
  // src/components/Chart/MapChart.tsx
36035
- var import_react_simple_maps = require("react-simple-maps");
36036
- var import_react27 = require("react");
36044
+ var import_react27 = __toESM(require("react"), 1);
36037
36045
  init_valueFormatter();
36046
+ var import_states_10m = __toESM(require("us-atlas/states-10m.json"), 1);
36047
+ var import_countries_50m = __toESM(require("world-atlas/countries-50m.json"), 1);
36038
36048
  var import_jsx_runtime46 = require("react/jsx-runtime");
36039
- var statesUrl = "https://cdn.jsdelivr.net/npm/us-atlas@3/states-10m.json";
36040
- var countriesUrl = "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-50m.json";
36049
+ var statesGeography = import_states_10m.default;
36050
+ var countriesGeography = import_countries_50m.default;
36051
+ var getSimpleMapsImport = () => {
36052
+ const majorVersion = Number.parseInt(import_react27.default.version.split(".")[0] ?? "18", 10);
36053
+ if (majorVersion >= 19) {
36054
+ const react19Maps = "@vnedyalk0v/react19-simple-maps";
36055
+ return import(
36056
+ /* @vite-ignore */
36057
+ react19Maps
36058
+ ).catch(() => {
36059
+ return import("react-simple-maps");
36060
+ });
36061
+ }
36062
+ return import("react-simple-maps");
36063
+ };
36064
+ var useSimpleMapsModule = () => {
36065
+ const [simpleMapsModule, setSimpleMapsModule] = (0, import_react27.useState)();
36066
+ (0, import_react27.useEffect)(() => {
36067
+ let mounted = true;
36068
+ getSimpleMapsImport().then((module2) => {
36069
+ if (mounted) {
36070
+ setSimpleMapsModule(module2);
36071
+ }
36072
+ });
36073
+ return () => {
36074
+ mounted = false;
36075
+ };
36076
+ }, []);
36077
+ return simpleMapsModule;
36078
+ };
36041
36079
  var fipsToNames = {
36042
36080
  "01": { name: "Alabama", abbreviation: "AL" },
36043
36081
  "02": { name: "Alaska", abbreviation: "AK" },
@@ -36360,6 +36398,7 @@ function USMap({
36360
36398
  className,
36361
36399
  containerStyle
36362
36400
  }) {
36401
+ const simpleMaps = useSimpleMapsModule();
36363
36402
  const containerRef = (0, import_react27.useRef)(null);
36364
36403
  const [hoveredState, setHoveredState] = (0, import_react27.useState)(
36365
36404
  void 0
@@ -36428,6 +36467,9 @@ function USMap({
36428
36467
  }
36429
36468
  );
36430
36469
  }
36470
+ if (!simpleMaps) {
36471
+ return null;
36472
+ }
36431
36473
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
36432
36474
  "div",
36433
36475
  {
@@ -36442,9 +36484,10 @@ function USMap({
36442
36484
  position: "relative"
36443
36485
  },
36444
36486
  children: [
36445
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_simple_maps.ComposableMap, { projection: "geoAlbersUsa", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
36487
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(simpleMaps.ComposableMap, { projection: "geoAlbersUsa", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
36446
36488
  MapLayout,
36447
36489
  {
36490
+ simpleMaps,
36448
36491
  hoveredRegion: hoveredState,
36449
36492
  setHoveredRegion: setHoveredState,
36450
36493
  setHoveredCoords,
@@ -36454,7 +36497,7 @@ function USMap({
36454
36497
  colorScale,
36455
36498
  onClickChartElement,
36456
36499
  regionNames: fipsToNames,
36457
- geographyUrl: statesUrl
36500
+ geographyUrl: statesGeography
36458
36501
  }
36459
36502
  ) }),
36460
36503
  hoveredCoords && hoveredState && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
@@ -36551,6 +36594,7 @@ function WorldMap({
36551
36594
  className,
36552
36595
  containerStyle
36553
36596
  }) {
36597
+ const simpleMaps = useSimpleMapsModule();
36554
36598
  const containerRef = (0, import_react27.useRef)(null);
36555
36599
  const [hoveredCountry, setHoveredCountry] = (0, import_react27.useState)(
36556
36600
  void 0
@@ -36619,6 +36663,9 @@ function WorldMap({
36619
36663
  }
36620
36664
  );
36621
36665
  }
36666
+ if (!simpleMaps) {
36667
+ return null;
36668
+ }
36622
36669
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
36623
36670
  "div",
36624
36671
  {
@@ -36634,9 +36681,10 @@ function WorldMap({
36634
36681
  position: "relative"
36635
36682
  },
36636
36683
  children: [
36637
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_simple_maps.ComposableMap, { projection: "geoEqualEarth", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
36684
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(simpleMaps.ComposableMap, { projection: "geoEqualEarth", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
36638
36685
  MapLayout,
36639
36686
  {
36687
+ simpleMaps,
36640
36688
  hoveredRegion: hoveredCountry,
36641
36689
  setHoveredRegion: setHoveredCountry,
36642
36690
  setHoveredCoords,
@@ -36645,7 +36693,7 @@ function WorldMap({
36645
36693
  measureField,
36646
36694
  colorScale,
36647
36695
  onClickChartElement,
36648
- geographyUrl: countriesUrl,
36696
+ geographyUrl: countriesGeography,
36649
36697
  regionNames: isoToNames
36650
36698
  }
36651
36699
  ) }),
@@ -36732,6 +36780,7 @@ function WorldMap({
36732
36780
  );
36733
36781
  }
36734
36782
  function MapLayout({
36783
+ simpleMaps,
36735
36784
  geographyUrl,
36736
36785
  hoveredRegion,
36737
36786
  setHoveredRegion,
@@ -36743,19 +36792,19 @@ function MapLayout({
36743
36792
  onClickChartElement,
36744
36793
  regionNames
36745
36794
  }) {
36746
- const { projection } = (0, import_react_simple_maps.useMapContext)();
36795
+ const { projection } = simpleMaps.useMapContext();
36747
36796
  const [geoCentroid, setGeoCentroid] = (0, import_react27.useState)(null);
36748
36797
  (0, import_react27.useEffect)(() => {
36749
36798
  import("d3-geo").then((geo) => {
36750
36799
  setGeoCentroid(() => geo.geoCentroid);
36751
36800
  });
36752
36801
  }, []);
36753
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_simple_maps.Geographies, { geography: geographyUrl, children: ({ geographies }) => geographies.map((geo, index) => {
36802
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(simpleMaps.Geographies, { geography: geographyUrl, children: ({ geographies }) => geographies.map((geo, index) => {
36754
36803
  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() ?? ""];
36755
36804
  const value = regionData ? parseFloat(regionData[measureField]) : null;
36756
36805
  const fill = value != null ? colorScale(value) : "#D6D6DA";
36757
36806
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
36758
- import_react_simple_maps.Geography,
36807
+ simpleMaps.Geography,
36759
36808
  {
36760
36809
  geography: geo,
36761
36810
  fill,
@@ -41416,9 +41465,12 @@ function Dashboard({
41416
41465
  setFilterListAddFilterPopoverIsOpen
41417
41466
  ] = (0, import_react38.useState)(false);
41418
41467
  const presetOptions = (0, import_react38.useMemo)(() => {
41419
- return populatedDashboardFilters?.[0]?.filterType === "date_range" ? convertPresetOptionsToSelectableList(
41420
- populatedDashboardFilters[0].presetOptions ?? [],
41421
- populatedDashboardFilters[0].defaultPresetRanges ?? []
41468
+ const dashboardDateFilter = populatedDashboardFilters?.find(
41469
+ (filter) => filter.filterType === "date_range"
41470
+ );
41471
+ return dashboardDateFilter ? convertPresetOptionsToSelectableList(
41472
+ dashboardDateFilter.presetOptions ?? [],
41473
+ dashboardDateFilter.defaultPresetRanges ?? []
41422
41474
  ) : defaultOptionsV2;
41423
41475
  }, [populatedDashboardFilters]);
41424
41476
  const [filterValues, setFilterValues] = (0, import_react38.useState)({});
@@ -48857,7 +48909,7 @@ function ChartBuilder({
48857
48909
  )
48858
48910
  }
48859
48911
  ),
48860
- (showTableFormatOptions || isAdmin) && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
48912
+ (showTableFormatOptions || isAdmin || formData.chartType === "table" && !hideTableView) && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
48861
48913
  "div",
48862
48914
  {
48863
48915
  style: {