@happeouikit/form-elements 2.3.36 → 2.3.38

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.
@@ -1,4 +1,4 @@
1
- import { CSSProperties } from "react";
1
+ import { ChangeEvent, CSSProperties } from "react";
2
2
  interface BaseCheckboxProps {
3
3
  label?: string;
4
4
  subtitle?: string;
@@ -6,7 +6,7 @@ interface BaseCheckboxProps {
6
6
  indeterminate?: boolean;
7
7
  disabled?: boolean;
8
8
  background?: string;
9
- onChange: (newVal: boolean) => void | any;
9
+ onChange?: (event: ChangeEvent<HTMLInputElement>, newVal: boolean) => void | any;
10
10
  checked: boolean;
11
11
  style?: CSSProperties;
12
12
  id?: string;
@@ -29,7 +29,7 @@ export interface CheckboxGroupOption {
29
29
  value: string;
30
30
  background?: string;
31
31
  disabled?: boolean;
32
- onChange?: (newVal: boolean) => void;
32
+ onChange?: (event: ChangeEvent<HTMLInputElement>, newVal: boolean) => void;
33
33
  }
34
34
  export interface CheckboxGroupProps {
35
35
  value?: string[];
@@ -1,7 +1,7 @@
1
1
  import PropTypes from "prop-types";
2
2
  import { RadioButtonProps } from "./RadioButton.types";
3
3
  declare const RadioButton: {
4
- ({ label, subtitle, description, background, id, ...props }: RadioButtonProps): import("react/jsx-runtime").JSX.Element;
4
+ ({ label, subtitle, description, background, id, onChange, ...props }: RadioButtonProps): import("react/jsx-runtime").JSX.Element;
5
5
  propTypes: {
6
6
  label: PropTypes.Requireable<PropTypes.ReactNodeLike>;
7
7
  subtitle: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -5,5 +5,6 @@ export interface RadioButtonProps {
5
5
  description?: React.ReactNode;
6
6
  id?: string;
7
7
  background?: string;
8
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>, newVal: boolean) => void | any;
8
9
  [key: string]: any;
9
10
  }
package/dist/Switch.d.ts CHANGED
@@ -1,19 +1,3 @@
1
+ import { SwitchProps } from "./Switch.types";
2
+ declare const Switch: ({ label, subtitle, description, tabIndex, id, disabled, checked, defaultChecked, required, onChange, background, "data-tip": dataTip, "data-tip-disable": dataTipDisable, "data-testid": dataTestId, ...props }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
1
3
  export default Switch;
2
- declare function Switch({ label, tabIndex, ...props }: {
3
- [x: string]: any;
4
- label: any;
5
- tabIndex: any;
6
- }): import("react/jsx-runtime").JSX.Element;
7
- declare namespace Switch {
8
- namespace propTypes {
9
- let label: PropTypes.Requireable<PropTypes.ReactNodeLike>;
10
- let tabIndex: PropTypes.Requireable<number>;
11
- }
12
- namespace defaultProps {
13
- let label_1: undefined;
14
- export { label_1 as label };
15
- let tabIndex_1: number;
16
- export { tabIndex_1 as tabIndex };
17
- }
18
- }
19
- import PropTypes from "prop-types";
@@ -0,0 +1,30 @@
1
+ /// <reference types="react" />
2
+ export interface BaseSwitchProps {
3
+ tabIndex?: number;
4
+ id?: string;
5
+ disabled?: boolean;
6
+ checked?: boolean;
7
+ background?: string;
8
+ defaultChecked?: boolean;
9
+ subtitle?: string;
10
+ description?: string;
11
+ "data-tracker"?: string;
12
+ "data-testid"?: string;
13
+ required?: boolean;
14
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>, newVal: boolean) => void | any;
15
+ "aria-label"?: string;
16
+ "aria-expanded"?: boolean;
17
+ "aria-controls"?: string;
18
+ "aria-describedby"?: string;
19
+ [key: string]: any;
20
+ }
21
+ interface AriaLabelSwitchProps extends BaseSwitchProps {
22
+ "aria-label": string;
23
+ label?: never;
24
+ }
25
+ interface LabelSwitchProps extends BaseSwitchProps {
26
+ label: string;
27
+ "aria-label"?: never;
28
+ }
29
+ export type SwitchProps = AriaLabelSwitchProps | LabelSwitchProps;
30
+ export {};