@selectwin/kit 0.1.218 → 0.1.220

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.
@@ -87,6 +87,17 @@ var r = {
87
87
  progress: (e, t) => `${e} de ${t}`
88
88
  },
89
89
  sideNav: { pending: (e) => `${e} (com pendências)` },
90
+ carousel: {
91
+ label: "Destaques",
92
+ carousel: "carrossel",
93
+ slide: "slide",
94
+ position: (e, t) => `${e} de ${t}`,
95
+ previous: "Anterior",
96
+ next: "Próximo",
97
+ pause: "Parar de passar sozinho",
98
+ play: "Passar sozinho",
99
+ open: (e) => `Ver: ${e}`
100
+ },
90
101
  fees: {
91
102
  gross: "Valor bruto",
92
103
  net: "Valor líquido",
@@ -180,6 +191,17 @@ var r = {
180
191
  progress: (e, t) => `${e} of ${t}`
181
192
  },
182
193
  sideNav: { pending: (e) => `${e} (pending)` },
194
+ carousel: {
195
+ label: "Highlights",
196
+ carousel: "carousel",
197
+ slide: "slide",
198
+ position: (e, t) => `${e} of ${t}`,
199
+ previous: "Previous",
200
+ next: "Next",
201
+ pause: "Stop rotating",
202
+ play: "Rotate automatically",
203
+ open: (e) => `Open: ${e}`
204
+ },
183
205
  fees: {
184
206
  gross: "Gross amount",
185
207
  net: "Net amount",
@@ -9,6 +9,12 @@ export interface SelectSetupStep {
9
9
  trailing?: ReactNode;
10
10
  /** A linha inteira vira botão e leva até a etapa (0.1.163). */
11
11
  onSelect?: () => void;
12
+ /**
13
+ * 0.1.220: a linha inteira é um LINK de verdade até a etapa — `to` é um endereço do app (o `<Link>` do roteador) e
14
+ * `href`, um de fora. Abre em outra aba, copia o endereço e o leitor de tela diz "link" (o `onSelect` é um botão).
15
+ */
16
+ to?: string;
17
+ href?: string;
12
18
  }
13
19
  export interface SelectSetupGroup {
14
20
  title: ReactNode;
@@ -1,20 +1,22 @@
1
1
  /* empty css */
2
- import { formatSelectNumber as e, useSelectLocale as t, useSelectMessages as n } from "./SelectLocale.js";
3
- import { useInsideFrame as r } from "./internal/frame.js";
4
- import { inertProps as i } from "./internal/inert.js";
5
- import { forwardRef as a, useEffect as o, useRef as s, useState as c } from "react";
6
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
2
+ import { safeHref as e } from "./internal/safeHref.js";
3
+ import { formatSelectNumber as t, useSelectLocale as n, useSelectMessages as r } from "./SelectLocale.js";
4
+ import { useInsideFrame as i } from "./internal/frame.js";
5
+ import { inertProps as a } from "./internal/inert.js";
6
+ import { forwardRef as o, useEffect as s, useRef as c, useState as l } from "react";
7
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
8
+ import { Link as p } from "react-router-dom";
7
9
  //#region src/SelectSetupGuide.tsx
8
- function d({ status: e }) {
9
- return /* @__PURE__ */ l("span", {
10
+ function m({ status: e }) {
11
+ return /* @__PURE__ */ d("span", {
10
12
  className: `select-setupguide__icon select-setupguide__icon--${e}`,
11
13
  "aria-hidden": "true",
12
- children: e === "done" && /* @__PURE__ */ l("svg", {
14
+ children: e === "done" && /* @__PURE__ */ d("svg", {
13
15
  viewBox: "0 0 16 16",
14
16
  width: "10",
15
17
  height: "10",
16
18
  fill: "none",
17
- children: /* @__PURE__ */ l("path", {
19
+ children: /* @__PURE__ */ d("path", {
18
20
  d: "M3.5 8.5l3 3 6-7",
19
21
  stroke: "currentColor",
20
22
  strokeWidth: "2",
@@ -24,7 +26,7 @@ function d({ status: e }) {
24
26
  })
25
27
  });
26
28
  }
27
- var f = /* @__PURE__ */ l("svg", {
29
+ var h = /* @__PURE__ */ d("svg", {
28
30
  viewBox: "0 0 20 20",
29
31
  width: "16",
30
32
  height: "16",
@@ -34,120 +36,134 @@ var f = /* @__PURE__ */ l("svg", {
34
36
  strokeLinecap: "round",
35
37
  strokeLinejoin: "round",
36
38
  "aria-hidden": "true",
37
- children: /* @__PURE__ */ l("path", { d: "M8 5l5 5-5 5" })
39
+ children: /* @__PURE__ */ d("path", { d: "M8 5l5 5-5 5" })
38
40
  });
39
- function p({ group: e, justDone: t }) {
40
- let r = n().setupGuide, [a, o] = c(!!(e.collapsible && e.defaultCollapsed)), s = !e.collapsible || !a;
41
- return /* @__PURE__ */ u("div", {
42
- className: `select-setupguide__group${s ? "" : " is-collapsed"}`,
43
- children: [e.collapsible ? /* @__PURE__ */ u("button", {
41
+ function g({ group: t, justDone: n }) {
42
+ let i = r().setupGuide, [o, s] = l(!!(t.collapsible && t.defaultCollapsed)), c = !t.collapsible || !o;
43
+ return /* @__PURE__ */ f("div", {
44
+ className: `select-setupguide__group${c ? "" : " is-collapsed"}`,
45
+ children: [t.collapsible ? /* @__PURE__ */ f("button", {
44
46
  type: "button",
45
47
  className: "select-setupguide__grouptitle select-setupguide__grouptoggle",
46
- "aria-expanded": s,
47
- onClick: () => o((e) => !e),
48
- children: [/* @__PURE__ */ l("span", { children: e.title }), f]
49
- }) : /* @__PURE__ */ l("div", {
48
+ "aria-expanded": c,
49
+ onClick: () => s((e) => !e),
50
+ children: [/* @__PURE__ */ d("span", { children: t.title }), h]
51
+ }) : /* @__PURE__ */ d("div", {
50
52
  className: "select-setupguide__grouptitle",
51
- children: e.title
52
- }), /* @__PURE__ */ l("div", {
53
+ children: t.title
54
+ }), /* @__PURE__ */ d("div", {
53
55
  className: "select-setupguide__collapse",
54
- ...i(!s),
55
- children: /* @__PURE__ */ l("ul", {
56
+ ...a(!c),
57
+ children: /* @__PURE__ */ d("ul", {
56
58
  className: "select-setupguide__list",
57
- children: e.steps.map((e) => /* @__PURE__ */ u("li", {
58
- className: `select-setupguide__step is-${e.status}${e.onSelect ? " is-link" : ""}${t.has(e.id) ? " is-just-done" : ""}`,
59
- children: [
60
- /* @__PURE__ */ l(d, { status: e.status }),
61
- /* @__PURE__ */ u("span", {
62
- className: "select-setupguide__text",
63
- children: [e.onSelect ? /* @__PURE__ */ u("button", {
64
- type: "button",
65
- className: "select-setupguide__steptitle select-setupguide__go",
66
- onClick: e.onSelect,
67
- children: [e.title, /* @__PURE__ */ u("span", {
68
- className: "select-setupguide__sr",
69
- children: [" — ", r[e.status]]
59
+ children: t.steps.map((t) => {
60
+ let r = t.to != null || t.href != null ? e(t.to ?? t.href) : void 0, a = r !== void 0, o = /* @__PURE__ */ f(u, { children: [t.title, /* @__PURE__ */ f("span", {
61
+ className: "select-setupguide__sr",
62
+ children: [" — ", i[t.status]]
63
+ })] });
64
+ return /* @__PURE__ */ f("li", {
65
+ className: `select-setupguide__step is-${t.status}${t.onSelect || a ? " is-link" : ""}${n.has(t.id) ? " is-just-done" : ""}`,
66
+ children: [
67
+ /* @__PURE__ */ d(m, { status: t.status }),
68
+ /* @__PURE__ */ f("span", {
69
+ className: "select-setupguide__text",
70
+ children: [a && t.to != null ? /* @__PURE__ */ d(p, {
71
+ to: r,
72
+ className: "select-setupguide__steptitle select-setupguide__go",
73
+ children: o
74
+ }) : a ? /* @__PURE__ */ d("a", {
75
+ href: r,
76
+ className: "select-setupguide__steptitle select-setupguide__go",
77
+ children: o
78
+ }) : t.onSelect ? /* @__PURE__ */ f("button", {
79
+ type: "button",
80
+ className: "select-setupguide__steptitle select-setupguide__go",
81
+ onClick: t.onSelect,
82
+ children: [t.title, /* @__PURE__ */ f("span", {
83
+ className: "select-setupguide__sr",
84
+ children: [" — ", i[t.status]]
85
+ })]
86
+ }) : /* @__PURE__ */ f("span", {
87
+ className: "select-setupguide__steptitle",
88
+ children: [t.title, /* @__PURE__ */ f("span", {
89
+ className: "select-setupguide__sr",
90
+ children: [" — ", i[t.status]]
91
+ })]
92
+ }), t.description && /* @__PURE__ */ d("span", {
93
+ className: "select-setupguide__stepdesc",
94
+ children: t.description
70
95
  })]
71
- }) : /* @__PURE__ */ u("span", {
72
- className: "select-setupguide__steptitle",
73
- children: [e.title, /* @__PURE__ */ u("span", {
74
- className: "select-setupguide__sr",
75
- children: [" — ", r[e.status]]
76
- })]
77
- }), e.description && /* @__PURE__ */ l("span", {
78
- className: "select-setupguide__stepdesc",
79
- children: e.description
80
- })]
81
- }),
82
- e.trailing ? /* @__PURE__ */ l("span", {
83
- className: "select-setupguide__trailing",
84
- children: e.trailing
85
- }) : e.onSelect && e.status !== "done" ? /* @__PURE__ */ l("span", {
86
- className: "select-setupguide__chevron",
87
- children: f
88
- }) : null
89
- ]
90
- }, e.id))
96
+ }),
97
+ t.trailing ? /* @__PURE__ */ d("span", {
98
+ className: "select-setupguide__trailing",
99
+ children: t.trailing
100
+ }) : (t.onSelect || a) && t.status !== "done" ? /* @__PURE__ */ d("span", {
101
+ className: "select-setupguide__chevron",
102
+ children: h
103
+ }) : null
104
+ ]
105
+ }, t.id);
106
+ })
91
107
  })
92
108
  })]
93
109
  });
94
110
  }
95
- var m = a(function({ title: a, description: c, progress: d, actions: f, next: m, groups: h, minimized: g = !1, tone: _ = "default", className: v, ...y }, b) {
96
- let x = n().setupGuide, S = t(), C = d && d.total > 0 ? Math.round(d.done / d.total * 100) : 0, w = r(), T = s(null), E = /* @__PURE__ */ new Set(), D = h.flatMap((e) => e.steps);
111
+ var _ = o(function({ title: e, description: o, progress: l, actions: u, next: p, groups: m, minimized: h = !1, tone: _ = "default", className: v, ...y }, b) {
112
+ let x = r().setupGuide, S = n(), C = l && l.total > 0 ? Math.round(l.done / l.total * 100) : 0, w = i(), T = c(null), E = /* @__PURE__ */ new Set(), D = m.flatMap((e) => e.steps);
97
113
  if (T.current) for (let e of D) e.status === "done" && T.current.get(e.id) !== "done" && E.add(e.id);
98
- return o(() => {
114
+ return s(() => {
99
115
  T.current = new Map(D.map((e) => [e.id, e.status]));
100
- }), /* @__PURE__ */ u("section", {
116
+ }), /* @__PURE__ */ f("section", {
101
117
  ref: b,
102
118
  ...y,
103
- className: `select-setupguide${w ? " select-setupguide--nested" : ""}${g ? " is-minimized" : ""}${_ === "sandbox" ? " select-setupguide--sandbox" : ""}${v ? " " + v : ""}`,
104
- children: [/* @__PURE__ */ u("div", {
119
+ className: `select-setupguide${w ? " select-setupguide--nested" : ""}${h ? " is-minimized" : ""}${_ === "sandbox" ? " select-setupguide--sandbox" : ""}${v ? " " + v : ""}`,
120
+ children: [/* @__PURE__ */ f("div", {
105
121
  className: "select-setupguide__head",
106
122
  children: [
107
- /* @__PURE__ */ u("div", {
123
+ /* @__PURE__ */ f("div", {
108
124
  className: "select-setupguide__heading",
109
- children: [/* @__PURE__ */ l("h2", {
125
+ children: [/* @__PURE__ */ d("h2", {
110
126
  className: "select-setupguide__title",
111
- children: a
112
- }), c && /* @__PURE__ */ l("p", {
127
+ children: e
128
+ }), o && /* @__PURE__ */ d("p", {
113
129
  className: "select-setupguide__desc",
114
- children: c
130
+ children: o
115
131
  })]
116
132
  }),
117
- d && /* @__PURE__ */ u("div", {
133
+ l && /* @__PURE__ */ f("div", {
118
134
  className: "select-setupguide__progress",
119
- children: [/* @__PURE__ */ l("div", {
135
+ children: [/* @__PURE__ */ d("div", {
120
136
  className: "select-setupguide__bar",
121
137
  role: "progressbar",
122
138
  "aria-valuemin": 0,
123
- "aria-valuemax": d.total,
124
- "aria-valuenow": d.done,
139
+ "aria-valuemax": l.total,
140
+ "aria-valuenow": l.done,
125
141
  "aria-label": x.progressLabel,
126
- children: /* @__PURE__ */ l("span", {
142
+ children: /* @__PURE__ */ d("span", {
127
143
  className: "select-setupguide__fill",
128
144
  style: { width: `${Math.max(C, 3)}%` }
129
145
  })
130
- }), /* @__PURE__ */ l("span", {
146
+ }), /* @__PURE__ */ d("span", {
131
147
  className: "select-setupguide__count",
132
- children: d.label ?? x.progress(e(d.done, S), e(d.total, S))
148
+ children: l.label ?? x.progress(t(l.done, S), t(l.total, S))
133
149
  })]
134
150
  }),
135
- f && /* @__PURE__ */ l("div", {
151
+ u && /* @__PURE__ */ d("div", {
136
152
  className: "select-setupguide__actions",
137
- children: f
153
+ children: u
138
154
  })
139
155
  ]
140
- }), /* @__PURE__ */ l("div", {
156
+ }), /* @__PURE__ */ d("div", {
141
157
  className: "select-setupguide__fold",
142
- ...i(g),
143
- children: /* @__PURE__ */ u("div", {
158
+ ...a(h),
159
+ children: /* @__PURE__ */ f("div", {
144
160
  className: "select-setupguide__body",
145
- children: [m && /* @__PURE__ */ l("div", {
161
+ children: [p && /* @__PURE__ */ d("div", {
146
162
  className: "select-setupguide__next",
147
- children: m
148
- }), /* @__PURE__ */ l("div", {
163
+ children: p
164
+ }), /* @__PURE__ */ d("div", {
149
165
  className: "select-setupguide__steps",
150
- children: h.map((e, t) => /* @__PURE__ */ l(p, {
166
+ children: m.map((e, t) => /* @__PURE__ */ d(g, {
151
167
  group: e,
152
168
  justDone: E
153
169
  }, t))
@@ -156,32 +172,32 @@ var m = a(function({ title: a, description: c, progress: d, actions: f, next: m,
156
172
  })]
157
173
  });
158
174
  });
159
- function h({ eyebrow: e, title: t, children: n, actions: r }) {
160
- return /* @__PURE__ */ u("div", {
175
+ function v({ eyebrow: e, title: t, children: n, actions: r }) {
176
+ return /* @__PURE__ */ f("div", {
161
177
  className: "select-setupnext",
162
- children: [/* @__PURE__ */ u("div", {
178
+ children: [/* @__PURE__ */ f("div", {
163
179
  className: "select-setupnext__text",
164
180
  children: [
165
- e && /* @__PURE__ */ l("div", {
181
+ e && /* @__PURE__ */ d("div", {
166
182
  className: "select-setupnext__eyebrow",
167
183
  children: e
168
184
  }),
169
- /* @__PURE__ */ l("h3", {
185
+ /* @__PURE__ */ d("h3", {
170
186
  className: "select-setupnext__title",
171
187
  children: t
172
188
  }),
173
- n && /* @__PURE__ */ l("div", {
189
+ n && /* @__PURE__ */ d("div", {
174
190
  className: "select-setupnext__body",
175
191
  children: n
176
192
  })
177
193
  ]
178
- }), r && /* @__PURE__ */ l("div", {
194
+ }), r && /* @__PURE__ */ d("div", {
179
195
  className: "select-setupnext__actions",
180
196
  children: r
181
197
  })]
182
198
  });
183
199
  }
184
200
  //#endregion
185
- export { m as SelectSetupGuide, h as SelectSetupNext };
201
+ export { _ as SelectSetupGuide, v as SelectSetupNext };
186
202
 
187
203
  //# sourceMappingURL=SelectSetupGuide.js.map
@@ -0,0 +1,19 @@
1
+ import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
+ import { SelectColumnTooltip } from './SelectColumnChart';
3
+ type SelectSparkBarsOwnProps = {
4
+ data: number[];
5
+ /** A altura das barras, em px (padrão 96). */
6
+ height?: number;
7
+ color?: string;
8
+ /** Os rótulos embaixo, espalhados ("12/10", "19/10", "25/10"). */
9
+ labels?: ReactNode[];
10
+ /** O nome do gráfico: com ele, o gráfico entra no Tab e anda pelas setas. */
11
+ label?: string;
12
+ /** A dica de cada barra (o título e as linhas); `null` para nenhuma. */
13
+ tooltip?: (index: number) => SelectColumnTooltip | null;
14
+ /** A barra que o foco do teclado acende primeiro (padrão: a última). */
15
+ start?: number;
16
+ };
17
+ export type SelectSparkBarsProps = SelectSparkBarsOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectSparkBarsOwnProps>;
18
+ export declare function SelectSparkBars({ data, height, color, labels, label, tooltip, start, className, ...rest }: SelectSparkBarsProps): import("react").JSX.Element;
19
+ export {};
@@ -0,0 +1,98 @@
1
+ /* empty css */
2
+ import { chartColor as e, useChartSize as t } from "./chartUtils.js";
3
+ import { FloatingChartTooltip as n } from "./chartTip.js";
4
+ import { tipSpeech as r, useChartPointer as i } from "./internal/chartPointer.js";
5
+ import { useId as a, useReducer as o } from "react";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ //#region src/SelectSparkBars.tsx
8
+ function l({ data: l, height: u = 96, color: d, labels: f, label: p, tooltip: m, start: h, className: g, ..._ }) {
9
+ var v;
10
+ let { ref: y, width: b } = t(u), x = a(), [, S] = o((e) => e + 1, 0), C = d ?? e(0), w = l.length, T = Math.max(...l, 1), E = w > 0 && b > 0 ? Math.min(12, Math.max(1.5, (b - (w > 60 ? 1.5 : 3) * (w - 1)) / w)) : 0, D = w > 1 ? (b - E * w) / (w - 1) : 0, O = (e) => e * (E + D), k = (e) => u - e / T * (u - 8), { active: A, props: j } = i({
11
+ count: w,
12
+ indexAt: (e) => Math.floor((e + D / 2) / (E + D || 1)),
13
+ start: h,
14
+ focusable: p != null
15
+ }), M = A != null && m ? m(A) : null, N = M && A != null ? (v = y.current) == null ? void 0 : v.getBoundingClientRect() : void 0, P = A == null ? 0 : k(l[A] ?? 0), F = N != null && N.top + P < 96, I = w - 1;
16
+ return /* @__PURE__ */ c("div", {
17
+ ..._,
18
+ ref: y,
19
+ className: `select-sparkbars${g ? " " + g : ""}`,
20
+ children: [
21
+ b > 0 && w > 0 && /* @__PURE__ */ c("svg", {
22
+ width: b,
23
+ height: u,
24
+ className: "select-chart",
25
+ ...p == null ? { "aria-hidden": !0 } : {
26
+ role: "img",
27
+ "aria-label": p
28
+ },
29
+ ...j,
30
+ children: [
31
+ /* @__PURE__ */ s("defs", { children: /* @__PURE__ */ c("linearGradient", {
32
+ id: `${x}-glow`,
33
+ x1: "0",
34
+ y1: "0",
35
+ x2: "0",
36
+ y2: "1",
37
+ children: [/* @__PURE__ */ s("stop", {
38
+ offset: "0%",
39
+ stopColor: C,
40
+ stopOpacity: .16
41
+ }), /* @__PURE__ */ s("stop", {
42
+ offset: "100%",
43
+ stopColor: C,
44
+ stopOpacity: 0
45
+ })]
46
+ }) }),
47
+ /* @__PURE__ */ s("rect", {
48
+ x: 0,
49
+ y: k(T) - 4,
50
+ width: O(I) + E,
51
+ height: u - k(T) + 4,
52
+ rx: 6,
53
+ fill: `url(#${x}-glow)`
54
+ }),
55
+ l.map((e, t) => /* @__PURE__ */ s("rect", {
56
+ className: `select-sparkbars__bar${A != null && A !== t ? " is-dim" : ""}`,
57
+ x: O(t),
58
+ y: k(e),
59
+ width: E,
60
+ height: u - k(e),
61
+ rx: E > 3 ? 1.5 : 0,
62
+ fill: C
63
+ }, t)),
64
+ /* @__PURE__ */ s("circle", {
65
+ className: "select-sparkbars__end",
66
+ cx: O(I) + E / 2,
67
+ cy: k(l[I] ?? 0) - 5,
68
+ r: 4,
69
+ fill: C
70
+ })
71
+ ]
72
+ }),
73
+ f != null && f.length > 0 && /* @__PURE__ */ s("div", {
74
+ className: "select-sparkbars__labels",
75
+ children: f.map((e, t) => /* @__PURE__ */ s("span", { children: e }, t))
76
+ }),
77
+ p != null && /* @__PURE__ */ s("span", {
78
+ className: "select-visually-hidden",
79
+ "aria-live": "polite",
80
+ children: M ? r(M.title, M.rows) : ""
81
+ }),
82
+ /* @__PURE__ */ s(n, {
83
+ tip: M && N && A != null ? {
84
+ x: N.left + O(A) + E / 2,
85
+ y: F ? N.top + u + 2 : N.top + P - 6,
86
+ place: F ? "bottom" : "top",
87
+ title: M.title,
88
+ rows: M.rows
89
+ } : null,
90
+ onDismiss: S
91
+ })
92
+ ]
93
+ });
94
+ }
95
+ //#endregion
96
+ export { l as SelectSparkBars };
97
+
98
+ //# sourceMappingURL=SelectSparkBars.js.map
@@ -3,6 +3,8 @@ export interface ChartTipRow {
3
3
  label: ReactNode;
4
4
  value: ReactNode;
5
5
  color?: string;
6
+ /** 0.1.219: a linha da soma (sem o ponto, com o fio acima). */
7
+ total?: boolean;
6
8
  }
7
9
  export interface ChartTipState {
8
10
  x: number;
package/dist/icons.d.ts CHANGED
@@ -154,6 +154,8 @@ export declare function UsersIcon(): import("react").JSX.Element;
154
154
  /** Três círculos sobrepostos (Iconsax colorfilter) — cor, identidade visual. */
155
155
  export declare function PaletteIcon(): import("react").JSX.Element;
156
156
  /** Duas barras (Iconsax pause) — pausar uma cobrança recorrente. */
157
+ /** Tocar (0.1.220): o triângulo, o par do `PauseIcon` (o botão de passar sozinho do SelectCarousel). */
158
+ export declare function PlayIcon(): import("react").JSX.Element;
157
159
  export declare function PauseIcon(): import("react").JSX.Element;
158
160
  /** Seta voltando em volta (Iconsax arrow-rotate-left) — o ESTORNO: o dinheiro que volta. Não é o
159
161
  * `RefreshIcon` (recarregar), que desenha o mesmo gesto para "de novo". */