@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.cjs CHANGED
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var react = require('react');
4
- var autocomplete = require('primereact/autocomplete');
4
+ var accordion = require('primereact/accordion');
5
5
  var react$1 = require('@phosphor-icons/react');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
+ var autocomplete = require('primereact/autocomplete');
7
8
  var badge = require('primereact/badge');
8
9
  var button = require('primereact/button');
9
10
  var card = require('primereact/card');
@@ -32,7 +33,60 @@ var inputswitch = require('primereact/inputswitch');
32
33
  var tabview = require('primereact/tabview');
33
34
  var toast = require('primereact/toast');
34
35
 
35
- // src/components/AutoComplete/AutoComplete.tsx
36
+ // src/components/Accordion/Accordion.tsx
37
+ function AccordionTab(_props) {
38
+ return null;
39
+ }
40
+ var seta = (icon) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-accordion__toggle", "aria-hidden": "true", children: icon });
41
+ var Accordion = react.forwardRef(function Accordion2({ multiple = false, activeIndex, onTabChange, children, id, className }, ref) {
42
+ const primeRef = react.useRef(null);
43
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
44
+ const [interno, setInterno] = react.useState(multiple ? [0] : 0);
45
+ const abertos = activeIndex === void 0 ? interno : activeIndex;
46
+ const tabs = react.Children.toArray(children).filter(
47
+ (child) => react.isValidElement(child)
48
+ );
49
+ return /* @__PURE__ */ jsxRuntime.jsx(
50
+ accordion.Accordion,
51
+ {
52
+ ...{ unstyled: true },
53
+ ref: primeRef,
54
+ id,
55
+ multiple,
56
+ activeIndex: abertos,
57
+ onTabChange: (event) => {
58
+ const index = event.index;
59
+ setInterno(index);
60
+ onTabChange?.(index);
61
+ },
62
+ expandIcon: seta(/* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDown, {})),
63
+ collapseIcon: seta(/* @__PURE__ */ jsxRuntime.jsx(react$1.CaretUp, {})),
64
+ pt: { root: { className: ["cr-accordion", className].filter(Boolean).join(" ") } },
65
+ children: tabs.map((tab, index) => /* @__PURE__ */ jsxRuntime.jsx(
66
+ accordion.AccordionTab,
67
+ {
68
+ header: tab.props.header,
69
+ disabled: tab.props.disabled,
70
+ headerTemplate: tab.props.headerContent ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-accordion__custom", children: tab.props.headerContent }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "cr-accordion__texts", children: [
71
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-accordion__title", children: tab.props.header }),
72
+ tab.props.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-accordion__description", children: tab.props.description })
73
+ ] }),
74
+ pt: {
75
+ root: { className: "cr-accordion__item" },
76
+ header: { className: "cr-accordion__header" },
77
+ headerAction: { className: "cr-accordion__action" },
78
+ toggleableContent: { className: "cr-accordion__region" },
79
+ content: { className: "cr-accordion__content" },
80
+ // Sem animação: o Prime manteria o conteúdo na tela pelos 450ms da saída dele.
81
+ transition: { timeout: 0 }
82
+ },
83
+ children: tab.props.children
84
+ },
85
+ tab.key ?? index
86
+ ))
87
+ }
88
+ );
89
+ });
36
90
  var AutoComplete = react.forwardRef(function AutoComplete2({
37
91
  variant = "outline",
38
92
  size = "large",
@@ -1473,7 +1527,7 @@ var Select = react.forwardRef(function Select2({
1473
1527
  ] })
1474
1528
  ] });
1475
1529
  });
1476
- var seta = (label, icon) => (options) => /* @__PURE__ */ jsxRuntime.jsx(
1530
+ var seta2 = (label, icon) => (options) => /* @__PURE__ */ jsxRuntime.jsx(
1477
1531
  "button",
1478
1532
  {
1479
1533
  type: "button",
@@ -1519,10 +1573,10 @@ var Paginator = react.forwardRef(function Paginator2({
1519
1573
  },
1520
1574
  template: {
1521
1575
  layout: "FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",
1522
- FirstPageLink: seta("Primeira p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDoubleLeft, { "aria-hidden": "true" })),
1523
- PrevPageLink: seta("P\xE1gina anterior", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretLeft, { "aria-hidden": "true" })),
1524
- NextPageLink: seta("Pr\xF3xima p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretRight, { "aria-hidden": "true" })),
1525
- LastPageLink: seta("\xDAltima p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDoubleRight, { "aria-hidden": "true" })),
1576
+ FirstPageLink: seta2("Primeira p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDoubleLeft, { "aria-hidden": "true" })),
1577
+ PrevPageLink: seta2("P\xE1gina anterior", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretLeft, { "aria-hidden": "true" })),
1578
+ NextPageLink: seta2("Pr\xF3xima p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretRight, { "aria-hidden": "true" })),
1579
+ LastPageLink: seta2("\xDAltima p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDoubleRight, { "aria-hidden": "true" })),
1526
1580
  PageLinks: (options) => {
1527
1581
  const ativa = options.page === options.currentPage;
1528
1582
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -1918,6 +1972,8 @@ var Toast = react.forwardRef(function Toast2({ position = "top-right", closeLabe
1918
1972
  );
1919
1973
  });
1920
1974
 
1975
+ exports.Accordion = Accordion;
1976
+ exports.AccordionTab = AccordionTab;
1921
1977
  exports.AutoComplete = AutoComplete;
1922
1978
  exports.Badge = Badge;
1923
1979
  exports.Button = Button;