@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.
- package/README.md +31 -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/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 +9 -1
- package/dist/SelectMail.js +234 -207
- package/dist/SelectSection.d.ts +4 -4
- package/dist/SelectSection.js +77 -8
- 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/SelectWeekHours.d.ts +64 -0
- package/dist/SelectWeekHours.js +338 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.js +188 -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/style.css +1 -1
- package/package.json +1 -1
package/dist/SelectSection.d.ts
CHANGED
|
@@ -2,15 +2,15 @@ import { ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
|
2
2
|
import { SelectHeadingLevel } from './internal/headingLevel';
|
|
3
3
|
type SelectSectionOwnProps = {
|
|
4
4
|
title?: ReactNode;
|
|
5
|
-
/** Ajuda contextual: vira o "!" ao lado do título (SelectInfoTip).
|
|
6
|
-
*
|
|
7
|
-
* inválido. */
|
|
5
|
+
/** Ajuda contextual: vira o "!" ao lado do título (SelectInfoTip). 0.1.259: também na que recolhe — o cabeçalho dela
|
|
6
|
+
* passa a ser um título com o botão que abre e fecha dentro (botão dentro de botão é DOM inválido). */
|
|
8
7
|
help?: ReactNode;
|
|
9
8
|
/** Subdued line under the title (e.g. the step subtitle of a wizard card). Collapsible too:
|
|
10
9
|
* there it is the SUMMARY of what is inside ("Liberação imediata · conclui com 90%"), so the
|
|
11
10
|
* closed card still says what it holds. */
|
|
12
11
|
description?: ReactNode;
|
|
13
|
-
/** Right-aligned action in the head (e.g. an "Editar" link).
|
|
12
|
+
/** Right-aligned action in the head (e.g. an "Editar" link). 0.1.259: também na que recolhe ("Mudar"), à direita, antes
|
|
13
|
+
* da seta; o clique nela é dela (não abre nem fecha). */
|
|
14
14
|
action?: ReactNode;
|
|
15
15
|
/** Make the head a button that expands/collapses the body. */
|
|
16
16
|
collapsible?: boolean;
|
package/dist/SelectSection.js
CHANGED
|
@@ -3,15 +3,84 @@ import { ChevronDownIcon as e } from "./icons.js";
|
|
|
3
3
|
import { SelectInfoTip as t } from "./SelectInfoTip.js";
|
|
4
4
|
import { registerSheetFrame as n } from "./internal/sheetBands.js";
|
|
5
5
|
import { FrameBody as r, useInsideFrame as i } from "./internal/frame.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { inertProps as a } from "./internal/inert.js";
|
|
7
|
+
import { HeadingScope as o, SelectHeading as s, nextHeadingLevel as c, useHeadingLevel as l } from "./internal/headingLevel.js";
|
|
8
8
|
import { forwardRef as u, useId as d, useState as f } from "react";
|
|
9
9
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
10
10
|
//#region src/SelectSection.tsx
|
|
11
11
|
var h = u(function({ title: n, help: u, description: h, action: g, collapsible: _ = !1, defaultOpen: v = !0, open: y, onOpenChange: b, footer: x, flush: S = !1, list: C = !1, headingLevel: w, children: T, className: E, ...D }, O) {
|
|
12
|
-
let k =
|
|
12
|
+
let k = l(w), [A, j] = f(v), M = y ?? A, N = d(), P = () => {
|
|
13
13
|
y === void 0 && j(!M), b == null || b(!M);
|
|
14
14
|
}, F = (i() ? " select-section--nested" : "") + (S ? " select-section--flush" : "") + (C ? " select-section--list" : ""), I = C ? "list" : "body";
|
|
15
|
+
if (_ && (u != null && u !== "" || g != null && g !== !1)) {
|
|
16
|
+
let i = (e) => {
|
|
17
|
+
let t = e.currentTarget, n = e.target;
|
|
18
|
+
if (!(n instanceof Element) || !t.contains(n)) return;
|
|
19
|
+
let r = n.closest("button, a[href], input, select, textarea, label, summary, [role=\"button\"], [tabindex]");
|
|
20
|
+
r && r !== t && t.contains(r) || P();
|
|
21
|
+
};
|
|
22
|
+
return /* @__PURE__ */ m("div", {
|
|
23
|
+
ref: O,
|
|
24
|
+
...D,
|
|
25
|
+
className: `select-section select-section--collapsible select-section--split${F}${M ? " is-open" : ""}${E ? " " + E : ""}`,
|
|
26
|
+
children: [/* @__PURE__ */ m("div", {
|
|
27
|
+
className: "select-section__head select-section__head--split",
|
|
28
|
+
onClick: i,
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ m("div", {
|
|
31
|
+
className: "select-section__heading",
|
|
32
|
+
children: [/* @__PURE__ */ m(s, {
|
|
33
|
+
level: k,
|
|
34
|
+
className: `select-section__title${u != null && u !== "" ? " select-section__title--help" : ""}`,
|
|
35
|
+
children: [/* @__PURE__ */ p("button", {
|
|
36
|
+
type: "button",
|
|
37
|
+
className: "select-section__toggle",
|
|
38
|
+
"aria-expanded": M,
|
|
39
|
+
"aria-controls": N,
|
|
40
|
+
"aria-describedby": h ? `${N}-desc` : void 0,
|
|
41
|
+
onClick: P,
|
|
42
|
+
children: n
|
|
43
|
+
}), u != null && u !== "" && /* @__PURE__ */ p(t, { content: u })]
|
|
44
|
+
}), h && /* @__PURE__ */ p("p", {
|
|
45
|
+
id: `${N}-desc`,
|
|
46
|
+
className: "select-section__desc",
|
|
47
|
+
children: h
|
|
48
|
+
})]
|
|
49
|
+
}),
|
|
50
|
+
g != null && g !== !1 ? /* @__PURE__ */ p("div", {
|
|
51
|
+
className: "select-section__action",
|
|
52
|
+
children: g
|
|
53
|
+
}) : null,
|
|
54
|
+
/* @__PURE__ */ p("span", {
|
|
55
|
+
className: "select-section__chevron",
|
|
56
|
+
"aria-hidden": "true",
|
|
57
|
+
children: /* @__PURE__ */ p(e, {})
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
}), /* @__PURE__ */ p("div", {
|
|
61
|
+
id: N,
|
|
62
|
+
className: "select-section__collapse",
|
|
63
|
+
"data-open": M,
|
|
64
|
+
...a(!M),
|
|
65
|
+
children: /* @__PURE__ */ m("div", {
|
|
66
|
+
className: "select-section__collapsewrap",
|
|
67
|
+
children: [/* @__PURE__ */ p("div", {
|
|
68
|
+
className: "select-section__body",
|
|
69
|
+
children: /* @__PURE__ */ p(o, {
|
|
70
|
+
level: c(k),
|
|
71
|
+
children: /* @__PURE__ */ p(r, {
|
|
72
|
+
kind: I,
|
|
73
|
+
children: T
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
}), x != null && x !== "" && /* @__PURE__ */ p("div", {
|
|
77
|
+
className: "select-section__foot",
|
|
78
|
+
children: x
|
|
79
|
+
})]
|
|
80
|
+
})
|
|
81
|
+
})]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
15
84
|
return _ ? /* @__PURE__ */ m("div", {
|
|
16
85
|
ref: O,
|
|
17
86
|
...D,
|
|
@@ -40,12 +109,12 @@ var h = u(function({ title: n, help: u, description: h, action: g, collapsible:
|
|
|
40
109
|
id: N,
|
|
41
110
|
className: "select-section__collapse",
|
|
42
111
|
"data-open": M,
|
|
43
|
-
...
|
|
112
|
+
...a(!M),
|
|
44
113
|
children: /* @__PURE__ */ m("div", {
|
|
45
114
|
className: "select-section__collapsewrap",
|
|
46
115
|
children: [/* @__PURE__ */ p("div", {
|
|
47
116
|
className: "select-section__body",
|
|
48
|
-
children: /* @__PURE__ */ p(
|
|
117
|
+
children: /* @__PURE__ */ p(o, {
|
|
49
118
|
level: k,
|
|
50
119
|
children: /* @__PURE__ */ p(r, {
|
|
51
120
|
kind: I,
|
|
@@ -67,7 +136,7 @@ var h = u(function({ title: n, help: u, description: h, action: g, collapsible:
|
|
|
67
136
|
className: "select-section__head",
|
|
68
137
|
children: [/* @__PURE__ */ m("div", {
|
|
69
138
|
className: "select-section__heading",
|
|
70
|
-
children: [n && /* @__PURE__ */ m(
|
|
139
|
+
children: [n && /* @__PURE__ */ m(s, {
|
|
71
140
|
level: k,
|
|
72
141
|
className: `select-section__title${u == null ? "" : " select-section__title--help"}`,
|
|
73
142
|
children: [n, u != null && /* @__PURE__ */ p(t, { content: u })]
|
|
@@ -82,8 +151,8 @@ var h = u(function({ title: n, help: u, description: h, action: g, collapsible:
|
|
|
82
151
|
}),
|
|
83
152
|
/* @__PURE__ */ p("div", {
|
|
84
153
|
className: "select-section__body",
|
|
85
|
-
children: /* @__PURE__ */ p(
|
|
86
|
-
level: n ?
|
|
154
|
+
children: /* @__PURE__ */ p(o, {
|
|
155
|
+
level: n ? c(k) : k,
|
|
87
156
|
children: /* @__PURE__ */ p(r, {
|
|
88
157
|
kind: I,
|
|
89
158
|
children: T
|
package/dist/SelectTable.d.ts
CHANGED
|
@@ -138,9 +138,21 @@ type SelectTableRowOwnProps = {
|
|
|
138
138
|
* chave, o menu) fica cheia.
|
|
139
139
|
*/
|
|
140
140
|
muted?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* 0.1.259: o tom da linha (o chamado vencido): a borda da esquerda no tom. A cor não diz sozinha: o estado à vista
|
|
143
|
+
* (o ícone e o texto, o `SelectDeadlineBadge variant="text"`) vai numa célula, e o `toneLabel` o diz ao leitor de tela.
|
|
144
|
+
*/
|
|
145
|
+
tone?: SelectTableRowTone;
|
|
146
|
+
/**
|
|
147
|
+
* 0.1.259: o tom em palavras ("Vencido"), para o leitor de tela: entra fora da vista no começo da célula de cabeçalho
|
|
148
|
+
* da linha (`header`), ou da primeira célula sem ela.
|
|
149
|
+
*/
|
|
150
|
+
toneLabel?: string;
|
|
141
151
|
};
|
|
142
152
|
export type SelectTableRowProps = SelectTableRowOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectTableRowOwnProps | 'role'>;
|
|
143
|
-
|
|
153
|
+
/** 0.1.259: os tons da linha (a borda da esquerda): o vencido, o perto de vencer, o cumprido e o de informação. */
|
|
154
|
+
export type SelectTableRowTone = 'critical' | 'warning' | 'success' | 'info';
|
|
155
|
+
export declare function SelectTableRow({ children: childrenProp, onClick, expanded, nested, current, section, muted, tone, toneLabel, className, ...rest }: SelectTableRowProps): import("react").JSX.Element;
|
|
144
156
|
type SelectTableCellOwnProps = {
|
|
145
157
|
children: ReactNode;
|
|
146
158
|
align?: 'start' | 'end' | 'center';
|
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
|