@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.
- package/README.md +75 -0
- package/dist/SelectActionBar.d.ts +29 -0
- package/dist/SelectActionBar.js +101 -0
- package/dist/SelectActionList.d.ts +5 -0
- package/dist/SelectActionList.js +55 -39
- package/dist/SelectAppFrame.d.ts +8 -2
- package/dist/SelectAppFrame.js +124 -119
- package/dist/SelectAvatarGroup.d.ts +31 -0
- package/dist/SelectAvatarGroup.js +39 -0
- package/dist/SelectBadge.d.ts +10 -1
- package/dist/SelectBadge.js +26 -12
- package/dist/SelectBulkBar.d.ts +21 -0
- package/dist/SelectBulkBar.js +40 -0
- package/dist/SelectChannelPreview.d.ts +35 -5
- package/dist/SelectChannelPreview.js +127 -60
- 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/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/SelectFieldset.d.ts +14 -0
- package/dist/SelectFieldset.js +27 -0
- package/dist/SelectFilterBar.d.ts +6 -1
- package/dist/SelectFilterBar.js +155 -125
- package/dist/SelectImageUploadField.d.ts +5 -3
- package/dist/SelectImageUploadField.js +26 -26
- package/dist/SelectKanban.d.ts +13 -1
- package/dist/SelectKanban.js +72 -50
- package/dist/SelectListCard.d.ts +27 -1
- package/dist/SelectListCard.js +47 -22
- package/dist/SelectLocale.d.ts +96 -0
- package/dist/SelectLocale.js +733 -521
- package/dist/SelectMail.d.ts +9 -1
- package/dist/SelectMail.js +234 -207
- package/dist/SelectModal.d.ts +10 -4
- package/dist/SelectModal.js +158 -137
- package/dist/SelectSection.d.ts +4 -4
- package/dist/SelectSection.js +77 -8
- package/dist/SelectSegmented.d.ts +7 -0
- package/dist/SelectSegmented.js +51 -43
- package/dist/SelectSideNav.d.ts +2 -1
- package/dist/SelectSideNav.js +156 -135
- package/dist/SelectSortable.d.ts +47 -1
- package/dist/SelectSortable.js +138 -19
- package/dist/SelectSteps.d.ts +3 -0
- package/dist/SelectSteps.js +42 -31
- package/dist/SelectTable.d.ts +13 -1
- package/dist/SelectTable.js +88 -79
- package/dist/SelectTabs.d.ts +10 -0
- package/dist/SelectTabs.js +68 -30
- package/dist/SelectTimeline.d.ts +4 -0
- package/dist/SelectTimeline.js +20 -9
- package/dist/SelectWeekHours.d.ts +64 -0
- package/dist/SelectWeekHours.js +338 -0
- package/dist/index.d.ts +19 -2
- package/dist/index.js +191 -184
- package/dist/internal/color.d.ts +15 -0
- package/dist/internal/color.js +40 -0
- package/dist/internal/navCount.d.ts +21 -0
- package/dist/internal/navCount.js +27 -0
- package/dist/internal/safeHref.d.ts +7 -0
- package/dist/internal/safeHref.js +12 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
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
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
type SelectFieldsetOwnProps = {
|
|
3
|
+
/** O nome do grupo, na `<legend>`. */
|
|
4
|
+
legend: ReactNode;
|
|
5
|
+
/** A linha que explica o grupo, no começo dele (e a descrição dele para o leitor de tela). */
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
/** `plain` (o padrão): sem moldura. `highlight`: a caixa em destaque, no acento do app. */
|
|
8
|
+
variant?: 'plain' | 'highlight';
|
|
9
|
+
/** A legenda só para o leitor de tela. */
|
|
10
|
+
hideLegend?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type SelectFieldsetProps = SelectFieldsetOwnProps & Omit<ComponentPropsWithoutRef<'fieldset'>, keyof SelectFieldsetOwnProps>;
|
|
13
|
+
export declare const SelectFieldset: import('react').ForwardRefExoticComponent<SelectFieldsetOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>, "ref">, keyof SelectFieldsetOwnProps> & import('react').RefAttributes<HTMLFieldSetElement>>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { forwardRef as e, useId as t } from "react";
|
|
2
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
3
|
+
//#region src/SelectFieldset.tsx
|
|
4
|
+
var i = e(function({ legend: e, description: i, variant: a = "plain", hideLegend: o = !1, className: s, children: c, "aria-describedby": l, ...u }, d) {
|
|
5
|
+
let f = t(), p = i != null && i !== !1 && i !== "", m = [l, p ? f : null].filter(Boolean).join(" ") || void 0;
|
|
6
|
+
return /* @__PURE__ */ r("fieldset", {
|
|
7
|
+
ref: d,
|
|
8
|
+
...u,
|
|
9
|
+
"aria-describedby": m,
|
|
10
|
+
className: `select-fieldset select-fieldset--${a}${s ? ` ${s}` : ""}`,
|
|
11
|
+
children: [/* @__PURE__ */ n("legend", {
|
|
12
|
+
className: `select-fieldset__legend${o ? " select-visually-hidden" : ""}`,
|
|
13
|
+
children: e
|
|
14
|
+
}), /* @__PURE__ */ r("div", {
|
|
15
|
+
className: "select-fieldset__body",
|
|
16
|
+
children: [p && /* @__PURE__ */ n("p", {
|
|
17
|
+
id: f,
|
|
18
|
+
className: "select-fieldset__description",
|
|
19
|
+
children: i
|
|
20
|
+
}), c]
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//#endregion
|
|
25
|
+
export { i as SelectFieldset };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=SelectFieldset.js.map
|
|
@@ -2,13 +2,18 @@ import { ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
|
2
2
|
export interface SelectFilterDef {
|
|
3
3
|
key: string;
|
|
4
4
|
label: string;
|
|
5
|
-
|
|
5
|
+
/** 0.1.258: `toggle` — a faceta de marcar, que liga e desliga num clique (sem painel). */
|
|
6
|
+
type: 'text' | 'select' | 'multiselect' | 'date' | 'toggle';
|
|
6
7
|
placeholder?: string;
|
|
7
8
|
options?: {
|
|
8
9
|
label: string;
|
|
9
10
|
value: string;
|
|
10
11
|
}[];
|
|
11
12
|
pinned?: boolean;
|
|
13
|
+
/** 0.1.258: o valor da faceta de marcar ligada (padrão `'true'`); desligada, vazio. */
|
|
14
|
+
toggleValue?: string;
|
|
15
|
+
/** 0.1.258: a faceta é um campo personalizado — o selo "campo" ao lado do nome. */
|
|
16
|
+
custom?: boolean;
|
|
12
17
|
/**
|
|
13
18
|
* The value is set but NOT usable — say so on the filter itself.
|
|
14
19
|
*
|