@digigov/form 0.6.0 → 0.6.3
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/CHANGELOG.md +23 -1
- package/Field/index.js +2 -1
- package/es/Field/index.js +2 -1
- package/es/index.js +16 -8
- package/es/inputs/Checkboxes/index.js +1 -3
- package/es/inputs/DateInput/index.js +1 -2
- package/es/inputs/FileInput/index.js +20 -9
- package/es/inputs/Input/index.js +1 -1
- package/es/inputs/Select/index.js +3 -8
- package/esm/Field/index.js +2 -1
- package/esm/index.js +17 -9
- package/esm/inputs/Checkboxes/index.js +1 -3
- package/esm/inputs/DateInput/index.js +1 -2
- package/esm/inputs/FileInput/index.js +20 -9
- package/esm/inputs/Input/index.js +1 -1
- package/esm/inputs/Select/index.js +3 -8
- package/index.js +15 -9
- package/inputs/Checkboxes/index.js +2 -1
- package/inputs/DateInput/index.js +2 -1
- package/inputs/FileInput/index.js +23 -9
- package/inputs/Input/index.js +2 -1
- package/inputs/Select/index.js +3 -7
- package/libs/form/src/index.d.ts +1 -1
- package/libs/form/src/inputs/Checkboxes/index.d.ts +1 -1
- package/libs/form/src/inputs/DateInput/index.d.ts +1 -1
- package/libs/form/src/inputs/FileInput/index.d.ts +1 -1
- package/libs/form/src/inputs/Input/index.d.ts +1 -1
- package/libs/ui/src/app/I18nText.d.ts +10 -0
- package/libs/ui/src/app/i18n.d.ts +2 -0
- package/libs/ui/src/app/index.d.ts +1 -0
- package/libs/ui/src/locales/el.d.ts +7 -0
- package/libs-ui/react-core/src/AccordionSection/index.d.ts +1 -0
- package/package.json +2 -2
- package/libs-ui/react-core/src/FileUpload/index.d.ts +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
# Change Log - @digigov/form
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 18 Apr 2022 13:00:33 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.6.3
|
|
6
|
+
Mon, 18 Apr 2022 13:00:33 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Do a minor refactor in React components to generate documentation more easily
|
|
11
|
+
|
|
12
|
+
## 0.6.2
|
|
13
|
+
Thu, 14 Apr 2022 12:32:51 GMT
|
|
14
|
+
|
|
15
|
+
### Patches
|
|
16
|
+
|
|
17
|
+
- fix FileInput component with input and custom button, fix Field component to add children inside fieldset
|
|
18
|
+
- Remove empty option from Select component
|
|
19
|
+
|
|
20
|
+
## 0.6.1
|
|
21
|
+
Tue, 05 Apr 2022 12:23:28 GMT
|
|
22
|
+
|
|
23
|
+
### Patches
|
|
24
|
+
|
|
25
|
+
- Allow passing custom props on form element
|
|
4
26
|
|
|
5
27
|
## 0.6.0
|
|
6
28
|
Wed, 30 Mar 2022 12:28:30 GMT
|
package/Field/index.js
CHANGED
|
@@ -64,6 +64,7 @@ var FIELD_COMPONENTS = {
|
|
|
64
64
|
component: _Input["default"]
|
|
65
65
|
},
|
|
66
66
|
file: {
|
|
67
|
+
wrapper: 'fieldset',
|
|
67
68
|
component: _FileInput["default"]
|
|
68
69
|
},
|
|
69
70
|
date: {
|
|
@@ -103,7 +104,7 @@ var FieldContainer = function FieldContainer(_ref) {
|
|
|
103
104
|
error: !!error
|
|
104
105
|
}, /*#__PURE__*/_react["default"].createElement(_Fieldset["default"], null, /*#__PURE__*/_react["default"].createElement(_FieldsetLegend["default"], {
|
|
105
106
|
size: "s"
|
|
106
|
-
}, label && label.primary, label && label.secondary && /*#__PURE__*/_react["default"].createElement(_Hint["default"], null, t(label.secondary)), error && /*#__PURE__*/_react["default"].createElement(_ErrorMessage["default"], null, t((error === null || error === void 0 ? void 0 : error.message) || '')))
|
|
107
|
+
}, label && label.primary, label && label.secondary && /*#__PURE__*/_react["default"].createElement(_Hint["default"], null, t(label.secondary)), error && /*#__PURE__*/_react["default"].createElement(_ErrorMessage["default"], null, t((error === null || error === void 0 ? void 0 : error.message) || ''))), children));
|
|
107
108
|
} else {
|
|
108
109
|
return /*#__PURE__*/_react["default"].createElement(_Field["default"], {
|
|
109
110
|
error: !!error
|
package/es/Field/index.js
CHANGED
|
@@ -28,6 +28,7 @@ var FIELD_COMPONENTS = {
|
|
|
28
28
|
component: Input
|
|
29
29
|
},
|
|
30
30
|
file: {
|
|
31
|
+
wrapper: 'fieldset',
|
|
31
32
|
component: FileInput
|
|
32
33
|
},
|
|
33
34
|
date: {
|
|
@@ -67,7 +68,7 @@ var FieldContainer = function FieldContainer(_ref) {
|
|
|
67
68
|
error: !!error
|
|
68
69
|
}, /*#__PURE__*/React.createElement(CoreFieldset, null, /*#__PURE__*/React.createElement(FieldsetLegend, {
|
|
69
70
|
size: "s"
|
|
70
|
-
}, label && label.primary, label && label.secondary && /*#__PURE__*/React.createElement(Hint, null, t(label.secondary)), error && /*#__PURE__*/React.createElement(ErrorMessage, null, t((error === null || error === void 0 ? void 0 : error.message) || '')))
|
|
71
|
+
}, label && label.primary, label && label.secondary && /*#__PURE__*/React.createElement(Hint, null, t(label.secondary)), error && /*#__PURE__*/React.createElement(ErrorMessage, null, t((error === null || error === void 0 ? void 0 : error.message) || ''))), children));
|
|
71
72
|
} else {
|
|
72
73
|
return /*#__PURE__*/React.createElement(CoreField, {
|
|
73
74
|
error: !!error
|
package/es/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
3
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["onSubmit", "children", "registerField", "fieldsMap", "fieldsetsMap", "resolver", "mode", "initial", "reValidateMode", "shouldFocusError", "criteriaMode", "componentRegistry"],
|
|
6
|
+
_excluded2 = ["fields", "fieldsets", "initial", "onSubmit", "children", "reValidateMode", "mode", "shouldFocusError", "criteriaMode", "auto", "validatorRegistry", "componentRegistry"];
|
|
4
7
|
|
|
5
8
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
9
|
import React, { createContext, useCallback, useRef } from 'react';
|
|
@@ -28,7 +31,9 @@ export var FormBase = function FormBase(_ref) {
|
|
|
28
31
|
reValidateMode = _ref.reValidateMode,
|
|
29
32
|
shouldFocusError = _ref.shouldFocusError,
|
|
30
33
|
criteriaMode = _ref.criteriaMode,
|
|
31
|
-
componentRegistry = _ref.componentRegistry
|
|
34
|
+
componentRegistry = _ref.componentRegistry,
|
|
35
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
+
|
|
32
37
|
var form = useForm({
|
|
33
38
|
resolver: resolver,
|
|
34
39
|
mode: mode,
|
|
@@ -58,9 +63,9 @@ export var FormBase = function FormBase(_ref) {
|
|
|
58
63
|
};
|
|
59
64
|
return /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
60
65
|
value: ctx
|
|
61
|
-
}, /*#__PURE__*/React.createElement("form", {
|
|
66
|
+
}, /*#__PURE__*/React.createElement("form", _extends({
|
|
62
67
|
onSubmit: form.handleSubmit(handleSubmit)
|
|
63
|
-
}, /*#__PURE__*/React.createElement(Grid, {
|
|
68
|
+
}, props), /*#__PURE__*/React.createElement(Grid, {
|
|
64
69
|
container: true
|
|
65
70
|
}, /*#__PURE__*/React.createElement(Grid, {
|
|
66
71
|
item: true,
|
|
@@ -86,7 +91,9 @@ export function FormBuilder(_ref2) {
|
|
|
86
91
|
_ref2$auto = _ref2.auto,
|
|
87
92
|
auto = _ref2$auto === void 0 ? false : _ref2$auto,
|
|
88
93
|
validatorRegistry = _ref2.validatorRegistry,
|
|
89
|
-
componentRegistry = _ref2.componentRegistry
|
|
94
|
+
componentRegistry = _ref2.componentRegistry,
|
|
95
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
96
|
+
|
|
90
97
|
var fieldsState = useRef(fields);
|
|
91
98
|
var setFieldsState = useCallback(function (newFields) {
|
|
92
99
|
fieldsState.current = newFields;
|
|
@@ -128,7 +135,7 @@ export function FormBuilder(_ref2) {
|
|
|
128
135
|
}
|
|
129
136
|
}
|
|
130
137
|
|
|
131
|
-
return /*#__PURE__*/React.createElement(FormBase, {
|
|
138
|
+
return /*#__PURE__*/React.createElement(FormBase, _extends({
|
|
132
139
|
resolver: resolver,
|
|
133
140
|
fieldsetsMap: fieldsetsMap,
|
|
134
141
|
fieldsMap: fieldsMap,
|
|
@@ -137,9 +144,10 @@ export function FormBuilder(_ref2) {
|
|
|
137
144
|
reValidateMode: reValidateMode,
|
|
138
145
|
mode: mode,
|
|
139
146
|
shouldFocusError: shouldFocusError,
|
|
140
|
-
criteriaMode: criteriaMode
|
|
147
|
+
criteriaMode: criteriaMode
|
|
148
|
+
}, props, {
|
|
141
149
|
onSubmit: onSubmit,
|
|
142
150
|
componentRegistry: componentRegistry
|
|
143
|
-
}, fieldChildren, children);
|
|
151
|
+
}), fieldChildren, children);
|
|
144
152
|
}
|
|
145
153
|
export default FormBuilder;
|
|
@@ -4,8 +4,7 @@ import { useTranslation } from '@digigov/ui/app/i18n';
|
|
|
4
4
|
import CoreCheckboxes from '@digigov/react-core/Checkbox';
|
|
5
5
|
import CheckboxItem from '@digigov/react-core/CheckboxItem';
|
|
6
6
|
import Hint from '@digigov/react-core/Hint';
|
|
7
|
-
|
|
8
|
-
var Checkboxes = function Checkboxes(_ref) {
|
|
7
|
+
export var Checkboxes = function Checkboxes(_ref) {
|
|
9
8
|
var name = _ref.name,
|
|
10
9
|
onChange = _ref.onChange,
|
|
11
10
|
value = _ref.value,
|
|
@@ -52,5 +51,4 @@ var Checkboxes = function Checkboxes(_ref) {
|
|
|
52
51
|
}, option), option.label && option.label.primary && t(option.label.primary) || value, option.label && option.label.secondary && /*#__PURE__*/React.createElement(Hint, null, t(option.label.secondary)));
|
|
53
52
|
}));
|
|
54
53
|
};
|
|
55
|
-
|
|
56
54
|
export default Checkboxes;
|
|
@@ -93,7 +93,7 @@ var DatePart = function DatePart(_ref) {
|
|
|
93
93
|
return /*#__PURE__*/React.createElement(CoreDateInputItem, props, label);
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
var DateInput = function DateInput(_ref2) {
|
|
96
|
+
export var DateInput = function DateInput(_ref2) {
|
|
97
97
|
var name = _ref2.name,
|
|
98
98
|
type = _ref2.type,
|
|
99
99
|
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
@@ -145,5 +145,4 @@ var DateInput = function DateInput(_ref2) {
|
|
|
145
145
|
disabled: props.disabled
|
|
146
146
|
}));
|
|
147
147
|
};
|
|
148
|
-
|
|
149
148
|
export default DateInput;
|
|
@@ -1,28 +1,39 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
5
|
+
import Paragraph from '@digigov/ui/typography/Paragraph';
|
|
6
|
+
import CoreHint from '@digigov/react-core/Hint';
|
|
5
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
var FileInput = /*#__PURE__*/React.forwardRef(function FileInput(_ref, ref) {
|
|
8
|
+
export var FileInput = /*#__PURE__*/React.forwardRef(function FileInput(_ref, ref) {
|
|
7
9
|
var name = _ref.name,
|
|
8
10
|
_ref$extra = _ref.extra,
|
|
9
11
|
extra = _ref$extra === void 0 ? {} : _ref$extra,
|
|
10
12
|
disabled = _ref.disabled;
|
|
11
13
|
|
|
14
|
+
var _useTranslation = useTranslation(),
|
|
15
|
+
t = _useTranslation.t;
|
|
16
|
+
|
|
12
17
|
var _useState = useState([]),
|
|
13
18
|
_useState2 = _slicedToArray(_useState, 2),
|
|
14
19
|
files = _useState2[0],
|
|
15
20
|
setFiles = _useState2[1];
|
|
16
21
|
|
|
17
|
-
var filesLabel = extra.multiple ? 'αρχεία' : 'αρχείο';
|
|
18
22
|
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
-
className: extra.className
|
|
20
|
-
}, /*#__PURE__*/React.createElement(
|
|
23
|
+
className: clsx(extra.className, files.length > 0 && 'govgr-uploaded-file', true && 'govgr-field-file')
|
|
24
|
+
}, files.length ? /*#__PURE__*/React.createElement(Paragraph, null, /*#__PURE__*/React.createElement("b", null, t('upload.file'), ":"), " ", "".concat(files.join(', '))) : /*#__PURE__*/React.createElement(CoreHint, null, t('upload.no_file')), /*#__PURE__*/React.createElement("label", {
|
|
25
|
+
tabIndex: 0,
|
|
26
|
+
role: "button",
|
|
27
|
+
className: clsx(extra.className, files.length === 0 && ['govgr-btn', 'govgr-btn-primary'], files.length > 0 && 'govgr-link', true && 'govgr-label-file')
|
|
28
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
21
29
|
ref: ref,
|
|
30
|
+
type: "file",
|
|
22
31
|
name: name,
|
|
23
|
-
id: name,
|
|
24
32
|
disabled: disabled,
|
|
25
|
-
|
|
33
|
+
style: {
|
|
34
|
+
display: 'none'
|
|
35
|
+
},
|
|
36
|
+
className: "govgr-file-upload",
|
|
26
37
|
onChange: function onChange(e) {
|
|
27
38
|
var target = e.target;
|
|
28
39
|
var selectedFiles = Array.from(target.files).map(function (_ref2) {
|
|
@@ -31,6 +42,6 @@ var FileInput = /*#__PURE__*/React.forwardRef(function FileInput(_ref, ref) {
|
|
|
31
42
|
});
|
|
32
43
|
setFiles(selectedFiles);
|
|
33
44
|
}
|
|
34
|
-
}),
|
|
45
|
+
}), files.length ? t('upload.change_file') : t('upload.choose_file')));
|
|
35
46
|
});
|
|
36
47
|
export default FileInput;
|
package/es/inputs/Input/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var TYPES_MAP = {
|
|
|
10
10
|
text: 'text',
|
|
11
11
|
date: 'date'
|
|
12
12
|
};
|
|
13
|
-
var Input = /*#__PURE__*/React.forwardRef(function WrappedInput(_ref, ref) {
|
|
13
|
+
export var Input = /*#__PURE__*/React.forwardRef(function WrappedInput(_ref, ref) {
|
|
14
14
|
var name = _ref.name,
|
|
15
15
|
type = _ref.type,
|
|
16
16
|
extra = _ref.extra,
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import CoreSelect from '@digigov/react-core/Select';
|
|
3
3
|
import SelectOption from '@digigov/react-core/SelectOption';
|
|
4
|
-
|
|
5
|
-
var _ref2 = /*#__PURE__*/React.createElement(SelectOption, {
|
|
6
|
-
value: ""
|
|
7
|
-
});
|
|
8
|
-
|
|
9
4
|
export var Select = /*#__PURE__*/React.forwardRef(function WrappedSelect(_ref, ref) {
|
|
10
5
|
var name = _ref.name,
|
|
11
6
|
_ref$extra = _ref.extra,
|
|
@@ -17,9 +12,9 @@ export var Select = /*#__PURE__*/React.forwardRef(function WrappedSelect(_ref, r
|
|
|
17
12
|
ref: ref,
|
|
18
13
|
name: name,
|
|
19
14
|
disabled: disabled
|
|
20
|
-
},
|
|
21
|
-
var value =
|
|
22
|
-
label =
|
|
15
|
+
}, options.map(function (_ref2) {
|
|
16
|
+
var value = _ref2.value,
|
|
17
|
+
label = _ref2.label;
|
|
23
18
|
return /*#__PURE__*/React.createElement(SelectOption, {
|
|
24
19
|
key: value,
|
|
25
20
|
value: value
|
package/esm/Field/index.js
CHANGED
|
@@ -28,6 +28,7 @@ var FIELD_COMPONENTS = {
|
|
|
28
28
|
component: Input
|
|
29
29
|
},
|
|
30
30
|
file: {
|
|
31
|
+
wrapper: 'fieldset',
|
|
31
32
|
component: FileInput
|
|
32
33
|
},
|
|
33
34
|
date: {
|
|
@@ -67,7 +68,7 @@ var FieldContainer = function FieldContainer(_ref) {
|
|
|
67
68
|
error: !!error
|
|
68
69
|
}, /*#__PURE__*/React.createElement(CoreFieldset, null, /*#__PURE__*/React.createElement(FieldsetLegend, {
|
|
69
70
|
size: "s"
|
|
70
|
-
}, label && label.primary, label && label.secondary && /*#__PURE__*/React.createElement(Hint, null, t(label.secondary)), error && /*#__PURE__*/React.createElement(ErrorMessage, null, t((error === null || error === void 0 ? void 0 : error.message) || '')))
|
|
71
|
+
}, label && label.primary, label && label.secondary && /*#__PURE__*/React.createElement(Hint, null, t(label.secondary)), error && /*#__PURE__*/React.createElement(ErrorMessage, null, t((error === null || error === void 0 ? void 0 : error.message) || ''))), children));
|
|
71
72
|
} else {
|
|
72
73
|
return /*#__PURE__*/React.createElement(CoreField, {
|
|
73
74
|
error: !!error
|
package/esm/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
/** @license Digigov v0.6.
|
|
1
|
+
/** @license Digigov v0.6.3
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
5
5
|
*/
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
8
7
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
8
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
9
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
10
|
+
var _excluded = ["onSubmit", "children", "registerField", "fieldsMap", "fieldsetsMap", "resolver", "mode", "initial", "reValidateMode", "shouldFocusError", "criteriaMode", "componentRegistry"],
|
|
11
|
+
_excluded2 = ["fields", "fieldsets", "initial", "onSubmit", "children", "reValidateMode", "mode", "shouldFocusError", "criteriaMode", "auto", "validatorRegistry", "componentRegistry"];
|
|
9
12
|
|
|
10
13
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
11
14
|
import React, { createContext, useCallback, useRef } from 'react';
|
|
@@ -33,7 +36,9 @@ export var FormBase = function FormBase(_ref) {
|
|
|
33
36
|
reValidateMode = _ref.reValidateMode,
|
|
34
37
|
shouldFocusError = _ref.shouldFocusError,
|
|
35
38
|
criteriaMode = _ref.criteriaMode,
|
|
36
|
-
componentRegistry = _ref.componentRegistry
|
|
39
|
+
componentRegistry = _ref.componentRegistry,
|
|
40
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
41
|
+
|
|
37
42
|
var form = useForm({
|
|
38
43
|
resolver: resolver,
|
|
39
44
|
mode: mode,
|
|
@@ -63,9 +68,9 @@ export var FormBase = function FormBase(_ref) {
|
|
|
63
68
|
};
|
|
64
69
|
return /*#__PURE__*/React.createElement(FormContext.Provider, {
|
|
65
70
|
value: ctx
|
|
66
|
-
}, /*#__PURE__*/React.createElement("form", {
|
|
71
|
+
}, /*#__PURE__*/React.createElement("form", _extends({
|
|
67
72
|
onSubmit: form.handleSubmit(handleSubmit)
|
|
68
|
-
}, /*#__PURE__*/React.createElement(Grid, {
|
|
73
|
+
}, props), /*#__PURE__*/React.createElement(Grid, {
|
|
69
74
|
container: true
|
|
70
75
|
}, /*#__PURE__*/React.createElement(Grid, {
|
|
71
76
|
item: true,
|
|
@@ -91,7 +96,9 @@ export function FormBuilder(_ref2) {
|
|
|
91
96
|
_ref2$auto = _ref2.auto,
|
|
92
97
|
auto = _ref2$auto === void 0 ? false : _ref2$auto,
|
|
93
98
|
validatorRegistry = _ref2.validatorRegistry,
|
|
94
|
-
componentRegistry = _ref2.componentRegistry
|
|
99
|
+
componentRegistry = _ref2.componentRegistry,
|
|
100
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
101
|
+
|
|
95
102
|
var fieldsState = useRef(fields);
|
|
96
103
|
var setFieldsState = useCallback(function (newFields) {
|
|
97
104
|
fieldsState.current = newFields;
|
|
@@ -133,7 +140,7 @@ export function FormBuilder(_ref2) {
|
|
|
133
140
|
}
|
|
134
141
|
}
|
|
135
142
|
|
|
136
|
-
return /*#__PURE__*/React.createElement(FormBase, {
|
|
143
|
+
return /*#__PURE__*/React.createElement(FormBase, _extends({
|
|
137
144
|
resolver: resolver,
|
|
138
145
|
fieldsetsMap: fieldsetsMap,
|
|
139
146
|
fieldsMap: fieldsMap,
|
|
@@ -142,9 +149,10 @@ export function FormBuilder(_ref2) {
|
|
|
142
149
|
reValidateMode: reValidateMode,
|
|
143
150
|
mode: mode,
|
|
144
151
|
shouldFocusError: shouldFocusError,
|
|
145
|
-
criteriaMode: criteriaMode
|
|
152
|
+
criteriaMode: criteriaMode
|
|
153
|
+
}, props, {
|
|
146
154
|
onSubmit: onSubmit,
|
|
147
155
|
componentRegistry: componentRegistry
|
|
148
|
-
}, fieldChildren, children);
|
|
156
|
+
}), fieldChildren, children);
|
|
149
157
|
}
|
|
150
158
|
export default FormBuilder;
|
|
@@ -4,8 +4,7 @@ import { useTranslation } from '@digigov/ui/app/i18n';
|
|
|
4
4
|
import CoreCheckboxes from '@digigov/react-core/Checkbox';
|
|
5
5
|
import CheckboxItem from '@digigov/react-core/CheckboxItem';
|
|
6
6
|
import Hint from '@digigov/react-core/Hint';
|
|
7
|
-
|
|
8
|
-
var Checkboxes = function Checkboxes(_ref) {
|
|
7
|
+
export var Checkboxes = function Checkboxes(_ref) {
|
|
9
8
|
var name = _ref.name,
|
|
10
9
|
onChange = _ref.onChange,
|
|
11
10
|
value = _ref.value,
|
|
@@ -52,5 +51,4 @@ var Checkboxes = function Checkboxes(_ref) {
|
|
|
52
51
|
}, option), option.label && option.label.primary && t(option.label.primary) || value, option.label && option.label.secondary && /*#__PURE__*/React.createElement(Hint, null, t(option.label.secondary)));
|
|
53
52
|
}));
|
|
54
53
|
};
|
|
55
|
-
|
|
56
54
|
export default Checkboxes;
|
|
@@ -93,7 +93,7 @@ var DatePart = function DatePart(_ref) {
|
|
|
93
93
|
return /*#__PURE__*/React.createElement(CoreDateInputItem, props, label);
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
var DateInput = function DateInput(_ref2) {
|
|
96
|
+
export var DateInput = function DateInput(_ref2) {
|
|
97
97
|
var name = _ref2.name,
|
|
98
98
|
type = _ref2.type,
|
|
99
99
|
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
@@ -145,5 +145,4 @@ var DateInput = function DateInput(_ref2) {
|
|
|
145
145
|
disabled: props.disabled
|
|
146
146
|
}));
|
|
147
147
|
};
|
|
148
|
-
|
|
149
148
|
export default DateInput;
|
|
@@ -1,28 +1,39 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useTranslation } from '@digigov/ui/app/i18n';
|
|
5
|
+
import Paragraph from '@digigov/ui/typography/Paragraph';
|
|
6
|
+
import CoreHint from '@digigov/react-core/Hint';
|
|
5
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
var FileInput = /*#__PURE__*/React.forwardRef(function FileInput(_ref, ref) {
|
|
8
|
+
export var FileInput = /*#__PURE__*/React.forwardRef(function FileInput(_ref, ref) {
|
|
7
9
|
var name = _ref.name,
|
|
8
10
|
_ref$extra = _ref.extra,
|
|
9
11
|
extra = _ref$extra === void 0 ? {} : _ref$extra,
|
|
10
12
|
disabled = _ref.disabled;
|
|
11
13
|
|
|
14
|
+
var _useTranslation = useTranslation(),
|
|
15
|
+
t = _useTranslation.t;
|
|
16
|
+
|
|
12
17
|
var _useState = useState([]),
|
|
13
18
|
_useState2 = _slicedToArray(_useState, 2),
|
|
14
19
|
files = _useState2[0],
|
|
15
20
|
setFiles = _useState2[1];
|
|
16
21
|
|
|
17
|
-
var filesLabel = extra.multiple ? 'αρχεία' : 'αρχείο';
|
|
18
22
|
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
-
className: extra.className
|
|
20
|
-
}, /*#__PURE__*/React.createElement(
|
|
23
|
+
className: clsx(extra.className, files.length > 0 && 'govgr-uploaded-file', true && 'govgr-field-file')
|
|
24
|
+
}, files.length ? /*#__PURE__*/React.createElement(Paragraph, null, /*#__PURE__*/React.createElement("b", null, t('upload.file'), ":"), " ", "".concat(files.join(', '))) : /*#__PURE__*/React.createElement(CoreHint, null, t('upload.no_file')), /*#__PURE__*/React.createElement("label", {
|
|
25
|
+
tabIndex: 0,
|
|
26
|
+
role: "button",
|
|
27
|
+
className: clsx(extra.className, files.length === 0 && ['govgr-btn', 'govgr-btn-primary'], files.length > 0 && 'govgr-link', true && 'govgr-label-file')
|
|
28
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
21
29
|
ref: ref,
|
|
30
|
+
type: "file",
|
|
22
31
|
name: name,
|
|
23
|
-
id: name,
|
|
24
32
|
disabled: disabled,
|
|
25
|
-
|
|
33
|
+
style: {
|
|
34
|
+
display: 'none'
|
|
35
|
+
},
|
|
36
|
+
className: "govgr-file-upload",
|
|
26
37
|
onChange: function onChange(e) {
|
|
27
38
|
var target = e.target;
|
|
28
39
|
var selectedFiles = Array.from(target.files).map(function (_ref2) {
|
|
@@ -31,6 +42,6 @@ var FileInput = /*#__PURE__*/React.forwardRef(function FileInput(_ref, ref) {
|
|
|
31
42
|
});
|
|
32
43
|
setFiles(selectedFiles);
|
|
33
44
|
}
|
|
34
|
-
}),
|
|
45
|
+
}), files.length ? t('upload.change_file') : t('upload.choose_file')));
|
|
35
46
|
});
|
|
36
47
|
export default FileInput;
|
|
@@ -10,7 +10,7 @@ var TYPES_MAP = {
|
|
|
10
10
|
text: 'text',
|
|
11
11
|
date: 'date'
|
|
12
12
|
};
|
|
13
|
-
var Input = /*#__PURE__*/React.forwardRef(function WrappedInput(_ref, ref) {
|
|
13
|
+
export var Input = /*#__PURE__*/React.forwardRef(function WrappedInput(_ref, ref) {
|
|
14
14
|
var name = _ref.name,
|
|
15
15
|
type = _ref.type,
|
|
16
16
|
extra = _ref.extra,
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import CoreSelect from '@digigov/react-core/Select';
|
|
3
3
|
import SelectOption from '@digigov/react-core/SelectOption';
|
|
4
|
-
|
|
5
|
-
var _ref2 = /*#__PURE__*/React.createElement(SelectOption, {
|
|
6
|
-
value: ""
|
|
7
|
-
});
|
|
8
|
-
|
|
9
4
|
export var Select = /*#__PURE__*/React.forwardRef(function WrappedSelect(_ref, ref) {
|
|
10
5
|
var name = _ref.name,
|
|
11
6
|
_ref$extra = _ref.extra,
|
|
@@ -17,9 +12,9 @@ export var Select = /*#__PURE__*/React.forwardRef(function WrappedSelect(_ref, r
|
|
|
17
12
|
ref: ref,
|
|
18
13
|
name: name,
|
|
19
14
|
disabled: disabled
|
|
20
|
-
},
|
|
21
|
-
var value =
|
|
22
|
-
label =
|
|
15
|
+
}, options.map(function (_ref2) {
|
|
16
|
+
var value = _ref2.value,
|
|
17
|
+
label = _ref2.label;
|
|
23
18
|
return /*#__PURE__*/React.createElement(SelectOption, {
|
|
24
19
|
key: value,
|
|
25
20
|
value: value
|
package/index.js
CHANGED
|
@@ -18,9 +18,11 @@ exports["default"] = exports.FormContext = void 0;
|
|
|
18
18
|
|
|
19
19
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
20
|
|
|
21
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
22
|
+
|
|
21
23
|
var _extends4 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
22
24
|
|
|
23
|
-
var
|
|
25
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
24
26
|
|
|
25
27
|
var _react = _interopRequireWildcard(require("react"));
|
|
26
28
|
|
|
@@ -59,12 +61,13 @@ Object.keys(_Field).forEach(function (key) {
|
|
|
59
61
|
}
|
|
60
62
|
});
|
|
61
63
|
});
|
|
64
|
+
var _excluded = ["onSubmit", "children", "registerField", "fieldsMap", "fieldsetsMap", "resolver", "mode", "initial", "reValidateMode", "shouldFocusError", "criteriaMode", "componentRegistry"],
|
|
65
|
+
_excluded2 = ["fields", "fieldsets", "initial", "onSubmit", "children", "reValidateMode", "mode", "shouldFocusError", "criteriaMode", "auto", "validatorRegistry", "componentRegistry"];
|
|
62
66
|
|
|
63
67
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
64
68
|
|
|
65
69
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
66
70
|
|
|
67
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
68
71
|
var FormContext = /*#__PURE__*/(0, _react.createContext)({
|
|
69
72
|
fieldsMap: {},
|
|
70
73
|
fieldsetsMap: {}
|
|
@@ -83,7 +86,8 @@ var FormBase = function FormBase(_ref) {
|
|
|
83
86
|
reValidateMode = _ref.reValidateMode,
|
|
84
87
|
shouldFocusError = _ref.shouldFocusError,
|
|
85
88
|
criteriaMode = _ref.criteriaMode,
|
|
86
|
-
componentRegistry = _ref.componentRegistry
|
|
89
|
+
componentRegistry = _ref.componentRegistry,
|
|
90
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
87
91
|
var form = (0, _reactHookForm.useForm)({
|
|
88
92
|
resolver: resolver,
|
|
89
93
|
mode: mode,
|
|
@@ -113,9 +117,9 @@ var FormBase = function FormBase(_ref) {
|
|
|
113
117
|
};
|
|
114
118
|
return /*#__PURE__*/_react["default"].createElement(FormContext.Provider, {
|
|
115
119
|
value: ctx
|
|
116
|
-
}, /*#__PURE__*/_react["default"].createElement("form", {
|
|
120
|
+
}, /*#__PURE__*/_react["default"].createElement("form", (0, _extends4["default"])({
|
|
117
121
|
onSubmit: form.handleSubmit(handleSubmit)
|
|
118
|
-
}, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
122
|
+
}, props), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
119
123
|
container: true
|
|
120
124
|
}, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
|
|
121
125
|
item: true,
|
|
@@ -144,7 +148,8 @@ function FormBuilder(_ref2) {
|
|
|
144
148
|
_ref2$auto = _ref2.auto,
|
|
145
149
|
auto = _ref2$auto === void 0 ? false : _ref2$auto,
|
|
146
150
|
validatorRegistry = _ref2.validatorRegistry,
|
|
147
|
-
componentRegistry = _ref2.componentRegistry
|
|
151
|
+
componentRegistry = _ref2.componentRegistry,
|
|
152
|
+
props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
|
|
148
153
|
var fieldsState = (0, _react.useRef)(fields);
|
|
149
154
|
var setFieldsState = (0, _react.useCallback)(function (newFields) {
|
|
150
155
|
fieldsState.current = newFields;
|
|
@@ -186,7 +191,7 @@ function FormBuilder(_ref2) {
|
|
|
186
191
|
}
|
|
187
192
|
}
|
|
188
193
|
|
|
189
|
-
return /*#__PURE__*/_react["default"].createElement(FormBase, {
|
|
194
|
+
return /*#__PURE__*/_react["default"].createElement(FormBase, (0, _extends4["default"])({
|
|
190
195
|
resolver: resolver,
|
|
191
196
|
fieldsetsMap: fieldsetsMap,
|
|
192
197
|
fieldsMap: fieldsMap,
|
|
@@ -195,10 +200,11 @@ function FormBuilder(_ref2) {
|
|
|
195
200
|
reValidateMode: reValidateMode,
|
|
196
201
|
mode: mode,
|
|
197
202
|
shouldFocusError: shouldFocusError,
|
|
198
|
-
criteriaMode: criteriaMode
|
|
203
|
+
criteriaMode: criteriaMode
|
|
204
|
+
}, props, {
|
|
199
205
|
onSubmit: onSubmit,
|
|
200
206
|
componentRegistry: componentRegistry
|
|
201
|
-
}, fieldChildren, children);
|
|
207
|
+
}), fieldChildren, children);
|
|
202
208
|
}
|
|
203
209
|
|
|
204
210
|
var _default = FormBuilder;
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = void 0;
|
|
8
|
+
exports["default"] = exports.Checkboxes = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
@@ -67,5 +67,6 @@ var Checkboxes = function Checkboxes(_ref) {
|
|
|
67
67
|
}));
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
+
exports.Checkboxes = Checkboxes;
|
|
70
71
|
var _default = Checkboxes;
|
|
71
72
|
exports["default"] = _default;
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports["default"] = void 0;
|
|
10
|
+
exports["default"] = exports.DateInput = void 0;
|
|
11
11
|
|
|
12
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
13
|
|
|
@@ -169,5 +169,6 @@ var DateInput = function DateInput(_ref2) {
|
|
|
169
169
|
}));
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
+
exports.DateInput = DateInput;
|
|
172
173
|
var _default = DateInput;
|
|
173
174
|
exports["default"] = _default;
|
|
@@ -7,15 +7,19 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports["default"] = void 0;
|
|
10
|
+
exports["default"] = exports.FileInput = void 0;
|
|
11
11
|
|
|
12
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
13
|
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _i18n = require("@digigov/ui/app/i18n");
|
|
19
|
+
|
|
20
|
+
var _Paragraph = _interopRequireDefault(require("@digigov/ui/typography/Paragraph"));
|
|
21
|
+
|
|
22
|
+
var _Hint = _interopRequireDefault(require("@digigov/react-core/Hint"));
|
|
19
23
|
|
|
20
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
25
|
|
|
@@ -28,20 +32,29 @@ var FileInput = /*#__PURE__*/_react["default"].forwardRef(function FileInput(_re
|
|
|
28
32
|
extra = _ref$extra === void 0 ? {} : _ref$extra,
|
|
29
33
|
disabled = _ref.disabled;
|
|
30
34
|
|
|
35
|
+
var _useTranslation = (0, _i18n.useTranslation)(),
|
|
36
|
+
t = _useTranslation.t;
|
|
37
|
+
|
|
31
38
|
var _useState = (0, _react.useState)([]),
|
|
32
39
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
33
40
|
files = _useState2[0],
|
|
34
41
|
setFiles = _useState2[1];
|
|
35
42
|
|
|
36
|
-
var filesLabel = extra.multiple ? 'αρχεία' : 'αρχείο';
|
|
37
43
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
38
|
-
className: extra.className
|
|
39
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
44
|
+
className: (0, _clsx["default"])(extra.className, files.length > 0 && 'govgr-uploaded-file', true && 'govgr-field-file')
|
|
45
|
+
}, files.length ? /*#__PURE__*/_react["default"].createElement(_Paragraph["default"], null, /*#__PURE__*/_react["default"].createElement("b", null, t('upload.file'), ":"), " ", "".concat(files.join(', '))) : /*#__PURE__*/_react["default"].createElement(_Hint["default"], null, t('upload.no_file')), /*#__PURE__*/_react["default"].createElement("label", {
|
|
46
|
+
tabIndex: 0,
|
|
47
|
+
role: "button",
|
|
48
|
+
className: (0, _clsx["default"])(extra.className, files.length === 0 && ['govgr-btn', 'govgr-btn-primary'], files.length > 0 && 'govgr-link', true && 'govgr-label-file')
|
|
49
|
+
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
40
50
|
ref: ref,
|
|
51
|
+
type: "file",
|
|
41
52
|
name: name,
|
|
42
|
-
id: name,
|
|
43
53
|
disabled: disabled,
|
|
44
|
-
|
|
54
|
+
style: {
|
|
55
|
+
display: 'none'
|
|
56
|
+
},
|
|
57
|
+
className: "govgr-file-upload",
|
|
45
58
|
onChange: function onChange(e) {
|
|
46
59
|
var target = e.target;
|
|
47
60
|
var selectedFiles = Array.from(target.files).map(function (_ref2) {
|
|
@@ -50,8 +63,9 @@ var FileInput = /*#__PURE__*/_react["default"].forwardRef(function FileInput(_re
|
|
|
50
63
|
});
|
|
51
64
|
setFiles(selectedFiles);
|
|
52
65
|
}
|
|
53
|
-
}),
|
|
66
|
+
}), files.length ? t('upload.change_file') : t('upload.choose_file')));
|
|
54
67
|
});
|
|
55
68
|
|
|
69
|
+
exports.FileInput = FileInput;
|
|
56
70
|
var _default = FileInput;
|
|
57
71
|
exports["default"] = _default;
|
package/inputs/Input/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = void 0;
|
|
8
|
+
exports["default"] = exports.Input = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
@@ -63,5 +63,6 @@ var Input = /*#__PURE__*/_react["default"].forwardRef(function WrappedInput(_ref
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
exports.Input = Input;
|
|
66
67
|
var _default = Input;
|
|
67
68
|
exports["default"] = _default;
|
package/inputs/Select/index.js
CHANGED
|
@@ -13,10 +13,6 @@ var _Select = _interopRequireDefault(require("@digigov/react-core/Select"));
|
|
|
13
13
|
|
|
14
14
|
var _SelectOption = _interopRequireDefault(require("@digigov/react-core/SelectOption"));
|
|
15
15
|
|
|
16
|
-
var _ref2 = /*#__PURE__*/_react["default"].createElement(_SelectOption["default"], {
|
|
17
|
-
value: ""
|
|
18
|
-
});
|
|
19
|
-
|
|
20
16
|
var Select = /*#__PURE__*/_react["default"].forwardRef(function WrappedSelect(_ref, ref) {
|
|
21
17
|
var name = _ref.name,
|
|
22
18
|
_ref$extra = _ref.extra,
|
|
@@ -28,9 +24,9 @@ var Select = /*#__PURE__*/_react["default"].forwardRef(function WrappedSelect(_r
|
|
|
28
24
|
ref: ref,
|
|
29
25
|
name: name,
|
|
30
26
|
disabled: disabled
|
|
31
|
-
},
|
|
32
|
-
var value =
|
|
33
|
-
label =
|
|
27
|
+
}, options.map(function (_ref2) {
|
|
28
|
+
var value = _ref2.value,
|
|
29
|
+
label = _ref2.label;
|
|
34
30
|
return /*#__PURE__*/_react["default"].createElement(_SelectOption["default"], {
|
|
35
31
|
key: value,
|
|
36
32
|
value: value
|
package/libs/form/src/index.d.ts
CHANGED
|
@@ -70,5 +70,5 @@ interface FormBaseProps extends Omit<FormBuilderProps, 'fields' | 'fieldsets' |
|
|
|
70
70
|
resolver: any;
|
|
71
71
|
}
|
|
72
72
|
export declare const FormBase: React.FC<FormBaseProps>;
|
|
73
|
-
export declare function FormBuilder({ fields, fieldsets, initial, onSubmit, children, reValidateMode, mode, shouldFocusError, criteriaMode, auto, validatorRegistry, componentRegistry, }: FormBuilderProps): React.ReactElement;
|
|
73
|
+
export declare function FormBuilder({ fields, fieldsets, initial, onSubmit, children, reValidateMode, mode, shouldFocusError, criteriaMode, auto, validatorRegistry, componentRegistry, ...props }: FormBuilderProps): React.ReactElement;
|
|
74
74
|
export default FormBuilder;
|
|
@@ -8,5 +8,5 @@ export interface CheckboxesProps extends Omit<ControlledFieldProps, 'extra' | 'v
|
|
|
8
8
|
options: Array<FieldOptionProps>;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
declare const Checkboxes: React.FC<CheckboxesProps>;
|
|
11
|
+
export declare const Checkboxes: React.FC<CheckboxesProps>;
|
|
12
12
|
export default Checkboxes;
|
|
@@ -6,7 +6,7 @@ export interface DateInputProps extends Omit<UncontrolledFieldProps, 'extra'> {
|
|
|
6
6
|
min?: string;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
-
declare const DateInput: ({ name, type, ...props }: {
|
|
9
|
+
export declare const DateInput: ({ name, type, ...props }: {
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
name: any;
|
|
12
12
|
type: any;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface I18NContextProps {
|
|
3
|
+
Trans?: any;
|
|
3
4
|
t: (str: string) => string;
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
i18n?: any;
|
|
6
7
|
}
|
|
8
|
+
export declare const defaultTranslate: (key: any) => any;
|
|
7
9
|
export declare const I18NContext: React.Context<I18NContextProps>;
|
|
8
10
|
export declare const I18NProvider: React.FC<I18NContextProps>;
|
|
9
11
|
export declare const useTranslation: () => I18NContextProps;
|
|
@@ -9,6 +9,7 @@ export interface AccordionSectionProps extends DivElementAttributes {
|
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* AccordionSection should be inside the Accordion component.
|
|
12
|
+
*
|
|
12
13
|
* Inside this component must place the AccordionSectionHeader and the AccordionSectionContent components.
|
|
13
14
|
*/
|
|
14
15
|
export declare const AccordionSection: React.ForwardRefExoticComponent<Pick<AccordionSectionProps, "className" | "style" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "open"> & React.RefAttributes<HTMLDivElement>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digigov/form",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "@digigov form builder",
|
|
5
5
|
"author": "GRNET Developers <devs@lists.grnet.gr>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dayjs": "1.10.4"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@digigov/ui": "0.
|
|
20
|
+
"@digigov/ui": "0.17.0",
|
|
21
21
|
"@material-ui/core": "4.11.3",
|
|
22
22
|
"@material-ui/icons": "4.11.2",
|
|
23
23
|
"clsx": "1.1.1",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare type InputElementAttributes = JSX.IntrinsicElements['input'];
|
|
3
|
-
export interface FileUploadProps extends InputElementAttributes {
|
|
4
|
-
/**
|
|
5
|
-
* name is optional.
|
|
6
|
-
*/
|
|
7
|
-
name?: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Details for the FileUpload.
|
|
11
|
-
* FileUpload component is used for uploading files
|
|
12
|
-
*/
|
|
13
|
-
export declare const FileUpload: React.ForwardRefExoticComponent<Pick<FileUploadProps, "type" | "className" | "style" | "form" | "slot" | "title" | "pattern" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "required" | "disabled" | "name" | "list" | "step" | "size" | "min" | "max" | "maxLength" | "minLength" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "multiple" | "readOnly" | "src" | "value" | "width"> & React.RefAttributes<HTMLInputElement>>;
|
|
14
|
-
export default FileUpload;
|