@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/SelectTable.js
CHANGED
|
@@ -4,36 +4,36 @@ import { FrameBody as r, useFrameKind as i } from "./internal/frame.js";
|
|
|
4
4
|
import { SelectAvatar as a } from "./SelectAvatar.js";
|
|
5
5
|
import { SelectListChrome as o, listChromeShape as s } from "./internal/listChrome.js";
|
|
6
6
|
import { SelectTableEmpty as c } from "./SelectTableEmpty.js";
|
|
7
|
-
import { Children as l,
|
|
8
|
-
import { Fragment as
|
|
7
|
+
import { Children as l, Fragment as u, cloneElement as d, createContext as f, forwardRef as p, isValidElement as m, useCallback as h, useContext as g, useId as _, useLayoutEffect as ee, useRef as te, useState as v } from "react";
|
|
8
|
+
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
9
9
|
//#region src/SelectTable.tsx
|
|
10
|
-
var
|
|
11
|
-
function
|
|
10
|
+
var S = 40, C = 1200, w = 8;
|
|
11
|
+
function T(e) {
|
|
12
12
|
let t = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
13
13
|
return `${Math.round(e / t * 1e3) / 1e3}rem`;
|
|
14
14
|
}
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
let
|
|
18
|
-
open:
|
|
19
|
-
onToggle: () =>
|
|
15
|
+
var E = f(0), D = p(function({ columns: t, children: a, empty: c, footer: u, title: d, headingLevel: f, help: p, description: m, action: g, filters: y, tools: D, onColumnResize: O, onColumnResizeReset: k, collapsible: A = !1, defaultOpen: j = !0, flush: M = !1, label: N, minWidth: P, sizing: F = "even", className: I, ...L }, R) {
|
|
16
|
+
var z;
|
|
17
|
+
let B = N ?? (typeof d == "string" ? d : void 0), [V, re] = v(j), H = _(), U = A && d != null ? {
|
|
18
|
+
open: V,
|
|
19
|
+
onToggle: () => re((e) => !e),
|
|
20
20
|
controls: H
|
|
21
21
|
} : void 0, W = l.count(a) === 0, G = W && !!c, { hasFilters: K, hasTitleRow: q } = s({
|
|
22
22
|
title: d,
|
|
23
|
-
description:
|
|
24
|
-
action:
|
|
25
|
-
filters:
|
|
23
|
+
description: m,
|
|
24
|
+
action: g,
|
|
25
|
+
filters: y,
|
|
26
26
|
tools: D
|
|
27
|
-
}), J = G && !q && !K, Y = (
|
|
27
|
+
}), J = G && !q && !K, Y = (z = t[t.length - 1]) == null ? void 0 : z.label, ie = Y != null && Y !== "" && Y !== !1, X = i(), ae = X === "body", oe = X === "list", se = n({
|
|
28
28
|
selector: ".select-table__row",
|
|
29
29
|
y: 8,
|
|
30
30
|
duration: .45,
|
|
31
31
|
stagger: .05,
|
|
32
32
|
scroll: !0
|
|
33
|
-
}), Z = t.length ? t.map((e) => e.width ?? `minmax(${e.minWidth ?? "var(--select-table-col-min, 6.5rem)"}, ${e.grow ?? 1}fr)`).join(" ") : "1fr", Q =
|
|
34
|
-
Q.current = e, typeof
|
|
35
|
-
}, [
|
|
36
|
-
|
|
33
|
+
}), Z = t.length ? t.map((e) => e.width ?? `minmax(${e.minWidth ?? "var(--select-table-col-min, 6.5rem)"}, ${e.grow ?? 1}fr)`).join(" ") : "1fr", Q = te(null), ce = h((e) => {
|
|
34
|
+
Q.current = e, typeof R == "function" ? R(e) : R && (R.current = e);
|
|
35
|
+
}, [R]);
|
|
36
|
+
ee(() => {
|
|
37
37
|
let e = Q.current;
|
|
38
38
|
if (!e) return;
|
|
39
39
|
if (F !== "content" || !t.some((e) => e.width == null)) {
|
|
@@ -74,9 +74,9 @@ var S = u(0), C = d(function({ columns: t, children: a, empty: c, footer: u, tit
|
|
|
74
74
|
let o = Q.current;
|
|
75
75
|
o == null || o.classList.add("select-table--resizing");
|
|
76
76
|
let s = a, c = (t) => {
|
|
77
|
-
s = Math.min(
|
|
77
|
+
s = Math.min(C, Math.max(S, a + (t.clientX - i))), $(e, s);
|
|
78
78
|
}, l = () => {
|
|
79
|
-
window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", l), o == null || o.classList.remove("select-table--resizing"), O(e,
|
|
79
|
+
window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", l), o == null || o.classList.remove("select-table--resizing"), O(e, T(s));
|
|
80
80
|
};
|
|
81
81
|
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l), window.addEventListener("pointercancel", l);
|
|
82
82
|
}, ue = (e) => (t) => {
|
|
@@ -87,56 +87,56 @@ var S = u(0), C = d(function({ columns: t, children: a, empty: c, footer: u, tit
|
|
|
87
87
|
let i = (n = t.currentTarget.parentElement) == null ? void 0 : n.getBoundingClientRect();
|
|
88
88
|
if (!i) return;
|
|
89
89
|
t.preventDefault();
|
|
90
|
-
let a =
|
|
91
|
-
$(e, o), O(e,
|
|
90
|
+
let a = w * (t.shiftKey ? 10 : 1), o = Math.min(C, Math.max(S, i.width + r * a));
|
|
91
|
+
$(e, o), O(e, T(o));
|
|
92
92
|
};
|
|
93
|
-
return /* @__PURE__ */
|
|
93
|
+
return /* @__PURE__ */ x("div", {
|
|
94
94
|
ref: ce,
|
|
95
|
-
...
|
|
96
|
-
className: `select-table${J ? " select-table--empty" : ""}${ae && !M ? " select-table--nested" : ""}${oe && !M ? " select-table--inlist" : ""}${M ? " select-table--flush" : ""}${U ? ` select-table--collapsible${
|
|
95
|
+
...L,
|
|
96
|
+
className: `select-table${J ? " select-table--empty" : ""}${ae && !M ? " select-table--nested" : ""}${oe && !M ? " select-table--inlist" : ""}${M ? " select-table--flush" : ""}${U ? ` select-table--collapsible${V ? " is-open" : ""}` : ""}${ie ? " select-table--free-last" : ""}${I ? " " + I : ""}`,
|
|
97
97
|
style: {
|
|
98
98
|
"--select-table-cols": Z,
|
|
99
99
|
...P ? { "--select-table-min": P } : {}
|
|
100
100
|
},
|
|
101
|
-
children: [/* @__PURE__ */
|
|
101
|
+
children: [/* @__PURE__ */ b(o, {
|
|
102
102
|
title: d,
|
|
103
|
-
headingLevel:
|
|
104
|
-
help: U ? void 0 :
|
|
105
|
-
description:
|
|
106
|
-
action:
|
|
107
|
-
filters: U ? void 0 :
|
|
103
|
+
headingLevel: f,
|
|
104
|
+
help: U ? void 0 : p,
|
|
105
|
+
description: m,
|
|
106
|
+
action: g,
|
|
107
|
+
filters: U ? void 0 : y,
|
|
108
108
|
tools: U ? void 0 : D,
|
|
109
109
|
toggle: U
|
|
110
|
-
}), /* @__PURE__ */
|
|
110
|
+
}), /* @__PURE__ */ x(ne, {
|
|
111
111
|
enabled: !!U,
|
|
112
|
-
open:
|
|
112
|
+
open: V,
|
|
113
113
|
id: H,
|
|
114
114
|
children: [
|
|
115
|
-
U && (
|
|
116
|
-
filters:
|
|
115
|
+
U && (y != null || D != null) ? /* @__PURE__ */ b(o, {
|
|
116
|
+
filters: y,
|
|
117
117
|
tools: D
|
|
118
118
|
}) : null,
|
|
119
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ b("div", {
|
|
120
120
|
className: `select-table__scroll${G ? " select-table__scroll--empty" : ""}`,
|
|
121
|
-
children: /* @__PURE__ */
|
|
121
|
+
children: /* @__PURE__ */ x("div", {
|
|
122
122
|
className: "select-table__scrollinner",
|
|
123
123
|
...G ? {} : {
|
|
124
124
|
role: "table",
|
|
125
|
-
"aria-label":
|
|
125
|
+
"aria-label": B
|
|
126
126
|
},
|
|
127
|
-
children: [!G && /* @__PURE__ */
|
|
127
|
+
children: [!G && /* @__PURE__ */ b("div", {
|
|
128
128
|
className: "select-table__head",
|
|
129
129
|
role: "row",
|
|
130
|
-
children: t.map((n, r) => /* @__PURE__ */
|
|
130
|
+
children: t.map((n, r) => /* @__PURE__ */ x("div", {
|
|
131
131
|
role: "columnheader",
|
|
132
132
|
"aria-sort": n.sortable ? n.sortDir === "asc" ? "ascending" : n.sortDir === "desc" ? "descending" : "none" : void 0,
|
|
133
133
|
className: `select-table__th select-table__cell--${n.align ?? "start"}${n.tone ? ` select-table__th--${n.tone}` : ""}`,
|
|
134
|
-
children: [n.sortable ? /* @__PURE__ */
|
|
134
|
+
children: [n.sortable ? /* @__PURE__ */ x("button", {
|
|
135
135
|
type: "button",
|
|
136
136
|
className: `select-table__sortbtn${n.sortDir === "asc" ? " select-table__sortbtn--asc" : ""}${n.sortDir == null ? "" : " select-table__sortbtn--active"}`,
|
|
137
137
|
onClick: n.onSort,
|
|
138
|
-
children: [n.label, /* @__PURE__ */
|
|
139
|
-
}) : n.label, O && n.resizable !== !1 && r < t.length - 1 && /* @__PURE__ */
|
|
138
|
+
children: [n.label, /* @__PURE__ */ b(e, {})]
|
|
139
|
+
}) : n.label, O && n.resizable !== !1 && r < t.length - 1 && /* @__PURE__ */ b("span", {
|
|
140
140
|
role: "separator",
|
|
141
141
|
"aria-orientation": "vertical",
|
|
142
142
|
"aria-label": "Ajustar a largura da coluna",
|
|
@@ -147,14 +147,14 @@ var S = u(0), C = d(function({ columns: t, children: a, empty: c, footer: u, tit
|
|
|
147
147
|
onDoubleClick: k ? () => k(r) : void 0
|
|
148
148
|
})]
|
|
149
149
|
}, r))
|
|
150
|
-
}), /* @__PURE__ */
|
|
150
|
+
}), /* @__PURE__ */ b("div", {
|
|
151
151
|
className: "select-table__body",
|
|
152
|
-
children: /* @__PURE__ */
|
|
152
|
+
children: /* @__PURE__ */ b("div", {
|
|
153
153
|
className: "select-table__rows",
|
|
154
154
|
ref: se,
|
|
155
|
-
children: /* @__PURE__ */
|
|
155
|
+
children: /* @__PURE__ */ b(E.Provider, {
|
|
156
156
|
value: t.length,
|
|
157
|
-
children: /* @__PURE__ */
|
|
157
|
+
children: /* @__PURE__ */ b(r, { children: W && c ? /* @__PURE__ */ b("div", {
|
|
158
158
|
className: "select-table__empty",
|
|
159
159
|
children: c
|
|
160
160
|
}) : a })
|
|
@@ -163,7 +163,7 @@ var S = u(0), C = d(function({ columns: t, children: a, empty: c, footer: u, tit
|
|
|
163
163
|
})]
|
|
164
164
|
})
|
|
165
165
|
}),
|
|
166
|
-
u && /* @__PURE__ */
|
|
166
|
+
u && /* @__PURE__ */ b("div", {
|
|
167
167
|
className: "select-table__footer",
|
|
168
168
|
children: u
|
|
169
169
|
})
|
|
@@ -171,77 +171,86 @@ var S = u(0), C = d(function({ columns: t, children: a, empty: c, footer: u, tit
|
|
|
171
171
|
})]
|
|
172
172
|
});
|
|
173
173
|
});
|
|
174
|
-
function
|
|
175
|
-
return e ? /* @__PURE__ */
|
|
174
|
+
function ne({ enabled: e, open: t, id: n, children: r }) {
|
|
175
|
+
return e ? /* @__PURE__ */ b("div", {
|
|
176
176
|
className: "select-table__collapse",
|
|
177
177
|
id: n,
|
|
178
178
|
"data-open": t,
|
|
179
179
|
"aria-hidden": !t,
|
|
180
|
-
children: /* @__PURE__ */
|
|
180
|
+
children: /* @__PURE__ */ b("div", {
|
|
181
181
|
className: "select-table__collapsewrap",
|
|
182
182
|
children: r
|
|
183
183
|
})
|
|
184
|
-
}) : /* @__PURE__ */
|
|
184
|
+
}) : /* @__PURE__ */ b(y, { children: r });
|
|
185
185
|
}
|
|
186
|
-
var
|
|
187
|
-
return /* @__PURE__ */
|
|
186
|
+
var O = p(function({ name: e, secondary: t, src: n, badge: r, className: i, ...o }, s) {
|
|
187
|
+
return /* @__PURE__ */ x("span", {
|
|
188
188
|
ref: s,
|
|
189
189
|
...o,
|
|
190
190
|
className: `select-usercell${i ? " " + i : ""}`,
|
|
191
|
-
children: [/* @__PURE__ */
|
|
191
|
+
children: [/* @__PURE__ */ b(a, {
|
|
192
192
|
name: typeof e == "string" ? e : void 0,
|
|
193
193
|
src: n
|
|
194
|
-
}), /* @__PURE__ */
|
|
194
|
+
}), /* @__PURE__ */ x("span", {
|
|
195
195
|
className: "select-usercell__text",
|
|
196
|
-
children: [r ? /* @__PURE__ */
|
|
196
|
+
children: [r ? /* @__PURE__ */ x("span", {
|
|
197
197
|
className: "select-usercell__line",
|
|
198
|
-
children: [/* @__PURE__ */
|
|
198
|
+
children: [/* @__PURE__ */ b("span", {
|
|
199
199
|
className: "select-usercell__name",
|
|
200
200
|
children: e
|
|
201
201
|
}), r]
|
|
202
|
-
}) : /* @__PURE__ */
|
|
202
|
+
}) : /* @__PURE__ */ b("span", {
|
|
203
203
|
className: "select-usercell__name",
|
|
204
204
|
children: e
|
|
205
|
-
}), t && /* @__PURE__ */
|
|
205
|
+
}), t && /* @__PURE__ */ b("span", {
|
|
206
206
|
className: "select-usercell__secondary",
|
|
207
207
|
children: t
|
|
208
208
|
})]
|
|
209
209
|
})]
|
|
210
210
|
});
|
|
211
211
|
});
|
|
212
|
-
function
|
|
213
|
-
let
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
function k(e, t) {
|
|
213
|
+
let n = l.toArray(e), r = (e) => m(e) && e.type !== u, i = n.findIndex((e) => r(e) && e.props.header === !0), a = i >= 0 ? i : n.findIndex(r);
|
|
214
|
+
if (a < 0) return e;
|
|
215
|
+
let o = n[a];
|
|
216
|
+
return n[a] = d(o, void 0, /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("span", {
|
|
217
|
+
className: "select-visually-hidden",
|
|
218
|
+
children: `${t}: `
|
|
219
|
+
}), o.props.children] })), n;
|
|
220
|
+
}
|
|
221
|
+
function A({ children: e, onClick: t, expanded: n, nested: r = !1, current: i = !1, section: a = !1, muted: o = !1, tone: s, toneLabel: c, className: l, ...u }) {
|
|
222
|
+
let d = c ? k(e, c) : e, f = `select-table__row${t ? " select-table__row--clickable" : ""}${r ? " select-table__row--nested" : ""}${a ? " select-table__row--section" : ""}${o ? " select-table__row--muted" : ""}${s ? ` select-table__row--tone select-table__row--tone-${s}` : ""}${n ? " is-expanded" : ""}${i ? " is-current" : ""}${l ? " " + l : ""}`;
|
|
223
|
+
return t ? /* @__PURE__ */ b("div", {
|
|
224
|
+
...u,
|
|
225
|
+
className: f,
|
|
217
226
|
role: "row",
|
|
218
227
|
tabIndex: 0,
|
|
219
228
|
"aria-expanded": n,
|
|
220
229
|
"aria-current": i || void 0,
|
|
221
230
|
onClick: (e) => {
|
|
222
|
-
|
|
231
|
+
M(e.target, e.currentTarget) || t();
|
|
223
232
|
},
|
|
224
233
|
onKeyDown: (e) => {
|
|
225
234
|
e.target !== e.currentTarget || e.key !== "Enter" && e.key !== " " || (e.preventDefault(), t());
|
|
226
235
|
},
|
|
227
|
-
children:
|
|
228
|
-
}) : /* @__PURE__ */
|
|
229
|
-
...
|
|
230
|
-
className:
|
|
236
|
+
children: d
|
|
237
|
+
}) : /* @__PURE__ */ b("div", {
|
|
238
|
+
...u,
|
|
239
|
+
className: f,
|
|
231
240
|
role: "row",
|
|
232
241
|
"aria-current": i || void 0,
|
|
233
|
-
children:
|
|
242
|
+
children: d
|
|
234
243
|
});
|
|
235
244
|
}
|
|
236
|
-
var
|
|
237
|
-
function
|
|
245
|
+
var j = "button, a[href], input, select, textarea, label, summary, [role=\"button\"], [role=\"menuitem\"], [role=\"checkbox\"], [role=\"switch\"], [data-row-click=\"ignore\"]";
|
|
246
|
+
function M(e, t) {
|
|
238
247
|
if (!(e instanceof Element) || !t.contains(e)) return !0;
|
|
239
|
-
let n = e.closest(
|
|
248
|
+
let n = e.closest(j);
|
|
240
249
|
return n !== null && n !== t && t.contains(n);
|
|
241
250
|
}
|
|
242
|
-
var
|
|
243
|
-
let d =
|
|
244
|
-
return /* @__PURE__ */
|
|
251
|
+
var N = p(function({ children: e, align: n = "start", disclosure: r, header: i = !1, span: a, wrap: o = !1, className: s, style: c, ...l }, u) {
|
|
252
|
+
let d = g(E), f = a === "all" ? d || void 0 : a;
|
|
253
|
+
return /* @__PURE__ */ x("div", {
|
|
245
254
|
ref: u,
|
|
246
255
|
...l,
|
|
247
256
|
role: i ? "rowheader" : "cell",
|
|
@@ -251,14 +260,14 @@ var k = d(function({ children: e, align: n = "start", disclosure: r, header: i =
|
|
|
251
260
|
...c
|
|
252
261
|
} : c,
|
|
253
262
|
className: `select-table__td select-table__cell--${n}${o ? " select-table__td--wrap" : ""}${s ? " " + s : ""}`,
|
|
254
|
-
children: [r ? /* @__PURE__ */
|
|
263
|
+
children: [r ? /* @__PURE__ */ b("span", {
|
|
255
264
|
className: `select-table__disclosure${r === "open" ? " is-open" : ""}`,
|
|
256
265
|
"aria-hidden": "true",
|
|
257
|
-
children: r !== "none" && /* @__PURE__ */
|
|
266
|
+
children: r !== "none" && /* @__PURE__ */ b(t, {})
|
|
258
267
|
}) : null, e]
|
|
259
268
|
});
|
|
260
269
|
});
|
|
261
270
|
//#endregion
|
|
262
|
-
export {
|
|
271
|
+
export { D as SelectTable, N as SelectTableCell, c as SelectTableEmpty, A as SelectTableRow, O as SelectUserCell };
|
|
263
272
|
|
|
264
273
|
//# sourceMappingURL=SelectTable.js.map
|
package/dist/SelectTabs.d.ts
CHANGED
|
@@ -18,5 +18,15 @@ type SelectTabsOwnProps = {
|
|
|
18
18
|
panelId?: string;
|
|
19
19
|
};
|
|
20
20
|
export type SelectTabsProps = SelectTabsOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectTabsOwnProps>;
|
|
21
|
+
/**
|
|
22
|
+
* 0.1.259: as pontas da barra que escondem abas — `start` (há abas à esquerda), `end` (à direita), `both` ou `null`
|
|
23
|
+
* (tudo cabe). Um pixel de folga contra o arredondamento da rolagem. PURA.
|
|
24
|
+
*/
|
|
25
|
+
export declare function selectTabsOverflow(scrollLeft: number, scrollWidth: number, clientWidth: number): 'start' | 'end' | 'both' | null;
|
|
26
|
+
/**
|
|
27
|
+
* 0.1.259: até onde rolar para a aba [left, right) ficar à vista com um pedaço do vizinho; `null` quando ela já está à
|
|
28
|
+
* vista (ou tudo cabe). PURA.
|
|
29
|
+
*/
|
|
30
|
+
export declare function selectTabScrollTarget(left: number, right: number, scrollLeft: number, clientWidth: number, scrollWidth: number): number | null;
|
|
21
31
|
export declare function SelectTabs({ tabs, value, onChange, end, panelId, className, onKeyDown, ...rest }: SelectTabsProps): import("react").JSX.Element;
|
|
22
32
|
export {};
|
package/dist/SelectTabs.js
CHANGED
|
@@ -2,68 +2,106 @@ import { formatSelectNumber as e, useSelectLocale as t } from "./SelectLocale.js
|
|
|
2
2
|
import { useLayoutEffect as n, useRef as r, useState as i } from "react";
|
|
3
3
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
4
|
//#region src/SelectTabs.tsx
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
var s = 24;
|
|
6
|
+
function c(e, t, n) {
|
|
7
|
+
if (t - n <= 1) return null;
|
|
8
|
+
let r = e > 1, i = e + n < t - 1;
|
|
9
|
+
return r && i ? "both" : r ? "start" : i ? "end" : null;
|
|
10
|
+
}
|
|
11
|
+
function l(e, t, n, r, i) {
|
|
12
|
+
if (i - r <= 1) return null;
|
|
13
|
+
let a = i - r;
|
|
14
|
+
return e < n + s && n > 0 ? Math.max(0, Math.min(a, e - s)) : t > n + r - s && n < a ? Math.max(0, Math.min(a, t + s - r)) : null;
|
|
15
|
+
}
|
|
16
|
+
function u(e, t) {
|
|
17
|
+
var n, r;
|
|
18
|
+
let i = e.querySelector(".select-tab--active");
|
|
19
|
+
if (!i) return;
|
|
20
|
+
let a = i.offsetLeft, o = l(a, a + i.offsetWidth, e.scrollLeft, e.clientWidth, e.scrollWidth);
|
|
21
|
+
if (o === null) return;
|
|
22
|
+
let s = typeof window < "u" && ((n = (r = window).matchMedia) == null ? void 0 : n.call(r, "(prefers-reduced-motion: reduce)").matches);
|
|
23
|
+
t && !s && typeof e.scrollTo == "function" ? e.scrollTo({
|
|
24
|
+
left: o,
|
|
25
|
+
behavior: "smooth"
|
|
26
|
+
}) : e.scrollLeft = o;
|
|
27
|
+
}
|
|
28
|
+
function d({ tabs: s, value: l, onChange: d, end: f, panelId: p, className: m, onKeyDown: h, ...g }) {
|
|
29
|
+
let _ = t(), v = r(null), y = r([]), [b, x] = i({
|
|
7
30
|
left: 0,
|
|
8
31
|
width: 0
|
|
9
|
-
}),
|
|
32
|
+
}), S = s.findIndex((e) => e.id === l), C = s.map((e) => e.id).join("\0"), w = r(!1);
|
|
10
33
|
n(() => {
|
|
11
|
-
let e =
|
|
34
|
+
let e = v.current;
|
|
35
|
+
e && (u(e, w.current), w.current = !0);
|
|
36
|
+
}, [l, C]), n(() => {
|
|
37
|
+
let e = v.current;
|
|
38
|
+
if (!e) return;
|
|
39
|
+
let t = () => {
|
|
40
|
+
let t = c(e.scrollLeft, e.scrollWidth, e.clientWidth);
|
|
41
|
+
t ? e.setAttribute("data-overflow", t) : e.removeAttribute("data-overflow");
|
|
42
|
+
};
|
|
43
|
+
t(), e.addEventListener("scroll", t, { passive: !0 });
|
|
44
|
+
let n = typeof ResizeObserver < "u" ? new ResizeObserver(t) : null;
|
|
45
|
+
return n == null || n.observe(e), e.querySelectorAll(".select-tab").forEach((e) => n == null ? void 0 : n.observe(e)), () => {
|
|
46
|
+
e.removeEventListener("scroll", t), n == null || n.disconnect();
|
|
47
|
+
};
|
|
48
|
+
}, [s.length, C]), n(() => {
|
|
49
|
+
let e = v.current;
|
|
12
50
|
if (!e) return;
|
|
13
51
|
let t = () => {
|
|
14
52
|
let t = e.querySelector(".select-tab--active");
|
|
15
53
|
if (!t) {
|
|
16
|
-
|
|
54
|
+
x((e) => e.width === 0 ? e : {
|
|
17
55
|
left: e.left,
|
|
18
56
|
width: 0
|
|
19
57
|
});
|
|
20
58
|
return;
|
|
21
59
|
}
|
|
22
60
|
let n = t.offsetLeft, r = t.offsetWidth;
|
|
23
|
-
|
|
61
|
+
x((e) => e.left === n && e.width === r ? e : {
|
|
24
62
|
left: n,
|
|
25
63
|
width: r
|
|
26
64
|
});
|
|
27
65
|
};
|
|
28
66
|
t();
|
|
29
67
|
let n = typeof ResizeObserver < "u" ? new ResizeObserver(t) : null;
|
|
30
|
-
return n == null || n.observe(e),
|
|
68
|
+
return n == null || n.observe(e), y.current.forEach((e) => e && (n == null ? void 0 : n.observe(e))), () => n == null ? void 0 : n.disconnect();
|
|
31
69
|
}, [
|
|
32
|
-
|
|
70
|
+
l,
|
|
33
71
|
s.length,
|
|
34
|
-
|
|
72
|
+
C
|
|
35
73
|
]);
|
|
36
|
-
let
|
|
74
|
+
let T = (e) => {
|
|
37
75
|
var t;
|
|
38
|
-
if (
|
|
39
|
-
let n =
|
|
76
|
+
if (h == null || h(e), e.defaultPrevented || !s.length) return;
|
|
77
|
+
let n = y.current.findIndex((t) => t === e.target);
|
|
40
78
|
if (n < 0) return;
|
|
41
79
|
let r = s.length - 1, i = e.key === "ArrowRight" ? (n + 1) % s.length : e.key === "ArrowLeft" ? (n - 1 + s.length) % s.length : e.key === "Home" ? 0 : e.key === "End" ? r : -1;
|
|
42
|
-
i < 0 || (e.preventDefault(), (t =
|
|
43
|
-
},
|
|
44
|
-
"--tab-ind-left": `${
|
|
45
|
-
"--tab-ind-width": `${
|
|
80
|
+
i < 0 || (e.preventDefault(), (t = y.current[i]) == null || t.focus(), s[i].id !== l && d(s[i].id));
|
|
81
|
+
}, E = {
|
|
82
|
+
"--tab-ind-left": `${b.left}px`,
|
|
83
|
+
"--tab-ind-width": `${b.width}px`
|
|
46
84
|
};
|
|
47
85
|
return /* @__PURE__ */ o("div", {
|
|
48
|
-
...
|
|
49
|
-
className: `select-tabs${
|
|
86
|
+
...g,
|
|
87
|
+
className: `select-tabs${m ? " " + m : ""}`,
|
|
50
88
|
role: "tablist",
|
|
51
|
-
ref:
|
|
52
|
-
style:
|
|
53
|
-
onKeyDown:
|
|
89
|
+
ref: v,
|
|
90
|
+
style: E,
|
|
91
|
+
onKeyDown: T,
|
|
54
92
|
children: [s.map((t, n) => {
|
|
55
|
-
let r = t.id ===
|
|
93
|
+
let r = t.id === l;
|
|
56
94
|
return /* @__PURE__ */ o("button", {
|
|
57
95
|
ref: (e) => {
|
|
58
|
-
|
|
96
|
+
y.current[n] = e;
|
|
59
97
|
},
|
|
60
98
|
type: "button",
|
|
61
99
|
role: "tab",
|
|
62
100
|
"aria-selected": r,
|
|
63
|
-
"aria-controls":
|
|
64
|
-
tabIndex: r ||
|
|
101
|
+
"aria-controls": p,
|
|
102
|
+
tabIndex: r || S < 0 && n === 0 ? 0 : -1,
|
|
65
103
|
className: `select-tab${r ? " select-tab--active" : ""}`,
|
|
66
|
-
onClick: () =>
|
|
104
|
+
onClick: () => d(t.id),
|
|
67
105
|
children: [
|
|
68
106
|
t.dot && /* @__PURE__ */ a("span", {
|
|
69
107
|
className: `select-tab__dot select-tab__dot--${t.dot}`,
|
|
@@ -72,17 +110,17 @@ function s({ tabs: s, value: c, onChange: l, end: u, panelId: d, className: f, o
|
|
|
72
110
|
t.label,
|
|
73
111
|
t.count !== void 0 && /* @__PURE__ */ a("span", {
|
|
74
112
|
className: "select-tab__count",
|
|
75
|
-
children: e(t.count,
|
|
113
|
+
children: e(t.count, _)
|
|
76
114
|
})
|
|
77
115
|
]
|
|
78
116
|
}, t.id);
|
|
79
|
-
}),
|
|
117
|
+
}), f != null && /* @__PURE__ */ a("div", {
|
|
80
118
|
className: "select-tabs__end",
|
|
81
|
-
children:
|
|
119
|
+
children: f
|
|
82
120
|
})]
|
|
83
121
|
});
|
|
84
122
|
}
|
|
85
123
|
//#endregion
|
|
86
|
-
export {
|
|
124
|
+
export { d as SelectTabs, l as selectTabScrollTarget, c as selectTabsOverflow };
|
|
87
125
|
|
|
88
126
|
//# sourceMappingURL=SelectTabs.js.map
|
package/dist/SelectTimeline.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export interface SelectTimelineItem {
|
|
|
8
8
|
tone?: SelectTimelineTone;
|
|
9
9
|
/** Selo ao lado do título. */
|
|
10
10
|
badge?: ReactNode;
|
|
11
|
+
/** 0.1.258: o ícone do marcador (o tipo do evento), no lugar do ponto, no tom do evento. */
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
/** 0.1.258: o tipo do evento para o leitor de tela, antes do título ("Ligação"). O ícone fica fora da leitura. */
|
|
14
|
+
iconLabel?: string;
|
|
11
15
|
}
|
|
12
16
|
type SelectTimelineOwnProps = {
|
|
13
17
|
items: SelectTimelineItem[];
|
package/dist/SelectTimeline.js
CHANGED
|
@@ -19,22 +19,26 @@ var r = {
|
|
|
19
19
|
let f = {
|
|
20
20
|
"--tl-final": r[e.length ? ((d = e[0]) == null ? void 0 : d.tone) ?? "default" : "default"],
|
|
21
21
|
...c
|
|
22
|
-
}, p = a === "each", m = o === "start";
|
|
22
|
+
}, p = a === "each", m = o === "start", h = e.some((e) => e.icon != null && e.icon !== !1);
|
|
23
23
|
return /* @__PURE__ */ t("ul", {
|
|
24
24
|
ref: u,
|
|
25
25
|
...l,
|
|
26
|
-
className: `select-timeline${p ? " select-timeline--each" : ""}${m ? " select-timeline--timestart" : ""}${s ? " " + s : ""}`,
|
|
26
|
+
className: `select-timeline${p ? " select-timeline--each" : ""}${m ? " select-timeline--timestart" : ""}${h ? " select-timeline--icons" : ""}${s ? " " + s : ""}`,
|
|
27
27
|
style: f,
|
|
28
28
|
children: e.map((e, r) => {
|
|
29
|
-
let a = !p && r === 0, o = p ? { "--tl-dot": i[e.tone ?? "default"] } : void 0;
|
|
29
|
+
let a = !p && r === 0, o = p ? { "--tl-dot": i[e.tone ?? "default"] } : void 0, s = e.icon != null && e.icon !== !1;
|
|
30
30
|
return /* @__PURE__ */ n("li", {
|
|
31
|
-
className: "select-timeline__item"
|
|
31
|
+
className: `select-timeline__item${s ? " select-timeline__item--icon" : ""}`,
|
|
32
32
|
children: [
|
|
33
33
|
m && e.timestamp != null && /* @__PURE__ */ t("span", {
|
|
34
34
|
className: "select-timeline__when",
|
|
35
35
|
children: e.timestamp
|
|
36
36
|
}),
|
|
37
|
-
/* @__PURE__ */ t("span", {
|
|
37
|
+
s ? /* @__PURE__ */ t("span", {
|
|
38
|
+
className: `select-timeline__marker select-timeline__marker--${e.tone ?? "default"}`,
|
|
39
|
+
"aria-hidden": "true",
|
|
40
|
+
children: e.icon
|
|
41
|
+
}) : /* @__PURE__ */ t("span", {
|
|
38
42
|
className: `select-timeline__dot${a ? " select-timeline__dot--final" : ""}${p ? " select-timeline__dot--toned" : ""}`,
|
|
39
43
|
style: o,
|
|
40
44
|
"aria-hidden": "true"
|
|
@@ -46,10 +50,17 @@ var r = {
|
|
|
46
50
|
className: "select-timeline__head",
|
|
47
51
|
children: [/* @__PURE__ */ n("span", {
|
|
48
52
|
className: "select-timeline__title",
|
|
49
|
-
children: [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
children: [
|
|
54
|
+
e.iconLabel ? /* @__PURE__ */ t("span", {
|
|
55
|
+
className: "select-visually-hidden",
|
|
56
|
+
children: `${e.iconLabel}: `
|
|
57
|
+
}) : null,
|
|
58
|
+
e.title,
|
|
59
|
+
e.badge != null && /* @__PURE__ */ t("span", {
|
|
60
|
+
className: "select-timeline__badge",
|
|
61
|
+
children: e.badge
|
|
62
|
+
})
|
|
63
|
+
]
|
|
53
64
|
}), !m && e.timestamp != null && /* @__PURE__ */ t("span", {
|
|
54
65
|
className: "select-timeline__time",
|
|
55
66
|
children: e.timestamp
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SelectLocaleCode } from './SelectLocale';
|
|
3
|
+
export type SelectWeekday = 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';
|
|
4
|
+
/** Uma faixa do dia, em `HH:MM` (o fim pode ser `24:00`, o fim do dia). */
|
|
5
|
+
export interface SelectTimeRange {
|
|
6
|
+
from: string;
|
|
7
|
+
to: string;
|
|
8
|
+
}
|
|
9
|
+
/** O horário da semana: as faixas de cada dia; o dia ausente (ou vazio) é fechado. */
|
|
10
|
+
export type SelectWeekHoursValue = Partial<Record<SelectWeekday, readonly SelectTimeRange[]>>;
|
|
11
|
+
/** Uma data a mais (o municipal, o ponto facultativo): `YYYY-MM-DD` e o nome. */
|
|
12
|
+
export interface SelectHoliday {
|
|
13
|
+
date: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
16
|
+
/** O problema de um dia: a faixa sem as duas horas, a que termina antes de começar, as que se cruzam, as faixas demais. */
|
|
17
|
+
export type SelectWeekHoursProblem = 'empty' | 'order' | 'overlap' | 'many';
|
|
18
|
+
export declare const SELECT_WEEKDAYS: readonly SelectWeekday[];
|
|
19
|
+
/** `HH:MM` em minutos do dia; `null` quando não é uma hora. PURA. */
|
|
20
|
+
export declare function selectTimeMinutes(hhmm: string): number | null;
|
|
21
|
+
/** Os dias na ordem da tela: a semana começa na segunda (o padrão) ou no domingo. PURA. */
|
|
22
|
+
export declare function selectWeekOrder(weekStart?: 'mon' | 'sun'): SelectWeekday[];
|
|
23
|
+
/**
|
|
24
|
+
* Os problemas de cada dia (só os dias com problema aparecem), as mesmas regras do horário da API: as duas horas em
|
|
25
|
+
* `HH:MM`, o fim depois do começo, nada cruzando e até `max` faixas (padrão 6). PURA.
|
|
26
|
+
*/
|
|
27
|
+
export declare function selectWeekHoursProblems(value: SelectWeekHoursValue, max?: number): Partial<Record<SelectWeekday, SelectWeekHoursProblem>>;
|
|
28
|
+
/** O horário de `from` copiado para os outros dias (`to`); os outros ficam como estavam. PURA. */
|
|
29
|
+
export declare function selectCopyDay(value: SelectWeekHoursValue, from: SelectWeekday, to: readonly SelectWeekday[]): SelectWeekHoursValue;
|
|
30
|
+
/** A faixa nova depois das de um dia: uma hora depois da última, por quatro horas (até o fim do dia); `null` sem lugar. PURA. */
|
|
31
|
+
export declare function selectNextRange(ranges: readonly SelectTimeRange[], fallback: SelectTimeRange): SelectTimeRange | null;
|
|
32
|
+
/**
|
|
33
|
+
* A semana como texto, agrupando os dias seguidos com o mesmo horário: `[{ days: 'Segunda a sexta', hours: '08:00 às
|
|
34
|
+
* 12:00, 13:00 às 18:00' }, { days: 'Sábado e domingo', hours: 'Fechado' }]`. PURA (a língua do kit).
|
|
35
|
+
*/
|
|
36
|
+
export declare function selectWeekHoursLines(value: SelectWeekHoursValue, locale?: SelectLocaleCode, weekStart?: 'mon' | 'sun'): Array<{
|
|
37
|
+
days: string;
|
|
38
|
+
hours: string;
|
|
39
|
+
}>;
|
|
40
|
+
export interface SelectWeekHoursProps {
|
|
41
|
+
/** As faixas de cada dia; o dia ausente (ou vazio) é fechado. */
|
|
42
|
+
value: SelectWeekHoursValue;
|
|
43
|
+
/** O horário novo, a cada mudança (inclusive com problema: quem grava confere com `selectWeekHoursProblems`). */
|
|
44
|
+
onChange: (next: SelectWeekHoursValue) => void;
|
|
45
|
+
/** As datas a mais (o municipal, o ponto facultativo). Com `onHolidaysChange`, a seção dos feriados aparece. */
|
|
46
|
+
holidays?: readonly SelectHoliday[];
|
|
47
|
+
onHolidaysChange?: (next: SelectHoliday[]) => void;
|
|
48
|
+
/** No topo da seção dos feriados: o que vale sempre (os nacionais, a UF, o município) — o app desenha. */
|
|
49
|
+
holidaysNote?: ReactNode;
|
|
50
|
+
/** A semana começa na segunda (o padrão) ou no domingo. */
|
|
51
|
+
weekStart?: 'mon' | 'sun';
|
|
52
|
+
/** A faixa do dia que abre sem faixa guardada (padrão das 08:00 às 18:00). */
|
|
53
|
+
defaultRange?: SelectTimeRange;
|
|
54
|
+
/** O teto de faixas por dia (padrão 6, o da API do CRM). */
|
|
55
|
+
maxRanges?: number;
|
|
56
|
+
/** Só para ler: a semana como texto (os dias seguidos com o mesmo horário juntos), sem os campos. */
|
|
57
|
+
readOnly?: boolean;
|
|
58
|
+
/** Tudo apagado (enquanto grava). */
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
/** O nome do editor (padrão "Horário da semana"): a legenda do grupo, para o leitor de tela. */
|
|
61
|
+
label?: string;
|
|
62
|
+
className?: string;
|
|
63
|
+
}
|
|
64
|
+
export declare function SelectWeekHours({ value, onChange, holidays, onHolidaysChange, holidaysNote, weekStart, defaultRange, maxRanges, readOnly, disabled, label, className, }: SelectWeekHoursProps): import("react").JSX.Element;
|