@abgov/react-components 6.11.0-dev.5 → 6.11.0-dev.7

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';
@@ -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;
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,
@@ -1218,6 +1304,7 @@ exports.GoabxButton = GoabxButton;
1218
1304
  exports.GoabxCalendar = GoabxCalendar;
1219
1305
  exports.GoabxCallout = GoabxCallout;
1220
1306
  exports.GoabxCheckbox = GoabxCheckbox;
1307
+ exports.GoabxCheckboxList = GoabxCheckboxList;
1221
1308
  exports.GoabxDatePicker = GoabxDatePicker;
1222
1309
  exports.GoabxDrawer = GoabxDrawer;
1223
1310
  exports.GoabxDropdown = GoabxDropdown;
@@ -1242,6 +1329,8 @@ exports.GoabxInputText = GoabxInputText;
1242
1329
  exports.GoabxInputTime = GoabxInputTime;
1243
1330
  exports.GoabxInputUrl = GoabxInputUrl;
1244
1331
  exports.GoabxLink = GoabxLink;
1332
+ exports.GoabxMenuAction = GoabxMenuAction;
1333
+ exports.GoabxMenuButton = GoabxMenuButton;
1245
1334
  exports.GoabxModal = GoabxModal;
1246
1335
  exports.GoabxNotification = GoabxNotification;
1247
1336
  exports.GoabxPagination = GoabxPagination;