@rhc-shared-components/form-group-container 0.1.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/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # @rhc-shared-components/form-group-container
2
+
3
+ > Form group container for Red Hat certified technology apps
4
+
5
+ [![NPM](https://img.shields.io/npm/v/form-group-container.svg)](https://www.npmjs.com/package/form-group-container) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install --save @rhc-shared-components/form-group-container
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```tsx
16
+ import React, { Component } from 'react'
17
+
18
+ import { FormGroupContainer } from '@rhc-shared-components/form-group-container'
19
+ // ...
20
+
21
+ class Example extends Component {
22
+ // .....
23
+ // when used with formik contexts
24
+ render() {
25
+ return <FormGroupContainer
26
+ validated={meta.touched && meta.error ? ValidatedOptions.error : ValidatedOptions.default}
27
+ helperTextInvalid={meta.error}
28
+ isRequired={isRequired}
29
+ fieldId={rest.name}
30
+ label={label}
31
+ helperText={helperText}
32
+ {...(labelIcon && {labelIcon: labelIcon})}
33
+ {...formGroupProps}
34
+ >
35
+ <TextInput
36
+ isDisabled={isSubmitting || isDisabled}
37
+ validated={meta.touched && meta.error ? ValidatedOptions.error : ValidatedOptions.default}
38
+ id={rest.name}
39
+ data-testid={rest.name}
40
+ {...field}
41
+ {...rest}
42
+ onBlur={onBlurHandler}
43
+ onChange={onChangeHandler}
44
+ />
45
+ </FormGroupContainer>
46
+ }
47
+ }
48
+ ```
49
+
50
+ ## License
51
+
52
+ MIT © [gautamkrishnar](https://github.com/gautamkrishnar)
package/dist/index.css ADDED
@@ -0,0 +1,8 @@
1
+ ._2lEqn ._jPOnz {
2
+ float: right;
3
+ color: #6A6E73;
4
+ font-size: var(--pf-c-form__helper-text--FontSize);
5
+ margin-top: var(--pf-c-form__helper-text--MarginTop); }
6
+
7
+ ._2lEqn ._K4sVw {
8
+ color: var(--pf-c-form--m-error--Color); }
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import './style.scss';
3
+ interface FormGroupContainerProps {
4
+ isValid?: boolean;
5
+ helperTextInvalid?: string;
6
+ fieldId: string;
7
+ label?: string;
8
+ labelIcon?: any;
9
+ children: React.ReactNode;
10
+ className?: string;
11
+ isRequired?: boolean;
12
+ helperText?: string;
13
+ validated?: any;
14
+ }
15
+ declare const FormGroupContainer: React.FC<FormGroupContainerProps>;
16
+ export { FormGroupContainer };
package/dist/index.js ADDED
@@ -0,0 +1,40 @@
1
+ var React = require('react');
2
+ var reactCore = require('@patternfly/react-core');
3
+
4
+ function _objectWithoutPropertiesLoose(source, excluded) {
5
+ if (source == null) return {};
6
+ var target = {};
7
+ var sourceKeys = Object.keys(source);
8
+ var key, i;
9
+
10
+ for (i = 0; i < sourceKeys.length; i++) {
11
+ key = sourceKeys[i];
12
+ if (excluded.indexOf(key) >= 0) continue;
13
+ target[key] = source[key];
14
+ }
15
+
16
+ return target;
17
+ }
18
+
19
+ var _excluded = ["children", "helperTextInvalid", "isValid", "helperText", "labelIcon"];
20
+
21
+ var FormGroupContainer = function FormGroupContainer(_ref) {
22
+ var children = _ref.children,
23
+ helperTextInvalid = _ref.helperTextInvalid,
24
+ isValid = _ref.isValid,
25
+ helperText = _ref.helperText,
26
+ labelIcon = _ref.labelIcon,
27
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
28
+
29
+ return React.createElement(reactCore.FormGroup, Object.assign({
30
+ className: 'form-group',
31
+ helperTextInvalid: helperTextInvalid,
32
+ helperText: helperText,
33
+ validated: isValid ? reactCore.ValidatedOptions["default"] : reactCore.ValidatedOptions.error
34
+ }, labelIcon && {
35
+ labelIcon: labelIcon
36
+ }, rest), children);
37
+ };
38
+
39
+ exports.FormGroupContainer = FormGroupContainer;
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport { FormGroup, ValidatedOptions } from '@patternfly/react-core';\n\nimport './style.scss';\n\ninterface FormGroupContainerProps {\n isValid?: boolean;\n helperTextInvalid?: string;\n fieldId: string;\n label?: string;\n labelIcon?: any;\n children: React.ReactNode;\n className?: string;\n isRequired?: boolean;\n helperText?: string;\n validated?: any;\n}\n\nconst FormGroupContainer: React.FC<FormGroupContainerProps> = ({\n children,\n helperTextInvalid,\n isValid,\n helperText,\n labelIcon,\n ...rest\n}) => {\n return (\n <FormGroup\n className='form-group'\n helperTextInvalid={helperTextInvalid}\n helperText={helperText}\n validated={isValid ? ValidatedOptions.default : ValidatedOptions.error}\n {...(labelIcon && { labelIcon: labelIcon })}\n {...rest}\n >\n {children}\n </FormGroup>\n );\n};\n\nexport { FormGroupContainer };\n"],"names":["FormGroupContainer","children","helperTextInvalid","isValid","helperText","labelIcon","rest","React","FormGroup","className","validated","ValidatedOptions","error"],"mappings":";;;;;;;;;;;;;;;;;;;;IAkBMA,kBAAkB,GAAsC,SAAxDA,kBAAwD;MAC5DC,gBAAAA;MACAC,yBAAAA;MACAC,eAAAA;MACAC,kBAAAA;MACAC,iBAAAA;MACGC;;AAEH,SACEC,mBAAA,CAACC,mBAAD;AACEC,IAAAA,SAAS,EAAC;AACVP,IAAAA,iBAAiB,EAAEA;AACnBE,IAAAA,UAAU,EAAEA;AACZM,IAAAA,SAAS,EAAEP,OAAO,GAAGQ,0BAAgB,WAAnB,GAA8BA,0BAAgB,CAACC;KAC5DP,SAAS,IAAI;AAAEA,IAAAA,SAAS,EAAEA;AAAb,KACdC,KANN,EAQGL,QARH,CADF;AAYD;;;;"}
@@ -0,0 +1,40 @@
1
+ import { createElement } from 'react';
2
+ import { FormGroup, ValidatedOptions } from '@patternfly/react-core';
3
+
4
+ function _objectWithoutPropertiesLoose(source, excluded) {
5
+ if (source == null) return {};
6
+ var target = {};
7
+ var sourceKeys = Object.keys(source);
8
+ var key, i;
9
+
10
+ for (i = 0; i < sourceKeys.length; i++) {
11
+ key = sourceKeys[i];
12
+ if (excluded.indexOf(key) >= 0) continue;
13
+ target[key] = source[key];
14
+ }
15
+
16
+ return target;
17
+ }
18
+
19
+ var _excluded = ["children", "helperTextInvalid", "isValid", "helperText", "labelIcon"];
20
+
21
+ var FormGroupContainer = function FormGroupContainer(_ref) {
22
+ var children = _ref.children,
23
+ helperTextInvalid = _ref.helperTextInvalid,
24
+ isValid = _ref.isValid,
25
+ helperText = _ref.helperText,
26
+ labelIcon = _ref.labelIcon,
27
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
28
+
29
+ return createElement(FormGroup, Object.assign({
30
+ className: 'form-group',
31
+ helperTextInvalid: helperTextInvalid,
32
+ helperText: helperText,
33
+ validated: isValid ? ValidatedOptions["default"] : ValidatedOptions.error
34
+ }, labelIcon && {
35
+ labelIcon: labelIcon
36
+ }, rest), children);
37
+ };
38
+
39
+ export { FormGroupContainer };
40
+ //# sourceMappingURL=index.modern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.modern.js","sources":["../src/index.tsx"],"sourcesContent":["import * as React from 'react';\nimport { FormGroup, ValidatedOptions } from '@patternfly/react-core';\n\nimport './style.scss';\n\ninterface FormGroupContainerProps {\n isValid?: boolean;\n helperTextInvalid?: string;\n fieldId: string;\n label?: string;\n labelIcon?: any;\n children: React.ReactNode;\n className?: string;\n isRequired?: boolean;\n helperText?: string;\n validated?: any;\n}\n\nconst FormGroupContainer: React.FC<FormGroupContainerProps> = ({\n children,\n helperTextInvalid,\n isValid,\n helperText,\n labelIcon,\n ...rest\n}) => {\n return (\n <FormGroup\n className='form-group'\n helperTextInvalid={helperTextInvalid}\n helperText={helperText}\n validated={isValid ? ValidatedOptions.default : ValidatedOptions.error}\n {...(labelIcon && { labelIcon: labelIcon })}\n {...rest}\n >\n {children}\n </FormGroup>\n );\n};\n\nexport { FormGroupContainer };\n"],"names":["FormGroupContainer","children","helperTextInvalid","isValid","helperText","labelIcon","rest","React","FormGroup","className","validated","ValidatedOptions","error"],"mappings":";;;;;;;;;;;;;;;;;;;;IAkBMA,kBAAkB,GAAsC,SAAxDA,kBAAwD;MAC5DC,gBAAAA;MACAC,yBAAAA;MACAC,eAAAA;MACAC,kBAAAA;MACAC,iBAAAA;MACGC;;AAEH,SACEC,aAAA,CAACC,SAAD;AACEC,IAAAA,SAAS,EAAC;AACVP,IAAAA,iBAAiB,EAAEA;AACnBE,IAAAA,UAAU,EAAEA;AACZM,IAAAA,SAAS,EAAEP,OAAO,GAAGQ,gBAAgB,WAAnB,GAA8BA,gBAAgB,CAACC;KAC5DP,SAAS,IAAI;AAAEA,IAAAA,SAAS,EAAEA;AAAb,KACdC,KANN,EAQGL,QARH,CADF;AAYD;;;;"}
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@rhc-shared-components/form-group-container",
3
+ "version": "0.1.0",
4
+ "description": "Form group container for Red Hat certified technology apps",
5
+ "author": "gautamkrishnar",
6
+ "license": "MIT",
7
+ "repository": "https://gitlab.cee.redhat.com/dxp/customer-portal/rhc-shared-components",
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.modern.js",
10
+ "source": "src/index.tsx",
11
+ "engines": {
12
+ "node": ">=10"
13
+ },
14
+ "scripts": {
15
+ "build": "microbundle-crl --no-compress --format modern,cjs",
16
+ "start": "microbundle-crl watch --no-compress --format modern,cjs",
17
+ "prepare": "run-s build",
18
+ "test": "run-s test:unit test:lint test:build",
19
+ "test:build": "run-s build",
20
+ "test:lint": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
21
+ "test:unit": "cross-env CI=1 react-scripts test --env=jsdom",
22
+ "test:watch": "react-scripts test --env=jsdom",
23
+ "predeploy": "cd example && yarn install && yarn run build",
24
+ "deploy": "gh-pages -d example/build"
25
+ },
26
+ "peerDependencies": {
27
+ "@patternfly/react-core": ">=4.101.3",
28
+ "react": "^16.0.0"
29
+ },
30
+ "devDependencies": {
31
+ "@testing-library/jest-dom": "^4.2.4",
32
+ "@testing-library/react": "^9.5.0",
33
+ "@testing-library/user-event": "^7.2.1",
34
+ "@types/jest": "^25.1.4",
35
+ "@types/node": "^12.12.38",
36
+ "@types/react": "^16.9.27",
37
+ "@types/react-dom": "^16.9.7",
38
+ "@typescript-eslint/eslint-plugin": "^2.26.0",
39
+ "@typescript-eslint/parser": "^2.26.0",
40
+ "babel-eslint": "^10.0.3",
41
+ "cross-env": "^7.0.2",
42
+ "eslint": "^6.8.0",
43
+ "eslint-config-prettier": "^6.7.0",
44
+ "eslint-config-standard": "^14.1.0",
45
+ "eslint-config-standard-react": "^9.2.0",
46
+ "eslint-plugin-import": "^2.18.2",
47
+ "eslint-plugin-node": "^11.0.0",
48
+ "eslint-plugin-prettier": "^3.1.1",
49
+ "eslint-plugin-promise": "^4.2.1",
50
+ "eslint-plugin-react": "^7.17.0",
51
+ "eslint-plugin-standard": "^4.0.1",
52
+ "gh-pages": "^2.2.0",
53
+ "microbundle-crl": "^0.13.10",
54
+ "node-sass": "^6.0.1",
55
+ "npm-run-all": "^4.1.5",
56
+ "prettier": "^2.0.4",
57
+ "react": "^16.13.1",
58
+ "react-dom": "^16.13.1",
59
+ "react-scripts": "^3.4.1",
60
+ "typescript": "^3.7.5"
61
+ },
62
+ "files": [
63
+ "dist"
64
+ ],
65
+ "dependencies": {
66
+ "@patternfly/react-core": "^4.101.3"
67
+ },
68
+ "publishConfig": {
69
+ "access": "public"
70
+ },
71
+ "gitHead": "2e1440e2a6888467c9c75d2dcb7a03659b8e05f3"
72
+ }