@vector-business-services/cristal-ds-web 0.12.0 → 0.13.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 +61 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -24
- package/dist/index.d.ts +44 -24
- package/dist/index.js +62 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, InputHTMLAttributes, HTMLAttributes, ButtonHTMLAttributes, CSSProperties, SyntheticEvent, MouseEvent
|
|
2
|
+
import { ReactNode, InputHTMLAttributes, HTMLAttributes, ButtonHTMLAttributes, CSSProperties, RefObject, SyntheticEvent, MouseEvent } from 'react';
|
|
3
3
|
import { AutoCompleteProps as AutoCompleteProps$1 } from 'primereact/autocomplete';
|
|
4
4
|
import { CheckboxChangeEvent } from 'primereact/checkbox';
|
|
5
5
|
import { ChipRemoveEvent } from 'primereact/chip';
|
|
@@ -271,6 +271,32 @@ interface DrawerProps {
|
|
|
271
271
|
}
|
|
272
272
|
declare function Drawer({ visible, onHide, title, subtitle, side, behavior, size, modal, onBack, backLabel, closeLabel, footer, children, id, className, }: DrawerProps): react.JSX.Element;
|
|
273
273
|
|
|
274
|
+
/** Type no Figma: Plain (rótulo curto, uma linha) e Rich (texto de até 300px, quebra linha). */
|
|
275
|
+
type TooltipType = 'plain' | 'rich';
|
|
276
|
+
type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
277
|
+
interface TooltipProps {
|
|
278
|
+
/** Elemento que mostra o tooltip: ref, elemento ou seletor CSS. */
|
|
279
|
+
target: RefObject<HTMLElement | null> | HTMLElement | string;
|
|
280
|
+
/** Texto do tooltip (Label no Plain, Text no Rich). */
|
|
281
|
+
content: ReactNode;
|
|
282
|
+
type?: TooltipType;
|
|
283
|
+
/** Lado do alvo. O Prime inverte o lado se faltar espaço na tela. */
|
|
284
|
+
position?: TooltipPosition;
|
|
285
|
+
/** O que abre o tooltip; o padrão abre no hover e no foco do teclado. */
|
|
286
|
+
event?: 'hover' | 'focus' | 'both';
|
|
287
|
+
showDelay?: number;
|
|
288
|
+
hideDelay?: number;
|
|
289
|
+
disabled?: boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Liga o texto ao alvo como descrição (aria-describedby). Padrão: true. Use false quando o texto
|
|
292
|
+
* já é o nome do alvo (como no IconButton), para o leitor de tela não ler duas vezes.
|
|
293
|
+
*/
|
|
294
|
+
describe?: boolean;
|
|
295
|
+
id?: string;
|
|
296
|
+
className?: string;
|
|
297
|
+
}
|
|
298
|
+
declare function Tooltip({ target, content, type, position, event, showDelay, hideDelay, disabled, describe, id, className, }: TooltipProps): react.JSX.Element;
|
|
299
|
+
|
|
274
300
|
/**
|
|
275
301
|
* Hierarchy no Figma: Primary (Filled), Secondary (Tonal), Tertiary (Outlined) e Other (Icon),
|
|
276
302
|
* que aqui é `ghost`: só o ícone, com fundo no hover.
|
|
@@ -285,6 +311,13 @@ interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
|
|
|
285
311
|
icon: ReactNode;
|
|
286
312
|
/** Obrigatório: o botão não tem texto, então é isso que o leitor de tela anuncia. */
|
|
287
313
|
'aria-label': string;
|
|
314
|
+
/**
|
|
315
|
+
* Tooltip do botão. Padrão: o próprio `aria-label`, para quem vê saber o que o ícone faz. Um
|
|
316
|
+
* texto diferente vira também a descrição do botão; `false` tira o tooltip.
|
|
317
|
+
*/
|
|
318
|
+
tooltip?: ReactNode | false;
|
|
319
|
+
/** Lado do tooltip. Padrão: bottom. */
|
|
320
|
+
tooltipPosition?: TooltipPosition;
|
|
288
321
|
}
|
|
289
322
|
declare const IconButton: react.ForwardRefExoticComponent<IconButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
290
323
|
|
|
@@ -554,9 +587,17 @@ interface PageHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>
|
|
|
554
587
|
segmentControl?: ReactNode;
|
|
555
588
|
/** Botões das ferramentas (Show Buttons no Figma), 8px entre eles. */
|
|
556
589
|
actions?: ReactNode;
|
|
557
|
-
/**
|
|
558
|
-
|
|
590
|
+
/**
|
|
591
|
+
* Mostra o botão de expandir, o último das ferramentas. Recebe o novo estado: true ao expandir,
|
|
592
|
+
* false ao recolher.
|
|
593
|
+
*/
|
|
594
|
+
onExpand?: (expanded: boolean) => void;
|
|
595
|
+
/** Expandido (controlado). Sem ele, o PageHeader alterna sozinho a cada clique. */
|
|
596
|
+
expanded?: boolean;
|
|
597
|
+
/** Nome do botão recolhido (ArrowsOutSimple). */
|
|
559
598
|
expandLabel?: string;
|
|
599
|
+
/** Nome do botão expandido (ArrowsInSimple). */
|
|
600
|
+
collapseLabel?: string;
|
|
560
601
|
/** Abas abaixo do título (Show Tabs no Figma). */
|
|
561
602
|
tabs?: PageHeaderTab[];
|
|
562
603
|
/** Aba ativa (controlado). Sem ela, o PageHeader controla sozinho. */
|
|
@@ -791,26 +832,5 @@ interface ToastProps {
|
|
|
791
832
|
}
|
|
792
833
|
declare const Toast: react.ForwardRefExoticComponent<ToastProps & react.RefAttributes<ToastHandle>>;
|
|
793
834
|
|
|
794
|
-
/** Type no Figma: Plain (rótulo curto, uma linha) e Rich (texto de até 300px, quebra linha). */
|
|
795
|
-
type TooltipType = 'plain' | 'rich';
|
|
796
|
-
type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
797
|
-
interface TooltipProps {
|
|
798
|
-
/** Elemento que mostra o tooltip: ref, elemento ou seletor CSS. */
|
|
799
|
-
target: RefObject<HTMLElement | null> | HTMLElement | string;
|
|
800
|
-
/** Texto do tooltip (Label no Plain, Text no Rich). */
|
|
801
|
-
content: ReactNode;
|
|
802
|
-
type?: TooltipType;
|
|
803
|
-
/** Lado do alvo. O Prime inverte o lado se faltar espaço na tela. */
|
|
804
|
-
position?: TooltipPosition;
|
|
805
|
-
/** O que abre o tooltip; o padrão abre no hover e no foco do teclado. */
|
|
806
|
-
event?: 'hover' | 'focus' | 'both';
|
|
807
|
-
showDelay?: number;
|
|
808
|
-
hideDelay?: number;
|
|
809
|
-
disabled?: boolean;
|
|
810
|
-
id?: string;
|
|
811
|
-
className?: string;
|
|
812
|
-
}
|
|
813
|
-
declare function Tooltip({ target, content, type, position, event, showDelay, hideDelay, disabled, id, className, }: TooltipProps): react.JSX.Element;
|
|
814
|
-
|
|
815
835
|
export { Accordion, AccordionTab, AutoComplete, Badge, Button, Card, Chart, Checkbox, Chip, Divider, Drawer, IconButton, Input, Menu, MenuPrincipal, Menubar, Message, Modal, MultiSelect, PageHeader, Paginator, Panel, Radio, ScrollPanel, SegmentControl, Select, Switch, TabPanel, Tabs, Tag, Toast, Tooltip };
|
|
816
836
|
export type { AccordionProps, AccordionTabProps, AutoCompleteProps, AutoCompleteSize, AutoCompleteVariant, BadgeProps, BadgeSize, BadgeVariant, ButtonProps, ButtonSize, ButtonVariant, CardPadding, CardProps, ChartAxis, ChartColor, ChartProps, ChartSeries, CheckboxLabelSize, CheckboxPosition, CheckboxProps, ChipProps, ChipSize, ChipVariant, DividerOrientation, DividerProps, DividerVariant, DrawerBehavior, DrawerProps, DrawerSide, DrawerSize, IconButtonProps, IconButtonSize, IconButtonVariant, InputProps, InputSize, InputVariant, MenuDensity, MenuHandle, MenuItem, MenuPrincipalEntry, MenuPrincipalGroup, MenuPrincipalHandle, MenuPrincipalItem, MenuPrincipalProps, MenuProps, MenubarProps, MenubarTool, MenubarUser, MessageProps, MessageType, ModalProps, ModalSize, MultiSelectDensity, MultiSelectProps, MultiSelectSize, MultiSelectVariant, PageHeaderProps, PageHeaderTab, PageHeaderVariant, PaginatorPageChangeEvent, PaginatorProps, PanelProps, RadioLabelSize, RadioProps, ScrollPanelProps, SegmentControlOption, SegmentControlProps, SegmentControlVariant, SelectProps, SelectSize, SelectVariant, SwitchLabelPosition, SwitchProps, SwitchSize, TabPanelProps, TabsProps, TagProps, TagSize, TagVariant, ToastHandle, ToastMessage, ToastPosition, ToastProps, ToastType, TooltipPosition, TooltipProps, TooltipType };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, InputHTMLAttributes, HTMLAttributes, ButtonHTMLAttributes, CSSProperties, SyntheticEvent, MouseEvent
|
|
2
|
+
import { ReactNode, InputHTMLAttributes, HTMLAttributes, ButtonHTMLAttributes, CSSProperties, RefObject, SyntheticEvent, MouseEvent } from 'react';
|
|
3
3
|
import { AutoCompleteProps as AutoCompleteProps$1 } from 'primereact/autocomplete';
|
|
4
4
|
import { CheckboxChangeEvent } from 'primereact/checkbox';
|
|
5
5
|
import { ChipRemoveEvent } from 'primereact/chip';
|
|
@@ -271,6 +271,32 @@ interface DrawerProps {
|
|
|
271
271
|
}
|
|
272
272
|
declare function Drawer({ visible, onHide, title, subtitle, side, behavior, size, modal, onBack, backLabel, closeLabel, footer, children, id, className, }: DrawerProps): react.JSX.Element;
|
|
273
273
|
|
|
274
|
+
/** Type no Figma: Plain (rótulo curto, uma linha) e Rich (texto de até 300px, quebra linha). */
|
|
275
|
+
type TooltipType = 'plain' | 'rich';
|
|
276
|
+
type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
277
|
+
interface TooltipProps {
|
|
278
|
+
/** Elemento que mostra o tooltip: ref, elemento ou seletor CSS. */
|
|
279
|
+
target: RefObject<HTMLElement | null> | HTMLElement | string;
|
|
280
|
+
/** Texto do tooltip (Label no Plain, Text no Rich). */
|
|
281
|
+
content: ReactNode;
|
|
282
|
+
type?: TooltipType;
|
|
283
|
+
/** Lado do alvo. O Prime inverte o lado se faltar espaço na tela. */
|
|
284
|
+
position?: TooltipPosition;
|
|
285
|
+
/** O que abre o tooltip; o padrão abre no hover e no foco do teclado. */
|
|
286
|
+
event?: 'hover' | 'focus' | 'both';
|
|
287
|
+
showDelay?: number;
|
|
288
|
+
hideDelay?: number;
|
|
289
|
+
disabled?: boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Liga o texto ao alvo como descrição (aria-describedby). Padrão: true. Use false quando o texto
|
|
292
|
+
* já é o nome do alvo (como no IconButton), para o leitor de tela não ler duas vezes.
|
|
293
|
+
*/
|
|
294
|
+
describe?: boolean;
|
|
295
|
+
id?: string;
|
|
296
|
+
className?: string;
|
|
297
|
+
}
|
|
298
|
+
declare function Tooltip({ target, content, type, position, event, showDelay, hideDelay, disabled, describe, id, className, }: TooltipProps): react.JSX.Element;
|
|
299
|
+
|
|
274
300
|
/**
|
|
275
301
|
* Hierarchy no Figma: Primary (Filled), Secondary (Tonal), Tertiary (Outlined) e Other (Icon),
|
|
276
302
|
* que aqui é `ghost`: só o ícone, com fundo no hover.
|
|
@@ -285,6 +311,13 @@ interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>,
|
|
|
285
311
|
icon: ReactNode;
|
|
286
312
|
/** Obrigatório: o botão não tem texto, então é isso que o leitor de tela anuncia. */
|
|
287
313
|
'aria-label': string;
|
|
314
|
+
/**
|
|
315
|
+
* Tooltip do botão. Padrão: o próprio `aria-label`, para quem vê saber o que o ícone faz. Um
|
|
316
|
+
* texto diferente vira também a descrição do botão; `false` tira o tooltip.
|
|
317
|
+
*/
|
|
318
|
+
tooltip?: ReactNode | false;
|
|
319
|
+
/** Lado do tooltip. Padrão: bottom. */
|
|
320
|
+
tooltipPosition?: TooltipPosition;
|
|
288
321
|
}
|
|
289
322
|
declare const IconButton: react.ForwardRefExoticComponent<IconButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
290
323
|
|
|
@@ -554,9 +587,17 @@ interface PageHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>
|
|
|
554
587
|
segmentControl?: ReactNode;
|
|
555
588
|
/** Botões das ferramentas (Show Buttons no Figma), 8px entre eles. */
|
|
556
589
|
actions?: ReactNode;
|
|
557
|
-
/**
|
|
558
|
-
|
|
590
|
+
/**
|
|
591
|
+
* Mostra o botão de expandir, o último das ferramentas. Recebe o novo estado: true ao expandir,
|
|
592
|
+
* false ao recolher.
|
|
593
|
+
*/
|
|
594
|
+
onExpand?: (expanded: boolean) => void;
|
|
595
|
+
/** Expandido (controlado). Sem ele, o PageHeader alterna sozinho a cada clique. */
|
|
596
|
+
expanded?: boolean;
|
|
597
|
+
/** Nome do botão recolhido (ArrowsOutSimple). */
|
|
559
598
|
expandLabel?: string;
|
|
599
|
+
/** Nome do botão expandido (ArrowsInSimple). */
|
|
600
|
+
collapseLabel?: string;
|
|
560
601
|
/** Abas abaixo do título (Show Tabs no Figma). */
|
|
561
602
|
tabs?: PageHeaderTab[];
|
|
562
603
|
/** Aba ativa (controlado). Sem ela, o PageHeader controla sozinho. */
|
|
@@ -791,26 +832,5 @@ interface ToastProps {
|
|
|
791
832
|
}
|
|
792
833
|
declare const Toast: react.ForwardRefExoticComponent<ToastProps & react.RefAttributes<ToastHandle>>;
|
|
793
834
|
|
|
794
|
-
/** Type no Figma: Plain (rótulo curto, uma linha) e Rich (texto de até 300px, quebra linha). */
|
|
795
|
-
type TooltipType = 'plain' | 'rich';
|
|
796
|
-
type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
797
|
-
interface TooltipProps {
|
|
798
|
-
/** Elemento que mostra o tooltip: ref, elemento ou seletor CSS. */
|
|
799
|
-
target: RefObject<HTMLElement | null> | HTMLElement | string;
|
|
800
|
-
/** Texto do tooltip (Label no Plain, Text no Rich). */
|
|
801
|
-
content: ReactNode;
|
|
802
|
-
type?: TooltipType;
|
|
803
|
-
/** Lado do alvo. O Prime inverte o lado se faltar espaço na tela. */
|
|
804
|
-
position?: TooltipPosition;
|
|
805
|
-
/** O que abre o tooltip; o padrão abre no hover e no foco do teclado. */
|
|
806
|
-
event?: 'hover' | 'focus' | 'both';
|
|
807
|
-
showDelay?: number;
|
|
808
|
-
hideDelay?: number;
|
|
809
|
-
disabled?: boolean;
|
|
810
|
-
id?: string;
|
|
811
|
-
className?: string;
|
|
812
|
-
}
|
|
813
|
-
declare function Tooltip({ target, content, type, position, event, showDelay, hideDelay, disabled, id, className, }: TooltipProps): react.JSX.Element;
|
|
814
|
-
|
|
815
835
|
export { Accordion, AccordionTab, AutoComplete, Badge, Button, Card, Chart, Checkbox, Chip, Divider, Drawer, IconButton, Input, Menu, MenuPrincipal, Menubar, Message, Modal, MultiSelect, PageHeader, Paginator, Panel, Radio, ScrollPanel, SegmentControl, Select, Switch, TabPanel, Tabs, Tag, Toast, Tooltip };
|
|
816
836
|
export type { AccordionProps, AccordionTabProps, AutoCompleteProps, AutoCompleteSize, AutoCompleteVariant, BadgeProps, BadgeSize, BadgeVariant, ButtonProps, ButtonSize, ButtonVariant, CardPadding, CardProps, ChartAxis, ChartColor, ChartProps, ChartSeries, CheckboxLabelSize, CheckboxPosition, CheckboxProps, ChipProps, ChipSize, ChipVariant, DividerOrientation, DividerProps, DividerVariant, DrawerBehavior, DrawerProps, DrawerSide, DrawerSize, IconButtonProps, IconButtonSize, IconButtonVariant, InputProps, InputSize, InputVariant, MenuDensity, MenuHandle, MenuItem, MenuPrincipalEntry, MenuPrincipalGroup, MenuPrincipalHandle, MenuPrincipalItem, MenuPrincipalProps, MenuProps, MenubarProps, MenubarTool, MenubarUser, MessageProps, MessageType, ModalProps, ModalSize, MultiSelectDensity, MultiSelectProps, MultiSelectSize, MultiSelectVariant, PageHeaderProps, PageHeaderTab, PageHeaderVariant, PaginatorPageChangeEvent, PaginatorProps, PanelProps, RadioLabelSize, RadioProps, ScrollPanelProps, SegmentControlOption, SegmentControlProps, SegmentControlVariant, SelectProps, SelectSize, SelectVariant, SwitchLabelPosition, SwitchProps, SwitchSize, TabPanelProps, TabsProps, TagProps, TagSize, TagVariant, ToastHandle, ToastMessage, ToastPosition, ToastProps, ToastType, TooltipPosition, TooltipProps, TooltipType };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forwardRef, useRef, useImperativeHandle, useState, Children, isValidElement, useId, useCallback, useEffect, useContext, cloneElement, useLayoutEffect, useMemo } from 'react';
|
|
2
2
|
import { Accordion as Accordion$1, AccordionTab as AccordionTab$1 } from 'primereact/accordion';
|
|
3
|
-
import { WarningCircle, Info, Check, CircleNotch, CaretDown, MagnifyingGlass, ArrowLeft, ArrowsOutSimple, CaretUp, X, List, DribbbleLogo, SealWarning, XCircle, CheckCircle, Warning, CaretDoubleRight, CaretRight, CaretLeft, CaretDoubleLeft, Question } from '@phosphor-icons/react';
|
|
3
|
+
import { WarningCircle, Info, Check, CircleNotch, CaretDown, MagnifyingGlass, ArrowLeft, ArrowsInSimple, ArrowsOutSimple, CaretUp, X, List, DribbbleLogo, SealWarning, XCircle, CheckCircle, Warning, CaretDoubleRight, CaretRight, CaretLeft, CaretDoubleLeft, Question } from '@phosphor-icons/react';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { AutoComplete as AutoComplete$1 } from 'primereact/autocomplete';
|
|
6
6
|
import { Badge as Badge$1 } from 'primereact/badge';
|
|
@@ -209,6 +209,11 @@ var Card = forwardRef(function Card2({ padding = "xsmall", outline = false, clas
|
|
|
209
209
|
}
|
|
210
210
|
);
|
|
211
211
|
});
|
|
212
|
+
var usandoTeclado = false;
|
|
213
|
+
if (typeof document !== "undefined") {
|
|
214
|
+
document.addEventListener("keydown", () => usandoTeclado = true, true);
|
|
215
|
+
document.addEventListener("pointerdown", () => usandoTeclado = false, true);
|
|
216
|
+
}
|
|
212
217
|
var resolveTargets = (target) => {
|
|
213
218
|
if (typeof target === "string") return Array.from(document.querySelectorAll(target));
|
|
214
219
|
if (target instanceof HTMLElement) return [target];
|
|
@@ -223,16 +228,18 @@ function Tooltip({
|
|
|
223
228
|
showDelay,
|
|
224
229
|
hideDelay,
|
|
225
230
|
disabled,
|
|
231
|
+
describe = true,
|
|
226
232
|
id,
|
|
227
233
|
className
|
|
228
234
|
}) {
|
|
229
235
|
const autoId = useId();
|
|
230
236
|
const tooltipId = id ?? autoId;
|
|
231
237
|
useEffect(() => {
|
|
238
|
+
if (!describe) return;
|
|
232
239
|
const elements = resolveTargets(target);
|
|
233
240
|
elements.forEach((element) => element.setAttribute("aria-describedby", tooltipId));
|
|
234
241
|
return () => elements.forEach((element) => element.removeAttribute("aria-describedby"));
|
|
235
|
-
}, [target, tooltipId]);
|
|
242
|
+
}, [target, tooltipId, describe]);
|
|
236
243
|
const classes = ["cr-tooltip", `cr-tooltip--${type}`, className].filter(Boolean).join(" ");
|
|
237
244
|
const pt = {
|
|
238
245
|
root: (options) => {
|
|
@@ -253,6 +260,7 @@ function Tooltip({
|
|
|
253
260
|
showDelay,
|
|
254
261
|
hideDelay,
|
|
255
262
|
disabled,
|
|
263
|
+
onBeforeShow: (e) => e.originalEvent?.type !== "focus" || usandoTeclado,
|
|
256
264
|
pt,
|
|
257
265
|
children: content
|
|
258
266
|
}
|
|
@@ -656,24 +664,54 @@ var Divider = forwardRef(function Divider2({ orientation = "horizontal", variant
|
|
|
656
664
|
}
|
|
657
665
|
);
|
|
658
666
|
});
|
|
659
|
-
var IconButton = forwardRef(function IconButton2({
|
|
667
|
+
var IconButton = forwardRef(function IconButton2({
|
|
668
|
+
variant = "primary",
|
|
669
|
+
size = "large",
|
|
670
|
+
icon,
|
|
671
|
+
type = "button",
|
|
672
|
+
tooltip,
|
|
673
|
+
tooltipPosition,
|
|
674
|
+
className,
|
|
675
|
+
...props
|
|
676
|
+
}, ref) {
|
|
677
|
+
const botao = useRef(null);
|
|
678
|
+
const ligar = useCallback(
|
|
679
|
+
(elemento) => {
|
|
680
|
+
botao.current = elemento;
|
|
681
|
+
if (typeof ref === "function") ref(elemento);
|
|
682
|
+
else if (ref) ref.current = elemento;
|
|
683
|
+
},
|
|
684
|
+
[ref]
|
|
685
|
+
);
|
|
686
|
+
const texto = tooltip ?? props["aria-label"];
|
|
660
687
|
const classes = [
|
|
661
688
|
"cr-icon-button",
|
|
662
689
|
`cr-icon-button--${variant}`,
|
|
663
690
|
`cr-icon-button--${size}`,
|
|
664
691
|
className
|
|
665
692
|
].filter(Boolean).join(" ");
|
|
666
|
-
return /* @__PURE__ */
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
693
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
694
|
+
/* @__PURE__ */ jsx(
|
|
695
|
+
Button$1,
|
|
696
|
+
{
|
|
697
|
+
unstyled: true,
|
|
698
|
+
ref: ligar,
|
|
699
|
+
type,
|
|
700
|
+
className: classes,
|
|
701
|
+
...props,
|
|
702
|
+
children: /* @__PURE__ */ jsx("span", { className: "cr-icon-button__icon", "aria-hidden": "true", children: icon })
|
|
703
|
+
}
|
|
704
|
+
),
|
|
705
|
+
texto !== false && /* @__PURE__ */ jsx(
|
|
706
|
+
Tooltip,
|
|
707
|
+
{
|
|
708
|
+
target: botao,
|
|
709
|
+
content: texto,
|
|
710
|
+
position: tooltipPosition,
|
|
711
|
+
describe: texto !== props["aria-label"]
|
|
712
|
+
}
|
|
713
|
+
)
|
|
714
|
+
] });
|
|
677
715
|
});
|
|
678
716
|
var FOCAVEIS = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
679
717
|
function Drawer({
|
|
@@ -1590,7 +1628,9 @@ var PageHeader = forwardRef(function PageHeader2({
|
|
|
1590
1628
|
segmentControl,
|
|
1591
1629
|
actions,
|
|
1592
1630
|
onExpand,
|
|
1631
|
+
expanded,
|
|
1593
1632
|
expandLabel = "Expandir",
|
|
1633
|
+
collapseLabel = "Recolher",
|
|
1594
1634
|
tabs,
|
|
1595
1635
|
activeTab,
|
|
1596
1636
|
onTabChange,
|
|
@@ -1600,6 +1640,8 @@ var PageHeader = forwardRef(function PageHeader2({
|
|
|
1600
1640
|
}, ref) {
|
|
1601
1641
|
const [interna, setInterna] = useState(0);
|
|
1602
1642
|
const ativa = activeTab ?? interna;
|
|
1643
|
+
const [expandidoInterno, setExpandidoInterno] = useState(false);
|
|
1644
|
+
const expandido = expanded ?? expandidoInterno;
|
|
1603
1645
|
const tools = segmentControl || actions;
|
|
1604
1646
|
const tabTemplate = (tab) => (
|
|
1605
1647
|
// O TabMenu também passa o index da aba nas opções, além do que o tipo do MenuItem declara.
|
|
@@ -1647,9 +1689,12 @@ var PageHeader = forwardRef(function PageHeader2({
|
|
|
1647
1689
|
className: "cr-page-header__expand",
|
|
1648
1690
|
variant: "tertiary",
|
|
1649
1691
|
size: "medium",
|
|
1650
|
-
icon: /* @__PURE__ */ jsx(ArrowsOutSimple, {}),
|
|
1651
|
-
"aria-label": expandLabel,
|
|
1652
|
-
onClick:
|
|
1692
|
+
icon: expandido ? /* @__PURE__ */ jsx(ArrowsInSimple, {}) : /* @__PURE__ */ jsx(ArrowsOutSimple, {}),
|
|
1693
|
+
"aria-label": expandido ? collapseLabel : expandLabel,
|
|
1694
|
+
onClick: () => {
|
|
1695
|
+
setExpandidoInterno(!expandido);
|
|
1696
|
+
onExpand(!expandido);
|
|
1697
|
+
}
|
|
1653
1698
|
}
|
|
1654
1699
|
)
|
|
1655
1700
|
]
|