@gooddata/sdk-ui-vis-commons 10.41.0-alpha.5 → 10.42.0-alpha.1

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.
Files changed (52) hide show
  1. package/esm/coloring/PatternFill.d.ts +13 -0
  2. package/esm/coloring/PatternFill.d.ts.map +1 -0
  3. package/esm/coloring/PatternFill.js +17 -0
  4. package/esm/coloring/PatternFill.js.map +1 -0
  5. package/esm/coloring/color.d.ts +25 -1
  6. package/esm/coloring/color.d.ts.map +1 -1
  7. package/esm/coloring/color.js +100 -0
  8. package/esm/coloring/color.js.map +1 -1
  9. package/esm/coloring/patternFills.d.ts +313 -0
  10. package/esm/coloring/patternFills.d.ts.map +1 -0
  11. package/esm/coloring/patternFills.js +336 -0
  12. package/esm/coloring/patternFills.js.map +1 -0
  13. package/esm/coloring/types.d.ts +21 -0
  14. package/esm/coloring/types.d.ts.map +1 -1
  15. package/esm/index.d.ts +6 -2
  16. package/esm/index.d.ts.map +1 -1
  17. package/esm/index.js +3 -1
  18. package/esm/index.js.map +1 -1
  19. package/esm/legend/FluidLegend.d.ts +2 -0
  20. package/esm/legend/FluidLegend.d.ts.map +1 -1
  21. package/esm/legend/FluidLegend.js +2 -2
  22. package/esm/legend/FluidLegend.js.map +1 -1
  23. package/esm/legend/Legend.d.ts +2 -0
  24. package/esm/legend/Legend.d.ts.map +1 -1
  25. package/esm/legend/Legend.js +4 -3
  26. package/esm/legend/Legend.js.map +1 -1
  27. package/esm/legend/LegendItem.d.ts +2 -0
  28. package/esm/legend/LegendItem.d.ts.map +1 -1
  29. package/esm/legend/LegendItem.js +111 -4
  30. package/esm/legend/LegendItem.js.map +1 -1
  31. package/esm/legend/LegendList.d.ts +2 -0
  32. package/esm/legend/LegendList.d.ts.map +1 -1
  33. package/esm/legend/LegendList.js +4 -4
  34. package/esm/legend/LegendList.js.map +1 -1
  35. package/esm/legend/PopUpLegend/PopUpLegend.d.ts +2 -0
  36. package/esm/legend/PopUpLegend/PopUpLegend.d.ts.map +1 -1
  37. package/esm/legend/PopUpLegend/PopUpLegend.js +3 -3
  38. package/esm/legend/PopUpLegend/PopUpLegend.js.map +1 -1
  39. package/esm/legend/PopUpLegend/RowLegend.d.ts +2 -0
  40. package/esm/legend/PopUpLegend/RowLegend.d.ts.map +1 -1
  41. package/esm/legend/PopUpLegend/RowLegend.js +2 -2
  42. package/esm/legend/PopUpLegend/RowLegend.js.map +1 -1
  43. package/esm/legend/StaticLegend.d.ts +2 -0
  44. package/esm/legend/StaticLegend.d.ts.map +1 -1
  45. package/esm/legend/StaticLegend.js +3 -3
  46. package/esm/legend/StaticLegend.js.map +1 -1
  47. package/esm/legend/types.d.ts +4 -1
  48. package/esm/legend/types.d.ts.map +1 -1
  49. package/esm/legend/types.js.map +1 -1
  50. package/esm/sdk-ui-vis-commons.d.ts +380 -1
  51. package/package.json +8 -8
  52. package/styles/scss/legend.scss +1 -0
@@ -22,6 +22,7 @@ import { ITheme } from '@gooddata/sdk-model';
22
22
  import { default as React_2 } from 'react';
23
23
  import { ReactElement } from 'react';
24
24
  import { Rect } from 'react-measure';
25
+ import { SVGAttributes } from 'react';
25
26
 
26
27
  /**
27
28
  * @internal
@@ -45,6 +46,11 @@ export declare function calculateHeadlineHeightFontSize(secondaryItem?: boolean,
45
46
  fontSize: number | undefined;
46
47
  };
47
48
 
49
+ /**
50
+ * @public
51
+ */
52
+ export declare type ChartFill = "solid" | "pattern" | "outline";
53
+
48
54
  /**
49
55
  * @internal
50
56
  */
@@ -140,6 +146,14 @@ export declare function getColorMappingPredicate(testValue: string): IHeaderPred
140
146
  */
