@vector-business-services/cristal-ds-web 0.10.0 → 0.11.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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { InputHTMLAttributes, ReactNode, HTMLAttributes, ButtonHTMLAttributes, CSSProperties, SyntheticEvent, MouseEvent, RefObject } from 'react';
2
+ import { ReactNode, InputHTMLAttributes, HTMLAttributes, ButtonHTMLAttributes, CSSProperties, SyntheticEvent, MouseEvent, RefObject } 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';
@@ -8,6 +8,36 @@ import { RadioButtonChangeEvent } from 'primereact/radiobutton';
8
8
  import { InputSwitchChangeEvent } from 'primereact/inputswitch';
9
9
  import { ToastProps as ToastProps$1 } from 'primereact/toast';
10
10
 
11
+ /** Um item (.Accordion Item no Figma) e o conteúdo dele. */
12
+ interface AccordionTabProps {
13
+ /** Título (Accordion Item Title no Figma). Com headerContent, não aparece. */
14
+ header: string;
15
+ /** Texto abaixo do título (Show Description no Figma). */
16
+ description?: string;
17
+ /** Cabeçalho livre no lugar do título e da descrição (Type=Custom no Figma). */
18
+ headerContent?: ReactNode;
19
+ disabled?: boolean;
20
+ /** Conteúdo do item aberto (Accordion Item Body no Figma). */
21
+ children?: ReactNode;
22
+ }
23
+ /** Só descreve o item: quem desenha é o Accordion. */
24
+ declare function AccordionTab(_props: AccordionTabProps): null;
25
+ interface AccordionProps {
26
+ /** Mais de um item aberto ao mesmo tempo. */
27
+ multiple?: boolean;
28
+ /**
29
+ * Item(ns) aberto(s) (controlado): o índice, ou a lista com `multiple`; null fecha todos. Sem
30
+ * ele, o Accordion controla sozinho e começa com o primeiro aberto, como nos exemplos do Figma.
31
+ */
32
+ activeIndex?: number | number[] | null;
33
+ onTabChange?: (activeIndex: number | number[] | null) => void;
34
+ /** Os itens, como `<AccordionTab>`. */
35
+ children: ReactNode;
36
+ id?: string;
37
+ className?: string;
38
+ }
39
+ declare const Accordion: react.ForwardRefExoticComponent<AccordionProps & react.RefAttributes<HTMLDivElement>>;
40
+
11
41
  /** Type no Figma: Outline (com borda) e Filled (com fundo). */
12
42
  type InputVariant = 'outline' | 'filled';
13
43
  /** Size no Figma: 32, 36, 42 e 48px de altura do campo. */
@@ -727,5 +757,5 @@ interface TooltipProps {
727
757
  }
728
758
  declare function Tooltip({ target, content, type, position, event, showDelay, hideDelay, disabled, id, className, }: TooltipProps): react.JSX.Element;
729
759
 
