@selectwin/kit 0.1.257 → 0.1.259

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.
Files changed (67) hide show
  1. package/README.md +75 -0
  2. package/dist/SelectActionBar.d.ts +29 -0
  3. package/dist/SelectActionBar.js +101 -0
  4. package/dist/SelectActionList.d.ts +5 -0
  5. package/dist/SelectActionList.js +55 -39
  6. package/dist/SelectAppFrame.d.ts +8 -2
  7. package/dist/SelectAppFrame.js +124 -119
  8. package/dist/SelectAvatarGroup.d.ts +31 -0
  9. package/dist/SelectAvatarGroup.js +39 -0
  10. package/dist/SelectBadge.d.ts +10 -1
  11. package/dist/SelectBadge.js +26 -12
  12. package/dist/SelectBulkBar.d.ts +21 -0
  13. package/dist/SelectBulkBar.js +40 -0
  14. package/dist/SelectChannelPreview.d.ts +35 -5
  15. package/dist/SelectChannelPreview.js +127 -60
  16. package/dist/SelectColorField.d.ts +1 -5
  17. package/dist/SelectColorField.js +83 -101
  18. package/dist/SelectCombobox.d.ts +5 -0
  19. package/dist/SelectCombobox.js +52 -49
  20. package/dist/SelectDataTable.d.ts +17 -1
  21. package/dist/SelectDataTable.js +100 -90
  22. package/dist/SelectDeadlineBadge.d.ts +32 -0
  23. package/dist/SelectDeadlineBadge.js +73 -0
  24. package/dist/SelectFieldset.d.ts +14 -0
  25. package/dist/SelectFieldset.js +27 -0
  26. package/dist/SelectFilterBar.d.ts +6 -1
  27. package/dist/SelectFilterBar.js +155 -125
  28. package/dist/SelectImageUploadField.d.ts +5 -3
  29. package/dist/SelectImageUploadField.js +26 -26
  30. package/dist/SelectKanban.d.ts +13 -1
  31. package/dist/SelectKanban.js +72 -50
  32. package/dist/SelectListCard.d.ts +27 -1
  33. package/dist/SelectListCard.js +47 -22
  34. package/dist/SelectLocale.d.ts +96 -0
  35. package/dist/SelectLocale.js +733 -521
  36. package/dist/SelectMail.d.ts +9 -1
  37. package/dist/SelectMail.js +234 -207
  38. package/dist/SelectModal.d.ts +10 -4
  39. package/dist/SelectModal.js +158 -137
  40. package/dist/SelectSection.d.ts +4 -4
  41. package/dist/SelectSection.js +77 -8
  42. package/dist/SelectSegmented.d.ts +7 -0
  43. package/dist/SelectSegmented.js +51 -43
  44. package/dist/SelectSideNav.d.ts +2 -1
  45. package/dist/SelectSideNav.js +156 -135
  46. package/dist/SelectSortable.d.ts +47 -1
  47. package/dist/SelectSortable.js +138 -19
  48. package/dist/SelectSteps.d.ts +3 -0
  49. package/dist/SelectSteps.js +42 -31
  50. package/dist/SelectTable.d.ts +13 -1
  51. package/dist/SelectTable.js +88 -79
  52. package/dist/SelectTabs.d.ts +10 -0
  53. package/dist/SelectTabs.js +68 -30
  54. package/dist/SelectTimeline.d.ts +4 -0
  55. package/dist/SelectTimeline.js +20 -9
  56. package/dist/SelectWeekHours.d.ts +64 -0
  57. package/dist/SelectWeekHours.js +338 -0
  58. package/dist/index.d.ts +19 -2
  59. package/dist/index.js +191 -184
  60. package/dist/internal/color.d.ts +15 -0
  61. package/dist/internal/color.js +40 -0
  62. package/dist/internal/navCount.d.ts +21 -0
  63. package/dist/internal/navCount.js +27 -0
  64. package/dist/internal/safeHref.d.ts +7 -0
  65. package/dist/internal/safeHref.js +12 -1
  66. package/dist/style.css +1 -1
  67. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
1
  /* empty css */
2
2
  import { SelectLabelRow as e } from "./SelectField.js";
3
3
  import { SelectPopover as t } from "./SelectPopover.js";
4
- import { useEffect as n, useId as r, useRef as i, useState as a } from "react";
5
- import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
4
+ import { contrastRatio as n, luminance as r, normalizeHex as i } from "./internal/color.js";
5
+ import { useEffect as a, useId as o, useRef as s, useState as c } from "react";
6
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
6
7
  //#region src/SelectColorField.tsx
