@selectwin/kit 0.1.258 → 0.1.260
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 +47 -0
- package/dist/SelectActionBar.d.ts +29 -0
- package/dist/SelectActionBar.js +101 -0
- package/dist/SelectBadge.d.ts +9 -0
- package/dist/SelectBadge.js +26 -12
- package/dist/SelectBulkBar.d.ts +21 -0
- package/dist/SelectBulkBar.js +40 -0
- package/dist/SelectChannelPreview.d.ts +21 -1
- package/dist/SelectChannelPreview.js +100 -73
- package/dist/SelectColorField.d.ts +1 -5
- package/dist/SelectColorField.js +83 -101
- package/dist/SelectCombobox.d.ts +5 -0
- package/dist/SelectCombobox.js +52 -49
- package/dist/SelectComposerNotice.d.ts +14 -0
- package/dist/SelectComposerNotice.js +37 -0
- package/dist/SelectDataTable.d.ts +17 -1
- package/dist/SelectDataTable.js +100 -90
- package/dist/SelectDeadlineBadge.d.ts +32 -0
- package/dist/SelectDeadlineBadge.js +73 -0
- package/dist/SelectFilterBar.js +5 -5
- package/dist/SelectListCard.d.ts +27 -1
- package/dist/SelectListCard.js +47 -22
- package/dist/SelectLocale.d.ts +62 -0
- package/dist/SelectLocale.js +173 -0
- package/dist/SelectMail.d.ts +52 -8
- package/dist/SelectMail.js +315 -242
- package/dist/SelectSection.d.ts +4 -4
- package/dist/SelectSection.js +77 -8
- package/dist/SelectSegmented.d.ts +11 -0
- package/dist/SelectSegmented.js +87 -68
- package/dist/SelectTable.d.ts +13 -1
- package/dist/SelectTable.js +88 -79
- package/dist/SelectTabs.d.ts +7 -0
- package/dist/SelectTabs.js +47 -40
- package/dist/SelectWeekHours.d.ts +64 -0
- package/dist/SelectWeekHours.js +338 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.js +189 -183
- package/dist/internal/color.d.ts +15 -0
- package/dist/internal/color.js +40 -0
- package/dist/internal/safeHref.d.ts +7 -0
- package/dist/internal/safeHref.js +12 -1
- package/dist/internal/scrollReveal.d.ts +19 -0
- package/dist/internal/scrollReveal.js +38 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -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
|
package/dist/SelectDataTable.js
CHANGED
|
@@ -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
|
|
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
|
|
19
|
+
var g = "select-datatable:hidden-cols:";
|
|
20
20
|
function ae(e) {
|
|
21
21
|
try {
|
|
22
|
-
let t = localStorage.getItem(
|
|
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(
|
|
30
|
+
t.length === 0 ? localStorage.removeItem(g + e) : localStorage.setItem(g + e, JSON.stringify(t));
|
|
31
31
|
} catch {}
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function _(e) {
|
|
34
34
|
return e.hideable ?? !!e.title;
|
|
35
35
|
}
|
|
36
|
-
var
|
|
36
|
+
var v = "select-datatable:col-widths:";
|
|
37
37
|
function se(e) {
|
|
38
38
|
try {
|
|
39
|
-
let t = localStorage.getItem(
|
|
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
|
|
48
|
+
function y(e, t) {
|
|
49
49
|
try {
|
|
50
|
-
Object.keys(t).length === 0 ? localStorage.removeItem(
|
|
50
|
+
Object.keys(t).length === 0 ? localStorage.removeItem(v + e) : localStorage.setItem(v + e, JSON.stringify(t));
|
|
51
51
|
} catch {}
|
|
52
52
|
}
|
|
53
|
-
var
|
|
54
|
-
function
|
|
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(
|
|
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(
|
|
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
|
|
78
|
-
let [
|
|
79
|
-
let n = new Set(t), r =
|
|
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
|
-
}),
|
|
82
|
-
|
|
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
|
|
84
|
+
return C && oe(C, r), n && K((t) => t && t.key === e.key ? null : t), r;
|
|
85
85
|
});
|
|
86
|
-
},
|
|
87
|
-
|
|
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 =
|
|
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 (!
|
|
100
|
-
let t =
|
|
101
|
-
return (n) => [...n].sort((n, r) => ce(e(n), e(r), t,
|
|
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
|
-
|
|
103
|
+
G,
|
|
104
104
|
J,
|
|
105
|
-
|
|
106
|
-
]), X = c(() => Y(p), [p, Y]), Z = (e) =>
|
|
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
|
-
}] :
|
|
115
|
+
}] : W.map((e) => ({
|
|
110
116
|
label: e.title,
|
|
111
117
|
align: e.align,
|
|
112
|
-
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: (
|
|
117
|
-
onSort: e.sortValue ? () =>
|
|
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 =
|
|
122
|
-
n &&
|
|
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],
|
|
130
|
+
return t ? r[n.key] = t : delete r[n.key], C && y(C, r), r;
|
|
125
131
|
});
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
icon:
|
|
130
|
-
title:
|
|
131
|
-
subtitle:
|
|
132
|
-
action:
|
|
133
|
-
}) : void 0,
|
|
134
|
-
active:
|
|
135
|
-
onClose: () =>
|
|
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:
|
|
146
|
+
label: P.columns,
|
|
141
147
|
size: "sm",
|
|
142
|
-
active:
|
|
143
|
-
"aria-expanded":
|
|
144
|
-
onClick: () =>
|
|
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:
|
|
152
|
-
let n = !
|
|
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: () =>
|
|
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
|
-
}),
|
|
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
|
-
|
|
181
|
+
De(), N(!1);
|
|
176
182
|
},
|
|
177
|
-
children: /* @__PURE__ */ u("span", { children:
|
|
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${
|
|
189
|
+
className: `select-datatable${A ? " select-datatable--flush" : ""}`,
|
|
184
190
|
children: [/* @__PURE__ */ u(ie, {
|
|
185
|
-
columns:
|
|
186
|
-
empty:
|
|
187
|
-
footer:
|
|
188
|
-
title:
|
|
189
|
-
headingLevel:
|
|
190
|
-
help:
|
|
191
|
-
description:
|
|
192
|
-
filters:
|
|
193
|
-
action:
|
|
194
|
-
tools:
|
|
195
|
-
className:
|
|
196
|
-
flush:
|
|
197
|
-
onColumnResize:
|
|
198
|
-
onColumnResizeReset:
|
|
199
|
-
children:
|
|
200
|
-
|
|
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:
|
|
203
|
-
children:
|
|
209
|
+
className: _e ? "select-table__td--wrap" : void 0,
|
|
210
|
+
children: R(e)
|
|
204
211
|
})
|
|
205
|
-
},
|
|
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 =
|
|
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:
|
|
221
|
+
children: W.map((t, n) => /* @__PURE__ */ u(o, {
|
|
214
222
|
align: t.align,
|
|
215
223
|
width: t.width,
|
|
216
|
-
className:
|
|
217
|
-
disclosure:
|
|
224
|
+
className: h(t),
|
|
225
|
+
disclosure: Te && n === 0 ? "none" : void 0,
|
|
218
226
|
children: t.render(e)
|
|
219
227
|
}, n))
|
|
220
|
-
},
|
|
221
|
-
let n =
|
|
228
|
+
}, m(e))];
|
|
229
|
+
let n = xe(e);
|
|
222
230
|
return [/* @__PURE__ */ u(s, {
|
|
223
|
-
|
|
231
|
+
...Z(e),
|
|
232
|
+
onClick: () => Se(e),
|
|
224
233
|
expanded: n,
|
|
225
|
-
children:
|
|
234
|
+
children: W.map((t, r) => /* @__PURE__ */ u(o, {
|
|
226
235
|
align: t.align,
|
|
227
236
|
width: t.width,
|
|
228
|
-
className:
|
|
237
|
+
className: h(t),
|
|
229
238
|
disclosure: r === 0 ? n ? "open" : "closed" : void 0,
|
|
230
239
|
children: t.render(e)
|
|
231
240
|
}, r))
|
|
232
|
-
},
|
|
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:
|
|
245
|
+
children: W.map((e, n) => /* @__PURE__ */ u(o, {
|
|
236
246
|
align: e.align,
|
|
237
247
|
width: e.width,
|
|
238
|
-
className:
|
|
248
|
+
className: h(e),
|
|
239
249
|
children: e.render(t)
|
|
240
250
|
}, n))
|
|
241
|
-
}, `${
|
|
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,
|
|
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
|
package/dist/SelectFilterBar.js
CHANGED
|
@@ -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 {
|
|
7
|
-
import {
|
|
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(
|
|
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(
|
|
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(
|
|
171
|
+
children: /* @__PURE__ */ v(u, {
|
|
172
172
|
value: i,
|
|
173
173
|
onChange: f,
|
|
174
174
|
placeholder: n.placeholder,
|
package/dist/SelectListCard.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
/**
|