@abgov/react-components 5.0.0-alpha.7 → 5.0.0-alpha.9
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 +4 -0
- package/index.js +109 -7
- package/index.js.map +1 -1
- package/index.mjs +109 -7
- package/index.mjs.map +1 -1
- package/lib/checkbox/checkbox.d.ts +1 -1
- package/lib/date-picker/date-picker.d.ts +1 -1
- package/lib/dropdown/dropdown.d.ts +1 -1
- package/lib/fieldset/fieldset.d.ts +29 -0
- package/lib/input/input.d.ts +3 -3
- package/lib/link/link.d.ts +21 -0
- package/lib/link-button/link-button.d.ts +24 -0
- package/lib/radio-group/radio-group.d.ts +1 -1
- package/lib/text/text.d.ts +28 -0
- package/lib/textarea/textarea.d.ts +1 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -392,7 +392,7 @@ function GoACheckbox({
|
|
|
392
392
|
id,
|
|
393
393
|
name,
|
|
394
394
|
error,
|
|
395
|
-
checked,
|
|
395
|
+
checked: checked || false,
|
|
396
396
|
disabled,
|
|
397
397
|
text,
|
|
398
398
|
value,
|
|
@@ -536,7 +536,7 @@ function GoADatePicker({
|
|
|
536
536
|
const current = ref.current;
|
|
537
537
|
const handleChange = (e) => {
|
|
538
538
|
const newValue = e.detail.value;
|
|
539
|
-
onChange(name || "", newValue ? new Date(newValue) : void 0);
|
|
539
|
+
onChange == null ? void 0 : onChange(name || "", newValue ? new Date(newValue) : void 0);
|
|
540
540
|
};
|
|
541
541
|
current.addEventListener("_change", handleChange);
|
|
542
542
|
return () => {
|
|
@@ -607,8 +607,9 @@ function GoADropdown(props) {
|
|
|
607
607
|
}
|
|
608
608
|
const current = el.current;
|
|
609
609
|
const handler = (e) => {
|
|
610
|
+
var _a;
|
|
610
611
|
const { name, value, values } = e.detail;
|
|
611
|
-
props.onChange(name, props.multiselect ? values : value);
|
|
612
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, name, props.multiselect ? values : value);
|
|
612
613
|
};
|
|
613
614
|
current.addEventListener("_change", handler);
|
|
614
615
|
return () => {
|
|
@@ -662,6 +663,53 @@ function GoADropdownItem({ value, label, filter, name, testId, mountType = "appe
|
|
|
662
663
|
}
|
|
663
664
|
);
|
|
664
665
|
}
|
|
666
|
+
function GoAFieldset({
|
|
667
|
+
heading,
|
|
668
|
+
buttonText,
|
|
669
|
+
id,
|
|
670
|
+
onContinue,
|
|
671
|
+
children,
|
|
672
|
+
mt,
|
|
673
|
+
mr,
|
|
674
|
+
mb,
|
|
675
|
+
ml,
|
|
676
|
+
first,
|
|
677
|
+
last
|
|
678
|
+
}) {
|
|
679
|
+
const ref = useRef(null);
|
|
680
|
+
useEffect(() => {
|
|
681
|
+
var _a;
|
|
682
|
+
const _continue = (e) => {
|
|
683
|
+
const { el, state } = e.detail;
|
|
684
|
+
return onContinue == null ? void 0 : onContinue(el, state);
|
|
685
|
+
};
|
|
686
|
+
if (onContinue) {
|
|
687
|
+
(_a = ref.current) == null ? void 0 : _a.addEventListener("_continue", _continue);
|
|
688
|
+
}
|
|
689
|
+
return () => {
|
|
690
|
+
var _a2;
|
|
691
|
+
if (onContinue) {
|
|
692
|
+
(_a2 = ref.current) == null ? void 0 : _a2.removeEventListener("_continue", _continue);
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
}, [ref.current, onContinue]);
|
|
696
|
+
return /* @__PURE__ */ jsx(
|
|
697
|
+
"goa-fieldset",
|
|
698
|
+
{
|
|
699
|
+
ref,
|
|
700
|
+
id,
|
|
701
|
+
first,
|
|
702
|
+
last,
|
|
703
|
+
heading,
|
|
704
|
+
buttontext: buttonText,
|
|
705
|
+
mt,
|
|
706
|
+
mr,
|
|
707
|
+
mb,
|
|
708
|
+
ml,
|
|
709
|
+
children
|
|
710
|
+
}
|
|
711
|
+
);
|
|
712
|
+
}
|
|
665
713
|
function GoAFileUploadCard({
|
|
666
714
|
filename,
|
|
667
715
|
size,
|
|
@@ -2628,7 +2676,7 @@ function GoAInput({
|
|
|
2628
2676
|
const current = ref.current;
|
|
2629
2677
|
const changeListener = (e) => {
|
|
2630
2678
|
const { name: name2, value: value2 } = e.detail;
|
|
2631
|
-
onChange(name2, value2);
|
|
2679
|
+
onChange == null ? void 0 : onChange(name2, value2);
|
|
2632
2680
|
};
|
|
2633
2681
|
const clickListener = () => {
|
|
2634
2682
|
onTrailingIconClick == null ? void 0 : onTrailingIconClick();
|
|
@@ -2699,6 +2747,7 @@ function GoAInput({
|
|
|
2699
2747
|
}
|
|
2700
2748
|
const onDateChangeHandler = (onChange) => {
|
|
2701
2749
|
return (name, value) => {
|
|
2750
|
+
if (!onChange) return;
|
|
2702
2751
|
if (!value) {
|
|
2703
2752
|
onChange(name, "");
|
|
2704
2753
|
return;
|
|
@@ -2710,6 +2759,7 @@ const onDateChangeHandler = (onChange) => {
|
|
|
2710
2759
|
};
|
|
2711
2760
|
const onTimeChangeHandler = (onChange) => {
|
|
2712
2761
|
return (name, value) => {
|
|
2762
|
+
if (!onChange) return;
|
|
2713
2763
|
if (!value) {
|
|
2714
2764
|
onChange(name, "");
|
|
2715
2765
|
return;
|
|
@@ -2804,7 +2854,10 @@ function GoAInputFile(props) {
|
|
|
2804
2854
|
id: props.id,
|
|
2805
2855
|
name: props.name,
|
|
2806
2856
|
type: "file",
|
|
2807
|
-
onChange: (e) =>
|
|
2857
|
+
onChange: (e) => {
|
|
2858
|
+
var _a;
|
|
2859
|
+
return (_a = props.onChange) == null ? void 0 : _a.call(props, e.target.name, e.target.value);
|
|
2860
|
+
},
|
|
2808
2861
|
style: { backgroundColor: "revert" }
|
|
2809
2862
|
}
|
|
2810
2863
|
);
|
|
@@ -2819,7 +2872,8 @@ function GoAInputNumber({
|
|
|
2819
2872
|
...props
|
|
2820
2873
|
}) {
|
|
2821
2874
|
const onNumberChange = (name, value2) => {
|
|
2822
|
-
|
|
2875
|
+
var _a;
|
|
2876
|
+
(_a = props.onChange) == null ? void 0 : _a.call(props, name, parseFloat(value2));
|
|
2823
2877
|
};
|
|
2824
2878
|
const onFocus = (name, value2) => {
|
|
2825
2879
|
var _a;
|
|
@@ -2851,6 +2905,35 @@ function GoAInputNumber({
|
|
|
2851
2905
|
function GoAInputRange(props) {
|
|
2852
2906
|
return /* @__PURE__ */ jsx(GoAInput, { ...props, type: "range" });
|
|
2853
2907
|
}
|
|
2908
|
+
function GoALink(props) {
|
|
2909
|
+
return /* @__PURE__ */ jsx(
|
|
2910
|
+
"goa-link",
|
|
2911
|
+
{
|
|
2912
|
+
leadingicon: props.leadingIcon,
|
|
2913
|
+
trailingicon: props.trailingIcon,
|
|
2914
|
+
mt: props.mt,
|
|
2915
|
+
mb: props.mb,
|
|
2916
|
+
ml: props.ml,
|
|
2917
|
+
mr: props.mr,
|
|
2918
|
+
children: props.children
|
|
2919
|
+
}
|
|
2920
|
+
);
|
|
2921
|
+
}
|
|
2922
|
+
function GoALinkButton({ type = "primary", ...props }) {
|
|
2923
|
+
return /* @__PURE__ */ jsx(
|
|
2924
|
+
"goa-link-button",
|
|
2925
|
+
{
|
|
2926
|
+
type,
|
|
2927
|
+
leadingicon: props.leadingIcon,
|
|
2928
|
+
trailingicon: props.trailingIcon,
|
|
2929
|
+
mt: props.mt,
|
|
2930
|
+
mb: props.mb,
|
|
2931
|
+
ml: props.ml,
|
|
2932
|
+
mr: props.mr,
|
|
2933
|
+
children: props.children
|
|
2934
|
+
}
|
|
2935
|
+
);
|
|
2936
|
+
}
|
|
2854
2937
|
function GoAMicrositeHeader({
|
|
2855
2938
|
type,
|
|
2856
2939
|
version,
|
|
@@ -3308,6 +3391,21 @@ function GoATab({ heading, children }) {
|
|
|
3308
3391
|
children
|
|
3309
3392
|
] });
|
|
3310
3393
|
}
|
|
3394
|
+
function GoAText(props) {
|
|
3395
|
+
return /* @__PURE__ */ jsx(
|
|
3396
|
+
"goa-text",
|
|
3397
|
+
{
|
|
3398
|
+
as: props.as || "div",
|
|
3399
|
+
size: props.size,
|
|
3400
|
+
maxwidth: props.maxWidth || "65ch",
|
|
3401
|
+
mt: props.mt,
|
|
3402
|
+
mb: props.mb,
|
|
3403
|
+
ml: props.ml,
|
|
3404
|
+
mr: props.mr,
|
|
3405
|
+
children: props.children
|
|
3406
|
+
}
|
|
3407
|
+
);
|
|
3408
|
+
}
|
|
3311
3409
|
function GoATextarea({
|
|
3312
3410
|
name,
|
|
3313
3411
|
value,
|
|
@@ -3336,7 +3434,7 @@ function GoATextarea({
|
|
|
3336
3434
|
const current = el.current;
|
|
3337
3435
|
const listener = (e) => {
|
|
3338
3436
|
const { name: name2, value: value2 } = e.detail;
|
|
3339
|
-
onChange(name2, value2);
|
|
3437
|
+
onChange == null ? void 0 : onChange(name2, value2);
|
|
3340
3438
|
};
|
|
3341
3439
|
current.addEventListener("_change", listener);
|
|
3342
3440
|
return () => {
|
|
@@ -3453,6 +3551,7 @@ export {
|
|
|
3453
3551
|
GoADropdownItem,
|
|
3454
3552
|
GoADropdownOption,
|
|
3455
3553
|
GoAEmergencyBadge,
|
|
3554
|
+
GoAFieldset,
|
|
3456
3555
|
GoAFileUploadCard,
|
|
3457
3556
|
GoAFileUploadInput,
|
|
3458
3557
|
GoAFormItem,
|
|
@@ -3479,6 +3578,8 @@ export {
|
|
|
3479
3578
|
GoAInputText,
|
|
3480
3579
|
GoAInputTime,
|
|
3481
3580
|
GoAInputUrl,
|
|
3581
|
+
GoALink,
|
|
3582
|
+
GoALinkButton,
|
|
3482
3583
|
GoAMicrositeHeader,
|
|
3483
3584
|
GoAModal,
|
|
3484
3585
|
GoANotification,
|
|
@@ -3500,6 +3601,7 @@ export {
|
|
|
3500
3601
|
GoATable,
|
|
3501
3602
|
GoATableSortHeader,
|
|
3502
3603
|
GoATabs,
|
|
3604
|
+
GoAText,
|
|
3503
3605
|
GoATextarea as GoATextArea,
|
|
3504
3606
|
GoATextarea,
|
|
3505
3607
|
GoAThreeColumnLayout,
|