@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.
package/experimental.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { t as transformProps, l as lowercase, f as format, p as parseISO, i as isValid } from "./parseISO-BHUUf1QW.mjs";
2
+ import { t as transformProps, l as lowercase, f as format, p as parseISO, i as isValid, k as kebab } from "./parseISO-BHUUf1QW.mjs";
3
3
  import { useRef, useEffect } from "react";
4
4
  function getIconValue(icon, iconType) {
5
5
  if (icon !== void 0) {
@@ -174,6 +174,54 @@ function GoabxCheckbox({
174
174
  }
175
175
  );
176
176
  }
177
+ function GoabxCheckboxList({
178
+ name,
179
+ value = [],
180
+ disabled,
181
+ error,
182
+ testId,
183
+ maxWidth,
184
+ size = "default",
185
+ children,
186
+ onChange,
187
+ mt,
188
+ mr,
189
+ mb,
190
+ ml
191
+ }) {
192
+ const el = useRef(null);
193
+ useEffect(() => {
194
+ if (!el.current) return;
195
+ const current = el.current;
196
+ const listener = (e) => {
197
+ const detail = e.detail;
198
+ onChange == null ? void 0 : onChange({ ...detail, event: e });
199
+ };
200
+ current.addEventListener("_change", listener);
201
+ return () => {
202
+ current.removeEventListener("_change", listener);
203
+ };
204
+ }, [onChange]);
205
+ return /* @__PURE__ */ jsx(
206
+ "goa-checkbox-list",
207
+ {
208
+ ref: el,
209
+ name,
210
+ value,
211
+ disabled: disabled ? "true" : void 0,
212
+ error: error ? "true" : void 0,
213
+ testid: testId,
214
+ maxwidth: maxWidth,
215
+ version: "2",
216
+ size,
217
+ mt,
218
+ mr,
219
+ mb,
220
+ ml,
221
+ children
222
+ }
223
+ );
224
+ }
177
225
  function GoabxDatePicker({
178
226
  value,
179
227
  error,
@@ -744,6 +792,44 @@ function GoabxLink({
744
792
  }
745
793
  );
746
794
  }
795
+ function GoabxMenuAction(props) {
796
+ const _props = transformProps(props, lowercase);
797
+ return /* @__PURE__ */ jsx("goa-menu-action", { ..._props });
798
+ }
799
+ function GoabxMenuButton({
800
+ type = "primary",
801
+ testId,
802
+ onAction,
803
+ children,
804
+ ...rest
805
+ }) {
806
+ const el = useRef(null);
807
+ const _props = transformProps(
808
+ { type, testid: testId, ...rest },
809
+ kebab
810
+ );
811
+ useEffect(() => {
812
+ if (!el.current) {
813
+ return;
814
+ }
815
+ if (!onAction) {
816
+ return;
817
+ }
818
+ const current = el.current;
819
+ const listener = (e) => {
820
+ const detail = e.detail;
821
+ onAction == null ? void 0 : onAction(detail);
822
+ };
823
+ current.addEventListener("_action", listener);
824
+ return () => {
825
+ current.removeEventListener("_action", listener);
826
+ };
827
+ }, [el, onAction]);
828
+ return (
829
+ // @ts-expect-error - stable WCProps requires text, but experimental supports icon-only mode
830
+ /* @__PURE__ */ jsx("goa-menu-button", { ..._props, version: "2", ref: el, children })
831
+ );
832
+ }
747
833
  function GoabxModal({
748
834
  heading,
749
835
  children,
@@ -1000,7 +1086,7 @@ function GoabxSideMenuHeading({
1000
1086
  meta && /* @__PURE__ */ jsx("span", { slot: "meta", children: meta })
1001
1087
  ] });
1002
1088
  }
1003
- function GoabxTable({ onSort, version = "2", ...props }) {
1089
+ function GoabxTable({ onSort, onMultiSort, sortMode, version = "2", ...props }) {
1004
1090
  const ref = useRef(null);
1005
1091
  useEffect(() => {
1006
1092
  if (!ref.current) {
@@ -1011,17 +1097,24 @@ function GoabxTable({ onSort, version = "2", ...props }) {
1011
1097
  const detail = e.detail;
1012
1098
  onSort == null ? void 0 : onSort(detail);
1013
1099
  };
1100
+ const multiSortListener = (e) => {
1101
+ const detail = e.detail;
1102
+ onMultiSort == null ? void 0 : onMultiSort(detail);
1103
+ };
1014
1104
  current.addEventListener("_sort", sortListener);
1105
+ current.addEventListener("_multisort", multiSortListener);
1015
1106
  return () => {
1016
1107
  current.removeEventListener("_sort", sortListener);
1108
+ current.removeEventListener("_multisort", multiSortListener);
1017
1109
  };
1018
- }, [ref, onSort]);
1110
+ }, [ref, onSort, onMultiSort]);
1019
1111
  return /* @__PURE__ */ jsx(
1020
1112
  "goa-table",
1021
1113
  {
1022
1114
  ref,
1023
1115
  width: props.width,
1024
1116
  variant: props.variant,
1117
+ "sort-mode": sortMode,
1025
1118
  striped: props.striped ? "true" : void 0,
1026
1119
  testid: props.testId,
1027
1120
  mt: props.mt,
@@ -1034,11 +1127,27 @@ function GoabxTable({ onSort, version = "2", ...props }) {
1034
1127
  );
1035
1128
  }
1036
1129
  function GoabxTableSortHeader({
1130
+ name,
1131
+ direction = "none",
1132
+ sortOrder,
1037
1133
  children,
1038
1134
  ...rest
1039
1135
  }) {
1040
- const _props = transformProps(rest, lowercase);
1041
- return /* @__PURE__ */ jsx("goa-table-sort-header", { ..._props, children });
1136
+ return /* @__PURE__ */ jsx("goa-table-sort-header", { name, direction, "sort-order": sortOrder, ...rest, children });
1137
+ }
1138
+ function GoabxTab({ heading, disabled, slug, children }) {
1139
+ return /* @__PURE__ */ jsxs(
1140
+ "goa-tab",
1141
+ {
1142
+ slug,
1143
+ disabled: disabled ? "true" : void 0,
1144
+ heading: typeof heading === "string" ? heading : void 0,
1145
+ children: [
1146
+ typeof heading !== "string" && /* @__PURE__ */ jsx("span", { slot: "heading", children: heading }),
1147
+ children
1148
+ ]
1149
+ }
1150
+ );
1042
1151
  }
1043
1152
  function GoabxTabs({
1044
1153
  initialTab,
@@ -1046,7 +1155,7 @@ function GoabxTabs({
1046
1155
  testId,
1047
1156
  onChange,
1048
1157
  variant,
1049
- version = "2"
1158
+ orientation
1050
1159
  }) {
1051
1160
  const ref = useRef(null);
1052
1161
  useEffect(() => {
@@ -1069,7 +1178,8 @@ function GoabxTabs({
1069
1178
  initialtab: initialTab,
1070
1179
  testid: testId,
1071
1180
  variant,
1072
- version,
1181
+ version: "2",
1182
+ orientation,
1073
1183
  children
1074
1184
  }
1075
1185
  );
@@ -1188,6 +1298,7 @@ function GoabxWorkSideMenuGroup(props) {
1188
1298
  {
1189
1299
  heading: props.heading,
1190
1300
  icon: props.icon,
1301
+ open: props.open ? true : void 0,
1191
1302
  testid: props.testId,
1192
1303
  children: props.children
1193
1304
  }
@@ -1202,6 +1313,7 @@ export {
1202
1313
  GoabxCalendar,
1203
1314
  GoabxCallout,
1204
1315
  GoabxCheckbox,
1316
+ GoabxCheckboxList,
1205
1317
  GoabxDatePicker,
1206
1318
  GoabxDrawer,
1207
1319
  GoabxDropdown,
@@ -1226,6 +1338,8 @@ export {
1226
1338
  GoabxInputTime,
1227
1339
  GoabxInputUrl,
1228
1340
  GoabxLink,
1341
+ GoabxMenuAction,
1342
+ GoabxMenuButton,
1229
1343
  GoabxModal,
1230
1344
  GoabxNotification,
1231
1345
  GoabxPagination,
@@ -1234,6 +1348,7 @@ export {
1234
1348
  GoabxSideMenu,
1235
1349
  GoabxSideMenuGroup,
1236
1350
  GoabxSideMenuHeading,
1351
+ GoabxTab,
1237
1352
  GoabxTable,
1238
1353
  GoabxTableSortHeader,
1239
1354
  GoabxTabs,