@bodynarf/react.components 1.4.20 → 1.4.21

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,3 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../../redux";
3
2
  import { FormModuleProps } from "../../component";
4
3
  /** Form container props type */
@@ -12,11 +11,12 @@ interface FormContainerComponentProps extends Omit<FormState, 'initialConfig' |
12
11
  submitForm: () => void;
13
12
  }
14
13
  /** Form container component */
15
- declare const FormContainer: import("react-redux").ConnectedComponent<({ items, state, valuesStorage, formCfg, submitForm }: FormContainerComponentProps) => JSX.Element, {
14
+ declare const FormContainer: import("react-redux").ConnectedComponent<({ items, state, valuesStorage, formCfg, submitForm, }: FormContainerComponentProps) => JSX.Element, {
16
15
  onSubmit: (values: import("../../redux").FieldValue[]) => void;
17
16
  name: string;
18
17
  caption?: string | undefined;
19
18
  items: import("../../types").Field<any>[];
19
+ submitButtonConfiguration: import("../../types").SubmitButtonConfiguration;
20
20
  context?: import("react").Context<import("react-redux").ReactReduxContextValue<any, import("redux").AnyAction>> | undefined;
21
21
  store?: import("redux").Store<any, import("redux").AnyAction> | undefined;
22
22
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/container/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAmC,SAAS,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAuClD,gCAAgC;AAChC,UAAU,2BAA4B,SAAQ,IAAI,CAAC,SAAS,EAAE,eAAe,GAAG,aAAa,CAAC;IAE1F,iCAAiC;IACjC,OAAO,EAAE,eAAe,CAAC;IAEzB;;;OAGG;IACH,UAAU,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,+BAA+B;AAC/B,QAAA,MAAM,aAAa,kGA7ChB,2BAA2B,KAAG,WAAW;;;;;;;EAmDnB,CAAC;AAE1B,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/container/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAmC,SAAS,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAwClD,gCAAgC;AAChC,UAAU,2BAA4B,SAAQ,IAAI,CAAC,SAAS,EAAE,eAAe,GAAG,aAAa,CAAC;IAE1F,iCAAiC;IACjC,OAAO,EAAE,eAAe,CAAC;IAEzB;;;OAGG;IACH,UAAU,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,+BAA+B;AAC/B,QAAA,MAAM,aAAa,mGA9ChB,2BAA2B,KAAG,WAAW;;;;;;;;EAoDnB,CAAC;AAE1B,eAAe,aAAa,CAAC"}
@@ -5,7 +5,7 @@ import Form from "../form";
5
5
  import { getInitAction, getSetFormStatus } from "../../redux";
6
6
  import { submitFormAsync } from "../../redux/actions";
7
7
  import Button from "../../../button";
8
- const FormContainerComponent = ({ items, state, valuesStorage, formCfg, submitForm }) => {
8
+ const FormContainerComponent = ({ items, state, valuesStorage, formCfg, submitForm, }) => {
9
9
  const dispatch = useDispatch();
10
10
  useEffect(() => {
11
11
  if (state === "init") {
@@ -17,7 +17,8 @@ const FormContainerComponent = ({ items, state, valuesStorage, formCfg, submitFo
17
17
  }
18
18
  }, [state]);
19
19
  const onSubmitClick = useCallback(submitForm, [submitForm]);
20
- return (_jsxs(_Fragment, { children: [_jsx(Form, { items: items, name: formCfg.name, caption: formCfg.caption }), _jsx(Button, { onClick: onSubmitClick, caption: "Submit", type: "success", disabled: state === "validating" })] }));
20
+ const buttonDisabled = formCfg.submitButtonConfiguration.disabled || state === "validating";
21
+ return (_jsxs(_Fragment, { children: [_jsx(Form, { items: items, name: formCfg.name, caption: formCfg.caption }), _jsx(Button, { ...formCfg.submitButtonConfiguration, onClick: onSubmitClick, disabled: buttonDisabled })] }));
21
22
  };
22
23
  /** Form container component */
23
24
  const FormContainer = connect(({ items, state, valuesStorage }, props) => ({ items, state, valuesStorage, formCfg: props }), {
@@ -1,7 +1,6 @@
1
- /// <reference types="react" />
2
1
  import { FormConfig, FormItem } from "../../types";
3
2
  /** Form component props type */
4
- interface FormProps extends Omit<FormConfig, 'items'> {
3
+ interface FormProps extends Omit<FormConfig, 'items' | 'submitButtonConfiguration'> {
5
4
  /** Form caption */
6
5
  items: Array<FormItem<any>>;
7
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/form/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAInD,gCAAgC;AAChC,UAAU,SAAU,SAAQ,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC;IACjD,mBAAmB;IACnB,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;CAC/B;AAED,wBAAwB;AACxB,QAAA,MAAM,IAAI,6BAA8B,SAAS,KAAG,WAuBnD,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/form/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAInD,gCAAgC;AAChC,UAAU,SAAU,SAAQ,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,2BAA2B,CAAC;IAC/E,mBAAmB;IACnB,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;CAC/B;AAED,wBAAwB;AACxB,QAAA,MAAM,IAAI,6BAA8B,SAAS,KAAG,WAuBnD,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Field } from ".";
1
+ import { Field, SubmitButtonConfiguration } from ".";
2
2
  /** Form configuration */
3
3
  export interface FormConfig {
4
4
  /** Form name */
@@ -12,5 +12,9 @@ export interface FormConfig {
12
12
  * To see possible extensions - see `model/extensions/items` interfaces with `..Extension` name template
13
13
  */
14
14
  items: Array<Field<any>>;
15
+ /**
16
+ * Configuration for submit button
17
+ */
18
+ submitButtonConfiguration: SubmitButtonConfiguration;
15
19
  }
16
20
  //# sourceMappingURL=form.config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.config.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/types/model/form.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC;AAE1B,yBAAyB;AACzB,MAAM,WAAW,UAAU;IACvB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IAEb,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;MAKE;IACF,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B"}
1
+ {"version":3,"file":"form.config.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/types/model/form.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,yBAAyB,EAAE,MAAM,GAAG,CAAC;AAErD,yBAAyB;AACzB,MAAM,WAAW,UAAU;IACvB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IAEb,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;MAKE;IACF,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAEzB;;OAEG;IACH,yBAAyB,EAAE,yBAAyB,CAAC;CACxD"}
@@ -0,0 +1,26 @@
1
+ import { ButtonType } from "../../../button/types";
2
+ import { ElementIcon, ElementSize } from "../../../types";
3
+ /** Form submit button configuration */
4
+ export interface SubmitButtonConfiguration {
5
+ /** Button displaying text */
6
+ caption?: string;
7
+ /** Type of button (color) */
8
+ type: ButtonType;
9
+ /** Configuration of inner icon */
10
+ icon?: ElementIcon;
11
+ /** Button size */
12
+ size?: ElementSize;
13
+ /** Title on hover */
14
+ title?: string;
15
+ /** Is button uses light version of color */
16
+ light?: boolean;
17
+ /** Is button outlined */
18
+ outlined?: boolean;
19
+ /** Should button corners be rounded */
20
+ rounded?: boolean;
21
+ /** Display loading icon */
22
+ isLoading?: boolean;
23
+ /** Is button disabled */
24
+ disabled?: boolean;
25
+ }
26
+ //# sourceMappingURL=form.submitButtonCfg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.submitButtonCfg.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/types/model/form.submitButtonCfg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE1D,uCAAuC;AACvC,MAAM,WAAW,yBAAyB;IACtC,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,8BAA8B;IAC9B,IAAI,EAAE,UAAU,CAAC;IAEjB,kCAAkC;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,mBAAmB;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,6CAA6C;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB"}
@@ -6,4 +6,5 @@ export * from "./formItemValidationState";
6
6
  export * from "./validationResult";
7
7
  export * from "./extensions";
8
8
  export * from "./form.config";
9
+ export * from "./form.submitButtonCfg";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/types/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/types/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC"}
@@ -6,3 +6,4 @@ export * from "./formItemValidationState";
6
6
  export * from "./validationResult";
7
7
  export * from "./extensions";
8
8
  export * from "./form.config";
9
+ export * from "./form.submitButtonCfg";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bodynarf/react.components",
3
- "version": "1.4.20",
3
+ "version": "1.4.21",
4
4
  "author": {
5
5
  "name": "Artem",
6
6
  "email": "bodynar@gmail.com"