@vector-business-services/cristal-ds-web 0.22.0 → 0.23.0
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/index.cjs +44 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +44 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -84,6 +84,11 @@ interface AutoCompleteProps extends Omit<AutoCompleteProps$1, 'size' | 'variant'
|
|
|
84
84
|
dropdown?: boolean;
|
|
85
85
|
/** Nome da seta para o leitor de tela. Padrão: "Mostrar opções". */
|
|
86
86
|
dropdownAriaLabel?: string;
|
|
87
|
+
/**
|
|
88
|
+
* O clique no campo abre a lista, com as sugestões do texto que já está nele (com o campo vazio,
|
|
89
|
+
* todas). Padrão: true.
|
|
90
|
+
*/
|
|
91
|
+
openOnClick?: boolean;
|
|
87
92
|
}
|
|
88
93
|
declare const AutoComplete: react.ForwardRefExoticComponent<AutoCompleteProps & react.RefAttributes<HTMLInputElement>>;
|
|
89
94
|
|
package/dist/index.d.ts
CHANGED
|
@@ -84,6 +84,11 @@ interface AutoCompleteProps extends Omit<AutoCompleteProps$1, 'size' | 'variant'
|
|
|
84
84
|
dropdown?: boolean;
|
|
85
85
|
/** Nome da seta para o leitor de tela. Padrão: "Mostrar opções". */
|
|
86
86
|
dropdownAriaLabel?: string;
|
|
87
|
+
/**
|
|
88
|
+
* O clique no campo abre a lista, com as sugestões do texto que já está nele (com o campo vazio,
|
|
89
|
+
* todas). Padrão: true.
|
|
90
|
+
*/
|
|
91
|
+
openOnClick?: boolean;
|
|
87
92
|
}
|
|
88
93
|
declare const AutoComplete: react.ForwardRefExoticComponent<AutoCompleteProps & react.RefAttributes<HTMLInputElement>>;
|
|
89
94
|
|
package/dist/index.js
CHANGED
|
@@ -138,6 +138,7 @@ var AutoComplete = forwardRef(function AutoComplete2({
|
|
|
138
138
|
error,
|
|
139
139
|
dropdown = false,
|
|
140
140
|
dropdownAriaLabel = "Mostrar op\xE7\xF5es",
|
|
141
|
+
openOnClick = true,
|
|
141
142
|
inputId,
|
|
142
143
|
required,
|
|
143
144
|
disabled,
|
|
@@ -149,6 +150,8 @@ var AutoComplete = forwardRef(function AutoComplete2({
|
|
|
149
150
|
const id = inputId ?? autoId;
|
|
150
151
|
const hintId = `${id}-hint`;
|
|
151
152
|
const supportText = error ?? hint;
|
|
153
|
+
const prime = useRef(null);
|
|
154
|
+
const aberta = () => Boolean(prime.current?.getOverlay());
|
|
152
155
|
const classes2 = [
|
|
153
156
|
"cr-field",
|
|
154
157
|
"cr-autocomplete",
|
|
@@ -167,6 +170,7 @@ var AutoComplete = forwardRef(function AutoComplete2({
|
|
|
167
170
|
/* @__PURE__ */ jsx(
|
|
168
171
|
AutoComplete$1,
|
|
169
172
|
{
|
|
173
|
+
ref: prime,
|
|
170
174
|
unstyled: true,
|
|
171
175
|
inputRef: ref,
|
|
172
176
|
inputId: id,
|
|
@@ -182,12 +186,31 @@ var AutoComplete = forwardRef(function AutoComplete2({
|
|
|
182
186
|
root: {
|
|
183
187
|
className: "cr-field__control cr-autocomplete__input",
|
|
184
188
|
"aria-describedby": juntarIds(supportText && hintId, props["aria-describedby"]),
|
|
185
|
-
"aria-invalid": error ? true : void 0
|
|
189
|
+
"aria-invalid": error ? true : void 0,
|
|
190
|
+
// O clique no campo abre a lista (o Prime só abre ao digitar ou pela seta).
|
|
191
|
+
...openOnClick && {
|
|
192
|
+
onClick: (event) => {
|
|
193
|
+
if (!aberta() && !disabled) {
|
|
194
|
+
prime.current?.search(event, event.currentTarget.value, "dropdown");
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
186
198
|
}
|
|
187
199
|
},
|
|
188
200
|
// A seta: o botão de dropdown do Prime, por cima do fim do <input> (que segue sendo a caixa,
|
|
189
201
|
// para a lista continuar alinhada ao campo).
|
|
190
|
-
dropdownButton: {
|
|
202
|
+
dropdownButton: {
|
|
203
|
+
root: {
|
|
204
|
+
className: "cr-autocomplete__dropdown",
|
|
205
|
+
// Com a lista aberta, a seta fecha (como no p-autoComplete do PrimeNG 19); a do
|
|
206
|
+
// PrimeReact só abre. Na captura, antes do clique do Prime, que buscaria de novo.
|
|
207
|
+
onClickCapture: (event) => {
|
|
208
|
+
if (!aberta()) return;
|
|
209
|
+
event.stopPropagation();
|
|
210
|
+
prime.current?.hide();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
},
|
|
191
214
|
// O Prime mostra um spinner próprio enquanto busca; o Figma não define esse estado.
|
|
192
215
|
loadingIcon: { className: "cr-autocomplete__loader" },
|
|
193
216
|
panel: { className: "cr-lista cr-autocomplete__panel" },
|
|
@@ -1286,18 +1309,26 @@ function ListaDePeriodos({
|
|
|
1286
1309
|
onEscolher
|
|
1287
1310
|
}) {
|
|
1288
1311
|
const grupo = useId();
|
|
1289
|
-
return /* @__PURE__ */ jsx(
|
|
1290
|
-
|
|
1312
|
+
return /* @__PURE__ */ jsx(
|
|
1313
|
+
"div",
|
|
1291
1314
|
{
|
|
1292
|
-
className: "cr-data-
|
|
1293
|
-
|
|
1294
|
-
label:
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1315
|
+
className: "cr-data-picker__periods cr-rolagem-fina",
|
|
1316
|
+
role: "radiogroup",
|
|
1317
|
+
"aria-label": "Per\xEDodos",
|
|
1318
|
+
children: periods.map((item) => /* @__PURE__ */ jsx(
|
|
1319
|
+
Radio,
|
|
1320
|
+
{
|
|
1321
|
+
className: "cr-data-picker__period",
|
|
1322
|
+
name: grupo,
|
|
1323
|
+
label: item.label,
|
|
1324
|
+
value: item.label,
|
|
1325
|
+
checked: periodo === item,
|
|
1326
|
+
onChange: () => onEscolher(item)
|
|
1327
|
+
},
|
|
1328
|
+
item.label
|
|
1329
|
+
))
|
|
1330
|
+
}
|
|
1331
|
+
);
|
|
1301
1332
|
}
|
|
1302
1333
|
var mesmoRascunho = (a, b) => (a[0] === b[0] || mesmoDia2(a[0], b[0])) && (a[1] === b[1] || mesmoDia2(a[1], b[1]));
|
|
1303
1334
|
function CamposDoPeriodo({
|