@abgov/react-components 6.11.0-dev.4 → 6.11.0-dev.6

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.
@@ -16,6 +16,8 @@ export * from './footer-meta-section/footer-meta-section';
16
16
  export * from './footer-nav-section/footer-nav-section';
17
17
  export * from './input/input';
18
18
  export * from './link/link';
19
+ export * from './menu-action/menu-action';
20
+ export * from './menu-button/menu-button';
19
21
  export * from './modal/modal';
20
22
  export * from './notification/notification';
21
23
  export * from './pagination/pagination';
@@ -25,6 +27,7 @@ export * from './side-menu-group/side-menu-group';
25
27
  export * from './side-menu-heading/side-menu-heading';
26
28
  export * from './table/table';
27
29
  export * from './table/table-sort-header';
30
+ export * from './tab/tab';
28
31
  export * from './tabs/tabs';
29
32
  export * from './textarea/textarea';
30
33
  export * from './work-side-menu/work-side-menu';
@@ -0,0 +1,10 @@
1
+ import { DataAttributes, GoabIconType } from '@abgov/ui-components-common';
2
+ import { JSX } from 'react';
3
+ export interface GoabxMenuActionProps extends DataAttributes {
4
+ text: string;
5
+ action: string;
6
+ icon?: GoabIconType;
7
+ testId?: string;
8
+ }
9
+ export declare function GoabxMenuAction(props: GoabxMenuActionProps): JSX.Element;
10
+ export default GoabxMenuAction;
@@ -0,0 +1,16 @@
1
+ import { DataAttributes, GoabButtonSize, GoabButtonType, GoabButtonVariant, GoabIconType, GoabMenuButtonOnActionDetail } from '@abgov/ui-components-common';
2
+ import { ReactNode, JSX } from 'react';
3
+ export interface GoabxMenuButtonProps extends DataAttributes {
4
+ text?: string;
5
+ type?: GoabButtonType;
6
+ size?: GoabButtonSize;
7
+ variant?: GoabButtonVariant;
8
+ maxWidth?: string;
9
+ leadingIcon?: GoabIconType;
10
+ ariaLabel?: string;
11
+ testId?: string;
12
+ onAction?: (detail: GoabMenuButtonOnActionDetail) => void;
13
+ children?: ReactNode;
14
+ }
15
+ export declare function GoabxMenuButton({ type, testId, onAction, children, ...rest }: GoabxMenuButtonProps): JSX.Element;
16
+ export default GoabxMenuButton;
@@ -0,0 +1,21 @@
1
+ import { JSX } from 'react';
2
+ interface WCProps {
3
+ heading?: React.ReactNode;
4
+ disabled?: string;
5
+ slug?: string;
6
+ }
7
+ declare module "react" {
8
+ namespace JSX {
9
+ interface IntrinsicElements {
10
+ "goa-tab": WCProps & React.HTMLAttributes<HTMLElement>;
11
+ }
12
+ }
13
+ }
14
+ export interface GoabxTabItemProps {
15
+ heading?: React.ReactNode;
16
+ disabled?: boolean;
17
+ children?: React.ReactNode;
18
+ slug?: string;
19
+ }
20
+ export declare function GoabxTab({ heading, disabled, slug, children }: GoabxTabItemProps): JSX.Element;
21
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { default as React, JSX } from 'react';
2
- import { GoabTabsOnChangeDetail, GoabTabsVariant } from '@abgov/ui-components-common';
2
+ import { GoabTabsOnChangeDetail, GoabTabsOrientation, GoabTabsVariant } from '@abgov/ui-components-common';
3
3
  interface WCProps {
4
4
  initialtab?: number;
5
5
  ref: React.RefObject<HTMLElement | null>;
@@ -7,6 +7,7 @@ interface WCProps {
7
7
  testid?: string;
8
8
  variant?: GoabTabsVariant;
9
9
  version?: string;
10
+ orientation?: string;
10
11
  }
11
12
  declare module "react" {
12
13
  namespace JSX {
@@ -20,8 +21,9 @@ export interface GoabxTabsProps {
20
21
  children?: React.ReactNode;
21
22
  testId?: string;
22
23
  variant?: GoabTabsVariant;
24
+ /** Tab layout orientation. "auto" stacks vertically on mobile (default), "horizontal" keeps horizontal on all screen sizes. */
25
+ orientation?: GoabTabsOrientation;
23
26
  onChange?: (detail: GoabTabsOnChangeDetail) => void;
24
- version?: string;
25
27
  }
26
- export declare function GoabxTabs({ initialTab, children, testId, onChange, variant, version, }: GoabxTabsProps): JSX.Element;
28
+ export declare function GoabxTabs({ initialTab, children, testId, onChange, variant, orientation, }: GoabxTabsProps): JSX.Element;
27
29
  export default GoabxTabs;
package/experimental.js CHANGED
@@ -746,6 +746,44 @@ function GoabxLink({
746
746
  }
747
747
  );
748
748
  }
749
+ function GoabxMenuAction(props) {
750
+ const _props = parseISO.transformProps(props, parseISO.lowercase);
751
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-menu-action", { ..._props });
752
+ }
753
+ function GoabxMenuButton({
754
+ type = "primary",
755
+ testId,
756
+ onAction,
757
+ children,
758
+ ...rest
759
+ }) {
760
+ const el = react.useRef(null);
761
+ const _props = parseISO.transformProps(
762
+ { type, testid: testId, ...rest },
763
+ parseISO.kebab
764
+ );
765
+ react.useEffect(() => {
766
+ if (!el.current) {
767
+ return;
768
+ }
769
+ if (!onAction) {
770
+ return;
771
+ }
772
+ const current = el.current;
773
+ const listener = (e) => {
774
+ const detail = e.detail;
775
+ onAction == null ? void 0 : onAction(detail);
776
+ };
777
+ current.addEventListener("_action", listener);
778
+ return () => {
779
+ current.removeEventListener("_action", listener);
780
+ };
781
+ }, [el, onAction]);
782
+ return (
783
+ // @ts-expect-error - stable WCProps requires text, but experimental supports icon-only mode
784
+ /* @__PURE__ */ jsxRuntime.jsx("goa-menu-button", { ..._props, version: "2", ref: el, children })
785
+ );
786
+ }
749
787
  function GoabxModal({
750
788
  heading,
751
789
  children,
@@ -1042,13 +1080,27 @@ function GoabxTableSortHeader({
1042
1080
  const _props = parseISO.transformProps(rest, parseISO.lowercase);
1043
1081
  return /* @__PURE__ */ jsxRuntime.jsx("goa-table-sort-header", { ..._props, children });
1044
1082
  }
1083
+ function GoabxTab({ heading, disabled, slug, children }) {
1084
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1085
+ "goa-tab",
1086
+ {
1087
+ slug,
1088
+ disabled: disabled ? "true" : void 0,
1089
+ heading: typeof heading === "string" ? heading : void 0,
1090
+ children: [
1091
+ typeof heading !== "string" && /* @__PURE__ */ jsxRuntime.jsx("span", { slot: "heading", children: heading }),
1092
+ children
1093
+ ]
1094
+ }
1095
+ );
1096
+ }
1045
1097
  function GoabxTabs({
1046
1098
  initialTab,
1047
1099
  children,
1048
1100
  testId,
1049
1101
  onChange,
1050
1102
  variant,
1051
- version = "2"
1103
+ orientation
1052
1104
  }) {
1053
1105
  const ref = react.useRef(null);
1054
1106
  react.useEffect(() => {
@@ -1071,7 +1123,8 @@ function GoabxTabs({
1071
1123
  initialtab: initialTab,
1072
1124
  testid: testId,
1073
1125
  variant,
1074
- version,
1126
+ version: "2",
1127
+ orientation,
1075
1128
  children
1076
1129
  }
1077
1130
  );
@@ -1227,6 +1280,8 @@ exports.GoabxInputText = GoabxInputText;
1227
1280
  exports.GoabxInputTime = GoabxInputTime;
1228
1281
  exports.GoabxInputUrl = GoabxInputUrl;
1229
1282
  exports.GoabxLink = GoabxLink;
1283
+ exports.GoabxMenuAction = GoabxMenuAction;
1284
+ exports.GoabxMenuButton = GoabxMenuButton;
1230
1285
  exports.GoabxModal = GoabxModal;
1231
1286
  exports.GoabxNotification = GoabxNotification;
1232
1287
  exports.GoabxPagination = GoabxPagination;
@@ -1235,6 +1290,7 @@ exports.GoabxRadioItem = GoabxRadioItem;
1235
1290
  exports.GoabxSideMenu = GoabxSideMenu;
1236
1291
  exports.GoabxSideMenuGroup = GoabxSideMenuGroup;
1237
1292
  exports.GoabxSideMenuHeading = GoabxSideMenuHeading;
1293
+ exports.GoabxTab = GoabxTab;
1238
1294
  exports.GoabxTable = GoabxTable;
1239
1295
  exports.GoabxTableSortHeader = GoabxTableSortHeader;
1240
1296
  exports.GoabxTabs = GoabxTabs;