@appquality/unguess-design-system 2.12.44 → 2.12.45

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,20 @@
1
+ # v2.12.45 (Mon Dec 05 2022)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Change sunburst and pie cornerradius, expose skiparclabel and rerender bullet on resize [#140](https://github.com/AppQuality/unguess-design-system/pull/140) ([@d-beezee](https://github.com/d-beezee) [@marcbon](https://github.com/marcbon) [@iacopolea](https://github.com/iacopolea))
6
+ - feat: Rerender bullet on resize to prevent invalid positioning [#139](https://github.com/AppQuality/unguess-design-system/pull/139) ([@d-beezee](https://github.com/d-beezee))
7
+ - feat: Change pie and sunburst corner radius [#137](https://github.com/AppQuality/unguess-design-system/pull/137) ([@d-beezee](https://github.com/d-beezee))
8
+ - feat(pie): add arcLinkLabelsSkipAngle props [#138](https://github.com/AppQuality/unguess-design-system/pull/138) ([@marcbon](https://github.com/marcbon))
9
+
10
+ #### Authors: 3
11
+
12
+ - [@d-beezee](https://github.com/d-beezee)
13
+ - Iacopo Leardini ([@iacopolea](https://github.com/iacopolea))
14
+ - Marco Bonomo ([@marcbon](https://github.com/marcbon))
15
+
16
+ ---
17
+
1
18
  # v2.12.44 (Fri Dec 02 2022)
2
19
 
3
20
  #### 🐛 Bug Fix
package/build/index.js CHANGED
@@ -1162,20 +1162,33 @@ var CustomTooltip = function (_a) {
1162
1162
  };
1163
1163
 
1164
1164
  var UgBulletChart = styled__default["default"](bullet.ResponsiveBullet)(templateObject_1$19 || (templateObject_1$19 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n"], ["\n width: 100%;\n height: 100%;\n"])));
1165
+ var useResizeOfReference = function () {
1166
+ var ref = React.createRef();
1167
+ var _a = React.useState({ width: 0 }), setDimensions = _a[1];
1168
+ React.useEffect(function () {
1169
+ if (ref.current) {
1170
+ setDimensions({
1171
+ width: ref.current.clientWidth,
1172
+ });
1173
+ }
1174
+ }, [ref]);
1175
+ return { ref: ref };
1176
+ };
1165
1177
  var BulletChart = function (_a) {
1166
1178
  var width = _a.width, height = _a.height, ranges = _a.ranges, values = _a.values;
1167
- return (jsxRuntime.jsx(ChartContainer, __assign({ width: width, height: height }, { children: jsxRuntime.jsx(UgBulletChart, { theme: DEFAULT_CHARTS_THEME, data: [
1168
- {
1169
- id: "",
1170
- title: "",
1171
- ranges: ranges,
1172
- measures: values,
1173
- markers: values,
1174
- },
1175
- ], animate: false, measureComponent: CustomMeasure, markerColors: CHARTS_COLOR_PALETTE.darkPine, markerComponent: function (_a) {
1176
- _a.size; var markerProps = __rest(_a, ["size"]);
1177
- return (jsxRuntime.jsx(CustomBulletChartMarkers, __assign({}, markerProps, { size: 4 })));
1178
- }, tooltip: CustomTooltip, rangeColors: CHARTS_COLOR_PALETTE.lightGrey, rangeBorderColor: "white", rangeBorderWidth: 2, margin: { top: 0, right: 5, bottom: -1, left: 0 } }) })));
1179
+ var ref = useResizeOfReference().ref;
1180
+ return (jsxRuntime.jsx(ChartContainer, __assign({ width: width, height: height }, { children: jsxRuntime.jsx("div", __assign({ style: { width: "100%", height: height }, ref: ref }, { children: jsxRuntime.jsx(UgBulletChart, { theme: DEFAULT_CHARTS_THEME, data: [
1181
+ {
1182
+ id: "",
1183
+ title: "",
1184
+ ranges: ranges,
1185
+ measures: values,
1186
+ markers: values,
1187
+ },
1188
+ ], animate: false, measureComponent: CustomMeasure, markerColors: CHARTS_COLOR_PALETTE.darkPine, markerComponent: function (_a) {
1189
+ _a.size; var markerProps = __rest(_a, ["size"]);
1190
+ return (jsxRuntime.jsx(CustomBulletChartMarkers, __assign({}, markerProps, { size: 4 })));
1191
+ }, tooltip: CustomTooltip, rangeColors: CHARTS_COLOR_PALETTE.lightGrey, rangeBorderColor: "white", rangeBorderWidth: 2, margin: { top: 0, right: 5, bottom: -1, left: 0 } }) })) })));
1179
1192
  };
1180
1193
  var templateObject_1$19;
1181
1194
 
@@ -1248,16 +1261,16 @@ var templateObject_1$18, templateObject_2$t, templateObject_3$i, templateObject_
1248
1261
 
1249
1262
  var PieChart = function (_a) {
1250
1263
  var _b;
1251
- var theme = _a.theme, colors = _a.colors, width = _a.width, height = _a.height, data = _a.data, centerItem = _a.centerItem, margin = _a.margin, tooltip = _a.tooltip, legend = _a.legend;
1264
+ var theme = _a.theme, colors = _a.colors, width = _a.width, height = _a.height, data = _a.data, centerItem = _a.centerItem, margin = _a.margin, tooltip = _a.tooltip, legend = _a.legend, arcLinkLabelsSkipAngle = _a.arcLinkLabelsSkipAngle;
1252
1265
  var themeContext = React.useContext(styled.ThemeContext);
1253
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ChartContainer, __assign({ width: width, height: height }, { children: jsxRuntime.jsx(pie.ResponsivePie, { theme: __assign({}, __assign(__assign(__assign({}, DEFAULT_CHARTS_THEME), theme), { labels: __assign(__assign({}, theme === null || theme === void 0 ? void 0 : theme.labels), { text: __assign({ fontWeight: themeContext.fontWeights.semibold, fill: themeContext.palette.grey[800] }, (_b = theme === null || theme === void 0 ? void 0 : theme.labels) === null || _b === void 0 ? void 0 : _b.text) }) })), arcLinkLabel: function (d) { return (d.label || d.id).toString(); }, 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), tooltip: tooltip
1266
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ChartContainer, __assign({ width: width, height: height }, { children: jsxRuntime.jsx(pie.ResponsivePie, { theme: __assign({}, __assign(__assign(__assign({}, DEFAULT_CHARTS_THEME), theme), { labels: __assign(__assign({}, theme === null || theme === void 0 ? void 0 : theme.labels), { text: __assign({ fontWeight: themeContext.fontWeights.semibold, fill: themeContext.palette.grey[800] }, (_b = theme === null || theme === void 0 ? void 0 : theme.labels) === null || _b === void 0 ? void 0 : _b.text) }) })), arcLinkLabel: function (d) { return (d.label || d.id).toString(); }, colors: colors !== null && colors !== void 0 ? colors : CHARTS_COLOR_SCHEME_CATEGORICAL_8_A, enableArcLabels: false, arcLinkLabelsColor: { from: "color" }, arcLinkLabelsSkipAngle: arcLinkLabelsSkipAngle !== null && arcLinkLabelsSkipAngle !== void 0 ? arcLinkLabelsSkipAngle : 10, padAngle: 2, data: data, margin: __assign({ top: 40, bottom: 40 }, margin), tooltip: tooltip
1254
1267
  ? function (node) {
1255
1268
  var data = node.datum.data;
1256
1269
  var label = (data === null || data === void 0 ? void 0 : data.label) || data.id;
1257
1270
  var value = data.value;
1258
1271
  return jsxRuntime.jsx(jsxRuntime.Fragment, { children: tooltip({ label: label, value: value, data: data }) });
1259
1272
  }
1260
- : undefined, cornerRadius: 3, innerRadius: 0.8, arcLinkLabelsThickness: 2, layers: __spreadArray([
1273
+ : undefined, cornerRadius: 2, innerRadius: 0.8, arcLinkLabelsThickness: 2, layers: __spreadArray([
1261
1274
  "arcs",
1262
1275
  "arcLabels",
1263
1276
  "arcLinkLabels"
@@ -1379,7 +1392,7 @@ var SunburstChart = function (_a) {
1379
1392
  padding: 0,
1380
1393
  } }) }) : DEFAULT_CHARTS_THEME, colors: currentColor
1381
1394
  ? function () { return currentColor; }
1382
- : colors !== null && colors !== void 0 ? colors : CHARTS_COLOR_SCHEME_CATEGORICAL_8_A, borderWidth: 4, cornerRadius: 3, onMouseEnter: function (node) {
1395
+ : colors !== null && colors !== void 0 ? colors : CHARTS_COLOR_SCHEME_CATEGORICAL_8_A, borderWidth: 4, cornerRadius: 4, onMouseEnter: function (node) {
1383
1396
  if (node.data.children) {
1384
1397
  setIsHovering(true);
1385
1398
  }
@@ -22,5 +22,6 @@ export interface PieChartProps {
22
22
  };
23
23
  tooltip?: ChartTooltipFunction;
24
24
  legend?: LegendType | true;
25
+ arcLinkLabelsSkipAngle?: number;
25
26
  }
26
27
  export {};
@@ -1,3 +1,3 @@
1
1
  import { PieChartProps } from "./_types";
2
- declare const PieChart: ({ theme, colors, width, height, data, centerItem, margin, tooltip, legend, }: PieChartProps) => JSX.Element;
2
+ declare const PieChart: ({ theme, colors, width, height, data, centerItem, margin, tooltip, legend, arcLinkLabelsSkipAngle, }: PieChartProps) => JSX.Element;
3
3
  export { PieChart };
@@ -2,5 +2,5 @@ import { ComponentMeta, Story } from "@storybook/react";
2
2
  import { PieChartProps } from "./_types";
3
3
  export declare const Default: Story<PieChartProps>;
4
4
  export declare const WithCustomTooltip: Story<PieChartProps>;
5
- declare const _default: ComponentMeta<({ theme, colors, width, height, data, centerItem, margin, tooltip, legend, }: PieChartProps) => JSX.Element>;
5
+ declare const _default: ComponentMeta<({ theme, colors, width, height, data, centerItem, margin, tooltip, legend, arcLinkLabelsSkipAngle, }: PieChartProps) => JSX.Element>;
6
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.44",
3
+ "version": "2.12.45",
4
4
  "dependencies": {
5
5
  "@nivo/bar": "^0.80.0",
6
6
  "@nivo/bullet": "^0.80.0",