@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.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ export * from './lib/icon/icon';
|
|
|
42
42
|
export * from './lib/input/input';
|
|
43
43
|
export * from './lib/link/link';
|
|
44
44
|
export * from './lib/link-button/link-button';
|
|
45
|
+
export * from './lib/menu-button/menu-button';
|
|
46
|
+
export * from './lib/menu-button/menu-action';
|
|
45
47
|
export * from './lib/microsite-header/microsite-header';
|
|
46
48
|
export * from './lib/modal/modal';
|
|
47
49
|
export * from './lib/notification/notification';
|
package/index.js
CHANGED
|
@@ -745,9 +745,6 @@ function stringify(value) {
|
|
|
745
745
|
if (typeof value === "string") {
|
|
746
746
|
return value;
|
|
747
747
|
}
|
|
748
|
-
if (typeof value === "number") {
|
|
749
|
-
return "" + value;
|
|
750
|
-
}
|
|
751
748
|
return JSON.stringify(value);
|
|
752
749
|
}
|
|
753
750
|
function GoabDropdown(props) {
|
|
@@ -3295,6 +3292,36 @@ function GoALinkButton({ type = "primary", ...props }) {
|
|
|
3295
3292
|
}
|
|
3296
3293
|
);
|
|
3297
3294
|
}
|
|
3295
|
+
function GoabMenuButton({
|
|
3296
|
+
text,
|
|
3297
|
+
type = "primary",
|
|
3298
|
+
testId,
|
|
3299
|
+
onAction,
|
|
3300
|
+
children
|
|
3301
|
+
}) {
|
|
3302
|
+
const el = react.useRef(null);
|
|
3303
|
+
react.useEffect(() => {
|
|
3304
|
+
if (!el.current) {
|
|
3305
|
+
return;
|
|
3306
|
+
}
|
|
3307
|
+
if (!onAction) {
|
|
3308
|
+
return;
|
|
3309
|
+
}
|
|
3310
|
+
const current = el.current;
|
|
3311
|
+
const listener = (e) => {
|
|
3312
|
+
const detail = e.detail;
|
|
3313
|
+
onAction(detail.action);
|
|
3314
|
+
};
|
|
3315
|
+
current.addEventListener("_action", listener);
|
|
3316
|
+
return () => {
|
|
3317
|
+
current.removeEventListener("_action", listener);
|
|
3318
|
+
};
|
|
3319
|
+
}, [el, onAction]);
|
|
3320
|
+
return /* @__PURE__ */ jsxRuntime.jsx("goa-menu-button", { ref: el, text, type, testid: testId, children });
|
|
3321
|
+
}
|
|
3322
|
+
function GoabMenuAction({ text, icon: icon2, action, testId }) {
|
|
3323
|
+
return /* @__PURE__ */ jsxRuntime.jsx("goa-menu-action", { text, action, icon: icon2, testid: testId });
|
|
3324
|
+
}
|
|
3298
3325
|
function GoabMicrositeHeader({
|
|
3299
3326
|
type,
|
|
3300
3327
|
version,
|
|
@@ -4403,6 +4430,8 @@ exports.GoabInputText = GoabInputText;
|
|
|
4403
4430
|
exports.GoabInputTime = GoabInputTime;
|
|
4404
4431
|
exports.GoabInputUrl = GoabInputUrl;
|
|
4405
4432
|
exports.GoabLink = GoabLink;
|
|
4433
|
+
exports.GoabMenuAction = GoabMenuAction;
|
|
4434
|
+
exports.GoabMenuButton = GoabMenuButton;
|
|
4406
4435
|
exports.GoabMicrositeHeader = GoabMicrositeHeader;
|
|
4407
4436
|
exports.GoabModal = GoabModal;
|
|
4408
4437
|
exports.GoabNotification = GoabNotification;
|