@selectwin/kit 0.1.258 → 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 (40) hide show
  1. package/README.md +31 -0
  2. package/dist/SelectActionBar.d.ts +29 -0
  3. package/dist/SelectActionBar.js +101 -0
  4. package/dist/SelectBadge.d.ts +9 -0
  5. package/dist/SelectBadge.js +26 -12
  6. package/dist/SelectBulkBar.d.ts +21 -0
  7. package/dist/SelectBulkBar.js +40 -0
  8. package/dist/SelectChannelPreview.d.ts +21 -1
  9. package/dist/SelectChannelPreview.js +100 -73
  10. package/dist/SelectColorField.d.ts +1 -5
  11. package/dist/SelectColorField.js +83 -101
  12. package/dist/SelectCombobox.d.ts +5 -0
  13. package/dist/SelectCombobox.js +52 -49
  14. package/dist/SelectDataTable.d.ts +17 -1
  15. package/dist/SelectDataTable.js +100 -90
  16. package/dist/SelectDeadlineBadge.d.ts +32 -0
  17. package/dist/SelectDeadlineBadge.js +73 -0
  18. package/dist/SelectFilterBar.js +5 -5
  19. package/dist/SelectListCard.d.ts +27 -1
  20. package/dist/SelectListCard.js +47 -22
  21. package/dist/SelectLocale.d.ts +62 -0
  22. package/dist/SelectLocale.js +173 -0
  23. package/dist/SelectMail.d.ts +9 -1
  24. package/dist/SelectMail.js +234 -207
  25. package/dist/SelectSection.d.ts +4 -4
  26. package/dist/SelectSection.js +77 -8
  27. package/dist/SelectTable.d.ts +13 -1
  28. package/dist/SelectTable.js +88 -79
  29. package/dist/SelectTabs.d.ts +10 -0
  30. package/dist/SelectTabs.js +68 -30
  31. package/dist/SelectWeekHours.d.ts +64 -0
  32. package/dist/SelectWeekHours.js +338 -0
  33. package/dist/index.d.ts +12 -2
  34. package/dist/index.js +188 -183
  35. package/dist/internal/color.d.ts +15 -0
  36. package/dist/internal/color.js +40 -0
  37. package/dist/internal/safeHref.d.ts +7 -0
  38. package/dist/internal/safeHref.js +12 -1
  39. package/dist/style.css +1 -1
  40. package/package.json +1 -1
@@ -9,17 +9,17 @@ import { SelectTable as ie, SelectTableCell as o, SelectTableRow as s } from "./
9
9
  import { useMemo as c, useState as l } from "react";
10
10
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
11
11
  //#region src/SelectDataTable.tsx
