@abgov/react-components 6.8.0-alpha.1 → 6.8.0-alpha.3
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 +2 -0
- package/index.js +32 -3
- package/index.js.map +1 -1
- package/index.mjs +32 -3
- package/index.mjs.map +1 -1
- package/lib/dropdown/dropdown-item.d.ts +2 -2
- package/lib/dropdown/dropdown.d.ts +1 -1
- package/lib/menu-button/menu-action.d.ts +23 -0
- package/lib/menu-button/menu-button.d.ts +71 -0
- package/lib/radio-group/radio-group.d.ts +2 -2
- package/lib/radio-group/radio.d.ts +2 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -743,9 +743,6 @@ function stringify(value) {
|
|
|
743
743
|
if (typeof value === "string") {
|
|
744
744
|
return value;
|
|
745
745
|
}
|
|
746
|
-
if (typeof value === "number") {
|
|
747
|
-
return "" + value;
|
|
748
|
-
}
|
|
749
746
|
return JSON.stringify(value);
|
|
750
747
|
}
|
|
751
748
|
function GoabDropdown(props) {
|
|
@@ -3293,6 +3290,36 @@ function GoALinkButton({ type = "primary", ...props }) {
|
|
|
3293
3290
|
}
|
|
3294
3291
|
);
|
|
3295
3292
|
}
|
|
3293
|
+
function GoabMenuButton({
|
|
3294
|
+
text,
|
|
3295
|
+
type = "primary",
|
|
3296
|
+
testId,
|
|
3297
|
+
onAction,
|
|
3298
|
+
children
|
|
3299
|
+
}) {
|
|
3300
|
+
const el = useRef(null);
|
|
3301
|
+
useEffect(() => {
|
|
3302
|
+
if (!el.current) {
|
|
3303
|
+
return;
|
|
3304
|
+
}
|
|
3305
|
+
if (!onAction) {
|
|
3306
|
+
return;
|
|
3307
|
+
}
|
|
3308
|
+
const current = el.current;
|
|
3309
|
+
const listener = (e) => {
|
|
3310
|
+
const detail = e.detail;
|
|
3311
|
+
onAction(detail.action);
|
|
3312
|
+
};
|
|
3313
|
+
current.addEventListener("_action", listener);
|
|
3314
|
+
return () => {
|
|
3315
|
+
current.removeEventListener("_action", listener);
|
|
3316
|
+
};
|
|
3317
|
+
}, [el, onAction]);
|
|
3318
|
+
return /* @__PURE__ */ jsx("goa-menu-button", { ref: el, text, type, testid: testId, children });
|
|
3319
|
+
}
|
|
3320
|
+
function GoabMenuAction({ text, icon, action, testId }) {
|
|
3321
|
+
return /* @__PURE__ */ jsx("goa-menu-action", { text, action, icon, testid: testId });
|
|
3322
|
+
}
|
|
3296
3323
|
function GoabMicrositeHeader({
|
|
3297
3324
|
type,
|
|
3298
3325
|
version,
|
|
@@ -4402,6 +4429,8 @@ export {
|
|
|
4402
4429
|
GoabInputTime,
|
|
4403
4430
|
GoabInputUrl,
|
|
4404
4431
|
GoabLink,
|
|
4432
|
+
GoabMenuAction,
|
|
4433
|
+
GoabMenuButton,
|
|
4405
4434
|
GoabMicrositeHeader,
|
|
4406
4435
|
GoabModal,
|
|
4407
4436
|
GoabNotification,
|