141
147
  export declare function getColorPaletteFromColors(colors: string[]): IColorPalette;
142
148
 
149
+ /**
150
+ * Computes WCAG contrast ratio between two colors.
151
+ * Accepts any web color supported by `getRgbFromWebColor` (hex, rgb/rgba, named colors).
152
+ *
153
+ * @internal
154
+ */
155
+ export declare function getContrastRatio(colorA: string, colorB: string): number;
156
+
143
157
  /**
144
158
  * @internal
145
159
  * Provides responsive class for headline/kpi component based on its width and state of secondary item
@@ -164,6 +178,27 @@ export declare function getLighterColor(color: string, percent: number): string;
164
178
  */
165
179
  export declare function getLighterColorFromRGB(color: IRgbColorValue, percent: number): IRgbColorValue;
166
180
 
181
+ /**
182
+ * Returns pattern fill by index. When index is out of bounds, the pattern fill is repeated.
183
+ * @param index - index of pattern fill
184
+ *
185
+ * @internal
186
+ */
187
+ export declare function getPatternFillByIndex(index: number): IPatternOptionsObject;
188
+
189
+ /**
190
+ * Returns pattern fill by key.
191
+ * @param name - name of a pattern fill
192
+ *
193
+ * @internal
194
+ */
195
+ export declare function getPatternFillByName(name: PatternFillName): IPatternOptionsObject | undefined;
196
+
197
+ /**
198
+ * @internal
199
+ */
200
+ export declare function getRgbFromWebColor(input: string): IRgbColorValue | null;
201
+
167
202
  /**
168
203
  * @internal
169
204
  */
@@ -201,6 +236,7 @@ export declare interface IBaseLegendItem {
201
236
  color: string;
202
237
  legendIndex: number;
203
238
  yAxis: number;
239
+ pointShape?: string;
204
240
  }
205
241
 
206
242
  /**
@@ -274,6 +310,7 @@ export declare interface IFluidLegendProps {
274
310
  series: IPushpinCategoryLegendItem[];
275
311
  enableBorderRadius?: boolean | ItemBorderRadiusPredicate;
276
312
  onItemClick?(item: IPushpinCategoryLegendItem): void;
313
+ chartFill?: ChartFill;
277
314
  }
278
315
 
279
316
  /**
@@ -369,6 +406,7 @@ export declare interface ILegendProps {
369
406
  locale?: string;
370
407
  showFluidLegend?: boolean;
371
408
  enableBorderRadius?: boolean | ItemBorderRadiusPredicate;
409
+ chartFill?: ChartFill;
372
410
  onItemClick(item: ISeriesItem): void;
373
411
  validateOverHeight(legendClient: Rect): void;
374
412
  contentDimensions: {
@@ -389,6 +427,36 @@ export declare interface IPagingProps {
389
427
  buttonsOrientation?: ButtonsOrientationType;
390
428
  }
391
429
 
430
+ /**
431
+ * @internal
432
+ */
433
+ export declare type IPatternFill = (typeof PATTERN_FILLS)[number];
434
+
435
+ /**
436
+ * @internal
437
+ */
438
+ export declare interface IPatternFillProps {
439
+ patternFill: IPatternOptionsObject;
440
+ }
441
+
442
+ /**
443
+ * @internal
444
+ */
445
+ export declare interface IPatternObject {
446
+ pattern: IPatternOptionsObject;
447
+ }
448
+
449
+ /**
450
+ * @internal
451
+ */
452
+ export declare interface IPatternOptionsObject {
453
+ path: SVGAttributes<SVGPathElement>;
454
+ width: number;
455
+ height: number;
456
+ color?: string;
457
+ opacity?: number;
458
+ }
459
+
392
460
  /**
393
461
  * @internal
394
462
  */
@@ -401,6 +469,7 @@ export declare interface IPopUpLegendProps {
401
469
  containerId: string;
402
470
  customComponent?: ReactElement | null;
403
471
  customComponentName?: string;
472
+ chartFill?: ChartFill;
404
473
  }
405
474
 
406
475
  /**
@@ -437,12 +506,21 @@ export declare function isCustomPalette(palette: IColorPalette): boolean;
437
506
  export declare type ISeriesItem = {
438
507
  isVisible?: boolean;
439
508
  name?: string;
440
- color?: string;
509
+ color?: string | IPatternObject;
441
510
  type?: string;
442
511
  labelKey?: string;
443
512
  data?: string[];
513
+ pointShape?: string;
444
514
  };
445
515
 
516
+ /**
517
+ * Test whether the color is a pattern object.
518
+ * @param color - tested color object
519
+ *
520
+ * @internal
521
+ */
522
+ export declare function isPatternObject(color: string | IPatternObject | undefined): color is IPatternObject;
523
+
446
524
  /**
447
525
  * @internal
448
526
  */
