@mechane-ai/elements 0.44.0 → 0.45.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.
package/dist/ai.js CHANGED
@@ -3,7 +3,7 @@ import { t as l } from "./code-block-Cpfr7B6a.js";
3
3
  import { a as u } from "./src-Bk7M67zy.js";
4
4
  import { t as d } from "./content-link-CGeFFb9F.js";
5
5
  import { r as f, t as p } from "./src-na2DdkKI.js";
6
- import { f as m, l as h } from "./src-CDp1JtwC.js";
6
+ import { p as m, u as h } from "./src-Dcs3SZ9V.js";
7
7
  import { i as g, t as _ } from "./forms-DeU0Tiv3.js";
8
8
  import { t as ee } from "./accessibility-P89UG9-r.js";
9
9
  import { r as v } from "./control-styles-D3q_Qyxi.js";
package/dist/catalog.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@mechane-ai/elements",
3
- "version": "0.44.0",
3
+ "version": "0.45.0",
4
4
  "recipes": [
5
5
  {
6
6
  "slug": "allocation-report",
@@ -1387,6 +1387,10 @@
1387
1387
  "kind": "value",
1388
1388
  "declaration": "dist/packages/foundations/src/chart-tones.d.ts"
1389
1389
  },
1390
+ "chartToneOutlines": {
1391
+ "kind": "value",
1392
+ "declaration": "dist/packages/foundations/src/chart-tones.d.ts"
1393
+ },
1390
1394
  "ChartMarkShape": {
1391
1395
  "kind": "type",
1392
1396
  "declaration": "dist/packages/charts/src/chart-series-marker.d.ts"
@@ -0,0 +1,63 @@
1
+ import { c as e, l as t } from "./src-Dcs3SZ9V.js";
2
+ import { t as n } from "./chart-frame-Ztktqs1b.js";
3
+ import { n as r } from "./chart-input-BO3BqlFO.js";
4
+ import * as i from "@stylexjs/stylex";
5
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ // packages/charts/src/categorical-values.tsx
7
+ var s = {
8
+ kzqmXN: "x1xc55vz",
9
+ kZKoxP: "xdk7pt",
10
+ kmuXW: "x2lah0s",
11
+ kGVxlE: "x1iotiob",
12
+ $$css: !0
13
+ }, c = { swatch: (e, t) => [
14
+ s,
15
+ {
16
+ kWkggS: e == null ? e : "xl8spv7",
17
+ $$css: !0
18
+ },
19
+ {
20
+ "--x-backgroundColor": e ?? void 0,
21
+ "--x-boxShadow": `inset 0 0 0 1px ${t}` == null ? void 0 : `inset 0 0 0 1px ${t}`
22
+ }
23
+ ] }, l = {
24
+ items: 200,
25
+ series: 12
26
+ }, u = [
27
+ "series1",
28
+ "series2",
29
+ "series3",
30
+ "series4",
31
+ "series5",
32
+ "series6"
33
+ ];
34
+ function d(e, t) {
35
+ return e ?? u[t % u.length] ?? "series1";
36
+ }
37
+ function f(e) {
38
+ if (e.length > l.items) return `Choose a window with at most ${l.items} items.`;
39
+ if (!r(e)) return "Every breakdown item needs a unique identifier.";
40
+ if (e.some((e) => e.value !== null && (!Number.isFinite(e.value) || e.value < 0))) return "Breakdown values must be finite and nonnegative, or explicitly missing.";
41
+ if (!Number.isFinite(e.reduce((e, t) => e + (t.value ?? 0), 0))) return "The sum of recorded values must be finite.";
42
+ }
43
+ function p({ items: r, selection: s }) {
44
+ return /* @__PURE__ */ a("ul", {
45
+ className: "xrvj5dj x1ghz6dp x1717udv xe8uvvx",
46
+ children: r.map((r) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ o(n, {
47
+ label: `${r.label}: ${r.valueLabel}`,
48
+ isSelected: s?.selectedId === r.id,
49
+ onSelect: s === void 0 ? void 0 : () => s.onSelect(r.id),
50
+ children: [/* @__PURE__ */ o("span", {
51
+ className: "x78zum5 x6s0dn4 x1hnptsi x1slnebi xeuugli",
52
+ children: [/* @__PURE__ */ a("span", {
53
+ "aria-hidden": !0,
54
+ ...i.props(c.swatch(e[r.tone], t[r.tone]))
55
+ }), r.label]
56
+ }), /* @__PURE__ */ a("span", {
57
+ className: "x153jb6y xp4054r xeuugli x193iq5w",
58
+ children: r.valueLabel
59
+ })]
60
+ }) }, r.id))
61
+ });
62
+ }
63
+ export { f as i, l as n, d as r, p as t };
@@ -1,11 +1,11 @@
1
1
  import { t as e } from "./header-styles-COxCYFZx.js";