730
- export { AutoComplete, Badge, Button, Card, 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 };
731
- 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, 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 };
760
+ export { Accordion, AccordionTab, AutoComplete, Badge, Button, Card, 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 };
761
+ export type { AccordionProps, AccordionTabProps, 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, 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 { InputHTMLAttributes, ReactNode, HTMLAttributes, ButtonHTMLAttributes, CSSProperties, SyntheticEvent, MouseEvent, RefObject } from 'react';
2
+ import { ReactNode, InputHTMLAttributes, HTMLAttributes, ButtonHTMLAttributes, CSSProperties, SyntheticEvent, MouseEvent, RefObject } 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';
@@ -8,6 +8,36 @@ import { RadioButtonChangeEvent } from 'primereact/radiobutton';
8
8
  import { InputSwitchChangeEvent } from 'primereact/inputswitch';
9
9
  import { ToastProps as ToastProps$1 } from 'primereact/toast';
10
10
 
11
+ /** Um item (.Accordion Item no Figma) e o conteúdo dele. */
12
+ interface AccordionTabProps {
13
+ /** Título (Accordion Item Title no Figma). Com headerContent, não aparece. */
14
+ header: string;
15
+ /** Texto abaixo do título (Show Description no Figma). */
16
+ description?: string;
17
+ /** Cabeçalho livre no lugar do título e da descrição (Type=Custom no Figma). */
18
+ headerContent?: ReactNode;
19
+ disabled?: boolean;
20
+ /** Conteúdo do item aberto (Accordion Item Body no Figma). */
21
+ children?: ReactNode;
22
+ }
23
+ /** Só descreve o item: quem desenha é o Accordion. */
24
+ declare function AccordionTab(_props: AccordionTabProps): null;
25
+ interface AccordionProps {
26
+ /** Mais de um item aberto ao mesmo tempo. */
27
+ multiple?: boolean;
28
+ /**
29
+ * Item(ns) aberto(s) (controlado): o índice, ou a lista com `multiple`; null fecha todos. Sem
30
+ * ele, o Accordion controla sozinho e começa com o primeiro aberto, como nos exemplos do Figma.
31
+ */
32
+ activeIndex?: number | number[] | null;
33
+ onTabChange?: (activeIndex: number | number[] | null) => void;
34
+ /** Os itens, como `<AccordionTab>`. */
35
+ children: ReactNode;
36
+ id?: string;
37
+ className?: string;
38
+ }
39
+ declare const Accordion: react.ForwardRefExoticComponent<AccordionProps & react.RefAttributes<HTMLDivElement>>;
40
+
11
41
  /** Type no Figma: Outline (com borda) e Filled (com fundo). */
12
42
  type InputVariant = 'outline' | 'filled';
13
43
  /** Size no Figma: 32, 36, 42 e 48px de altura do campo. */
@@ -727,5 +757,5 @@ interface TooltipProps {
727
757
  }
728
758
  declare function Tooltip({ target, content, type, position, event, showDelay, hideDelay, disabled, id, className, }: TooltipProps): react.JSX.Element;
729
759
 
730
- export { AutoComplete, Badge, Button, Card, 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 };
731
- 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, 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 };
760
+ export { Accordion, AccordionTab, AutoComplete, Badge, Button, Card, 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 };
761
+ export type { AccordionProps, AccordionTabProps, 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, 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,7 +1,8 @@
1
- import { forwardRef, useId, useRef, useImperativeHandle, useCallback, useEffect, useContext, useState, Children, isValidElement, cloneElement } from 'react';
2
- import { AutoComplete as AutoComplete$1 } from 'primereact/autocomplete';
1
+ import { forwardRef, useRef, useImperativeHandle, useState, Children, isValidElement, useId, useCallback, useEffect, useContext, cloneElement } from 'react';
2
+ import { Accordion as Accordion$1, AccordionTab as AccordionTab$1 } from 'primereact/accordion';
3
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';
4
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
+ import { AutoComplete as AutoComplete$1 } from 'primereact/autocomplete';
5
6
  import { Badge as Badge$1 } from 'primereact/badge';
6
7
  import { Button as Button$1 } from 'primereact/button';
7
8
  import { Card as Card$1 } from 'primereact/card';
@@ -30,7 +31,60 @@ import { InputSwitch } from 'primereact/inputswitch';
30
31
  import { TabView, TabPanel as TabPanel$1 } from 'primereact/tabview';
31
32
  import { Toast as Toast$1 } from 'primereact/toast';
32
33
 
33
- // src/components/AutoComplete/AutoComplete.tsx
34
+ // src/components/Accordion/Accordion.tsx
35
+ function AccordionTab(_props) {
36
+ return null;
37
+ }
38
+ var seta = (icon) => /* @__PURE__ */ jsx("span", { className: "cr-accordion__toggle", "aria-hidden": "true", children: icon });
39
+ var Accordion = forwardRef(function Accordion2({ multiple = false, activeIndex, onTabChange, children, id, className }, ref) {
40
+ const primeRef = useRef(null);
41
+ useImperativeHandle(ref, () => primeRef.current?.getElement());
42
+ const [interno, setInterno] = useState(multiple ? [0] : 0);
43
+ const abertos = activeIndex === void 0 ? interno : activeIndex;
44
+ const tabs = Children.toArray(children).filter(
45
+ (child) => isValidElement(child)
46
+ );
47
+ return /* @__PURE__ */ jsx(
48
+ Accordion$1,
49
+ {
50
+ ...{ unstyled: true },
51
+ ref: primeRef,
52
+ id,
53
+ multiple,
54
+ activeIndex: abertos,
55
+ onTabChange: (event) => {
56
+ const index = event.index;
57
+ setInterno(index);
58
+ onTabChange?.(index);
59
+ },
60
+ expandIcon: seta(/* @__PURE__ */ jsx(CaretDown, {})),
61
+ collapseIcon: seta(/* @__PURE__ */ jsx(CaretUp, {})),
62
+ pt: { root: { className: ["cr-accordion", className].filter(Boolean).join(" ") } },
63
+ children: tabs.map((tab, index) => /* @__PURE__ */ jsx(
64
+ AccordionTab$1,
65
+ {
66
+ header: tab.props.header,
67
+ disabled: tab.props.disabled,
68
+ headerTemplate: tab.props.headerContent ? /* @__PURE__ */ jsx("span", { className: "cr-accordion__custom", children: tab.props.headerContent }) : /* @__PURE__ */ jsxs("span", { className: "cr-accordion__texts", children: [
69
+ /* @__PURE__ */ jsx("span", { className: "cr-accordion__title", children: tab.props.header }),
70
+ tab.props.description && /* @__PURE__ */ jsx("span", { className: "cr-accordion__description", children: tab.props.description })
71
+ ] }),
72
+ pt: {
73
+ root: { className: "cr-accordion__item" },
74
+ header: { className: "cr-accordion__header" },
75
+ headerAction: { className: "cr-accordion__action" },
76
+ toggleableContent: { className: "cr-accordion__region" },
77
+ content: { className: "cr-accordion__content" },
78
+ // Sem animação: o Prime manteria o conteúdo na tela pelos 450ms da saída dele.
79
+ transition: { timeout: 0 }
80
+ },
81
+ children: tab.props.children
82
+ },
83
+ tab.key ?? index
84
+ ))
85
+ }
86
+ );
87
+ });
34
88
  var AutoComplete = forwardRef(function AutoComplete2({
35
89
  variant = "outline",
36
90
  size = "large",
@@ -1471,7 +1525,7 @@ var Select = forwardRef(function Select2({
1471
1525
  ] })
1472
1526
  ] });
1473
1527
  });
