@economic/taco 2.57.0-charts.8 → 2.57.0

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/taco.css CHANGED
@@ -1567,9 +1567,20 @@ table[data-taco^='table'] tr[data-row-create] {
1567
1567
  @apply h-full;
1568
1568
  }
1569
1569
 
1570
+ [data-taco='card-content'] > [data-taco='chart-wrapper'] {
1571
+ container: wrapper / inline-size;
1572
+ }
1573
+
1570
1574
  [data-taco='card-content'] > [data-taco='chart-wrapper'] [data-taco='chart-donut']:not([class*='w-']),
1571
1575
  [data-taco='card-content'] > [data-taco='chart-wrapper'] [data-taco='chart-pie']:not([class*='w-']) {
1572
- @apply aspect-square w-2/3;
1576
+ @apply aspect-square w-3/5;
1577
+ }
1578
+
1579
+ @container wrapper (width > 400px) {
1580
+ [data-taco='card-content'] > [data-taco='chart-wrapper'] [data-taco='chart-donut']:not([class*='w-']),
1581
+ [data-taco='card-content'] > [data-taco='chart-wrapper'] [data-taco='chart-pie']:not([class*='w-']) {
1582
+ @apply w-2/3;
1583
+ }
1573
1584
  }
1574
1585
 
1575
1586
  .recharts-cartesian-axis line,
@@ -1598,13 +1609,9 @@ table[data-taco^='table'] tr[data-row-create] {
1598
1609
  container: wrapper / inline-size;
1599
1610
  }
1600
1611
 
1601
- [data-taco='chart-donut-total'] span:first-child {
1602
- @apply text-xl;
1603
- }
1604
-
1605
- @container wrapper (width < 100px) {
1612
+ @container wrapper (width > 130px) {
1606
1613
  [data-taco='chart-donut-total'] span:first-child {
1607
- @apply text-red text-lg;
1614
+ @apply text-xl;
1608
1615
  }
1609
1616
  }
1610
1617
 
@@ -1613,3 +1620,7 @@ table[data-taco^='table'] tr[data-row-create] {
1613
1620
  @apply text-base;
1614
1621
  }
1615
1622
  }
1623
+
1624
+ [data-taco='chart-donut']:has([data-taco='chart-tooltip']) {
1625
+ @apply relative z-10;
1626
+ }
package/dist/taco.d.ts CHANGED
@@ -13,6 +13,7 @@ import * as DialogPrimitive from '@radix-ui/react-dialog';
13
13
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
14
14
  import { IdType } from 'react-table';
15
15
  import { Matcher } from 'react-day-picker';
16
+ import { Payload } from 'recharts/types/component/DefaultLegendContent';
16
17
  import { Placement as Placement_2 } from 'react-joyride';
17
18
  import * as PopoverPrimitive from '@radix-ui/react-popover';
18
19
  import * as React_2 from 'react';
@@ -69,6 +70,8 @@ export declare interface AccordionUncontrolledProps extends AccordionBaseProps {
69
70
  onChange?: never;
70
71
  }
71
72
 
