ish-ui 1.0.43 → 1.0.45

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.
@@ -3,5 +3,6 @@
3
3
  * */
4
4
  import React from 'react';
5
5
  import { CheckboxFieldProps, FieldInputProps } from '../model';
6
+ import { CheckboxProps } from '@mui/material/Checkbox/Checkbox';
6
7
  export declare const StyledCheckbox: React.JSXElementConstructor<Omit<any, "classes"> & import("@mui/styles/withStyles").StyledComponentProps<"root"> & object>;
7
- export declare function CheckboxField<IP extends FieldInputProps>({ input, color, disabled, stringValue, className, uncheckedClass, onChangeHandler, stopPropagation }: CheckboxFieldProps<IP>): React.JSX.Element;
8
+ export declare function CheckboxField<IP extends FieldInputProps>({ input, color, disabled, stringValue, className, uncheckedClass, onChangeHandler, stopPropagation, ...rest }: CheckboxFieldProps<IP> & CheckboxProps): React.JSX.Element;
@@ -50,7 +50,8 @@ const StyledCheckboxBase = props => {
50
50
  } }, rest)));
51
51
  };
52
52
  export const StyledCheckbox = withStyles(styles)(StyledCheckboxBase);
53
- export function CheckboxField({ input, color, disabled, stringValue, className, uncheckedClass, onChangeHandler, stopPropagation }) {
53
+ export function CheckboxField(_a) {
54
+ var { input, color, disabled, stringValue, className, uncheckedClass, onChangeHandler, stopPropagation } = _a, rest = __rest(_a, ["input", "color", "disabled", "stringValue", "className", "uncheckedClass", "onChangeHandler", "stopPropagation"]);
54
55
  const onChange = useCallback((e, value) => {
55
56
  let checked = value;
56
57
  if (stringValue) {
@@ -63,5 +64,5 @@ export function CheckboxField({ input, color, disabled, stringValue, className,
63
64
  input.onChange(checked);
64
65
  }
65
66
  }, [stringValue, input, onChangeHandler]);
66
- return (React.createElement(StyledCheckbox, { checked: getValue(input.value, stringValue), onChange: onChange, color: color, disabled: disabled, className: className, uncheckedClass: uncheckedClass, onClick: stopPropagation ? e => e.stopPropagation() : undefined, id: `input-${input.name}`, name: input.name }));
67
+ return (React.createElement(StyledCheckbox, Object.assign({ checked: getValue(input.value, stringValue), onChange: onChange, color: color, disabled: disabled, className: className, uncheckedClass: uncheckedClass, onClick: stopPropagation ? e => e.stopPropagation() : undefined, id: `input-${input.name}`, name: input.name }, rest)));
67
68
  }
@@ -21,7 +21,7 @@ function FormRadioButtons({ items, disabled, input: { value, onChange, name }, m
21
21
  label,
22
22
  labelAdornment)),
23
23
  React.createElement(RadioGroup, Object.assign({ className: classes.group, value: value, onChange: (e) => onChange(e.target.value), row: row }, radioGroupProps), items
24
- && items.map((i, n) => (React.createElement(FormControlLabel, { key: n, value: i[valuePath], control: React.createElement(Radio, Object.assign({ color: color, id: `input-${n}-${name}`, name: name }, radioProps)), label: (React.createElement(Typography, { component: "span", variant: "body2" }, i[labelPath])), disabled: disabled, htmlFor: `input-${n}-${name}` })))),
24
+ && items.map((i, n) => (React.createElement(FormControlLabel, { key: n, value: i[valuePath], control: React.createElement(Radio, Object.assign({ color: color, id: `input-${n}-${name}`, name: name }, radioProps)), label: (React.createElement(Typography, { component: "span", variant: "body2" }, i[labelPath])), disabled: disabled })))),
25
25
  React.createElement(FormHelperText, { classes: {
26
26
  error: 'shakingError'
27
27
  } }, error)));
@@ -7,6 +7,7 @@ import { PopperPlacementType } from '@mui/material';
7
7
  import { FormControlTypeMap } from '@mui/material/FormControl/FormControl';
8
8
  import { RadioProps } from '@mui/material/Radio/Radio';
9
9
  import { RadioGroupProps } from '@mui/material/RadioGroup/RadioGroup';
10
+ import { CheckboxProps } from '@mui/material/Checkbox/Checkbox';
10
11
  export type EventHandler<Event> = (event: Event, name?: string) => void;
11
12
  export interface EventOrValueHandler<Event> extends EventHandler<Event> {
12
13
  (value: any): void;
@@ -217,11 +218,11 @@ export interface FormSwitchProps<IP> {
217
218
  onChangeHandler?: AnyArgFunction;
218
219
  onClick?: AnyArgFunction;
219
220
  }
220
- export interface CheckboxFieldProps<IP> {
221
+ export interface CheckboxFieldProps<IP> extends CheckboxProps {
222
+ inputRef?: MutableRefObject<any>;
221
223
  input?: Partial<Omit<IP, 'onBlur'>> & {
222
224
  onBlur?: AnyArgFunction;
223
225
  };
224
- color?: string;
225
226
  disabled?: boolean;
226
227
  stringValue?: boolean;
227
228
  className?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ish-ui",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "description": "UI elements for onCourse and other ish apps",
5
5
  "main": "main.ts",
6
6
  "devDependencies": {