@abgov/react-components 6.11.0-dev.1 → 6.11.0-dev.10

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.
@@ -0,0 +1,33 @@
1
+ import { GoabCheckboxListOnChangeDetail, Margins } from '@abgov/ui-components-common';
2
+ import { JSX } from 'react';
3
+ interface WCProps extends Margins {
4
+ ref: React.RefObject<HTMLElement | null>;
5
+ name: string;
6
+ value?: string[];
7
+ disabled?: string;
8
+ error?: string;
9
+ testid?: string;
10
+ maxwidth?: string;
11
+ version?: string;
12
+ size?: string;
13
+ }
14
+ declare module "react" {
15
+ namespace JSX {
16
+ interface IntrinsicElements {
17
+ "goa-checkbox-list": WCProps & React.HTMLAttributes<HTMLElement>;
18
+ }
19
+ }
20
+ }
21
+ export interface GoabxCheckboxListProps extends Margins {
22
+ name: string;
23
+ value?: string[];
24
+ disabled?: boolean;
25
+ error?: boolean;
26
+ testId?: string;
27
+ maxWidth?: string;
28
+ size?: "default" | "compact";
29
+ children?: React.ReactNode;
30
+ onChange?: (detail: GoabCheckboxListOnChangeDetail) => void;
31
+ }
32
+ export declare function GoabxCheckboxList({ name, value, disabled, error, testId, maxWidth, size, children, onChange, mt, mr, mb, ml, }: GoabxCheckboxListProps): JSX.Element;
33
+ export default GoabxCheckboxList;
@@ -3,6 +3,7 @@ export * from './button/button';
3
3
  export * from './calendar/calendar';
4
4
  export * from './callout/callout';
5
5
  export * from './checkbox/checkbox';
6
+ export * from './checkbox-list/checkbox-list';
6
7
  export * from './date-picker/date-picker';
7
8
  export * from './drawer/drawer';
8
9
  export * from './dropdown/dropdown';
@@ -16,6 +17,8 @@ export * from './footer-meta-section/footer-meta-section';
16
17
  export * from './footer-nav-section/footer-nav-section';
17
18
  export * from './input/input';
18
19
  export * from './link/link';
20
+ export * from './menu-action/menu-action';
21
+ export * from './menu-button/menu-button';
19
22
  export * from './modal/modal';
20
23
  export * from './notification/notification';
21
24
  export * from './pagination/pagination';
@@ -25,6 +28,7 @@ export * from './side-menu-group/side-menu-group';
25
28
  export * from './side-menu-heading/side-menu-heading';
26
29
  export * from './table/table';
27
30
  export * from './table/table-sort-header';
31
+ export * from './tab/tab';
28
32
  export * from './tabs/tabs';
29
33
  export * from './textarea/textarea';
30
34
  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;
@@ -4,6 +4,7 @@ interface WCProps {
4
4
  heading: string;
5
5
  icon: GoabIconType;
6
6
  testid?: string;
7
+ open?: boolean;
7
8
  }