2
- import { c as t, f as n, h as r } from "./src-CDp1JtwC.js";
3
- import * as i from "@stylexjs/stylex";
4
- import { Button as a } from "@ui-sdk/react/button";
5
- import { Children as o, useId as s } from "react";
6
- import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
2
+ import { c as t, g as n, l as r, p as i } from "./src-Dcs3SZ9V.js";
3
+ import * as a from "@stylexjs/stylex";
4
+ import { Button as o } from "@ui-sdk/react/button";
5
+ import { Children as s, useId as c } from "react";
6
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
7
7
  // packages/charts/src/chart-heading.tsx
8
- var d = { root: {
8
+ var f = { root: {
9
9
  k1C7PZ: "x8zbtdt",
10
10
  khm7nJ: "x1gkm1c7",
11
11
  kMwMTN: "xbixft",
@@ -14,28 +14,31 @@ var d = { root: {
14
14
  kLWn49: "x1778rvt",
15
15
  $$css: !0
16
16
  } };
17
- function f({ title: t, id: n, meta: r, actions: a }) {
18
- let s = o.toArray(r).length > 0, c = o.toArray(a).length > 0, f = s || c, p = s && /* @__PURE__ */ l("div", {
19
- ...i.props(e.meta),
17
+ function p({ title: t, id: n, meta: r, actions: i }) {
18
+ let o = s.toArray(r).length > 0, c = s.toArray(i).length > 0, l = o || c, p = o && /* @__PURE__ */ u("div", {
19
+ ...a.props(e.meta),
20
20
  children: r
21
- }), m = c && /* @__PURE__ */ l("div", {
22
- ...i.props(e.actions),
23
- children: a
21
+ }), m = c && /* @__PURE__ */ u("div", {
22
+ ...a.props(e.actions),
23
+ children: i
24
24
  });
25
- return /* @__PURE__ */ u("div", {
26
- ...i.props(e.row, e.reportRow, d.root),
27
- children: [/* @__PURE__ */ l("p", {
25
+ return /* @__PURE__ */ d("div", {
26
+ ...a.props(e.row, e.reportRow, f.root),
27
+ children: [/* @__PURE__ */ u("p", {
28
28
  id: n,
29
- ...i.props(e.title),
29
+ ...a.props(e.title),
30
30
  children: t
31
- }), f && /* @__PURE__ */ u("div", {
32
- ...i.props(e.trailing),
31
+ }), l && /* @__PURE__ */ d("div", {
32
+ ...a.props(e.trailing),
33
33
  children: [p, m]
34
34
  })]
35
35
  });
36
36
  }
37
37
  // packages/charts/src/chart-series-marker.tsx
38
- var p = {
38
+ var m = {
39
+ kGVxlE: "x1iotiob",
40
+ $$css: !0
41
+ }, h = {
39
42
  root: {
40
43
  k1xSpc: "x3nfvp2",
41
44
  kGNEyG: "x6s0dn4",
@@ -58,177 +61,178 @@ var p = {
58
61
  kWkggS: "xtwfq29",
59
62
  $$css: !0
60
63
  },
64
+ edge: (e) => [m, { "--x-boxShadow": `inset 0 0 0 1px ${e}` == null ? void 0 : `inset 0 0 0 1px ${e}` }],
61
65
  transparent: {
62
66
  kWkggS: "xjbqb8w",
63
67
  $$css: !0
64
68
  }
65
- }, m = 8, h = .3;
66
- function g({ shape: e }) {
69
+ }, g = 8, _ = .3;
70
+ function v({ shape: e }) {
67
71
  switch (e) {
68
- case "line": return /* @__PURE__ */ l("path", {
72
+ case "line": return /* @__PURE__ */ u("path", {
69
73
  d: "M0 4 H8",
70
74
  stroke: "currentColor",
71
75
  strokeWidth: 2
72
76
  });
73
- case "band": return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("rect", {
77
+ case "band": return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("rect", {
74
78
  width: 8,
75
79
  height: 8,
76
80
  fill: "currentColor",
77
- opacity: h
78
- }), /* @__PURE__ */ l("path", {
81
+ opacity: _
82
+ }), /* @__PURE__ */ u("path", {
79
83
  d: "M0 4 H8",
80
84
  stroke: "currentColor",
81
85
  strokeWidth: 1.5
82
86
  })] });
83
- case "tick": return /* @__PURE__ */ l("path", {
87
+ case "tick": return /* @__PURE__ */ u("path", {
84
88
  d: "M0 4 H8",
85
89
  stroke: "currentColor",
86
90
  strokeWidth: 3
87
91
  });
88
- case "range": return /* @__PURE__ */ l("path", {
92
+ case "range": return /* @__PURE__ */ u("path", {
89
93
  d: "M1.5 0.75 H6.5 M4 0.75 V7.25 M1.5 7.25 H6.5",
90
94
  stroke: "currentColor",
91
95
  strokeWidth: 1.5,
92
96
  fill: "none"
93
97
  });
94
- case "dashed": return /* @__PURE__ */ l("path", {
98
+ case "dashed": return /* @__PURE__ */ u("path", {
95
99
  d: "M0 4 H3 M5 4 H8",
96
100
  stroke: "currentColor",
97
101
  strokeWidth: 1.5
98
102
  });
99
103
  }
100
104
  }
101
- function _({ tone: e, shape: n = "swatch", children: r }) {
102
- let a = o.toArray(r).length > 0, s = !a && n !== "swatch", c = a || n === "swatch" ? r : /* @__PURE__ */ l("svg", {
103
- width: m,
104
- height: m,
105
- viewBox: `0 0 ${m} ${m}`,
105
+ function y({ tone: e, shape: n = "swatch", children: i }) {
106
+ let o = s.toArray(i).length > 0, c = !o && n !== "swatch", l = o || n === "swatch" ? i : /* @__PURE__ */ u("svg", {
107
+ width: g,
108
+ height: g,
109
+ viewBox: `0 0 ${g} ${g}`,
106
110
  focusable: "false",
107
111
  className: "x1lliihq x1xc55vz xdk7pt x1rea2x4",
108
- children: /* @__PURE__ */ l(g, { shape: n })
112
+ children: /* @__PURE__ */ u(v, { shape: n })
109
113
  });
110
- return /* @__PURE__ */ l("span", {
114
+ return /* @__PURE__ */ u("span", {
111
115
  "aria-hidden": !0,
112
116
  inert: !0,
113
- ...i.props(p.root, p.color(t[e]), a ? p.icon : p.swatch, s && p.transparent),
114
- children: c
117
+ ...a.props(h.root, h.color(t[e]), o ? h.icon : h.swatch, c && h.transparent, !o && !c && h.edge(r[e])),
118
+ children: l
115
119
  });
116
120
  }
117
121
  // packages/charts/src/chart-series-summary.tsx
118
- function v({ series: e, values: t }) {
119
- return Object.keys(t).length === e.length && e.every((e) => Object.hasOwn(t, e.id)) ? /* @__PURE__ */ l("dl", {
122
+ function b({ series: e, values: t }) {
123
+ return Object.keys(t).length === e.length && e.every((e) => Object.hasOwn(t, e.id)) ? /* @__PURE__ */ u("dl", {
120
124
  "aria-label": "Period summary",
121
125
  className: "x78zum5 x1a02dak xaml1ju x1ghz6dp xeuugli",
122
- children: e.map((e, r) => /* @__PURE__ */ u("div", {
126
+ children: e.map((e, n) => /* @__PURE__ */ d("div", {
123
127
  ...{
124
128
  0: { className: "xeuugli" },
125
129
  1: { className: "xeuugli xo02m6d xpilrb4 x1t7ytsu x97x49r" }
126
- }[r > 0 | 0],
127
- children: [/* @__PURE__ */ u("dt", {
130
+ }[n > 0 | 0],
131
+ children: [/* @__PURE__ */ d("dt", {
128
132
  className: "x78zum5 x6s0dn4 xunmzkg x153jb6y xy8obcc",
129
- children: [/* @__PURE__ */ l(_, {
133
+ children: [/* @__PURE__ */ u(y, {
130
134
  tone: e.tone,
131
135
  shape: e.shape
132
136
  }), e.label]
133
- }), /* @__PURE__ */ l("dd", {
137
+ }), /* @__PURE__ */ u("dd", {
134
138
  className: "x1ghz6dp xbixft x71lla1 xgkpprq xk4h15q x1wjjqco xss6m8b xj0a0fe",
135
- children: t[e.id] === void 0 ? /* @__PURE__ */ l(n, { width: "6ch" }) : t[e.id]
139
+ children: t[e.id] === void 0 ? /* @__PURE__ */ u(i, { width: "6ch" }) : t[e.id]
136
140
  })]
137
141
  }, e.id))
138
- }) : /* @__PURE__ */ l(r, {
142
+ }) : /* @__PURE__ */ u(n, {
139
143
  hasError: !0,
140
144
  children: "Period values must match the chart series identifiers."
141
145
  });
142
146
  }
143
147
  // packages/charts/src/chart-frame.tsx
144
- function y({ title: t, description: n, children: r, actions: a, footer: d, report: p, series: m = [] }) {
145
- let h = s();
146
- if (p !== void 0) {
147
- let e = p.seriesValues === void 0 ? p.summary : /* @__PURE__ */ l(v, {
148
+ function x({ title: t, description: n, children: r, actions: i, footer: o, report: f, series: m = [] }) {
149
+ let h = c();
150
+ if (f !== void 0) {
151
+ let e = f.seriesValues === void 0 ? f.summary : /* @__PURE__ */ u(b, {
148
152
  series: m,
149
- values: p.seriesValues
150
- }), i = e != null && e !== !1, s = o.toArray([p.actions, a]).length > 0, g = /* @__PURE__ */ u(c, { children: [p.actions, a] });
151
- return /* @__PURE__ */ u("figure", {
153
+ values: f.seriesValues
154
+ }), a = e != null && e !== !1, c = s.toArray([f.actions, i]).length > 0, g = /* @__PURE__ */ d(l, { children: [f.actions, i] });
155
+ return /* @__PURE__ */ d("figure", {
152
156
  "aria-labelledby": h,
153
157
  className: "xeuugli x1ghz6dp xbixft xpvm0e4 x1hz01jw xtqrqnz xj57cvi x1778rvt xmkeg23 x1y0btm7 x1ey3b81",
154
- children: [/* @__PURE__ */ l("figcaption", { children: /* @__PURE__ */ l(f, {
158
+ children: [/* @__PURE__ */ u("figcaption", { children: /* @__PURE__ */ u(p, {
155
159
  id: h,
156
160
  title: t,
157
- meta: p.meta,
158
- actions: s && g
159
- }) }), /* @__PURE__ */ u("div", {
161
+ meta: f.meta,
162
+ actions: c && g
163
+ }) }), /* @__PURE__ */ d("div", {
160
164
  className: "xeuugli xg7ukam",
161
165
  children: [
162
- i && /* @__PURE__ */ l("div", {
166
+ a && /* @__PURE__ */ u("div", {
163
167
  className: "x1xxlxpq xeuugli",
164
168
  children: e
165
169
  }),
166
- n !== void 0 && /* @__PURE__ */ l("p", {
170
+ n !== void 0 && /* @__PURE__ */ u("p", {
167
171
  className: "x1ghz6dp x1c87qhr x153jb6y xy8obcc xas2l8k",
168
172
  children: n
169
173
  }),
170
174
  r,
171
- d !== void 0 && /* @__PURE__ */ l("div", {
175
+ o !== void 0 && /* @__PURE__ */ u("div", {
172
176
  className: "x1xxf3xd xeuugli x153jb6y xy8obcc xas2l8k xj0a0fe",
173
- children: d
177
+ children: o
174
178
  })
175
179
  ]
176
180
  })]
177
181
  });
178
182
  }
179
- return /* @__PURE__ */ u("figure", {
183
+ return /* @__PURE__ */ d("figure", {
180
184
  "aria-labelledby": h,
181
185
  className: "xeuugli x1ghz6dp xbixft xpvm0e4 x1hz01jw xtqrqnz xj57cvi x1778rvt",
182
186
  children: [
183
- /* @__PURE__ */ u("figcaption", {
187
+ /* @__PURE__ */ d("figcaption", {
184
188
  className: "x78zum5 x1a02dak x1qughib x7a106z x1n8ia3y x1wv5www",
185
- children: [/* @__PURE__ */ u("div", {
189
+ children: [/* @__PURE__ */ d("div", {
186
190
  className: "x1cqoux5 xeuugli xj0a0fe",
187
- children: [/* @__PURE__ */ l("p", {
191
+ children: [/* @__PURE__ */ u("p", {
188
192
  id: h,
189
193
  className: "x1ghz6dp x12myhf4 x1778rvt x1b5ytql",
190
194
  children: t
191
- }), n !== void 0 && /* @__PURE__ */ l("p", {
195
+ }), n !== void 0 && /* @__PURE__ */ u("p", {
192
196
  className: "x1ghz6dp x1c87qhr x153jb6y xy8obcc xas2l8k",
193
197
  children: n
194
198
  })]
195
- }), a !== void 0 && /* @__PURE__ */ l("div", {
196
- ...i.props(e.actions),
197
- children: a
199
+ }), i !== void 0 && /* @__PURE__ */ u("div", {
200
+ ...a.props(e.actions),
201
+ children: i
198
202
  })]
199
203
  }),
200
204
  r,
201
- d !== void 0 && /* @__PURE__ */ l("div", {
205
+ o !== void 0 && /* @__PURE__ */ u("div", {
202
206
  className: "x1xxf3xd xeuugli x153jb6y xy8obcc xas2l8k xj0a0fe",
203
- children: d
207
+ children: o
204
208
  })
205
209
  ]
206
210
  });
207
211
  }
208
- function b({ items: e, label: t = "Legend", isScrollable: n = !1 }) {
209
- return /* @__PURE__ */ l("ul", {
212
+ function S({ items: e, label: t = "Legend", isScrollable: n = !1 }) {
213
+ return /* @__PURE__ */ u("ul", {
210
214
  "aria-label": t,
211
215
  ...{
212
216
  0: { className: "x78zum5 x1a02dak x8zbtdt x1gkm1c7 xe8uvvx x1ghz6dp x1717udv x153jb6y x1hz01jw xy8obcc xas2l8k" },
213
217
  1: { className: "x78zum5 x8zbtdt x1gkm1c7 xe8uvvx x1ghz6dp x1717udv x153jb6y x1hz01jw xy8obcc xas2l8k xozqiw3 xw2csxc x1mqbd49" }
214
218
  }[!!n | 0],
215
- children: e.map((e) => /* @__PURE__ */ u("li", {
219
+ children: e.map((e) => /* @__PURE__ */ d("li", {
216
220
  ...{
217
221
  0: { className: "x3nfvp2 x6s0dn4 xunmzkg xeuugli x193iq5w xj0a0fe" },
218
222
  1: { className: "x3nfvp2 x6s0dn4 xunmzkg xeuugli xj0a0fe x2lah0s x1x1rfll xuxw1ft" }
219
223
  }[!!n | 0],
220
- children: [/* @__PURE__ */ l(_, {
224
+ children: [/* @__PURE__ */ u(y, {
221
225
  tone: e.tone,
222
226
  shape: e.shape
223
227
  }), e.label]
224
228
  }, e.id))
225
229
  });
226
230
  }
227
- function x({ label: e, isSelected: t = !1, onSelect: n, children: r }) {
228
- return n === void 0 ? /* @__PURE__ */ l("div", {
231
+ function C({ label: e, isSelected: t = !1, onSelect: n, children: r }) {
232
+ return n === void 0 ? /* @__PURE__ */ u("div", {
229
233
  className: "x78zum5 x1a02dak x6s0dn4 x1qughib x8zbtdt x1gkm1c7 xeuugli x17tes2r x17oiadl x9f619 xh8yej3 xc342km x1hmw7ec x5g2kb4 x1hz01jw xtqrqnz xj57cvi x1778rvt x1yc453h xj0a0fe xbixft xpvm0e4 xss6m8b",
230
234
  children: r
231
- }) : /* @__PURE__ */ l(a, {
235
+ }) : /* @__PURE__ */ u(o, {
232
236
  type: "button",
233
237
  "aria-label": e,
234
238
  "aria-pressed": t,
@@ -240,12 +244,12 @@ function x({ label: e, isSelected: t = !1, onSelect: n, children: r }) {
240
244
  children: r
241
245
  });
242
246
  }
243
- function S({ children: e, id: t }) {
244
- return /* @__PURE__ */ l("p", {
247
+ function w({ children: e, id: t }) {
248
+ return /* @__PURE__ */ u("p", {
245
249
  id: t,
246
250
  "aria-live": "polite",
247
251
  className: "x1ghz6dp xeuugli x1mqbd49 xbixft xy8obcc xas2l8k xss6m8b xj0a0fe",
248
252
  children: e
249
253
  });
250
254
  }
251
- export { _ as a, S as i, y as n, b as r, x as t };
255
+ export { y as a, w as i, x as n, S as r, C as t };
@@ -1,5 +1,5 @@
1
- import { h as e } from "./src-CDp1JtwC.js";
2
- import { n as t } from "./chart-frame-Bcd9Tpt5.js";
1
+ import { g as e } from "./src-Dcs3SZ9V.js";
2
+ import { n as t } from "./chart-frame-Ztktqs1b.js";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
4
  // packages/charts/src/chart-input.tsx
5
5
  function r(e) {