@abgov/react-components 5.2.0 → 5.4.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/index.mjs CHANGED
@@ -1,26 +1,45 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useRef, useEffect } from "react";
3
+ import { G } from "./icon-DgSW1II3.mjs";
3
4
  function GoAAccordion({
4
5
  open,
5
6
  heading,
6
7
  headingSize,
7
8
  secondaryText,
8
9
  headingContent,
10
+ iconPosition,
9
11
  maxWidth,
10
12
  testid,
13
+ onChange,
11
14
  children,
12
15
  mt,
13
16
  mr,
14
17
  mb,
15
18
  ml
16
19
  }) {
20
+ const ref = useRef(null);
21
+ useEffect(() => {
22
+ const element = ref.current;
23
+ if (element && onChange) {
24
+ const handler = (event) => {
25
+ const customEvent = event;
26
+ onChange(customEvent.detail.open);
27
+ };
28
+ element.addEventListener("_change", handler);
29
+ return () => {
30
+ element.removeEventListener("_change", handler);
31
+ };
32
+ }
33
+ }, [onChange]);
17
34
  return /* @__PURE__ */ jsxs(
18
35
  "goa-accordion",
19
36
  {
37
+ ref,
20
38
  open,
21
39
  headingSize,
22
40
  heading,
23
41
  secondaryText,
42
+ iconposition: iconPosition,
24
43
  maxwidth: maxWidth,
25
44
  testid,
26
45
  mt,
@@ -40,16 +59,36 @@ function GoAAppHeader({
40
59
  maxContentWidth,
41
60
  fullMenuBreakpoint,
42
61
  testId,
43
- children
62
+ children,
63
+ onMenuClick
44
64
  }) {
65
+ const el = useRef(null);
66
+ useEffect(() => {
67
+ if (!el.current) {
68
+ return;
69
+ }
70
+ if (!onMenuClick) {
71
+ return;
72
+ }
73
+ const current = el.current;
74
+ const listener = () => {
75
+ onMenuClick();
76
+ };
77
+ current.addEventListener("_menuClick", listener);
78
+ return () => {
79
+ current.removeEventListener("_menuClick", listener);
80
+ };
81
+ }, [el, onMenuClick]);
45
82
  return /* @__PURE__ */ jsx(
46
83
  "goa-app-header",
47
84
  {
85
+ ref: el,
48
86
  heading,
49
87
  url,
50
88
  fullmenubreakpoint: fullMenuBreakpoint,
51
89
  maxcontentwidth: maxContentWidth,
52
90
  testid: testId,
91
+ hasmenuclickhandler: !!onMenuClick,
53
92
  children
54
93
  }
55
94
  );
@@ -214,6 +253,7 @@ function GoAButton({
214
253
  variant,
215
254
  leadingIcon,
216
255
  trailingIcon,
256
+ width,
217
257
  testId,
218
258
  children,
219
259
  onClick,
@@ -249,6 +289,7 @@ function GoAButton({
249
289
  disabled,
250
290
  leadingicon: leadingIcon,
251
291
  trailingicon: trailingIcon,
292
+ width,
252
293
  testid: testId,
253
294
  mt,
254
295
  mr,
@@ -323,6 +364,7 @@ function GoACalendar({
323
364
  const GoACallout = ({
324
365
  heading,
325
366
  type = "information",
367
+ iconTheme = "outline",
326
368
  size = "large",
327
369
  maxWidth,
328
370
  testId,
@@ -341,6 +383,7 @@ const GoACallout = ({
341
383
  size,
342
384
  maxwidth: maxWidth,
343
385
  arialive: ariaLive,
386
+ icontheme: iconTheme,
344
387
  mt,
345
388
  mr,
346
389
  mb,
@@ -650,7 +693,7 @@ function GoADropdownOption(props) {
650
693
  }, []);
651
694
  return /* @__PURE__ */ jsx(GoADropdownItem, { ...props });
652
695
  }
653
- function GoADropdownItem({ value, label, filter, name, testId, mountType = "append" }) {
696
+ function GoADropdownItem({ value, label, filter, name, testId, mountType = "reset" }) {
654
697
  return /* @__PURE__ */ jsx(
655
698
  "goa-dropdown-item",
656
699
  {
@@ -994,40 +1037,6 @@ function GoAIconButton({
994
1037
  }
995
1038
  );
996
1039
  }
997
- function GoAIcon({
998
- type,
999
- theme,
1000
- size,
1001
- inverted,
1002
- fillColor,
1003
- opacity,
1004
- title,
1005
- ariaLabel,
1006
- mt,
1007
- mr,
1008
- mb,
1009
- ml,
1010
- testId
1011
- }) {
1012
- return /* @__PURE__ */ jsx(
1013
- "goa-icon",
1014
- {
1015
- type,
1016
- theme,
1017
- size,
1018
- inverted,
1019
- fillcolor: fillColor,
1020
- opacity,
1021
- title,
1022
- arialabel: ariaLabel,
1023
- mt,
1024
- mr,
1025
- mb,
1026
- ml,
1027
- testid: testId
1028
- }
1029
- );
1030
- }
1031
1040
  function toDate(argument) {
1032
1041
  const argStr = Object.prototype.toString.call(argument);
1033
1042
  if (argument instanceof Date || typeof argument === "object" && argStr === "[object Date]") {
@@ -3249,7 +3258,12 @@ function GoASideMenuGroup(props) {
3249
3258
  "goa-side-menu-group",
3250
3259
  {
3251
3260
  heading: props.heading,
3261
+ icon: props.icon,
3252
3262
  testid: props.testId,
3263
+ mt: props.mt,
3264
+ mr: props.mr,
3265
+ mb: props.mb,
3266
+ ml: props.ml,
3253
3267
  children: props.children
3254
3268
  }
3255
3269
  );
@@ -3411,6 +3425,7 @@ function GoATextarea({
3411
3425
  value,
3412
3426
  placeholder,
3413
3427
  rows,
3428
+ readOnly,
3414
3429
  disabled,
3415
3430
  countBy,
3416
3431
  maxCount,
@@ -3463,6 +3478,7 @@ function GoATextarea({
3463
3478
  placeholder,
3464
3479
  value,
3465
3480
  rows,
3481
+ readOnly,
3466
3482
  disabled,
3467
3483
  countby: countBy,
3468
3484
  maxcount: maxCount,
@@ -3527,6 +3543,42 @@ function GoATwoColumnLayout(props) {
3527
3543
  }
3528
3544
  );
3529
3545
  }
3546
+ const GoAFilterChip = ({
3547
+ iconTheme = "outline",
3548
+ error = false,
3549
+ content,
3550
+ onClick,
3551
+ mt,
3552
+ mr,
3553
+ mb,
3554
+ ml,
3555
+ testId
3556
+ }) => {
3557
+ const el = useRef(null);
3558
+ useEffect(() => {
3559
+ if (!el.current) return;
3560
+ if (!onClick) return;
3561
+ const current = el.current;
3562
+ current.addEventListener("_click", onClick);
3563
+ return () => {
3564
+ current.removeEventListener("_click", onClick);
3565
+ };
3566
+ }, [el, onClick]);
3567
+ return /* @__PURE__ */ jsx(
3568
+ "goa-filter-chip",
3569
+ {
3570
+ ref: el,
3571
+ icontheme: iconTheme,
3572
+ error,
3573
+ content,
3574
+ mt,
3575
+ mr,
3576
+ mb,
3577
+ ml,
3578
+ "data-testid": testId
3579
+ }
3580
+ );
3581
+ };
3530
3582
  export {
3531
3583
  GoAAccordion,
3532
3584
  GoAAppFooter,
@@ -3554,13 +3606,14 @@ export {
3554
3606
  GoAFieldset,
3555
3607
  GoAFileUploadCard,
3556
3608
  GoAFileUploadInput,
3609
+ GoAFilterChip,
3557
3610
  GoAFormItem,
3558
3611
  GoAFormStep,
3559
3612
  GoAFormStepper,
3560
3613
  GoAGrid,
3561
3614
  GoAHeroBanner,
3562
3615
  GoAHeroBannerActions,
3563
- GoAIcon,
3616
+ G as GoAIcon,
3564
3617
  GoAIconButton,
3565
3618
  GoAImportantBadge,
3566
3619
  GoAInfoBadge,