@selectwin/kit 0.1.262 → 0.1.264
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/README.md +74 -0
- package/dist/SelectActionMenu.d.ts +7 -1
- package/dist/SelectActionMenu.js +14 -13
- package/dist/SelectBlockBuilder.d.ts +63 -0
- package/dist/SelectBlockBuilder.js +370 -0
- package/dist/SelectCalendar.d.ts +68 -4
- package/dist/SelectCalendar.js +449 -279
- package/dist/SelectChannelPreview.d.ts +34 -5
- package/dist/SelectChannelPreview.js +167 -73
- package/dist/SelectChartCard.d.ts +13 -0
- package/dist/SelectChartCard.js +50 -30
- package/dist/SelectCombobox.d.ts +5 -0
- package/dist/SelectCombobox.js +77 -61
- package/dist/SelectConversationContext.d.ts +30 -0
- package/dist/SelectConversationContext.js +141 -0
- package/dist/SelectDatePicker.d.ts +4 -0
- package/dist/SelectDatePicker.js +78 -62
- package/dist/SelectDateRangeField.d.ts +6 -1
- package/dist/SelectDateRangeField.js +9 -8
- package/dist/SelectField.d.ts +7 -3
- package/dist/SelectField.js +71 -70
- package/dist/SelectFilterBar.d.ts +9 -0
- package/dist/SelectFilterBar.js +301 -179
- package/dist/SelectFunnel.d.ts +12 -2
- package/dist/SelectFunnel.js +193 -63
- package/dist/SelectHorizontalBar.d.ts +11 -1
- package/dist/SelectHorizontalBar.js +86 -35
- package/dist/SelectHtmlFrame.d.ts +3 -1
- package/dist/SelectHtmlFrame.js +4 -4
- package/dist/SelectIconButton.d.ts +2 -1
- package/dist/SelectIconButton.js +1 -1
- package/dist/SelectLocale.d.ts +146 -0
- package/dist/SelectLocale.js +363 -31
- package/dist/SelectMail.d.ts +80 -4
- package/dist/SelectMail.js +433 -300
- package/dist/SelectMailEditor.d.ts +35 -1
- package/dist/SelectMailEditor.js +347 -163
- package/dist/SelectNumberedList.d.ts +20 -2
- package/dist/SelectNumberedList.js +75 -17
- package/dist/SelectPopover.js +31 -18
- package/dist/SelectProgressBar.d.ts +22 -5
- package/dist/SelectProgressBar.js +70 -40
- package/dist/SelectRecordCard.d.ts +13 -4
- package/dist/SelectRecordCard.js +30 -8
- package/dist/SelectRuleBuilder.d.ts +52 -0
- package/dist/SelectRuleBuilder.js +157 -0
- package/dist/SelectSearchPreview.d.ts +35 -0
- package/dist/SelectSearchPreview.js +69 -0
- package/dist/SelectSegmented.d.ts +2 -0
- package/dist/SelectSegmented.js +1 -1
- package/dist/SelectSortable.d.ts +5 -1
- package/dist/SelectSparkBars.d.ts +5 -1
- package/dist/SelectSparkBars.js +65 -57
- package/dist/SelectSteps.d.ts +6 -0
- package/dist/SelectSteps.js +43 -10
- package/dist/SelectTabs.d.ts +16 -4
- package/dist/SelectTabs.js +95 -60
- package/dist/SelectTextarea.d.ts +1 -1
- package/dist/SelectVoiceNote.d.ts +6 -1
- package/dist/SelectVoiceNote.js +118 -106
- package/dist/chartUtils.d.ts +10 -0
- package/dist/index.d.ts +18 -2
- package/dist/index.js +153 -149
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/SelectFunnel.d.ts
CHANGED
|
@@ -6,8 +6,18 @@ type SelectFunnelOwnProps = {
|
|
|
6
6
|
palette?: 'ramp' | 'mono';
|
|
7
7
|
/** Texto da conversão de uma etapa sobre a anterior (padrão "56%"); no `shape="funnel"`, sobre a primeira. */
|
|
8
8
|
convLabel?: (pct: number, index: number) => ReactNode;
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* 0.1.235: `funnel` = os trapézios que afinam etapa a etapa. Padrão `bars`, as barras horizontais. 0.1.263: `table` = o
|
|
11
|
+
* funil em tabela (Etapa, Chegaram, Da anterior, Do início).
|
|
12
|
+
*/
|
|
13
|
+
shape?: 'bars' | 'funnel' | 'table';
|
|
14
|
+
/**
|
|
15
|
+
* 0.1.263, no `shape="table"`: a porcentagem escrita (padrão: uma casa sempre, na língua do kit — "78,8%", "88,0%" —, e o
|
|
16
|
+
* zero e o todo sem ela, "0%" e "100%", como na prancha).
|
|
17
|
+
*/
|
|
18
|
+
pctFormat?: (pct: number) => string;
|
|
19
|
+
/** 0.1.263, no `shape="table"`: o nome da tabela para o leitor de tela. */
|
|
20
|
+
label?: string;
|
|
11
21
|
};
|
|
12
22
|
/**
|
|
13
23
|
* O trapézio de uma etapa com os cantos arredondados: em cima a largura dela, embaixo a da seguinte (em % da maior). Cada
|
package/dist/SelectFunnel.js
CHANGED
|
@@ -1,108 +1,238 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { LockIcon as e } from "./icons.js";
|
|
3
|
+
import { selectIntlLocale as t, useSelectLocale as n, useSelectMessages as r } from "./SelectLocale.js";
|
|
4
|
+
import { chartColor as i, formatCompact as a } from "./chartUtils.js";
|
|
5
|
+
import { forwardRef as o } from "react";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
7
|
//#region src/SelectFunnel.tsx
|
|
6
|
-
var
|
|
7
|
-
function
|
|
8
|
-
let n =
|
|
9
|
-
[(
|
|
10
|
-
[(
|
|
11
|
-
[(
|
|
12
|
-
[(
|
|
13
|
-
],
|
|
8
|
+
var l = 160, u = 52, d = 6;
|
|
9
|
+
function f(e, t) {
|
|
10
|
+
let n = l * e / 100, r = l * t / 100, i = [
|
|
11
|
+
[(l - n) / 2, 0],
|
|
12
|
+
[(l + n) / 2, 0],
|
|
13
|
+
[(l + r) / 2, u],
|
|
14
|
+
[(l - r) / 2, u]
|
|
15
|
+
], a = (e) => e.toFixed(1), o = "";
|
|
14
16
|
return i.forEach((e, t) => {
|
|
15
|
-
let n = i[(t + 3) % 4], r = i[(t + 1) % 4],
|
|
16
|
-
|
|
17
|
-
}),
|
|
17
|
+
let n = i[(t + 3) % 4], r = i[(t + 1) % 4], s = Math.hypot(n[0] - e[0], n[1] - e[1]) || 1, c = Math.hypot(r[0] - e[0], r[1] - e[1]) || 1, l = Math.min(d, s / 2, c / 2), u = [e[0] + (n[0] - e[0]) / s * l, e[1] + (n[1] - e[1]) / s * l], f = [e[0] + (r[0] - e[0]) / c * l, e[1] + (r[1] - e[1]) / c * l];
|
|
18
|
+
o += `${t === 0 ? "M" : "L"}${a(u[0])} ${a(u[1])} Q${a(e[0])} ${a(e[1])} ${a(f[0])} ${a(f[1])} `;
|
|
19
|
+
}), o + "Z";
|
|
18
20
|
}
|
|
19
|
-
var
|
|
20
|
-
let
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
var p = o(function({ stages: e, format: t = a, palette: n = "ramp", convLabel: r, shape: o = "bars", pctFormat: d, label: p, className: h, ...g }, _) {
|
|
22
|
+
let v = Math.max(1, ...e.map((e) => e.value));
|
|
23
|
+
if (o === "table") return /* @__PURE__ */ s(m, {
|
|
24
|
+
ref: _,
|
|
25
|
+
...g,
|
|
26
|
+
stages: e,
|
|
27
|
+
max: v,
|
|
28
|
+
format: t,
|
|
29
|
+
pctFormat: d,
|
|
30
|
+
label: p,
|
|
31
|
+
className: h
|
|
32
|
+
});
|
|
33
|
+
if (o === "funnel") {
|
|
34
|
+
var y;
|
|
35
|
+
let n = ((y = e[0]) == null ? void 0 : y.value) || 1, i = (e) => Math.max(3, e / v * 100);
|
|
36
|
+
return /* @__PURE__ */ s("div", {
|
|
37
|
+
ref: _,
|
|
38
|
+
...g,
|
|
39
|
+
className: `select-funnel select-funnel--shape${h ? " " + h : ""}`,
|
|
40
|
+
children: e.map((a, o) => {
|
|
41
|
+
let d = o === e.length - 1, p = d ? a : e[o + 1], m = a.value / n * 100, h = a.color ?? (d ? "var(--select-chart-paid)" : "color-mix(in srgb, var(--select-chart-neutral) 40%, transparent)");
|
|
42
|
+
return /* @__PURE__ */ c("div", {
|
|
43
|
+
className: `select-funnel__step${d ? " select-funnel__step--last" : ""}`,
|
|
44
|
+
children: [/* @__PURE__ */ s("svg", {
|
|
33
45
|
className: "select-funnel__shape",
|
|
34
|
-
viewBox: `0 0 ${
|
|
46
|
+
viewBox: `0 0 ${l} ${u}`,
|
|
35
47
|
"aria-hidden": "true",
|
|
36
|
-
children: /* @__PURE__ */
|
|
37
|
-
d:
|
|
48
|
+
children: /* @__PURE__ */ s("path", {
|
|
49
|
+
d: f(i(a.value), i(p.value)),
|
|
38
50
|
style: { fill: h }
|
|
39
51
|
})
|
|
40
|
-
}), /* @__PURE__ */
|
|
52
|
+
}), /* @__PURE__ */ c("div", {
|
|
41
53
|
className: "select-funnel__steptext",
|
|
42
54
|
children: [
|
|
43
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ s("span", {
|
|
44
56
|
className: "select-funnel__label",
|
|
45
|
-
children:
|
|
57
|
+
children: a.label
|
|
46
58
|
}),
|
|
47
|
-
/* @__PURE__ */
|
|
59
|
+
/* @__PURE__ */ c("span", {
|
|
48
60
|
className: "select-funnel__nums",
|
|
49
|
-
children: [/* @__PURE__ */
|
|
61
|
+
children: [/* @__PURE__ */ s("span", {
|
|
50
62
|
className: "select-funnel__value",
|
|
51
|
-
children:
|
|
52
|
-
}),
|
|
53
|
-
className: `select-funnel__conv${
|
|
54
|
-
children: [
|
|
63
|
+
children: t(a.value)
|
|
64
|
+
}), o > 0 && /* @__PURE__ */ c("span", {
|
|
65
|
+
className: `select-funnel__conv${a.flag ? " is-flagged" : ""}`,
|
|
66
|
+
children: [a.flag ? "▼ " : "", r ? r(m, o) : `${m.toFixed(1).replace(".", ",")}%`]
|
|
55
67
|
})]
|
|
56
68
|
}),
|
|
57
|
-
|
|
69
|
+
a.note != null && /* @__PURE__ */ s("span", {
|
|
58
70
|
className: "select-funnel__note",
|
|
59
|
-
children:
|
|
71
|
+
children: a.note
|
|
60
72
|
})
|
|
61
73
|
]
|
|
62
74
|
})]
|
|
63
|
-
},
|
|
75
|
+
}, o);
|
|
64
76
|
})
|
|
65
77
|
});
|
|
66
78
|
}
|
|
67
|
-
return /* @__PURE__ */
|
|
68
|
-
ref:
|
|
69
|
-
...
|
|
70
|
-
className: `select-funnel select-funnel--${
|
|
71
|
-
children:
|
|
72
|
-
let
|
|
73
|
-
return /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ s("div", {
|
|
80
|
+
ref: _,
|
|
81
|
+
...g,
|
|
82
|
+
className: `select-funnel select-funnel--${n}${h ? " " + h : ""}`,
|
|
83
|
+
children: e.map((a, o) => {
|
|
84
|
+
let l = o > 0 ? e[o - 1].value || 1 : a.value || 1, u = o > 0 ? a.value / l * 100 : 100, d = n === "mono", f = a.color ?? (d ? o === e.length - 1 ? "var(--select-chart-paid)" : "var(--select-chart-1)" : i(o));
|
|
85
|
+
return /* @__PURE__ */ c("div", {
|
|
74
86
|
className: "select-funnel__row",
|
|
75
87
|
children: [
|
|
76
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ s("div", {
|
|
77
89
|
className: "select-funnel__label",
|
|
78
|
-
children:
|
|
90
|
+
children: a.label
|
|
79
91
|
}),
|
|
80
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ s("div", {
|
|
81
93
|
className: "select-funnel__track",
|
|
82
|
-
children: /* @__PURE__ */
|
|
94
|
+
children: /* @__PURE__ */ s("div", {
|
|
83
95
|
className: "select-funnel__bar",
|
|
84
96
|
style: {
|
|
85
|
-
width: `${
|
|
97
|
+
width: `${a.value / v * 100}%`,
|
|
86
98
|
background: d ? f : `linear-gradient(90deg, ${f}, color-mix(in srgb, ${f} 50%, transparent))`
|
|
87
99
|
}
|
|
88
100
|
})
|
|
89
101
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ c("div", {
|
|
91
103
|
className: "select-funnel__meta",
|
|
92
|
-
children: [/* @__PURE__ */
|
|
104
|
+
children: [/* @__PURE__ */ s("span", {
|
|
93
105
|
className: "select-funnel__value",
|
|
94
|
-
children:
|
|
95
|
-
}),
|
|
96
|
-
className: `select-funnel__conv${
|
|
97
|
-
children: [
|
|
106
|
+
children: t(a.value)
|
|
107
|
+
}), o > 0 && /* @__PURE__ */ c("span", {
|
|
108
|
+
className: `select-funnel__conv${a.flag ? " is-flagged" : ""}`,
|
|
109
|
+
children: [a.flag ? "▼ " : "", r ? r(u, o) : `${u.toFixed(0)}%`]
|
|
98
110
|
})]
|
|
99
111
|
})
|
|
100
112
|
]
|
|
101
|
-
},
|
|
113
|
+
}, o);
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
}), m = o(function({ stages: i, max: a, format: o, pctFormat: l, label: u, className: d, ...f }, p) {
|
|
117
|
+
var m;
|
|
118
|
+
let h = r(), g = n(), _ = l ?? ((e) => {
|
|
119
|
+
let n = e === 0 || e === 100;
|
|
120
|
+
return `${e.toLocaleString(t(g), {
|
|
121
|
+
minimumFractionDigits: +!n,
|
|
122
|
+
maximumFractionDigits: +!n
|
|
123
|
+
})}%`;
|
|
124
|
+
}), v = ((m = i[0]) == null ? void 0 : m.value) || 0;
|
|
125
|
+
return /* @__PURE__ */ s("div", {
|
|
126
|
+
ref: p,
|
|
127
|
+
...f,
|
|
128
|
+
className: `select-funnel select-funnel--table${d ? " " + d : ""}`,
|
|
129
|
+
children: /* @__PURE__ */ c("table", {
|
|
130
|
+
className: "select-funnel__table",
|
|
131
|
+
role: "table",
|
|
132
|
+
"aria-label": u,
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ c("colgroup", { children: [
|
|
135
|
+
/* @__PURE__ */ s("col", { className: "select-funnel__colstage" }),
|
|
136
|
+
/* @__PURE__ */ s("col", {}),
|
|
137
|
+
/* @__PURE__ */ s("col", { className: "select-funnel__colprev" }),
|
|
138
|
+
/* @__PURE__ */ s("col", { className: "select-funnel__colstart" })
|
|
139
|
+
] }),
|
|
140
|
+
/* @__PURE__ */ s("thead", {
|
|
141
|
+
role: "rowgroup",
|
|
142
|
+
children: /* @__PURE__ */ c("tr", {
|
|
143
|
+
role: "row",
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ s("th", {
|
|
146
|
+
role: "columnheader",
|
|
147
|
+
scope: "col",
|
|
148
|
+
children: h.funnel.stage
|
|
149
|
+
}),
|
|
150
|
+
/* @__PURE__ */ s("th", {
|
|
151
|
+
role: "columnheader",
|
|
152
|
+
scope: "col",
|
|
153
|
+
className: "select-funnel__thbar",
|
|
154
|
+
children: h.funnel.reached
|
|
155
|
+
}),
|
|
156
|
+
/* @__PURE__ */ s("th", {
|
|
157
|
+
role: "columnheader",
|
|
158
|
+
scope: "col",
|
|
159
|
+
className: "select-funnel__thnum",
|
|
160
|
+
children: h.funnel.fromPrevious
|
|
161
|
+
}),
|
|
162
|
+
/* @__PURE__ */ s("th", {
|
|
163
|
+
role: "columnheader",
|
|
164
|
+
scope: "col",
|
|
165
|
+
className: "select-funnel__thnum",
|
|
166
|
+
children: h.funnel.fromStart
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
})
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ s("tbody", {
|
|
172
|
+
role: "rowgroup",
|
|
173
|
+
children: i.map((t, n) => {
|
|
174
|
+
let r = n > 0 ? i[n - 1].value : 0, l = Math.max(0, Math.min(100, t.value / a * 100)), u = t.lockedLabel ?? h.lock.label, d = {
|
|
175
|
+
"--select-funnel-w": `${l}%`,
|
|
176
|
+
...t.color ? { "--select-funnel-bar": t.color } : {}
|
|
177
|
+
};
|
|
178
|
+
return /* @__PURE__ */ c("tr", {
|
|
179
|
+
role: "row",
|
|
180
|
+
className: t.locked ? "is-locked" : void 0,
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ c("th", {
|
|
183
|
+
role: "rowheader",
|
|
184
|
+
scope: "row",
|
|
185
|
+
className: "select-funnel__tstage",
|
|
186
|
+
children: [
|
|
187
|
+
t.locked ? /* @__PURE__ */ s("span", {
|
|
188
|
+
className: "select-funnel__lock",
|
|
189
|
+
title: u,
|
|
190
|
+
children: /* @__PURE__ */ s(e, {})
|
|
191
|
+
}) : null,
|
|
192
|
+
/* @__PURE__ */ s("span", {
|
|
193
|
+
className: "select-funnel__stagename",
|
|
194
|
+
children: t.label
|
|
195
|
+
}),
|
|
196
|
+
t.locked ? /* @__PURE__ */ s("span", {
|
|
197
|
+
className: "select-visually-hidden",
|
|
198
|
+
children: ` (${u})`
|
|
199
|
+
}) : null
|
|
200
|
+
]
|
|
201
|
+
}),
|
|
202
|
+
/* @__PURE__ */ s("td", {
|
|
203
|
+
role: "cell",
|
|
204
|
+
className: "select-funnel__reached",
|
|
205
|
+
"data-label": h.funnel.reached,
|
|
206
|
+
children: /* @__PURE__ */ s("span", {
|
|
207
|
+
className: "select-funnel__tbarcell",
|
|
208
|
+
children: /* @__PURE__ */ s("span", {
|
|
209
|
+
className: "select-funnel__tbar",
|
|
210
|
+
style: d,
|
|
211
|
+
children: o(t.value)
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ s("td", {
|
|
216
|
+
role: "cell",
|
|
217
|
+
className: "select-funnel__num select-funnel__num--prev",
|
|
218
|
+
"data-label": h.funnel.fromPrevious,
|
|
219
|
+
children: n === 0 || r <= 0 ? "—" : _(t.value / r * 100)
|
|
220
|
+
}),
|
|
221
|
+
/* @__PURE__ */ s("td", {
|
|
222
|
+
role: "cell",
|
|
223
|
+
className: "select-funnel__num select-funnel__num--start",
|
|
224
|
+
"data-label": h.funnel.fromStart,
|
|
225
|
+
children: v > 0 ? _(t.value / v * 100) : "—"
|
|
226
|
+
})
|
|
227
|
+
]
|
|
228
|
+
}, n);
|
|
229
|
+
})
|
|
230
|
+
})
|
|
231
|
+
]
|
|
102
232
|
})
|
|
103
233
|
});
|
|
104
234
|
});
|
|
105
235
|
//#endregion
|
|
106
|
-
export {
|
|
236
|
+
export { p as SelectFunnel, f as funnelStagePath };
|
|
107
237
|
|
|
108
238
|
//# sourceMappingURL=SelectFunnel.js.map
|
|
@@ -23,7 +23,17 @@ type SelectHorizontalBarOwnProps = {
|
|
|
23
23
|
* "everyone watched it all".
|
|
24
24
|
*/
|
|
25
25
|
max?: number;
|
|
26
|
+
/**
|
|
27
|
+
* 0.1.263: as séries de cada categoria — duas (ou mais) barras por linha, com o nome e a cor de cada uma (padrão: o
|
|
28
|
+
* primário e o acento claro). Os valores vêm em `datum.values`, na mesma ordem.
|
|
29
|
+
*/
|
|
30
|
+
series?: SelectHorizontalBarSeries[];
|
|
26
31
|
};
|
|
32
|
+
/** 0.1.263: uma série das barras por linha (`SelectHorizontalBar series`). */
|
|
33
|
+
export interface SelectHorizontalBarSeries {
|
|
34
|
+
label: string;
|
|
35
|
+
color?: string;
|
|
36
|
+
}
|
|
27
37
|
export type SelectHorizontalBarProps = SelectHorizontalBarOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectHorizontalBarOwnProps>;
|
|
28
|
-
export declare function SelectHorizontalBar(
|
|
38
|
+
export declare function SelectHorizontalBar(props: SelectHorizontalBarProps): import("react").JSX.Element;
|
|
29
39
|
export {};
|
|
@@ -4,22 +4,28 @@ import { ChartTooltip as a, useChartTooltip as o } from "./chartTip.js";
|
|
|
4
4
|
import { useId as s } from "react";
|
|
5
5
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
6
|
//#region src/SelectHorizontalBar.tsx
|
|
7
|
-
var u = 6.1, d = 12, f = 56, p = .4;
|
|
8
|
-
function
|
|
9
|
-
|
|
7
|
+
var u = 6.1, d = 12, f = 56, p = .4, m = ["var(--select-primary)", "color-mix(in srgb, var(--select-accent) 70%, var(--select-surface))"];
|
|
8
|
+
function h(e) {
|
|
9
|
+
return e.series && e.series.length > 0 ? /* @__PURE__ */ c(_, {
|
|
10
|
+
...e,
|
|
11
|
+
series: e.series
|
|
12
|
+
}) : /* @__PURE__ */ c(g, { ...e });
|
|
13
|
+
}
|
|
14
|
+
function g({ data: m, height: h, color: g, format: _ = t, formatValue: v, distributed: y = !0, labelWidth: b, max: x, series: S, className: C, ...w }) {
|
|
15
|
+
let T = h ?? m.length * 36 + 6 + 26, { ref: E, width: D } = i(T), O = o(), k = s(), A = x && x > 0 ? x : n(Math.max(0, ...m.map((e) => e.value))), j = m.reduce((e, t) => Math.max(e, t.label.length), 0), M = Math.min(Math.max(f, j * u + d), Math.max(f, D * p)), N = b ?? M, P = Math.max(3, Math.floor((N - d) / u)), F = (e) => e.length <= P ? e : `${e.slice(0, P - 1).trimEnd()}…`, I = Math.max(0, D - N - 28), L = T - 6 - 26, R = m.length ? L / m.length : 0, z = Math.min(R * .62, 22), B = (e) => N + e / A * I, V = (t, n) => t.color ?? (y ? e(n) : g ?? e(0));
|
|
10
16
|
return /* @__PURE__ */ l("div", {
|
|
11
|
-
...
|
|
12
|
-
className: `select-chart-wrap${
|
|
13
|
-
ref:
|
|
14
|
-
children: [
|
|
15
|
-
width:
|
|
16
|
-
height:
|
|
17
|
+
...w,
|
|
18
|
+
className: `select-chart-wrap${C ? " " + C : ""}`,
|
|
19
|
+
ref: E,
|
|
20
|
+
children: [D > 0 && /* @__PURE__ */ l("svg", {
|
|
21
|
+
width: D,
|
|
22
|
+
height: T,
|
|
17
23
|
className: "select-chart",
|
|
18
24
|
children: [
|
|
19
25
|
/* @__PURE__ */ c("defs", { children: m.map((e, t) => {
|
|
20
|
-
let n =
|
|
26
|
+
let n = V(e, t);
|
|
21
27
|
return /* @__PURE__ */ l("linearGradient", {
|
|
22
|
-
id: `${
|
|
28
|
+
id: `${k}-h${t}`,
|
|
23
29
|
x1: "0",
|
|
24
30
|
y1: "0",
|
|
25
31
|
x2: "1",
|
|
@@ -35,66 +41,111 @@ function m({ data: m, height: h, color: g, format: _ = t, formatValue: v, distri
|
|
|
35
41
|
})]
|
|
36
42
|
}, t);
|
|
37
43
|
}) }),
|
|
38
|
-
r(
|
|
39
|
-
x1:
|
|
40
|
-
x2:
|
|
44
|
+
r(A).map((e, t) => /* @__PURE__ */ l("g", { children: [/* @__PURE__ */ c("line", {
|
|
45
|
+
x1: B(e),
|
|
46
|
+
x2: B(e),
|
|
41
47
|
y1: 6,
|
|
42
|
-
y2: 6 +
|
|
48
|
+
y2: 6 + L,
|
|
43
49
|
className: t === 0 ? "select-chart__axis" : "select-chart__grid"
|
|
44
50
|
}), /* @__PURE__ */ c("text", {
|
|
45
|
-
x:
|
|
46
|
-
y:
|
|
51
|
+
x: B(e),
|
|
52
|
+
y: T - 26 + 16,
|
|
47
53
|
className: "select-chart__xlabel",
|
|
48
54
|
textAnchor: "middle",
|
|
49
55
|
children: _(e)
|
|
50
56
|
})] }, t)),
|
|
51
57
|
m.map((e, t) => {
|
|
52
|
-
let n = 6 +
|
|
58
|
+
let n = 6 + R * t + R / 2, r = Math.min(I, e.value / A * I), i = V(e, t);
|
|
53
59
|
return /* @__PURE__ */ l("g", { children: [
|
|
54
60
|
/* @__PURE__ */ c("rect", {
|
|
55
|
-
x:
|
|
56
|
-
y: n -
|
|
57
|
-
width:
|
|
58
|
-
height:
|
|
61
|
+
x: N,
|
|
62
|
+
y: n - z / 2,
|
|
63
|
+
width: I,
|
|
64
|
+
height: z,
|
|
59
65
|
rx: 5,
|
|
60
66
|
className: "select-chart__track-bar"
|
|
61
67
|
}),
|
|
62
68
|
/* @__PURE__ */ c("rect", {
|
|
63
|
-
x:
|
|
64
|
-
y: n -
|
|
69
|
+
x: N,
|
|
70
|
+
y: n - z / 2,
|
|
65
71
|
width: Math.max(0, r),
|
|
66
|
-
height:
|
|
72
|
+
height: z,
|
|
67
73
|
rx: 5,
|
|
68
|
-
fill: `url(#${
|
|
74
|
+
fill: `url(#${k}-h${t})`,
|
|
69
75
|
className: "select-chart__hbar",
|
|
70
76
|
style: { animationDelay: `${t * 40}ms` },
|
|
71
|
-
onMouseEnter: () =>
|
|
72
|
-
x:
|
|
73
|
-
y: n -
|
|
74
|
-
place: n -
|
|
77
|
+
onMouseEnter: () => O.show({
|
|
78
|
+
x: N + r,
|
|
79
|
+
y: n - z / 2,
|
|
80
|
+
place: n - z / 2 < 50 ? "bottom" : "top",
|
|
75
81
|
rows: [{
|
|
76
82
|
label: e.label,
|
|
77
83
|
value: (v ?? _)(e.value),
|
|
78
84
|
color: i
|
|
79
85
|
}]
|
|
80
86
|
}),
|
|
81
|
-
onMouseLeave:
|
|
87
|
+
onMouseLeave: O.hide
|
|
82
88
|
}),
|
|
83
89
|
/* @__PURE__ */ l("text", {
|
|
84
|
-
x:
|
|
90
|
+
x: N - d / 2,
|
|
85
91
|
y: n,
|
|
86
92
|
className: "select-chart__ylabel",
|
|
87
93
|
dominantBaseline: "middle",
|
|
88
94
|
textAnchor: "end",
|
|
89
|
-
children: [/* @__PURE__ */ c("title", { children: e.label }),
|
|
95
|
+
children: [/* @__PURE__ */ c("title", { children: e.label }), F(e.label)]
|
|
90
96
|
})
|
|
91
97
|
] }, t);
|
|
92
98
|
})
|
|
93
99
|
]
|
|
94
|
-
}), /* @__PURE__ */ c(a, { tip:
|
|
100
|
+
}), /* @__PURE__ */ c(a, { tip: O.tip })]
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function _({ data: e, series: n, format: r = t, formatValue: i, max: a, className: o, height: s, color: u, distributed: d, labelWidth: f, ...p }) {
|
|
104
|
+
let h = e.flatMap((e) => (e.values ?? []).filter((e) => Number.isFinite(e))), g = a && a > 0 ? a : Math.max(1, ...h), _ = i ?? r;
|
|
105
|
+
return /* @__PURE__ */ c("div", {
|
|
106
|
+
...p,
|
|
107
|
+
className: `select-hbars${o ? " " + o : ""}`,
|
|
108
|
+
children: e.map((e, t) => /* @__PURE__ */ l("div", {
|
|
109
|
+
className: "select-hbars__group",
|
|
110
|
+
role: "group",
|
|
111
|
+
"aria-label": e.label,
|
|
112
|
+
children: [/* @__PURE__ */ l("div", {
|
|
113
|
+
className: "select-hbars__head",
|
|
114
|
+
children: [/* @__PURE__ */ c("span", {
|
|
115
|
+
className: "select-hbars__label",
|
|
116
|
+
children: e.label
|
|
117
|
+
}), e.note == null ? null : /* @__PURE__ */ c("span", {
|
|
118
|
+
className: "select-hbars__note",
|
|
119
|
+
children: e.note
|
|
120
|
+
})]
|
|
121
|
+
}), n.map((t, n) => {
|
|
122
|
+
var r;
|
|
123
|
+
let i = ((r = e.values) == null ? void 0 : r[n]) ?? 0, a = {
|
|
124
|
+
"--select-hbars-w": `${+Math.max(0, Math.min(100, i / g * 100)).toFixed(3)}%`,
|
|
125
|
+
"--select-hbars-color": t.color ?? m[n % m.length]
|
|
126
|
+
};
|
|
127
|
+
return /* @__PURE__ */ l("div", {
|
|
128
|
+
className: `select-hbars__row${n === 0 ? " select-hbars__row--lead" : ""}`,
|
|
129
|
+
children: [/* @__PURE__ */ c("span", {
|
|
130
|
+
className: "select-hbars__track",
|
|
131
|
+
"aria-hidden": "true",
|
|
132
|
+
children: /* @__PURE__ */ c("span", {
|
|
133
|
+
className: "select-hbars__bar",
|
|
134
|
+
style: a
|
|
135
|
+
})
|
|
136
|
+
}), /* @__PURE__ */ l("span", {
|
|
137
|
+
className: "select-hbars__value",
|
|
138
|
+
children: [/* @__PURE__ */ c("span", {
|
|
139
|
+
className: "select-visually-hidden",
|
|
140
|
+
children: `${t.label}: `
|
|
141
|
+
}), _(i)]
|
|
142
|
+
})]
|
|
143
|
+
}, n);
|
|
144
|
+
})]
|
|
145
|
+
}, t))
|
|
95
146
|
});
|
|
96
147
|
}
|
|
97
148
|
//#endregion
|
|
98
|
-
export {
|
|
149
|
+
export { h as SelectHorizontalBar };
|
|
99
150
|
|
|
100
151
|
//# sourceMappingURL=SelectHorizontalBar.js.map
|
|
@@ -7,8 +7,10 @@ export interface SelectHtmlFrameProps {
|
|
|
7
7
|
height?: string;
|
|
8
8
|
/** Os links do documento abrem em outra aba. Nunca libera script nem a origem. */
|
|
9
9
|
allowLinks?: boolean;
|
|
10
|
+
/** 0.1.263: `dark` — o quadro de um leitor de e-mail no escuro (sem o clarão branco ao carregar). Padrão `light`. */
|
|
11
|
+
scheme?: 'light' | 'dark';
|
|
10
12
|
className?: string;
|
|
11
13
|
}
|
|
12
14
|
/** Só a própria origem (um caminho que não é `//host`) ou `https:`. */
|
|
13
15
|
export declare function frameSrcAllowed(src: string): boolean;
|
|
14
|
-
export declare function SelectHtmlFrame({ src, title, height, allowLinks, className }: SelectHtmlFrameProps): import("react").JSX.Element;
|
|
16
|
+
export declare function SelectHtmlFrame({ src, title, height, allowLinks, scheme, className }: SelectHtmlFrameProps): import("react").JSX.Element;
|
package/dist/SelectHtmlFrame.js
CHANGED
|
@@ -10,11 +10,11 @@ function t(e) {
|
|
|
10
10
|
return !1;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
function n({ src: n, title: r, height: i = "28rem", allowLinks: a = !1,
|
|
14
|
-
let
|
|
13
|
+
function n({ src: n, title: r, height: i = "28rem", allowLinks: a = !1, scheme: o = "light", className: s }) {
|
|
14
|
+
let c = t(n);
|
|
15
15
|
return /* @__PURE__ */ e("div", {
|
|
16
|
-
className: `select-htmlframe${o ? " " +
|
|
17
|
-
children:
|
|
16
|
+
className: `select-htmlframe${o === "dark" ? " select-htmlframe--dark" : ""}${s ? " " + s : ""}`,
|
|
17
|
+
children: c ? /* @__PURE__ */ e("iframe", {
|
|
18
18
|
className: "select-htmlframe__frame",
|
|
19
19
|
title: r,
|
|
20
20
|
src: n,
|
|
@@ -10,7 +10,8 @@ type SelectIconButtonOwnProps = {
|
|
|
10
10
|
/**
|
|
11
11
|
* Pressed/selected look — e.g. the active device in a preview toggle. 0.1.200: o `aria-pressed` só sai quando `active`
|
|
12
12
|
* vem: o botão de ícone comum (copiar, fechar, o "…") não é um botão de alternar, e o leitor de tela o anunciava como
|
|
13
|
-
* "não pressionado".
|
|
13
|
+
* "não pressionado". 0.1.264: o gatilho de um painel (com `aria-expanded`, o seletor de emoji, o de reação) fica com o
|
|
14
|
+
* desenho de ativo enquanto o painel está aberto, mas o leitor de tela ouve "expandido", nunca "pressionado".
|
|
14
15
|
*/
|
|
15
16
|
active?: boolean;
|
|
16
17
|
};
|
package/dist/SelectIconButton.js
CHANGED
|
@@ -11,7 +11,7 @@ var r = t(function({ icon: t, label: r, onClick: i, disabled: a = !1, size: o =
|
|
|
11
11
|
type: "button",
|
|
12
12
|
className: `select-iconbtn select-iconbtn--${o} select-iconbtn--${s}${c ? " is-active" : ""}${l ? " " + l : ""}`,
|
|
13
13
|
"aria-label": r,
|
|
14
|
-
"aria-pressed": c,
|
|
14
|
+
"aria-pressed": u["aria-expanded"] === void 0 ? c : void 0,
|
|
15
15
|
onClick: i,
|
|
16
16
|
disabled: a,
|
|
17
17
|
children: t
|