@scality/core-ui 0.180.0 → 0.182.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.
@@ -101,7 +101,7 @@ export const Barchart = (props) => {
101
101
  }
102
102
  return acc;
103
103
  }, {});
104
- const { rechartsBars, unitLabel, roundReferenceValue, rechartsData } = useChartData(bars || [], type, colorSet || {}, stacked, defaultSort, unitRange, stackedBarSort);
104
+ const { rechartsBars, unitLabel, roundReferenceValue, rechartsData, topDomain } = useChartData(bars || [], type, colorSet || {}, stacked, defaultSort, unitRange, stackedBarSort);
105
105
  const titleWithUnit = unitLabel ? `${title} (${unitLabel})` : title;
106
106
  return (_jsxs(Stack, { direction: "vertical", style: { gap: '0' }, children: [_jsx(ChartHeader, { title: titleWithUnit, secondaryTitle: secondaryTitle, helpTooltip: helpTooltip, rightTitle: rightTitle }), isError || (!bars && !isLoading) ? (_jsx(Error, { height: height })) : isLoading ? (_jsx(Loading, { height: height })) : (_jsx(StyledResponsiveContainer, { ref: chartRef, width: "100%", height: height, children: _jsxs(BarChart, { data: rechartsData, accessibilityLayer: true, barSize: type.type === 'category'
107
107
  ? type.gap === 0
@@ -110,7 +110,7 @@ export const Barchart = (props) => {
110
110
  : CHART_CONSTANTS.BAR_SIZE, height: height, margin: CHART_CONSTANTS.CHART_MARGIN, barCategoryGap: type.type === 'category' ? type.gap : undefined, children: [_jsx(CartesianGrid, { vertical: true, horizontal: true, verticalPoints: [0], horizontalPoints: [0], stroke: theme.border, fill: theme.backgroundLevel4, strokeWidth: 1 }), rechartsBars.map((bar) => {
111
111
  const { fill, dataKey, stackId } = bar;
112
112
  return (_jsx(Bar, { dataKey: dataKey, fill: chartColors[fill] || fill, minPointSize: stacked ? 0 : CHART_CONSTANTS.MIN_POINT_SIZE, stackId: stackId, isAnimationActive: false, onMouseOver: () => setHoveredValue(dataKey), onMouseLeave: () => setHoveredValue(undefined) }, dataKey));
113
- }), _jsx(YAxis, { interval: 0, domain: [0, roundReferenceValue], ticks: getTicks(roundReferenceValue, false), tickFormatter: (value) => new Intl.NumberFormat('fr-FR').format(value) // Add a space as thousand separator
113
+ }), _jsx(YAxis, { interval: 0, domain: [0, topDomain], ticks: getTicks(roundReferenceValue, false), tickFormatter: (value) => new Intl.NumberFormat('fr-FR').format(value) // Add a space as thousand separator
114
114
  , axisLine: { stroke: theme.border }, tick: {
115
115
  fill: theme.textSecondary,
116
116
  fontSize: fontSize.smaller,
@@ -57,10 +57,12 @@ export declare const computeUnitLabelAndRoundReferenceValue: (data: any, maxValu
57
57
  unitLabel: undefined;
58
58
  roundReferenceValue: number;
59
59
  rechartsData: any;
60
+ topDomain: number;
60
61
  } | {
61
62
  unitLabel: string;
62
63
  roundReferenceValue: number;
63
64
  rechartsData: any;
65
+ topDomain: number;
64
66
  };
65
67
  /**
66
68
  * Return the unit label base on the current dataset, and the valueBase which is used to convert the data
@@ -116,6 +118,7 @@ export declare const useChartData: <T extends BarchartBars>(bars: T, type: Barch
116
118
  stackId?: string;
117
119
  }[];
118
120
  unitLabel: string | undefined;
121
+ topDomain: number;
119
122
  roundReferenceValue: number;
120
123
  rechartsData: any;
121
124
  };
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/components/barchartv2/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG7D,eAAO,MAAM,sBAAsB,UAAW,MAAM,KAAG,MA8BtD,CAAC;AAEF,eAAO,MAAM,QAAQ,aAAc,MAAM,iBAAiB,OAAO,aAyBhE,CAAC;AAEF,eAAO,MAAM,cAAc,SACnB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,EAAE,YAChC,OAAO,WAuBl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AAG,MAAM,GAAG,MAAM,CAAC;CAChC,EAAE,YACO,OAAO,gBACH,MAAM,EAAE;aARX,MAAM;UACT,MAAM;cACF,MAAM;GA8CnB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,uCAAuC,SAC5C;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,EAAE,gBAC5B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,qBAChD,MAAM,EAAE;;;;;iBADF,MAAM;cAAQ,MAAM;kBAAY,MAAM;;CA2BhE,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,YAAY,QAC3C,CAAC,QACD,aAAa,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,YACpB,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,YACpC,OAAO,gBACH,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,cACjC,SAAS,mBACJ,SAAS,GAAG,QAAQ;;iBApCZ,MAAM;cAAQ,MAAM;kBAAY,MAAM;;;;;;CAwEhE,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,YAAY,SAC7C,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,gBAC5B,MAAM,GAAG,SAAS;cAeX,MAAM,GAAG,MAAM;;eAV3B,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;eAClB,MAAM;mBACF,OAAO;;CAWrB,CAAC"}
@@ -3,51 +3,29 @@ import { useChartLegend } from '../chartlegend/ChartLegendWrapper';
3
3
  export const getRoundReferenceValue = (value) => {
4
4
  if (value <= 0)
5
5
  return 1; // Default for zero or negative values
6
- // Get the magnitude (10^n where n is the number of digits - 1)
7
- const magnitude = Math.pow(10, Math.floor(Math.log10(value)));
8
6
  // Buffer the value by 10% to avoid being too close to the edge of the chart
9
7
  const bufferedValue = value * 1.1;
10
- // Normalized value between 1 and 10
11
- const normalized = bufferedValue / magnitude;
12
- // Round to nice numbers based on normalized value
13
- // skip 1.5, 3, 4, 7.5 as top value for better chart
14
- // appearance for small values
15
- let result;
16
- if (normalized <= 1)
17
- result = magnitude;
18
- else if (value > 10 && normalized <= 1.5)
19
- result = 1.5 * magnitude;
20
- else if (normalized <= 2)
21
- result = 2 * magnitude;
22
- else if (value > 10 && normalized <= 2.5)
23
- result = 2.5 * magnitude;
24
- else if (value > 10 && normalized <= 3)
25
- result = 3 * magnitude;
26
- else if (value > 10 && normalized <= 4)
27
- result = 4 * magnitude;
28
- else if (normalized <= 5)
29
- result = 5 * magnitude;
30
- else if (value > 10 && normalized <= 6)
31
- result = 6 * magnitude;
32
- else if (value > 10 && normalized <= 8)
33
- result = 8 * magnitude;
34
- else if (normalized <= 10)
35
- result = 10 * magnitude;
36
- else
37
- result = 10 * magnitude;
38
- return result;
39
- };
40
- export const getTicks = (topValue, isSymmetrical) => {
41
- if (topValue < 10) {
42
- if (isSymmetrical) {
43
- return [-topValue, 0, topValue];
8
+ if (value >= 10) {
9
+ const remainder = value % 10;
10
+ const incremented = value + (10 - remainder);
11
+ // If the remainder is less than 5, round down to the nearest 10
12
+ if (remainder < 5) {
13
+ return value - remainder;
44
14
  }
45
- else {
46
- return [0, topValue];
15
+ // If incrementing would exceed the buffered max, also round down
16
+ if (incremented > bufferedValue) {
17
+ return value - remainder;
47
18
  }
19
+ // Otherwise, round up to the next 10
20
+ return incremented;
48
21
  }
22
+ const magnitude = Math.pow(10, Math.floor(Math.log10(value)));
23
+ const remainder = bufferedValue % magnitude;
24
+ return remainder === 0 ? bufferedValue : bufferedValue - remainder;
25
+ };
26
+ export const getTicks = (topValue, isSymmetrical) => {
49
27
  const possibleTickNumbers = [4, 3];
50
- const numberOfTicks = possibleTickNumbers.find((number) => topValue % (number - 1) === 0) || 2; // Default to 2 ticks if no match
28
+ const numberOfTicks = possibleTickNumbers.find((number) => topValue % (number - 1) === 0) || 3; // Default to 2 ticks if no match
51
29
  const tickInterval = topValue / (numberOfTicks - 1);
52
30
  const ticks = Array.from({ length: numberOfTicks }, (_, index) => index * tickInterval);
53
31
  if (isSymmetrical) {
@@ -226,7 +204,7 @@ export const formatPrometheusDataToRechartsDataAndBars = (bars, type, colorSet,
226
204
  export const computeUnitLabelAndRoundReferenceValue = (data, maxValue, unitRange) => {
227
205
  if (!unitRange) {
228
206
  const roundReferenceValue = getRoundReferenceValue(maxValue);
229
- return { unitLabel: undefined, roundReferenceValue, rechartsData: data };
207
+ return { unitLabel: undefined, roundReferenceValue, rechartsData: data, topDomain: maxValue * 1.1 };
230
208
  }
231
209
  const { valueBase, unitLabel } = getUnitLabel(unitRange, maxValue);
232
210
  const topValue = maxValue / valueBase;
@@ -240,7 +218,7 @@ export const computeUnitLabelAndRoundReferenceValue = (data, maxValue, unitRange
240
218
  });
241
219
  return normalizedDataPoint;
242
220
  });
243
- return { unitLabel, roundReferenceValue, rechartsData };
221
+ return { unitLabel, roundReferenceValue, rechartsData, topDomain: topValue * 1.1 };
244
222
  };
245
223
  /**
246
224
  * Return the unit label base on the current dataset, and the valueBase which is used to convert the data
@@ -343,10 +321,11 @@ export const useChartData = (bars, type, colorSet, stacked, defaultSort, unitRan
343
321
  // Filter both data and bars to only include selected resources for accurate maxValue calculation
344
322
  const { filteredData, filteredRechartsBars } = filterChartDataAndBarsByLegendSelection(data, rechartsBars, selectedResources);
345
323
  const maxValue = getMaxBarValue(filteredData, stacked);
346
- const { unitLabel, roundReferenceValue, rechartsData } = computeUnitLabelAndRoundReferenceValue(filteredData, maxValue, unitRange);
324
+ const { unitLabel, roundReferenceValue, rechartsData, topDomain } = computeUnitLabelAndRoundReferenceValue(filteredData, maxValue, unitRange);
347
325
  return {
348
326
  rechartsBars: filteredRechartsBars,
349
327
  unitLabel,
328
+ topDomain,
350
329
  roundReferenceValue,
351
330
  rechartsData,
352
331
  };
@@ -16,7 +16,8 @@ export type ChartLegendState = {
16
16
  export type ChartLegendWrapperProps = {
17
17
  children: ReactNode;
18
18
  colorSet: Record<string, ChartColors | string> | ((seriesNames: string[]) => Record<string, ChartColors | string>);
19
+ sortOrder?: 'alphabetical' | 'status' | ((a: string, b: string) => number);
19
20
  };
20
- export declare const ChartLegendWrapper: ({ children, colorSet, }: ChartLegendWrapperProps) => import("react/jsx-runtime").JSX.Element;
21
+ export declare const ChartLegendWrapper: ({ children, colorSet, sortOrder, }: ChartLegendWrapperProps) => import("react/jsx-runtime").JSX.Element;
21
22
  export declare const useChartLegend: () => ChartLegendState;
22
23
  //# sourceMappingURL=ChartLegendWrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChartLegendWrapper.d.ts","sourceRoot":"","sources":["../../../src/lib/components/chartlegend/ChartLegendWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EAKV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,eAAO,MAAM,UAAU,QAAO,MAQ7B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,sBAAsB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IAC1C,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACnD,aAAa,EAAE,MAAM,MAAM,EAAE,CAAC;IAC9B,iBAAiB,EAAE,MAAM,OAAO,CAAC;IACjC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAA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AAE,WAAW,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC5D,CAAC;AAIF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EACJ,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,GACpC,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC;IACtE,SAAS,CAAC,EAAE,cAAc,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;CAC5E,CAAC;AAEF,eAAO,MAAM,kBAAkB,uCAI5B,uBAAuB,4CAsIzB,CAAC;AAEF,eAAO,MAAM,cAAc,wBAM1B,CAAC"}
@@ -9,7 +9,7 @@ export const useChartId = () => {
9
9
  return idRef.current;
10
10
  };
11
11
  const ChartLegendContext = createContext(null);
12
- export const ChartLegendWrapper = ({ children, colorSet, }) => {
12
+ export const ChartLegendWrapper = ({ children, colorSet, sortOrder = 'alphabetical', }) => {
13
13
  const [registeredColorSets, setRegisteredColorSets] = useState({});
14
14
  const [internalColorSet, setInternalColorSet] = useState(() => {
15
15
  return typeof colorSet === 'function' ? {} : colorSet;
@@ -64,8 +64,18 @@ export const ChartLegendWrapper = ({ children, colorSet, }) => {
64
64
  return color;
65
65
  }, [internalColorSet]);
66
66
  const listResources = useCallback(() => {
67
- return Object.keys(internalColorSet).sort();
68
- }, [internalColorSet]);
67
+ const resources = Object.keys(internalColorSet);
68
+ if (sortOrder === 'alphabetical') {
69
+ return resources.sort((a, b) => a.localeCompare(b));
70
+ }
71
+ else if (sortOrder === 'status') {
72
+ return ['Success', 'Warning', 'Failed'].filter((status) => resources.includes(status));
73
+ }
74
+ else if (typeof sortOrder === 'function') {
75
+ return resources.sort(sortOrder);
76
+ }
77
+ return resources;
78
+ }, [internalColorSet, sortOrder]);
69
79
  const chartLegendState = useMemo(() => ({
70
80
  selectedResources,
71
81
  addSelectedResource,
@@ -1 +1 @@
1
- {"version":3,"file":"linetimeseriechart.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/linetimeseriechart/linetimeseriechart.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,mBAAmB,EAGpB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAiD,MAAM,OAAO,CAAC;AAiCtE,MAAM,MAAM,KAAK,GAAG;IAElB,QAAQ,EAAE,MAAM,CAAC;IAEjB,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAEzC,eAAe,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtE,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,SAAS,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IACrC,MAAM,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;CAC7B,CAAC;AAGF,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,aAAa,CAAC;IACzB,MAAM,EACF;QACE,KAAK,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;QAC3B,KAAK,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;KAC5B,GACD,SAAS,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,CACzB,wBAAwB,GACxB,qBAAqB,CACxB,GAAG;IACF,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE;QACV,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACJ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,CACd,YAAY,EAAE,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,EACjD,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,KACd,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC;AAiHF,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,KAAK,EACL,MAAM,EACN,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAiB,EACjB,UAAwB,EACxB,SAAqB,EACrB,UAAU,EACV,QAAQ,EACR,MAAM,EACN,aAAa,EACb,GAAG,IAAI,EACR,EAAE,cAAc,2CAqWhB"}
1
+ {"version":3,"file":"linetimeseriechart.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/linetimeseriechart/linetimeseriechart.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,mBAAmB,EAGpB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAiD,MAAM,OAAO,CAAC;AAiCtE,MAAM,MAAM,KAAK,GAAG;IAElB,QAAQ,EAAE,MAAM,CAAC;IAEjB,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAEzC,eAAe,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtE,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,wBAAwB,GAAG;I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AAG,IAAI,EACR,EAAE,cAAc,2CAgWhB"}
@@ -142,13 +142,7 @@ export function LineTimeSerieChart({ series, title, height, startingTimeStamp, i
142
142
  return evenlySpacedTicks;
143
143
  }, [chartData]);
144
144
  // 3. Transform the data base on the valuebase
145
- const { topValue, unitLabel, rechartsData } = useMemo(() => {
146
- if (yAxisType === 'percentage')
147
- return {
148
- topValue: 100,
149
- unitLabel: '%',
150
- rechartsData: chartData,
151
- };
145
+ const { topValue, unitLabel, rechartsData, topDomain } = useMemo(() => {
152
146
  const values = chartData.flatMap((dataPoint) => Object.entries(dataPoint)
153
147
  .filter(([key]) => key !== 'timestamp')
154
148
  .map(([_, value]) => {
@@ -160,16 +154,19 @@ export function LineTimeSerieChart({ series, title, height, startingTimeStamp, i
160
154
  if (values.length === 0) {
161
155
  return {
162
156
  topValue: 100, // Default value for empty charts
163
- unitLabel: '',
157
+ unitLabel: yAxisType === 'percentage' ? '%' : '',
164
158
  rechartsData: [],
159
+ topDomain: 100,
165
160
  };
166
161
  }
167
162
  const top = Math.abs(Math.max(...values));
168
163
  const bottom = Math.abs(Math.min(...values));
169
164
  const maxValue = Math.max(top, bottom);
170
- const { valueBase, unitLabel } = getUnitLabel(unitRange !== null && unitRange !== void 0 ? unitRange : [], maxValue);
165
+ const { valueBase, unitLabel } = yAxisType === 'percentage' ? { valueBase: 1, unitLabel: '%' } : getUnitLabel(unitRange !== null && unitRange !== void 0 ? unitRange : [], maxValue);
171
166
  // Use round reference value to add extra padding to the top value
172
- const topValue = getRoundReferenceValue(maxValue / valueBase);
167
+ const basedValue = maxValue / valueBase;
168
+ const topDomain = basedValue * 1.1;
169
+ const topValue = getRoundReferenceValue(basedValue);
173
170
  const rechartsData = chartData.map((dataPoint) => {
174
171
  const normalizedDataPoint = { ...dataPoint };
175
172
  Object.entries(dataPoint).forEach(([key, value]) => {
@@ -179,7 +176,7 @@ export function LineTimeSerieChart({ series, title, height, startingTimeStamp, i
179
176
  });
180
177
  return normalizedDataPoint;
181
178
  });
182
- return { topValue, unitLabel, rechartsData };
179
+ return { topValue, unitLabel, rechartsData, topDomain };
183
180
  }, [chartData, yAxisType, unitRange]);
184
181
  // Group series by resource and create color mapping
185
182
  const { colorMapping, groupedSeries } = useMemo(() => {
@@ -231,10 +228,10 @@ export function LineTimeSerieChart({ series, title, height, startingTimeStamp, i
231
228
  fontSize: fontSize.smaller,
232
229
  },
233
230
  }, domain: yAxisType === 'percentage'
234
- ? [0, 100]
231
+ ? [0, topDomain]
235
232
  : yAxisType === 'symmetrical'
236
- ? [-topValue, topValue]
237
- : [0, topValue], axisLine: { stroke: theme.border }, tick: {
233
+ ? [-topDomain, topDomain]
234
+ : [0, topDomain], axisLine: { stroke: theme.border }, tick: {
238
235
  fill: theme.textSecondary,
239
236
  fontSize: fontSize.smaller,
240
237
  }, tickFormatter: (value) => new Intl.NumberFormat('fr-FR').format(value), ticks: getTicks(topValue, yAxisType === 'symmetrical'), interval: 0 }), _jsx(Tooltip, { content: (props) => (_jsx(LineTimeSerieChartTooltip, { unitLabel: unitLabel, duration: duration, renderTooltip: renderTooltip, isSymmetrical: yAxisType === 'symmetrical', tooltipProps: props, isChartActive: isChartActive, hoveredValue: hoveredValue, chartContainerRef: chartRef })) }), yAxisType === 'symmetrical' && (_jsx(ReferenceLine, { y: 0, stroke: theme.border })), Object.entries(groupedSeries).map(([resource, resourceSeries]) => resourceSeries.map((serie, serieIndex) => {
@@ -1 +1 @@
1
- {"version":3,"file":"branding-logo.d.ts","sourceRoot":"","sources":["../../src/lib/icons/branding-logo.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,IAAI,+CA0CT,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"branding-logo.d.ts","sourceRoot":"","sources":["../../src/lib/icons/branding-logo.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,IAAI,+CAgBT,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- const Logo = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "49", height: "49", viewBox: "0 0 49 49", children: [_jsx("path", { fill: "#3d9bd6", d: "M21.25 4.42v7.25h3.99V4.33l5.16 2.92 2-3.36L27.14.97A7.7 7.7 0 0 0 23.15 0c-1.36 0-2.72.35-3.89 1.06L14 3.98l1.99 3.36z" }), _jsx("path", { fill: "#007664", d: "M21.25 4.42v7.25h3.99V4.33l5.16 2.92 2-3.36L27.14.97A7.7 7.7 0 0 0 23.15 0c-1.36 0-2.72.35-3.89 1.06L14 3.98l1.99 3.36z" }), _jsx("path", { fill: "#ee4642", d: "M21.16 44.25V37h3.99v7.25l5.16-2.92 2 3.36-5.17 2.92a7.9 7.9 0 0 1-7.88 0L14 44.69l1.99-3.36z" }), _jsx("path", { fill: "#2aad8e", d: "M40.43 13.28L34 16.9l1.99 3.36 6.44-3.62v5.83h3.99v-5.92c0-1.33-.37-2.65-1.09-3.8a8.82 8.82 0 0 0-2.9-2.83L37.17 7l-1.99 3.36z" }), _jsx("path", { fill: "#d71d4f", d: "M4.99 32.84l6.43-3.63 2 3.36-6.44 3.63 5.17 2.91-2 3.36-5.25-2.92a7.6 7.6 0 0 1-2.81-2.82A7.1 7.1 0 0 1 1 32.92V27h3.99z" }), _jsx("path", { fill: "#9e2569", d: "M4.08 16.64l6.43 3.62 2-3.36-6.44-3.62 5.17-2.92-2-3.36-5.25 2.92a8.72 8.72 0 0 0-2.9 2.83A7.16 7.16 0 0 0 0 16.64v5.92h3.99z" }), _jsx("path", { fill: "#f79836", d: "M40.34 36.2L34 32.57l1.99-3.36 6.44 3.63V27h3.99v5.92c0 1.33-.37 2.57-1.09 3.81a8.69 8.69 0 0 1-2.9 2.82l-5.26 2.92-1.99-3.36z" }), _jsx("path", { fill: "#007664", d: "M24 15v8.22l7.34-4.06z" }), _jsx("path", { fill: "#9e2569", d: "M23.25 15L16 19.16l7.25 4.06z" }), _jsx("path", { fill: "#d71d4f", d: "M22.25 25.07L15 21v8.13z" }), _jsx("path", { fill: "#2aad8e", d: "M24 24.98l7.25 4.07V21z" }), _jsx("path", { fill: "#ee4642", d: "M23.16 26L16 30.07l7.16 4.15z" }), _jsx("path", { fill: "#f79836", d: "M24 26v8.22l7.25-4.15z" })] }));
2
+ const Logo = () => (_jsxs("svg", { width: "49", height: "49", viewBox: "0 0 49 49", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M21.0748 4.41441V11.6541H25.0566V4.32613L30.2149 7.23964L32.2058 3.88469L26.9571 0.971171C25.7806 0.264865 24.4232 0 22.9753 0C21.6178 0 20.2604 0.353153 19.0839 1.05946L13.8352 3.97297L15.8261 7.32793L21.0748 4.41441Z", fill: "#005357" }), _jsx("path", { d: "M21.0749 44.5856V37.3459H25.0567V44.5856L30.215 41.6721L32.2059 45.027L27.0476 47.9405C25.8712 48.6469 24.4233 49 23.0658 49C21.7084 49 20.351 48.6469 19.1745 47.9405L13.9258 45.027L15.9167 41.6721L21.0749 44.5856Z", fill: "#FD8144" }), _jsx("path", { d: "M39.8981 12.7133L33.4729 16.3331L35.4638 19.6881L41.889 16.0682V21.8953H45.8708V15.98C45.8708 14.6556 45.5088 13.3313 44.7848 12.1836C44.0609 11.0358 43.0654 10.0646 41.889 9.35834L36.6402 6.44482L34.6493 9.79978L39.8981 12.7133Z", fill: "#0AADA6" }), _jsx("path", { d: "M4.24279 32.8434L10.668 29.2236L12.6589 32.5785L6.23369 36.1983L11.3919 39.1119L9.40103 42.4668L4.15229 39.5533C2.97585 38.847 1.9804 37.8758 1.34693 36.7281C0.622968 35.5803 0.260986 34.256 0.260986 32.9317V27.0164H4.24279V32.8434Z", fill: "#E84855" }), _jsx("path", { d: "M4.24271 16.1569L10.6679 19.7767L12.6588 16.4217L6.23361 12.8019L11.3919 9.8884L9.40095 6.53345L4.15221 9.44696C2.97577 10.1533 1.98032 11.1244 1.25636 12.2722C0.532392 13.4199 0.17041 14.7443 0.17041 16.1569V22.0722H4.15221L4.24271 16.1569Z", fill: "#A14FBF" }), _jsx("path", { d: "M39.8982 36.1983L33.5635 32.5785L35.5544 29.2236L41.9796 32.8434V27.0164H45.9614V32.9317C45.9614 34.256 45.5994 35.492 44.8754 36.7281C44.1514 37.8758 43.156 38.847 41.9796 39.5533L36.7308 42.4668L34.7399 39.1119L39.8982 36.1983Z", fill: "#F8F32B" }), _jsx("path", { d: "M23.6086 15.3623V23.5731L30.9388 19.5119L23.6086 15.3623Z", fill: "#005357" }), _jsx("path", { d: "M22.5226 15.3623L15.283 19.5119L22.5226 23.5731V15.3623Z", fill: "#A14FBF" }), _jsx("path", { d: "M22.0705 24.4558L14.8308 20.3945V28.5171L22.0705 24.4558Z", fill: "#E84855" }), _jsx("path", { d: "M24.1519 24.4559L31.3915 28.5171V20.4829L24.1519 24.4559Z", fill: "#0AADA6" }), _jsx("path", { d: "M22.5227 25.4272L15.3735 29.4885L22.5227 33.6381V25.4272Z", fill: "#FD8144" }), _jsx("path", { d: "M23.6086 25.4272V33.6381L30.8483 29.4885L23.6086 25.4272Z", fill: "#F8F32B" })] }));
3
3
  export { Logo };
@@ -1 +1 @@
1
- {"version":3,"file":"branding.d.ts","sourceRoot":"","sources":["../../src/lib/icons/branding.tsx"],"names":[],"mappings":"AAAA,QAAA,MAAM,IAAI,+CAkDT,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"branding.d.ts","sourceRoot":"","sources":["../../src/lib/icons/branding.tsx"],"names":[],"mappings":"AAAA,QAAA,MAAM,IAAI,+CA0BT,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- const Logo = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "186", height: "49", viewBox: "0 0 186 49", children: [_jsx("path", { fill: "#fff", d: "M72.23 18.19c0-2.03-1.18-3.18-4.53-3.18-3.35 0-4.53 1.15-4.53 3.18v.71c0 1.68 1.09 2.21 1.9 2.47l6.98 2.57c2.27.88 4.17 2.29 4.17 5.04v3.09c0 3.09-2.27 5.75-8.61 5.75-6.43 0-8.61-2.66-8.61-5.75v-2.03c0-.53.27-.71.82-.71h2.26c.45 0 .64.18.64.71v1.68c0 2.03 1.45 3.18 4.89 3.18 3.44 0 4.89-1.15 4.89-3.18v-1.77c0-1.86-1.72-2.48-3.17-3.1l-6.43-2.38a4.98 4.98 0 0 1-3.36-4.6v-2.12c0-3.1 2-5.75 8.16-5.75 6.25 0 8.25 2.65 8.25 5.75v1.68c0 .44-.18.7-.64.7h-2.26c-.55 0-.82-.17-.82-.7zM97.04 32.16c0 3.09-1.91 5.75-8.52 5.75-6.62 0-8.52-2.66-8.52-5.75V17.75c0-3.1 1.9-5.75 8.52-5.75 6.61 0 8.52 2.65 8.52 5.75v1.85c0 .53-.18.71-.73.71h-2.17c-.55 0-.82-.18-.82-.71v-1.23c0-2.04-1.36-3.28-4.8-3.28-3.44 0-4.8 1.24-4.8 3.28v13.26c0 2.03 1.36 3.27 4.8 3.27 3.44 0 4.8-1.24 4.8-3.27v-1.77c0-.44.27-.71.82-.71h2.17c.46 0 .73.27.73.71zM125.81 34.28h9.78c.46 0 .82.18.82.71v1.68c0 .53-.36.71-.82.71h-12.96c-.45 0-.63-.27-.63-.71V12.8c0-.53.18-.8.73-.8h2.35c.45 0 .73.27.73.8zM164.58 12c.46 0 .64.18.64.71v1.68c0 .53-.09.7-.64.7h-5.98v21.58c0 .53-.27.71-.81.71h-2.36c-.45 0-.81-.27-.81-.71V15.09h-5.99c-.54 0-.63-.17-.63-.7v-1.68c0-.53.09-.71.63-.71z" }), _jsx("path", { fill: "#fff", d: "M72.23 18.19c0-2.03-1.18-3.18-4.53-3.18-3.35 0-4.53 1.15-4.53 3.18v.71c0 1.68 1.09 2.21 1.9 2.47l6.98 2.57c2.27.88 4.17 2.29 4.17 5.04v3.09c0 3.09-2.27 5.75-8.61 5.75-6.43 0-8.61-2.66-8.61-5.75v-2.03c0-.53.27-.71.82-.71h2.26c.45 0 .64.18.64.71v1.68c0 2.03 1.45 3.18 4.89 3.18 3.44 0 4.89-1.15 4.89-3.18v-1.77c0-1.86-1.72-2.48-3.17-3.1l-6.43-2.38a4.98 4.98 0 0 1-3.36-4.6v-2.12c0-3.1 2-5.75 8.16-5.75 6.25 0 8.25 2.65 8.25 5.75v1.68c0 .44-.18.7-.64.7h-2.26c-.55 0-.82-.17-.82-.7zM97.04 32.16c0 3.09-1.91 5.75-8.52 5.75-6.62 0-8.52-2.66-8.52-5.75V17.75c0-3.1 1.9-5.75 8.52-5.75 6.61 0 8.52 2.65 8.52 5.75v1.85c0 .53-.18.71-.73.71h-2.17c-.55 0-.82-.18-.82-.71v-1.23c0-2.04-1.36-3.28-4.8-3.28-3.44 0-4.8 1.24-4.8 3.28v13.26c0 2.03 1.36 3.27 4.8 3.27 3.44 0 4.8-1.24 4.8-3.27v-1.77c0-.44.27-.71.82-.71h2.17c.46 0 .73.27.73.71zM125.81 34.28h9.78c.46 0 .82.18.82.71v1.68c0 .53-.36.71-.82.71h-12.96c-.45 0-.63-.27-.63-.71V12.8c0-.53.18-.8.73-.8h2.35c.45 0 .73.27.73.8zM143.72 36.67c0 .53-.19.71-.73.71h-2.36c-.45 0-.63-.27-.63-.71V12.8c0-.53.09-.8.63-.8h2.36c.54 0 .73.27.73.8zM164.58 12c.46 0 .64.18.64.71v1.68c0 .53-.09.7-.64.7h-5.98v21.58c0 .53-.27.71-.81.71h-2.36c-.45 0-.81-.27-.81-.71V15.09h-5.99c-.54 0-.63-.17-.63-.7v-1.68c0-.53.09-.71.63-.71zM175.53 23.76l5.71-11.05c.18-.36.36-.71.82-.71h2.35c.55 0 .82.27.55.71l-7.53 14.59v9.37c0 .44-.18.71-.72.71h-2.36c-.54 0-.63-.27-.63-.71V27.3l-7.61-14.59c-.28-.44 0-.71.54-.71h2.27c.54 0 .63.27.9.71zM110.76 12c.45 0 .73.27.91.71l7.43 23.96c.18.44 0 .71-.54.71h-2.45c-.45 0-.73-.27-.82-.71l-1.72-5.75h-7.97l-1.73 5.75c-.09.44-.36.71-.81.71h-2.45c-.54 0-.72-.27-.54-.71l7.43-23.96c.18-.44.45-.71.91-.71zm-1.18 5.48l-3.17 10.61h6.25z" }), _jsx("path", { fill: "#3d9bd6", d: "M21.25 4.42v7.25h3.99V4.33l5.16 2.92 2-3.36L27.14.97A7.7 7.7 0 0 0 23.15 0c-1.36 0-2.72.35-3.89 1.06L14 3.98l1.99 3.36z" }), _jsx("path", { fill: "#007664", d: "M21.25 4.42v7.25h3.99V4.33l5.16 2.92 2-3.36L27.14.97A7.7 7.7 0 0 0 23.15 0c-1.36 0-2.72.35-3.89 1.06L14 3.98l1.99 3.36z" }), _jsx("path", { fill: "#ee4642", d: "M21.16 44.25V37h3.99v7.25l5.16-2.92 2 3.36-5.17 2.92a7.9 7.9 0 0 1-7.88 0L14 44.69l1.99-3.36z" }), _jsx("path", { fill: "#2aad8e", d: "M40.43 13.28L34 16.9l1.99 3.36 6.44-3.62v5.83h3.99v-5.92c0-1.33-.37-2.65-1.09-3.8a8.82 8.82 0 0 0-2.9-2.83L37.17 7l-1.99 3.36z" }), _jsx("path", { fill: "#d71d4f", d: "M4.99 32.84l6.43-3.63 2 3.36-6.44 3.63 5.17 2.91-2 3.36-5.25-2.92a7.6 7.6 0 0 1-2.81-2.82A7.1 7.1 0 0 1 1 32.92V27h3.99z" }), _jsx("path", { fill: "#9e2569", d: "M4.08 16.64l6.43 3.62 2-3.36-6.44-3.62 5.17-2.92-2-3.36-5.25 2.92a8.72 8.72 0 0 0-2.9 2.83A7.16 7.16 0 0 0 0 16.64v5.92h3.99z" }), _jsx("path", { fill: "#f79836", d: "M40.34 36.2L34 32.57l1.99-3.36 6.44 3.63V27h3.99v5.92c0 1.33-.37 2.57-1.09 3.81a8.69 8.69 0 0 1-2.9 2.82l-5.26 2.92-1.99-3.36z" }), _jsx("path", { fill: "#007664", d: "M24 15v8.22l7.34-4.06z" }), _jsx("path", { fill: "#9e2569", d: "M23.25 15L16 19.16l7.25 4.06z" }), _jsx("path", { fill: "#d71d4f", d: "M22.25 25.07L15 21v8.13z" }), _jsx("path", { fill: "#2aad8e", d: "M24 24.98l7.25 4.07V21z" }), _jsx("path", { fill: "#ee4642", d: "M23.16 26L16 30.07l7.16 4.15z" }), _jsx("path", { fill: "#f79836", d: "M24 26v8.22l7.25-4.15z" })] }));
2
+ const Logo = () => (_jsxs("svg", { width: "186", height: "49", viewBox: "0 0 186 49", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M72.2048 18.0991C72.2048 16.0685 71.0283 14.9207 67.68 14.9207C64.3317 14.9207 63.1552 16.0685 63.1552 18.0991V18.8054C63.1552 20.4829 64.2412 21.0126 65.0556 21.2775L72.0238 23.8379C74.2862 24.7207 76.1866 26.1334 76.1866 28.8703V31.9604C76.1866 35.0505 73.9242 37.6991 67.5895 37.6991C61.1643 37.6991 58.9924 35.0505 58.9924 31.9604V29.9298C58.9924 29.4 59.2639 29.2235 59.8069 29.2235H62.0693C62.5218 29.2235 62.7027 29.4 62.7027 29.9298V31.6072C62.7027 33.6379 64.1507 34.7856 67.5895 34.7856C71.0283 34.7856 72.4763 33.6379 72.4763 31.6072V29.8415C72.4763 27.9874 70.7568 27.3694 69.3089 26.7514L62.8837 24.3676C61.1643 23.7496 59.5354 22.0721 59.5354 19.7766V17.6577C59.5354 14.5676 61.5263 11.9189 67.68 11.9189C73.9242 11.9189 75.9151 14.5676 75.9151 17.6577V19.3352C75.9151 19.7766 75.7341 20.0415 75.2816 20.0415H73.0192C72.4763 20.0415 72.2048 19.8649 72.2048 19.3352V18.0991Z", fill: "white" }), _jsx("path", { d: "M97.0913 32.0487C97.0913 35.1388 95.1909 37.7874 88.5847 37.7874C81.9785 37.7874 80.0781 35.1388 80.0781 32.0487V17.6577C80.0781 14.5676 81.9785 11.9189 88.5847 11.9189C95.1909 11.9189 97.0913 14.5676 97.0913 17.6577V19.5117C97.0913 20.0415 96.9103 20.218 96.3673 20.218H94.1954C93.6524 20.218 93.381 20.0415 93.381 19.5117V18.2757C93.381 16.2451 92.0235 15.009 88.5847 15.009C85.1459 15.009 83.7884 16.2451 83.7884 18.2757V31.5189C83.7884 33.5496 85.1459 34.7856 88.5847 34.7856C92.0235 34.7856 93.381 33.5496 93.381 31.5189V29.7532C93.381 29.3117 93.6524 29.0469 94.1954 29.0469H96.3673C96.8198 29.0469 97.0913 29.3117 97.0913 29.7532V32.0487Z", fill: "white" }), _jsx("path", { d: "M125.235 34.4322H135.009C135.461 34.4322 135.823 34.6088 135.823 35.1385V36.816C135.823 37.3458 135.461 37.5223 135.009 37.5223H122.068C121.616 37.5223 121.435 37.2575 121.435 36.816V12.9782C121.435 12.4485 121.616 12.1836 122.159 12.1836H124.511C124.964 12.1836 125.235 12.4485 125.235 12.9782V34.4322Z", fill: "white" }), _jsx("path", { d: "M164.148 12.1836C164.601 12.1836 164.782 12.3602 164.782 12.8899V14.5674C164.782 15.0971 164.691 15.2737 164.148 15.2737H158.175V36.816C158.175 37.3458 157.904 37.5223 157.361 37.5223H155.008C154.556 37.5223 154.194 37.2575 154.194 36.816V15.2737H148.221C147.678 15.2737 147.587 15.0971 147.587 14.5674V12.8899C147.587 12.3602 147.678 12.1836 148.221 12.1836H164.148Z", fill: "white" }), _jsx("path", { d: "M72.2048 18.0991C72.2048 16.0685 71.0283 14.9207 67.68 14.9207C64.3317 14.9207 63.1552 16.0685 63.1552 18.0991V18.8054C63.1552 20.4829 64.2412 21.0126 65.0556 21.2775L72.0238 23.8379C74.2862 24.7207 76.1866 26.1334 76.1866 28.8703V31.9604C76.1866 35.0505 73.9242 37.6991 67.5895 37.6991C61.1643 37.6991 58.9924 35.0505 58.9924 31.9604V29.9298C58.9924 29.4 59.2639 29.2235 59.8069 29.2235H62.0693C62.5218 29.2235 62.7027 29.4 62.7027 29.9298V31.6072C62.7027 33.6379 64.1507 34.7856 67.5895 34.7856C71.0283 34.7856 72.4763 33.6379 72.4763 31.6072V29.8415C72.4763 27.9874 70.7568 27.3694 69.3089 26.7514L62.8837 24.3676C61.1643 23.7496 59.5354 22.0721 59.5354 19.7766V17.6577C59.5354 14.5676 61.5263 11.9189 67.68 11.9189C73.9242 11.9189 75.9151 14.5676 75.9151 17.6577V19.3352C75.9151 19.7766 75.7341 20.0415 75.2816 20.0415H73.0192C72.4763 20.0415 72.2048 19.8649 72.2048 19.3352V18.0991Z", fill: "white" }), _jsx("path", { d: "M97.0913 32.0487C97.0913 35.1388 95.1909 37.7874 88.5847 37.7874C81.9785 37.7874 80.0781 35.1388 80.0781 32.0487V17.6577C80.0781 14.5676 81.9785 11.9189 88.5847 11.9189C95.1909 11.9189 97.0913 14.5676 97.0913 17.6577V19.5117C97.0913 20.0415 96.9103 20.218 96.3673 20.218H94.1954C93.6524 20.218 93.381 20.0415 93.381 19.5117V18.2757C93.381 16.2451 92.0235 15.009 88.5847 15.009C85.1459 15.009 83.7884 16.2451 83.7884 18.2757V31.5189C83.7884 33.5496 85.1459 34.7856 88.5847 34.7856C92.0235 34.7856 93.381 33.5496 93.381 31.5189V29.7532C93.381 29.3117 93.6524 29.0469 94.1954 29.0469H96.3673C96.8198 29.0469 97.0913 29.3117 97.0913 29.7532V32.0487Z", fill: "white" }), _jsx("path", { d: "M125.235 34.4322H135.009C135.461 34.4322 135.823 34.6088 135.823 35.1385V36.816C135.823 37.3458 135.461 37.5223 135.009 37.5223H122.068C121.616 37.5223 121.435 37.2575 121.435 36.816V12.9782C121.435 12.4485 121.616 12.1836 122.159 12.1836H124.511C124.964 12.1836 125.235 12.4485 125.235 12.9782V34.4322Z", fill: "white" }), _jsx("path", { d: "M143.515 36.816C143.515 37.3458 143.334 37.5223 142.791 37.5223H140.438C139.986 37.5223 139.805 37.2575 139.805 36.816V12.9782C139.805 12.4485 139.895 12.1836 140.438 12.1836H142.791C143.334 12.1836 143.515 12.4485 143.515 12.9782V36.816Z", fill: "white" }), _jsx("path", { d: "M164.148 12.1836C164.601 12.1836 164.782 12.3602 164.782 12.8899V14.5674C164.782 15.0971 164.691 15.2737 164.148 15.2737H158.175V36.816C158.175 37.3458 157.904 37.5223 157.361 37.5223H155.008C154.556 37.5223 154.194 37.2575 154.194 36.816V15.2737H148.221C147.678 15.2737 147.587 15.0971 147.587 14.5674V12.8899C147.587 12.3602 147.678 12.1836 148.221 12.1836H164.148Z", fill: "white" }), _jsx("path", { d: "M175.279 23.9259L180.98 12.8899C181.161 12.5367 181.342 12.1836 181.795 12.1836H184.148C184.691 12.1836 184.962 12.4485 184.691 12.8899L177.179 27.4575V36.816C177.179 37.2575 176.998 37.5223 176.455 37.5223H174.103C173.56 37.5223 173.469 37.2575 173.469 36.816V27.4575L165.867 12.8899C165.596 12.4485 165.867 12.1836 166.41 12.1836H168.673C169.216 12.1836 169.306 12.4485 169.578 12.8899L175.279 23.9259Z", fill: "white" }), _jsx("path", { d: "M109.851 12.1836C110.303 12.1836 110.575 12.4485 110.756 12.8899L118.176 36.816C118.357 37.2575 118.176 37.5223 117.633 37.5223H115.19C114.738 37.5223 114.466 37.2575 114.376 36.816L112.656 31.0773H104.693L102.973 36.816C102.883 37.2575 102.611 37.5223 102.159 37.5223H99.7153C99.1724 37.5223 98.9914 37.2575 99.1724 36.816L106.593 12.8899C106.774 12.4485 107.045 12.1836 107.498 12.1836H109.851ZM108.674 17.6575L105.507 28.2521H111.751L108.674 17.6575Z", fill: "white" }), _jsx("path", { d: "M21.0748 4.41441V11.6541H25.0566V4.32613L30.2149 7.23964L32.2058 3.88469L26.9571 0.971171C25.7806 0.264865 24.4232 0 22.9753 0C21.6178 0 20.2604 0.353153 19.0839 1.05946L13.8352 3.97297L15.8261 7.32793L21.0748 4.41441Z", fill: "#005357" }), _jsx("path", { d: "M21.0749 44.5856V37.3459H25.0567V44.5856L30.215 41.6721L32.2059 45.027L27.0476 47.9405C25.8712 48.6469 24.4233 49 23.0658 49C21.7084 49 20.351 48.6469 19.1745 47.9405L13.9258 45.027L15.9167 41.6721L21.0749 44.5856Z", fill: "#FD8144" }), _jsx("path", { d: "M39.8981 12.7133L33.4729 16.3331L35.4638 19.6881L41.889 16.0682V21.8953H45.8708V15.98C45.8708 14.6556 45.5088 13.3313 44.7848 12.1836C44.0609 11.0358 43.0654 10.0646 41.889 9.35834L36.6402 6.44482L34.6493 9.79978L39.8981 12.7133Z", fill: "#0AADA6" }), _jsx("path", { d: "M4.24279 32.8434L10.668 29.2236L12.6589 32.5785L6.23369 36.1983L11.3919 39.1119L9.40103 42.4668L4.15229 39.5533C2.97585 38.847 1.9804 37.8758 1.34693 36.7281C0.622968 35.5803 0.260986 34.256 0.260986 32.9317V27.0164H4.24279V32.8434Z", fill: "#E84855" }), _jsx("path", { d: "M4.24271 16.1569L10.6679 19.7767L12.6588 16.4217L6.23361 12.8019L11.3919 9.8884L9.40095 6.53345L4.15221 9.44696C2.97577 10.1533 1.98032 11.1244 1.25636 12.2722C0.532392 13.4199 0.17041 14.7443 0.17041 16.1569V22.0722H4.15221L4.24271 16.1569Z", fill: "#A14FBF" }), _jsx("path", { d: "M39.8982 36.1983L33.5635 32.5785L35.5544 29.2236L41.9796 32.8434V27.0164H45.9614V32.9317C45.9614 34.256 45.5994 35.492 44.8754 36.7281C44.1514 37.8758 43.156 38.847 41.9796 39.5533L36.7308 42.4668L34.7399 39.1119L39.8982 36.1983Z", fill: "#F8F32B" }), _jsx("path", { d: "M23.6086 15.3623V23.5731L30.9388 19.5119L23.6086 15.3623Z", fill: "#005357" }), _jsx("path", { d: "M22.5226 15.3623L15.283 19.5119L22.5226 23.5731V15.3623Z", fill: "#A14FBF" }), _jsx("path", { d: "M22.0705 24.4558L14.8308 20.3945V28.5171L22.0705 24.4558Z", fill: "#E84855" }), _jsx("path", { d: "M24.1519 24.4559L31.3915 28.5171V20.4829L24.1519 24.4559Z", fill: "#0AADA6" }), _jsx("path", { d: "M22.5227 25.4272L15.3735 29.4885L22.5227 33.6381V25.4272Z", fill: "#FD8144" }), _jsx("path", { d: "M23.6086 25.4272V33.6381L30.8483 29.4885L23.6086 25.4272Z", fill: "#F8F32B" })] }));
3
3
  export { Logo };
package/dist/index.css CHANGED
@@ -9,7 +9,8 @@ body {
9
9
  font-family: 'Lato';
10
10
  font-style: normal;
11
11
  font-weight: normal;
12
- src: local(''), url('./style/fonts/Lato-Regular.woff2') format('woff2'),
12
+ src:
13
+ url('./style/fonts/Lato-Regular.woff2') format('woff2'),
13
14
  /* Chrome 26+, Opera 23+, Firefox 39+ */
14
15
  url('./style/fonts/Lato-Regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
15
16
  }
@@ -19,7 +20,8 @@ body {
19
20
  font-family: 'Lato';
20
21
  font-style: normal;
21
22
  font-weight: bold;
22
- src: local(''), url('./style/fonts/Lato-Bold.woff2') format('woff2'),
23
+ src:
24
+ url('./style/fonts/Lato-Bold.woff2') format('woff2'),
23
25
  /* Chrome 26+, Opera 23+, Firefox 39+ */ url('./style/fonts/Lato-Bold.woff')
24
26
  format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
25
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scality/core-ui",
3
- "version": "0.180.0",
3
+ "version": "0.182.0",
4
4
  "description": "Scality common React component library",
5
5
  "author": "Scality Engineering",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -297,7 +297,7 @@ export const Barchart = <T extends BarchartBars>(props: BarchartProps<T>) => {
297
297
  {} as Record<string, ChartColors | string>,
298
298
  );
299
299
 
300
- const { rechartsBars, unitLabel, roundReferenceValue, rechartsData } =
300
+ const { rechartsBars, unitLabel, roundReferenceValue, rechartsData, topDomain } =
301
301
  useChartData(
302
302
  bars || [],
303
303
  type,
@@ -363,7 +363,7 @@ export const Barchart = <T extends BarchartBars>(props: BarchartProps<T>) => {
363
363
 
364
364
  <YAxis
365
365
  interval={0}
366
- domain={[0, roundReferenceValue]}
366
+ domain={[0, topDomain]}
367
367
  ticks={getTicks(roundReferenceValue, false)}
368
368
  tickFormatter={
369
369
  (value) => new Intl.NumberFormat('fr-FR').format(value) // Add a space as thousand separator
@@ -507,41 +507,41 @@ describe('applySortingToData', () => {
507
507
  describe('getRoundReferenceValue', () => {
508
508
  it('should return appropriate rounded values with 10% buffer', () => {
509
509
  // Small values (< 10)
510
- expect(getRoundReferenceValue(0.1)).toBe(0.2); // 0.1 → 0.11 → 0.2
511
- expect(getRoundReferenceValue(1)).toBe(2); // 1.1 → 1.52
512
- expect(getRoundReferenceValue(2)).toBe(5); // 2.2 → 3 5
513
- expect(getRoundReferenceValue(3)).toBe(5); // 3.3 → 4 5
510
+ expect(getRoundReferenceValue(0.1)).toBe(0.1); // 0.1 → 0.11 → 0.1 (magnitude 0.1, remainder 0.01)
511
+ expect(getRoundReferenceValue(1)).toBe(1); // 1 → 1.11 (magnitude 1, remainder 0.1)
512
+ expect(getRoundReferenceValue(2)).toBe(2); // 2 → 2.2 → 2 (magnitude 1, remainder 0.2)
513
+ expect(getRoundReferenceValue(3)).toBe(3); // 3 → 3.3 → 3 (magnitude 1, remainder 0.3)
514
514
 
515
515
  // Values 5-10 range
516
- expect(getRoundReferenceValue(6)).toBe(10); // 6.6 → 10 (skip 7.5 for values < 10)
517
- expect(getRoundReferenceValue(9)).toBe(10); // 9.9 → 10
516
+ expect(getRoundReferenceValue(6)).toBe(6); // 6 → 6.6 → 6 (magnitude 1, remainder 0.6)
517
+ expect(getRoundReferenceValue(9)).toBe(9); // 9 → 9.9 → 9 (magnitude 1, remainder 0.9)
518
518
 
519
519
  // Larger values get 10% buffer applied
520
- expect(getRoundReferenceValue(15)).toBe(20); // 16.5 20
521
- expect(getRoundReferenceValue(35)).toBe(40); // 38.5 40
522
- expect(getRoundReferenceValue(75)).toBe(100); // 82.5 100
523
- expect(getRoundReferenceValue(150)).toBe(200); // 165200
524
- expect(getRoundReferenceValue(350)).toBe(400); // 385400
525
- expect(getRoundReferenceValue(750)).toBe(1000); // 8251000
526
- expect(getRoundReferenceValue(1500)).toBe(2000); // 16502000
527
- expect(getRoundReferenceValue(3500)).toBe(4000); // 38504000
528
- expect(getRoundReferenceValue(7500)).toBe(10000); // 825010000
529
- expect(getRoundReferenceValue(15000)).toBe(20000); // 1650020000
520
+ expect(getRoundReferenceValue(15)).toBe(10); // 15 → 16.5, remainder 5, incremented 20 > 16.5, so round down to 10
521
+ expect(getRoundReferenceValue(35)).toBe(30); // 35 → 38.5, remainder 5, incremented 40 > 38.5, so round down to 30
522
+ expect(getRoundReferenceValue(75)).toBe(80); // 75 → 82.5, remainder 5, incremented 80 <= 82.5, so round up to 80
523
+ expect(getRoundReferenceValue(150)).toBe(150); // 150165, remainder 0, so return 150
524
+ expect(getRoundReferenceValue(350)).toBe(350); // 350385, remainder 0, so return 350
525
+ expect(getRoundReferenceValue(750)).toBe(750); // 750825, remainder 0, so return 750
526
+ expect(getRoundReferenceValue(1500)).toBe(1500); // 15001650, remainder 0, so return 1500
527
+ expect(getRoundReferenceValue(3500)).toBe(3500); // 35003850, remainder 0, so return 3500
528
+ expect(getRoundReferenceValue(7500)).toBe(7500); // 75008250, remainder 0, so return 7500
529
+ expect(getRoundReferenceValue(15000)).toBe(15000); // 1500016500, remainder 0, so return 15000
530
530
  });
531
531
  });
532
532
 
533
533
  describe('getTicks', () => {
534
534
  describe('small values (< 10)', () => {
535
535
  it('should return 2 ticks for non-symmetrical small values', () => {
536
- expect(getTicks(1, false)).toEqual([0, 1]);
537
- expect(getTicks(2, false)).toEqual([0, 2]);
538
- expect(getTicks(5, false)).toEqual([0, 5]);
536
+ expect(getTicks(1, false)).toEqual([0, 0.5, 1]); // 1 % 2 != 0, defaults to 3 ticks
537
+ expect(getTicks(2, false)).toEqual([0, 1, 2]); // 2 % (3-1) == 0, uses 3 ticks
538
+ expect(getTicks(5, false)).toEqual([0, 2.5, 5]); // 5 % 2 != 0 and 5 % 3 != 0, defaults to 3 ticks
539
539
  });
540
540
 
541
541
  it('should return 3 ticks for symmetrical small values', () => {
542
- expect(getTicks(1, true)).toEqual([-1, 0, 1]);
543
- expect(getTicks(2, true)).toEqual([-2, 0, 2]);
544
- expect(getTicks(5, true)).toEqual([-5, 0, 5]);
542
+ expect(getTicks(1, true)).toEqual([-1, -0.5, 0, 0.5, 1]); // 1 % 2 != 0, defaults to 3 ticks, symmetrical adds negatives
543
+ expect(getTicks(2, true)).toEqual([-2, -1, 0, 1, 2]); // 2 % (3-1) == 0, uses 3 ticks, symmetrical adds negatives
544
+ expect(getTicks(5, true)).toEqual([-5, -2.5, 0, 2.5, 5]); // 5 % 2 != 0 and 5 % 3 != 0, defaults to 3 ticks, symmetrical adds negatives
545
545
  });
546
546
  });
547
547
 
@@ -738,8 +738,8 @@ describe('computeUnitLabelAndRoundReferenceValue', () => {
738
738
  );
739
739
 
740
740
  expect(result.unitLabel).toBe('kB');
741
- // 1680 / 1000 = 1.68, with buffer: 1.848 → rounds to 2
742
- expect(result.roundReferenceValue).toBe(2);
741
+ // 1680 / 1000 = 1.68, with buffer: 1.848 → rounds to 1 (magnitude 1, remainder 0.848)
742
+ expect(result.roundReferenceValue).toBe(1);
743
743
  expect(result.rechartsData).toEqual([
744
744
  {
745
745
  category: 'category1',
@@ -772,8 +772,8 @@ describe('computeUnitLabelAndRoundReferenceValue', () => {
772
772
  );
773
773
 
774
774
  expect(result.unitLabel).toBe('B');
775
- // 680 with buffer: 748 → rounds to 800 (8 * 100, value > 10)
776
- expect(result.roundReferenceValue).toBe(800);
775
+ // 680 with buffer: 748 → rounds to 680 (value >= 10, remainder 0, rounds down)
776
+ expect(result.roundReferenceValue).toBe(680);
777
777
  expect(result.rechartsData).toEqual([
778
778
  { category: 'category1', success: 680 },
779
779
  ]);
@@ -5,47 +5,39 @@ import { useChartLegend } from '../chartlegend/ChartLegendWrapper';
5
5
 
6
6
  export const getRoundReferenceValue = (value: number): number => {
7
7
  if (value <= 0) return 1; // Default for zero or negative values
8
+
9
+ // Buffer the value by 10% to avoid being too close to the edge of the chart
10
+ const bufferedValue = value * 1.1;
11
+
12
+ if (value >= 10) {
13
+ const remainder = value % 10;
14
+ const incremented = value + (10 - remainder);
15
+
16
+ // If the remainder is less than 5, round down to the nearest 10
17
+ if (remainder < 5) {
18
+ return value - remainder;
19
+ }
20
+
21
+ // If incrementing would exceed the buffered max, also round down
22
+ if (incremented > bufferedValue) {
23
+ return value - remainder;
24
+ }
25
+
26
+ // Otherwise, round up to the next 10
27
+ return incremented;
28
+ }
8
29
 
9
- // Get the magnitude (10^n where n is the number of digits - 1)
10
30
  const magnitude = Math.pow(10, Math.floor(Math.log10(value)));
11
31
 
12
- // Buffer the value by 10% to avoid being too close to the edge of the chart
13
- const bufferedValue = value * 1.1;
32
+ const remainder = bufferedValue % magnitude;
14
33
 
15
- // Normalized value between 1 and 10
16
- const normalized = bufferedValue / magnitude;
17
-
18
- // Round to nice numbers based on normalized value
19
- // skip 1.5, 3, 4, 7.5 as top value for better chart
20
- // appearance for small values
21
- let result: number;
22
-
23
- if (normalized <= 1) result = magnitude;
24
- else if (value > 10 && normalized <= 1.5) result = 1.5 * magnitude;
25
- else if (normalized <= 2) result = 2 * magnitude;
26
- else if (value > 10 && normalized <= 2.5) result = 2.5 * magnitude;
27
- else if (value > 10 && normalized <= 3) result = 3 * magnitude;
28
- else if (value > 10 && normalized <= 4) result = 4 * magnitude;
29
- else if (normalized <= 5) result = 5 * magnitude;
30
- else if (value > 10 && normalized <= 6) result = 6 * magnitude;
31
- else if (value > 10 && normalized <= 8) result = 8 * magnitude;
32
- else if (normalized <= 10) result = 10 * magnitude;
33
- else result = 10 * magnitude;
34
-
35
- return result;
34
+ return remainder === 0 ? bufferedValue : bufferedValue - remainder;
36
35
  };
37
36
 
38
37
  export const getTicks = (topValue: number, isSymmetrical: boolean) => {
39
- if (topValue < 10) {
40
- if (isSymmetrical) {
41
- return [-topValue, 0, topValue];
42
- } else {
43
- return [0, topValue];
44
- }
45
- }
46
38
  const possibleTickNumbers = [4, 3];
47
39
  const numberOfTicks =
48
- possibleTickNumbers.find((number) => topValue % (number - 1) === 0) || 2; // Default to 2 ticks if no match
40
+ possibleTickNumbers.find((number) => topValue % (number - 1) === 0) || 3; // Default to 2 ticks if no match
49
41
  const tickInterval = topValue / (numberOfTicks - 1);
50
42
  const ticks = Array.from(
51
43
  { length: numberOfTicks },
@@ -339,7 +331,7 @@ export const computeUnitLabelAndRoundReferenceValue = (
339
331
  ) => {
340
332
  if (!unitRange) {
341
333
  const roundReferenceValue = getRoundReferenceValue(maxValue);
342
- return { unitLabel: undefined, roundReferenceValue, rechartsData: data };
334
+ return { unitLabel: undefined, roundReferenceValue, rechartsData: data, topDomain: maxValue * 1.1 };
343
335
  }
344
336
 
345
337
  const { valueBase, unitLabel } = getUnitLabel(unitRange, maxValue);
@@ -354,7 +346,7 @@ export const computeUnitLabelAndRoundReferenceValue = (
354
346
  });
355
347
  return normalizedDataPoint;
356
348
  });
357
- return { unitLabel, roundReferenceValue, rechartsData };
349
+ return { unitLabel, roundReferenceValue, rechartsData, topDomain: topValue * 1.1 };
358
350
  };
359
351
 
360
352
  /**
@@ -534,12 +526,13 @@ export const useChartData = <T extends BarchartBars>(
534
526
 
535
527
  const maxValue = getMaxBarValue(filteredData, stacked);
536
528
 
537
- const { unitLabel, roundReferenceValue, rechartsData } =
529
+ const { unitLabel, roundReferenceValue, rechartsData, topDomain } =
538
530
  computeUnitLabelAndRoundReferenceValue(filteredData, maxValue, unitRange);
539
531
 
540
532
  return {
541
533
  rechartsBars: filteredRechartsBars,
542
534
  unitLabel,
535
+ topDomain,
543
536
  roundReferenceValue,
544
537
  rechartsData,
545
538
  };
@@ -41,11 +41,13 @@ export type ChartLegendWrapperProps = {
41
41
  colorSet:
42
42
  | Record<string, ChartColors | string>
43
43
  | ((seriesNames: string[]) => Record<string, ChartColors | string>);
44
+ sortOrder?: 'alphabetical' | 'status' | ((a: string, b: string) => number);
44
45
  };
45
46
 
46
47
  export const ChartLegendWrapper = ({
47
48
  children,
48
49
  colorSet,
50
+ sortOrder = 'alphabetical',
49
51
  }: ChartLegendWrapperProps) => {
50
52
  const [registeredColorSets, setRegisteredColorSets] = useState<
51
53
  Record<string, string[]>
@@ -133,8 +135,20 @@ export const ChartLegendWrapper = ({
133
135
  );
134
136
 
135
137
  const listResources = useCallback(() => {
136
- return Object.keys(internalColorSet).sort();
137
- }, [internalColorSet]);
138
+ const resources = Object.keys(internalColorSet);
139
+
140
+ if (sortOrder === 'alphabetical') {
141
+ return resources.sort((a, b) => a.localeCompare(b));
142
+ } else if (sortOrder === 'status') {
143
+ return ['Success', 'Warning', 'Failed'].filter((status) =>
144
+ resources.includes(status),
145
+ );
146
+ } else if (typeof sortOrder === 'function') {
147
+ return resources.sort(sortOrder);
148
+ }
149
+
150
+ return resources;
151
+ }, [internalColorSet, sortOrder]);
138
152
 
139
153
  const chartLegendState = useMemo(
140
154
  () => ({
@@ -360,13 +360,7 @@ export function LineTimeSerieChart({
360
360
  }, [chartData]);
361
361
 
362
362
  // 3. Transform the data base on the valuebase
363
- const { topValue, unitLabel, rechartsData } = useMemo(() => {
364
- if (yAxisType === 'percentage')
365
- return {
366
- topValue: 100,
367
- unitLabel: '%',
368
- rechartsData: chartData,
369
- };
363
+ const { topValue, unitLabel, rechartsData, topDomain } = useMemo(() => {
370
364
 
371
365
  const values = chartData.flatMap((dataPoint) =>
372
366
  Object.entries(dataPoint)
@@ -383,19 +377,20 @@ export function LineTimeSerieChart({
383
377
  if (values.length === 0) {
384
378
  return {
385
379
  topValue: 100, // Default value for empty charts
386
- unitLabel: '',
380
+ unitLabel: yAxisType === 'percentage' ? '%' : '',
387
381
  rechartsData: [],
382
+ topDomain: 100,
388
383
  };
389
384
  }
390
385
 
391
386
  const top = Math.abs(Math.max(...values));
392
387
  const bottom = Math.abs(Math.min(...values));
393
388
  const maxValue = Math.max(top, bottom);
394
-
395
- const { valueBase, unitLabel } = getUnitLabel(unitRange ?? [], maxValue);
389
+ const { valueBase, unitLabel } = yAxisType === 'percentage' ? { valueBase: 1, unitLabel: '%' } : getUnitLabel(unitRange ?? [], maxValue);
396
390
  // Use round reference value to add extra padding to the top value
397
- const topValue = getRoundReferenceValue(maxValue / valueBase);
398
-
391
+ const basedValue = maxValue / valueBase
392
+ const topDomain = basedValue * 1.1;
393
+ const topValue = getRoundReferenceValue(basedValue);
399
394
  const rechartsData = chartData.map((dataPoint) => {
400
395
  const normalizedDataPoint = { ...dataPoint };
401
396
  Object.entries(dataPoint).forEach(([key, value]) => {
@@ -406,7 +401,7 @@ export function LineTimeSerieChart({
406
401
  return normalizedDataPoint;
407
402
  });
408
403
 
409
- return { topValue, unitLabel, rechartsData };
404
+ return { topValue, unitLabel, rechartsData, topDomain };
410
405
  }, [chartData, yAxisType, unitRange]);
411
406
 
412
407
  // Group series by resource and create color mapping
@@ -522,10 +517,10 @@ export function LineTimeSerieChart({
522
517
  }}
523
518
  domain={
524
519
  yAxisType === 'percentage'
525
- ? [0, 100]
520
+ ? [0, topDomain]
526
521
  : yAxisType === 'symmetrical'
527
- ? [-topValue, topValue]
528
- : [0, topValue]
522
+ ? [-topDomain, topDomain]
523
+ : [0, topDomain]
529
524
  }
530
525
  axisLine={{ stroke: theme.border }}
531
526
  tick={{
@@ -1,47 +1,21 @@
1
1
  import React from 'react';
2
2
 
3
3
  const Logo = () => (
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- width="49"
7
- height="49"
8
- viewBox="0 0 49 49"
9
- >
10
- <path
11
- fill="#3d9bd6"
12
- d="M21.25 4.42v7.25h3.99V4.33l5.16 2.92 2-3.36L27.14.97A7.7 7.7 0 0 0 23.15 0c-1.36 0-2.72.35-3.89 1.06L14 3.98l1.99 3.36z"
13
- />
14
- <path
15
- fill="#007664"
16
- d="M21.25 4.42v7.25h3.99V4.33l5.16 2.92 2-3.36L27.14.97A7.7 7.7 0 0 0 23.15 0c-1.36 0-2.72.35-3.89 1.06L14 3.98l1.99 3.36z"
17
- />
18
- <path
19
- fill="#ee4642"
20
- d="M21.16 44.25V37h3.99v7.25l5.16-2.92 2 3.36-5.17 2.92a7.9 7.9 0 0 1-7.88 0L14 44.69l1.99-3.36z"
21
- />
22
- <path
23
- fill="#2aad8e"
24
- d="M40.43 13.28L34 16.9l1.99 3.36 6.44-3.62v5.83h3.99v-5.92c0-1.33-.37-2.65-1.09-3.8a8.82 8.82 0 0 0-2.9-2.83L37.17 7l-1.99 3.36z"
25
- />
26
- <path
27
- fill="#d71d4f"
28
- d="M4.99 32.84l6.43-3.63 2 3.36-6.44 3.63 5.17 2.91-2 3.36-5.25-2.92a7.6 7.6 0 0 1-2.81-2.82A7.1 7.1 0 0 1 1 32.92V27h3.99z"
29
- />
30
- <path
31
- fill="#9e2569"
32
- d="M4.08 16.64l6.43 3.62 2-3.36-6.44-3.62 5.17-2.92-2-3.36-5.25 2.92a8.72 8.72 0 0 0-2.9 2.83A7.16 7.16 0 0 0 0 16.64v5.92h3.99z"
33
- />
34
- <path
35
- fill="#f79836"
36
- d="M40.34 36.2L34 32.57l1.99-3.36 6.44 3.63V27h3.99v5.92c0 1.33-.37 2.57-1.09 3.81a8.69 8.69 0 0 1-2.9 2.82l-5.26 2.92-1.99-3.36z"
37
- />
38
- <path fill="#007664" d="M24 15v8.22l7.34-4.06z" />
39
- <path fill="#9e2569" d="M23.25 15L16 19.16l7.25 4.06z" />
40
- <path fill="#d71d4f" d="M22.25 25.07L15 21v8.13z" />
41
- <path fill="#2aad8e" d="M24 24.98l7.25 4.07V21z" />
42
- <path fill="#ee4642" d="M23.16 26L16 30.07l7.16 4.15z" />
43
- <path fill="#f79836" d="M24 26v8.22l7.25-4.15z" />
44
- </svg>
4
+ <svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
5
+
6
+ <path d="M21.0748 4.41441V11.6541H25.0566V4.32613L30.2149 7.23964L32.2058 3.88469L26.9571 0.971171C25.7806 0.264865 24.4232 0 22.9753 0C21.6178 0 20.2604 0.353153 19.0839 1.05946L13.8352 3.97297L15.8261 7.32793L21.0748 4.41441Z" fill="#005357"/>
7
+ <path d="M21.0749 44.5856V37.3459H25.0567V44.5856L30.215 41.6721L32.2059 45.027L27.0476 47.9405C25.8712 48.6469 24.4233 49 23.0658 49C21.7084 49 20.351 48.6469 19.1745 47.9405L13.9258 45.027L15.9167 41.6721L21.0749 44.5856Z" fill="#FD8144"/>
8
+ <path d="M39.8981 12.7133L33.4729 16.3331L35.4638 19.6881L41.889 16.0682V21.8953H45.8708V15.98C45.8708 14.6556 45.5088 13.3313 44.7848 12.1836C44.0609 11.0358 43.0654 10.0646 41.889 9.35834L36.6402 6.44482L34.6493 9.79978L39.8981 12.7133Z" fill="#0AADA6"/>
9
+ <path d="M4.24279 32.8434L10.668 29.2236L12.6589 32.5785L6.23369 36.1983L11.3919 39.1119L9.40103 42.4668L4.15229 39.5533C2.97585 38.847 1.9804 37.8758 1.34693 36.7281C0.622968 35.5803 0.260986 34.256 0.260986 32.9317V27.0164H4.24279V32.8434Z" fill="#E84855"/>
10
+ <path d="M4.24271 16.1569L10.6679 19.7767L12.6588 16.4217L6.23361 12.8019L11.3919 9.8884L9.40095 6.53345L4.15221 9.44696C2.97577 10.1533 1.98032 11.1244 1.25636 12.2722C0.532392 13.4199 0.17041 14.7443 0.17041 16.1569V22.0722H4.15221L4.24271 16.1569Z" fill="#A14FBF"/>
11
+ <path d="M39.8982 36.1983L33.5635 32.5785L35.5544 29.2236L41.9796 32.8434V27.0164H45.9614V32.9317C45.9614 34.256 45.5994 35.492 44.8754 36.7281C44.1514 37.8758 43.156 38.847 41.9796 39.5533L36.7308 42.4668L34.7399 39.1119L39.8982 36.1983Z" fill="#F8F32B"/>
12
+ <path d="M23.6086 15.3623V23.5731L30.9388 19.5119L23.6086 15.3623Z" fill="#005357"/>
13
+ <path d="M22.5226 15.3623L15.283 19.5119L22.5226 23.5731V15.3623Z" fill="#A14FBF"/>
14
+ <path d="M22.0705 24.4558L14.8308 20.3945V28.5171L22.0705 24.4558Z" fill="#E84855"/>
15
+ <path d="M24.1519 24.4559L31.3915 28.5171V20.4829L24.1519 24.4559Z" fill="#0AADA6"/>
16
+ <path d="M22.5227 25.4272L15.3735 29.4885L22.5227 33.6381V25.4272Z" fill="#FD8144"/>
17
+ <path d="M23.6086 25.4272V33.6381L30.8483 29.4885L23.6086 25.4272Z" fill="#F8F32B"/>
18
+ </svg>
45
19
  );
46
20
 
47
21
  export { Logo };
@@ -1,53 +1,29 @@
1
1
  const Logo = () => (
2
- <svg
3
- xmlns="http://www.w3.org/2000/svg"
4
- width="186"
5
- height="49"
6
- viewBox="0 0 186 49"
7
- >
8
- <path
9
- fill="#fff"
10
- d="M72.23 18.19c0-2.03-1.18-3.18-4.53-3.18-3.35 0-4.53 1.15-4.53 3.18v.71c0 1.68 1.09 2.21 1.9 2.47l6.98 2.57c2.27.88 4.17 2.29 4.17 5.04v3.09c0 3.09-2.27 5.75-8.61 5.75-6.43 0-8.61-2.66-8.61-5.75v-2.03c0-.53.27-.71.82-.71h2.26c.45 0 .64.18.64.71v1.68c0 2.03 1.45 3.18 4.89 3.18 3.44 0 4.89-1.15 4.89-3.18v-1.77c0-1.86-1.72-2.48-3.17-3.1l-6.43-2.38a4.98 4.98 0 0 1-3.36-4.6v-2.12c0-3.1 2-5.75 8.16-5.75 6.25 0 8.25 2.65 8.25 5.75v1.68c0 .44-.18.7-.64.7h-2.26c-.55 0-.82-.17-.82-.7zM97.04 32.16c0 3.09-1.91 5.75-8.52 5.75-6.62 0-8.52-2.66-8.52-5.75V17.75c0-3.1 1.9-5.75 8.52-5.75 6.61 0 8.52 2.65 8.52 5.75v1.85c0 .53-.18.71-.73.71h-2.17c-.55 0-.82-.18-.82-.71v-1.23c0-2.04-1.36-3.28-4.8-3.28-3.44 0-4.8 1.24-4.8 3.28v13.26c0 2.03 1.36 3.27 4.8 3.27 3.44 0 4.8-1.24 4.8-3.27v-1.77c0-.44.27-.71.82-.71h2.17c.46 0 .73.27.73.71zM125.81 34.28h9.78c.46 0 .82.18.82.71v1.68c0 .53-.36.71-.82.71h-12.96c-.45 0-.63-.27-.63-.71V12.8c0-.53.18-.8.73-.8h2.35c.45 0 .73.27.73.8zM164.58 12c.46 0 .64.18.64.71v1.68c0 .53-.09.7-.64.7h-5.98v21.58c0 .53-.27.71-.81.71h-2.36c-.45 0-.81-.27-.81-.71V15.09h-5.99c-.54 0-.63-.17-.63-.7v-1.68c0-.53.09-.71.63-.71z"
11
- />
12
- <path
13
- fill="#fff"
14
- d="M72.23 18.19c0-2.03-1.18-3.18-4.53-3.18-3.35 0-4.53 1.15-4.53 3.18v.71c0 1.68 1.09 2.21 1.9 2.47l6.98 2.57c2.27.88 4.17 2.29 4.17 5.04v3.09c0 3.09-2.27 5.75-8.61 5.75-6.43 0-8.61-2.66-8.61-5.75v-2.03c0-.53.27-.71.82-.71h2.26c.45 0 .64.18.64.71v1.68c0 2.03 1.45 3.18 4.89 3.18 3.44 0 4.89-1.15 4.89-3.18v-1.77c0-1.86-1.72-2.48-3.17-3.1l-6.43-2.38a4.98 4.98 0 0 1-3.36-4.6v-2.12c0-3.1 2-5.75 8.16-5.75 6.25 0 8.25 2.65 8.25 5.75v1.68c0 .44-.18.7-.64.7h-2.26c-.55 0-.82-.17-.82-.7zM97.04 32.16c0 3.09-1.91 5.75-8.52 5.75-6.62 0-8.52-2.66-8.52-5.75V17.75c0-3.1 1.9-5.75 8.52-5.75 6.61 0 8.52 2.65 8.52 5.75v1.85c0 .53-.18.71-.73.71h-2.17c-.55 0-.82-.18-.82-.71v-1.23c0-2.04-1.36-3.28-4.8-3.28-3.44 0-4.8 1.24-4.8 3.28v13.26c0 2.03 1.36 3.27 4.8 3.27 3.44 0 4.8-1.24 4.8-3.27v-1.77c0-.44.27-.71.82-.71h2.17c.46 0 .73.27.73.71zM125.81 34.28h9.78c.46 0 .82.18.82.71v1.68c0 .53-.36.71-.82.71h-12.96c-.45 0-.63-.27-.63-.71V12.8c0-.53.18-.8.73-.8h2.35c.45 0 .73.27.73.8zM143.72 36.67c0 .53-.19.71-.73.71h-2.36c-.45 0-.63-.27-.63-.71V12.8c0-.53.09-.8.63-.8h2.36c.54 0 .73.27.73.8zM164.58 12c.46 0 .64.18.64.71v1.68c0 .53-.09.7-.64.7h-5.98v21.58c0 .53-.27.71-.81.71h-2.36c-.45 0-.81-.27-.81-.71V15.09h-5.99c-.54 0-.63-.17-.63-.7v-1.68c0-.53.09-.71.63-.71zM175.53 23.76l5.71-11.05c.18-.36.36-.71.82-.71h2.35c.55 0 .82.27.55.71l-7.53 14.59v9.37c0 .44-.18.71-.72.71h-2.36c-.54 0-.63-.27-.63-.71V27.3l-7.61-14.59c-.28-.44 0-.71.54-.71h2.27c.54 0 .63.27.9.71zM110.76 12c.45 0 .73.27.91.71l7.43 23.96c.18.44 0 .71-.54.71h-2.45c-.45 0-.73-.27-.82-.71l-1.72-5.75h-7.97l-1.73 5.75c-.09.44-.36.71-.81.71h-2.45c-.54 0-.72-.27-.54-.71l7.43-23.96c.18-.44.45-.71.91-.71zm-1.18 5.48l-3.17 10.61h6.25z"
15
- />
16
- <path
17
- fill="#3d9bd6"
18
- d="M21.25 4.42v7.25h3.99V4.33l5.16 2.92 2-3.36L27.14.97A7.7 7.7 0 0 0 23.15 0c-1.36 0-2.72.35-3.89 1.06L14 3.98l1.99 3.36z"
19
- />
20
- <path
21
- fill="#007664"
22
- d="M21.25 4.42v7.25h3.99V4.33l5.16 2.92 2-3.36L27.14.97A7.7 7.7 0 0 0 23.15 0c-1.36 0-2.72.35-3.89 1.06L14 3.98l1.99 3.36z"
23
- />
24
- <path
25
- fill="#ee4642"
26
- d="M21.16 44.25V37h3.99v7.25l5.16-2.92 2 3.36-5.17 2.92a7.9 7.9 0 0 1-7.88 0L14 44.69l1.99-3.36z"
27
- />
28
- <path
29
- fill="#2aad8e"
30
- d="M40.43 13.28L34 16.9l1.99 3.36 6.44-3.62v5.83h3.99v-5.92c0-1.33-.37-2.65-1.09-3.8a8.82 8.82 0 0 0-2.9-2.83L37.17 7l-1.99 3.36z"
31
- />
32
- <path
33
- fill="#d71d4f"
34
- d="M4.99 32.84l6.43-3.63 2 3.36-6.44 3.63 5.17 2.91-2 3.36-5.25-2.92a7.6 7.6 0 0 1-2.81-2.82A7.1 7.1 0 0 1 1 32.92V27h3.99z"
35
- />
36
- <path
37
- fill="#9e2569"
38
- d="M4.08 16.64l6.43 3.62 2-3.36-6.44-3.62 5.17-2.92-2-3.36-5.25 2.92a8.72 8.72 0 0 0-2.9 2.83A7.16 7.16 0 0 0 0 16.64v5.92h3.99z"
39
- />
40
- <path
41
- fill="#f79836"
42
- d="M40.34 36.2L34 32.57l1.99-3.36 6.44 3.63V27h3.99v5.92c0 1.33-.37 2.57-1.09 3.81a8.69 8.69 0 0 1-2.9 2.82l-5.26 2.92-1.99-3.36z"
43
- />
44
- <path fill="#007664" d="M24 15v8.22l7.34-4.06z" />
45
- <path fill="#9e2569" d="M23.25 15L16 19.16l7.25 4.06z" />
46
- <path fill="#d71d4f" d="M22.25 25.07L15 21v8.13z" />
47
- <path fill="#2aad8e" d="M24 24.98l7.25 4.07V21z" />
48
- <path fill="#ee4642" d="M23.16 26L16 30.07l7.16 4.15z" />
49
- <path fill="#f79836" d="M24 26v8.22l7.25-4.15z" />
50
- </svg>
2
+ <svg width="186" height="49" viewBox="0 0 186 49" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M72.2048 18.0991C72.2048 16.0685 71.0283 14.9207 67.68 14.9207C64.3317 14.9207 63.1552 16.0685 63.1552 18.0991V18.8054C63.1552 20.4829 64.2412 21.0126 65.0556 21.2775L72.0238 23.8379C74.2862 24.7207 76.1866 26.1334 76.1866 28.8703V31.9604C76.1866 35.0505 73.9242 37.6991 67.5895 37.6991C61.1643 37.6991 58.9924 35.0505 58.9924 31.9604V29.9298C58.9924 29.4 59.2639 29.2235 59.8069 29.2235H62.0693C62.5218 29.2235 62.7027 29.4 62.7027 29.9298V31.6072C62.7027 33.6379 64.1507 34.7856 67.5895 34.7856C71.0283 34.7856 72.4763 33.6379 72.4763 31.6072V29.8415C72.4763 27.9874 70.7568 27.3694 69.3089 26.7514L62.8837 24.3676C61.1643 23.7496 59.5354 22.0721 59.5354 19.7766V17.6577C59.5354 14.5676 61.5263 11.9189 67.68 11.9189C73.9242 11.9189 75.9151 14.5676 75.9151 17.6577V19.3352C75.9151 19.7766 75.7341 20.0415 75.2816 20.0415H73.0192C72.4763 20.0415 72.2048 19.8649 72.2048 19.3352V18.0991Z" fill="white"/>
4
+ <path d="M97.0913 32.0487C97.0913 35.1388 95.1909 37.7874 88.5847 37.7874C81.9785 37.7874 80.0781 35.1388 80.0781 32.0487V17.6577C80.0781 14.5676 81.9785 11.9189 88.5847 11.9189C95.1909 11.9189 97.0913 14.5676 97.0913 17.6577V19.5117C97.0913 20.0415 96.9103 20.218 96.3673 20.218H94.1954C93.6524 20.218 93.381 20.0415 93.381 19.5117V18.2757C93.381 16.2451 92.0235 15.009 88.5847 15.009C85.1459 15.009 83.7884 16.2451 83.7884 18.2757V31.5189C83.7884 33.5496 85.1459 34.7856 88.5847 34.7856C92.0235 34.7856 93.381 33.5496 93.381 31.5189V29.7532C93.381 29.3117 93.6524 29.0469 94.1954 29.0469H96.3673C96.8198 29.0469 97.0913 29.3117 97.0913 29.7532V32.0487Z" fill="white"/>
5
+ <path d="M125.235 34.4322H135.009C135.461 34.4322 135.823 34.6088 135.823 35.1385V36.816C135.823 37.3458 135.461 37.5223 135.009 37.5223H122.068C121.616 37.5223 121.435 37.2575 121.435 36.816V12.9782C121.435 12.4485 121.616 12.1836 122.159 12.1836H124.511C124.964 12.1836 125.235 12.4485 125.235 12.9782V34.4322Z" fill="white"/>
6
+ <path d="M164.148 12.1836C164.601 12.1836 164.782 12.3602 164.782 12.8899V14.5674C164.782 15.0971 164.691 15.2737 164.148 15.2737H158.175V36.816C158.175 37.3458 157.904 37.5223 157.361 37.5223H155.008C154.556 37.5223 154.194 37.2575 154.194 36.816V15.2737H148.221C147.678 15.2737 147.587 15.0971 147.587 14.5674V12.8899C147.587 12.3602 147.678 12.1836 148.221 12.1836H164.148Z" fill="white"/>
7
+ <path d="M72.2048 18.0991C72.2048 16.0685 71.0283 14.9207 67.68 14.9207C64.3317 14.9207 63.1552 16.0685 63.1552 18.0991V18.8054C63.1552 20.4829 64.2412 21.0126 65.0556 21.2775L72.0238 23.8379C74.2862 24.7207 76.1866 26.1334 76.1866 28.8703V31.9604C76.1866 35.0505 73.9242 37.6991 67.5895 37.6991C61.1643 37.6991 58.9924 35.0505 58.9924 31.9604V29.9298C58.9924 29.4 59.2639 29.2235 59.8069 29.2235H62.0693C62.5218 29.2235 62.7027 29.4 62.7027 29.9298V31.6072C62.7027 33.6379 64.1507 34.7856 67.5895 34.7856C71.0283 34.7856 72.4763 33.6379 72.4763 31.6072V29.8415C72.4763 27.9874 70.7568 27.3694 69.3089 26.7514L62.8837 24.3676C61.1643 23.7496 59.5354 22.0721 59.5354 19.7766V17.6577C59.5354 14.5676 61.5263 11.9189 67.68 11.9189C73.9242 11.9189 75.9151 14.5676 75.9151 17.6577V19.3352C75.9151 19.7766 75.7341 20.0415 75.2816 20.0415H73.0192C72.4763 20.0415 72.2048 19.8649 72.2048 19.3352V18.0991Z" fill="white"/>
8
+ <path d="M97.0913 32.0487C97.0913 35.1388 95.1909 37.7874 88.5847 37.7874C81.9785 37.7874 80.0781 35.1388 80.0781 32.0487V17.6577C80.0781 14.5676 81.9785 11.9189 88.5847 11.9189C95.1909 11.9189 97.0913 14.5676 97.0913 17.6577V19.5117C97.0913 20.0415 96.9103 20.218 96.3673 20.218H94.1954C93.6524 20.218 93.381 20.0415 93.381 19.5117V18.2757C93.381 16.2451 92.0235 15.009 88.5847 15.009C85.1459 15.009 83.7884 16.2451 83.7884 18.2757V31.5189C83.7884 33.5496 85.1459 34.7856 88.5847 34.7856C92.0235 34.7856 93.381 33.5496 93.381 31.5189V29.7532C93.381 29.3117 93.6524 29.0469 94.1954 29.0469H96.3673C96.8198 29.0469 97.0913 29.3117 97.0913 29.7532V32.0487Z" fill="white"/>
9
+ <path d="M125.235 34.4322H135.009C135.461 34.4322 135.823 34.6088 135.823 35.1385V36.816C135.823 37.3458 135.461 37.5223 135.009 37.5223H122.068C121.616 37.5223 121.435 37.2575 121.435 36.816V12.9782C121.435 12.4485 121.616 12.1836 122.159 12.1836H124.511C124.964 12.1836 125.235 12.4485 125.235 12.9782V34.4322Z" fill="white"/>
10
+ <path d="M143.515 36.816C143.515 37.3458 143.334 37.5223 142.791 37.5223H140.438C139.986 37.5223 139.805 37.2575 139.805 36.816V12.9782C139.805 12.4485 139.895 12.1836 140.438 12.1836H142.791C143.334 12.1836 143.515 12.4485 143.515 12.9782V36.816Z" fill="white"/>
11
+ <path d="M164.148 12.1836C164.601 12.1836 164.782 12.3602 164.782 12.8899V14.5674C164.782 15.0971 164.691 15.2737 164.148 15.2737H158.175V36.816C158.175 37.3458 157.904 37.5223 157.361 37.5223H155.008C154.556 37.5223 154.194 37.2575 154.194 36.816V15.2737H148.221C147.678 15.2737 147.587 15.0971 147.587 14.5674V12.8899C147.587 12.3602 147.678 12.1836 148.221 12.1836H164.148Z" fill="white"/>
12
+ <path d="M175.279 23.9259L180.98 12.8899C181.161 12.5367 181.342 12.1836 181.795 12.1836H184.148C184.691 12.1836 184.962 12.4485 184.691 12.8899L177.179 27.4575V36.816C177.179 37.2575 176.998 37.5223 176.455 37.5223H174.103C173.56 37.5223 173.469 37.2575 173.469 36.816V27.4575L165.867 12.8899C165.596 12.4485 165.867 12.1836 166.41 12.1836H168.673C169.216 12.1836 169.306 12.4485 169.578 12.8899L175.279 23.9259Z" fill="white"/>
13
+ <path d="M109.851 12.1836C110.303 12.1836 110.575 12.4485 110.756 12.8899L118.176 36.816C118.357 37.2575 118.176 37.5223 117.633 37.5223H115.19C114.738 37.5223 114.466 37.2575 114.376 36.816L112.656 31.0773H104.693L102.973 36.816C102.883 37.2575 102.611 37.5223 102.159 37.5223H99.7153C99.1724 37.5223 98.9914 37.2575 99.1724 36.816L106.593 12.8899C106.774 12.4485 107.045 12.1836 107.498 12.1836H109.851ZM108.674 17.6575L105.507 28.2521H111.751L108.674 17.6575Z" fill="white"/>
14
+ <path d="M21.0748 4.41441V11.6541H25.0566V4.32613L30.2149 7.23964L32.2058 3.88469L26.9571 0.971171C25.7806 0.264865 24.4232 0 22.9753 0C21.6178 0 20.2604 0.353153 19.0839 1.05946L13.8352 3.97297L15.8261 7.32793L21.0748 4.41441Z" fill="#005357"/>
15
+ <path d="M21.0749 44.5856V37.3459H25.0567V44.5856L30.215 41.6721L32.2059 45.027L27.0476 47.9405C25.8712 48.6469 24.4233 49 23.0658 49C21.7084 49 20.351 48.6469 19.1745 47.9405L13.9258 45.027L15.9167 41.6721L21.0749 44.5856Z" fill="#FD8144"/>
16
+ <path d="M39.8981 12.7133L33.4729 16.3331L35.4638 19.6881L41.889 16.0682V21.8953H45.8708V15.98C45.8708 14.6556 45.5088 13.3313 44.7848 12.1836C44.0609 11.0358 43.0654 10.0646 41.889 9.35834L36.6402 6.44482L34.6493 9.79978L39.8981 12.7133Z" fill="#0AADA6"/>
17
+ <path d="M4.24279 32.8434L10.668 29.2236L12.6589 32.5785L6.23369 36.1983L11.3919 39.1119L9.40103 42.4668L4.15229 39.5533C2.97585 38.847 1.9804 37.8758 1.34693 36.7281C0.622968 35.5803 0.260986 34.256 0.260986 32.9317V27.0164H4.24279V32.8434Z" fill="#E84855"/>
18
+ <path d="M4.24271 16.1569L10.6679 19.7767L12.6588 16.4217L6.23361 12.8019L11.3919 9.8884L9.40095 6.53345L4.15221 9.44696C2.97577 10.1533 1.98032 11.1244 1.25636 12.2722C0.532392 13.4199 0.17041 14.7443 0.17041 16.1569V22.0722H4.15221L4.24271 16.1569Z" fill="#A14FBF"/>
19
+ <path d="M39.8982 36.1983L33.5635 32.5785L35.5544 29.2236L41.9796 32.8434V27.0164H45.9614V32.9317C45.9614 34.256 45.5994 35.492 44.8754 36.7281C44.1514 37.8758 43.156 38.847 41.9796 39.5533L36.7308 42.4668L34.7399 39.1119L39.8982 36.1983Z" fill="#F8F32B"/>
20
+ <path d="M23.6086 15.3623V23.5731L30.9388 19.5119L23.6086 15.3623Z" fill="#005357"/>
21
+ <path d="M22.5226 15.3623L15.283 19.5119L22.5226 23.5731V15.3623Z" fill="#A14FBF"/>
22
+ <path d="M22.0705 24.4558L14.8308 20.3945V28.5171L22.0705 24.4558Z" fill="#E84855"/>
23
+ <path d="M24.1519 24.4559L31.3915 28.5171V20.4829L24.1519 24.4559Z" fill="#0AADA6"/>
24
+ <path d="M22.5227 25.4272L15.3735 29.4885L22.5227 33.6381V25.4272Z" fill="#FD8144"/>
25
+ <path d="M23.6086 25.4272V33.6381L30.8483 29.4885L23.6086 25.4272Z" fill="#F8F32B"/>
26
+ </svg>
51
27
  );
52
28
 
53
29
  export { Logo };
package/src/lib/index.css CHANGED
@@ -9,7 +9,8 @@ body {
9
9
  font-family: 'Lato';
10
10
  font-style: normal;
11
11
  font-weight: normal;
12
- src: local(''), url('./style/fonts/Lato-Regular.woff2') format('woff2'),
12
+ src:
13
+ url('./style/fonts/Lato-Regular.woff2') format('woff2'),
13
14
  /* Chrome 26+, Opera 23+, Firefox 39+ */
14
15
  url('./style/fonts/Lato-Regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
15
16
  }
@@ -19,7 +20,8 @@ body {
19
20
  font-family: 'Lato';
20
21
  font-style: normal;
21
22
  font-weight: bold;
22
- src: local(''), url('./style/fonts/Lato-Bold.woff2') format('woff2'),
23
+ src:
24
+ url('./style/fonts/Lato-Bold.woff2') format('woff2'),
23
25
  /* Chrome 26+, Opera 23+, Firefox 39+ */ url('./style/fonts/Lato-Bold.woff')
24
26
  format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
25
27
  }
@@ -59,6 +59,7 @@ export const Playground: Story = {
59
59
  Success: theme.statusHealthy,
60
60
  Failed: theme.statusCritical,
61
61
  }}
62
+ sortOrder="status"
62
63
  >
63
64
  <Stack direction="vertical" gap="r16">
64
65
  <Barchart
@@ -123,6 +124,7 @@ export const Time7Days: Story = {
123
124
  Success: theme.statusHealthy,
124
125
  Failed: theme.statusCritical,
125
126
  }}
127
+ sortOrder="status"
126
128
  >
127
129
  <Stack direction="vertical" gap="r16">
128
130
  <Barchart
@@ -408,6 +410,7 @@ export const Stacked: Story = {
408
410
  Failed: theme.statusCritical,
409
411
  Warning: theme.statusWarning,
410
412
  }}
413
+ sortOrder="status"
411
414
  >
412
415
  <Stack direction="vertical" gap="r16">
413
416
  <Barchart
@@ -464,6 +467,7 @@ export const DefaultSort: Story = {
464
467
  Success: theme.statusHealthy,
465
468
  Failed: theme.statusCritical,
466
469
  }}
470
+ sortOrder="status"
467
471
  >
468
472
  <Barchart
469
473
  type={{ type: 'category' }}
@@ -542,6 +546,7 @@ export const WithCustomTooltip: Story = {
542
546
  Success: theme.statusHealthy,
543
547
  Failed: theme.statusCritical,
544
548
  }}
549
+ sortOrder="status"
545
550
  >
546
551
  <Stack direction="vertical" gap="r16">
547
552
  <Barchart
@@ -614,6 +619,14 @@ export const StatusColors: Story = {
614
619
  'Failed Requests': theme.statusCritical,
615
620
  'Warning Events': theme.statusWarning,
616
621
  }}
622
+ sortOrder={(a, b) => {
623
+ const statusOrder: Record<string, number> = {
624
+ 'Success Rate': 0,
625
+ 'Warning Events': 1,
626
+ 'Failed Requests': 2,
627
+ };
628
+ return statusOrder[a] - statusOrder[b];
629
+ }}
617
630
  >
618
631
  <Stack direction="vertical" gap="r16">
619
632
  <Barchart
@@ -668,6 +681,7 @@ export const LegendShapes: Story = {
668
681
  Failed: theme.statusCritical,
669
682
  Warning: theme.statusWarning,
670
683
  }}
684
+ sortOrder="status"
671
685
  >
672
686
  <Stack direction="vertical" gap="r16">
673
687
  <Barchart
@@ -685,6 +699,7 @@ export const LegendShapes: Story = {
685
699
  Failed: theme.statusCritical,
686
700
  Warning: theme.statusWarning,
687
701
  }}
702
+ sortOrder="status"
688
703
  >
689
704
  <Stack direction="vertical" gap="r16">
690
705
  <Barchart
@@ -740,6 +755,7 @@ export const BarchartsWithSingleLegend: Story = {
740
755
  Failed: theme.statusCritical,
741
756
  Warning: theme.statusWarning,
742
757
  }}
758
+ sortOrder="status"
743
759
  >
744
760
  <Barchart
745
761
  type={{ type: 'category' }}
@@ -770,6 +786,7 @@ export const ErrorState: Story = {
770
786
  Success: theme.statusHealthy,
771
787
  Failed: theme.statusCritical,
772
788
  }}
789
+ sortOrder="status"
773
790
  >
774
791
  <Barchart
775
792
  type={{ type: 'category' }}
@@ -821,6 +838,7 @@ export const StackedBarSort: Story = {
821
838
  Warning: theme.statusWarning,
822
839
  Failed: theme.statusCritical,
823
840
  }}
841
+ sortOrder="status"
824
842
  >
825
843
  <Barchart
826
844
  type={{ type: 'category' }}
@@ -896,6 +914,7 @@ export const CompleteExample: Story = {
896
914
  Success: 'lineColor1',
897
915
  Failed: 'lineColor2',
898
916
  }}
917
+ sortOrder="status"
899
918
  >
900
919
  <Barchart
901
920
  type={{ type: 'category' }}