@abgov/react-components 5.0.0-alpha.11 → 5.0.0-alpha.12

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.d.ts CHANGED
@@ -57,4 +57,5 @@ export * from "./lib/textarea/textarea";
57
57
  export * from "./lib/three-column-layout/three-column-layout";
58
58
  export * from "./lib/tooltip/tooltip";
59
59
  export * from "./lib/two-column-layout/two-column-layout";
60
+ export * from "./lib/filter-chip/filter-chip";
60
61
  export * from "./common/styling";
package/index.js CHANGED
@@ -12,15 +12,31 @@ function GoAAccordion({
12
12
  iconPosition,
13
13
  maxWidth,
14
14
  testid,
15
+ onChange,
15
16
  children,
16
17
  mt,
17
18
  mr,
18
19
  mb,
19
20
  ml
20
21
  }) {
22
+ const ref = react.useRef(null);
23
+ react.useEffect(() => {
24
+ const element = ref.current;
25
+ if (element && onChange) {
26
+ const handler = (event) => {
27
+ const customEvent = event;
28
+ onChange(customEvent.detail.open);
29
+ };
30
+ element.addEventListener("_change", handler);
31
+ return () => {
32
+ element.removeEventListener("_change", handler);
33
+ };
34
+ }
35
+ }, [onChange]);
21
36
  return /* @__PURE__ */ jsxRuntime.jsxs(
22
37
  "goa-accordion",
23
38
  {
39
+ ref,
24
40
  open,
25
41
  headingSize,
26
42
  heading,
@@ -3525,6 +3541,42 @@ function GoATwoColumnLayout(props) {
3525
3541
  }
3526
3542
  );
3527
3543
  }
3544
+ const GoAFilterChip = ({
3545
+ iconTheme = "outline",
3546
+ error = false,
3547
+ content,
3548
+ onClick,
3549
+ mt,
3550
+ mr,
3551
+ mb,
3552
+ ml,
3553
+ testId
3554
+ }) => {
3555
+ const el = react.useRef(null);
3556
+ react.useEffect(() => {
3557
+ if (!el.current) return;
3558
+ if (!onClick) return;
3559
+ const current = el.current;
3560
+ current.addEventListener("_click", onClick);
3561
+ return () => {
3562
+ current.removeEventListener("_click", onClick);
3563
+ };
3564
+ }, [el, onClick]);
3565
+ return /* @__PURE__ */ jsxRuntime.jsx(
3566
+ "goa-filter-chip",
3567
+ {
3568
+ ref: el,
3569
+ icontheme: iconTheme,
3570
+ error,
3571
+ content,
3572
+ mt,
3573
+ mr,
3574
+ mb,
3575
+ ml,
3576
+ "data-testid": testId
3577
+ }
3578
+ );
3579
+ };
3528
3580
  exports.GoAIcon = icon.GoAIcon;
3529
3581
  exports.GoAAccordion = GoAAccordion;
3530
3582
  exports.GoAAppFooter = GoAAppFooter;
@@ -3552,6 +3604,7 @@ exports.GoAEmergencyBadge = GoAEmergencyBadge;
3552
3604
  exports.GoAFieldset = GoAFieldset;
3553
3605
  exports.GoAFileUploadCard = GoAFileUploadCard;
3554
3606
  exports.GoAFileUploadInput = GoAFileUploadInput;
3607
+ exports.GoAFilterChip = GoAFilterChip;
3555
3608
  exports.GoAFormItem = GoAFormItem;
3556
3609
  exports.GoAFormStep = GoAFormStep;
3557
3610
  exports.GoAFormStepper = GoAFormStepper;