@vector-business-services/cristal-ds-web 0.8.0 → 0.9.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
@@ -20,6 +20,7 @@ var tooltip = require('primereact/tooltip');
20
20
  var tag = require('primereact/tag');
21
21
  var dialog = require('primereact/dialog');
22
22
  var multiselect = require('primereact/multiselect');
23
+ var tabmenu = require('primereact/tabmenu');
23
24
  var panel = require('primereact/panel');
24
25
  var radiobutton = require('primereact/radiobutton');
25
26
  var scrollpanel = require('primereact/scrollpanel');
@@ -1219,6 +1220,105 @@ var MultiSelect = react.forwardRef(function MultiSelect2({
1219
1220
  ] })
1220
1221
  ] });
1221
1222
  });
1223
+ var PageHeader = react.forwardRef(function PageHeader2({
1224
+ title,
1225
+ variant = "primary",
1226
+ onBack,
1227
+ backLabel = "Voltar",
1228
+ tag,
1229
+ segmentControl,
1230
+ actions,
1231
+ onExpand,
1232
+ expandLabel = "Expandir",
1233
+ tabs,
1234
+ activeTab,
1235
+ onTabChange,
1236
+ tabsLabel,
1237
+ className,
1238
+ ...props
1239
+ }, ref) {
1240
+ const [interna, setInterna] = react.useState(0);
1241
+ const ativa = activeTab ?? interna;
1242
+ const tools = segmentControl || actions;
1243
+ const tabTemplate = (tab) => (
1244
+ // O TabMenu também passa o index da aba nas opções, além do que o tipo do MenuItem declara.
1245
+ function TabContent(item, options) {
1246
+ const { element, index } = options;
1247
+ const active = index === ativa;
1248
+ return react.cloneElement(
1249
+ element,
1250
+ { "aria-current": active ? "page" : void 0 },
1251
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1252
+ (variant === "primary" || tab.icon) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-page-header__tab-icon", "aria-hidden": "true", children: tab.icon }),
1253
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-page-header__tab-label", children: item.label })
1254
+ ] })
1255
+ );
1256
+ }
1257
+ );
1258
+ const classes = ["cr-page-header", `cr-page-header--${variant}`, className].filter(Boolean).join(" ");
1259
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: classes, ...props, children: [
1260
+ /* @__PURE__ */ jsxRuntime.jsxs(
1261
+ "div",
1262
+ {
1263
+ className: `cr-page-header__title-group${tools ? " cr-page-header__title-group--tools" : ""}`,
1264
+ children: [
1265
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-page-header__title-text", children: [
1266
+ onBack && /* @__PURE__ */ jsxRuntime.jsx(
1267
+ IconButton,
1268
+ {
1269
+ variant: "tertiary",
1270
+ size: "small",
1271
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.ArrowLeft, {}),
1272
+ "aria-label": backLabel,
1273
+ onClick: onBack
1274
+ }
1275
+ ),
1276
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "cr-page-header__title", children: title }),
1277
+ tag && /* @__PURE__ */ jsxRuntime.jsx(Tag, { className: "cr-page-header__tag", children: tag })
1278
+ ] }),
1279
+ tools && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-page-header__tools", children: [
1280
+ segmentControl && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cr-page-header__segment", children: segmentControl }),
1281
+ actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cr-page-header__actions", children: actions })
1282
+ ] }),
1283
+ onExpand && /* @__PURE__ */ jsxRuntime.jsx(
1284
+ IconButton,
1285
+ {
1286
+ className: "cr-page-header__expand",
1287
+ variant: "tertiary",
1288
+ size: "medium",
1289
+ icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.ArrowsOutSimple, {}),
1290
+ "aria-label": expandLabel,
1291
+ onClick: onExpand
1292
+ }
1293
+ )
1294
+ ]
1295
+ }
1296
+ ),
1297
+ tabs && tabs.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1298
+ tabmenu.TabMenu,
1299
+ {
1300
+ unstyled: true,
1301
+ model: tabs.map((tab) => ({
1302
+ label: tab.label,
1303
+ disabled: tab.disabled,
1304
+ template: tabTemplate(tab)
1305
+ })),
1306
+ activeIndex: ativa,
1307
+ onTabChange: (event) => {
1308
+ setInterna(event.index);
1309
+ onTabChange?.(event.index);
1310
+ },
1311
+ pt: {
1312
+ root: { className: "cr-page-header__tabs" },
1313
+ menu: { className: "cr-page-header__tab-list", "aria-label": tabsLabel ?? title },
1314
+ menuitem: { className: "cr-page-header__tab-item" },
1315
+ action: { className: "cr-page-header__tab" },
1316
+ inkbar: { className: "cr-page-header__inkbar" }
1317
+ }
1318
+ }
1319
+ )
1320
+ ] });
1321
+ });
1222
1322
  var Panel = react.forwardRef(function Panel2({ className, style, children, ...props }, ref) {
1223
1323
  const primeRef = react.useRef(null);
1224
1324
  react.useImperativeHandle(ref, () => primeRef.current?.getElement());
@@ -1631,6 +1731,7 @@ exports.MenuPrincipal = MenuPrincipal;
1631
1731
  exports.Menubar = Menubar;
1632
1732
  exports.Modal = Modal;
1633
1733
  exports.MultiSelect = MultiSelect;
1734
+ exports.PageHeader = PageHeader;
1634
1735
  exports.Panel = Panel;
1635
1736
  exports.Radio = Radio;
1636
1737
  exports.ScrollPanel = ScrollPanel;