@vector-business-services/cristal-ds-web 0.5.0 → 0.6.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 +18 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +125 -11
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -161,6 +161,11 @@ interface DrawerProps {
|
|
|
161
161
|
side?: DrawerSide;
|
|
162
162
|
/** Padrão: full. */
|
|
163
163
|
behavior?: DrawerBehavior;
|
|
164
|
+
/**
|
|
165
|
+
* Com overlay (padrão): a gaveta é modal, a página atrás fica bloqueada e o clique no overlay
|
|
166
|
+
* fecha. Sem overlay (`false`): a página continua rolando e clicável, e só o X e o Esc fecham.
|
|
167
|
+
*/
|
|
168
|
+
modal?: boolean;
|
|
164
169
|
/** Mostra o botão de voltar antes do título. */
|
|
165
170
|
onBack?: () => void;
|
|
166
171
|
backLabel?: string;
|
|
@@ -171,7 +176,7 @@ interface DrawerProps {
|
|
|
171
176
|
id?: string;
|
|
172
177
|
className?: string;
|
|
173
178
|
}
|
|
174
|
-
declare function Drawer({ visible, onHide, title, subtitle, side, behavior, onBack, backLabel, closeLabel, footer, children, id, className, }: DrawerProps): react.JSX.Element;
|
|
179
|
+
declare function Drawer({ visible, onHide, title, subtitle, side, behavior, modal, onBack, backLabel, closeLabel, footer, children, id, className, }: DrawerProps): react.JSX.Element;
|
|
175
180
|
|
|
176
181
|
/**
|
|
177
182
|
* Hierarchy no Figma: Primary (Filled), Secondary (Tonal), Tertiary (Outlined) e Other (Icon),
|
package/dist/index.d.ts
CHANGED
|
@@ -161,6 +161,11 @@ interface DrawerProps {
|
|
|
161
161
|
side?: DrawerSide;
|
|
162
162
|
/** Padrão: full. */
|
|
163
163
|
behavior?: DrawerBehavior;
|
|
164
|
+
/**
|
|
165
|
+
* Com overlay (padrão): a gaveta é modal, a página atrás fica bloqueada e o clique no overlay
|
|
166
|
+
* fecha. Sem overlay (`false`): a página continua rolando e clicável, e só o X e o Esc fecham.
|
|
167
|
+
*/
|
|
168
|
+
modal?: boolean;
|
|
164
169
|
/** Mostra o botão de voltar antes do título. */
|
|
165
170
|
onBack?: () => void;
|
|
166
171
|
backLabel?: string;
|
|
@@ -171,7 +176,7 @@ interface DrawerProps {
|
|
|
171
176
|
id?: string;
|
|
172
177
|
className?: string;
|
|
173
178
|
}
|
|
174
|
-
declare function Drawer({ visible, onHide, title, subtitle, side, behavior, onBack, backLabel, closeLabel, footer, children, id, className, }: DrawerProps): react.JSX.Element;
|
|
179
|
+
declare function Drawer({ visible, onHide, title, subtitle, side, behavior, modal, onBack, backLabel, closeLabel, footer, children, id, className, }: DrawerProps): react.JSX.Element;
|
|
175
180
|
|
|
176
181
|
/**
|
|
177
182
|
* Hierarchy no Figma: Primary (Filled), Secondary (Tonal), Tertiary (Outlined) e Other (Icon),
|
package/dist/index.js
CHANGED
|
@@ -319,6 +319,7 @@ function Drawer({
|
|
|
319
319
|
subtitle,
|
|
320
320
|
side = "right",
|
|
321
321
|
behavior = "full",
|
|
322
|
+
modal = true,
|
|
322
323
|
onBack,
|
|
323
324
|
backLabel = "Voltar",
|
|
324
325
|
closeLabel = "Fechar",
|
|
@@ -352,7 +353,7 @@ function Drawer({
|
|
|
352
353
|
return () => observer.disconnect();
|
|
353
354
|
}, [rolagem, children]);
|
|
354
355
|
const prenderFoco = (event) => {
|
|
355
|
-
if (event.key !== "Tab" || !panelRef.current) return;
|
|
356
|
+
if (!modal || event.key !== "Tab" || !panelRef.current) return;
|
|
356
357
|
const focaveis = [...panelRef.current.querySelectorAll(FOCAVEIS)];
|
|
357
358
|
const primeiro = focaveis[0];
|
|
358
359
|
const ultimo = focaveis[focaveis.length - 1];
|
|
@@ -374,16 +375,29 @@ function Drawer({
|
|
|
374
375
|
visible,
|
|
375
376
|
onHide,
|
|
376
377
|
position: side,
|
|
377
|
-
|
|
378
|
+
modal,
|
|
379
|
+
blockScroll: modal,
|
|
380
|
+
dismissable: modal,
|
|
378
381
|
pt: {
|
|
379
|
-
mask: {
|
|
382
|
+
mask: {
|
|
383
|
+
className: `cr-drawer__mask cr-drawer__mask--${side}${modal ? "" : " cr-drawer__mask--sem-overlay"}`
|
|
384
|
+
},
|
|
380
385
|
root: {
|
|
381
386
|
className: classes,
|
|
382
387
|
role: "dialog",
|
|
383
|
-
"aria-modal":
|
|
388
|
+
"aria-modal": modal || void 0,
|
|
384
389
|
"aria-labelledby": titleId,
|
|
385
390
|
"aria-describedby": subtitle ? subtitleId : void 0,
|
|
386
391
|
onKeyDown: prenderFoco
|
|
392
|
+
},
|
|
393
|
+
// No unstyled o Prime não põe classes na transição: o Cristal dá as dele (Drawer.css).
|
|
394
|
+
// O tipo do Prime exige o addEndListener do react-transition-group, que aqui não se usa.
|
|
395
|
+
transition: {
|
|
396
|
+
classNames: {
|
|
397
|
+
enter: "cr-drawer--enter",
|
|
398
|
+
enterActive: "cr-drawer--enter-active",
|
|
399
|
+
exitActive: "cr-drawer--exit-active"
|
|
400
|
+
}
|
|
387
401
|
}
|
|
388
402
|
},
|
|
389
403
|
content: ({ closeIconRef, hide }) => /* @__PURE__ */ jsxs(
|