@abgov/react-components 5.0.0-alpha.7 → 5.0.0-alpha.8

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
@@ -16,6 +16,7 @@ export * from "./lib/details/details";
16
16
  export * from "./lib/divider/divider";
17
17
  export * from "./lib/dropdown/dropdown";
18
18
  export * from "./lib/dropdown/dropdown-item";
19
+ export * from "./lib/fieldset/fieldset";
19
20
  export * from "./lib/file-upload-card/file-upload-card";
20
21
  export * from "./lib/file-upload-input/file-upload-input";
21
22
  export * from "./lib/footer/footer";
@@ -30,6 +31,8 @@ export * from "./lib/hero-banner/hero-banner-actions";
30
31
  export * from "./lib/icon-button/icon-button";
31
32
  export * from "./lib/icon/icon";
32
33
  export * from "./lib/input/input";
34
+ export * from "./lib/link/link";
35
+ export * from "./lib/link-button/link-button";
33
36
  export * from "./lib/microsite-header/microsite-header";
34
37
  export * from "./lib/modal/modal";
35
38
  export * from "./lib/notification/notification";
@@ -49,6 +52,7 @@ export * from "./lib/table/table";
49
52
  export * from "./lib/table/table-sort-header";
50
53
  export * from "./lib/tabs/tabs";
51
54
  export * from "./lib/tab/tab";
55
+ export * from "./lib/text/text";
52
56
  export * from "./lib/textarea/textarea";
53
57
  export * from "./lib/three-column-layout/three-column-layout";
54
58
  export * from "./lib/tooltip/tooltip";