1474
- var seta = (label, icon) => (options) => /* @__PURE__ */ jsx(
1528
+ var seta2 = (label, icon) => (options) => /* @__PURE__ */ jsx(
1475
1529
  "button",
1476
1530
  {
1477
1531
  type: "button",
@@ -1517,10 +1571,10 @@ var Paginator = forwardRef(function Paginator2({
1517
1571
  },
1518
1572
  template: {
1519
1573
  layout: "FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",
1520
- FirstPageLink: seta("Primeira p\xE1gina", /* @__PURE__ */ jsx(CaretDoubleLeft, { "aria-hidden": "true" })),
1521
- PrevPageLink: seta("P\xE1gina anterior", /* @__PURE__ */ jsx(CaretLeft, { "aria-hidden": "true" })),
1522
- NextPageLink: seta("Pr\xF3xima p\xE1gina", /* @__PURE__ */ jsx(CaretRight, { "aria-hidden": "true" })),
1523
- LastPageLink: seta("\xDAltima p\xE1gina", /* @__PURE__ */ jsx(CaretDoubleRight, { "aria-hidden": "true" })),
1574
+ FirstPageLink: seta2("Primeira p\xE1gina", /* @__PURE__ */ jsx(CaretDoubleLeft, { "aria-hidden": "true" })),
1575
+ PrevPageLink: seta2("P\xE1gina anterior", /* @__PURE__ */ jsx(CaretLeft, { "aria-hidden": "true" })),
1576
+ NextPageLink: seta2("Pr\xF3xima p\xE1gina", /* @__PURE__ */ jsx(CaretRight, { "aria-hidden": "true" })),
1577
+ LastPageLink: seta2("\xDAltima p\xE1gina", /* @__PURE__ */ jsx(CaretDoubleRight, { "aria-hidden": "true" })),
1524
1578
  PageLinks: (options) => {
1525
1579
  const ativa = options.page === options.currentPage;
1526
1580
  return /* @__PURE__ */ jsx(
@@ -1916,6 +1970,6 @@ var Toast = forwardRef(function Toast2({ position = "top-right", closeLabel = "F
1916
1970
  );
1917
1971
  });
1918
1972
 
1919
- export { AutoComplete, Badge, Button, Card, 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 };
1973
+ export { Accordion, AccordionTab, AutoComplete, Badge, Button, Card, 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 };
1920
1974
  //# sourceMappingURL=index.js.map
1921
1975
  //# sourceMappingURL=index.js.map