@insticc/genericform 1.0.9 → 1.0.10

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.
@@ -23,6 +23,24 @@ var defaultStyles = {
23
23
  },
24
24
  tooltip: {}
25
25
  };
26
+
27
+ /**
28
+ * A reusable checkbox with optional tooltip and label positioning.
29
+ *
30
+ * @param {Object} props
31
+ * @param {function(string, boolean):void} props.onChange - Callback when checkbox value changes.
32
+ * @param {string} props.name - Unique name of the checkbox.
33
+ * @param {string} props.displayName - Label text displayed next to the checkbox.
34
+ * @param {boolean} [props.checked=false] - Whether the checkbox is checked.
35
+ * @param {boolean} [props.disabled=false] - Whether the checkbox is disabled.
36
+ * @param {boolean} [props.showHelp=false] - Show a help icon with tooltip.
37
+ * @param {string} [props.tooltip=""] - Tooltip text (if showHelp is true).
38
+ * @param {Object} [props.mainDivStyle] - Custom style for outer container.
39
+ * @param {Object} [props.labelStyle] - Custom style for the label element.
40
+ * @param {Object} [props.componentStyle] - Custom style for the checkbox element.
41
+ * @param {Object} [props.tooltipStyle] - Custom style for the tooltip icon.
42
+ */
43
+
26
44
  var CustomCheckbox = function CustomCheckbox(_ref) {
27
45
  var onChange = _ref.onChange,
28
46
  name = _ref.name,
@@ -68,4 +86,17 @@ var CustomCheckbox = function CustomCheckbox(_ref) {
68
86
  style: tooltipStyle
69
87
  })));
70
88
  };
89
+ CustomCheckbox.propTypes = {
90
+ onChange: PropTypes.func.isRequired,
91
+ name: PropTypes.string.isRequired,
92
+ displayName: PropTypes.string,
93
+ checked: PropTypes.bool,
94
+ disabled: PropTypes.bool,
95
+ showHelp: PropTypes.bool,
96
+ tooltip: PropTypes.string,
97
+ mainDivStyle: PropTypes.object,
98
+ labelStyle: PropTypes.object,
99
+ componentStyle: PropTypes.object,
100
+ tooltipStyle: PropTypes.object
101
+ };
71
102
  var _default = exports["default"] = CustomCheckbox;
@@ -30,6 +30,25 @@ var defaultStyles = {
30
30
  color: "#666"
31
31
  }
32
32
  };
33
+
34
+ /**
35
+ * Custom date picker component.
36
+ * @param {Object} props
37
+ * @param {function(string, any):void} props.onChange - Callback when date value changes.
38
+ * @param {string} props.name - Unique name of the date picker.
39
+ * @param {string} props.displayName - Label text displayed next to the date picker.
40
+ * @param {any} props.value - Current value of the date picker.
41
+ * @param {boolean} [props.disabled=false] - Whether the date picker is disabled.
42
+ * @param {boolean} [props.required=false] - Whether the date picker is required.
43
+ * @param {string} [props.tooltip=""] - Tooltip text displayed below the date picker.
44
+ * @param {Object} [props.mainDivStyle] - Custom style for outer container.
45
+ * @param {Object} [props.labelStyle] - Custom style for the label element.
46
+ * @param {Object} [props.componentStyle] - Custom style for the date picker element.
47
+ * @param {Object} [props.tooltipStyle] - Custom style for the tooltip text.
48
+ * @param {string} [props.dateFormat="DD/MM/YYYY"] - Date format for the picker.
49
+ * @param {boolean} [props.timeFormat=false] - Whether to include time selection.
50
+ */
51
+
33
52
  var CustomDatePicker = function CustomDatePicker(_ref) {
34
53
  var onChange = _ref.onChange,
35
54
  name = _ref.name,
@@ -79,4 +98,19 @@ var CustomDatePicker = function CustomDatePicker(_ref) {
79
98
  style: tooltipStyle
80
99
  }, tooltip));
81
100
  };
