@vector-business-services/cristal-ds-web 0.5.0 → 0.7.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 +119 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +352 -94
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +56 -3
- package/dist/index.d.ts +56 -3
- package/dist/index.js +120 -23
- 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),
|
|
@@ -289,6 +294,54 @@ interface MenubarProps {
|
|
|
289
294
|
}
|
|
290
295
|
declare const Menubar: react.ForwardRefExoticComponent<MenubarProps & react.RefAttributes<HTMLDivElement>>;
|
|
291
296
|
|
|
297
|
+
/** Um produto do menu (.Menu Principal / Item no Figma). */
|
|
298
|
+
interface MenuPrincipalItem {
|
|
299
|
+
/** Nome do produto (Item Label no Figma). */
|
|
300
|
+
label: string;
|
|
301
|
+
/** Texto de apoio abaixo do nome, até 2 linhas. */
|
|
302
|
+
description?: string;
|
|
303
|
+
/** Ícone no círculo à esquerda. Use um ícone de `@vector-business-services/cristal-ds-web/icons`. */
|
|
304
|
+
icon: ReactNode;
|
|
305
|
+
/** Texto da tag no canto (Show Tag no Figma, onde é "Experimente"). */
|
|
306
|
+
tag?: string;
|
|
307
|
+
/** Ação do item; o menu popup fecha depois dela. */
|
|
308
|
+
command?: (event: MenuItemCommandEvent) => void;
|
|
309
|
+
/** Link do item; sem ele o clique não navega. */
|
|
310
|
+
url?: string;
|
|
311
|
+
target?: string;
|
|
312
|
+
id?: string;
|
|
313
|
+
className?: string;
|
|
314
|
+
}
|
|
315
|
+
/** Um grupo de produtos com título (Product Group no Figma). */
|
|
316
|
+
interface MenuPrincipalGroup {
|
|
317
|
+
/** Título do grupo, acima dos itens. */
|
|
318
|
+
label: string;
|
|
319
|
+
items: MenuPrincipalItem[];
|
|
320
|
+
id?: string;
|
|
321
|
+
}
|
|
322
|
+
type MenuPrincipalEntry = MenuPrincipalItem | MenuPrincipalGroup;
|
|
323
|
+
interface MenuPrincipalProps {
|
|
324
|
+
/** Itens soltos e grupos, na ordem; o divisor tracejado entra antes e depois de cada grupo. */
|
|
325
|
+
model: MenuPrincipalEntry[];
|
|
326
|
+
/** Abre sobre a tela, posicionado no elemento que chamou `toggle`/`show` pela ref. */
|
|
327
|
+
popup?: boolean;
|
|
328
|
+
/** Nome acessível do menu. */
|
|
329
|
+
'aria-label'?: string;
|
|
330
|
+
onShow?: (event: SyntheticEvent) => void;
|
|
331
|
+
onHide?: (event: SyntheticEvent) => void;
|
|
332
|
+
id?: string;
|
|
333
|
+
className?: string;
|
|
334
|
+
}
|
|
335
|
+
/** Controle do menu popup, pela ref. */
|
|
336
|
+
interface MenuPrincipalHandle {
|
|
337
|
+
toggle: (event: SyntheticEvent) => void;
|
|
338
|
+
show: (event: SyntheticEvent) => void;
|
|
339
|
+
hide: (event: SyntheticEvent) => void;
|
|
340
|
+
/** O <div> raiz do menu (só existe com o popup aberto). */
|
|
341
|
+
getElement: () => HTMLDivElement | null;
|
|
342
|
+
}
|
|
343
|
+
declare const MenuPrincipal: react.ForwardRefExoticComponent<MenuPrincipalProps & react.RefAttributes<MenuPrincipalHandle>>;
|
|
344
|
+
|
|
292
345
|
/**
|
|
293
346
|
* Size no Figma: Small (520px), Medium (768px) e Large (1200 x 720px; abaixo de 768px de tela
|
|
294
347
|
* vira tela cheia, como o Responsive=360 do Figma).
|
|
@@ -553,5 +606,5 @@ interface TooltipProps {
|
|
|
553
606
|
}
|
|
554
607
|
declare function Tooltip({ target, content, type, position, event, showDelay, hideDelay, disabled, id, className, }: TooltipProps): react.JSX.Element;
|
|
555
608
|
|
|
556
|
-
export { AutoComplete, Badge, Button, Card, Checkbox, Chip, Divider, Drawer, IconButton, Input, Menu, Menubar, Modal, MultiSelect, Panel, Radio, ScrollPanel, SegmentControl, Select, Switch, TabPanel, Tabs, Tag, Tooltip };
|
|
557
|
-
export type { AutoCompleteProps, AutoCompleteSize, AutoCompleteVariant, BadgeProps, BadgeSize, BadgeVariant, ButtonProps, ButtonSize, ButtonVariant, CardPadding, CardProps, CheckboxLabelSize, CheckboxPosition, CheckboxProps, ChipProps, ChipSize, ChipVariant, DividerOrientation, DividerProps, DividerVariant, DrawerBehavior, DrawerProps, DrawerSide, IconButtonProps, IconButtonSize, IconButtonVariant, InputProps, InputSize, InputVariant, MenuDensity, MenuHandle, MenuItem, MenuProps, MenubarProps, MenubarTool, MenubarUser, ModalProps, ModalSize, MultiSelectDensity, MultiSelectProps, MultiSelectSize, MultiSelectVariant, PanelProps, RadioLabelSize, RadioProps, ScrollPanelProps, SegmentControlOption, SegmentControlProps, SegmentControlVariant, SelectProps, SelectSize, SelectVariant, SwitchLabelPosition, SwitchProps, SwitchSize, TabPanelProps, TabsProps, TagProps, TagSize, TagVariant, TooltipPosition, TooltipProps, TooltipType };
|
|
609
|
+
export { AutoComplete, Badge, Button, Card, Checkbox, Chip, Divider, Drawer, IconButton, Input, Menu, MenuPrincipal, Menubar, Modal, MultiSelect, Panel, Radio, ScrollPanel, SegmentControl, Select, Switch, TabPanel, Tabs, Tag, Tooltip };
|
|
610
|
+
export type { AutoCompleteProps, AutoCompleteSize, AutoCompleteVariant, BadgeProps, BadgeSize, BadgeVariant, ButtonProps, ButtonSize, ButtonVariant, CardPadding, CardProps, CheckboxLabelSize, CheckboxPosition, CheckboxProps, ChipProps, ChipSize, ChipVariant, DividerOrientation, DividerProps, DividerVariant, DrawerBehavior, DrawerProps, DrawerSide, IconButtonProps, IconButtonSize, IconButtonVariant, InputProps, InputSize, InputVariant, MenuDensity, MenuHandle, MenuItem, MenuPrincipalEntry, MenuPrincipalGroup, MenuPrincipalHandle, MenuPrincipalItem, MenuPrincipalProps, MenuProps, MenubarProps, MenubarTool, MenubarUser, ModalProps, ModalSize, MultiSelectDensity, MultiSelectProps, MultiSelectSize, MultiSelectVariant, PanelProps, RadioLabelSize, RadioProps, ScrollPanelProps, SegmentControlOption, SegmentControlProps, SegmentControlVariant, SelectProps, SelectSize, SelectVariant, SwitchLabelPosition, SwitchProps, SwitchSize, TabPanelProps, TabsProps, TagProps, TagSize, TagVariant, TooltipPosition, TooltipProps, TooltipType };
|
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),
|
|
@@ -289,6 +294,54 @@ interface MenubarProps {
|
|
|
289
294
|
}
|
|
290
295
|
declare const Menubar: react.ForwardRefExoticComponent<MenubarProps & react.RefAttributes<HTMLDivElement>>;
|
|
291
296
|
|
|
297
|
+
/** Um produto do menu (.Menu Principal / Item no Figma). */
|
|
298
|
+
interface MenuPrincipalItem {
|
|
299
|
+
/** Nome do produto (Item Label no Figma). */
|
|
300
|
+
label: string;
|
|
301
|
+
/** Texto de apoio abaixo do nome, até 2 linhas. */
|
|
302
|
+
description?: string;
|
|
303
|
+
/** Ícone no círculo à esquerda. Use um ícone de `@vector-business-services/cristal-ds-web/icons`. */
|
|
304
|
+
icon: ReactNode;
|
|
305
|
+
/** Texto da tag no canto (Show Tag no Figma, onde é "Experimente"). */
|
|
306
|
+
tag?: string;
|
|
307
|
+
/** Ação do item; o menu popup fecha depois dela. */
|
|
308
|
+
command?: (event: MenuItemCommandEvent) => void;
|
|
309
|
+
/** Link do item; sem ele o clique não navega. */
|
|
310
|
+
url?: string;
|
|
311
|
+
target?: string;
|
|
312
|
+
id?: string;
|
|
313
|
+
className?: string;
|
|
314
|
+
}
|
|
315
|
+
/** Um grupo de produtos com título (Product Group no Figma). */
|
|
316
|
+
interface MenuPrincipalGroup {
|
|
317
|
+
/** Título do grupo, acima dos itens. */
|
|
318
|
+
label: string;
|
|
319
|
+
items: MenuPrincipalItem[];
|
|
320
|
+
id?: string;
|
|
321
|
+
}
|
|
322
|
+
type MenuPrincipalEntry = MenuPrincipalItem | MenuPrincipalGroup;
|
|
323
|
+
interface MenuPrincipalProps {
|
|
324
|
+
/** Itens soltos e grupos, na ordem; o divisor tracejado entra antes e depois de cada grupo. */
|
|
325
|
+
model: MenuPrincipalEntry[];
|
|
326
|
+
/** Abre sobre a tela, posicionado no elemento que chamou `toggle`/`show` pela ref. */
|
|
327
|
+
popup?: boolean;
|
|
328
|
+
/** Nome acessível do menu. */
|
|
329
|
+
'aria-label'?: string;
|
|
330
|
+
onShow?: (event: SyntheticEvent) => void;
|
|
331
|
+
onHide?: (event: SyntheticEvent) => void;
|
|
332
|
+
id?: string;
|
|
333
|
+
className?: string;
|
|
334
|
+
}
|
|
335
|
+
/** Controle do menu popup, pela ref. */
|
|
336
|
+
interface MenuPrincipalHandle {
|
|
337
|
+
toggle: (event: SyntheticEvent) => void;
|
|
338
|
+
show: (event: SyntheticEvent) => void;
|
|
339
|
+
hide: (event: SyntheticEvent) => void;
|
|
340
|
+
/** O <div> raiz do menu (só existe com o popup aberto). */
|
|
341
|
+
getElement: () => HTMLDivElement | null;
|
|
342
|
+
}
|
|
343
|
+
declare const MenuPrincipal: react.ForwardRefExoticComponent<MenuPrincipalProps & react.RefAttributes<MenuPrincipalHandle>>;
|
|
344
|
+
|
|
292
345
|
/**
|
|
293
346
|
* Size no Figma: Small (520px), Medium (768px) e Large (1200 x 720px; abaixo de 768px de tela
|
|
294
347
|
* vira tela cheia, como o Responsive=360 do Figma).
|
|
@@ -553,5 +606,5 @@ interface TooltipProps {
|
|
|
553
606
|
}
|
|
554
607
|
declare function Tooltip({ target, content, type, position, event, showDelay, hideDelay, disabled, id, className, }: TooltipProps): react.JSX.Element;
|
|
555
608
|
|
|
556
|
-
export { AutoComplete, Badge, Button, Card, Checkbox, Chip, Divider, Drawer, IconButton, Input, Menu, Menubar, Modal, MultiSelect, Panel, Radio, ScrollPanel, SegmentControl, Select, Switch, TabPanel, Tabs, Tag, Tooltip };
|
|
557
|
-
export type { AutoCompleteProps, AutoCompleteSize, AutoCompleteVariant, BadgeProps, BadgeSize, BadgeVariant, ButtonProps, ButtonSize, ButtonVariant, CardPadding, CardProps, CheckboxLabelSize, CheckboxPosition, CheckboxProps, ChipProps, ChipSize, ChipVariant, DividerOrientation, DividerProps, DividerVariant, DrawerBehavior, DrawerProps, DrawerSide, IconButtonProps, IconButtonSize, IconButtonVariant, InputProps, InputSize, InputVariant, MenuDensity, MenuHandle, MenuItem, MenuProps, MenubarProps, MenubarTool, MenubarUser, ModalProps, ModalSize, MultiSelectDensity, MultiSelectProps, MultiSelectSize, MultiSelectVariant, PanelProps, RadioLabelSize, RadioProps, ScrollPanelProps, SegmentControlOption, SegmentControlProps, SegmentControlVariant, SelectProps, SelectSize, SelectVariant, SwitchLabelPosition, SwitchProps, SwitchSize, TabPanelProps, TabsProps, TagProps, TagSize, TagVariant, TooltipPosition, TooltipProps, TooltipType };
|
|
609
|
+
export { AutoComplete, Badge, Button, Card, Checkbox, Chip, Divider, Drawer, IconButton, Input, Menu, MenuPrincipal, Menubar, Modal, MultiSelect, Panel, Radio, ScrollPanel, SegmentControl, Select, Switch, TabPanel, Tabs, Tag, Tooltip };
|
|
610
|
+
export type { AutoCompleteProps, AutoCompleteSize, AutoCompleteVariant, BadgeProps, BadgeSize, BadgeVariant, ButtonProps, ButtonSize, ButtonVariant, CardPadding, CardProps, CheckboxLabelSize, CheckboxPosition, CheckboxProps, ChipProps, ChipSize, ChipVariant, DividerOrientation, DividerProps, DividerVariant, DrawerBehavior, DrawerProps, DrawerSide, IconButtonProps, IconButtonSize, IconButtonVariant, InputProps, InputSize, InputVariant, MenuDensity, MenuHandle, MenuItem, MenuPrincipalEntry, MenuPrincipalGroup, MenuPrincipalHandle, MenuPrincipalItem, MenuPrincipalProps, MenuProps, MenubarProps, MenubarTool, MenubarUser, ModalProps, ModalSize, MultiSelectDensity, MultiSelectProps, MultiSelectSize, MultiSelectVariant, PanelProps, RadioLabelSize, RadioProps, ScrollPanelProps, SegmentControlOption, SegmentControlProps, SegmentControlVariant, SelectProps, SelectSize, SelectVariant, SwitchLabelPosition, SwitchProps, SwitchSize, TabPanelProps, TabsProps, TagProps, TagSize, TagVariant, TooltipPosition, TooltipProps, TooltipType };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forwardRef, useId, useRef, useImperativeHandle, useCallback, useEffect, useContext, useState, Children, isValidElement, cloneElement } from 'react';
|
|
2
2
|
import { AutoComplete as AutoComplete$1 } from 'primereact/autocomplete';
|
|
3
|
-
import { WarningCircle, Info, Check, CircleNotch, CaretDown, MagnifyingGlass, CaretUp, X, List, ArrowLeft, Question } from '@phosphor-icons/react';
|
|
3
|
+
import { WarningCircle, Info, Check, CircleNotch, CaretDown, MagnifyingGlass, CaretUp, X, List, DribbbleLogo, ArrowLeft, Question } from '@phosphor-icons/react';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { Badge as Badge$1 } from 'primereact/badge';
|
|
6
6
|
import { Button as Button$1 } from 'primereact/button';
|
|
@@ -15,6 +15,7 @@ import { Menu as Menu$1 } from 'primereact/menu';
|
|
|
15
15
|
import { Menubar as Menubar$1 } from 'primereact/menubar';
|
|
16
16
|
import { Avatar } from 'primereact/avatar';
|
|
17
17
|
import { Tooltip as Tooltip$1 } from 'primereact/tooltip';
|
|
18
|
+
import { Tag as Tag$1 } from 'primereact/tag';
|
|
18
19
|
import { Dialog } from 'primereact/dialog';
|
|
19
20
|
import { MultiSelect as MultiSelect$1 } from 'primereact/multiselect';
|
|
20
21
|
import { Panel as Panel$1 } from 'primereact/panel';
|
|
@@ -24,7 +25,6 @@ import { SelectButton } from 'primereact/selectbutton';
|
|
|
24
25
|
import { Dropdown } from 'primereact/dropdown';
|
|
25
26
|
import { InputSwitch } from 'primereact/inputswitch';
|
|
26
27
|
import { TabView, TabPanel as TabPanel$1 } from 'primereact/tabview';
|
|
27
|
-
import { Tag as Tag$1 } from 'primereact/tag';
|
|
28
28
|
|
|
29
29
|
// src/components/AutoComplete/AutoComplete.tsx
|
|
30
30
|
var AutoComplete = forwardRef(function AutoComplete2({
|
|
@@ -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(
|
|
@@ -828,6 +842,105 @@ var Menubar = forwardRef(function Menubar2({
|
|
|
828
842
|
}
|
|
829
843
|
) });
|
|
830
844
|
});
|
|
845
|
+
var Tag = forwardRef(function Tag2({ variant = "default", size = "small", icon, className, children, ...props }, ref) {
|
|
846
|
+
const primeRef = useRef(null);
|
|
847
|
+
useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
848
|
+
const classes = ["cr-tag", `cr-tag--${variant}`, `cr-tag--${size}`, className].filter(Boolean).join(" ");
|
|
849
|
+
return /* @__PURE__ */ jsx(
|
|
850
|
+
Tag$1,
|
|
851
|
+
{
|
|
852
|
+
unstyled: true,
|
|
853
|
+
ref: primeRef,
|
|
854
|
+
className: classes,
|
|
855
|
+
icon: icon ? () => /* @__PURE__ */ jsx("span", { className: "cr-tag__icon", "aria-hidden": "true", children: icon }) : void 0,
|
|
856
|
+
value: children,
|
|
857
|
+
...props
|
|
858
|
+
}
|
|
859
|
+
);
|
|
860
|
+
});
|
|
861
|
+
var isGroup = (entry) => "items" in entry;
|
|
862
|
+
var MenuPrincipal = forwardRef(
|
|
863
|
+
function MenuPrincipal2({
|
|
864
|
+
model,
|
|
865
|
+
popup = false,
|
|
866
|
+
"aria-label": ariaLabel = "Menu principal",
|
|
867
|
+
onShow,
|
|
868
|
+
onHide,
|
|
869
|
+
id,
|
|
870
|
+
className
|
|
871
|
+
}, ref) {
|
|
872
|
+
const primeRef = useRef(null);
|
|
873
|
+
const context = useContext(PrimeReactContext);
|
|
874
|
+
useImperativeHandle(ref, () => ({
|
|
875
|
+
toggle: (event) => primeRef.current?.toggle(event),
|
|
876
|
+
show: (event) => primeRef.current?.show(event),
|
|
877
|
+
hide: (event) => primeRef.current?.hide(event),
|
|
878
|
+
getElement: () => primeRef.current?.getElement() ?? null
|
|
879
|
+
}));
|
|
880
|
+
const toPrime = (item) => ({
|
|
881
|
+
id: item.id,
|
|
882
|
+
// Sem label no Prime: ele viraria o aria-label do item, só com parte do texto visível. O
|
|
883
|
+
// nome vem do conteúdo: o nome, a descrição e a tag. Os espaços entre eles não aparecem
|
|
884
|
+
// (estão em flex), mas separam as palavras no nome ("Início Tela inicial", não colado).
|
|
885
|
+
command: item.command,
|
|
886
|
+
url: item.url,
|
|
887
|
+
target: item.target,
|
|
888
|
+
className: item.className,
|
|
889
|
+
// O <a> leva o data-pc-section do Prime: o Enter do teclado clica nele (e segue o link).
|
|
890
|
+
template: () => /* @__PURE__ */ jsxs(
|
|
891
|
+
"a",
|
|
892
|
+
{
|
|
893
|
+
className: "cr-menu-principal__action",
|
|
894
|
+
"data-pc-section": "action",
|
|
895
|
+
href: item.url ?? "#",
|
|
896
|
+
target: item.target,
|
|
897
|
+
tabIndex: -1,
|
|
898
|
+
children: [
|
|
899
|
+
/* @__PURE__ */ jsx("span", { className: "cr-menu-principal__icon", "aria-hidden": "true", children: item.icon }),
|
|
900
|
+
/* @__PURE__ */ jsxs("span", { className: "cr-menu-principal__text", children: [
|
|
901
|
+
/* @__PURE__ */ jsx("span", { className: "cr-menu-principal__label", children: item.label }),
|
|
902
|
+
" ",
|
|
903
|
+
item.description && /* @__PURE__ */ jsx("span", { className: "cr-menu-principal__description", children: item.description })
|
|
904
|
+
] }),
|
|
905
|
+
" ",
|
|
906
|
+
item.tag && /* @__PURE__ */ jsx(Tag, { className: "cr-menu-principal__tag", variant: "warning", icon: /* @__PURE__ */ jsx(DribbbleLogo, {}), children: item.tag })
|
|
907
|
+
]
|
|
908
|
+
}
|
|
909
|
+
)
|
|
910
|
+
});
|
|
911
|
+
const items = [];
|
|
912
|
+
let anterior;
|
|
913
|
+
model.forEach((entry) => {
|
|
914
|
+
if (anterior && (isGroup(entry) || isGroup(anterior))) items.push({ separator: true });
|
|
915
|
+
items.push(
|
|
916
|
+
isGroup(entry) ? { id: entry.id, label: entry.label, items: entry.items.map(toPrime) } : toPrime(entry)
|
|
917
|
+
);
|
|
918
|
+
anterior = entry;
|
|
919
|
+
});
|
|
920
|
+
const classes = ["cr-menu-principal", popup && "cr-menu-principal--popup", className].filter(Boolean).join(" ");
|
|
921
|
+
const pt = {
|
|
922
|
+
menu: { className: "cr-menu-principal__list", "aria-label": ariaLabel },
|
|
923
|
+
submenuHeader: { className: "cr-menu-principal__group" },
|
|
924
|
+
separator: { className: "cr-menu-principal__separator" },
|
|
925
|
+
menuitem: { className: "cr-menu-principal__item" }
|
|
926
|
+
};
|
|
927
|
+
const menu = /* @__PURE__ */ jsx(
|
|
928
|
+
Menu$1,
|
|
929
|
+
{
|
|
930
|
+
unstyled: true,
|
|
931
|
+
ref: primeRef,
|
|
932
|
+
id,
|
|
933
|
+
className: classes,
|
|
934
|
+
model: items,
|
|
935
|
+
popup,
|
|
936
|
+
onShow,
|
|
937
|
+
onHide,
|
|
938
|
+
pt
|
|
939
|
+
}
|
|
940
|
+
);
|
|
941
|
+
return context ? menu : /* @__PURE__ */ jsx(PrimeReactProvider, { children: menu });
|
|
942
|
+
}
|
|
943
|
+
);
|
|
831
944
|
function Modal({
|
|
832
945
|
visible,
|
|
833
946
|
onHide,
|
|
@@ -1493,23 +1606,7 @@ var Tabs = forwardRef(function Tabs2({ activeIndex, onTabChange, children, id, c
|
|
|
1493
1606
|
}
|
|
1494
1607
|
);
|
|
1495
1608
|
});
|
|
1496
|
-
var Tag = forwardRef(function Tag2({ variant = "default", size = "small", icon, className, children, ...props }, ref) {
|
|
1497
|
-
const primeRef = useRef(null);
|
|
1498
|
-
useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
1499
|
-
const classes = ["cr-tag", `cr-tag--${variant}`, `cr-tag--${size}`, className].filter(Boolean).join(" ");
|
|
1500
|
-
return /* @__PURE__ */ jsx(
|
|
1501
|
-
Tag$1,
|
|
1502
|
-
{
|
|
1503
|
-
unstyled: true,
|
|
1504
|
-
ref: primeRef,
|
|
1505
|
-
className: classes,
|
|
1506
|
-
icon: icon ? () => /* @__PURE__ */ jsx("span", { className: "cr-tag__icon", "aria-hidden": "true", children: icon }) : void 0,
|
|
1507
|
-
value: children,
|
|
1508
|
-
...props
|
|
1509
|
-
}
|
|
1510
|
-
);
|
|
1511
|
-
});
|
|
1512
1609
|
|
|
1513
|
-
export { AutoComplete, Badge, Button, Card, Checkbox, Chip, Divider, Drawer, IconButton, Input, Menu, Menubar, Modal, MultiSelect, Panel, Radio, ScrollPanel, SegmentControl, Select, Switch, TabPanel, Tabs, Tag, Tooltip };
|
|
1610
|
+
export { AutoComplete, Badge, Button, Card, Checkbox, Chip, Divider, Drawer, IconButton, Input, Menu, MenuPrincipal, Menubar, Modal, MultiSelect, Panel, Radio, ScrollPanel, SegmentControl, Select, Switch, TabPanel, Tabs, Tag, Tooltip };
|
|
1514
1611
|
//# sourceMappingURL=index.js.map
|
|
1515
1612
|
//# sourceMappingURL=index.js.map
|