@danderson00/react-forms-material 0.0.20 → 0.0.23

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 CHANGED
@@ -124,3 +124,22 @@ component.
124
124
 
125
125
  Renders a field component with a Material UI [`Checkbox` component](https://material-ui.com/api/checkbox/) as the
126
126
  input component.
127
+
128
+ ## License
129
+
130
+ **The MIT License (MIT)**
131
+
132
+ Copyright © 2022 Dale Anderson
133
+
134
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
135
+ documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
136
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
137
+ persons to whom the Software is furnished to do so, subject to the following conditions:
138
+
139
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
140
+ Software.
141
+
142
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
143
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
144
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
145
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/dist/index.js CHANGED
@@ -62,9 +62,9 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
62
62
 
63
63
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
64
64
 
65
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
65
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
66
66
 
67
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
67
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
68
68
 
69
69
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
70
70
 
@@ -98,7 +98,8 @@ var base = function base(component) {
98
98
  var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
99
99
  alwaysShrinkLabel = _ref2.alwaysShrinkLabel,
100
100
  _ref2$shrinkLabel = _ref2.shrinkLabel,
101
- shrinkLabelOption = _ref2$shrinkLabel === void 0 ? true : _ref2$shrinkLabel;
101
+ shrinkLabelOption = _ref2$shrinkLabel === void 0 ? true : _ref2$shrinkLabel,
102
+ passError = _ref2.passError;
102
103
 
103
104
  return function (_ref3) {
104
105
  var className = _ref3.className,
@@ -128,9 +129,12 @@ var base = function base(component) {
128
129
  shrink: false
129
130
  }), (alwaysShrinkLabel || shrinkLabel) && {
130
131
  className: 'MuiInputLabel-shrink'
131
- }))] : []), [/*#__PURE__*/(0, _react.createElement)(component, _objectSpread({
132
- key: 'input'
133
- }, inputProps))], _toConsumableArray(helperText ? [/*#__PURE__*/(0, _react.createElement)(_FormHelperText["default"], {
132
+ }))] : []), [/*#__PURE__*/(0, _react.createElement)(component, _objectSpread(_objectSpread({
133
+ key: 'input',
134
+ variant: variant
135
+ }, passError && {
136
+ error: error
137
+ }), inputProps))], _toConsumableArray(helperText ? [/*#__PURE__*/(0, _react.createElement)(_FormHelperText["default"], {
134
138
  key: 'helperText',
135
139
  children: helperText
136
140
  })] : []))
package/dist/styles.js CHANGED
@@ -4,4 +4,4 @@ var _injectCss = _interopRequireDefault(require("@danderson00/react-forms/dist/i
4
4
 
5
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
6
6
 
7
- (0, _injectCss["default"])('react-forms-material-styles', "\n .react-forms-material-radiogroup.MuiFormControl-root {\n overflow: hidden;\n }\n\n .react-forms-material-radio.MuiFormControl-root {\n flex-direction: row-reverse;\n justify-content: flex-end;\n }\n \n .react-forms-material-radio .MuiInputLabel-formControl {\n position: static;\n }\n\n .react-forms-material-radio .MuiRadio-root {\n transform: translate(0, 9px) scale(1);\n } \n \n .react-forms-material-checkbox .MuiCheckbox-root {\n transform: translate(0, 9px) scale(1);\n }\n");
7
+ (0, _injectCss["default"])('react-forms-material-styles', "\n .react-forms-material-radiogroup.MuiFormControl-root {\n overflow: hidden;\n }\n\n .react-forms-material-radio.MuiFormControl-root {\n flex-direction: row-reverse;\n justify-content: flex-end;\n }\n \n .react-forms-material-radio .MuiInputLabel-formControl {\n position: static;\n }\n\n .react-forms-material-radio .MuiRadio-root {\n transform: translate(0, 9px) scale(1);\n } \n \n .react-forms-material-checkbox .MuiCheckbox-root {\n transform: translate(0, 9px) scale(1);\n }\n \n /* allow forms to be embedded in dialogs - essentially replicate a few styles */\n .MuiDialog-container form {\n display: flex;\n }\n \n .MuiDialog-container form .MuiDialogContent-root {\n display: flex;\n align-items: flex-start;\n flex-direction: column;\n }\n\n .MuiDialog-container form .MuiDialogActions-root {\n align-self: flex-end;\n }\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danderson00/react-forms-material",
3
- "version": "0.0.20",
3
+ "version": "0.0.23",
4
4
  "description": "Beautiful, ultra simple, stateless, validated forms for use in React function components",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.js",
@@ -10,7 +10,7 @@
10
10
  "prepare": "babel src --source-maps false --out-dir dist"
11
11
  },
12
12
  "dependencies": {
13
- "@danderson00/react-forms": "0.0.20",
13
+ "@danderson00/react-forms": "0.0.23",
14
14
  "@material-ui/core": "^4.11.3"
15
15
  },
16
16
  "peerDependencies": {
package/src/index.js CHANGED
@@ -24,7 +24,7 @@ const wrapped = (component, options, baseOptions) => wrapInput(
24
24
  { passErrorProp: true, ...options }
25
25
  )
26
26
 
27
- const base = (component, options = {}, { alwaysShrinkLabel, shrinkLabel: shrinkLabelOption = true } = {}) => (
27
+ const base = (component, options = {}, { alwaysShrinkLabel, shrinkLabel: shrinkLabelOption = true, passError } = {}) => (
28
28
  ({ className, error, hiddenLabel, variant, margin, label, helperText, shrinkLabel, valid, ...inputProps }) => (
29
29
  createElement(MuiFormControl, {
30
30
  className: `react-forms-material-field${options.type ? ` react-forms-material-${options.type}` : ''}${className ? ` ${className}` : ''}`,
@@ -43,7 +43,12 @@ const base = (component, options = {}, { alwaysShrinkLabel, shrinkLabel: shrinkL
43
43
  ...((alwaysShrinkLabel || shrinkLabel) && { className: 'MuiInputLabel-shrink' }),
44
44
  })] : []),
45
45
 
46
- createElement(component, { key: 'input', ...inputProps }),
46
+ createElement(component, {
47
+ key: 'input',
48
+ variant,
49
+ ...(passError && { error }),
50
+ ...inputProps
51
+ }),
47
52
 
48
53
  ...(helperText ? [createElement(MuiFormHelperText, {
49
54
  key: 'helperText',
package/src/styles.js CHANGED
@@ -21,6 +21,21 @@ injectCss('react-forms-material-styles', `
21
21
  .react-forms-material-checkbox .MuiCheckbox-root {
22
22
  transform: translate(0, 9px) scale(1);
23
23
  }
24
+
25
+ /* allow forms to be embedded in dialogs - essentially replicate a few styles */
26
+ .MuiDialog-container form {
27
+ display: flex;
28
+ }
29
+
30
+ .MuiDialog-container form .MuiDialogContent-root {
31
+ display: flex;
32
+ align-items: flex-start;
33
+ flex-direction: column;
34
+ }
35
+
36
+ .MuiDialog-container form .MuiDialogActions-root {
37
+ align-self: flex-end;
38
+ }
24
39
  `)
25
40
 
26
41