@quillsql/react 2.16.15 → 2.16.16

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
@@ -25868,9 +25868,8 @@ var parseData2 = (data, colors, categoryKey, valueKey) => {
25868
25868
  dataPoint[valueKey] = totalValue ? rawValue * 100 / totalValue : data.length > maxItems ? 100 / (maxItems + 1) : 100 / slicedData.length;
25869
25869
  dataPoint[`raw_${valueKey}`] = parseFloat(rawValue.toFixed(2));
25870
25870
  });
25871
- const palette = colors.length >= maxItems ? colors.slice(0, maxItems) : generateArrayFromColor(colors, maxItems);
25872
25871
  const parsedData = slicedData.map((dataPoint, idx) => {
25873
- const baseColor = palette[idx % palette.length];
25872
+ const baseColor = colors.length > 0 ? idx < colors.length ? colors[idx] : colors[colors.length - 1] : "#808080";
25874
25873
  return {
25875
25874
  ...dataPoint,
25876
25875
  color: baseColor,
@@ -25888,7 +25887,7 @@ var parseData2 = (data, colors, categoryKey, valueKey) => {
25888
25887
  ),
25889
25888
  0
25890
25889
  );
25891
- const otherColor = palette[parsedData.length % palette.length] ?? palette[palette.length - 1];
25890
+ const otherColor = colors.length > 0 ? colors[colors.length - 1] : "#808080";
25892
25891
  const normalizedOtherSum = totalValue ? otherSum * 100 / totalValue : 100 / (maxItems + 1);
25893
25892
  parsedData.push({
25894
25893
  [categoryKey]: "Other",
@@ -26258,10 +26257,18 @@ var PieChartWrapper = import_react5.default.forwardRef(
26258
26257
  {
26259
26258
  data: parseData2(
26260
26259
  data,
26261
- (colorMap[category] && colorMap[category]["primary"] && generateArrayFromColor(
26262
- colorMap[category]["primary"],
26263
- data.length
26264
- )) ?? (colors.length >= data.length ? colors : generateArrayFromColor(colors, data.length)),
26260
+ (() => {
26261
+ const colorArray = colorMap[category] && colorMap[category]["primary"] && colorMap[category]["primary"] || colors;
26262
+ const containsCssVars = colorArray.some(
26263
+ (color2) => typeof color2 === "string" && color2.includes("var(")
26264
+ );
26265
+ if (containsCssVars) {
26266
+ return Array.from({ length: data.length }).map(
26267
+ (_, idx) => colorArray[idx % colorArray.length] ?? colorArray[colorArray.length - 1] ?? "#808080"
26268
+ );
26269
+ }
26270
+ return colorArray.length >= data.length ? colorArray.slice(0, data.length) : generateArrayFromColor(colorArray, data.length);
26271
+ })(),
26265
26272
  index,
26266
26273
  category
26267
26274
  ),
@@ -30422,12 +30429,18 @@ function QuillSelectComponent({
30422
30429
  const rect = buttonRef?.current?.getBoundingClientRect();
30423
30430
  if (rect) {
30424
30431
  const viewportHeight = window.innerHeight;
30425
- const availableHeight = viewportHeight - rect.bottom - 64;
30432
+ const spacing = 12;
30433
+ const availableHeight = viewportHeight - rect.bottom - spacing;
30434
+ const maxHeight = Math.max(availableHeight, 120);
30435
+ const top = Math.max(
30436
+ spacing,
30437
+ Math.min(rect.bottom, viewportHeight - maxHeight - spacing)
30438
+ );
30426
30439
  setPopoverPosition({
30427
- top: rect.bottom + window.scrollY,
30428
- left: rect.left + window.scrollX,
30440
+ top,
30441
+ left: rect.left,
30429
30442
  width: rect.width,
30430
- maxHeight: availableHeight
30443
+ maxHeight
30431
30444
  });
30432
30445
  }
30433
30446
  });
@@ -30565,11 +30578,11 @@ function QuillSelectComponent({
30565
30578
  "div",
30566
30579
  {
30567
30580
  style: {
30568
- position: "absolute",
30581
+ position: "fixed",
30569
30582
  top: `${popoverPosition?.top ?? 0}px`,
30570
30583
  left: `${popoverPosition?.left ?? 0}px`,
30571
30584
  width: `${popoverPosition?.width ?? 0}px`,
30572
- maxHeight: `${Math.max(popoverPosition?.maxHeight ?? 0, 100)}px`,
30585
+ maxHeight: `${popoverPosition?.maxHeight ?? 120}px`,
30573
30586
  minHeight: options.length > 2 ? 120 : options.length * 40,
30574
30587
  visibility: popoverPosition ? "visible" : "hidden",
30575
30588
  display: "flex",
package/dist/index.js CHANGED
@@ -25888,9 +25888,8 @@ var parseData2 = (data, colors, categoryKey, valueKey) => {
25888
25888
  dataPoint[valueKey] = totalValue ? rawValue * 100 / totalValue : data.length > maxItems ? 100 / (maxItems + 1) : 100 / slicedData.length;
25889
25889
  dataPoint[`raw_${valueKey}`] = parseFloat(rawValue.toFixed(2));
25890
25890
  });
25891
- const palette = colors.length >= maxItems ? colors.slice(0, maxItems) : generateArrayFromColor(colors, maxItems);
25892
25891
  const parsedData = slicedData.map((dataPoint, idx) => {
25893
- const baseColor = palette[idx % palette.length];
25892
+ const baseColor = colors.length > 0 ? idx < colors.length ? colors[idx] : colors[colors.length - 1] : "#808080";
25894
25893
  return {
25895
25894
  ...dataPoint,
25896
25895
  color: baseColor,
@@ -25908,7 +25907,7 @@ var parseData2 = (data, colors, categoryKey, valueKey) => {
25908
25907
  ),
25909
25908
  0
25910
25909
  );
25911
- const otherColor = palette[parsedData.length % palette.length] ?? palette[palette.length - 1];
25910
+ const otherColor = colors.length > 0 ? colors[colors.length - 1] : "#808080";
25912
25911
  const normalizedOtherSum = totalValue ? otherSum * 100 / totalValue : 100 / (maxItems + 1);
25913
25912
  parsedData.push({
25914
25913
  [categoryKey]: "Other",
@@ -26278,10 +26277,18 @@ var PieChartWrapper = React3.forwardRef(
26278
26277
  {
26279
26278
  data: parseData2(
26280
26279
  data,
26281
- (colorMap[category] && colorMap[category]["primary"] && generateArrayFromColor(
26282
- colorMap[category]["primary"],
26283
- data.length
26284
- )) ?? (colors.length >= data.length ? colors : generateArrayFromColor(colors, data.length)),
26280
+ (() => {
26281
+ const colorArray = colorMap[category] && colorMap[category]["primary"] && colorMap[category]["primary"] || colors;
26282
+ const containsCssVars = colorArray.some(
26283
+ (color2) => typeof color2 === "string" && color2.includes("var(")
26284
+ );
26285
+ if (containsCssVars) {
26286
+ return Array.from({ length: data.length }).map(
26287
+ (_, idx) => colorArray[idx % colorArray.length] ?? colorArray[colorArray.length - 1] ?? "#808080"
26288
+ );
26289
+ }
26290
+ return colorArray.length >= data.length ? colorArray.slice(0, data.length) : generateArrayFromColor(colorArray, data.length);
26291
+ })(),
26285
26292
  index,
26286
26293
  category
26287
26294
  ),
@@ -30497,12 +30504,18 @@ function QuillSelectComponent({
30497
30504
  const rect = buttonRef?.current?.getBoundingClientRect();
30498
30505
  if (rect) {
30499
30506
  const viewportHeight = window.innerHeight;
30500
- const availableHeight = viewportHeight - rect.bottom - 64;
30507
+ const spacing = 12;
30508
+ const availableHeight = viewportHeight - rect.bottom - spacing;
30509
+ const maxHeight = Math.max(availableHeight, 120);
30510
+ const top = Math.max(
30511
+ spacing,
30512
+ Math.min(rect.bottom, viewportHeight - maxHeight - spacing)
30513
+ );
30501
30514
  setPopoverPosition({
30502
- top: rect.bottom + window.scrollY,
30503
- left: rect.left + window.scrollX,
30515
+ top,
30516
+ left: rect.left,
30504
30517
  width: rect.width,
30505
- maxHeight: availableHeight
30518
+ maxHeight
30506
30519
  });
30507
30520
  }
30508
30521
  });
@@ -30640,11 +30653,11 @@ function QuillSelectComponent({
30640
30653
  "div",
30641
30654
  {
30642
30655
  style: {
30643
- position: "absolute",
30656
+ position: "fixed",
30644
30657
  top: `${popoverPosition?.top ?? 0}px`,
30645
30658
  left: `${popoverPosition?.left ?? 0}px`,
30646
30659
  width: `${popoverPosition?.width ?? 0}px`,
30647
- maxHeight: `${Math.max(popoverPosition?.maxHeight ?? 0, 100)}px`,
30660
+ maxHeight: `${popoverPosition?.maxHeight ?? 120}px`,
30648
30661
  minHeight: options.length > 2 ? 120 : options.length * 40,
30649
30662
  visibility: popoverPosition ? "visible" : "hidden",
30650
30663
  display: "flex",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillsql/react",
3
- "version": "2.16.15",
3
+ "version": "2.16.16",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {