@vector-business-services/cristal-ds-web 0.15.0 → 0.16.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 +69 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +130 -43
- package/dist/index.css.map +1 -1
- package/dist/index.js +69 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@ var Accordion = react.forwardRef(function Accordion2({ multiple = false, activeI
|
|
|
42
42
|
const primeRef = react.useRef(null);
|
|
43
43
|
react.useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
44
44
|
const [interno, setInterno] = react.useState(multiple ? [0] : 0);
|
|
45
|
-
const
|
|
45
|
+
const abertos2 = activeIndex === void 0 ? interno : activeIndex;
|
|
46
46
|
const tabs = react.Children.toArray(children).filter(
|
|
47
47
|
(child) => react.isValidElement(child)
|
|
48
48
|
);
|
|
@@ -54,7 +54,7 @@ var Accordion = react.forwardRef(function Accordion2({ multiple = false, activeI
|
|
|
54
54
|
ref: primeRef,
|
|
55
55
|
id,
|
|
56
56
|
multiple,
|
|
57
|
-
activeIndex:
|
|
57
|
+
activeIndex: abertos2,
|
|
58
58
|
onTabChange: (event) => {
|
|
59
59
|
const index = event.index;
|
|
60
60
|
setInterno(index);
|
|
@@ -78,8 +78,16 @@ var Accordion = react.forwardRef(function Accordion2({ multiple = false, activeI
|
|
|
78
78
|
headerAction: { className: "cr-accordion__action" },
|
|
79
79
|
toggleableContent: { className: "cr-accordion__region" },
|
|
80
80
|
content: { className: "cr-accordion__content" },
|
|
81
|
-
//
|
|
82
|
-
|
|
81
|
+
// Abre e fecha pela altura, como o tema do Prime (p-toggleable-content, Accordion.css):
|
|
82
|
+
// no unstyled o Prime só dá o tempo, sem classes.
|
|
83
|
+
transition: {
|
|
84
|
+
classNames: {
|
|
85
|
+
enter: "cr-accordion__region--entrar",
|
|
86
|
+
enterActive: "cr-accordion__region--entrando",
|
|
87
|
+
exit: "cr-accordion__region--sair",
|
|
88
|
+
exitActive: "cr-accordion__region--saindo"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
83
91
|
},
|
|
84
92
|
children: tab.props.children
|
|
85
93
|
},
|
|
@@ -107,7 +115,17 @@ var painelDoCampo = (campo, seletorDoPainel) => {
|
|
|
107
115
|
const lista = campo?.getAttribute("aria-controls");
|
|
108
116
|
return lista ? document.getElementById(lista)?.closest(seletorDoPainel) : null;
|
|
109
117
|
};
|
|
110
|
-
var
|
|
118
|
+
var CLASSES_DO_POPUP = {
|
|
119
|
+
enter: "cr-popup--entrar",
|
|
120
|
+
enterActive: "cr-popup--entrando",
|
|
121
|
+
enterDone: "cr-popup--entrou",
|
|
122
|
+
exitActive: "cr-popup--saindo"
|
|
123
|
+
};
|
|
124
|
+
var transicaoDoPopup = (onEnter) => (
|
|
125
|
+
// Sem onEnter, a chave nem aparece: o Prime soma as funções do pt às dele, mas um undefined
|
|
126
|
+
// substituiria o onEnter dele (que posiciona a lista).
|
|
127
|
+
{ classNames: CLASSES_DO_POPUP, ...onEnter && { onEnter } }
|
|
128
|
+
);
|
|
111
129
|
var AutoComplete = react.forwardRef(function AutoComplete2({
|
|
112
130
|
variant = "outline",
|
|
113
131
|
size = "large",
|
|
@@ -160,8 +178,9 @@ var AutoComplete = react.forwardRef(function AutoComplete2({
|
|
|
160
178
|
// O Prime mostra um spinner próprio enquanto busca; o Figma não define esse estado.
|
|
161
179
|
loadingIcon: { className: "cr-autocomplete__loader" },
|
|
162
180
|
panel: { className: "cr-lista cr-autocomplete__panel" },
|
|
163
|
-
//
|
|
164
|
-
|
|
181
|
+
// Animação de entrada e saída (a do Prime) e o lado da lista, medido logo depois de o Prime
|
|
182
|
+
// posicionar.
|
|
183
|
+
transition: transicaoDoPopup(() => {
|
|
165
184
|
const campo = document.getElementById(id);
|
|
166
185
|
seguirLado(painelDoCampo(campo, ".cr-autocomplete__panel"), campo);
|
|
167
186
|
}),
|
|
@@ -241,8 +260,16 @@ var Card = react.forwardRef(function Card2({ padding = "xsmall", outline = false
|
|
|
241
260
|
);
|
|
242
261
|
});
|
|
243
262
|
var usandoTeclado = false;
|
|
263
|
+
var abertos = /* @__PURE__ */ new Set();
|
|
244
264
|
if (typeof document !== "undefined") {
|
|
245
|
-
document.addEventListener(
|
|
265
|
+
document.addEventListener(
|
|
266
|
+
"keydown",
|
|
267
|
+
(event) => {
|
|
268
|
+
usandoTeclado = true;
|
|
269
|
+
if (event.key === "Escape") abertos.forEach((fechar) => fechar());
|
|
270
|
+
},
|
|
271
|
+
true
|
|
272
|
+
);
|
|
246
273
|
document.addEventListener("pointerdown", () => usandoTeclado = false, true);
|
|
247
274
|
}
|
|
248
275
|
var resolveTargets = (target) => {
|
|
@@ -265,6 +292,9 @@ function Tooltip({
|
|
|
265
292
|
}) {
|
|
266
293
|
const autoId = react.useId();
|
|
267
294
|
const tooltipId = id ?? autoId;
|
|
295
|
+
const primeRef = react.useRef(null);
|
|
296
|
+
const [fechar] = react.useState(() => () => void primeRef.current?.hide());
|
|
297
|
+
react.useEffect(() => () => void abertos.delete(fechar), [fechar]);
|
|
268
298
|
react.useEffect(() => {
|
|
269
299
|
if (!describe) return;
|
|
270
300
|
const elements = resolveTargets(target);
|
|
@@ -299,9 +329,17 @@ function Tooltip({
|
|
|
299
329
|
event,
|
|
300
330
|
showDelay,
|
|
301
331
|
hideDelay,
|
|
332
|
+
ref: primeRef,
|
|
302
333
|
disabled,
|
|
303
|
-
|
|
304
|
-
|
|
334
|
+
onBeforeShow: (e) => {
|
|
335
|
+
const abre = e.originalEvent?.type !== "focus" || usandoTeclado;
|
|
336
|
+
if (abre) abertos.add(fechar);
|
|
337
|
+
return abre;
|
|
338
|
+
},
|
|
339
|
+
onBeforeHide: () => {
|
|
340
|
+
abertos.delete(fechar);
|
|
341
|
+
return true;
|
|
342
|
+
},
|
|
305
343
|
pt,
|
|
306
344
|
children: content
|
|
307
345
|
}
|
|
@@ -1070,10 +1108,11 @@ var Menu = react.forwardRef(function Menu2({
|
|
|
1070
1108
|
};
|
|
1071
1109
|
},
|
|
1072
1110
|
content: { className: "cr-menu__content" },
|
|
1073
|
-
//
|
|
1111
|
+
// Animação de entrada e saída (a do Prime) e o lado do popup, medido logo depois de o Prime
|
|
1112
|
+
// posicionar.
|
|
1074
1113
|
// Numa microtarefa: no onEnter o Prime ainda está religando a ref (getElement vem vazio); ela
|
|
1075
1114
|
// roda logo depois, antes de a tela ser pintada.
|
|
1076
|
-
transition:
|
|
1115
|
+
transition: transicaoDoPopup(
|
|
1077
1116
|
() => queueMicrotask(() => seguirLado(primeRef.current?.getElement(), alvo.current))
|
|
1078
1117
|
),
|
|
1079
1118
|
action: { className: "cr-lista__item cr-menu__action" },
|
|
@@ -1416,7 +1455,7 @@ var MenuPrincipal = react.forwardRef(
|
|
|
1416
1455
|
menuitem: { className: "cr-menu-principal__item" },
|
|
1417
1456
|
// Lado do popup, medido logo depois de o Prime posicionar.
|
|
1418
1457
|
// Numa microtarefa: no onEnter o Prime ainda está religando a ref (como no Menu).
|
|
1419
|
-
transition:
|
|
1458
|
+
transition: transicaoDoPopup(
|
|
1420
1459
|
() => queueMicrotask(() => seguirLado(primeRef.current?.getElement(), alvo.current))
|
|
1421
1460
|
)
|
|
1422
1461
|
};
|
|
@@ -1530,6 +1569,16 @@ var Modal = react.forwardRef(function Modal2({
|
|
|
1530
1569
|
className: classes,
|
|
1531
1570
|
"aria-labelledby": titleId,
|
|
1532
1571
|
"aria-describedby": void 0
|
|
1572
|
+
},
|
|
1573
|
+
// Entrada e saída do tema do Prime (p-dialog, Modal.css). No unstyled o Prime não põe
|
|
1574
|
+
// classes na transição; o tipo exige o addEndListener do react-transition-group.
|
|
1575
|
+
transition: {
|
|
1576
|
+
classNames: {
|
|
1577
|
+
enter: "cr-modal--entrar",
|
|
1578
|
+
enterActive: "cr-modal--entrando",
|
|
1579
|
+
enterDone: "cr-modal--entrou",
|
|
1580
|
+
exitActive: "cr-modal--saindo"
|
|
1581
|
+
}
|
|
1533
1582
|
}
|
|
1534
1583
|
},
|
|
1535
1584
|
content: ({ hide, closeRef }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -1715,7 +1764,9 @@ var MultiSelect = react.forwardRef(function MultiSelect2({
|
|
|
1715
1764
|
...checkbox,
|
|
1716
1765
|
root: { ...checkbox.root, role: void 0, "aria-checked": void 0, inert: true }
|
|
1717
1766
|
},
|
|
1718
|
-
emptyMessage: { className: "cr-multiselect__empty" }
|
|
1767
|
+
emptyMessage: { className: "cr-multiselect__empty" },
|
|
1768
|
+
// Animação de entrada e saída da lista, a do Prime (comum.css).
|
|
1769
|
+
transition: transicaoDoPopup()
|
|
1719
1770
|
};
|
|
1720
1771
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classes, children: [
|
|
1721
1772
|
label && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "cr-field__label", htmlFor: inputId, children: [
|
|
@@ -1917,8 +1968,9 @@ var Select = react.forwardRef(function Select2({
|
|
|
1917
1968
|
input: { className: "cr-select__value" },
|
|
1918
1969
|
trigger: { className: "cr-field__icon cr-select__trigger", "aria-hidden": true },
|
|
1919
1970
|
panel: { className: "cr-lista cr-select__panel" },
|
|
1920
|
-
//
|
|
1921
|
-
|
|
1971
|
+
// Animação de entrada e saída (a do Prime) e o lado da lista, medido logo depois de o Prime
|
|
1972
|
+
// posicionar.
|
|
1973
|
+
transition: transicaoDoPopup(
|
|
1922
1974
|
() => seguirLado(
|
|
1923
1975
|
document.getElementById(listId)?.closest(".cr-select__panel"),
|
|
1924
1976
|
document.getElementById(inputId)?.closest(".cr-select__control")
|
|
@@ -2437,6 +2489,7 @@ var Toast = react.forwardRef(function Toast2({ position = "top-right", closeLabe
|
|
|
2437
2489
|
classNames: {
|
|
2438
2490
|
enter: "cr-toast__message--enter",
|
|
2439
2491
|
enterActive: "cr-toast__message--enter-active",
|
|
2492
|
+
exit: "cr-toast__message--exit",
|
|
2440
2493
|
exitActive: "cr-toast__message--exit-active"
|
|
2441
2494
|
}
|
|
2442
2495
|
}
|