@appquality/unguess-design-system 2.12.31 → 2.12.33

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/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ # v2.12.33 (Wed Nov 16 2022)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - feat(waffle): Use 6 rows instead of 8 [#108](https://github.com/AppQuality/unguess-design-system/pull/108) ([@d-beezee](https://github.com/d-beezee))
6
+
7
+ #### Authors: 1
8
+
9
+ - [@d-beezee](https://github.com/d-beezee)
10
+
11
+ ---
12
+
13
+ # v2.12.32 (Wed Nov 16 2022)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - Add custom tooltip to waffle and fix pie padangle [#107](https://github.com/AppQuality/unguess-design-system/pull/107) ([@d-beezee](https://github.com/d-beezee))
18
+
19
+ #### Authors: 1
20
+
21
+ - [@d-beezee](https://github.com/d-beezee)
22
+
23
+ ---
24
+
1
25
  # v2.12.31 (Tue Nov 15 2022)
2
26
 
3
27
  #### 🐛 Bug Fix
package/build/index.js CHANGED
@@ -1179,7 +1179,7 @@ var CenteredItem = function (_a) {
1179
1179
  var PieChart = function (_a) {
1180
1180
  var theme = _a.theme, colors = _a.colors, width = _a.width, height = _a.height, data = _a.data, centerItem = _a.centerItem, margin = _a.margin;
1181
1181
  var themeContext = React.useContext(styled.ThemeContext);
1182
- return (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(ChartContainer, __assign({ width: width, height: height }, { children: jsxRuntime.jsx(pie.ResponsivePie, { theme: __assign(__assign({}, DEFAULT_CHARTS_THEME), theme), colors: colors !== null && colors !== void 0 ? colors : CHARTS_COLOR_SCHEME_CATEGORICAL_8_A, enableArcLabels: false, arcLinkLabelsColor: { from: "color" }, padAngle: 1, data: data, margin: __assign({ top: 40, bottom: 40 }, margin), innerRadius: 0.8, arcLinkLabelsThickness: 2, arcLinkLabelsTextColor: themeContext.palette.grey[600], layers: __spreadArray([
1182
+ return (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(ChartContainer, __assign({ width: width, height: height }, { children: jsxRuntime.jsx(pie.ResponsivePie, { theme: __assign(__assign({}, DEFAULT_CHARTS_THEME), theme), colors: colors !== null && colors !== void 0 ? colors : CHARTS_COLOR_SCHEME_CATEGORICAL_8_A, enableArcLabels: false, arcLinkLabelsColor: { from: "color" }, padAngle: 2, data: data, margin: __assign({ top: 40, bottom: 40 }, margin), innerRadius: 0.8, arcLinkLabelsThickness: 2, arcLinkLabelsTextColor: themeContext.palette.grey[600], layers: __spreadArray([
1183
1183
  "arcs",
1184
1184
  "arcLabels",
1185
1185
  "arcLinkLabels"
@@ -1259,8 +1259,11 @@ var CustomCell = function (_a) {
1259
1259
  };
1260
1260
 
1261
1261
  var WaffleChart = function (_a) {
1262
- var height = _a.height, width = _a.width, data = _a.data, total = _a.total;
1263
- return (jsxRuntime.jsx(ChartContainer, __assign({ width: width, height: height }, { children: jsxRuntime.jsx(waffle.ResponsiveWaffle, { theme: DEFAULT_CHARTS_THEME, data: [
1262
+ var height = _a.height, width = _a.width, data = _a.data, total = _a.total, tooltip = _a.tooltip;
1263
+ return (jsxRuntime.jsx(ChartContainer, __assign({ width: width, height: height }, { children: jsxRuntime.jsx(waffle.ResponsiveWaffle, { theme: tooltip
1264
+ ? __assign(__assign({}, DEFAULT_CHARTS_THEME), { tooltip: __assign(__assign({}, tooltip), { container: {
1265
+ padding: 0,
1266
+ } }) }) : DEFAULT_CHARTS_THEME, data: [
1264
1267
  {
1265
1268
  id: "green-circles",
1266
1269
  label: data.label,
@@ -1271,7 +1274,10 @@ var WaffleChart = function (_a) {
1271
1274
  label: total.label,
1272
1275
  value: total.value,
1273
1276
  },
1274
- ], fillDirection: "bottom", total: total.value, rows: 8, columns: 8, colors: CHARTS_COLOR_SCHEME_MONO,
1277
+ ], tooltip: function (_a) {
1278
+ var value = _a.value, label = _a.label;
1279
+ return tooltip ? tooltip({ label: label, value: value }) : jsxRuntime.jsx(jsxRuntime.Fragment, { children: "".concat(label, ": ").concat(value) });
1280
+ }, fillDirection: "bottom", total: total.value, rows: 6, columns: 8, colors: CHARTS_COLOR_SCHEME_MONO,
1275
1281
  // @ts-ignore property cellComponent does not exist, but it does
1276
1282
  cellComponent: function (_a) {
1277
1283
  _a.borderWidth; _a.borderColor; var rest = __rest(_a, ["borderWidth", "borderColor"]);
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ export declare type ChartTooltipFunction = ({ value, label, }: {
3
+ value: number;
4
+ label: string;
5
+ }) => React.ReactNode;
@@ -1,3 +1,4 @@
1
+ import { ChartTooltipFunction } from "../_types";
1
2
  interface WaffleDataItem {
2
3
  label: string;
3
4
  value: number;
@@ -7,5 +8,6 @@ export interface WaffleChartProps {
7
8
  total: WaffleDataItem;
8
9
  width?: string;
9
10
  height?: string;
11
+ tooltip?: ChartTooltipFunction;
10
12
  }
11
13
  export {};
@@ -1,3 +1,3 @@
1
1
  import { WaffleChartProps } from "./_types";
2
- declare const WaffleChart: ({ height, width, data, total }: WaffleChartProps) => JSX.Element;
2
+ declare const WaffleChart: ({ height, width, data, total, tooltip, }: WaffleChartProps) => JSX.Element;
3
3
  export { WaffleChart };
@@ -1,5 +1,6 @@
1
1
  import { ComponentMeta, Story } from "@storybook/react";
2
2
  import { WaffleChartProps } from "./_types";
3
3
  export declare const Default: Story<WaffleChartProps>;
4
- declare const _default: ComponentMeta<({ height, width, data, total }: WaffleChartProps) => JSX.Element>;
4
+ export declare const WithCustomTooltip: Story<WaffleChartProps>;
5
+ declare const _default: ComponentMeta<({ height, width, data, total, tooltip, }: WaffleChartProps) => JSX.Element>;
5
6
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appquality/unguess-design-system",
3
- "version": "2.12.31",
3
+ "version": "2.12.33",
4
4
  "dependencies": {
5
5
  "@nivo/bar": "^0.80.0",
6
6
  "@nivo/bullet": "^0.80.0",