101
+ CustomDatePicker.propTypes = {
102
+ onChange: PropTypes.func.isRequired,
103
+ name: PropTypes.string.isRequired,
104
+ displayName: PropTypes.string,
105
+ value: PropTypes.any,
106
+ disabled: PropTypes.bool,
107
+ required: PropTypes.bool,
108
+ tooltip: PropTypes.string,
109
+ mainDivStyle: PropTypes.object,
110
+ labelStyle: PropTypes.object,
111
+ componentStyle: PropTypes.object,
112
+ tooltipStyle: PropTypes.object,
113
+ dateFormat: PropTypes.string,
114
+ timeFormat: PropTypes.bool
115
+ };
82
116
  var _default = exports["default"] = CustomDatePicker;
@@ -62,4 +62,18 @@ var CustomInput = function CustomInput(_ref) {
62
62
  className: className
63
63
  }));
64
64
  };
65
+ CustomInput.propTypes = {
66
+ onChange: PropTypes.func.isRequired,
67
+ name: PropTypes.string.isRequired,
68
+ displayName: PropTypes.string,
69
+ value: PropTypes.string,
70
+ disabled: PropTypes.bool,
71
+ required: PropTypes.bool,
72
+ mainDivStyle: PropTypes.object,
73
+ labelStyle: PropTypes.object,
74
+ spanStyle: PropTypes.object,
75
+ componentStyle: PropTypes.object,
76
+ tooltipStyle: PropTypes.object,
77
+ className: PropTypes.string
78
+ };
65
79
  var _default = exports["default"] = CustomInput;
@@ -29,4 +29,10 @@ var CustomLabel = function CustomLabel(_ref) {
29
29
  style: labelStyle
30
30
  }, displayName));
31
31
  };
32
+ CustomLabel.propTypes = {
33
+ name: PropTypes.string.isRequired,
34
+ displayName: PropTypes.string,
35
+ mainDivStyle: PropTypes.object,
36
+ labelStyle: PropTypes.object
37
+ };
32
38
  var _default = exports["default"] = CustomLabel;
@@ -67,4 +67,16 @@ var CustomNumberInput = function CustomNumberInput(_ref) {
67
67
  style: tooltipStyle
68
68
  }, tooltip) : null);
69
69
  };
70
+ CustomNumberInput.propTypes = {
71
+ onChange: PropTypes.func.isRequired,
72
+ name: PropTypes.string.isRequired,
73
+ displayName: PropTypes.string,
74
+ value: PropTypes.string,
75
+ disabled: PropTypes.bool,
76
+ required: PropTypes.bool,
77
+ mainDivStyle: PropTypes.object,
78
+ componentStyle: PropTypes.object,
79
+ labelStyle: PropTypes.object,
80
+ tooltipStyle: PropTypes.object
81
+ };
70
82
  var _default = exports["default"] = CustomNumberInput;
@@ -43,4 +43,14 @@ var CustomRadioButton = function CustomRadioButton(_ref) {
43
43
  style: tooltipStyle
44
44
  }) : null);
45
45
  };
46
+ CustomRadioButton.propTypes = {
47
+ onChange: PropTypes.func.isRequired,
48
+ name: PropTypes.string.isRequired,
49
+ displayName: PropTypes.string,
50
+ checked: PropTypes.bool,
51
+ disabled: PropTypes.bool,
52
+ showHelp: PropTypes.bool,
53
+ tooltipStyle: PropTypes.object,
54
+ helpText: PropTypes.string
55
+ };
46
56
  var _default = exports["default"] = CustomRadioButton;
@@ -47,4 +47,17 @@ var CustomSearch = function CustomSearch(_ref) {
47
47
  value: value
48
48
  }));
49
49
  };
50
+ CustomSearch.propTypes = {
51
+ onChange: PropTypes.func.isRequired,
52
+ handleResultSelect: PropTypes.func.isRequired,
53
+ resultRenderer: PropTypes.func,
54
+ name: PropTypes.string.isRequired,
55
+ displayName: PropTypes.string,
56
+ value: PropTypes.string,
57
+ isLoading: PropTypes.bool,
58
+ options: PropTypes.array.isRequired,
59
+ mainDivStyle: PropTypes.object,
60
+ labelStyle: PropTypes.object,
61
+ componentStyle: PropTypes.object
62
+ };
50
63
  var _default = exports["default"] = CustomSearch;
