@motech-development/breeze-ui 2.1.9 → 2.2.0

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/lib/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as react from 'react';
2
2
  import { ReactNode, FC, HTMLAttributes, ButtonHTMLAttributes, ChangeEvent, TdHTMLAttributes } from 'react';
3
3
  import * as styled_components from 'styled-components';
4
4
  import { FormikProps, FormikValues } from 'formik';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
6
  import { ObjectSchema } from 'yup';
6
7
  import { LinkProps } from 'react-router-dom';
7
8
 
@@ -107,7 +108,7 @@ declare const ButtonLink: FC<ButtonHTMLAttributes<HTMLButtonElement>>;
107
108
  interface ICalendarProps {
108
109
  selectedDate?: string;
109
110
  id: string;
110
- onDateChange(date: string): void;
111
+ onDateChange: (date: string) => void;
111
112
  }
112
113
  declare const Calendar: FC<ICalendarProps>;
113
114
 
@@ -141,7 +142,7 @@ interface ICheckBoxProps {
141
142
  name: string;
142
143
  readOnly?: boolean;
143
144
  spacing?: CheckBoxSpacing;
144
- onChange?(e: ChangeEvent<HTMLInputElement>, form: FormikProps<FormikValues>): void;
145
+ onChange?: (e: ChangeEvent<HTMLInputElement>, form: FormikProps<FormikValues>) => void;
145
146
  }
146
147
  declare const CheckBox: FC<ICheckBoxProps>;
147
148
 
@@ -189,7 +190,7 @@ interface ITextBoxProps {
189
190
  spacing?: InputSpacing;
190
191
  suffix?: string;
191
192
  type?: 'email' | 'number' | 'password' | 'text';
192
- onChange?(e: ChangeEvent<HTMLInputElement>, form: FormikProps<FormikValues>): Promise<void> | void;
193
+ onChange?: (e: ChangeEvent<HTMLInputElement>, form: FormikProps<FormikValues>) => Promise<void> | void;
193
194
  }
194
195
  declare const TextBox: FC<ITextBoxProps>;
195
196
 
@@ -224,21 +225,21 @@ interface IFileUploadProps {
224
225
  loading?: boolean;
225
226
  name: string;
226
227
  spacing?: FileUploadSpacing;
227
- onSelect(file: File, form: FormikProps<FormikValues>): void | Promise<void>;
228
+ onSelect: (file: File, form: FormikProps<FormikValues>) => void | Promise<void>;
228
229
  }
229
230
  declare const FileUpload: FC<IFileUploadProps>;
230
231
 
231
- interface IFormProps {
232
+ interface IFormProps<T extends FormikValues = FormikValues> {
232
233
  children: ReactNode;
233
234
  cancel?: ReactNode;
234
- initialValues: FormikValues;
235
+ initialValues: T;
235
236
  loading?: boolean;
236
- onPreSubmit?(values: FormikValues): FormikValues | Promise<FormikValues>;
237
- onSubmit(values: FormikValues): void | Promise<void>;
237
+ onPreSubmit?: (values: T) => T | Promise<T>;
238
+ onSubmit: (values: T) => void | Promise<void>;
238
239
  submitLabel: string;
239
- validationSchema: ObjectSchema<FormikValues>;
240
+ validationSchema: ObjectSchema<T>;
240
241
  }
241
- declare const Form: FC<IFormProps>;
242
+ declare function Form<T extends FormikValues = FormikValues>({ children, cancel, initialValues, loading, onPreSubmit, onSubmit, submitLabel, validationSchema, }: IFormProps<T>): react_jsx_runtime.JSX.Element;
242
243
 
243
244
  type TUseBreakpoint = 'xs' | 'sm' | 'md' | 'lg';
244
245
  declare const useBreakpoint: () => TUseBreakpoint;
@@ -294,7 +295,7 @@ interface INotificationsProps<T> {
294
295
  noResults: ReactNode;
295
296
  placement?: Placement;
296
297
  row: (item: T) => ReactNode;
297
- onClose(): void | Promise<void>;
298
+ onClose: () => void | Promise<void>;
298
299
  }
299
300
  declare function Notifications<T>({ alert, cols, items, label, noResults, onClose, placement, row, }: INotificationsProps<T>): JSX.Element;
300
301
 
@@ -325,7 +326,7 @@ interface IRadioProps {
325
326
  options: IRadioOption[];
326
327
  readOnly?: boolean;
327
328
  spacing?: RadioSpacing;
328
- onChange?(e: ChangeEvent<HTMLInputElement>, form: FormikProps<FormikValues>): void;
329
+ onChange?: (e: ChangeEvent<HTMLInputElement>, form: FormikProps<FormikValues>) => void;
329
330
  }
330
331
  declare const Radio: FC<IRadioProps>;
331
332
 
@@ -353,7 +354,7 @@ interface ISelectProps {
353
354
  placeholder: string;
354
355
  readOnly?: boolean;
355
356
  spacing?: SelectSpacing;
356
- onChange?(e: ChangeEvent<HTMLSelectElement>, form: FormikProps<FormikValues>): void;
357
+ onChange?: (e: ChangeEvent<HTMLSelectElement>, form: FormikProps<FormikValues>) => void;
357
358
  }
358
359
  declare const Select: FC<ISelectProps>;
359
360
 
@@ -364,7 +365,7 @@ interface IStepperProps {
364
365
  onStart?: ReactNode;
365
366
  previousLabel: string;
366
367
  start?: number;
367
- enableNext?(step: number): boolean;
368
+ enableNext?: (step: number) => boolean;
368
369
  }
369
370
  declare const Stepper: FC<IStepperProps>;
370
371
 
package/lib/index.esm.js CHANGED
@@ -1816,7 +1816,7 @@ function formNormaliser(values) {
1816
1816
  ...values
1817
1817
  });
1818
1818
  }
1819
- const Form = ({ children, cancel = null, initialValues, loading = false, onPreSubmit = null, onSubmit, submitLabel, validationSchema })=>{
1819
+ function Form({ children, cancel = null, initialValues, loading = false, onPreSubmit, onSubmit, submitLabel, validationSchema }) {
1820
1820
  const doSubmit = async (values)=>{
1821
1821
  const payload = onPreSubmit ? await Promise.resolve(onPreSubmit(values)) : values;
1822
1822
  await Promise.resolve(onSubmit(payload));
@@ -1863,7 +1863,7 @@ const Form = ({ children, cancel = null, initialValues, loading = false, onPreSu
1863
1863
  })
1864
1864
  })
1865
1865
  });
1866
- };
1866
+ }
1867
1867
 
1868
1868
  const Link = (props)=>// eslint-disable-next-line react/jsx-props-no-spreading
1869
1869
  /*#__PURE__*/ jsx(BaseLink, {
@@ -2036,7 +2036,9 @@ const NotificationButton = styled(Button)`
2036
2036
  }
2037
2037
  `;
2038
2038
  const NotificationContainer = styled.div`
2039
- box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 5px 8px 0 rgba(0, 0, 0, 0.14),
2039
+ box-shadow:
2040
+ 0 3px 5px -1px rgba(0, 0, 0, 0.2),
2041
+ 0 5px 8px 0 rgba(0, 0, 0, 0.14),
2040
2042
  0 1px 14px 0 rgba(0, 0, 0, 0.12);
2041
2043
  `;
2042
2044
  const NotificationWrapper = styled.div`