@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 CHANGED
@@ -17,6 +17,7 @@ var menu = require('primereact/menu');
17
17
  var menubar = require('primereact/menubar');
18
18
  var avatar = require('primereact/avatar');
19
19
  var tooltip = require('primereact/tooltip');
20
+ var tag = require('primereact/tag');
20
21
  var dialog = require('primereact/dialog');
21
22
  var multiselect = require('primereact/multiselect');
22
23
  var panel = require('primereact/panel');
@@ -26,7 +27,6 @@ var selectbutton = require('primereact/selectbutton');
26
27
  var dropdown = require('primereact/dropdown');
27
28
  var inputswitch = require('primereact/inputswitch');
28
29
  var tabview = require('primereact/tabview');
29
- var tag = require('primereact/tag');
30
30
 
31
31
  // src/components/AutoComplete/AutoComplete.tsx
32
32
  var AutoComplete = react.forwardRef(function AutoComplete2({
@@ -321,6 +321,7 @@ function Drawer({
321
321
  subtitle,
322
322
  side = "right",
323
323
  behavior = "full",
324
+ size = "small",
324
325
  modal = true,
325
326
  onBack,
326
327
  backLabel = "Voltar",
@@ -368,7 +369,13 @@ function Drawer({
368
369
  primeiro.focus();
369
370
  }
370
371
  };
371
- const classes = ["cr-drawer", `cr-drawer--${side}`, `cr-drawer--${behavior}`, className].filter(Boolean).join(" ");
372
+ const classes = [
373
+ "cr-drawer",
374
+ `cr-drawer--${side}`,
375
+ `cr-drawer--${behavior}`,
376
+ `cr-drawer--size-${size}`,
377
+ className
378
+ ].filter(Boolean).join(" ");
372
379
  return /* @__PURE__ */ jsxRuntime.jsx(
373
380
  sidebar.Sidebar,
374
381
  {
@@ -844,6 +851,105 @@ var Menubar = react.forwardRef(function Menubar2({
844
851
  }
845
852
  ) });
846
853
  });
854
+ var Tag = react.forwardRef(function Tag2({ variant = "default", size = "small", icon, className, children, ...props }, ref) {
855
+ const primeRef = react.useRef(null);
856
+ react.useImperativeHandle(ref, () => primeRef.current?.getElement());
857
+ const classes = ["cr-tag", `cr-tag--${variant}`, `cr-tag--${size}`, className].filter(Boolean).join(" ");
858
+ return /* @__PURE__ */ jsxRuntime.jsx(
859
+ tag.Tag,
860
+ {
861
+ unstyled: true,
862
+ ref: primeRef,
863
+ className: classes,
864
+ icon: icon ? () => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-tag__icon", "aria-hidden": "true", children: icon }) : void 0,
865
+ value: children,
866
+ ...props
867
+ }
868
+ );
869
+ });
870
+ var isGroup = (entry) => "items" in entry;
871
+ var MenuPrincipal = react.forwardRef(
872
+ function MenuPrincipal2({
873
+ model,
874
+ popup = false,
875
+ "aria-label": ariaLabel = "Menu principal",
876
+ onShow,
877
+ onHide,
878
+ id,
879
+ className
880
+ }, ref) {
881
+ const primeRef = react.useRef(null);
882
+ const context = react.useContext(api.PrimeReactContext);
883
+ react.useImperativeHandle(ref, () => ({
884
+ toggle: (event) => primeRef.current?.toggle(event),
885
+ show: (event) => primeRef.current?.show(event),
886
+ hide: (event) => primeRef.current?.hide(event),
887
+ getElement: () => primeRef.current?.getElement() ?? null
888
+ }));
889
+ const toPrime = (item) => ({
890
+ id: item.id,
891
+ // Sem label no Prime: ele viraria o aria-label do item, só com parte do texto visível. O
892
+ // nome vem do conteúdo: o nome, a descrição e a tag. Os espaços entre eles não aparecem
893
+ // (estão em flex), mas separam as palavras no nome ("Início Tela inicial", não colado).
894
+ command: item.command,
895
+ url: item.url,
896
+ target: item.target,
897
+ className: item.className,
898
+ // O <a> leva o data-pc-section do Prime: o Enter do teclado clica nele (e segue o link).
899
+ template: () => /* @__PURE__ */ jsxRuntime.jsxs(
900
+ "a",
901
+ {
902
+ className: "cr-menu-principal__action",
903
+ "data-pc-section": "action",
904
+ href: item.url ?? "#",
905
+ target: item.target,
906
+ tabIndex: -1,
907
+ children: [
908
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-menu-principal__icon", "aria-hidden": "true", children: item.icon }),
909
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "cr-menu-principal__text", children: [
910
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-menu-principal__label", children: item.label }),
911
+ " ",
912
+ item.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-menu-principal__description", children: item.description })
913
+ ] }),
914
+ " ",
915
+ item.tag && /* @__PURE__ */ jsxRuntime.jsx(Tag, { className: "cr-menu-principal__tag", variant: "warning", icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.DribbbleLogo, {}), children: item.tag })
916
+ ]
917
+ }
918
+ )
919
+ });
920
+ const items = [];
921
+ let anterior;
922
+ model.forEach((entry) => {
923
+ if (anterior && (isGroup(entry) || isGroup(anterior))) items.push({ separator: true });
924
+ items.push(
925
+ isGroup(entry) ? { id: entry.id, label: entry.label, items: entry.items.map(toPrime) } : toPrime(entry)
926
+ );
927
+ anterior = entry;
928
+ });
929
+ const classes = ["cr-menu-principal", popup && "cr-menu-principal--popup", className].filter(Boolean).join(" ");
930
+ const pt = {
931
+ menu: { className: "cr-menu-principal__list", "aria-label": ariaLabel },
932
+ submenuHeader: { className: "cr-menu-principal__group" },
933
+ separator: { className: "cr-menu-principal__separator" },
934
+ menuitem: { className: "cr-menu-principal__item" }
935
+ };
936
+ const menu$1 = /* @__PURE__ */ jsxRuntime.jsx(
937
+ menu.Menu,
938
+ {
939
+ unstyled: true,
940
+ ref: primeRef,
941
+ id,
942
+ className: classes,
943
+ model: items,
944
+ popup,
945
+ onShow,
946
+ onHide,
947
+ pt
948
+ }
949
+ );
950
+ return context ? menu$1 : /* @__PURE__ */ jsxRuntime.jsx(api.PrimeReactProvider, { children: menu$1 });
951
+ }
952
+ );
847
953
  function Modal({
848
954
  visible,
849
955
  onHide,
@@ -1509,22 +1615,6 @@ var Tabs = react.forwardRef(function Tabs2({ activeIndex, onTabChange, children,
1509
1615
  }
1510
1616
  );
1511
1617
  });
1512
- var Tag = react.forwardRef(function Tag2({ variant = "default", size = "small", icon, className, children, ...props }, ref) {
1513
- const primeRef = react.useRef(null);
1514
- react.useImperativeHandle(ref, () => primeRef.current?.getElement());
1515
- const classes = ["cr-tag", `cr-tag--${variant}`, `cr-tag--${size}`, className].filter(Boolean).join(" ");
1516
- return /* @__PURE__ */ jsxRuntime.jsx(
1517
- tag.Tag,
1518
- {
1519
- unstyled: true,
1520
- ref: primeRef,
1521
- className: classes,
1522
- icon: icon ? () => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-tag__icon", "aria-hidden": "true", children: icon }) : void 0,
1523
- value: children,
1524
- ...props
1525
- }
1526
- );
1527
- });
1528
1618
 
1529
1619
  exports.AutoComplete = AutoComplete;
1530
1620
  exports.Badge = Badge;
@@ -1537,6 +1627,7 @@ exports.Drawer = Drawer;
1537
1627
  exports.IconButton = IconButton;
1538
1628
  exports.Input = Input;
1539
1629
  exports.Menu = Menu;
1630
+ exports.MenuPrincipal = MenuPrincipal;
1540
1631
  exports.Menubar = Menubar;
1541
1632
  exports.Modal = Modal;
1542
1633
  exports.MultiSelect = MultiSelect;