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

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';
@@ -24,7 +27,8 @@ export * from './side-menu/side-menu';
24
27
  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
- export * from './table/table-sort-header';
30
+ export * from './table-sort-header/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,10 +1,11 @@
1
- import { GoabTableOnSortDetail, GoabTableVariant, Margins } from '@abgov/ui-components-common';
1
+ import { GoabTableOnSortDetail, GoabTableOnMultiSortDetail, GoabTableSortMode, GoabTableVariant, Margins } from '@abgov/ui-components-common';
2
2
  import { ReactNode } from 'react';
3
3
  interface WCProps extends Margins {
4
4
  ref?: React.RefObject<HTMLElement | null>;
5
5
  width?: string;
6
6
  stickyheader?: string;
7
7
  variant?: GoabTableVariant;
8
+ "sort-mode"?: GoabTableSortMode;
8
9
  testid?: string;
9
10
  striped?: string;
10
11
  version?: string;
@@ -19,6 +20,8 @@ declare module "react" {
19
20
  export interface GoabxTableProps extends Margins {
20
21
  width?: string;
21
22
  onSort?: (detail: GoabTableOnSortDetail) => void;
23
+ onMultiSort?: (detail: GoabTableOnMultiSortDetail) => void;
24
+ sortMode?: GoabTableSortMode;
22
25
  variant?: GoabTableVariant;
23
26
  striped?: boolean;
24
27
  testId?: string;
@@ -26,5 +29,5 @@ export interface GoabxTableProps extends Margins {
26
29
  children?: ReactNode;
27
30
  }
28
31
  export type TableProps = GoabxTableProps;
29
- export declare function GoabxTable({ onSort, version, ...props }: GoabxTableProps): import("react/jsx-runtime").JSX.Element;
32
+ export declare function GoabxTable({ onSort, onMultiSort, sortMode, version, ...props }: GoabxTableProps): import("react/jsx-runtime").JSX.Element;
30
33
  export default GoabxTable;
@@ -1,8 +1,9 @@
1
- import { DataAttributes, GoabTableSortDirection } from '@abgov/ui-components-common';
1
+ import { DataAttributes, GoabTableSortDirection, GoabTableSortOrder } from '@abgov/ui-components-common';
2
2
  import { JSX } from 'react';
3
3
  interface WCProps {
4
4
  name?: string;
5
5
  direction?: GoabTableSortDirection;
6
+ "sort-order"?: GoabTableSortOrder;
6
7
  }
7
8
  declare module "react" {
8
9
  namespace JSX {
@@ -14,7 +15,8 @@ declare module "react" {
14
15
  export interface GoabxTableSortProps extends DataAttributes {
15
16
  name?: string;
16
17
  direction?: GoabTableSortDirection;
18
+ sortOrder?: GoabTableSortOrder;
17
19
  children?: React.ReactNode;
18
20
  }
19
- export declare function GoabxTableSortHeader({ children, ...rest }: GoabxTableSortProps): JSX.Element;
21
+ export declare function GoabxTableSortHeader({ name, direction, sortOrder, children, ...rest }: GoabxTableSortProps): JSX.Element;
20
22
  export default GoabxTableSortHeader;
@@ -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,
@@ -1002,7 +1088,7 @@ function GoabxSideMenuHeading({
1002
1088
  meta && /* @__PURE__ */ jsxRuntime.jsx("span", { slot: "meta", children: meta })
1003
1089
  ] });
1004
1090
  }
1005
- function GoabxTable({ onSort, version = "2", ...props }) {
1091
+ function GoabxTable({ onSort, onMultiSort, sortMode, version = "2", ...props }) {
1006
1092
  const ref = react.useRef(null);
1007
1093
  react.useEffect(() => {
1008
1094
  if (!ref.current) {
@@ -1013,17 +1099,24 @@ function GoabxTable({ onSort, version = "2", ...props }) {
1013
1099
  const detail = e.detail;
1014
1100
  onSort == null ? void 0 : onSort(detail);
1015
1101
  };
1102
+ const multiSortListener = (e) => {
1103
+ const detail = e.detail;
1104
+ onMultiSort == null ? void 0 : onMultiSort(detail);
1105
+ };
1016
1106
  current.addEventListener("_sort", sortListener);
1107
+ current.addEventListener("_multisort", multiSortListener);
1017
1108
  return () => {
1018
1109
  current.removeEventListener("_sort", sortListener);
1110
+ current.removeEventListener("_multisort", multiSortListener);
1019
1111
  };
1020
- }, [ref, onSort]);
1112
+ }, [ref, onSort, onMultiSort]);
1021
1113
  return /* @__PURE__ */ jsxRuntime.jsx(
1022
1114
  "goa-table",
1023
1115
  {
1024
1116
  ref,
1025
1117
  width: props.width,
1026
1118
  variant: props.variant,
1119
+ "sort-mode": sortMode,
1027
1120
  striped: props.striped ? "true" : void 0,
1028
1121
  testid: props.testId,
1029
1122
  mt: props.mt,
@@ -1036,11 +1129,27 @@ function GoabxTable({ onSort, version = "2", ...props }) {
1036
1129
  );
1037
1130
  }
1038
1131
  function GoabxTableSortHeader({
1132
+ name,
1133
+ direction = "none",
1134
+ sortOrder,
1039
1135
  children,
1040
1136
  ...rest
1041
1137
  }) {
1042
- const _props = parseISO.transformProps(rest, parseISO.lowercase);
1043
- return /* @__PURE__ */ jsxRuntime.jsx("goa-table-sort-header", { ..._props, children });
1138
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-table-sort-header", { name, direction, "sort-order": sortOrder, ...rest, children });
1139
+ }
1140
+ function GoabxTab({ heading, disabled, slug, children }) {
1141
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1142
+ "goa-tab",
1143
+ {
1144
+ slug,
1145
+ disabled: disabled ? "true" : void 0,
1146
+ heading: typeof heading === "string" ? heading : void 0,
1147
+ children: [
1148
+ typeof heading !== "string" && /* @__PURE__ */ jsxRuntime.jsx("span", { slot: "heading", children: heading }),
1149
+ children
1150
+ ]
1151
+ }
1152
+ );
1044
1153
  }
1045
1154
  function GoabxTabs({
1046
1155
  initialTab,
@@ -1048,7 +1157,7 @@ function GoabxTabs({
1048
1157
  testId,
1049
1158
  onChange,
1050
1159
  variant,
1051
- version = "2"
1160
+ orientation
1052
1161
  }) {
1053
1162
  const ref = react.useRef(null);
1054
1163
  react.useEffect(() => {
@@ -1071,7 +1180,8 @@ function GoabxTabs({
1071
1180
  initialtab: initialTab,
1072
1181
  testid: testId,
1073
1182
  variant,
1074
- version,
1183
+ version: "2",
1184
+ orientation,
1075
1185
  children
1076
1186
  }
1077
1187
  );
@@ -1190,6 +1300,7 @@ function GoabxWorkSideMenuGroup(props) {
1190
1300
  {
1191
1301
  heading: props.heading,
1192
1302
  icon: props.icon,
1303
+ open: props.open ? true : void 0,
1193
1304
  testid: props.testId,
1194
1305
  children: props.children
1195
1306
  }
@@ -1203,6 +1314,7 @@ exports.GoabxButton = GoabxButton;
1203
1314
  exports.GoabxCalendar = GoabxCalendar;
1204
1315
  exports.GoabxCallout = GoabxCallout;
1205
1316
  exports.GoabxCheckbox = GoabxCheckbox;
1317
+ exports.GoabxCheckboxList = GoabxCheckboxList;
1206
1318
  exports.GoabxDatePicker = GoabxDatePicker;
1207
1319
  exports.GoabxDrawer = GoabxDrawer;
1208
1320
  exports.GoabxDropdown = GoabxDropdown;
@@ -1227,6 +1339,8 @@ exports.GoabxInputText = GoabxInputText;
1227
1339
  exports.GoabxInputTime = GoabxInputTime;
1228
1340
  exports.GoabxInputUrl = GoabxInputUrl;
1229
1341
  exports.GoabxLink = GoabxLink;
1342
+ exports.GoabxMenuAction = GoabxMenuAction;
1343
+ exports.GoabxMenuButton = GoabxMenuButton;
1230
1344
  exports.GoabxModal = GoabxModal;
1231
1345
  exports.GoabxNotification = GoabxNotification;
1232
1346
  exports.GoabxPagination = GoabxPagination;
@@ -1235,6 +1349,7 @@ exports.GoabxRadioItem = GoabxRadioItem;
1235
1349
  exports.GoabxSideMenu = GoabxSideMenu;
1236
1350
  exports.GoabxSideMenuGroup = GoabxSideMenuGroup;
1237
1351
  exports.GoabxSideMenuHeading = GoabxSideMenuHeading;
1352
+ exports.GoabxTab = GoabxTab;
1238
1353
  exports.GoabxTable = GoabxTable;
1239
1354
  exports.GoabxTableSortHeader = GoabxTableSortHeader;
1240
1355
  exports.GoabxTabs = GoabxTabs;