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

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';
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,
@@ -1256,6 +1304,7 @@ exports.GoabxButton = GoabxButton;
1256
1304
  exports.GoabxCalendar = GoabxCalendar;
1257
1305
  exports.GoabxCallout = GoabxCallout;
1258
1306
  exports.GoabxCheckbox = GoabxCheckbox;
1307
+ exports.GoabxCheckboxList = GoabxCheckboxList;
1259
1308
  exports.GoabxDatePicker = GoabxDatePicker;
1260
1309
  exports.GoabxDrawer = GoabxDrawer;
1261
1310
  exports.GoabxDropdown = GoabxDropdown;