package/index.js CHANGED
@@ -394,7 +394,7 @@ function GoACheckbox({
394
394
  id,
395
395
  name,
396
396
  error,
397
- checked,
397
+ checked: checked || false,
398
398
  disabled,
399
399
  text,
400
400
  value,
@@ -538,7 +538,7 @@ function GoADatePicker({
538
538
  const current = ref.current;
539
539
  const handleChange = (e) => {
540
540
  const newValue = e.detail.value;
541
- onChange(name || "", newValue ? new Date(newValue) : void 0);
541
+ onChange == null ? void 0 : onChange(name || "", newValue ? new Date(newValue) : void 0);
542
542
  };
543
543
  current.addEventListener("_change", handleChange);
544
544
  return () => {
@@ -609,8 +609,9 @@ function GoADropdown(props) {
609
609
  }
610
610
  const current = el.current;
611
611
  const handler = (e) => {
612
+ var _a;
612
613
  const { name, value, values } = e.detail;
613
- props.onChange(name, props.multiselect ? values : value);
614
+ (_a = props.onChange) == null ? void 0 : _a.call(props, name, props.multiselect ? values : value);
614
615
  };
615
616
  current.addEventListener("_change", handler);
616
617
  return () => {
@@ -664,6 +665,53 @@ function GoADropdownItem({ value, label, filter, name, testId, mountType = "appe
664
665
  }
665
666
  );
666
667
  }
668
+ function GoAFieldset({
669
+ heading,
670
+ buttonText,
671
+ id,
672
+ onContinue,
673
+ children,
674
+ mt,
675
+ mr,
676
+ mb,
677
+ ml,
678
+ first,
679
+ last
680
+ }) {
681
+ const ref = react.useRef(null);
682
+ react.useEffect(() => {
683
+ var _a;
684
+ const _continue = (e) => {
685
+ const { el, state } = e.detail;
686
+ return onContinue == null ? void 0 : onContinue(el, state);
687
+ };
688
+ if (onContinue) {
689
+ (_a = ref.current) == null ? void 0 : _a.addEventListener("_continue", _continue);
690
+ }
691
+ return () => {
692
+ var _a2;
693
+ if (onContinue) {
694
+ (_a2 = ref.current) == null ? void 0 : _a2.removeEventListener("_continue", _continue);
695
+ }
696
+ };
697
+ }, [ref.current, onContinue]);
698
+ return /* @__PURE__ */ jsxRuntime.jsx(
699
+ "goa-fieldset",
700
+ {
701
+ ref,
702
+ id,
703
+ first,
704
+ last,
705
+ heading,
706
+ buttontext: buttonText,
707
+ mt,
708
+ mr,
709
+ mb,
710
+ ml,
711
+ children
712
+ }
713
+ );
714
+ }
667
715
  function GoAFileUploadCard({
668
716
  filename,
669
717
  size,
@@ -2630,7 +2678,7 @@ function GoAInput({
2630
2678
  const current = ref.current;
2631
2679
  const changeListener = (e) => {
2632
2680
  const { name: name2, value: value2 } = e.detail;
2633
- onChange(name2, value2);
2681
+ onChange == null ? void 0 : onChange(name2, value2);
2634
2682
  };
2635
2683
  const clickListener = () => {
2636
2684
  onTrailingIconClick == null ? void 0 : onTrailingIconClick();
@@ -2701,6 +2749,7 @@ function GoAInput({
2701
2749
  }
2702
2750
  const onDateChangeHandler = (onChange) => {
2703
2751
  return (name, value) => {
2752
+ if (!onChange) return;
2704
2753
  if (!value) {
2705
2754
  onChange(name, "");
2706
2755
  return;
@@ -2712,6 +2761,7 @@ const onDateChangeHandler = (onChange) => {
2712
2761
  };
2713
2762
  const onTimeChangeHandler = (onChange) => {
2714
2763
  return (name, value) => {
2764
+ if (!onChange) return;
2715
2765
  if (!value) {
2716
2766
  onChange(name, "");
2717
2767
  return;
@@ -2806,7 +2856,10 @@ function GoAInputFile(props) {
2806
2856
  id: props.id,
2807
2857
  name: props.name,
2808
2858
  type: "file",
2809
- onChange: (e) => props.onChange(e.target.name, e.target.value),
2859
+ onChange: (e) => {
2860
+ var _a;
2861
+ return (_a = props.onChange) == null ? void 0 : _a.call(props, e.target.name, e.target.value);
2862
+ },
2810
2863
  style: { backgroundColor: "revert" }
2811
2864
  }
2812
2865
  );
@@ -2821,7 +2874,8 @@ function GoAInputNumber({
2821
2874
  ...props
2822
2875
  }) {
2823
2876
  const onNumberChange = (name, value2) => {
2824
- props.onChange(name, parseFloat(value2));
2877
+ var _a;
2878
+ (_a = props.onChange) == null ? void 0 : _a.call(props, name, parseFloat(value2));
2825
2879
  };
2826
2880
  const onFocus = (name, value2) => {
2827
2881
  var _a;
@@ -2853,6 +2907,35 @@ function GoAInputNumber({
2853
2907
  function GoAInputRange(props) {
2854
2908
  return /* @__PURE__ */ jsxRuntime.jsx(GoAInput, { ...props, type: "range" });
2855
2909
  }
2910
+ function GoALink(props) {
2911
+ return /* @__PURE__ */ jsxRuntime.jsx(
2912
+ "goa-link",
2913
+ {
2914
+ leadingicon: props.leadingIcon,
2915
+ trailingicon: props.trailingIcon,
2916
+ mt: props.mt,
2917
+ mb: props.mb,
2918
+ ml: props.ml,
2919
+ mr: props.mr,
2920
+ children: props.children
2921
+ }
2922
+ );
2923
+ }
2924
+ function GoALinkButton({ type = "primary", ...props }) {
2925
+ return /* @__PURE__ */ jsxRuntime.jsx(
2926
+ "goa-link-button",
2927
+ {
2928
+ type,
2929
+ leadingicon: props.leadingIcon,
2930
+ trailingicon: props.trailingIcon,
2931
+ mt: props.mt,
2932
+ mb: props.mb,
2933
+ ml: props.ml,
2934
+ mr: props.mr,
2935
+ children: props.children
2936
+ }
2937
+ );
2938
+ }
2856
2939
  function GoAMicrositeHeader({
2857
2940
  type,
2858
2941
  version,
@@ -3310,6 +3393,21 @@ function GoATab({ heading, children }) {
3310
3393
  children
3311
3394
  ] });
3312
3395
  }
3396
+ function GoAText(props) {
3397
+ return /* @__PURE__ */ jsxRuntime.jsx(
3398
+ "goa-text",
3399
+ {
3400
+ as: props.as || "div",
3401
+ size: props.size,
3402
+ maxwidth: props.maxWidth || "65ch",
3403
+ mt: props.mt,
3404
+ mb: props.mb,
3405
+ ml: props.ml,
3406
+ mr: props.mr,
3407
+ children: props.children
3408
+ }
3409
+ );
3410
+ }
3313
3411
  function GoATextarea({
3314
3412
  name,
3315
3413
  value,
@@ -3338,7 +3436,7 @@ function GoATextarea({
3338
3436
  const current = el.current;
3339
3437
  const listener = (e) => {
3340
3438
  const { name: name2, value: value2 } = e.detail;
3341
- onChange(name2, value2);
3439
+ onChange == null ? void 0 : onChange(name2, value2);
3342
3440
  };
3343
3441
  current.addEventListener("_change", listener);
3344
3442
  return () => {
@@ -3454,6 +3552,7 @@ exports.GoADropdown = GoADropdown;
3454
3552
  exports.GoADropdownItem = GoADropdownItem;
3455
3553
  exports.GoADropdownOption = GoADropdownOption;
3456
3554
  exports.GoAEmergencyBadge = GoAEmergencyBadge;
3555
+ exports.GoAFieldset = GoAFieldset;
3457
3556
  exports.GoAFileUploadCard = GoAFileUploadCard;
3458
3557
  exports.GoAFileUploadInput = GoAFileUploadInput;
3459
3558
  exports.GoAFormItem = GoAFormItem;
@@ -3480,6 +3579,8 @@ exports.GoAInputTel = GoAInputTel;
3480
3579
  exports.GoAInputText = GoAInputText;
3481
3580
  exports.GoAInputTime = GoAInputTime;
3482
3581
  exports.GoAInputUrl = GoAInputUrl;
3582
+ exports.GoALink = GoALink;
3583
+ exports.GoALinkButton = GoALinkButton;
3483
3584
  exports.GoAMicrositeHeader = GoAMicrositeHeader;
3484
3585
  exports.GoAModal = GoAModal;
3485
3586
  exports.GoANotification = GoANotification;
@@ -3501,6 +3602,7 @@ exports.GoATab = GoATab;
3501
3602
  exports.GoATable = GoATable;
3502
3603
  exports.GoATableSortHeader = GoATableSortHeader;
3503
3604
  exports.GoATabs = GoATabs;
3605
+ exports.GoAText = GoAText;
3504
3606
  exports.GoATextArea = GoATextarea;
3505
3607
  exports.GoATextarea = GoATextarea;
3506
3608
  exports.GoAThreeColumnLayout = GoAThreeColumnLayout;