@milktop/react-ui 0.3.15 → 0.3.16

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.
@@ -18,5 +18,5 @@ export function ChartFrame({ rows, x, list, fmt, height, label, hover, onHover,
18
18
  observer.observe(el);
19
19
  return () => observer.disconnect();
20
20
  }, []);
21
- return (_jsxs("div", { ...rest, ...part('root'), className: cx(className, classes?.root), children: [_jsxs("div", { ...part('frame'), ref: frame, style: { height }, onPointerMove: onMove, onPointerLeave: () => onHover(null), role: "presentation", children: [width > 0 && children, hover != null && rows[hover] && (_jsxs("div", { ...part('tooltip'), "data-flip": flip || undefined, style: { left: tipLeft }, children: [_jsx("div", { ...part('tooltip-label'), children: String(rows[hover][x] ?? '') }), list.map((s) => (_jsxs("div", { ...part('tooltip-row'), children: [_jsx("span", { ...part('swatch'), style: { background: s.color } }), _jsx("span", { ...part('tooltip-name'), children: s.label }), _jsx("span", { ...part('tooltip-value'), children: fmt(rows[hover][s.key]) })] }, s.key)))] }))] }), list.length > 1 && (_jsx("div", { ...part('legend'), children: list.map((s) => _jsxs("span", { ...part('legend-item'), children: [_jsx("span", { ...part('swatch'), style: { background: s.color } }), s.label] }, s.key)) })), _jsxs("table", { ...part('sr-only'), children: [_jsx("caption", { children: label }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("th", { children: x }), list.map((s) => _jsx("th", { children: s.label }, s.key))] }), rows.map((row, i) => _jsxs("tr", { children: [_jsx("td", { children: String(row[x] ?? '') }), list.map((s) => _jsx("td", { children: fmt(row[s.key]) }, s.key))] }, i))] })] })] }));
21
+ return (_jsxs("div", { ...rest, ...part('root'), className: cx(className, classes?.root), children: [_jsxs("div", { ...part('frame'), ref: frame, style: { height }, onPointerMove: onMove, onPointerLeave: () => onHover(null), role: "presentation", children: [width > 0 && children, hover != null && rows[hover] && (_jsxs("div", { ...part('tooltip'), "data-flip": flip || undefined, style: { left: tipLeft }, children: [_jsx("div", { ...part('tooltip-label'), children: String(rows[hover][x] ?? '') }), list.map((s) => (_jsxs("div", { ...part('tooltip-row'), children: [_jsx("span", { ...part('swatch'), style: { background: s.color } }), _jsx("span", { ...part('tooltip-name'), children: s.label }), _jsx("span", { ...part('tooltip-value'), children: fmt(rows[hover][s.key]) })] }, s.key)))] }))] }), list.length > 1 && (_jsx("div", { ...part('legend'), children: list.map((s) => _jsxs("span", { ...part('legend-item'), children: [_jsx("span", { ...part('swatch'), style: { background: s.color } }), s.label] }, s.key)) })), _jsx("div", { ...part('sr-only'), children: _jsxs("table", { children: [_jsx("caption", { children: label }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("th", { children: x }), list.map((s) => _jsx("th", { children: s.label }, s.key))] }), rows.map((row, i) => _jsxs("tr", { children: [_jsx("td", { children: String(row[x] ?? '') }), list.map((s) => _jsx("td", { children: fmt(row[s.key]) }, s.key))] }, i))] })] }) })] }));
22
22
  }
@@ -37,5 +37,5 @@ export function DonutChart({ data = [], size = 160, thickness = 0.32, center, le
37
37
  const shown = hover != null ? data[hover] : null;
38
38
  return (_jsxs("div", { ...rest, ...part('root'), className: cx(className, classes?.root), "data-legend": legend || undefined, children: [_jsxs("div", { ...part('frame'), style: { width: size, height: size }, children: [_jsx("svg", { ...part('svg'), width: size, height: size, viewBox: `${-radius - 4} ${-radius - 4} ${size + 8} ${size + 8}`, "aria-hidden": "true", children: slices.map((s, i) => (_jsx("path", { ...part('slice'), d: (hover === i ? grown : shape)(s) ?? '', fill: colorOf(data[i], i), "data-dim": (hover != null && hover !== i) || undefined, onPointerEnter: () => setHover(i), onPointerLeave: () => setHover(null) }, data[i].label))) }), inner > 0 && center !== null && (_jsx("div", { ...part('center'), children: shown
39
39
  ? _jsxs(_Fragment, { children: [_jsx("strong", { children: fmt(shown.value) }), _jsx("span", { children: shown.label })] })
40
- : center ?? _jsxs(_Fragment, { children: [_jsx("strong", { children: fmt(total) }), _jsx("span", { children: t.chart.total })] }) }))] }), legend && (_jsx("ul", { ...part('legend'), children: data.map((slice, i) => (_jsxs("li", { ...part('legend-item'), "data-dim": (hover != null && hover !== i) || undefined, onPointerEnter: () => setHover(i), onPointerLeave: () => setHover(null), children: [_jsx("span", { ...part('swatch'), style: { background: colorOf(slice, i) } }), _jsx("span", { ...part('legend-label'), children: slice.label }), _jsxs("span", { ...part('legend-value'), children: [fmt(slice.value), total > 0 && _jsxs("small", { children: [" ", Math.round((slice.value / total) * 100), "%"] })] })] }, slice.label))) })), _jsxs("table", { ...part('sr-only'), children: [_jsx("caption", { children: label }), _jsx("tbody", { children: data.map((slice) => _jsxs("tr", { children: [_jsx("td", { children: slice.label }), _jsx("td", { children: fmt(slice.value) })] }, slice.label)) })] })] }));
40
+ : center ?? _jsxs(_Fragment, { children: [_jsx("strong", { children: fmt(total) }), _jsx("span", { children: t.chart.total })] }) }))] }), legend && (_jsx("ul", { ...part('legend'), children: data.map((slice, i) => (_jsxs("li", { ...part('legend-item'), "data-dim": (hover != null && hover !== i) || undefined, onPointerEnter: () => setHover(i), onPointerLeave: () => setHover(null), children: [_jsx("span", { ...part('swatch'), style: { background: colorOf(slice, i) } }), _jsx("span", { ...part('legend-label'), children: slice.label }), _jsxs("span", { ...part('legend-value'), children: [fmt(slice.value), total > 0 && _jsxs("small", { children: [" ", Math.round((slice.value / total) * 100), "%"] })] })] }, slice.label))) })), _jsx("div", { ...part('sr-only'), children: _jsxs("table", { children: [_jsx("caption", { children: label }), _jsx("tbody", { children: data.map((slice) => _jsxs("tr", { children: [_jsx("td", { children: slice.label }), _jsx("td", { children: fmt(slice.value) })] }, slice.label)) })] }) })] }));
41
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milktop/react-ui",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
4
4
  "description": "React components on Ark UI (Zag state machines), with imba-ui's API and design",
5
5
  "license": "MIT",
6
6
  "author": "André Goldstein",