@@ -68,4 +68,16 @@ var CustomTextArea = function CustomTextArea(_ref) {
68
68
  style: tooltipStyle
69
69
  }, tooltip) : null);
70
70
  };
71
+ CustomTextArea.propTypes = {
72
+ onChange: PropTypes.func.isRequired,
73
+ name: PropTypes.string.isRequired,
74
+ displayName: PropTypes.string,
75
+ value: PropTypes.string,
76
+ disabled: PropTypes.bool,
77
+ required: PropTypes.bool,
78
+ mainDivStyle: PropTypes.object,
79
+ labelStyle: PropTypes.object,
80
+ componentStyle: PropTypes.object,
81
+ tooltipStyle: PropTypes.object
82
+ };
71
83
  var _default = exports["default"] = CustomTextArea;
@@ -76,4 +76,16 @@ var MultipleCheckbox = function MultipleCheckbox(_ref) {
76
76
  }) : null);
77
77
  })));
78
78
  };
79
+ MultipleCheckbox.propTypes = {
80
+ onChange: PropTypes.func.isRequired,
81
+ name: PropTypes.string.isRequired,
82
+ displayName: PropTypes.string,
83
+ required: PropTypes.bool,
84
+ options: PropTypes.array.isRequired,
85
+ mainDivStyle: PropTypes.object,
86
+ labelStyle: PropTypes.object,
87
+ spanStyle: PropTypes.object,
88
+ componentStyle: PropTypes.object,
89
+ tooltipStyle: PropTypes.object
90
+ };
79
91
  var _default = exports["default"] = MultipleCheckbox;
@@ -10,6 +10,21 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default":
10
10
  var defaultStyles = {
11
11
  mainDiv: {}
12
12
  };
13
+
14
+ /**
15
+ * Custom multiple dropdown component.
16
+ * @param {Object} props
17
+ * @param {function} props.onChange - Callback when dropdown value changes.
18
+ * @param {string} props.name - Unique name of the dropdown.
19
+ * @param {string} props.displayName - Label text displayed next to the dropdown.
20
+ * @param {Array} props.value - Current selected values of the dropdown.
21
+ * @param {boolean} [props.disabled=false] - Whether the dropdown is disabled.
22
+ * @param {Array} props.options - Options for the dropdown.
23
+ * @param {Object} [props.mainDivStyle] - Custom style for outer container.
24
+ * @param {Object} [props.labelStyle] - Custom style for the label element.
25
+ * @param {Object} [props.componentStyle] - Custom style for the dropdown element.
26
+ */
27
+
13
28
  var MultipleDropdown = function MultipleDropdown(_ref) {
14
29
  var onChange = _ref.onChange,
15
30
  name = _ref.name,
@@ -46,4 +61,15 @@ var MultipleDropdown = function MultipleDropdown(_ref) {
46
61
  disabled: disabled
47
62
  }));
48
63
  };
64
+ MultipleDropdown.propTypes = {
65
+ onChange: PropTypes.func.isRequired,
66
+ name: PropTypes.string.isRequired,
67
+ displayName: PropTypes.string,
68
+ value: PropTypes.array,
69
+ disabled: PropTypes.bool,
70
+ options: PropTypes.array.isRequired,
71
+ mainDivStyle: PropTypes.object,
72
+ labelStyle: PropTypes.object,
73
+ componentStyle: PropTypes.object
74
+ };
49
75
  var _default = exports["default"] = MultipleDropdown;
@@ -73,4 +73,17 @@ var MultipleRadioButton = function MultipleRadioButton(_ref) {
73
73
  }) : null);
74
74
  }), component ? component : null));
75
75
  };