@@ -459,6 +537,7 @@ export declare interface IStaticLegendProps {
459
537
  isLabelVisible?: boolean;
460
538
  onItemClick?(item: ISeriesItem): void;
461
539
  onPageChanged?: (page: number) => void;
540
+ chartFill?: ChartFill;
462
541
  }
463
542
 
464
543
  /**
@@ -512,6 +591,306 @@ export declare function parseRGBColorCode(color: string): {
512
591
  */
513
592
  export declare function parseRGBString(color: string): IRgbColorValue | null;
514
593
 
594
+ /**
595
+ * SVG patterns used in series.color.pattern Highcharts config.
596
+ *
597
+ * The array index matches the color palette index.
598
+ *
599
+ * The name is used in visualisation property that maps selected pattern to a metric, i.e., changing it is
600
+ * considered a breaking change.
601
+ *
602
+ * When a pattern "strokeWidth" is undefined, \{ "stroke": "none", "fill": currentColor \} is assumed.
603
+ *
604
+ * @internal
605
+ */
606
+ export declare const PATTERN_FILLS: readonly [{
607
+ readonly name: "diagonal_grid_small";
608
+ readonly pattern: {
609
+ readonly path: {
610
+ readonly d: "M4 0L8 4L4 8L0 4Z";
611
+ readonly strokeWidth: 1;
612
+ };
613
+ readonly width: 8;
614
+ readonly height: 8;
615
+ readonly opacity: 1;
616
+ };
617
+ }, {
618
+ readonly name: "vertical_lines_small";
619
+ readonly pattern: {
620
+ readonly path: {
621
+ readonly d: "M0 0H1V4H0Z";
622
+ readonly strokeWidth: 1;
623
+ };
624
+ readonly width: 4;
625
+ readonly height: 4;
626
+ readonly opacity: 1;
627
+ };
628
+ }, {
629
+ readonly name: "grid_small";
630
+ readonly pattern: {
631
+ readonly path: {
632
+ readonly d: "M0 0H4V4H0Z";
633
+ readonly strokeWidth: 1;
634
+ };
635
+ readonly width: 4;
636
+ readonly height: 4;
637
+ readonly opacity: 1;
638
+ };
639
+ }, {
640
+ readonly name: "horizontal_lines_small";
641
+ readonly pattern: {
642
+ readonly path: {
643
+ readonly d: "M0 0H4V1H0Z";
644
+ readonly strokeWidth: 1;
645
+ };
646
+ readonly width: 4;
647
+ readonly height: 4;
648
+ readonly opacity: 1;
649
+ };
650
+ }, {
651
+ readonly name: "wave_small";
652
+ readonly pattern: {
653
+ readonly path: {
654
+ readonly d: "M0 2 C0.7 0.6 1.3 3.4 2 2 S3.3 3.4 4 2";
655
+ readonly strokeWidth: 1;
656
+ };
657
+ readonly width: 4;
658
+ readonly height: 4;
659
+ readonly opacity: 1;
660
+ };
661
+ }, {
662
+ readonly name: "circle_small";
663
+ readonly pattern: {
664
+ readonly path: {
665
+ readonly d: "M3 2a1 1 0 1 1-2 0a1 1 0 1 1 2 0Z";
666
+ readonly strokeWidth: 0.75;
667
+ };
668
+ readonly width: 4;
669
+ readonly height: 4;
670
+ readonly opacity: 1;
671
+ };
672
+ }, {
673
+ readonly name: "waffle_small";
674
+ readonly pattern: {
675
+ readonly path: {
676
+ readonly d: "M0 0H3 M0 0V3";
677
+ readonly strokeWidth: 1;
678
+ };
679
+ readonly width: 4;
680
+ readonly height: 4;
681
+ readonly opacity: 1;
682
+ };
683
+ }, {
684
+ readonly name: "flag_small";
685
+ readonly pattern: {
686
+ readonly path: {
687
+ readonly d: "M1.5 0H3V1.5H3Z";
688
+ readonly strokeWidth: 1;
689
+ };
690
+ readonly width: 6;
691
+ readonly height: 6;
692
+ readonly opacity: 1;
693
+ };
694
+ }, {
695
+ readonly name: "dot_small";
696
+ readonly pattern: {
697
+ readonly path: {
698
+ readonly d: "M1 1 m -1 0 a 1 1 0 1 0 2 0 a 1 1 0 1 0 -2 0";
699
+ };
700
+ readonly width: 6;
701
+ readonly height: 6;
702
+ readonly opacity: 1;
703
+ };
704
+ }, {
705
+ readonly name: "pyramid_small";
706
+ readonly pattern: {
707
+ readonly path: {
708
+ readonly d: "M4 5 L7 8 L4 11 L1 8 Z";
709
+ };
710
+ readonly width: 8;
711
+ readonly height: 8;
712
+ readonly opacity: 1;
713
+ };
714
+ }, {
715
+ readonly name: "needle_small";
716
+ readonly pattern: {
717
+ readonly path: {
718
+ readonly d: "M0 0 L4 2 L2 4 L0 Z";
719
+ };
720
+ readonly width: 5;
721
+ readonly height: 5;
722
+ readonly opacity: 1;
723
+ };
724
+ }, {
725
+ readonly name: "diamond_small";
726
+ readonly pattern: {
727
+ readonly path: {
728
+ readonly d: "M4 1.75 L6.25 4 L4 6.25 L1.75 4 Z";
729
+ };
730
+ readonly width: 8;
731
+ readonly height: 8;
732
+ readonly opacity: 1;
733
+ };
734
+ }, {
735
+ readonly name: "pizza_small";
736
+ readonly pattern: {
737
+ readonly path: {
738
+ readonly d: "M6 6 m -3 0 a 3 3 0 1 0 6 0 a 3 3 0 1 0 -6 0";
739
+ };
740
+ readonly width: 6;
741
+ readonly height: 6;
742
+ readonly opacity: 1;
743
+ };
744
+ }, {
745
+ readonly name: "diagonal_grid_large";
746
+ readonly pattern: {
747
+ readonly path: {
748
+ readonly d: "M6 0L12 6L6 12L0 6Z";
749
+ readonly strokeWidth: 1;
750
+ };
751
+ readonly width: 12;
752
+ readonly height: 12;
753
+ readonly opacity: 1;
754
+ };
755
+ }, {
756
+ readonly name: "vertical_lines_large";
757
+ readonly pattern: {
758
+ readonly path: {
759
+ readonly d: "M0 0H1V8H0Z";
760
+ readonly strokeWidth: 1;
761
+ };
762
+ readonly width: 8;
763
+ readonly height: 8;
764
+ readonly opacity: 1;
765
+ };
766
+ }, {
767
+ readonly name: "grid_large";
768
+ readonly pattern: {
769
+ readonly path: {
770
+ readonly d: "M0 0H8V8H0Z";
771
+ readonly strokeWidth: 1;
772
+ };
773
+ readonly width: 8;
774
+ readonly height: 8;
775
+ readonly opacity: 1;
776
+ };
777
+ }, {
778
+ readonly name: "horizontal_lines_large";
779
+ readonly pattern: {
780
+ readonly path: {
781
+ readonly d: "M0 0H8V1H0Z";
782
+ readonly strokeWidth: 2;
783
+ };
784
+ readonly width: 8;
785
+ readonly height: 8;
786
+ readonly opacity: 1;
787
+ };
788
+ }, {
789
+ readonly name: "wave_large";
790
+ readonly pattern: {
791
+ readonly path: {
792
+ readonly d: "M0 4 C2 2 2 7 4 4 S6 7 8 4";
793
+ readonly strokeWidth: 1;
794
+ };
795
+ readonly width: 8;
796
+ readonly height: 8;
797
+ readonly opacity: 1;
798
+ };
799
+ }, {
800
+ readonly name: "circle_large";
801
+ readonly pattern: {
802
+ readonly path: {
803
+ readonly d: "M6 4a2 2 0 1 1-4 0a2 2 0 1 1 4 0Z";
804
+ readonly strokeWidth: 1;
805
+ };
806
+ readonly width: 8;
807
+ readonly height: 8;
808
+ readonly opacity: 1;
809
+ };
810
+ }, {
811
+ readonly name: "waffle_large";
812
+ readonly pattern: {
813
+ readonly path: {
814
+ readonly d: "M0 0H6 M0 0V6";
815
+ readonly strokeWidth: 2;
816
+ };
817
+ readonly width: 8;
818
+ readonly height: 8;
819
+ readonly opacity: 1;
820
+ };
821
+ }, {
822
+ readonly name: "flag_large";
823
+ readonly pattern: {
824
+ readonly path: {
825
+ readonly d: "M2 0H4V2H4Z";
826
+ readonly strokeWidth: 2;
827
+ };
828
+ readonly width: 8;
829
+ readonly height: 8;
830
+ readonly opacity: 1;
831
+ };
832
+ }, {
833
+ readonly name: "dot_large";
834
+ readonly pattern: {
835
+ readonly path: {
836
+ readonly d: "M4 4 m -1.75 0 a 1.75 1.75 0 1 0 3.5 0 a 1.75 1.75 0 1 0 -3.5 0";
837
+ };
838
+ readonly width: 8;
839
+ readonly height: 8;
840
+ readonly opacity: 1;
841
+ };
842
+ }, {
843
+ readonly name: "pyramid_large";
844
+ readonly pattern: {
845
+ readonly path: {
846
+ readonly d: "M5 6 L9 10 L5 14 L1 10 Z";
847
+ };
848
+ readonly width: 10;
849
+ readonly height: 10;
850
+ readonly opacity: 1;
851
+ };
852
+ }, {
853
+ readonly name: "needle_large";
854
+ readonly pattern: {
855
+ readonly path: {
856
+ readonly d: "M0 0 L6 3 L3 6 L0 Z";
857
+ };
858
+ readonly width: 8;
859
+ readonly height: 8;
860
+ readonly opacity: 1;
861
+ };
862
+ }, {
863
+ readonly name: "diamond_large";
864
+ readonly pattern: {
865
+ readonly path: {
866
+ readonly d: "M4 1 L7 4 L4 7 L1 4 Z";
867
+ };
868
+ readonly width: 8;
869
+ readonly height: 8;
870
+ readonly opacity: 1;
871
+ };
872
+ }, {
873
+ readonly name: "pizza_large";
874
+ readonly pattern: {
875
+ readonly path: {
876
+ readonly d: "M8 8 m -4 0 a 4 4 0 1 0 8 0 a 4 4 0 1 0 -8 0";
877
+ };
878
+ readonly width: 8;
879
+ readonly height: 8;
880
+ readonly opacity: 1;
881
+ };
882
+ }];
883
+
884
+ /**
885
+ * @internal
886
+ */
887
+ export declare function PatternFill({ patternFill }: IPatternFillProps): React_2.JSX.Element;
888
+
889
+ /**
890
+ * @internal
891
+ */
892
+ export declare type PatternFillName = (typeof PATTERN_FILLS)[number]["name"];
893
+
515
894
  /**
516
895
  * @internal
517
896
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-vis-commons",
3
- "version": "10.41.0-alpha.5",
3
+ "version": "10.42.0-alpha.1",
4
4
  "description": "GoodData.UI SDK - common functionality for different types of visualizations",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,11 +36,11 @@
36
36
  "react-intl": "6.8.9",
37
37
  "react-measure": "^2.5.2",
38
38
  "tslib": "2.8.1",
39
- "@gooddata/sdk-backend-spi": "10.41.0-alpha.5",
40
- "@gooddata/sdk-ui": "10.41.0-alpha.5",
41
- "@gooddata/sdk-ui-kit": "10.41.0-alpha.5",
42
- "@gooddata/sdk-ui-theme-provider": "10.41.0-alpha.5",
43
- "@gooddata/sdk-model": "10.41.0-alpha.5"
39
+ "@gooddata/sdk-ui": "10.42.0-alpha.1",
40
+ "@gooddata/sdk-backend-spi": "10.42.0-alpha.1",
41
+ "@gooddata/sdk-model": "10.42.0-alpha.1",
42
+ "@gooddata/sdk-ui-kit": "10.42.0-alpha.1",
43
+ "@gooddata/sdk-ui-theme-provider": "10.42.0-alpha.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@gooddata/eslint-config": "^4.1.1",
@@ -83,8 +83,8 @@
83
83
  "typescript": "5.8.3",
84
84
  "vitest": "3.2.4",
85
85
  "vitest-dom": "0.1.1",
86
- "@gooddata/reference-workspace": "10.41.0-alpha.5",
87
- "@gooddata/sdk-backend-mockingbird": "10.41.0-alpha.5"
86
+ "@gooddata/reference-workspace": "10.42.0-alpha.1",
87
+ "@gooddata/sdk-backend-mockingbird": "10.42.0-alpha.1"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "react": "^16.10.0 || ^17.0.0 || ^18.0.0",
@@ -76,6 +76,7 @@ $legend-content-background: var(--gd-chart-backgroundColor, var(--gd-palette-com
76
76
  height: 9px;
77
77
  margin-right: 5px;
78
78
  forced-color-adjust: none;
79
+ box-sizing: border-box;
79
80
  }
80
81
 
81
82
  .series-name,