8
9
  declare module "react" {
9
10
  namespace JSX {
@@ -15,6 +16,7 @@ declare module "react" {
15
16
  export interface GoabWorkSideMenuGroupProps {
16
17
  heading: string;
17
18
  icon: GoabIconType;
19
+ open?: boolean;
18
20
  testId?: string;
19
21
  children?: React.ReactNode;
20
22
  }
package/experimental.js CHANGED
@@ -176,6 +176,54 @@ function GoabxCheckbox({
176
176
  }
177
177
  );
178
178
  }
179
+ function GoabxCheckboxList({
180
+ name,
181
+ value = [],
182
+ disabled,
183
+ error,
184
+ testId,
185
+ maxWidth,
186
+ size = "default",
187
+ children,
188
+ onChange,
189
+ mt,
190
+ mr,
191
+ mb,
192
+ ml
193
+ }) {
194
+ const el = react.useRef(null);
195
+ react.useEffect(() => {
196
+ if (!el.current) return;
197
+ const current = el.current;
198
+ const listener = (e) => {
199
+ const detail = e.detail;
200
+ onChange == null ? void 0 : onChange({ ...detail, event: e });
201
+ };
202
+ current.addEventListener("_change", listener);
203
+ return () => {
204
+ current.removeEventListener("_change", listener);
205
+ };
206
+ }, [onChange]);
207
+ return /* @__PURE__ */ jsxRuntime.jsx(
208
+ "goa-checkbox-list",
209
+ {
210
+ ref: el,
211
+ name,
212
+ value,
213
+ disabled: disabled ? "true" : void 0,
214
+ error: error ? "true" : void 0,
215
+ testid: testId,
216
+ maxwidth: maxWidth,
217
+ version: "2",
218
+ size,
219
+ mt,
220
+ mr,
221
+ mb,
222
+ ml,
223
+ children
224
+ }
225
+ );
226
+ }
179
227
  function GoabxDatePicker({
180
228
  value,
181
229
  error,
@@ -746,6 +794,44 @@ function GoabxLink({
746
794
  }
747
795
  );
748
796
  }
797
+ function GoabxMenuAction(props) {
798
+ const _props = parseISO.transformProps(props, parseISO.lowercase);
799
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-menu-action", { ..._props });
800
+ }
801
+ function GoabxMenuButton({
802
+ type = "primary",
803
+ testId,
804
+ onAction,
805
+ children,
806
+ ...rest
807
+ }) {
808
+ const el = react.useRef(null);
809
+ const _props = parseISO.transformProps(
810
+ { type, testid: testId, ...rest },
811
+ parseISO.kebab
812
+ );
813
+ react.useEffect(() => {
814
+ if (!el.current) {
815
+ return;
816
+ }
817
+ if (!onAction) {
818
+ return;
819
+ }
820
+ const current = el.current;
821
+ const listener = (e) => {
822
+ const detail = e.detail;
823
+ onAction == null ? void 0 : onAction(detail);
824
+ };
825
+ current.addEventListener("_action", listener);
826
+ return () => {
827
+ current.removeEventListener("_action", listener);
828
+ };
829
+ }, [el, onAction]);
830
+ return (
831
+ // @ts-expect-error - stable WCProps requires text, but experimental supports icon-only mode
832
+ /* @__PURE__ */ jsxRuntime.jsx("goa-menu-button", { ..._props, version: "2", ref: el, children })
833
+ );
834
+ }
749
835
  function GoabxModal({
750
836
  heading,
751
837
  children,
@@ -1042,13 +1128,27 @@ function GoabxTableSortHeader({
1042
1128
  const _props = parseISO.transformProps(rest, parseISO.lowercase);
1043
1129
  return /* @__PURE__ */ jsxRuntime.jsx("goa-table-sort-header", { ..._props, children });
1044
1130
  }
1131
+ function GoabxTab({ heading, disabled, slug, children }) {
1132
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1133
+ "goa-tab",
1134
+ {
1135
+ slug,
1136
+ disabled: disabled ? "true" : void 0,
1137
+ heading: typeof heading === "string" ? heading : void 0,
1138
+ children: [
1139
+ typeof heading !== "string" && /* @__PURE__ */ jsxRuntime.jsx("span", { slot: "heading", children: heading }),
1140
+ children
1141
+ ]
1142
+ }
1143
+ );
1144
+ }
1045
1145
  function GoabxTabs({
1046
1146
  initialTab,
1047
1147
  children,
1048
1148
  testId,
1049
1149
  onChange,
1050
1150
  variant,
1051
- version = "2"
1151
+ orientation
1052
1152
  }) {
1053
1153
  const ref = react.useRef(null);
1054
1154
  react.useEffect(() => {
@@ -1071,7 +1171,8 @@ function GoabxTabs({
1071
1171
  initialtab: initialTab,
1072
1172
  testid: testId,
1073
1173
  variant,
1074
- version,
1174
+ version: "2",
1175
+ orientation,
1075
1176
  children
1076
1177
  }
1077
1178
  );
@@ -1190,6 +1291,7 @@ function GoabxWorkSideMenuGroup(props) {
1190
1291
  {
1191
1292
  heading: props.heading,
1192
1293
  icon: props.icon,
1294
+ open: props.open ? true : void 0,
1193
1295
  testid: props.testId,
1194
1296
  children: props.children
1195
1297
  }
@@ -1203,6 +1305,7 @@ exports.GoabxButton = GoabxButton;
1203
1305
  exports.GoabxCalendar = GoabxCalendar;
1204
1306
  exports.GoabxCallout = GoabxCallout;
1205
1307
  exports.GoabxCheckbox = GoabxCheckbox;
1308
+ exports.GoabxCheckboxList = GoabxCheckboxList;
1206
1309
  exports.GoabxDatePicker = GoabxDatePicker;
1207
1310
  exports.GoabxDrawer = GoabxDrawer;
1208
1311
  exports.GoabxDropdown = GoabxDropdown;
@@ -1227,6 +1330,8 @@ exports.GoabxInputText = GoabxInputText;
1227
1330
  exports.GoabxInputTime = GoabxInputTime;
1228
1331
  exports.GoabxInputUrl = GoabxInputUrl;
1229
1332
  exports.GoabxLink = GoabxLink;
1333
+ exports.GoabxMenuAction = GoabxMenuAction;
1334
+ exports.GoabxMenuButton = GoabxMenuButton;
1230
1335
  exports.GoabxModal = GoabxModal;
1231
1336
  exports.GoabxNotification = GoabxNotification;
1232
1337
  exports.GoabxPagination = GoabxPagination;
@@ -1235,6 +1340,7 @@ exports.GoabxRadioItem = GoabxRadioItem;
1235
1340
  exports.GoabxSideMenu = GoabxSideMenu;
1236
1341
  exports.GoabxSideMenuGroup = GoabxSideMenuGroup;
1237
1342
  exports.GoabxSideMenuHeading = GoabxSideMenuHeading;
1343
+ exports.GoabxTab = GoabxTab;
1238
1344
  exports.GoabxTable = GoabxTable;
1239
1345
  exports.GoabxTableSortHeader = GoabxTableSortHeader;
1240
1346
  exports.GoabxTabs = GoabxTabs;