76
+ MultipleRadioButton.propTypes = {
77
+ onChange: PropTypes.func.isRequired,
78
+ name: PropTypes.string.isRequired,
79
+ displayName: PropTypes.string,
80
+ required: PropTypes.bool,
81
+ options: PropTypes.array.isRequired,
82
+ radioButtonDivStyle: PropTypes.object,
83
+ component: PropTypes.node,
84
+ mainDivStyle: PropTypes.object,
85
+ labelStyle: PropTypes.object,
86
+ spanStyle: PropTypes.object,
87
+ componentStyle: PropTypes.object
88
+ };
76
89
  var _default = exports["default"] = MultipleRadioButton;
@@ -45,20 +45,17 @@ var YearDatePicker = function YearDatePicker(_ref) {
45
45
  spanStyle = _ref$spanStyle === void 0 ? defaultStyles.span : _ref$spanStyle,
46
46
  _ref$componentStyle = _ref.componentStyle,
47
47
  componentStyle = _ref$componentStyle === void 0 ? defaultStyles.component : _ref$componentStyle,
48
- _ref$currentMaxYear = _ref.currentMaxYear,
49
- currentMaxYear = _ref$currentMaxYear === void 0 ? false : _ref$currentMaxYear,
50
48
  _ref$dateFormat = _ref.dateFormat,
51
- dateFormat = _ref$dateFormat === void 0 ? "YYYY" : _ref$dateFormat,
49
+ dateFormat = _ref$dateFormat === void 0 ? "DD/MM/YYYY" : _ref$dateFormat,
52
50
  _ref$timeFormat = _ref.timeFormat,
53
51
  timeFormat = _ref$timeFormat === void 0 ? false : _ref$timeFormat,
54
52
  _ref$input = _ref.input,
55
53
  input = _ref$input === void 0 ? true : _ref$input,
56
54
  _ref$viewMode = _ref.viewMode,
57
55
  viewMode = _ref$viewMode === void 0 ? "years" : _ref$viewMode,
58
- _ref$minYear = _ref.minYear,
59
- minYear = _ref$minYear === void 0 ? 2000 : _ref$minYear,
60
56
  _ref$placeholder = _ref.placeholder,
61
- placeholder = _ref$placeholder === void 0 ? "Select year" : _ref$placeholder;
57
+ placeholder = _ref$placeholder === void 0 ? "Select year" : _ref$placeholder,
58
+ isValidDateFunction = _ref.isValidDateFunction;
62
59
  return /*#__PURE__*/_react["default"].createElement("div", {
63
60
  className: "yearDateDiv",
64
61
  key: name,
@@ -83,12 +80,7 @@ var YearDatePicker = function YearDatePicker(_ref) {
83
80
  viewMode: viewMode,
84
81
  disabled: disabled,
85
82
  isValidDate: function isValidDate(current) {
86
- if (currentMaxYear) {
87
- var year = current.year();
88
- var currentYear = new Date().getFullYear();
89
- return year >= minYear && year <= currentYear;
90
- }
91
- return true;
83
+ return isValidDateFunction(current);
92
84
  },
93
85
  renderInput: function renderInput(props, openCalendar) {
94
86
  return /*#__PURE__*/_react["default"].createElement("input", _extends({}, props, {
@@ -101,4 +93,22 @@ var YearDatePicker = function YearDatePicker(_ref) {
101
93
  }
102
94
  })));
103
95
  };
96
+ YearDatePicker.propTypes = {
97
+ onChange: PropTypes.func.isRequired,
98
+ name: PropTypes.string.isRequired,
99
+ displayName: PropTypes.string,
100
+ value: PropTypes.any,
101
+ disabled: PropTypes.bool,
102
+ required: PropTypes.bool,
103
+ mainDivStyle: PropTypes.object,
104
+ labelStyle: PropTypes.object,
105
+ spanStyle: PropTypes.object,
106
+ componentStyle: PropTypes.object,
107
+ dateFormat: PropTypes.string,
108
+ timeFormat: PropTypes.bool,
109
+ input: PropTypes.bool,
110
+ viewMode: PropTypes.string,
111
+ placeholder: PropTypes.string,
112
+ isValidDateFunction: PropTypes.func
113
+ };
104
114
  var _default = exports["default"] = YearDatePicker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insticc/genericform",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "a generic form with various types of fields",
5
5
  "main": "build/index.js",
6
6
  "scripts": {