@selectwin/kit 0.1.212 → 0.1.214
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/dist/SelectFilterBar.js +141 -132
- package/dist/SelectSection.d.ts +5 -0
- package/dist/SelectSection.js +24 -18
- package/dist/SelectTable.d.ts +39 -2
- package/dist/SelectTable.js +145 -103
- package/dist/internal/frame.d.ts +11 -2
- package/dist/internal/frame.js +6 -3
- package/dist/internal/listChrome.js +54 -49
- package/dist/internal/optionList.d.ts +3 -0
- package/dist/internal/optionList.js +29 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/SelectFilterBar.js
CHANGED
|
@@ -3,137 +3,142 @@ import { useSelectMessages as a } from "./SelectLocale.js";
|
|
|
3
3
|
import { SelectField as o } from "./SelectField.js";
|
|
4
4
|
import { SelectPopover as s } from "./SelectPopover.js";
|
|
5
5
|
import { SelectSearchInput as c } from "./SelectSearchInput.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { moveInOptions as l, useOptionListFocus as u } from "./internal/optionList.js";
|
|
7
|
+
import { SelectDateField as d } from "./SelectDateField.js";
|
|
8
|
+
import { formatDateValue as f } from "./internal/dateValue.js";
|
|
9
|
+
import { forwardRef as p, useEffect as m, useRef as h, useState as g } from "react";
|
|
10
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
10
11
|
//#region src/SelectFilterBar.tsx
|
|
11
|
-
function
|
|
12
|
+
function y(e) {
|
|
12
13
|
return (e ?? "").split(",").map((e) => e.trim()).filter(Boolean);
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function b(e, t) {
|
|
15
16
|
let n = new Set(e);
|
|
16
17
|
return (t ? t.map((e) => e.value).filter((e) => n.has(e)) : [...n]).join(",");
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
+
function x(e, t) {
|
|
19
20
|
var n;
|
|
20
21
|
if (e.type === "select") return ((n = e.options) == null || (n = n.find((e) => e.value === t)) == null ? void 0 : n.label) ?? t;
|
|
21
22
|
if (e.type === "multiselect") {
|
|
22
|
-
let n =
|
|
23
|
+
let n = y(t).map((t) => {
|
|
23
24
|
var n;
|
|
24
25
|
return ((n = e.options) == null || (n = n.find((e) => e.value === t)) == null ? void 0 : n.label) ?? t;
|
|
25
26
|
});
|
|
26
27
|
return n.length > 2 ? `${n[0]} +${n.length - 1}` : n.join(", ");
|
|
27
28
|
}
|
|
28
|
-
return e.type === "date" ?
|
|
29
|
+
return e.type === "date" ? f(t) ?? t : t;
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
let
|
|
32
|
-
f(() => {
|
|
33
|
-
|
|
34
|
-
}, [
|
|
35
|
-
let
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
-
active:
|
|
38
|
-
onClose:
|
|
31
|
+
function S({ filter: n, value: r, onChange: i, open: f, onToggle: p, onClose: S, disabled: C }) {
|
|
32
|
+
let w = a(), [T, E] = g(""), D = h(null);
|
|
33
|
+
u(f && (n.type === "select" || n.type === "multiselect"), D), m(() => {
|
|
34
|
+
f || E("");
|
|
35
|
+
}, [f]);
|
|
36
|
+
let O = r.trim() !== "", k = O ? x(n, r) : null, A = O && !!n.error, j = n.options ?? [], M = j.length > 7, N = M ? j.filter((e) => e.label.toLowerCase().includes(T.trim().toLowerCase())) : j;
|
|
37
|
+
return /* @__PURE__ */ v(s, {
|
|
38
|
+
active: f,
|
|
39
|
+
onClose: S,
|
|
39
40
|
placement: "bottom-start",
|
|
40
|
-
activator: /* @__PURE__ */
|
|
41
|
+
activator: /* @__PURE__ */ v("button", {
|
|
41
42
|
type: "button",
|
|
42
|
-
className: `select-facet${
|
|
43
|
-
onClick:
|
|
44
|
-
disabled:
|
|
45
|
-
"aria-expanded":
|
|
46
|
-
"aria-invalid":
|
|
47
|
-
title:
|
|
48
|
-
children: [/* @__PURE__ */
|
|
43
|
+
className: `select-facet${O ? " is-active" : ""}${A ? " is-error" : ""}`,
|
|
44
|
+
onClick: p,
|
|
45
|
+
disabled: C,
|
|
46
|
+
"aria-expanded": f,
|
|
47
|
+
"aria-invalid": A || void 0,
|
|
48
|
+
title: A ? n.error : void 0,
|
|
49
|
+
children: [/* @__PURE__ */ _("span", {
|
|
49
50
|
className: "select-facet__label",
|
|
50
|
-
children:
|
|
51
|
-
}), /* @__PURE__ */
|
|
52
|
-
className: `select-facet__caret${
|
|
51
|
+
children: k == null ? n.label : `${n.label}: ${k}`
|
|
52
|
+
}), /* @__PURE__ */ _("span", {
|
|
53
|
+
className: `select-facet__caret${f ? " is-open" : ""}`,
|
|
53
54
|
"aria-hidden": "true",
|
|
54
|
-
children: /* @__PURE__ */
|
|
55
|
+
children: /* @__PURE__ */ _(t, {})
|
|
55
56
|
})]
|
|
56
57
|
}),
|
|
57
58
|
children: [
|
|
58
|
-
n.type === "multiselect" ? /* @__PURE__ */
|
|
59
|
+
n.type === "multiselect" ? /* @__PURE__ */ v("div", {
|
|
59
60
|
className: "select-facet__panel",
|
|
60
|
-
|
|
61
|
+
ref: D,
|
|
62
|
+
onKeyDown: l,
|
|
63
|
+
children: [M && /* @__PURE__ */ _("div", {
|
|
61
64
|
className: "select-facet__search",
|
|
62
|
-
children: /* @__PURE__ */
|
|
63
|
-
value:
|
|
64
|
-
onChange:
|
|
65
|
-
placeholder:
|
|
65
|
+
children: /* @__PURE__ */ _(c, {
|
|
66
|
+
value: T,
|
|
67
|
+
onChange: E,
|
|
68
|
+
placeholder: w.filterBar.searchOption
|
|
66
69
|
})
|
|
67
|
-
}), /* @__PURE__ */
|
|
70
|
+
}), /* @__PURE__ */ _("div", {
|
|
68
71
|
className: "select-facet__options",
|
|
69
72
|
role: "listbox",
|
|
70
73
|
"aria-multiselectable": "true",
|
|
71
|
-
children:
|
|
74
|
+
children: N.length === 0 ? /* @__PURE__ */ _("div", {
|
|
72
75
|
className: "select-facet__empty",
|
|
73
|
-
children:
|
|
74
|
-
}) :
|
|
75
|
-
let n =
|
|
76
|
-
return /* @__PURE__ */
|
|
76
|
+
children: w.common.nothingFound
|
|
77
|
+
}) : N.map((t) => {
|
|
78
|
+
let n = y(r), a = n.includes(t.value);
|
|
79
|
+
return /* @__PURE__ */ v("button", {
|
|
77
80
|
type: "button",
|
|
78
81
|
role: "option",
|
|
79
82
|
"aria-selected": a,
|
|
80
83
|
className: "select-facet__opt",
|
|
81
|
-
onClick: () => i(
|
|
82
|
-
children: [/* @__PURE__ */
|
|
84
|
+
onClick: () => i(b(a ? n.filter((e) => e !== t.value) : [...n, t.value], j)),
|
|
85
|
+
children: [/* @__PURE__ */ _("span", { children: t.label }), a && /* @__PURE__ */ _("span", {
|
|
83
86
|
className: "select-facet__check",
|
|
84
87
|
"aria-hidden": "true",
|
|
85
|
-
children: /* @__PURE__ */
|
|
88
|
+
children: /* @__PURE__ */ _(e, {})
|
|
86
89
|
})]
|
|
87
90
|
}, t.value);
|
|
88
91
|
})
|
|
89
92
|
})]
|
|
90
|
-
}) : n.type === "select" ? /* @__PURE__ */
|
|
93
|
+
}) : n.type === "select" ? /* @__PURE__ */ v("div", {
|
|
91
94
|
className: "select-facet__panel",
|
|
92
|
-
|
|
95
|
+
ref: D,
|
|
96
|
+
onKeyDown: l,
|
|
97
|
+
children: [M && /* @__PURE__ */ _("div", {
|
|
93
98
|
className: "select-facet__search",
|
|
94
|
-
children: /* @__PURE__ */
|
|
95
|
-
value:
|
|
96
|
-
onChange:
|
|
97
|
-
placeholder:
|
|
99
|
+
children: /* @__PURE__ */ _(c, {
|
|
100
|
+
value: T,
|
|
101
|
+
onChange: E,
|
|
102
|
+
placeholder: w.filterBar.searchOption
|
|
98
103
|
})
|
|
99
|
-
}), /* @__PURE__ */
|
|
104
|
+
}), /* @__PURE__ */ _("div", {
|
|
100
105
|
className: "select-facet__options",
|
|
101
106
|
role: "listbox",
|
|
102
|
-
children:
|
|
107
|
+
children: N.length === 0 ? /* @__PURE__ */ _("div", {
|
|
103
108
|
className: "select-facet__empty",
|
|
104
|
-
children:
|
|
105
|
-
}) :
|
|
109
|
+
children: w.common.nothingFound
|
|
110
|
+
}) : N.map((t) => {
|
|
106
111
|
let n = r === t.value;
|
|
107
|
-
return /* @__PURE__ */
|
|
112
|
+
return /* @__PURE__ */ v("button", {
|
|
108
113
|
type: "button",
|
|
109
114
|
role: "option",
|
|
110
115
|
"aria-selected": n,
|
|
111
116
|
className: `select-facet__opt${n ? " is-selected" : ""}`,
|
|
112
117
|
onClick: () => {
|
|
113
|
-
i(n ? "" : t.value),
|
|
118
|
+
i(n ? "" : t.value), S();
|
|
114
119
|
},
|
|
115
|
-
children: [/* @__PURE__ */
|
|
120
|
+
children: [/* @__PURE__ */ _("span", { children: t.label }), n && /* @__PURE__ */ _("span", {
|
|
116
121
|
className: "select-facet__check",
|
|
117
122
|
"aria-hidden": "true",
|
|
118
|
-
children: /* @__PURE__ */
|
|
123
|
+
children: /* @__PURE__ */ _(e, {})
|
|
119
124
|
})]
|
|
120
125
|
}, t.value);
|
|
121
126
|
})
|
|
122
127
|
})]
|
|
123
|
-
}) : n.type === "date" ? /* @__PURE__ */
|
|
128
|
+
}) : n.type === "date" ? /* @__PURE__ */ _("div", {
|
|
124
129
|
className: "select-facet__field",
|
|
125
|
-
children: /* @__PURE__ */
|
|
130
|
+
children: /* @__PURE__ */ _(d, {
|
|
126
131
|
value: r,
|
|
127
132
|
onChange: i,
|
|
128
133
|
placeholder: n.placeholder,
|
|
129
134
|
clearable: !1
|
|
130
135
|
})
|
|
131
|
-
}) : /* @__PURE__ */
|
|
136
|
+
}) : /* @__PURE__ */ _("div", {
|
|
132
137
|
className: "select-facet__field",
|
|
133
138
|
onKeyDown: (e) => {
|
|
134
|
-
e.key === "Enter" && (e.preventDefault(),
|
|
139
|
+
e.key === "Enter" && (e.preventDefault(), S());
|
|
135
140
|
},
|
|
136
|
-
children: /* @__PURE__ */
|
|
141
|
+
children: /* @__PURE__ */ _(o, {
|
|
137
142
|
type: "text",
|
|
138
143
|
value: r,
|
|
139
144
|
onChange: i,
|
|
@@ -141,152 +146,156 @@ function y({ filter: n, value: r, onChange: i, open: u, onToggle: d, onClose: y,
|
|
|
141
146
|
autoFocus: !0
|
|
142
147
|
})
|
|
143
148
|
}),
|
|
144
|
-
|
|
149
|
+
A && /* @__PURE__ */ _("div", {
|
|
145
150
|
className: "select-facet__error",
|
|
146
151
|
role: "alert",
|
|
147
152
|
children: n.error
|
|
148
153
|
}),
|
|
149
|
-
|
|
154
|
+
O && /* @__PURE__ */ _("div", {
|
|
150
155
|
className: "select-facet__foot",
|
|
151
|
-
children: /* @__PURE__ */
|
|
156
|
+
children: /* @__PURE__ */ _("button", {
|
|
152
157
|
type: "button",
|
|
153
158
|
className: "select-facet__clear",
|
|
154
159
|
onClick: () => {
|
|
155
|
-
i(""),
|
|
160
|
+
i(""), S();
|
|
156
161
|
},
|
|
157
|
-
children:
|
|
162
|
+
children: w.filterBar.clear
|
|
158
163
|
})
|
|
159
164
|
})
|
|
160
165
|
]
|
|
161
166
|
});
|
|
162
167
|
}
|
|
163
|
-
var
|
|
164
|
-
let
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
+
var C = p(function({ filters: e, values: t, onChange: o, onClearAll: c, search: d, leading: f, disabled: p, className: m, ...y }, b) {
|
|
169
|
+
let C = a(), [w, T] = g([]), [E, D] = g(null), [O, k] = g(!1), A = h(null);
|
|
170
|
+
u(O, A);
|
|
171
|
+
let j = (e) => (t[e.key] ?? "").trim() !== "", M = (e) => !!e.pinned || j(e) || w.includes(e.key), N = e.filter(M), P = e.filter((e) => !M(e)), F = e.filter(j), I = () => {
|
|
172
|
+
T([]), D(null), c();
|
|
173
|
+
}, L = (e) => {
|
|
174
|
+
T((t) => t.includes(e) ? t : [...t, e]), k(!1), D(e);
|
|
168
175
|
};
|
|
169
|
-
return /* @__PURE__ */
|
|
170
|
-
ref:
|
|
171
|
-
...
|
|
172
|
-
className: `select-filterbar${
|
|
176
|
+
return /* @__PURE__ */ v("div", {
|
|
177
|
+
ref: b,
|
|
178
|
+
...y,
|
|
179
|
+
className: `select-filterbar${m ? " " + m : ""}`,
|
|
173
180
|
children: [
|
|
174
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ v("div", {
|
|
175
182
|
className: "select-filterbar__row",
|
|
176
183
|
children: [
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
className: `select-filterbar__query${
|
|
184
|
+
f,
|
|
185
|
+
d && /* @__PURE__ */ v("div", {
|
|
186
|
+
className: `select-filterbar__query${d.error ? " select-filterbar__query--error" : ""}`,
|
|
180
187
|
children: [
|
|
181
|
-
/* @__PURE__ */
|
|
188
|
+
/* @__PURE__ */ _("span", {
|
|
182
189
|
className: "select-filterbar__query-icon",
|
|
183
190
|
"aria-hidden": "true",
|
|
184
|
-
children: /* @__PURE__ */
|
|
191
|
+
children: /* @__PURE__ */ _(i, {})
|
|
185
192
|
}),
|
|
186
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ _("input", {
|
|
187
194
|
className: "select-filterbar__query-input",
|
|
188
195
|
type: "search",
|
|
189
|
-
value:
|
|
190
|
-
placeholder:
|
|
191
|
-
onChange: (e) =>
|
|
192
|
-
onKeyDown:
|
|
196
|
+
value: d.value,
|
|
197
|
+
placeholder: d.placeholder ?? C.common.searchPlaceholder,
|
|
198
|
+
onChange: (e) => d.onChange(e.target.value),
|
|
199
|
+
onKeyDown: d.onSubmit ? (e) => {
|
|
193
200
|
if (e.key === "Enter") {
|
|
194
201
|
var t;
|
|
195
|
-
e.preventDefault(), (t =
|
|
202
|
+
e.preventDefault(), (t = d.onSubmit) == null || t.call(d);
|
|
196
203
|
}
|
|
197
204
|
} : void 0,
|
|
198
|
-
"aria-label":
|
|
199
|
-
"aria-invalid":
|
|
200
|
-
disabled:
|
|
205
|
+
"aria-label": d.ariaLabel ?? d.placeholder ?? C.common.search,
|
|
206
|
+
"aria-invalid": d.error ? !0 : void 0,
|
|
207
|
+
disabled: p
|
|
201
208
|
}),
|
|
202
|
-
|
|
209
|
+
d.value && /* @__PURE__ */ _("button", {
|
|
203
210
|
type: "button",
|
|
204
211
|
className: "select-filterbar__query-clear",
|
|
205
|
-
"aria-label":
|
|
206
|
-
onClick: () =>
|
|
207
|
-
children: /* @__PURE__ */
|
|
212
|
+
"aria-label": C.filterBar.clearSearch,
|
|
213
|
+
onClick: () => d.onChange(""),
|
|
214
|
+
children: /* @__PURE__ */ _(n, {})
|
|
208
215
|
}),
|
|
209
|
-
|
|
216
|
+
d.onSubmit && /* @__PURE__ */ _("button", {
|
|
210
217
|
type: "button",
|
|
211
218
|
className: "select-filterbar__query-submit",
|
|
212
|
-
onClick:
|
|
213
|
-
disabled:
|
|
214
|
-
children:
|
|
219
|
+
onClick: d.onSubmit,
|
|
220
|
+
disabled: p,
|
|
221
|
+
children: d.submitLabel ?? C.common.search
|
|
215
222
|
})
|
|
216
223
|
]
|
|
217
224
|
}),
|
|
218
|
-
|
|
225
|
+
N.map((e) => /* @__PURE__ */ _(S, {
|
|
219
226
|
filter: e,
|
|
220
227
|
value: t[e.key] ?? "",
|
|
221
228
|
onChange: (t) => o(e.key, t),
|
|
222
|
-
open:
|
|
223
|
-
onToggle: () =>
|
|
224
|
-
onClose: () =>
|
|
225
|
-
disabled:
|
|
229
|
+
open: E === e.key,
|
|
230
|
+
onToggle: () => D((t) => t === e.key ? null : e.key),
|
|
231
|
+
onClose: () => D((t) => t === e.key ? null : t),
|
|
232
|
+
disabled: p
|
|
226
233
|
}, e.key)),
|
|
227
|
-
|
|
228
|
-
active:
|
|
229
|
-
onClose: () =>
|
|
234
|
+
P.length > 0 && /* @__PURE__ */ _(s, {
|
|
235
|
+
active: O,
|
|
236
|
+
onClose: () => k(!1),
|
|
230
237
|
placement: "bottom-start",
|
|
231
|
-
activator: /* @__PURE__ */
|
|
238
|
+
activator: /* @__PURE__ */ v("button", {
|
|
232
239
|
type: "button",
|
|
233
240
|
className: "select-facet select-facet--more",
|
|
234
|
-
onClick: () =>
|
|
235
|
-
disabled:
|
|
236
|
-
"aria-expanded":
|
|
237
|
-
children: [/* @__PURE__ */
|
|
241
|
+
onClick: () => k((e) => !e),
|
|
242
|
+
disabled: p,
|
|
243
|
+
"aria-expanded": O,
|
|
244
|
+
children: [/* @__PURE__ */ _("span", {
|
|
238
245
|
className: "select-facet__addicon",
|
|
239
246
|
"aria-hidden": "true",
|
|
240
|
-
children: /* @__PURE__ */
|
|
241
|
-
}),
|
|
247
|
+
children: /* @__PURE__ */ _(r, {})
|
|
248
|
+
}), C.filterBar.moreFilters]
|
|
242
249
|
}),
|
|
243
|
-
children: /* @__PURE__ */
|
|
250
|
+
children: /* @__PURE__ */ _("div", {
|
|
244
251
|
className: "select-facet__options",
|
|
245
252
|
role: "menu",
|
|
246
|
-
|
|
253
|
+
ref: A,
|
|
254
|
+
onKeyDown: l,
|
|
255
|
+
children: P.map((e) => /* @__PURE__ */ _("button", {
|
|
247
256
|
type: "button",
|
|
248
257
|
role: "menuitem",
|
|
249
258
|
className: "select-facet__opt",
|
|
250
|
-
onClick: () =>
|
|
251
|
-
children: /* @__PURE__ */
|
|
259
|
+
onClick: () => L(e.key),
|
|
260
|
+
children: /* @__PURE__ */ _("span", { children: e.label })
|
|
252
261
|
}, e.key))
|
|
253
262
|
})
|
|
254
263
|
})
|
|
255
264
|
]
|
|
256
265
|
}),
|
|
257
|
-
|
|
266
|
+
d != null && d.error ? /* @__PURE__ */ _("p", {
|
|
258
267
|
className: "select-filterbar__query-error",
|
|
259
268
|
role: "alert",
|
|
260
|
-
children:
|
|
269
|
+
children: d.error
|
|
261
270
|
}) : null,
|
|
262
|
-
|
|
271
|
+
F.length > 0 && /* @__PURE__ */ v("div", {
|
|
263
272
|
className: "select-filterbar__applied",
|
|
264
|
-
children: [
|
|
273
|
+
children: [F.map((e) => /* @__PURE__ */ v("span", {
|
|
265
274
|
className: `select-filterbar__tag${e.error ? " is-error" : ""}`,
|
|
266
275
|
title: e.error || void 0,
|
|
267
276
|
children: [
|
|
268
277
|
e.label,
|
|
269
278
|
": ",
|
|
270
|
-
|
|
271
|
-
/* @__PURE__ */
|
|
279
|
+
x(e, t[e.key] ?? ""),
|
|
280
|
+
/* @__PURE__ */ _("button", {
|
|
272
281
|
type: "button",
|
|
273
282
|
className: "select-filterbar__tagx",
|
|
274
|
-
"aria-label":
|
|
283
|
+
"aria-label": C.filterBar.removeFilter(e.label),
|
|
275
284
|
onClick: () => o(e.key, ""),
|
|
276
|
-
children: /* @__PURE__ */
|
|
285
|
+
children: /* @__PURE__ */ _(n, {})
|
|
277
286
|
})
|
|
278
287
|
]
|
|
279
|
-
}, e.key)), /* @__PURE__ */
|
|
288
|
+
}, e.key)), /* @__PURE__ */ _("button", {
|
|
280
289
|
type: "button",
|
|
281
290
|
className: "select-filterbar__clear",
|
|
282
|
-
onClick:
|
|
283
|
-
children:
|
|
291
|
+
onClick: I,
|
|
292
|
+
children: C.filterBar.clearAll
|
|
284
293
|
})]
|
|
285
294
|
})
|
|
286
295
|
]
|
|
287
296
|
});
|
|
288
297
|
});
|
|
289
298
|
//#endregion
|
|
290
|
-
export {
|
|
299
|
+
export { C as SelectFilterBar, b as joinFilterValues, y as splitFilterValues };
|
|
291
300
|
|
|
292
301
|
//# sourceMappingURL=SelectFilterBar.js.map
|
package/dist/SelectSection.d.ts
CHANGED
|
@@ -31,6 +31,11 @@ type SelectSectionOwnProps = {
|
|
|
31
31
|
* dentro de uma superfície sólida (`SelectRegions`, o drawer do Workbench); numa página, a seção segue two-tone.
|
|
32
32
|
*/
|
|
33
33
|
flush?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 0.1.213: a seção é a moldura de uma lista (a `SelectTable` de dentro): o corpo sem a caixa branca nem o respiro, e
|
|
36
|
+
* a tabela com o cabeçalho na moldura e as linhas na caixa branca dela. Sem tabela no corpo, a caixa branca volta.
|
|
37
|
+
*/
|
|
38
|
+
list?: boolean;
|
|
34
39
|
children: ReactNode;
|
|
35
40
|
};
|
|
36
41
|
export type SelectSectionProps = SelectSectionOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectSectionOwnProps>;
|
package/dist/SelectSection.js
CHANGED
|
@@ -6,20 +6,20 @@ import { inertProps as i } from "./internal/inert.js";
|
|
|
6
6
|
import { forwardRef as a, useId as o, useState as s } from "react";
|
|
7
7
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
8
|
//#region src/SelectSection.tsx
|
|
9
|
-
var u = a(function({ title: a, help: u, description: d, action: f, collapsible: p = !1, defaultOpen: m = !0, open: h, onOpenChange: g, footer: _, flush: v = !1,
|
|
10
|
-
let [
|
|
11
|
-
h === void 0 &&
|
|
12
|
-
},
|
|
9
|
+
var u = a(function({ title: a, help: u, description: d, action: f, collapsible: p = !1, defaultOpen: m = !0, open: h, onOpenChange: g, footer: _, flush: v = !1, list: y = !1, children: b, className: x, ...S }, C) {
|
|
10
|
+
let [w, T] = s(m), E = h ?? w, D = o(), O = () => {
|
|
11
|
+
h === void 0 && T(!E), g == null || g(!E);
|
|
12
|
+
}, k = (r() ? " select-section--nested" : "") + (v ? " select-section--flush" : "") + (y ? " select-section--list" : ""), A = y ? "list" : "body";
|
|
13
13
|
return p ? /* @__PURE__ */ l("div", {
|
|
14
|
-
ref:
|
|
15
|
-
...
|
|
16
|
-
className: `select-section select-section--collapsible${
|
|
14
|
+
ref: C,
|
|
15
|
+
...S,
|
|
16
|
+
className: `select-section select-section--collapsible${k}${E ? " is-open" : ""}${x ? " " + x : ""}`,
|
|
17
17
|
children: [/* @__PURE__ */ l("button", {
|
|
18
18
|
type: "button",
|
|
19
19
|
className: "select-section__head select-section__head--toggle",
|
|
20
|
-
"aria-expanded":
|
|
21
|
-
"aria-controls":
|
|
22
|
-
onClick:
|
|
20
|
+
"aria-expanded": E,
|
|
21
|
+
"aria-controls": D,
|
|
22
|
+
onClick: O,
|
|
23
23
|
children: [/* @__PURE__ */ l("span", {
|
|
24
24
|
className: "select-section__heading",
|
|
25
25
|
children: [a && /* @__PURE__ */ c("span", {
|
|
@@ -35,15 +35,18 @@ var u = a(function({ title: a, help: u, description: d, action: f, collapsible:
|
|
|
35
35
|
children: /* @__PURE__ */ c(e, {})
|
|
36
36
|
})]
|
|
37
37
|
}), /* @__PURE__ */ c("div", {
|
|
38
|
-
id:
|
|
38
|
+
id: D,
|
|
39
39
|
className: "select-section__collapse",
|
|
40
|
-
"data-open":
|
|
41
|
-
...i(!
|
|
40
|
+
"data-open": E,
|
|
41
|
+
...i(!E),
|
|
42
42
|
children: /* @__PURE__ */ l("div", {
|
|
43
43
|
className: "select-section__collapsewrap",
|
|
44
44
|
children: [/* @__PURE__ */ c("div", {
|
|
45
45
|
className: "select-section__body",
|
|
46
|
-
children: /* @__PURE__ */ c(n, {
|
|
46
|
+
children: /* @__PURE__ */ c(n, {
|
|
47
|
+
kind: A,
|
|
48
|
+
children: b
|
|
49
|
+
})
|
|
47
50
|
}), _ != null && _ !== "" && /* @__PURE__ */ c("div", {
|
|
48
51
|
className: "select-section__foot",
|
|
49
52
|
children: _
|
|
@@ -51,9 +54,9 @@ var u = a(function({ title: a, help: u, description: d, action: f, collapsible:
|
|
|
51
54
|
})
|
|
52
55
|
})]
|
|
53
56
|
}) : /* @__PURE__ */ l("div", {
|
|
54
|
-
ref:
|
|
55
|
-
...
|
|
56
|
-
className: `select-section${
|
|
57
|
+
ref: C,
|
|
58
|
+
...S,
|
|
59
|
+
className: `select-section${k}${x ? " " + x : ""}`,
|
|
57
60
|
children: [
|
|
58
61
|
(a || d || f) && /* @__PURE__ */ l("div", {
|
|
59
62
|
className: "select-section__head",
|
|
@@ -73,7 +76,10 @@ var u = a(function({ title: a, help: u, description: d, action: f, collapsible:
|
|
|
73
76
|
}),
|
|
74
77
|
/* @__PURE__ */ c("div", {
|
|
75
78
|
className: "select-section__body",
|
|
76
|
-
children: /* @__PURE__ */ c(n, {
|
|
79
|
+
children: /* @__PURE__ */ c(n, {
|
|
80
|
+
kind: A,
|
|
81
|
+
children: b
|
|
82
|
+
})
|
|
77
83
|
}),
|
|
78
84
|
_ != null && _ !== "" && /* @__PURE__ */ c("div", {
|
|
79
85
|
className: "select-section__foot",
|
package/dist/SelectTable.d.ts
CHANGED
|
@@ -73,6 +73,25 @@ type SelectTableOwnProps = {
|
|
|
73
73
|
* separados por linhas de 1px.
|
|
74
74
|
*/
|
|
75
75
|
flush?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* 0.1.213: o nome da tabela para o leitor de tela (a grade é `role="table"`). Sem ele, o nome é o `title` quando o
|
|
78
|
+
* `title` é texto.
|
|
79
|
+
*/
|
|
80
|
+
label?: string;
|
|
81
|
+
/**
|
|
82
|
+
* 0.1.213: a largura mínima das colunas juntas (um comprimento CSS, `'48rem'`): abaixo dela a tabela rola de lado em
|
|
83
|
+
* vez de apertar as colunas. Sem ela, o mínimo é a soma dos pisos das colunas.
|
|
84
|
+
*/
|
|
85
|
+
minWidth?: string;
|
|
86
|
+
/**
|
|
87
|
+
* 0.1.213: como as colunas flexíveis (as sem `width`) dividem a largura.
|
|
88
|
+
* · `even` (o padrão): cada uma leva a mesma fatia (vezes o `grow`);
|
|
89
|
+
* · `content`: cada uma leva a fatia do que ela tem — a tabela mede a largura natural de cada coluna (o cabeçalho e
|
|
90
|
+
* as células) e divide a largura na mesma proporção, como a tabela do HTML. O nome longo ganha espaço e o "OK" não
|
|
91
|
+
* o desperdiça. Nenhuma coluna fica mais estreita que o que ela tem (até 20rem, `--select-table-col-cap`): sem
|
|
92
|
+
* espaço, a tabela rola de lado. O cabeçalho continua alinhado com as linhas (a mesma grade).
|
|
93
|
+
*/
|
|
94
|
+
sizing?: 'even' | 'content';
|
|
76
95
|
};
|
|
77
96
|
export type SelectTableProps = SelectTableOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectTableOwnProps>;
|
|
78
97
|
export declare const SelectTable: import('react').ForwardRefExoticComponent<SelectTableOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SelectTableOwnProps> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -93,14 +112,26 @@ export declare const SelectUserCell: import('react').ForwardRefExoticComponent<S
|
|
|
93
112
|
* vêm logo abaixo com `nested` — recuadas e num fundo afundado, na MESMA grade de colunas.
|
|
94
113
|
* Continua uma tabela só: nada de tabela dentro de linha (card dentro de card).
|
|
95
114
|
*/
|
|
96
|
-
|
|
115
|
+
type SelectTableRowOwnProps = {
|
|
97
116
|
children: ReactNode;
|
|
98
117
|
onClick?: () => void;
|
|
99
118
|
/** Linha-mãe de um grupo: aberta/fechada (vira `aria-expanded`). */
|
|
100
119
|
expanded?: boolean;
|
|
101
120
|
/** Linha-filha de um grupo aberto. */
|
|
102
121
|
nested?: boolean;
|
|
103
|
-
|
|
122
|
+
/**
|
|
123
|
+
* 0.1.213: a linha do que está aberto agora (o plano que a página mostra ao lado, a mensagem da gaveta): o fundo
|
|
124
|
+
* afundado e `aria-current`.
|
|
125
|
+
*/
|
|
126
|
+
current?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* 0.1.213: a linha que abre um grupo de linhas ("Do workspace · as regras dele"): o título numa célula que ocupa a
|
|
129
|
+
* linha toda (`<SelectTableCell span="all">`), no fundo afundado.
|
|
130
|
+
*/
|
|
131
|
+
section?: boolean;
|
|
132
|
+
};
|
|
133
|
+
export type SelectTableRowProps = SelectTableRowOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectTableRowOwnProps | 'role'>;
|
|
134
|
+
export declare function SelectTableRow({ children, onClick, expanded, nested, current, section, className, ...rest }: SelectTableRowProps): import("react").JSX.Element;
|
|
104
135
|
type SelectTableCellOwnProps = {
|
|
105
136
|
children: ReactNode;
|
|
106
137
|
align?: 'start' | 'end' | 'center';
|
|
@@ -110,6 +141,12 @@ type SelectTableCellOwnProps = {
|
|
|
110
141
|
/** Chevron de grupo antes do conteúdo (primeira célula da linha-mãe). `'none'` reserva o
|
|
111
142
|
* espaço sem desenhar, para alinhar uma linha sem filhas com as vizinhas que têm. */
|
|
112
143
|
disclosure?: 'open' | 'closed' | 'none';
|
|
144
|
+
/** 0.1.213: o cabeçalho da linha (`role="rowheader"`): o leitor de tela diz o nome da linha em cada célula dela. */
|
|
145
|
+
header?: boolean;
|
|
146
|
+
/** 0.1.213: quantas colunas a célula ocupa (`'all'`: a linha toda — o título do grupo, o detalhe aberto). */
|
|
147
|
+
span?: number | 'all';
|
|
148
|
+
/** 0.1.213: o texto quebra linha em vez de cortar (a descrição, o valor longo que não pode sumir). */
|
|
149
|
+
wrap?: boolean;
|
|
113
150
|
};
|
|
114
151
|
export type SelectTableCellProps = SelectTableCellOwnProps & Omit<ComponentPropsWithoutRef<'div'>, keyof SelectTableCellOwnProps>;
|
|
115
152
|
export declare const SelectTableCell: import('react').ForwardRefExoticComponent<SelectTableCellOwnProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SelectTableCellOwnProps> & import('react').RefAttributes<HTMLDivElement>>;
|