@bluecateng/pelagos-forms 4.0.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/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) BlueCat Networks Inc.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # @bluecateng/pelagos-forms [![GitHub license](https://img.shields.io/badge/license-ISC-blue.svg)](https://github.com/bluecatengineering/pelagos-packages/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/@bluecateng/pelagos-forms.svg?style=flat)](https://www.npmjs.com/package/@bluecateng/pelagos-forms)
2
+
3
+ Form components.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i -S @bluecateng/pelagos-forms
9
+ ```
@@ -0,0 +1,10 @@
1
+ import { useCallback } from 'react';
2
+ import { CheckBox } from '@bluecateng/pelagos';
3
+ import { connect } from '@bluecateng/auto-forms';
4
+ export default connect(CheckBox, ({
5
+ value,
6
+ setValue
7
+ }) => ({
8
+ checked: value,
9
+ onChange: useCallback(() => setValue(!value), [value, setValue])
10
+ }));
@@ -0,0 +1,11 @@
1
+ import { DropDownField } from '@bluecateng/pelagos';
2
+ import { connect } from '@bluecateng/auto-forms';
3
+ export default connect(DropDownField, ({
4
+ value,
5
+ error,
6
+ setValue
7
+ }) => ({
8
+ value,
9
+ error,
10
+ onChange: setValue
11
+ }));
@@ -0,0 +1,13 @@
1
+ import { connect } from '@bluecateng/auto-forms';
2
+ import { DropZone } from '@bluecateng/pelagos';
3
+ export const mapState = ({
4
+ extra,
5
+ error,
6
+ setValue,
7
+ setExtra
8
+ }) => ({
9
+ fileName: extra,
10
+ error,
11
+ onDrop: (...args) => args.length === 1 ? (setExtra(args[0].name), setValue(args[0])) : (setExtra(args[0]), setValue(args[1]))
12
+ });
13
+ export default connect(DropZone, mapState);
@@ -0,0 +1,15 @@
1
+ import { ListInput } from '@bluecateng/pelagos';
2
+ import { connect } from '@bluecateng/auto-forms';
3
+ export default connect(ListInput, ({
4
+ value,
5
+ error,
6
+ setValue,
7
+ setError,
8
+ setExtra
9
+ }) => ({
10
+ list: value,
11
+ error,
12
+ onListChange: setValue,
13
+ onTextChange: setExtra,
14
+ onErrorChange: setError
15
+ }));
@@ -0,0 +1,9 @@
1
+ import { RadioGroup } from '@bluecateng/pelagos';
2
+ import { connect } from '@bluecateng/auto-forms';
3
+ export default connect(RadioGroup, ({
4
+ value,
5
+ setValue
6
+ }) => ({
7
+ value,
8
+ onChange: setValue
9
+ }));
@@ -0,0 +1,28 @@
1
+ import PropTypes from 'prop-types';
2
+ import { Button } from '@bluecateng/pelagos';
3
+ import { useFormState } from '@bluecateng/auto-forms';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const FormSubmit = ({
6
+ ...props
7
+ }) => {
8
+ const {
9
+ isChanged,
10
+ hasErrors
11
+ } = useFormState();
12
+ return /*#__PURE__*/_jsx(Button, {
13
+ ...props,
14
+ type: isChanged() ? 'primary' : 'tertiary',
15
+ disabled: hasErrors()
16
+ });
17
+ };
18
+ FormSubmit.propTypes = {
19
+ id: PropTypes.string,
20
+ componentId: PropTypes.string,
21
+ text: PropTypes.string,
22
+ className: PropTypes.string,
23
+ tooltipText: PropTypes.string,
24
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
25
+ onFocus: PropTypes.func,
26
+ onBlur: PropTypes.func
27
+ };
28
+ export default FormSubmit;
@@ -0,0 +1,13 @@
1
+ import { TagInputField } from '@bluecateng/pelagos';
2
+ import { connect } from '@bluecateng/auto-forms';
3
+ export default connect(TagInputField, ({
4
+ value,
5
+ error,
6
+ setValue,
7
+ setError
8
+ }) => ({
9
+ tags: value,
10
+ error,
11
+ onChange: setValue,
12
+ onError: setError
13
+ }));
@@ -0,0 +1,11 @@
1
+ import { TextAreaField } from '@bluecateng/pelagos';
2
+ import { connect } from '@bluecateng/auto-forms';
3
+ export default connect(TextAreaField, ({
4
+ value,
5
+ error,
6
+ setValue
7
+ }) => ({
8
+ value,
9
+ error,
10
+ onChange: setValue
11
+ }));
@@ -0,0 +1,11 @@
1
+ import { TextInputField } from '@bluecateng/pelagos';
2
+ import { connect } from '@bluecateng/auto-forms';
3
+ export default connect(TextInputField, ({
4
+ value,
5
+ error,
6
+ setValue
7
+ }) => ({
8
+ value,
9
+ error,
10
+ onChange: setValue
11
+ }));
@@ -0,0 +1,9 @@
1
+ import { ToggleField } from '@bluecateng/pelagos';
2
+ import { connect } from '@bluecateng/auto-forms';
3
+ export default connect(ToggleField, ({
4
+ value,
5
+ setValue
6
+ }) => ({
7
+ value,
8
+ onChange: setValue
9
+ }));
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export { default as FormCheckBox } from './components/FormCheckBox';
2
+ export { default as FormDropDown } from './components/FormDropDown';
3
+ export { default as FormDropZone } from './components/FormDropZone';
4
+ export { default as FormTagInput } from './components/FormTagInput';
5
+ export { default as FormTextArea } from './components/FormTextArea';
6
+ export { default as FormTextInput } from './components/FormTextInput';
7
+ export { default as FormToggle } from './components/FormToggle';
8
+ export { default as FormListInput } from './components/FormListInput';
9
+ export { default as FormRadioGroup } from './components/FormRadioGroup';
10
+ export { default as FormSubmit } from './components/FormSubmit';
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@bluecateng/pelagos-forms",
3
+ "version": "4.0.0",
4
+ "description": "Form components",
5
+ "license": "ISC",
6
+ "sideEffects": false,
7
+ "scripts": {
8
+ "build": "rm -rf dist && babel -D -d dist --env-name production --root-mode upward src",
9
+ "prepack": "npm run build"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git@github.com:bluecatengineering/pelagos-packages.git",
14
+ "directory": "packages/pelagos-forms"
15
+ },
16
+ "keywords": [
17
+ "react"
18
+ ],
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "exports": "./dist/index.js",
23
+ "peerDependencies": {
24
+ "@bluecateng/auto-forms": ">= 0",
25
+ "@bluecateng/pelagos": ">= 9"
26
+ },
27
+ "gitHead": "6e7333efa2db55e63e0248197fe07edfb69373d7"
28
+ }