@vector-business-services/cristal-ds-web 0.6.0 → 0.8.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 +109 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +236 -83
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +58 -3
- package/dist/index.d.ts +58 -3
- package/dist/index.js +110 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -149,6 +149,11 @@ type DrawerSide = 'right' | 'left';
|
|
|
149
149
|
* corpo rola).
|
|
150
150
|
*/
|
|
151
151
|
type DrawerBehavior = 'full' | 'fixed';
|
|
152
|
+
/**
|
|
153
|
+
* Largura da gaveta. O Figma só tem a de 340px (small); medium (480px), large (720px) e full (a
|
|
154
|
+
* tela toda) são do Cristal, nas faixas usuais de drawer.
|
|
155
|
+
*/
|
|
156
|
+
type DrawerSize = 'small' | 'medium' | 'large' | 'full';
|
|
152
157
|
interface DrawerProps {
|
|
153
158
|
visible: boolean;
|
|
154
159
|
/** Pedido para fechar (X, Esc ou clique no overlay). */
|
|
@@ -161,6 +166,8 @@ interface DrawerProps {
|
|
|
161
166
|
side?: DrawerSide;
|
|
162
167
|
/** Padrão: full. */
|
|
163
168
|
behavior?: DrawerBehavior;
|
|
169
|
+
/** Padrão: small (340px, a do Figma). */
|
|
170
|
+
size?: DrawerSize;
|
|
164
171
|
/**
|
|
165
172
|
* Com overlay (padrão): a gaveta é modal, a página atrás fica bloqueada e o clique no overlay
|
|
166
173
|
* fecha. Sem overlay (`false`): a página continua rolando e clicável, e só o X e o Esc fecham.
|
|
@@ -176,7 +183,7 @@ interface DrawerProps {
|
|
|
176
183
|
id?: string;
|
|
177
184
|
className?: string;
|
|
178
185
|
}
|
|
179
|
-
declare function Drawer({ visible, onHide, title, subtitle, side, behavior, modal, onBack, backLabel, closeLabel, footer, children, id, className, }: DrawerProps): react.JSX.Element;
|
|
186
|
+
declare function Drawer({ visible, onHide, title, subtitle, side, behavior, size, modal, onBack, backLabel, closeLabel, footer, children, id, className, }: DrawerProps): react.JSX.Element;
|
|
180
187
|
|
|
181
188
|
/**
|
|
182
189
|
* Hierarchy no Figma: Primary (Filled), Secondary (Tonal), Tertiary (Outlined) e Other (Icon),
|
|
@@ -294,6 +301,54 @@ interface MenubarProps {
|
|
|
294
301
|
}
|
|
295
302
|
declare const Menubar: react.ForwardRefExoticComponent<MenubarProps & react.RefAttributes<HTMLDivElement>>;
|
|
296
303
|
|
|
304
|
+
/** Um produto do menu (.Menu Principal / Item no Figma). */
|
|
305
|
+
interface MenuPrincipalItem {
|
|
306
|
+
/** Nome do produto (Item Label no Figma). */
|
|
307
|
+
label: string;
|
|
308
|
+
/** Texto de apoio abaixo do nome, até 2 linhas. */
|
|
309
|
+
description?: string;
|
|
310
|
+
/** Ícone no círculo à esquerda. Use um ícone de `@vector-business-services/cristal-ds-web/icons`. */
|
|
311
|
+
icon: ReactNode;
|
|
312
|
+
/** Texto da tag no canto (Show Tag no Figma, onde é "Experimente"). */
|
|
313
|
+
tag?: string;
|
|
314
|
+
/** Ação do item; o menu popup fecha depois dela. */
|
|
315
|
+
command?: (event: MenuItemCommandEvent) => void;
|
|
316
|
+
/** Link do item; sem ele o clique não navega. */
|
|
317
|
+
url?: string;
|
|
318
|
+
target?: string;
|
|
319
|
+
id?: string;
|
|
320
|
+
className?: string;
|
|
321
|
+
}
|
|
322
|
+
/** Um grupo de produtos com título (Product Group no Figma). */
|
|
323
|
+
interface MenuPrincipalGroup {
|
|
324
|
+
/** Título do grupo, acima dos itens. */
|
|
325
|
+
label: string;
|
|
326
|
+
items: MenuPrincipalItem[];
|
|
327
|
+
id?: string;
|
|
328
|
+
}
|
|
329
|
+
type MenuPrincipalEntry = MenuPrincipalItem | MenuPrincipalGroup;
|
|
330
|
+
interface MenuPrincipalProps {
|
|
331
|
+
/** Itens soltos e grupos, na ordem; o divisor tracejado entra antes e depois de cada grupo. */
|
|
332
|
+
model: MenuPrincipalEntry[];
|
|
333
|
+
/** Abre sobre a tela, posicionado no elemento que chamou `toggle`/`show` pela ref. */
|
|
334
|
+
popup?: boolean;
|
|
335
|
+
/** Nome acessível do menu. */
|
|
336
|
+
'aria-label'?: string;
|
|
337
|
+
onShow?: (event: SyntheticEvent) => void;
|
|
338
|
+
onHide?: (event: SyntheticEvent) => void;
|
|
339
|
+
id?: string;
|
|
340
|
+
className?: string;
|
|
341
|
+
}
|
|
342
|
+
/** Controle do menu popup, pela ref. */
|
|
343
|
+
interface MenuPrincipalHandle {
|
|
344
|
+
toggle: (event: SyntheticEvent) => void;
|
|
345
|
+
show: (event: SyntheticEvent) => void;
|
|
346
|
+
hide: (event: SyntheticEvent) => void;
|
|
347
|
+
/** O <div> raiz do menu (só existe com o popup aberto). */
|
|
348
|
+
getElement: () => HTMLDivElement | null;
|
|
349
|
+
}
|
|
350
|
+
declare const MenuPrincipal: react.ForwardRefExoticComponent<MenuPrincipalProps & react.RefAttributes<MenuPrincipalHandle>>;
|
|
351
|
+
|
|
297
352
|
/**
|
|
298
353
|
* Size no Figma: Small (520px), Medium (768px) e Large (1200 x 720px; abaixo de 768px de tela
|
|
299
354
|
* vira tela cheia, como o Responsive=360 do Figma).
|
|
@@ -558,5 +613,5 @@ interface TooltipProps {
|
|
|
558
613
|
}
|
|
559
614
|
declare function Tooltip({ target, content, type, position, event, showDelay, hideDelay, disabled, id, className, }: TooltipProps): react.JSX.Element;
|
|
560
615
|
|
|
561
|
-
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 };
|
|
562
|
-
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 };
|
|
616
|
+
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 };
|
|
617
|
+
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, DrawerSize, 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
|
@@ -149,6 +149,11 @@ type DrawerSide = 'right' | 'left';
|
|
|
149
149
|
* corpo rola).
|
|
150
150
|
*/
|
|
151
151
|
type DrawerBehavior = 'full' | 'fixed';
|
|
152
|
+
/**
|
|
153
|
+
* Largura da gaveta. O Figma só tem a de 340px (small); medium (480px), large (720px) e full (a
|
|
154
|
+
* tela toda) são do Cristal, nas faixas usuais de drawer.
|
|
155
|
+
*/
|
|
156
|
+
type DrawerSize = 'small' | 'medium' | 'large' | 'full';
|
|
152
157
|
interface DrawerProps {
|
|
153
158
|
visible: boolean;
|
|
154
159
|
/** Pedido para fechar (X, Esc ou clique no overlay). */
|
|
@@ -161,6 +166,8 @@ interface DrawerProps {
|
|
|
161
166
|
side?: DrawerSide;
|
|
162
167
|
/** Padrão: full. */
|
|
163
168
|
behavior?: DrawerBehavior;
|
|
169
|
+
/** Padrão: small (340px, a do Figma). */
|
|
170
|
+
size?: DrawerSize;
|
|
164
171
|
/**
|
|
165
172
|
* Com overlay (padrão): a gaveta é modal, a página atrás fica bloqueada e o clique no overlay
|
|
166
173
|
* fecha. Sem overlay (`false`): a página continua rolando e clicável, e só o X e o Esc fecham.
|
|
@@ -176,7 +183,7 @@ interface DrawerProps {
|
|
|
176
183
|
id?: string;
|
|
177
184
|
className?: string;
|
|
178
185
|
}
|
|
179
|
-
declare function Drawer({ visible, onHide, title, subtitle, side, behavior, modal, onBack, backLabel, closeLabel, footer, children, id, className, }: DrawerProps): react.JSX.Element;
|
|
186
|
+
declare function Drawer({ visible, onHide, title, subtitle, side, behavior, size, modal, onBack, backLabel, closeLabel, footer, children, id, className, }: DrawerProps): react.JSX.Element;
|
|
180
187
|
|
|
181
188
|
/**
|
|
182
189
|
* Hierarchy no Figma: Primary (Filled), Secondary (Tonal), Tertiary (Outlined) e Other (Icon),
|
|
@@ -294,6 +301,54 @@ interface MenubarProps {
|
|
|
294
301
|
}
|
|
295
302
|
declare const Menubar: react.ForwardRefExoticComponent<MenubarProps & react.RefAttributes<HTMLDivElement>>;
|
|
296
303
|
|
|
304
|
+
/** Um produto do menu (.Menu Principal / Item no Figma). */
|
|
305
|
+
interface MenuPrincipalItem {
|
|
306
|
+
/** Nome do produto (Item Label no Figma). */
|
|
307
|
+
label: string;
|
|
308
|
+
/** Texto de apoio abaixo do nome, até 2 linhas. */
|
|
309
|
+
description?: string;
|
|
310
|
+
/** Ícone no círculo à esquerda. Use um ícone de `@vector-business-services/cristal-ds-web/icons`. */
|
|
311
|
+
icon: ReactNode;
|
|
312
|
+
/** Texto da tag no canto (Show Tag no Figma, onde é "Experimente"). */
|
|
313
|
+
tag?: string;
|
|
314
|
+
/** Ação do item; o menu popup fecha depois dela. */
|
|
315
|
+
command?: (event: MenuItemCommandEvent) => void;
|
|
316
|
+
/** Link do item; sem ele o clique não navega. */
|
|
317
|
+
url?: string;
|
|
318
|
+
target?: string;
|
|
319
|
+
id?: string;
|
|
320
|
+
className?: string;
|
|
321
|
+
}
|
|
322
|
+
/** Um grupo de produtos com título (Product Group no Figma). */
|
|
323
|
+
interface MenuPrincipalGroup {
|
|
324
|
+
/** Título do grupo, acima dos itens. */
|
|
325
|
+
label: string;
|
|
326
|
+
items: MenuPrincipalItem[];
|
|
327
|
+
id?: string;
|
|
328
|
+
}
|
|
329
|
+
type MenuPrincipalEntry = MenuPrincipalItem | MenuPrincipalGroup;
|
|
330
|
+
interface MenuPrincipalProps {
|
|
331
|
+
/** Itens soltos e grupos, na ordem; o divisor tracejado entra antes e depois de cada grupo. */
|
|
332
|
+
model: MenuPrincipalEntry[];
|
|
333
|
+
/** Abre sobre a tela, posicionado no elemento que chamou `toggle`/`show` pela ref. */
|
|
334
|
+
popup?: boolean;
|
|
335
|
+
/** Nome acessível do menu. */
|
|
336
|
+
'aria-label'?: string;
|
|
337
|
+
onShow?: (event: SyntheticEvent) => void;
|
|
338
|
+
onHide?: (event: SyntheticEvent) => void;
|
|
339
|
+
id?: string;
|
|
340
|
+
className?: string;
|
|
341
|
+
}
|
|
342
|
+
/** Controle do menu popup, pela ref. */
|
|
343
|
+
interface MenuPrincipalHandle {
|
|
344
|
+
toggle: (event: SyntheticEvent) => void;
|
|
345
|
+
show: (event: SyntheticEvent) => void;
|
|
346
|
+
hide: (event: SyntheticEvent) => void;
|
|
347
|
+
/** O <div> raiz do menu (só existe com o popup aberto). */
|
|
348
|
+
getElement: () => HTMLDivElement | null;
|
|
349
|
+
}
|
|
350
|
+
declare const MenuPrincipal: react.ForwardRefExoticComponent<MenuPrincipalProps & react.RefAttributes<MenuPrincipalHandle>>;
|
|
351
|
+
|
|
297
352
|
/**
|
|
298
353
|
* Size no Figma: Small (520px), Medium (768px) e Large (1200 x 720px; abaixo de 768px de tela
|
|
299
354
|
* vira tela cheia, como o Responsive=360 do Figma).
|
|
@@ -558,5 +613,5 @@ interface TooltipProps {
|
|
|
558
613
|
}
|
|
559
614
|
declare function Tooltip({ target, content, type, position, event, showDelay, hideDelay, disabled, id, className, }: TooltipProps): react.JSX.Element;
|
|
560
615
|
|
|
561
|
-
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 };
|
|
562
|
-
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 };
|
|
616
|
+
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 };
|
|
617
|
+
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, DrawerSize, 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
|
+
size = "small",
|
|
322
323
|
modal = true,
|
|
323
324
|
onBack,
|
|
324
325
|
backLabel = "Voltar",
|
|
@@ -366,7 +367,13 @@ function Drawer({
|
|
|
366
367
|
primeiro.focus();
|
|
367
368
|
}
|
|
368
369
|
};
|
|
369
|
-
const classes = [
|
|
370
|
+
const classes = [
|
|
371
|
+
"cr-drawer",
|
|
372
|
+
`cr-drawer--${side}`,
|
|
373
|
+
`cr-drawer--${behavior}`,
|
|
374
|
+
`cr-drawer--size-${size}`,
|
|
375
|
+
className
|
|
376
|
+
].filter(Boolean).join(" ");
|
|
370
377
|
return /* @__PURE__ */ jsx(
|
|
371
378
|
Sidebar,
|
|
372
379
|
{
|
|
@@ -842,6 +849,105 @@ var Menubar = forwardRef(function Menubar2({
|
|
|
842
849
|
}
|
|
843
850
|
) });
|
|
844
851
|
});
|
|
852
|
+
var Tag = forwardRef(function Tag2({ variant = "default", size = "small", icon, className, children, ...props }, ref) {
|
|
853
|
+
const primeRef = useRef(null);
|
|
854
|
+
useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
855
|
+
const classes = ["cr-tag", `cr-tag--${variant}`, `cr-tag--${size}`, className].filter(Boolean).join(" ");
|
|
856
|
+
return /* @__PURE__ */ jsx(
|
|
857
|
+
Tag$1,
|
|
858
|
+
{
|
|
859
|
+
unstyled: true,
|
|
860
|
+
ref: primeRef,
|
|
861
|
+
className: classes,
|
|
862
|
+
icon: icon ? () => /* @__PURE__ */ jsx("span", { className: "cr-tag__icon", "aria-hidden": "true", children: icon }) : void 0,
|
|
863
|
+
value: children,
|
|
864
|
+
...props
|
|
865
|
+
}
|
|
866
|
+
);
|
|
867
|
+
});
|
|
868
|
+
var isGroup = (entry) => "items" in entry;
|
|
869
|
+
var MenuPrincipal = forwardRef(
|
|
870
|
+
function MenuPrincipal2({
|
|
871
|
+
model,
|
|
872
|
+
popup = false,
|
|
873
|
+
"aria-label": ariaLabel = "Menu principal",
|
|
874
|
+
onShow,
|
|
875
|
+
onHide,
|
|
876
|
+
id,
|
|
877
|
+
className
|
|
878
|
+
}, ref) {
|
|
879
|
+
const primeRef = useRef(null);
|
|
880
|
+
const context = useContext(PrimeReactContext);
|
|
881
|
+
useImperativeHandle(ref, () => ({
|
|
882
|
+
toggle: (event) => primeRef.current?.toggle(event),
|
|
883
|
+
show: (event) => primeRef.current?.show(event),
|
|
884
|
+
hide: (event) => primeRef.current?.hide(event),
|
|
885
|
+
getElement: () => primeRef.current?.getElement() ?? null
|
|
886
|
+
}));
|
|
887
|
+
const toPrime = (item) => ({
|
|
888
|
+
id: item.id,
|
|
889
|
+
// Sem label no Prime: ele viraria o aria-label do item, só com parte do texto visível. O
|
|
890
|
+
// nome vem do conteúdo: o nome, a descrição e a tag. Os espaços entre eles não aparecem
|
|
891
|
+
// (estão em flex), mas separam as palavras no nome ("Início Tela inicial", não colado).
|
|
892
|
+
command: item.command,
|
|
893
|
+
url: item.url,
|
|
894
|
+
target: item.target,
|
|
895
|
+
className: item.className,
|
|
896
|
+
// O <a> leva o data-pc-section do Prime: o Enter do teclado clica nele (e segue o link).
|
|
897
|
+
template: () => /* @__PURE__ */ jsxs(
|
|
898
|
+
"a",
|
|
899
|
+
{
|
|
900
|
+
className: "cr-menu-principal__action",
|
|
901
|
+
"data-pc-section": "action",
|
|
902
|
+
href: item.url ?? "#",
|
|
903
|
+
target: item.target,
|
|
904
|
+
tabIndex: -1,
|
|
905
|
+
children: [
|
|
906
|
+
/* @__PURE__ */ jsx("span", { className: "cr-menu-principal__icon", "aria-hidden": "true", children: item.icon }),
|
|
907
|
+
/* @__PURE__ */ jsxs("span", { className: "cr-menu-principal__text", children: [
|
|
908
|
+
/* @__PURE__ */ jsx("span", { className: "cr-menu-principal__label", children: item.label }),
|
|
909
|
+
" ",
|
|
910
|
+
item.description && /* @__PURE__ */ jsx("span", { className: "cr-menu-principal__description", children: item.description })
|
|
911
|
+
] }),
|
|
912
|
+
" ",
|
|
913
|
+
item.tag && /* @__PURE__ */ jsx(Tag, { className: "cr-menu-principal__tag", variant: "warning", icon: /* @__PURE__ */ jsx(DribbbleLogo, {}), children: item.tag })
|
|
914
|
+
]
|
|
915
|
+
}
|
|
916
|
+
)
|
|
917
|
+
});
|
|
918
|
+
const items = [];
|
|
919
|
+
let anterior;
|
|
920
|
+
model.forEach((entry) => {
|
|
921
|
+
if (anterior && (isGroup(entry) || isGroup(anterior))) items.push({ separator: true });
|
|
922
|
+
items.push(
|
|
923
|
+
isGroup(entry) ? { id: entry.id, label: entry.label, items: entry.items.map(toPrime) } : toPrime(entry)
|
|
924
|
+
);
|
|
925
|
+
anterior = entry;
|
|
926
|
+
});
|
|
927
|
+
const classes = ["cr-menu-principal", popup && "cr-menu-principal--popup", className].filter(Boolean).join(" ");
|
|
928
|
+
const pt = {
|
|
929
|
+
menu: { className: "cr-menu-principal__list", "aria-label": ariaLabel },
|
|
930
|
+
submenuHeader: { className: "cr-menu-principal__group" },
|
|
931
|
+
separator: { className: "cr-menu-principal__separator" },
|
|
932
|
+
menuitem: { className: "cr-menu-principal__item" }
|
|
933
|
+
};
|
|
934
|
+
const menu = /* @__PURE__ */ jsx(
|
|
935
|
+
Menu$1,
|
|
936
|
+
{
|
|
937
|
+
unstyled: true,
|
|
938
|
+
ref: primeRef,
|
|
939
|
+
id,
|
|
940
|
+
className: classes,
|
|
941
|
+
model: items,
|
|
942
|
+
popup,
|
|
943
|
+
onShow,
|
|
944
|
+
onHide,
|
|
945
|
+
pt
|
|
946
|
+
}
|
|
947
|
+
);
|
|
948
|
+
return context ? menu : /* @__PURE__ */ jsx(PrimeReactProvider, { children: menu });
|
|
949
|
+
}
|
|
950
|
+
);
|
|
845
951
|
function Modal({
|
|
846
952
|
visible,
|
|
847
953
|
onHide,
|
|
@@ -1507,23 +1613,7 @@ var Tabs = forwardRef(function Tabs2({ activeIndex, onTabChange, children, id, c
|
|
|
1507
1613
|
}
|
|
1508
1614
|
);
|
|
1509
1615
|
});
|
|
1510
|
-
var Tag = forwardRef(function Tag2({ variant = "default", size = "small", icon, className, children, ...props }, ref) {
|
|
1511
|
-
const primeRef = useRef(null);
|
|
1512
|
-
useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
1513
|
-
const classes = ["cr-tag", `cr-tag--${variant}`, `cr-tag--${size}`, className].filter(Boolean).join(" ");
|
|
1514
|
-
return /* @__PURE__ */ jsx(
|
|
1515
|
-
Tag$1,
|
|
1516
|
-
{
|
|
1517
|
-
unstyled: true,
|
|
1518
|
-
ref: primeRef,
|
|
1519
|
-
className: classes,
|
|
1520
|
-
icon: icon ? () => /* @__PURE__ */ jsx("span", { className: "cr-tag__icon", "aria-hidden": "true", children: icon }) : void 0,
|
|
1521
|
-
value: children,
|
|
1522
|
-
...props
|
|
1523
|
-
}
|
|
1524
|
-
);
|
|
1525
|
-
});
|
|
1526
1616
|
|
|
1527
|
-
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 };
|
|
1617
|
+
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 };
|
|
1528
1618
|
//# sourceMappingURL=index.js.map
|
|
1529
1619
|
//# sourceMappingURL=index.js.map
|