@zealicsolutions/web-ui 0.1.1 → 0.1.2

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,5 @@
1
1
  import { SelectOption } from 'atoms/Select/types';
2
+ import { ControllerProps } from 'react-hook-form';
2
3
  export declare type InputFieldTypes = 'number' | 'text' | 'email' | 'password';
3
4
  export declare type FieldTypes = 'input' | 'select' | 'date-picker' | 'checkbox' | 'switch';
4
5
  export declare type UIField<T = string> = (UIInputField | UISelectField | UICheckboxField) & {
@@ -9,6 +10,7 @@ export declare type UIField<T = string> = (UIInputField | UISelectField | UIChec
9
10
  required?: boolean;
10
11
  optional?: boolean;
11
12
  tooltip?: string;
13
+ rules?: ControllerProps['rules'];
12
14
  };
13
15
  export declare type UIInputField = {
14
16
  type: 'input';
@@ -7,4 +7,4 @@ export declare type FieldMapperProps<T extends object> = {
7
7
  control?: Control<T>;
8
8
  spacer?: number;
9
9
  };
10
- export declare const FieldMapper: <T extends object>({ field, isEditMode, spacer, control, }: FieldMapperProps<T>) => JSX.Element;
10
+ export declare const FieldMapper: <T extends object>({ field, isEditMode, spacer, control, }: FieldMapperProps<T>) => JSX.Element | null;
@@ -1,11 +1,12 @@
1
1
  /// <reference types="react" />
2
- import { Control } from 'react-hook-form/dist/types';
3
2
  import { CSSProperties } from 'styled-components';
4
- import { InputProps } from '../../atoms';
3
+ import { Control, ControllerProps } from 'react-hook-form/dist/types';
4
+ import { InputProps } from 'atoms';
5
5
  import { FieldLabelsProps } from '../FieldLabels/FieldLabels';
6
6
  export declare type InputFieldProps = {
7
7
  name: string;
8
8
  control?: Control<any>;
9
+ rules?: ControllerProps['rules'];
9
10
  required?: boolean;
10
11
  optional?: boolean;
11
12
  defaultValue?: string;
@@ -13,4 +14,4 @@ export declare type InputFieldProps = {
13
14
  styles?: CSSProperties;
14
15
  labelsProps?: FieldLabelsProps;
15
16
  };
16
- export declare const InputField: ({ control, name, inputProps, styles, labelsProps, defaultValue, optional, required, }: InputFieldProps) => JSX.Element;
17
+ export declare const InputField: ({ control, name, inputProps, styles, labelsProps, defaultValue, optional, required, rules, }: InputFieldProps) => JSX.Element;
@@ -3,7 +3,7 @@ import type { ComponentStory } from '@storybook/react';
3
3
  import { InputField as InputFieldComponent } from './InputField';
4
4
  declare const _default: {
5
5
  title: string;
6
- component: ({ control, name, inputProps, styles, labelsProps, defaultValue, optional, required, }: import("./InputField").InputFieldProps) => JSX.Element;
6
+ component: ({ control, name, inputProps, styles, labelsProps, defaultValue, optional, required, rules, }: import("./InputField").InputFieldProps) => JSX.Element;
7
7
  };
8
8
  export default _default;
9
9
  export declare const InputField: ComponentStory<typeof InputFieldComponent>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { Control } from 'react-hook-form/dist/types';
2
+ import { Control, ControllerProps } from 'react-hook-form/dist/types';
3
3
  import { CSSProperties } from 'styled-components';
4
4
  import { SelectProps } from '../../atoms/Select/types';
5
5
  import { FieldLabelsProps } from '../FieldLabels/FieldLabels';
@@ -7,10 +7,11 @@ export declare type SelectFieldProps = {
7
7
  selectProps: SelectProps;
8
8
  labelsProps?: FieldLabelsProps;
9
9
  name: string;
10
+ rules?: ControllerProps['rules'];
10
11
  control?: Control<any>;
11
12
  required?: boolean;
12
13
  optional?: boolean;
13
14
  defaultValue?: string;
14
15
  styles?: CSSProperties;
15
16
  };
16
- export declare const SelectField: ({ selectProps, name, defaultValue, optional, required, control, styles, labelsProps, }: SelectFieldProps) => JSX.Element;
17
+ export declare const SelectField: ({ selectProps, name, defaultValue, optional, required, control, styles, labelsProps, rules, }: SelectFieldProps) => JSX.Element;
@@ -3,7 +3,7 @@ import type { ComponentStory } from '@storybook/react';
3
3
  import { SelectField as SelectFieldComponent } from './SelectField';
4
4
  declare const _default: {
5
5
  title: string;
6
- component: ({ selectProps, name, defaultValue, optional, required, control, styles, labelsProps, }: import("./SelectField").SelectFieldProps) => JSX.Element;
6
+ component: ({ selectProps, name, defaultValue, optional, required, control, styles, labelsProps, rules, }: import("./SelectField").SelectFieldProps) => JSX.Element;
7
7
  };
8
8
  export default _default;
9
9
  export declare const SelectField: ComponentStory<typeof SelectFieldComponent>;
package/dist/index.d.ts CHANGED
@@ -11,12 +11,13 @@ import { SizesTypes as SizesTypes$2, ThemeColors as ThemeColors$2 } from 'theme'
11
11
  import { TooltipProps as TooltipProps$1 } from 'rc-tooltip/lib/Tooltip';
12
12
  import { WithGoogleMapProps } from 'react-google-maps/lib/withGoogleMap';
13
13
  import { WithScriptjsProps } from 'react-google-maps/lib/withScriptjs';
14
- import { Control } from 'react-hook-form/dist/types';
14
+ import { Control, ControllerProps } from 'react-hook-form/dist/types';
15
+ import { InputProps as InputProps$1 } from 'atoms';
15
16
  import { SelectOption as SelectOption$1 } from 'atoms/Select/types';
17
+ import { ControllerProps as ControllerProps$1, DeepPartial, FieldValues, FormState } from 'react-hook-form';
16
18
  import { DrawerProps as DrawerProps$1 } from '@mui/material';
17
19
  import { SetPasswordFields, MaxRuleValidation, MinRuleValidation } from 'organisms/SetPasswordForm/types';
18
20
  import { FieldSectionProps as FieldSectionProps$1 } from 'molecules';
19
- import { DeepPartial, FieldValues, FormState } from 'react-hook-form';
20
21
  import { LoginFields as LoginFields$1 } from 'organisms/LoginForm/types';
21
22
 
22
23
  declare type BaseButtonProps = {
@@ -262,14 +263,15 @@ declare const FieldLabels: ({ label, isError, ruleLabel, tooltipText }: FieldLab
262
263
  declare type InputFieldProps = {
263
264
  name: string;
264
265
  control?: Control<any>;
266
+ rules?: ControllerProps['rules'];
265
267
  required?: boolean;
266
268
  optional?: boolean;
267
269
  defaultValue?: string;
268
- inputProps: InputProps;
270
+ inputProps: InputProps$1;
269
271
  styles?: CSSProperties;
270
272
  labelsProps?: FieldLabelsProps;
271
273
  };
272
- declare const InputField: ({ control, name, inputProps, styles, labelsProps, defaultValue, optional, required, }: InputFieldProps) => JSX.Element;
274
+ declare const InputField: ({ control, name, inputProps, styles, labelsProps, defaultValue, optional, required, rules, }: InputFieldProps) => JSX.Element;
273
275
 
274
276
  declare const getFieldPlaceholder: (type: FieldTypes$1, title?: string) => string;
275
277
 
@@ -283,6 +285,7 @@ declare type UIField<T = string> = (UIInputField | UISelectField | UICheckboxFie
283
285
  required?: boolean;
284
286
  optional?: boolean;
285
287
  tooltip?: string;
288
+ rules?: ControllerProps$1['rules'];
286
289
  };
287
290
  declare type UIInputField = {
288
291
  type: 'input';
@@ -318,7 +321,7 @@ declare type FieldMapperProps<T extends object> = {
318
321
  control?: Control<T>;
319
322
  spacer?: number;
320
323
  };
321
- declare const FieldMapper: <T extends object>({ field, isEditMode, spacer, control, }: FieldMapperProps<T>) => JSX.Element;
324
+ declare const FieldMapper: <T extends object>({ field, isEditMode, spacer, control, }: FieldMapperProps<T>) => JSX.Element | null;
322
325
 
323
326
  declare type CheckboxFieldProps = {
324
327
  name: string;
@@ -332,13 +335,14 @@ declare type SelectFieldProps = {
332
335
  selectProps: SelectProps;
333
336
  labelsProps?: FieldLabelsProps;
334
337
  name: string;
338
+ rules?: ControllerProps['rules'];
335
339
  control?: Control<any>;
336
340
  required?: boolean;
337
341
  optional?: boolean;
338
342
  defaultValue?: string;
339
343
  styles?: CSSProperties;
340
344
  };
341
- declare const SelectField: ({ selectProps, name, defaultValue, optional, required, control, styles, labelsProps, }: SelectFieldProps) => JSX.Element;
345
+ declare const SelectField: ({ selectProps, name, defaultValue, optional, required, control, styles, labelsProps, rules, }: SelectFieldProps) => JSX.Element;
342
346
 
343
347
  declare type CustomValidationRule<T = string> = {
344
348
  text: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zealicsolutions/web-ui",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/Zealic_Solutions/zeal-ui-web.git"
@@ -26,10 +26,10 @@
26
26
  "storybook": "start-storybook -p 6006",
27
27
  "build-storybook": "build-storybook",
28
28
  "clean": "rimraf dist",
29
- "lint-fix": "eslint --fix ./src/**/*.ts",
30
- "pretty": "prettier --write ./src",
29
+ "lint:fix": "eslint --fix ./src/**/*.ts",
30
+ "format:fix": "prettier --write ./src",
31
31
  "prepare": "husky install",
32
- "precommit": "yarn pretty && yarn lint-fix"
32
+ "precommit": "yarn format:fix && yarn lint:fix"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@babel/core": "^7.19.0",
@@ -100,7 +100,7 @@
100
100
  },
101
101
  "husky": {
102
102
  "hooks": {
103
- "precommit": "yarn pretty && yarn lint-fix && yarn test"
103
+ "precommit": "yarn format:fix && yarn lint:fix && yarn test"
104
104
  }
105
105
  },
106
106
  "bugs": {