@abgov/react-components 6.11.0-dev.12 → 6.11.0-dev.15

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/experimental.mjs CHANGED
@@ -1,6 +1,50 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { t as transformProps, l as lowercase, f as format, p as parseISO, i as isValid, k as kebab } from "./parseISO-BHUUf1QW.mjs";
3
2
  import { useRef, useEffect } from "react";
3
+ import { t as transformProps, l as lowercase, C as CalendarDate, f as format, p as parseISO, i as isValid, k as kebab } from "./calendar-date-Chmr7h4a.mjs";
4
+ function GoabxAppHeader({
5
+ onMenuClick,
6
+ children,
7
+ secondaryText,
8
+ ...rest
9
+ }) {
10
+ const el = useRef(null);
11
+ const _props = transformProps(rest, lowercase);
12
+ useEffect(() => {
13
+ if (!el.current) {
14
+ return;
15
+ }
16
+ if (!onMenuClick) {
17
+ return;
18
+ }
19
+ const current = el.current;
20
+ const listener = () => {
21
+ onMenuClick == null ? void 0 : onMenuClick();
22
+ };
23
+ current.addEventListener("_menuClick", listener);
24
+ return () => {
25
+ current.removeEventListener("_menuClick", listener);
26
+ };
27
+ }, [el, onMenuClick]);
28
+ return /* @__PURE__ */ jsx(
29
+ "goa-app-header",
30
+ {
31
+ ref: el,
32
+ hasmenuclickhandler: onMenuClick ? "true" : "false",
33
+ secondarytext: secondaryText,
34
+ ..._props,
35
+ version: "2",
36
+ children
37
+ }
38
+ );
39
+ }
40
+ function GoabxAppHeaderMenu({
41
+ children,
42
+ slotName,
43
+ ...rest
44
+ }) {
45
+ const _props = transformProps(rest, lowercase);
46
+ return /* @__PURE__ */ jsx("goa-app-header-menu", { slot: slotName, ..._props, children });
47
+ }
4
48
  function getIconValue(icon, iconType) {
5
49
  if (icon !== void 0) {
6
50
  return icon ? "true" : "false";
@@ -263,7 +307,7 @@ function GoabxDatePicker({
263
307
  const formatValue = (val) => {
264
308
  if (!val) return "";
265
309
  if (val instanceof Date) {
266
- return val.toISOString();
310
+ return new CalendarDate(val).toString();
267
311
  }
268
312
  return val;
269
313
  };
@@ -323,6 +367,45 @@ function GoabxDrawer({
323
367
  }
324
368
  );
325
369
  }
370
+ function GoabxPushDrawer({
371
+ open,
372
+ heading,
373
+ width,
374
+ testId,
375
+ actions,
376
+ children,
377
+ onClose,
378
+ version = "2"
379
+ }) {
380
+ const el = useRef(null);
381
+ useEffect(() => {
382
+ var _a;
383
+ if (!(el == null ? void 0 : el.current) || !onClose) {
384
+ return;
385
+ }
386
+ (_a = el.current) == null ? void 0 : _a.addEventListener("_close", onClose);
387
+ return () => {
388
+ var _a2;
389
+ (_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_close", onClose);
390
+ };
391
+ }, [el, onClose]);
392
+ return /* @__PURE__ */ jsxs(
393
+ "goa-push-drawer",
394
+ {
395
+ ref: el,
396
+ open: open ? true : void 0,
397
+ heading: typeof heading === "string" ? heading : void 0,
398
+ width,
399
+ testid: testId,
400
+ version,
401
+ children: [
402
+ heading && typeof heading !== "string" && /* @__PURE__ */ jsx("div", { slot: "heading", children: heading }),
403
+ actions && /* @__PURE__ */ jsx("div", { slot: "actions", children: actions }),
404
+ children
405
+ ]
406
+ }
407
+ );
408
+ }
326
409
  function stringify(value) {
327
410
  if (typeof value === "undefined") {
328
411
  return "";
@@ -1155,7 +1238,8 @@ function GoabxTabs({
1155
1238
  testId,
1156
1239
  onChange,
1157
1240
  variant,
1158
- orientation
1241
+ orientation,
1242
+ navigation
1159
1243
  }) {
1160
1244
  const ref = useRef(null);
1161
1245
  useEffect(() => {
@@ -1180,6 +1264,7 @@ function GoabxTabs({
1180
1264
  variant,
1181
1265
  version: "2",
1182
1266
  orientation,
1267
+ navigation,
1183
1268
  children
1184
1269
  }
1185
1270
  );
@@ -1244,7 +1329,8 @@ function GoabxWorkSideMenu({
1244
1329
  secondaryContent,
1245
1330
  accountContent,
1246
1331
  open,
1247
- onToggle
1332
+ onToggle,
1333
+ onNavigate
1248
1334
  }) {
1249
1335
  const el = useRef(null);
1250
1336
  useEffect(() => {
@@ -1258,6 +1344,20 @@ function GoabxWorkSideMenu({
1258
1344
  (_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_toggle", onToggle);
1259
1345
  };
1260
1346
  }, [el, onToggle]);
1347
+ useEffect(() => {
1348
+ var _a;
1349
+ if (!(el == null ? void 0 : el.current) || !onNavigate) {
1350
+ return;
1351
+ }
1352
+ const handler = (e) => {
1353
+ onNavigate(e.detail.url);
1354
+ };
1355
+ (_a = el.current) == null ? void 0 : _a.addEventListener("_navigate", handler);
1356
+ return () => {
1357
+ var _a2;
1358
+ (_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_navigate", handler);
1359
+ };
1360
+ }, [el, onNavigate]);
1261
1361
  return /* @__PURE__ */ jsxs(
1262
1362
  "goa-work-side-menu",
1263
1363
  {
@@ -1277,7 +1377,7 @@ function GoabxWorkSideMenu({
1277
1377
  );
1278
1378
  }
1279
1379
  function GoabxWorkSideMenuItem(props) {
1280
- return /* @__PURE__ */ jsx(
1380
+ return /* @__PURE__ */ jsxs(
1281
1381
  "goa-work-side-menu-item",
1282
1382
  {
1283
1383
  label: props.label,
@@ -1288,7 +1388,10 @@ function GoabxWorkSideMenuItem(props) {
1288
1388
  icon: props.icon,
1289
1389
  testid: props.testId,
1290
1390
  type: props.type,
1291
- children: props.children
1391
+ children: [
1392
+ props.popoverContent && /* @__PURE__ */ jsx("div", { slot: "popoverContent", children: props.popoverContent }),
1393
+ props.children
1394
+ ]
1292
1395
  }
1293
1396
  );
1294
1397
  }
@@ -1304,10 +1407,84 @@ function GoabxWorkSideMenuGroup(props) {
1304
1407
  }
1305
1408
  );
1306
1409
  }
1410
+ function GoabxWorkSideNotificationPanel({
1411
+ heading,
1412
+ activeTab,
1413
+ testId,
1414
+ children,
1415
+ onMarkAllRead,
1416
+ onViewAll
1417
+ }) {
1418
+ const el = useRef(null);
1419
+ useEffect(() => {
1420
+ if (!el.current) return;
1421
+ const handleMarkAllRead = () => {
1422
+ onMarkAllRead == null ? void 0 : onMarkAllRead();
1423
+ };
1424
+ const handleViewAll = () => {
1425
+ onViewAll == null ? void 0 : onViewAll();
1426
+ };
1427
+ el.current.addEventListener("_markAllRead", handleMarkAllRead);
1428
+ el.current.addEventListener("_viewAll", handleViewAll);
1429
+ return () => {
1430
+ var _a, _b;
1431
+ (_a = el.current) == null ? void 0 : _a.removeEventListener("_markAllRead", handleMarkAllRead);
1432
+ (_b = el.current) == null ? void 0 : _b.removeEventListener("_viewAll", handleViewAll);
1433
+ };
1434
+ }, [el, onMarkAllRead, onViewAll]);
1435
+ return /* @__PURE__ */ jsx(
1436
+ "goa-work-side-notification-panel",
1437
+ {
1438
+ ref: el,
1439
+ heading,
1440
+ "active-tab": activeTab,
1441
+ testid: testId,
1442
+ children
1443
+ }
1444
+ );
1445
+ }
1446
+ function GoabxWorkSideNotificationItem({
1447
+ type,
1448
+ timestamp,
1449
+ title,
1450
+ description,
1451
+ readStatus,
1452
+ priority,
1453
+ testId,
1454
+ onClick
1455
+ }) {
1456
+ const el = useRef(null);
1457
+ useEffect(() => {
1458
+ if (!el.current) return;
1459
+ const handleClick = () => {
1460
+ onClick == null ? void 0 : onClick();
1461
+ };
1462
+ el.current.addEventListener("_click", handleClick);
1463
+ return () => {
1464
+ var _a;
1465
+ (_a = el.current) == null ? void 0 : _a.removeEventListener("_click", handleClick);
1466
+ };
1467
+ }, [el, onClick]);
1468
+ return /* @__PURE__ */ jsx(
1469
+ "goa-work-side-notification-item",
1470
+ {
1471
+ ref: el,
1472
+ type,
1473
+ timestamp,
1474
+ title,
1475
+ description,
1476
+ "read-status": readStatus,
1477
+ priority,
1478
+ testid: testId
1479
+ }
1480
+ );
1481
+ }
1307
1482
  export {
1308
1483
  GoabxAppFooter,
1309
1484
  GoabxAppFooterMetaSection,
1310
1485
  GoabxAppFooterNavSection,
1486
+ GoabxAppHeader,
1487
+ GoabxAppHeaderMenu,
1311
1488
  GoabxBadge,
1312
1489
  GoabxButton,
1313
1490
  GoabxCalendar,
@@ -1343,6 +1520,7 @@ export {
1343
1520
  GoabxModal,
1344
1521
  GoabxNotification,
1345
1522
  GoabxPagination,
1523
+ GoabxPushDrawer,
1346
1524
  GoabxRadioGroup,
1347
1525
  GoabxRadioItem,
1348
1526
  GoabxSideMenu,
@@ -1355,6 +1533,8 @@ export {
1355
1533
  GoabxTextArea,
1356
1534
  GoabxWorkSideMenu,
1357
1535
  GoabxWorkSideMenuGroup,
1358
- GoabxWorkSideMenuItem
1536
+ GoabxWorkSideMenuItem,
1537
+ GoabxWorkSideNotificationItem,
1538
+ GoabxWorkSideNotificationPanel
1359
1539
  };
1360
1540
  //# sourceMappingURL=experimental.mjs.map