73
+ export declare type ActiveChartItems<TType> = Record<keyof TType & string, boolean>;
74
+
72
75
  export declare type Agreement = {
73
76
  adminAgreementNumber?: number;
74
77
  number: number;
@@ -162,9 +165,18 @@ export declare namespace AreaChart {
162
165
  export declare interface AreaChartAreaProps<TData extends object> extends ChartChildProps<TData> {
163
166
  }
164
167
 
165
- export declare interface AreaChartProps<TData extends object> extends ChartProps<TData>, default_2.ComponentProps<'div'> {
168
+ export declare interface AreaChartProps<TData extends object> extends CartesianChartProps<TData> {
169
+ /** Show dots for each data point
170
+ * @default false
171
+ */
166
172
  showDots?: boolean;
173
+ /** Stack areas on top of one another, instead of other each other. 'expand' fills the available space
174
+ * @default false
175
+ */
167
176
  stacked?: boolean | 'expand';
177
+ /** Interpolation type of the line
178
+ * @default natural
179
+ */
168
180
  type?: CurveType;
169
181
  }
170
182
 
@@ -239,9 +251,18 @@ export declare namespace BarChart {
239
251
  export declare interface BarChartBarProps<TData extends object> extends ChartChildProps<TData> {
240
252
  }
241
253
 
242
- export declare interface BarChartProps<TData extends object> extends ChartProps<TData>, default_2.ComponentProps<'div'> {
243
- layout?: 'horizontal' | 'vertical';
254
+ export declare interface BarChartProps<TData extends object> extends CartesianChartProps<TData> {
255
+ /** Orientation of the bars
256
+ * @default false
257
+ */
258
+ orientation?: 'horizontal' | 'vertical';
259
+ /** Show bar values as labels next to/inside the bar
260
+ * @default vertical
261
+ */
244
262
  showLabels?: boolean;
263
+ /** Stack bars on top of one another, instead of other each other. 'expand' fills the available space
264
+ * @default false
265
+ */
245
266
  stacked?: boolean | 'expand';
246
267
  }
247
268
 
@@ -441,30 +462,61 @@ export declare type CardProps = Omit<React_2.HTMLAttributes<HTMLDivElement>, 'ti
441
462
  menu?: (props: Partial<MenuProps>) => JSX.Element;
442
463
  };
443
464
 
444
- declare interface ChartChildProps<TData extends object> {
445
- dataKey: keyof TData;
446
- label: string;
447
- unit?: string;
448
- color?: Color_2;
449
- formatter?: ChartValueFormatter;
450
- isHidden?: boolean;
451
- }
465
+ export declare type CardTexts = {
466
+ /** Text and aria-label for menu button in Card */
467
+ menu: string;
468
+ };
452
469
 
453
- declare interface ChartProps<TData extends object> {
470
+ export declare interface CartesianChartProps<TData extends object> extends ChartProps {
471
+ /** Data to show in chart, should be an array of objects */
454
472
  data: TData[];
473
+ /** Key in data to use for X Axis */
455
474
  dataKey: keyof TData;
456
- showLegend?: boolean;
475
+ /** Show the X Axis, shown by default
476
+ * @default true
477
+ */
457
478
  showXAxis?: boolean;
479
+ /** Show the Y Axis, shown by default
480
+ * @default false
481
+ */
458
482
  showYAxis?: boolean;
459
- tooltipTitle?: TooltipTitle;
483
+ /**
484
+ * @default auto
485
+ */
460
486
  xAxisScale?: ScaleType | Function;
487
+ /** Format the value shown for each tick on the X Axis */
461
488
  xAxisTickFormatter?: TickFormatter;
489
+ /**
490
+ * @default auto
491
+ */
462
492
  yAxisScale?: ScaleType | Function;
493
+ /** Format the value shown for each tick on the Y Axis */
463
494
  yAxisTickFormatter?: TickFormatter;
495
+ /** Adjust the width of the Y Axis to reduce whitespace
496
+ * @default 55
497
+ */
464
498
  yAxisWidth?: number;
465
499
  }
466
500
 
467
- declare type ChartValueFormatter = (value: number) => string | JSX.Element;
501
+ export declare interface ChartChildProps<TData extends object> {
502
+ dataKey: keyof TData;
503
+ label: string;
504
+ unit?: string;
505
+ color?: Color_2;
506
+ formatter?: ChartValueFormatter;
507
+ isHidden?: boolean;
508
+ }
509
+
510
+ export declare interface ChartProps extends React.ComponentProps<'div'> {
511
+ /** Show a legend below the chart, hidden by default
512
+ * @default false
513
+ */
514
+ showLegend?: boolean;
515
+ /** Add a title to the Tooltip show when hovering data */
516
+ tooltipTitle?: JSX.Element | string | null | false;
517
+ }
518
+
519
+ export declare type ChartValueFormatter = (value: number) => string | JSX.Element;
468
520
 
469
521
  export declare const Checkbox: React_2.ForwardRefExoticComponent<CheckboxProps & React_2.RefAttributes<HTMLButtonElement>>;
470
522
 
@@ -628,7 +680,7 @@ declare const createListboxValueSetter: (multiple: boolean, setValue: default_2.
628
680
 
629
681
  export declare function createShortcutKeyDownHandler<T = Element>(key: string | KeyDownHandlerOptions, handler: (event: KeyboardEvent | default_2.KeyboardEvent<T>) => void, stopPropagation?: boolean): (event: KeyboardEvent | default_2.KeyboardEvent<T>) => void;
630
682
 
631
- declare type CurveType = 'natural' | 'linear' | 'step';
683
+ export declare type CurveType = 'natural' | 'linear' | 'step';
632
684
 
633
685
  export declare const Datepicker: React_2.ForwardRefExoticComponent<Omit<InputProps, "value"> & {
634
686
  /** [Calendar](component:calendar) component associated with the DatePicker */
@@ -699,6 +751,9 @@ export declare const defaultLocalisationTexts: {
699
751
  today: string;
700
752
  };
701
753
  };
754
+ card: {
755
+ menu: string;
756
+ };
702
757
  combobox: {
703
758
  tooltip: string;
704
759
  };
@@ -1090,13 +1145,16 @@ export declare type DialogTitleProps = React_2.HTMLAttributes<HTMLHeadingElement
1090
1145
 
1091
1146
  declare type DialogTriggerProps = React_2.HTMLAttributes<HTMLButtonElement>;
1092
1147
 
1093
- export declare function DonutChart<TData extends object>(props: DonutChartProps<TData>): default_2.JSX.Element;
1148
+ export declare function DonutChart<TData extends object>(props: DonutChartProps): default_2.JSX.Element;
1094
1149
 
1095
1150
  export declare namespace DonutChart {
1096
1151
  var Segment: <TData extends object>(_: DonutChartSegmentProps<TData>) => JSX.Element | null;
1097
1152
  }
1098
1153
 
1099
- export declare interface DonutChartProps<TData extends object> extends Omit<PieChartProps<TData>, 'showLabels'> {
1154
+ export declare interface DonutChartProps extends PolarChartProps {
1155
+ /** Show total value in center of Donut
1156
+ * @default false
1157
+ */
1100
1158
  showTotal?: boolean;
1101
1159
  }
1102
1160
 
@@ -1636,6 +1694,12 @@ export declare type LayoutTopProps = {
1636
1694
  }) => default_2.ReactNode);
1637
1695
  };
1638
1696
 
1697
+ export declare interface LegacyChartChildProps {
1698
+ accessor: number;
1699
+ color: Color_2;
1700
+ label: string;
1701
+ }
1702
+
1639
1703
  export declare const LegacyDonutChart: {
1640
1704
  ({ children, formatter, onClick, label }: LegacyDonutChartProps): default_2.JSX.Element | null;
1641
1705
  Segment: (_: LegacyDonutChartSegmentProps) => null;
@@ -1883,8 +1947,14 @@ export declare namespace LineChart {
1883
1947
  export declare interface LineChartAreaProps<TData extends object> extends ChartChildProps<TData> {
1884
1948
  }
1885
1949
 
1886
- export declare interface LineChartProps<TData extends object> extends ChartProps<TData>, default_2.ComponentProps<'div'> {
1950
+ export declare interface LineChartProps<TData extends object> extends CartesianChartProps<TData> {
1951
+ /** Show dots for each data point
1952
+ * @default false
1953
+ */
1887
1954
  showDots?: boolean;
1955
+ /** Interpolation type of the line
1956
+ * @default natural
1957
+ */
1888
1958
  type?: CurveType;
1889
1959
  }
1890
1960
 
@@ -2124,6 +2194,8 @@ export declare type LocalizationTexts = {
2124
2194
  banner: BannerTexts;
2125
2195
  /** Localized texts and aria-labels for [Calendar](component:calendar) component */
2126
2196
  calendar: CalendarTexts;
2197
+ /** Localized texts and aria-labels for [Card](component:card) component */
2198
+ card: CardTexts;
2127
2199
  /** Localized texts and aria-labels for [Combobox](component:combobox) component */
2128
2200
  combobox: ComboboxTexts;
2129
2201
  /** Localized texts and aria-labels for [DatePicker](component:datepicker) component */
@@ -2471,16 +2543,21 @@ export declare const parseFromCustomString: (date?: string, mask?: string, defau
2471
2543
 
2472
2544
  export declare const parseFromISOString: (date: string) => Date | undefined;
2473
2545
 
2474
- export declare function PieChart<TData extends object>(props: PieChartProps<TData>): default_2.JSX.Element;
2546
+ export declare type PayloadType<TType> = Payload & {
2547
+ dataKey: keyof TType & string;
2548
+ };
2549
+
2550
+ export declare function PieChart<TData extends object>(props: PieChartProps): default_2.JSX.Element;
2475
2551
 
2476
2552
  export declare namespace PieChart {
2477
2553
  var Segment: <TData extends object>(_: PieChartSegmentProps<TData>) => JSX.Element | null;
2478
2554
  }
2479
2555
 
2480
- export declare interface PieChartProps<TData extends object> extends Pick<ChartProps<TData>, 'showLegend' | 'tooltipTitle'>, default_2.ComponentProps<'div'> {
2481
- formatter?: ChartValueFormatter;
2556
+ export declare interface PieChartProps extends PolarChartProps {
2557
+ /** Show labels inside each segment
2558
+ * @default false
2559
+ */
2482
2560
  showLabels?: boolean;
2483
- unit?: string;
2484
2561
  }
2485
2562
 
2486
2563
  export declare interface PieChartSegmentProps<TData extends object> extends Omit<ChartChildProps<TData>, 'dataKey' | 'formatter' | 'unit'> {
@@ -2489,6 +2566,15 @@ export declare interface PieChartSegmentProps<TData extends object> extends Omit
2489
2566
 
2490
2567
  export declare type Placement = 'right' | 'left' | 'top' | 'bottom';
2491
2568
 
2569
+ export declare interface PolarChartProps extends ChartProps {
2570
+ /** Format the displayed value
2571
+ * @default Intl.NumberFormat
2572
+ */
2573
+ formatter?: ChartValueFormatter;
2574
+ /** Text representation of data, used in tooltips and totals */
2575
+ unit?: string;
2576
+ }
2577
+
2492
2578
  export declare const Popover: ForwardedPopoverWithStatics;
2493
2579
 
2494
2580
  export declare type PopoverAnchorProps = React_2.HTMLAttributes<HTMLElement>;
@@ -3571,7 +3657,7 @@ export declare type TextareaProps = React_2.TextareaHTMLAttributes<HTMLTextAreaE
3571
3657
  value?: string;
3572
3658
  };
3573
3659
 
3574
- declare type TickFormatter = (value: any) => string;
3660
+ export declare type TickFormatter = (value: any) => string;
3575
3661
 
3576
3662
  export declare const Title: React_2.ForwardRefExoticComponent<HangerTitleProps & React_2.RefAttributes<HTMLHeadingElement>>;
3577
3663
 
@@ -3660,8 +3746,6 @@ export declare type TooltipProps = Omit<React_2.HTMLAttributes<HTMLDivElement>,
3660
3746
  placement?: 'top' | 'right' | 'bottom' | 'left';
3661
3747
  };
3662
3748
 
3663
- declare type TooltipTitle = JSX.Element | string | null | false;
3664
-
3665
3749
  declare const Top: (props: LayoutTopProps) => default_2.JSX.Element;
3666
3750
 
3667
3751
  export declare const Tour: {