@milktop/react-ui 0.3.15 → 0.3.17

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
  }
@@ -54,5 +54,7 @@
54
54
  background: var(--ui-surface); border-radius: calc(var(--ui-radius) - 2px); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); } }
55
55
  [data-scope=tabs][data-part=panels] { padding-top: 1rem; }
56
56
  [data-scope=tabs][data-part=content] { display: block; outline: none;
57
- &:focus-visible { outline: 2px solid var(--ui-ring-soft); outline-offset: 4px; border-radius: 4px; } }
57
+ &:focus-visible { outline: 2px solid var(--ui-ring-soft); outline-offset: 4px; border-radius: 4px; }
58
+ /* Zag sets `hidden` on the tab left a frame after the new one shows; without this both draw for that frame and the new one jumps up */
59
+ &[data-state=closed] { display: none; } }
58
60
  }
package/dist/theme.css CHANGED
@@ -159,6 +159,8 @@
159
159
  /* Zag hides closed parts with `hidden`; that beats any display a component sets. */
160
160
  [data-scope][hidden] { display: none !important; }
161
161
  [data-scope]:focus:not(:focus-visible) { outline: none; }
162
+ /* An icon's room before it has drawn, so what's beside it doesn't move when it does */
163
+ iconify-icon { display: inline-block; width: 1em; height: 1em; }
162
164
 
163
165
  @media (prefers-reduced-motion: reduce) {
164
166
  [data-scope][data-part] { animation: none !important; transition: none !important; }
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.17",
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",