12
- var f = "9.5rem", p = {
12
+ var f = "9.5rem", p = "8.5rem", m = {
13
13
  minWidth: "9.5rem",
14
14
  grow: 2
15
15
  };
16
- function m(e) {
16
+ function h(e) {
17
17
  return [e.wrap ? "select-table__td--wrap" : "", e.tone ? `select-table__td--${e.tone}` : ""].filter(Boolean).join(" ") || void 0;
18
18
  }
19
- var h = "select-datatable:hidden-cols:";
19
+ var g = "select-datatable:hidden-cols:";
20
20
  function ae(e) {
21
21
  try {
22
- let t = localStorage.getItem(h + e), n = t ? JSON.parse(t) : null;
22
+ let t = localStorage.getItem(g + e), n = t ? JSON.parse(t) : null;
23
23
  return Array.isArray(n) ? n.filter((e) => typeof e == "string") : [];
24
24
  } catch {
25
25
  return [];
@@ -27,16 +27,16 @@ function ae(e) {
27
27
  }
28
28
  function oe(e, t) {
29
29
  try {
30
- t.length === 0 ? localStorage.removeItem(h + e) : localStorage.setItem(h + e, JSON.stringify(t));
30
+ t.length === 0 ? localStorage.removeItem(g + e) : localStorage.setItem(g + e, JSON.stringify(t));
31
31
  } catch {}
32
32
  }
33
- function g(e) {
33
+ function _(e) {
34
34
  return e.hideable ?? !!e.title;
35
35
  }
36
- var _ = "select-datatable:col-widths:";
36
+ var v = "select-datatable:col-widths:";
37
37
  function se(e) {
38
38
  try {
39
- let t = localStorage.getItem(_ + e), n = t ? JSON.parse(t) : null;
39
+ let t = localStorage.getItem(v + e), n = t ? JSON.parse(t) : null;
40
40
  if (!n || typeof n != "object" || Array.isArray(n)) return {};
41
41
  let r = {};
42
42
  for (let [e, t] of Object.entries(n)) typeof t == "string" && t && (r[e] = t);
@@ -45,16 +45,16 @@ function se(e) {
45
45
  return {};
46
46
  }
47
47
  }
48
- function v(e, t) {
48
+ function y(e, t) {
49
49
  try {
50
- Object.keys(t).length === 0 ? localStorage.removeItem(_ + e) : localStorage.setItem(_ + e, JSON.stringify(t));
50
+ Object.keys(t).length === 0 ? localStorage.removeItem(v + e) : localStorage.setItem(v + e, JSON.stringify(t));
51
51
  } catch {}
52
52
  }
53
- var y = "select-datatable:page-size:";
54
- function b(e, t, n) {
53
+ var b = "select-datatable:page-size:";
54
+ function x(e, t, n) {
55
55
  let [r, i] = l(() => {
56
56
  try {
57
- let r = Number(localStorage.getItem(y + e));
57
+ let r = Number(localStorage.getItem(b + e));
58
58
  return Number.isInteger(r) && r > 0 && (!n || n.includes(r)) ? r : t;
59
59
  } catch {
60
60
  return t;
@@ -63,7 +63,7 @@ function b(e, t, n) {
63
63
  return [r, (t) => {
64
64
  i(t);
65
65
  try {
66
- localStorage.setItem(y + e, String(t));
66
+ localStorage.setItem(b + e, String(t));
67
67
  } catch {}
68
68
  }];
69
69
  }
@@ -74,17 +74,17 @@ function ce(e, t, n, r = "pt-BR") {
74
74
  sensitivity: "base"
75
75
  });
76
76
  }
77
- function x({ columns: f = [], items: p, getId: h, loading: _ = !1, empty: y, pagination: b, onRowClick: x, title: le, headingLevel: ue, help: S, description: C, action: w, filters: de, columnsKey: T, getChildren: E, defaultExpanded: D, compactRow: O, compactQuery: fe = "(max-width: 40rem)", onCompactRowClick: k, listRow: A, footer: pe, flush: j = !1 }) {
78
- let [M, me] = l(() => T ? ae(T) : []), [N, P] = l(!1), F = i().dataTable, I = n(r()), L = a(O && !A ? fe : void 0) && O != null, R = A != null || L, z = A ?? O, he = A != null || f.some((e) => e.wrap), [B, V] = l(() => T ? se(T) : {}), H = c(() => new Set(M), [M]), U = f.filter(g), ge = U.length > 0 && U.every((e) => H.has(e.key)), W = (e) => !ge && H.has(e.key) && g(e), G = f.filter((e) => !W(e)), _e = U.filter((e) => !W(e)), [K, q] = l(null), [ve, ye] = l(() => /* @__PURE__ */ new Set()), be = (e) => ((D == null ? void 0 : D(e)) ?? !1) !== ve.has(h(e)), xe = (e) => ye((t) => {
79
- let n = new Set(t), r = h(e);
77
+ function S({ columns: f = [], items: p, getId: m, loading: g = !1, empty: v, pagination: b, onRowClick: x, title: S, headingLevel: le, help: ue, description: de, action: fe, filters: pe, columnsKey: C, getChildren: w, defaultExpanded: T, compactRow: E, compactQuery: me = "(max-width: 40rem)", onCompactRowClick: D, rowTone: O, listRow: k, footer: he, flush: A = !1 }) {
78
+ let [j, ge] = l(() => C ? ae(C) : []), [M, N] = l(!1), P = i().dataTable, F = n(r()), I = a(E && !k ? me : void 0) && E != null, L = k != null || I, R = k ?? E, _e = k != null || f.some((e) => e.wrap), [z, B] = l(() => C ? se(C) : {}), V = c(() => new Set(j), [j]), H = f.filter(_), ve = H.length > 0 && H.every((e) => V.has(e.key)), U = (e) => !ve && V.has(e.key) && _(e), W = f.filter((e) => !U(e)), ye = H.filter((e) => !U(e)), [G, K] = l(null), [be, q] = l(() => /* @__PURE__ */ new Set()), xe = (e) => ((T == null ? void 0 : T(e)) ?? !1) !== be.has(m(e)), Se = (e) => q((t) => {
79
+ let n = new Set(t), r = m(e);
80
80
  return n.delete(r) || n.add(r), n;
81
- }), Se = (e) => {
82
- me((t) => {
81
+ }), Ce = (e) => {
82
+ ge((t) => {
83
83
  let n = !t.includes(e.key), r = n ? [...t, e.key] : t.filter((t) => t !== e.key);
84
- return T && oe(T, r), n && q((t) => t && t.key === e.key ? null : t), r;
84
+ return C && oe(C, r), n && K((t) => t && t.key === e.key ? null : t), r;
85
85
  });
86
- }, Ce = (e) => {
87
- q((t) => {
86
+ }, we = (e) => {
87
+ K((t) => {
88
88
  let n = e.sortDefault ?? "asc";
89
89
  return !t || t.key !== e.key ? {
90
90
  key: e.key,
@@ -94,69 +94,75 @@ function x({ columns: f = [], items: p, getId: h, loading: _ = !1, empty: y, pag
94
94
  dir: n === "asc" ? "desc" : "asc"
95
95
  } : null;
96
96
  });
97
- }, J = K ? f.find((e) => e.key === K.key) : void 0, Y = c(() => {
97
+ }, J = G ? f.find((e) => e.key === G.key) : void 0, Y = c(() => {
98
98
  let e = J == null ? void 0 : J.sortValue;
99
- if (!K || !e) return (e) => e;
100
- let t = K.dir === "asc" ? 1 : -1;
101
- return (n) => [...n].sort((n, r) => ce(e(n), e(r), t, I));
99
+ if (!G || !e) return (e) => e;
100
+ let t = G.dir === "asc" ? 1 : -1;
101
+ return (n) => [...n].sort((n, r) => ce(e(n), e(r), t, F));
102
102
  }, [
103
- K,
103
+ G,
104
104
  J,
105
- I
106
- ]), X = c(() => Y(p), [p, Y]), Z = (e) => (E == null ? void 0 : E(e)) ?? [], we = !!E && p.some((e) => Z(e).length > 0), Q = R ? [{
105
+ F
106
+ ]), X = c(() => Y(p), [p, Y]), Z = (e) => {
107
+ let t = O == null ? void 0 : O(e);
108
+ return t ? {
109
+ tone: t.tone,
110
+ ...t.label ? { toneLabel: t.label } : {}
111
+ } : {};
112
+ }, Q = (e) => (w == null ? void 0 : w(e)) ?? [], Te = !!w && p.some((e) => Q(e).length > 0), Ee = L ? [{
107
113
  label: "",
108
114
  grow: 1
109
- }] : G.map((e) => ({
115
+ }] : W.map((e) => ({
110
116
  label: e.title,
111
117
  align: e.align,
112
- width: B[e.key] ?? e.width,
118
+ width: z[e.key] ?? e.width,
113
119
  minWidth: e.minWidth,
114
120
  grow: e.grow,
115
121
  sortable: !!e.sortValue,
116
- sortDir: (K == null ? void 0 : K.key) === e.key ? K.dir : null,
117
- onSort: e.sortValue ? () => Ce(e) : void 0,
122
+ sortDir: (G == null ? void 0 : G.key) === e.key ? G.dir : null,
123
+ onSort: e.sortValue ? () => we(e) : void 0,
118
124
  resizable: !!e.title,
119
125
  tone: e.tone
120
126
  })), $ = (e, t) => {
121
- let n = G[e];
122
- n && V((e) => {
127
+ let n = W[e];
128
+ n && B((e) => {
123
129
  let r = { ...e };
124
- return t ? r[n.key] = t : delete r[n.key], T && v(T, r), r;
130
+ return t ? r[n.key] = t : delete r[n.key], C && y(C, r), r;
125
131
  });
126
- }, Te = () => {
127
- V({}), T && v(T, {});
128
- }, Ee = Object.keys(B).length > 0, De = !_ && y ? /* @__PURE__ */ u(re, {
129
- icon: y.icon,
130
- title: y.heading,
131
- subtitle: y.text,
132
- action: y.action
133
- }) : void 0, Oe = T && U.length > 0 ? /* @__PURE__ */ u(ee, {
134
- active: N,
135
- onClose: () => P(!1),
132
+ }, De = () => {
133
+ B({}), C && y(C, {});
134
+ }, Oe = Object.keys(z).length > 0, ke = !g && v ? /* @__PURE__ */ u(re, {
135
+ icon: v.icon,
136
+ title: v.heading,
137
+ subtitle: v.text,
138
+ action: v.action
139
+ }) : void 0, Ae = C && H.length > 0 ? /* @__PURE__ */ u(ee, {
140
+ active: M,
141
+ onClose: () => N(!1),
136
142
  placement: "bottom-end",
137
143
  role: "menu",
138
144
  activator: /* @__PURE__ */ u(te, {
139
145
  icon: /* @__PURE__ */ u(t, {}),
140
- label: F.columns,
146
+ label: P.columns,
141
147
  size: "sm",
142
- active: N,
143
- "aria-expanded": N,
144
- onClick: () => P((e) => !e)
148
+ active: M,
149
+ "aria-expanded": M,
150
+ onClick: () => N((e) => !e)
145
151
  }),
146
152
  children: /* @__PURE__ */ d("div", {
147
153
  className: "select-facet__panel",
148
154
  children: [/* @__PURE__ */ u("div", {
149
155
  className: "select-facet__options",
150
156
  role: "menu",
151
- children: U.map((t) => {
152
- let n = !W(t), r = n && _e.length === 1;
157
+ children: H.map((t) => {
158
+ let n = !U(t), r = n && ye.length === 1;
153
159
  return /* @__PURE__ */ d("button", {
154
160
  type: "button",
155
161
  role: "menuitemcheckbox",
156
162
  "aria-checked": n,
157
163
  disabled: r,
158
164
  className: "select-facet__opt",
159
- onClick: () => Se(t),
165
+ onClick: () => Ce(t),
160
166
  children: [/* @__PURE__ */ u("span", { children: t.title }), n && /* @__PURE__ */ u("span", {
161
167
  className: "select-facet__check",
162
168
  "aria-hidden": "true",
@@ -164,7 +170,7 @@ function x({ columns: f = [], items: p, getId: h, loading: _ = !1, empty: y, pag
164
170
  })]
165
171
  }, t.key);
166
172
  })
167
- }), Ee && /* @__PURE__ */ u("div", {
173
+ }), Oe && /* @__PURE__ */ u("div", {
168
174
  className: "select-facet__options select-facet__options--footer",
169
175
  role: "menu",
170
176
  children: /* @__PURE__ */ u("button", {
@@ -172,78 +178,82 @@ function x({ columns: f = [], items: p, getId: h, loading: _ = !1, empty: y, pag
172
178
  role: "menuitem",
173
179
  className: "select-facet__opt",
174
180
  onClick: () => {
175
- Te(), P(!1);
181
+ De(), N(!1);
176
182
  },
177
- children: /* @__PURE__ */ u("span", { children: F.resetWidths })
183
+ children: /* @__PURE__ */ u("span", { children: P.resetWidths })
178
184
  })
179
185
  })]
180
186
  })
181
187
  }) : null;
182
188
  return /* @__PURE__ */ d("div", {
183
- className: `select-datatable${j ? " select-datatable--flush" : ""}`,
189
+ className: `select-datatable${A ? " select-datatable--flush" : ""}`,
184
190
  children: [/* @__PURE__ */ u(ie, {
185
- columns: Q,
186
- empty: De,
187
- footer: pe,
188
- title: le,
189
- headingLevel: ue,
190
- help: S,
191
- description: C,
192
- filters: de,
193
- action: w,
194
- tools: R ? null : Oe,
195
- className: R ? "select-table--compact" : void 0,
196
- flush: j,
197
- onColumnResize: R ? void 0 : (e, t) => $(e, t),
198
- onColumnResizeReset: R ? void 0 : (e) => $(e, null),
199
- children: R && z ? _ ? Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ u(s, { children: /* @__PURE__ */ u(o, { children: /* @__PURE__ */ u("span", { className: "select-skeleton select-datatable__skel" }) }) }, `skeleton-${t}`)) : X.map((e) => /* @__PURE__ */ u(s, {
200
- onClick: k ?? x ? () => (k ?? x)(e) : void 0,
191
+ columns: Ee,
192
+ empty: ke,
193
+ footer: he,
194
+ title: S,
195
+ headingLevel: le,
196
+ help: ue,
197
+ description: de,
198
+ filters: pe,
199
+ action: fe,
200
+ tools: L ? null : Ae,
201
+ className: L ? "select-table--compact" : void 0,
202
+ flush: A,
203
+ onColumnResize: L ? void 0 : (e, t) => $(e, t),
204
+ onColumnResizeReset: L ? void 0 : (e) => $(e, null),
205
+ children: L && R ? g ? Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ u(s, { children: /* @__PURE__ */ u(o, { children: /* @__PURE__ */ u("span", { className: "select-skeleton select-datatable__skel" }) }) }, `skeleton-${t}`)) : X.map((e) => /* @__PURE__ */ u(s, {
206
+ ...Z(e),
207
+ onClick: D ?? x ? () => (D ?? x)(e) : void 0,
201
208
  children: /* @__PURE__ */ u(o, {
202
- className: he ? "select-table__td--wrap" : void 0,
203
- children: z(e)
209
+ className: _e ? "select-table__td--wrap" : void 0,
210
+ children: R(e)
204
211
  })
205
- }, h(e))) : _ ? Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ u(s, { children: G.map((e, t) => /* @__PURE__ */ u(o, {
212
+ }, m(e))) : g ? Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ u(s, { children: W.map((e, t) => /* @__PURE__ */ u(o, {
206
213
  align: e.align,
207
214
  width: e.width,
208
215
  children: /* @__PURE__ */ u("span", { className: "select-skeleton select-datatable__skel" })
209
216
  }, t)) }, `skeleton-${t}`)) : X.flatMap((e) => {
210
- let t = Z(e);
217
+ let t = Q(e);
211
218
  if (t.length === 0) return [/* @__PURE__ */ u(s, {
219
+ ...Z(e),
212
220
  onClick: x ? () => x(e) : void 0,
213
- children: G.map((t, n) => /* @__PURE__ */ u(o, {
221
+ children: W.map((t, n) => /* @__PURE__ */ u(o, {
214
222
  align: t.align,
215
223
  width: t.width,
216
- className: m(t),
217
- disclosure: we && n === 0 ? "none" : void 0,
224
+ className: h(t),
225
+ disclosure: Te && n === 0 ? "none" : void 0,
218
226
  children: t.render(e)
219
227
  }, n))
220
- }, h(e))];
221
- let n = be(e);
228
+ }, m(e))];
229
+ let n = xe(e);
222
230
  return [/* @__PURE__ */ u(s, {
223
- onClick: () => xe(e),
231
+ ...Z(e),
232
+ onClick: () => Se(e),
224
233
  expanded: n,
225
- children: G.map((t, r) => /* @__PURE__ */ u(o, {
234
+ children: W.map((t, r) => /* @__PURE__ */ u(o, {
226
235
  align: t.align,
227
236
  width: t.width,
228
- className: m(t),
237
+ className: h(t),
229
238
  disclosure: r === 0 ? n ? "open" : "closed" : void 0,
230
239
  children: t.render(e)
231
240
  }, r))
232
- }, h(e)), ...n ? Y(t).map((t) => /* @__PURE__ */ u(s, {
241
+ }, m(e)), ...n ? Y(t).map((t) => /* @__PURE__ */ u(s, {
242
+ ...Z(t),
233
243
  nested: !0,
234
244
  onClick: x ? () => x(t) : void 0,
235
- children: G.map((e, n) => /* @__PURE__ */ u(o, {
245
+ children: W.map((e, n) => /* @__PURE__ */ u(o, {
236
246
  align: e.align,
237
247
  width: e.width,
238
- className: m(e),
248
+ className: h(e),
239
249
  children: e.render(t)
240
250
  }, n))
241
- }, `${h(e)}/${h(t)}`)) : []];
251
+ }, `${m(e)}/${m(t)}`)) : []];
242
252
  })
243
253
  }), b && /* @__PURE__ */ u(ne, { pagination: b })]
244
254
  });
245
255
  }
246
256
  //#endregion
247
- export { f as SELECT_COL_DATETIME, p as SELECT_COL_ID, x as SelectDataTable, b as useSelectPageSize };
257
+ export { f as SELECT_COL_DATETIME, m as SELECT_COL_ID, p as SELECT_COL_TIMEAGO, S as SelectDataTable, x as useSelectPageSize };
248
258
 
249
259
  //# sourceMappingURL=SelectDataTable.js.map
@@ -0,0 +1,32 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ import { SelectLocaleCode } from './SelectLocale';
3
+ /** O estado do prazo: correndo no prazo, perto de vencer (os 25% finais), vencido, cumprido ou parado. */
4
+ export type SelectDeadlineState = 'running' | 'near' | 'overdue' | 'met' | 'paused';
5
+ /**
6
+ * A duração como a língua escreve, em `min`, `h` (até 10 h com os minutos: "1 h 30 min") e, fora das horas úteis, em
7
+ * dias a partir de 48 h ("3 dias"); nas horas úteis, só horas e minutos ("50 h úteis": o dia útil é do calendário de
8
+ * quem conta). PURA.
9
+ */
10
+ export declare function selectDurationText(minutes: number, business?: boolean, locale?: SelectLocaleCode): string;
11
+ /** O texto à vista do prazo ("Faltam 17 h úteis", "Vencido há 2 h", "Cumprido em 6 min", "Pausado"). PURA. */
12
+ export declare function selectDeadlineText(state: SelectDeadlineState, minutes?: number | null, business?: boolean, locale?: SelectLocaleCode): string;
13
+ type SelectDeadlineBadgeOwnProps = {
14
+ state: SelectDeadlineState;
15
+ /**
16
+ * Os minutos: os que faltam (no prazo e perto), há quanto venceu (vencido), em quanto foi cumprido (cumprido), há
17
+ * quanto parou (pausado). Sem eles, só o estado ("No prazo", "Vencido").
18
+ */
19
+ minutes?: number | null;
20
+ /** Os minutos são de horas úteis ("Faltam 17 h úteis"). */
21
+ business?: boolean;
22
+ /** O nome do prazo para o leitor de tela ("1ª resposta"), antes do texto. */
23
+ label?: string;
24
+ /** O texto à vista no lugar do que o kit escreve (o app que já tem a frase: "vence hoje, 14:08"). */
25
+ text?: string;
26
+ /** `badge` (o padrão): a pílula no tom; `text`: o ícone e o texto no tom, sem a pílula (a célula da tabela). */
27
+ variant?: 'badge' | 'text';
28
+ size?: 'md' | 'sm';
29
+ };
30
+ export type SelectDeadlineBadgeProps = SelectDeadlineBadgeOwnProps & Omit<ComponentPropsWithoutRef<'span'>, keyof SelectDeadlineBadgeOwnProps | 'children'>;
31
+ export declare const SelectDeadlineBadge: import('react').ForwardRefExoticComponent<SelectDeadlineBadgeOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref">, "children" | keyof SelectDeadlineBadgeOwnProps> & import('react').RefAttributes<HTMLSpanElement>>;
32
+ export {};
@@ -0,0 +1,73 @@
1
+ import { CheckIcon as e, ClockIcon as t, PauseIcon as n, WarningIcon as r } from "./icons.js";
2
+ import { selectKitMessages as i, useSelectLocale as a, useSelectMessages as o } from "./SelectLocale.js";
3
+ import { SelectBadge as s } from "./SelectBadge.js";
4
+ import { forwardRef as c } from "react";
5
+ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
6
+ //#region src/SelectDeadlineBadge.tsx
7
+ var f = {
8
+ running: "neutral",
9
+ near: "warning",
10
+ overdue: "critical",
11
+ met: "success",
12
+ paused: "outline"
13
+ };
14
+ function p(e, t = !1, n = "pt-BR") {
15
+ let r = i[n].deadline, a = Math.max(0, Math.round(e));
16
+ if (!t && a >= 2880) return r.days(Math.floor(a / 1440));
17
+ if (a < 60) return r.duration(0, a, t);
18
+ let o = Math.floor(a / 60), s = o < 10 ? a % 60 : 0;
19
+ return r.duration(o, s, t);
20
+ }
21
+ function m(e, t, n = !1, r = "pt-BR") {
22
+ let a = i[r].deadline;
23
+ if (t == null || !Number.isFinite(t)) return a.bare[e];
24
+ let o = Math.max(0, Math.round(t)), s = p(o, n, r), c = o === 1 || o === 60;
25
+ switch (e) {
26
+ case "running":
27
+ case "near": return a.left(s, c);
28
+ case "overdue": return a.overdue(s);
29
+ case "met": return a.met(s);
30
+ case "paused": return a.paused(s);
31
+ }
32
+ }
33
+ function h({ state: i }) {
34
+ return u(i === "overdue" ? r : i === "met" ? e : i === "paused" ? n : t, {});
35
+ }
36
+ var g = c(function({ state: e, minutes: t, business: n = !1, label: r, text: i, variant: c = "badge", size: p = "md", className: g, ..._ }, v) {
37
+ let y = a(), b = o().deadline, x = i ?? m(e, t, n, y), S = e === "running" || e === "near" ? b.state[e] : null, C = /* @__PURE__ */ d(l, { children: [
38
+ r ? /* @__PURE__ */ u("span", {
39
+ className: "select-visually-hidden",
40
+ children: `${r}: `
41
+ }) : null,
42
+ x,
43
+ S ? /* @__PURE__ */ u("span", {
44
+ className: "select-visually-hidden",
45
+ children: `, ${S}`
46
+ }) : null
47
+ ] }), w = `select-deadline select-deadline--${e}${g ? " " + g : ""}`;
48
+ return c === "text" ? /* @__PURE__ */ d("span", {
49
+ ref: v,
50
+ ..._,
51
+ className: `${w} select-deadline--text${p === "sm" ? " select-deadline--sm" : ""}`,
52
+ children: [/* @__PURE__ */ u("span", {
53
+ className: "select-deadline__icon",
54
+ "aria-hidden": "true",
55
+ children: /* @__PURE__ */ u(h, { state: e })
56
+ }), /* @__PURE__ */ u("span", {
57
+ className: "select-deadline__label",
58
+ children: C
59
+ })]
60
+ }) : /* @__PURE__ */ u(s, {
61
+ ref: v,
62
+ ..._,
63
+ tone: f[e],
64
+ size: p,
65
+ icon: /* @__PURE__ */ u(h, { state: e }),
66
+ className: w,
67
+ children: C
68
+ });
69
+ });
70
+ //#endregion
71
+ export { g as SelectDeadlineBadge, m as selectDeadlineText, p as selectDurationText };
72
+
73
+ //# sourceMappingURL=SelectDeadlineBadge.js.map
@@ -3,8 +3,8 @@ import { useSelectMessages as a } from "./SelectLocale.js";
3
3
  import { SelectField as o } from "./SelectField.js";
4
4
  import { moveInOptions as s, useOptionListFocus as c } from "./internal/optionList.js";
5
5
  import { SelectPopover as l } from "./SelectPopover.js";
6
- import { SelectSearchInput as u } from "./SelectSearchInput.js";
7
- import { SelectDateField as d } from "./SelectDateField.js";
6
+ import { SelectDateField as u } from "./SelectDateField.js";
7
+ import { SelectSearchInput as d } from "./SelectSearchInput.js";
8
8
  import { formatDateValue as f } from "./internal/dateValue.js";
9
9
  import { forwardRef as p, useEffect as m, useRef as h, useState as g } from "react";
10
10
  import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
@@ -103,7 +103,7 @@ function w({ filter: n, value: i, onChange: f, open: p, onToggle: _, onClose: w,
103
103
  onKeyDown: s,
104
104
  children: [P && /* @__PURE__ */ v("div", {
105
105
  className: "select-facet__search",
106
- children: /* @__PURE__ */ v(u, {
106
+ children: /* @__PURE__ */ v(d, {
107
107
  value: D,
108
108
  onChange: O,
109
109
  placeholder: E.filterBar.searchOption
@@ -137,7 +137,7 @@ function w({ filter: n, value: i, onChange: f, open: p, onToggle: _, onClose: w,
137
137
  onKeyDown: s,
138
138
  children: [P && /* @__PURE__ */ v("div", {
139
139
  className: "select-facet__search",
140
- children: /* @__PURE__ */ v(u, {
140
+ children: /* @__PURE__ */ v(d, {
141
141
  value: D,
142
142
  onChange: O,
143
143
  placeholder: E.filterBar.searchOption
@@ -168,7 +168,7 @@ function w({ filter: n, value: i, onChange: f, open: p, onToggle: _, onClose: w,
168
168
  })]
169
169
  }) : n.type === "date" ? /* @__PURE__ */ v("div", {
170
170
  className: "select-facet__field",
171
- children: /* @__PURE__ */ v(d, {
171
+ children: /* @__PURE__ */ v(u, {
172
172
  value: i,
173
173
  onChange: f,
174
174
  placeholder: n.placeholder,
@@ -34,7 +34,26 @@ type SelectListCardOwnProps = {
34
34
  };
35
35
  export type SelectListCardProps = SelectListCardOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectListCardOwnProps>;
36
36
  export declare const SelectListCard: import('react').ForwardRefExoticComponent<SelectListCardOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SelectListCardOwnProps> & import('react').RefAttributes<HTMLDivElement>>;
37
- export declare function SelectListRow({ media, mediaSize, title, secondary, action, muted, wrap, onClick, href, }: {
37
+ /**
38
+ * 0.1.259: uma coluna da linha (`SelectListRow columns`) — o registro, o prazo, o dono de uma tarefa. A linha não tem
39
+ * cabeçalho: o `label` diz ao leitor de tela o que a coluna é ("Prazo: amanhã").
40
+ */
41
+ export interface SelectListRowColumn {
42
+ /** O que vai na coluna. */
43
+ content: ReactNode;
44
+ /**
45
+ * A largura no largo (um comprimento CSS, `'12rem'`): com ela, as colunas de todas as linhas ficam alinhadas e cedem
46
+ * juntas quando falta lugar. Sem ela, a coluna tem a medida do conteúdo.
47
+ */
48
+ width?: string;
49
+ /** O nome da coluna para o leitor de tela (fora da vista). */
50
+ label?: string;
51
+ /** No largo: `end` encosta à direita (um valor, uma data curta). */
52
+ align?: 'start' | 'end';
53
+ /** A chave da coluna na lista (sem ela, a posição). */
54
+ key?: string;
55
+ }
56
+ export declare function SelectListRow({ media, mediaSize, title, secondary, action, columns, muted, wrap, onClick, href, }: {
38
57
  /** Leading visual — an icon or SelectAvatar. */
39
58
  media?: ReactNode;
40
59
  /** `icon` (padrão) encaixa um glifo cru numa caixa de 1.25rem; `auto` deixa o visual com o
@@ -45,6 +64,13 @@ export declare function SelectListRow({ media, mediaSize, title, secondary, acti
45
64
  secondary?: ReactNode;
46
65
  /** Trailing slot — a link, button or badge. */
47
66
  action?: ReactNode;
67
+ /**
68
+ * 0.1.259: as colunas da linha, depois do título (a lista das Tarefas: o registro, o prazo e o dono). No largo, cada
69
+ * uma na largura dela, alinhadas de linha a linha e cortando com reticências; quando a linha fica estreita (abaixo de
70
+ * 32rem, pela largura da própria linha, não da janela), elas descem para baixo do título, numa linha só com o "·"
71
+ * entre elas. Sem `columns`, a linha de antes.
72
+ */
73
+ columns?: readonly SelectListRowColumn[];
48
74
  /** Dim the title/media (e.g. a disabled field). */
49
75
  muted?: boolean;
50
76
  /**
@@ -44,42 +44,67 @@ var l = a(function({ title: e, headingLevel: n, help: a, description: o, headerA
44
44
  });
45
45
  });
46
46
  n(l);
47
- function u({ media: t, mediaSize: n = "icon", title: r, secondary: i, action: a, muted: l = !1, wrap: u = !1, onClick: d, href: f }) {
48
- let p = /* @__PURE__ */ c(o, { children: [
47
+ function u({ media: t, mediaSize: n = "icon", title: r, secondary: i, action: a, columns: l, muted: u = !1, wrap: d = !1, onClick: f, href: p }) {
48
+ let m = /* @__PURE__ */ c("span", {
49
+ className: "select-listrow__text",
50
+ children: [/* @__PURE__ */ s("span", {
51
+ className: "select-listrow__title",
52
+ children: r
53
+ }), i && /* @__PURE__ */ s("span", {
54
+ className: "select-listrow__secondary",
55
+ children: i
56
+ })]
57
+ }), h = l != null && l.length > 0, g = h && l.every((e) => e.width) ? `calc(${l.map((e) => e.width).join(" + ")} + ${l.length - 1} * var(--select-sp-6))` : void 0, _ = /* @__PURE__ */ c(o, { children: [
49
58
  t && /* @__PURE__ */ s("span", {
50
59
  className: `select-listrow__media${n === "auto" ? " select-listrow__media--auto" : ""}`,
51
60
  "aria-hidden": "true",
52
61
  children: t
53
62
  }),
54
- /* @__PURE__ */ c("span", {
55
- className: "select-listrow__text",
56
- children: [/* @__PURE__ */ s("span", {
57
- className: "select-listrow__title",
58
- children: r
59
- }), i && /* @__PURE__ */ s("span", {
60
- className: "select-listrow__secondary",
61
- children: i
63
+ h ? /* @__PURE__ */ c("span", {
64
+ className: "select-listrow__main",
65
+ children: [m, /* @__PURE__ */ s("span", {
66
+ className: "select-listrow__cols",
67
+ style: g ? { "--select-listrow-cols": g } : void 0,
68
+ children: l.map((e, t) => /* @__PURE__ */ c("span", {
69
+ className: `select-listrow__col${e.align === "end" ? " select-listrow__col--end" : ""}`,
70
+ style: e.width ? { "--select-listrow-col": e.width } : void 0,
71
+ children: [
72
+ e.label && /* @__PURE__ */ s("span", {
73
+ className: "select-visually-hidden",
74
+ children: `${e.label}: `
75
+ }),
76
+ /* @__PURE__ */ s("span", {
77
+ className: "select-listrow__colvalue",
78
+ children: e.content
79
+ }),
80
+ t < l.length - 1 && /* @__PURE__ */ s("span", {
81
+ className: "select-listrow__sep",
82
+ "aria-hidden": "true",
83
+ children: "·"
84
+ })
85
+ ]
86
+ }, e.key ?? t))
62
87
  })]
63
- }),
88
+ }) : m,
64
89
  a && /* @__PURE__ */ s("span", {
65
90
  className: "select-listrow__action",
66
91
  children: a
67
92
  })
68
- ] }), m = `select-listrow${l ? " select-listrow--muted" : ""}${u ? " select-listrow--wrap" : ""}`, h = e(f);
69
- return h ? /* @__PURE__ */ s("a", {
70
- className: `${m} select-listrow--clickable`,
71
- href: h,
93
+ ] }), v = `select-listrow${u ? " select-listrow--muted" : ""}${d ? " select-listrow--wrap" : ""}${h ? " select-listrow--columns" : ""}`, y = e(p);
94
+ return y ? /* @__PURE__ */ s("a", {
95
+ className: `${v} select-listrow--clickable`,
96
+ href: y,
72
97
  target: "_blank",
73
98
  rel: "noreferrer",
74
- children: p
75
- }) : d ? /* @__PURE__ */ s("button", {
99
+ children: _
100
+ }) : f ? /* @__PURE__ */ s("button", {
76
101
  type: "button",
77
- className: `${m} select-listrow--clickable`,
78
- onClick: d,
79
- children: p
102
+ className: `${v} select-listrow--clickable`,
103
+ onClick: f,
104
+ children: _
80
105
  }) : /* @__PURE__ */ s("div", {
81
- className: m,
82
- children: p
106
+ className: v,
107
+ children: _
83
108
  });
84
109
  }
85
110
  function d({ children: e }) {