7
- var l = [
8
+ var f = [
8
9
  "#212529",
9
10
  "#495057",
10
11
  "#868E96",
@@ -21,39 +22,20 @@ var l = [
21
22
  "#DB2777",
22
23
  "#9333EA",
23
24
  "#6D28D9"
24
- ], u = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;
25
- function d(e) {
26
- let t = u.exec((e ?? "").trim());
27
- return t ? `#${(t[1].length === 3 ? t[1].split("").map((e) => e + e).join("") : t[1]).toUpperCase()}` : null;
28
- }
29
- function f(e) {
30
- let t = d(e);
31
- if (!t) return 0;
32
- let [n, r, i] = [
33
- 1,
34
- 3,
35
- 5
36
- ].map((e) => parseInt(t.slice(e, e + 2), 16) / 255).map((e) => e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
37
- return .2126 * n + .7152 * r + .0722 * i;
38
- }
39
- function p(e, t) {
40
- let [n, r] = [f(e), f(t)].sort((e, t) => t - e);
41
- return (n + .05) / (r + .05);
42
- }
43
- var m = (e) => Math.min(1, Math.max(0, e));
44
- function h(e) {
45
- let t = d(e) ?? "#000000", [n, r, i] = [
25
+ ], p = (e) => Math.min(1, Math.max(0, e));
26
+ function m(e) {
27
+ let t = i(e) ?? "#000000", [n, r, a] = [
46
28
  1,
47
29
  3,
48
30
  5
49
- ].map((e) => parseInt(t.slice(e, e + 2), 16) / 255), a = Math.max(n, r, i), o = a - Math.min(n, r, i), s = 0;
50
- return o && (s = a === n ? (r - i) / o % 6 : a === r ? (i - n) / o + 2 : (n - r) / o + 4, s *= 60, s < 0 && (s += 360)), {
51
- h: s,
52
- s: a ? o / a : 0,
53
- v: a
31
+ ].map((e) => parseInt(t.slice(e, e + 2), 16) / 255), o = Math.max(n, r, a), s = o - Math.min(n, r, a), c = 0;
32
+ return s && (c = o === n ? (r - a) / s % 6 : o === r ? (a - n) / s + 2 : (n - r) / s + 4, c *= 60, c < 0 && (c += 360)), {
33
+ h: c,
34
+ s: o ? s / o : 0,
35
+ v: o
54
36
  };
55
37
  }
56
- function g({ h: e, s: t, v: n }) {
38
+ function h({ h: e, s: t, v: n }) {
57
39
  let r = (r) => {
58
40
  let i = (r + e / 60) % 6;
59
41
  return n - n * t * Math.max(0, Math.min(i, 4 - i, 1));
@@ -64,26 +46,26 @@ function g({ h: e, s: t, v: n }) {
64
46
  r(1)
65
47
  ].map((e) => Math.round(e * 255).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
66
48
  }
67
- function _({ hex: e, onPick: t }) {
68
- let [r, l] = a(() => h(e ?? "#1D4ED8")), u = i(r), d = (e) => {
69
- u.current = e, l(e);
49
+ function g({ hex: e, onPick: t }) {
50
+ let [n, r] = c(() => m(e ?? "#1D4ED8")), i = s(n), o = (e) => {
51
+ i.current = e, r(e);
70
52
  };
71
- n(() => {
72
- if (!e || g(u.current) === e) return;
73
- let t = h(e);
74
- d(t.s === 0 || t.v === 0 ? {
53
+ a(() => {
54
+ if (!e || h(i.current) === e) return;
55
+ let t = m(e);
56
+ o(t.s === 0 || t.v === 0 ? {
75
57
  ...t,
76
- h: u.current.h
58
+ h: i.current.h
77
59
  } : t);
78
60
  }, [e]);
79
61
  let f = (e) => {
80
- d(e), t(g(e));
81
- }, p = (e, t, n) => {
62
+ o(e), t(h(e));
63
+ }, g = (e, t, n) => {
82
64
  var r;
83
65
  (r = e.setPointerCapture) == null || r.call(e, t.pointerId);
84
66
  let i = (t) => {
85
67
  let r = e.getBoundingClientRect();
86
- n(m((t.clientX - r.left) / (r.width || 1)), m((t.clientY - r.top) / (r.height || 1)));
68
+ n(p((t.clientX - r.left) / (r.width || 1)), p((t.clientY - r.top) / (r.height || 1)));
87
69
  };
88
70
  i(t);
89
71
  let a = (e) => i(e), o = () => {
@@ -91,113 +73,113 @@ function _({ hex: e, onPick: t }) {
91
73
  };
92
74
  e.addEventListener("pointermove", a), e.addEventListener("pointerup", o), e.addEventListener("pointercancel", o);
93
75
  }, _ = (e) => {
94
- let t = e.shiftKey ? .1 : .01, { h: n, s: r, v: i } = u.current, a = e.key === "ArrowLeft" ? {
76
+ let t = e.shiftKey ? .1 : .01, { h: n, s: r, v: a } = i.current, o = e.key === "ArrowLeft" ? {
95
77
  h: n,
96
- s: m(r - t),
97
- v: i
78
+ s: p(r - t),
79
+ v: a
98
80
  } : e.key === "ArrowRight" ? {
99
81
  h: n,
100
- s: m(r + t),
101
- v: i
82
+ s: p(r + t),
83
+ v: a
102
84
  } : e.key === "ArrowUp" ? {
103
85
  h: n,
104
86
  s: r,
105
- v: m(i + t)
87
+ v: p(a + t)
106
88
  } : e.key === "ArrowDown" ? {
107
89
  h: n,
108
90
  s: r,
109
- v: m(i - t)
91
+ v: p(a - t)
110
92
  } : null;
111
- a && (e.preventDefault(), f(a));
93
+ o && (e.preventDefault(), f(o));
112
94
  }, v = (e) => {
113
- let t = e.shiftKey ? 10 : 1, { h: n, s: r, v: i } = u.current, a = e.key === "ArrowLeft" || e.key === "ArrowDown" ? Math.max(0, n - t) : e.key === "ArrowRight" || e.key === "ArrowUp" ? Math.min(360, n + t) : e.key === "Home" ? 0 : e.key === "End" ? 360 : null;
114
- a != null && (e.preventDefault(), f({
115
- h: a,
95
+ let t = e.shiftKey ? 10 : 1, { h: n, s: r, v: a } = i.current, o = e.key === "ArrowLeft" || e.key === "ArrowDown" ? Math.max(0, n - t) : e.key === "ArrowRight" || e.key === "ArrowUp" ? Math.min(360, n + t) : e.key === "Home" ? 0 : e.key === "End" ? 360 : null;
96
+ o != null && (e.preventDefault(), f({
97
+ h: o,
116
98
  s: r,
117
- v: i
99
+ v: a
118
100
  }));
119
- }, y = g({
120
- h: r.h,
101
+ }, y = h({
102
+ h: n.h,
121
103
  s: 1,
122
104
  v: 1
123
- }), b = g(r);
124
- return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("div", {
105
+ }), b = h(n);
106
+ return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("div", {
125
107
  className: "select-colorfield__sv",
126
108
  style: { backgroundColor: y },
127
109
  role: "slider",
128
110
  tabIndex: 0,
129
111
  "aria-label": "Saturação e brilho",
130
- "aria-valuetext": `${b} — saturação ${Math.round(r.s * 100)}%, brilho ${Math.round(r.v * 100)}%`,
131
- onPointerDown: (e) => p(e.currentTarget, e, (e, t) => f({
132
- h: u.current.h,
112
+ "aria-valuetext": `${b} — saturação ${Math.round(n.s * 100)}%, brilho ${Math.round(n.v * 100)}%`,
113
+ onPointerDown: (e) => g(e.currentTarget, e, (e, t) => f({
114
+ h: i.current.h,
133
115
  s: e,
134
116
  v: 1 - t
135
117
  })),
136
118
  onKeyDown: _,
137
- children: /* @__PURE__ */ s("span", {
119
+ children: /* @__PURE__ */ u("span", {
138
120
  className: "select-colorfield__svthumb",
139
121
  style: {
140
- left: `${r.s * 100}%`,
141
- top: `${(1 - r.v) * 100}%`,
122
+ left: `${n.s * 100}%`,
123
+ top: `${(1 - n.v) * 100}%`,
142
124
  background: b
143
125
  }
144
126
  })
145
- }), /* @__PURE__ */ s("div", {
127
+ }), /* @__PURE__ */ u("div", {
146
128
  className: "select-colorfield__hue",
147
129
  role: "slider",
148
130
  tabIndex: 0,
149
131
  "aria-label": "Matiz",
150
132
  "aria-valuemin": 0,
151
133
  "aria-valuemax": 360,
152
- "aria-valuenow": Math.round(r.h),
153
- onPointerDown: (e) => p(e.currentTarget, e, (e) => f({
154
- ...u.current,
134
+ "aria-valuenow": Math.round(n.h),
135
+ onPointerDown: (e) => g(e.currentTarget, e, (e) => f({
136
+ ...i.current,
155
137
  h: e * 360
156
138
  })),
157
139
  onKeyDown: v,
158
- children: /* @__PURE__ */ s("span", {
140
+ children: /* @__PURE__ */ u("span", {
159
141
  className: "select-colorfield__huethumb",
160
142
  style: {
161
- left: `${r.h / 360 * 100}%`,
143
+ left: `${n.h / 360 * 100}%`,
162
144
  background: y
163
145
  }
164
146
  })
165
147
  })] });
166
148
  }
167
- var v = (e) => e.toFixed(1).replace(".", ",");
168
- function y({ label: i, help: u, hint: m, error: h, value: g, onChange: y, presets: b = l, disabled: x = !1, allowEmpty: S = !1, contrastWith: C, contrastLabel: w = "o texto", id: T }) {
169
- let E = r(), D = T ?? `color-${E}`, [O, k] = a(!1), [A, j] = a(g ?? ""), [M, N] = a(null);
170
- n(() => {
171
- j(g ?? ""), N(null);
172
- }, [g]);
173
- let P = d(g ?? ""), F = (e) => {
149
+ var _ = (e) => e.toFixed(1).replace(".", ",");
150
+ function v({ label: s, help: p, hint: m, error: h, value: v, onChange: y, presets: b = f, disabled: x = !1, allowEmpty: S = !1, contrastWith: C, contrastLabel: w = "o texto", id: T }) {
151
+ let E = o(), D = T ?? `color-${E}`, [O, k] = c(!1), [A, j] = c(v ?? ""), [M, N] = c(null);
152
+ a(() => {
153
+ j(v ?? ""), N(null);
154
+ }, [v]);
155
+ let P = i(v ?? ""), F = (e) => {
174
156
  if (!e.trim()) {
175
- S ? (N(null), y("")) : j(g ?? "");
157
+ S ? (N(null), y("")) : j(v ?? "");
176
158
  return;
177
159
  }
178
- let t = d(e);
160
+ let t = i(e);
179
161
  if (!t) {
180
162
  N("Use o formato #RRGGBB (ex.: #1D4ED8).");
181
163
  return;
182
164
  }
183
165
  N(null), j(t), t !== P && y(t);
184
- }, I = C ? d(C) : null, L = P && I ? p(P, I) : null, R = h ?? M, z = R ? `${D}-err` : m || L != null ? `${D}-hint` : void 0;
185
- return /* @__PURE__ */ c("div", {
166
+ }, I = C ? i(C) : null, L = P && I ? n(P, I) : null, R = h ?? M, z = R ? `${D}-err` : m || L != null ? `${D}-hint` : void 0;
167
+ return /* @__PURE__ */ d("div", {
186
168
  className: `select-field select-colorfield${x ? " is-disabled" : ""}`,
187
169
  children: [
188
- (i || u) && /* @__PURE__ */ s(e, {
170
+ (s || p) && /* @__PURE__ */ u(e, {
189
171
  htmlFor: D,
190
- label: i,
191
- help: u
172
+ label: s,
173
+ help: p
192
174
  }),
193
- /* @__PURE__ */ c("div", {
175
+ /* @__PURE__ */ d("div", {
194
176
  className: `select-input-wrap select-input-wrap--affixed select-colorfield__control${R ? " select-input-wrap--error" : ""}`,
195
- children: [/* @__PURE__ */ s(t, {
177
+ children: [/* @__PURE__ */ u(t, {
196
178
  active: O,
197
179
  onClose: () => k(!1),
198
180
  placement: "bottom-start",
199
181
  role: "dialog",
200
- activator: /* @__PURE__ */ s("button", {
182
+ activator: /* @__PURE__ */ u("button", {
201
183
  type: "button",
202
184
  className: `select-colorfield__swatch${P ? "" : " is-empty"}`,
203
185
  style: P ? { background: P } : void 0,
@@ -206,20 +188,20 @@ function y({ label: i, help: u, hint: m, error: h, value: g, onChange: y, preset
206
188
  "aria-label": P ? `Cor ${P} — abrir a paleta` : "Escolher uma cor",
207
189
  "aria-expanded": O
208
190
  }),
209
- children: /* @__PURE__ */ c("div", {
191
+ children: /* @__PURE__ */ d("div", {
210
192
  className: "select-colorfield__panel",
211
193
  children: [
212
- /* @__PURE__ */ s(_, {
194
+ /* @__PURE__ */ u(g, {
213
195
  hex: P,
214
196
  onPick: F
215
197
  }),
216
- /* @__PURE__ */ s("div", {
198
+ /* @__PURE__ */ u("div", {
217
199
  className: "select-colorfield__presets",
218
200
  role: "group",
219
201
  "aria-label": "Cores prontas",
220
202
  children: b.map((e) => {
221
- let t = d(e) ?? e, n = t === P;
222
- return /* @__PURE__ */ s("button", {
203
+ let t = i(e) ?? e, n = t === P;
204
+ return /* @__PURE__ */ u("button", {
223
205
  type: "button",
224
206
  className: `select-colorfield__preset${n ? " is-selected" : ""}`,
225
207
  style: { background: t },
@@ -231,9 +213,9 @@ function y({ label: i, help: u, hint: m, error: h, value: g, onChange: y, preset
231
213
  }, t);
232
214
  })
233
215
  }),
234
- S && P && /* @__PURE__ */ s("div", {
216
+ S && P && /* @__PURE__ */ u("div", {
235
217
  className: "select-colorfield__row",
236
- children: /* @__PURE__ */ s("button", {
218
+ children: /* @__PURE__ */ u("button", {
237
219
  type: "button",
238
220
  className: "select-colorfield__clear",
239
221
  onClick: () => {
@@ -244,12 +226,12 @@ function y({ label: i, help: u, hint: m, error: h, value: g, onChange: y, preset
244
226
  })
245
227
  ]
246
228
  })
247
- }), /* @__PURE__ */ s("input", {
229
+ }), /* @__PURE__ */ u("input", {
248
230
  id: D,
249
231
  className: "select-input select-input--mono select-colorfield__hex",
250
232
  value: A,
251
233
  onChange: (e) => {
252
- j(e.target.value), e.target.value.replace("#", "").length === 6 && d(e.target.value) && F(e.target.value);
234
+ j(e.target.value), e.target.value.replace("#", "").length === 6 && i(e.target.value) && F(e.target.value);
253
235
  },
254
236
  onBlur: () => F(A),
255
237
  placeholder: S ? "Padrão" : "#000000",
@@ -261,23 +243,23 @@ function y({ label: i, help: u, hint: m, error: h, value: g, onChange: y, preset
261
243
  "aria-describedby": z
262
244
  })]
263
245
  }),
264
- R ? /* @__PURE__ */ s("p", {
246
+ R ? /* @__PURE__ */ u("p", {
265
247
  id: `${D}-err`,
266
248
  className: "select-field__error",
267
249
  children: R
268
- }) : L == null ? m ? /* @__PURE__ */ s("p", {
250
+ }) : L == null ? m ? /* @__PURE__ */ u("p", {
269
251
  id: `${D}-hint`,
270
252
  className: "select-field__hint",
271
253
  children: m
272
- }) : null : /* @__PURE__ */ c("p", {
254
+ }) : null : /* @__PURE__ */ d("p", {
273
255
  id: `${D}-hint`,
274
256
  className: `select-field__hint select-colorfield__contrast${L < 4.5 ? " is-low" : ""}`,
275
- children: [L >= 4.5 ? `Contraste com ${w}: ${v(L)}:1 — legível.` : `Contraste com ${w}: ${v(L)}:1 — difícil de ler. Escolha uma cor ${f(P) < f(I) ? "mais escura" : "mais clara"}.`, m ? /* @__PURE__ */ c(o, { children: [" ", m] }) : null]
257
+ children: [L >= 4.5 ? `Contraste com ${w}: ${_(L)}:1 — legível.` : `Contraste com ${w}: ${_(L)}:1 — difícil de ler. Escolha uma cor ${r(P) < r(I) ? "mais escura" : "mais clara"}.`, m ? /* @__PURE__ */ d(l, { children: [" ", m] }) : null]
276
258
  })
277
259
  ]
278
260
  });
279
261
  }
280
262
  //#endregion
281
- export { l as SELECT_COLOR_PRESETS, y as SelectColorField, p as contrastRatio, h as hexToHsv, g as hsvToHex, d as normalizeHex };
263
+ export { f as SELECT_COLOR_PRESETS, v as SelectColorField, n as contrastRatio, m as hexToHsv, h as hsvToHex, i as normalizeHex };
282
264
 
283
265
  //# sourceMappingURL=SelectColorField.js.map
@@ -25,6 +25,11 @@ type SelectComboboxOwnProps = {
25
25
  disabled?: boolean;
26
26
  /** Accepted for API parity with SelectSelect; sets aria-required (no native form control). */
27
27
  required?: boolean;
28
+ /**
29
+ * 0.1.259: o "(opcional)" depois do rótulo, dentro dele, como nos outros campos do kit (o `SelectField`, o
30
+ * `SelectSelect`): o leitor de tela ouve "Equipe (opcional)". Sem `label`, ele entra no `ariaLabel`.
31
+ */
32
+ optional?: boolean;
28
33
  /** Control density. Default `md`; use `sm` in dense surfaces and modal/card forms. */
29
34
  size?: 'sm' | 'md';
30
35
  /** Show the in-list search box (default true). Set false for a plain styled picker — the
@@ -4,41 +4,41 @@ import { SelectInfoTip as r } from "./SelectInfoTip.js";
4
4
  import { moveInOptions as i, useOptionListFocus as a } from "./internal/optionList.js";
5
5
  import { useSelectReveal as o } from "./internal/useSelectReveal.js";
6
6
  import { SelectPopover as s } from "./SelectPopover.js";
7
- import { forwardRef as c, useId as l, useMemo as u, useRef as d, useState as f } from "react";
8
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
7
+ import { forwardRef as c, useId as l, useMemo as ee, useRef as u, useState as d } from "react";
8
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
9
9
  //#region src/SelectCombobox.tsx
10
- function h({ count: e, children: t }) {
10
+ function m({ count: e, children: t }) {
11
11
  let n = e > 0 ? Math.min(.03, .35 / e) : 0, r = o({
12
12
  selector: ".select-combobox__option",
13
13
  y: 6,
14
14
  duration: .3,
15
15
  stagger: n
16
16
  });
17
- return /* @__PURE__ */ p("div", {
17
+ return /* @__PURE__ */ f("div", {
18
18
  className: "select-combobox__list",
19
19
  ref: r,
20
20
  children: t
21
21
  });
22
22
  }
23
- var g = c(function({ label: o, value: c, onChange: g, options: _, placeholder: v, searchPlaceholder: y, labelAction: b, help: x, hint: S, error: C, emptyText: ee, disabled: w, required: T, size: E = "md", searchable: D = !0, allowCustom: O = !1, customLabel: k, minWidth: A, ariaLabel: j, className: M, style: N, ...P }, F) {
24
- let I = n(), L = v ?? I.common.selectPlaceholder, R = y ?? I.common.searchPlaceholder, z = ee ?? I.common.noResults, B = l(), [V, H] = f(!1), [U, W] = f(""), G = d(null);
23
+ var h = c(function({ label: o, value: c, onChange: h, options: g, placeholder: _, searchPlaceholder: v, labelAction: y, help: b, hint: x, error: S, emptyText: te, disabled: C, required: w, optional: T = !1, size: E = "md", searchable: D = !0, allowCustom: O = !1, customLabel: k, minWidth: A, ariaLabel: j, className: M, style: N, ...P }, F) {
24
+ let I = n(), L = _ ?? I.common.selectPlaceholder, R = v ?? I.common.searchPlaceholder, z = te ?? I.common.noResults, B = l(), [V, H] = d(!1), [U, W] = d(""), G = u(null);
25
25
  a(V, G);
26
- let K = _.find((e) => e.value === c), q = K ? K.label : O && c ? c : null, J = u(() => {
26
+ let K = g.find((e) => e.value === c), q = K ? K.label : O && c ? c : null, J = ee(() => {
27
27
  let e = U.trim().toLowerCase();
28
- return !D || !e ? _ : _.filter((t) => {
28
+ return !D || !e ? g : g.filter((t) => {
29
29
  var n;
30
30
  return t.label.toLowerCase().includes(e) || ((n = t.secondary) == null ? void 0 : n.toLowerCase().includes(e));
31
31
  });
32
32
  }, [
33
- _,
33
+ g,
34
34
  U,
35
35
  D
36
- ]), Y = U.trim(), X = Y ? _.find((e) => e.label.toLowerCase() === Y.toLowerCase()) : void 0, Z = O && D && Y !== "" && !X, Q = () => {
36
+ ]), Y = U.trim(), X = Y ? g.find((e) => e.label.toLowerCase() === Y.toLowerCase()) : void 0, Z = O && D && Y !== "" && !X, Q = () => {
37
37
  H(!1), W("");
38
38
  }, $ = (e) => {
39
- g(e), Q();
40
- }, te = C ? `${B}-err` : S ? `${B}-hint` : void 0;
41
- return /* @__PURE__ */ m("div", {
39
+ h(e), Q();
40
+ }, ne = S ? `${B}-err` : x ? `${B}-hint` : void 0;
41
+ return /* @__PURE__ */ p("div", {
42
42
  ref: F,
43
43
  ...P,
44
44
  style: A ? {
@@ -47,54 +47,57 @@ var g = c(function({ label: o, value: c, onChange: g, options: _, placeholder: v
47
47
  } : N,
48
48
  className: `select-field${E === "sm" ? " select-field--sm" : ""}${M ? " " + M : ""}`,
49
49
  children: [
50
- (o || x || b) && /* @__PURE__ */ m("div", {
50
+ (o || b || y) && /* @__PURE__ */ p("div", {
51
51
  className: "select-field__labelrow",
52
- children: [/* @__PURE__ */ m("span", {
52
+ children: [/* @__PURE__ */ p("span", {
53
53
  className: "select-field__labelwrap",
54
54
  children: [o && /* @__PURE__ */ p("label", {
55
55
  className: "select-field__label",
56
56
  htmlFor: B,
57
- children: o
58
- }), x != null && x !== "" && /* @__PURE__ */ p(r, { content: x })]
59
- }), b]
57
+ children: [o, T && /* @__PURE__ */ p("span", {
58
+ className: "select-field__optional",
59
+ children: [" ", I.common.optional]
60
+ })]
61
+ }), b != null && b !== "" && /* @__PURE__ */ f(r, { content: b })]
62
+ }), y]
60
63
  }),
61
- /* @__PURE__ */ p("div", {
64
+ /* @__PURE__ */ f("div", {
62
65
  className: "select-combobox",
63
- children: /* @__PURE__ */ p(s, {
66
+ children: /* @__PURE__ */ f(s, {
64
67
  active: V,
65
68
  onClose: Q,
66
69
  placement: "bottom-start",
67
70
  role: "listbox",
68
71
  matchWidth: !0,
69
- activator: /* @__PURE__ */ m("button", {
72
+ activator: /* @__PURE__ */ p("button", {
70
73
  id: B,
71
74
  type: "button",
72
- className: `select-combobox__trigger${C ? " select-input--error" : ""}${V ? " is-open" : ""}`,
75
+ className: `select-combobox__trigger${S ? " select-input--error" : ""}${V ? " is-open" : ""}`,
73
76
  onClick: () => V ? Q() : H(!0),
74
- disabled: w,
77
+ disabled: C,
75
78
  "aria-haspopup": "listbox",
76
- "aria-label": o ? void 0 : j,
79
+ "aria-label": o ? void 0 : j && T ? `${j} ${I.common.optional}` : j,
77
80
  "data-value": c,
78
81
  "aria-expanded": V,
79
- "aria-required": T || void 0,
80
- "aria-describedby": te,
81
- "aria-invalid": C ? !0 : void 0,
82
- children: [/* @__PURE__ */ p("span", {
82
+ "aria-required": w || void 0,
83
+ "aria-describedby": ne,
84
+ "aria-invalid": S ? !0 : void 0,
85
+ children: [/* @__PURE__ */ f("span", {
83
86
  className: `select-combobox__value${q == null ? " is-placeholder" : ""}`,
84
87
  children: q ?? L
85
- }), /* @__PURE__ */ p("span", {
88
+ }), /* @__PURE__ */ f("span", {
86
89
  className: "select-combobox__caret",
87
90
  "aria-hidden": "true",
88
- children: /* @__PURE__ */ p(t, {})
91
+ children: /* @__PURE__ */ f(t, {})
89
92
  })]
90
93
  }),
91
- children: /* @__PURE__ */ m("div", {
94
+ children: /* @__PURE__ */ p("div", {
92
95
  className: "select-combobox__panel",
93
96
  ref: G,
94
97
  onKeyDown: i,
95
- children: [D && /* @__PURE__ */ p("div", {
98
+ children: [D && /* @__PURE__ */ f("div", {
96
99
  className: "select-combobox__search",
97
- children: /* @__PURE__ */ p("input", {
100
+ children: /* @__PURE__ */ f("input", {
98
101
  className: "select-combobox__searchinput",
99
102
  type: "text",
100
103
  value: U,
@@ -104,27 +107,27 @@ var g = c(function({ label: o, value: c, onChange: g, options: _, placeholder: v
104
107
  },
105
108
  placeholder: R
106
109
  })
107
- }), /* @__PURE__ */ m(h, {
110
+ }), /* @__PURE__ */ p(m, {
108
111
  count: J.length + +!!Z,
109
- children: [Z && /* @__PURE__ */ p("button", {
112
+ children: [Z && /* @__PURE__ */ f("button", {
110
113
  type: "button",
111
114
  role: "option",
112
115
  "aria-selected": !1,
113
116
  className: "select-combobox__option select-combobox__option--custom",
114
117
  onClick: () => $(Y),
115
- children: /* @__PURE__ */ p("span", {
118
+ children: /* @__PURE__ */ f("span", {
116
119
  className: "select-combobox__optiontext",
117
- children: /* @__PURE__ */ p("span", {
120
+ children: /* @__PURE__ */ f("span", {
118
121
  className: "select-combobox__optionlabel",
119
122
  children: k ? k(Y) : `Usar “${Y}”`
120
123
  })
121
124
  })
122
- }), J.length === 0 ? Z ? null : /* @__PURE__ */ p("div", {
125
+ }), J.length === 0 ? Z ? null : /* @__PURE__ */ f("div", {
123
126
  className: "select-combobox__empty",
124
127
  children: z
125
128
  }) : J.map((t) => {
126
129
  let n = t.value === c;
127
- return /* @__PURE__ */ m("button", {
130
+ return /* @__PURE__ */ p("button", {
128
131
  type: "button",
129
132
  role: "option",
130
133
  "aria-selected": n,
@@ -132,19 +135,19 @@ var g = c(function({ label: o, value: c, onChange: g, options: _, placeholder: v
132
135
  disabled: t.disabled,
133
136
  className: `select-combobox__option${n ? " is-selected" : ""}`,
134
137
  onClick: () => $(t.value),
135
- children: [/* @__PURE__ */ m("span", {
138
+ children: [/* @__PURE__ */ p("span", {
136
139
  className: "select-combobox__optiontext",
137
- children: [/* @__PURE__ */ p("span", {
140
+ children: [/* @__PURE__ */ f("span", {
138
141
  className: "select-combobox__optionlabel",
139
142
  children: t.label
140
- }), t.secondary && /* @__PURE__ */ p("span", {
143
+ }), t.secondary && /* @__PURE__ */ f("span", {
141
144
  className: "select-combobox__optionsecondary",
142
145
  children: t.secondary
143
146
  })]
144
- }), n && /* @__PURE__ */ p("span", {
147
+ }), n && /* @__PURE__ */ f("span", {
145
148
  className: "select-combobox__check",
146
149
  "aria-hidden": "true",
147
- children: /* @__PURE__ */ p(e, {})
150
+ children: /* @__PURE__ */ f(e, {})
148
151
  })]
149
152
  }, t.value);
150
153
  })]
@@ -152,19 +155,19 @@ var g = c(function({ label: o, value: c, onChange: g, options: _, placeholder: v
152
155
  })
153
156
  })
154
157
  }),
155
- C ? /* @__PURE__ */ p("p", {
158
+ S ? /* @__PURE__ */ f("p", {
156
159
  id: `${B}-err`,
157
160
  className: "select-field__error",
158
- children: C
159
- }) : S ? /* @__PURE__ */ p("p", {
161
+ children: S
162
+ }) : x ? /* @__PURE__ */ f("p", {
160
163
  id: `${B}-hint`,
161
164
  className: "select-field__hint",
162
- children: S
165
+ children: x
163
166
  }) : null
164
167
  ]
165
168
  });
166
169
  });
167
170
  //#endregion
168
- export { g as SelectCombobox };
171
+ export { h as SelectCombobox };
169
172
 
170
173
  //# sourceMappingURL=SelectCombobox.js.map
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { SelectTableRowTone } from './SelectTable';
2
3
  import { SelectListPagination } from './internal/listChrome';
3
4
  import { SelectHeadingLevel } from './internal/headingLevel';
4
5
  /**
@@ -14,6 +15,12 @@ import { SelectHeadingLevel } from './internal/headingLevel';
14
15
  * that renders `formatDateTime`.
15
16
  */
16
17
  export declare const SELECT_COL_DATETIME = "9.5rem";
18
+ /**
19
+ * 0.1.259 (a fase 3 do CRM, o P37: "há 30 minuto" cortado em 800): a largura FIXA de uma coluna de hora RELATIVA ("há 59
20
+ * minutos", "59 minutes ago", "ontem, 14:20"), com o respiro da célula — o mesmo porquê da `SELECT_COL_DATETIME` (uma
21
+ * medida pelo conteúdo desalinharia o cabeçalho e as linhas). Passe como o `width` da coluna.
22
+ */
23
+ export declare const SELECT_COL_TIMEAGO = "8.5rem";
17
24
  /**
18
25
  * Coluna de ID — espalhe com `...SELECT_COL_ID` na definição da coluna.
19
26
  *
@@ -68,7 +75,7 @@ export interface SelectDataColumn<T> {
68
75
  * guards mirror SelectMoney — storage unavailable = in-memory only.
69
76
  */
70
77
  export declare function useSelectPageSize(key: string, fallback: number, options?: number[]): [number, (size: number) => void];
71
- export declare function SelectDataTable<T>({ columns, items, getId, loading, empty, pagination, onRowClick, title, headingLevel, help, description, action, filters, columnsKey, getChildren, defaultExpanded, compactRow, compactQuery, onCompactRowClick, listRow, footer, flush, }: {
78
+ export declare function SelectDataTable<T>({ columns, items, getId, loading, empty, pagination, onRowClick, title, headingLevel, help, description, action, filters, columnsKey, getChildren, defaultExpanded, compactRow, compactQuery, onCompactRowClick, rowTone, listRow, footer, flush, }: {
72
79
  /** As colunas da grade. Dispensável com `listRow` (a lista não tem colunas). */
73
80
  columns?: SelectDataColumn<T>[];
74
81
  items: T[];
@@ -137,6 +144,15 @@ export declare function SelectDataTable<T>({ columns, items, getId, loading, emp
137
144
  compactQuery?: string;
138
145
  /** Clique na linha COMPACTA (padrão: `onRowClick`) — para quando só a compacta é clicável. */
139
146
  onCompactRowClick?: (item: T) => void;
147
+ /**
148
+ * 0.1.259: o tom de cada linha (o chamado vencido): a borda da esquerda no tom e o `label` ("Vencido") para o leitor
149
+ * de tela, no começo da primeira célula. A cor não diz sozinha: o estado à vista vai numa coluna (o ícone e o texto).
150
+ * Sem tom (`null`), a linha de sempre.
151
+ */
152
+ rowTone?: (item: T) => {
153
+ tone: SelectTableRowTone;
154
+ label?: string;
155
+ } | null | undefined;
140
156
  /**
141
157
  * Lista de LINHAS RICAS em toda largura (0.1.141): cada item é o bloco que esta função desenhar (o comentário com
142
158
  * as ações embaixo), na MESMA casca — título, faixa de filtros, paginação —, sem cabeçalho de colunas. Dispensa