@data-driven-forms/mui-component-mapper 4.1.12 → 4.1.14

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.
Files changed (245) hide show
  1. package/.eslintrc.json +27 -0
  2. package/CHANGELOG.md +13 -2
  3. package/checkbox/checkbox.d.ts +29 -16
  4. package/checkbox/checkbox.js +44 -77
  5. package/checkbox/checkbox.js.map +1 -0
  6. package/checkbox/index.js +22 -24
  7. package/checkbox/index.js.map +1 -0
  8. package/component-mapper/component-mapper.d.ts +35 -40
  9. package/component-mapper/component-mapper.js +55 -40
  10. package/component-mapper/component-mapper.js.map +1 -0
  11. package/component-mapper/index.js +22 -24
  12. package/component-mapper/index.js.map +1 -0
  13. package/date-picker/date-picker.d.ts +10 -10
  14. package/date-picker/date-picker.js +52 -63
  15. package/date-picker/date-picker.js.map +1 -0
  16. package/date-picker/index.js +22 -24
  17. package/date-picker/index.js.map +1 -0
  18. package/dual-list-select/dual-list-select.d.ts +3 -111
  19. package/dual-list-select/dual-list-select.js +93 -412
  20. package/dual-list-select/dual-list-select.js.map +1 -0
  21. package/dual-list-select/index.js +22 -24
  22. package/dual-list-select/index.js.map +1 -0
  23. package/esm/checkbox/checkbox.d.ts +31 -0
  24. package/esm/checkbox/checkbox.js +25 -69
  25. package/esm/checkbox/checkbox.js.map +1 -0
  26. package/esm/checkbox/index.d.ts +2 -0
  27. package/esm/checkbox/index.js +2 -1
  28. package/esm/checkbox/index.js.map +1 -0
  29. package/esm/component-mapper/component-mapper.d.ts +36 -0
  30. package/esm/component-mapper/component-mapper.js +34 -19
  31. package/esm/component-mapper/component-mapper.js.map +1 -0
  32. package/esm/component-mapper/index.d.ts +2 -0
  33. package/esm/component-mapper/index.js +2 -1
  34. package/esm/component-mapper/index.js.map +1 -0
  35. package/esm/date-picker/date-picker.d.ts +12 -0
  36. package/esm/date-picker/date-picker.js +35 -55
  37. package/esm/date-picker/date-picker.js.map +1 -0
  38. package/esm/date-picker/index.d.ts +2 -0
  39. package/esm/date-picker/index.js +2 -1
  40. package/esm/date-picker/index.js.map +1 -0
  41. package/esm/dual-list-select/dual-list-select.d.ts +3 -0
  42. package/esm/dual-list-select/dual-list-select.js +59 -404
  43. package/esm/dual-list-select/dual-list-select.js.map +1 -0
  44. package/esm/dual-list-select/index.d.ts +2 -0
  45. package/esm/dual-list-select/index.js +2 -1
  46. package/esm/dual-list-select/index.js.map +1 -0
  47. package/esm/field-array/field-array.d.ts +56 -0
  48. package/esm/field-array/field-array.js +107 -296
  49. package/esm/field-array/field-array.js.map +1 -0
  50. package/esm/field-array/index.d.ts +2 -0
  51. package/esm/field-array/index.js +2 -1
  52. package/esm/field-array/index.js.map +1 -0
  53. package/esm/form-field-grid/form-field-grid.d.ts +8 -0
  54. package/esm/form-field-grid/form-field-grid.js +26 -22
  55. package/esm/form-field-grid/form-field-grid.js.map +1 -0
  56. package/esm/form-field-grid/index.d.ts +2 -0
  57. package/esm/form-field-grid/index.js +3 -1
  58. package/esm/form-field-grid/index.js.map +1 -0
  59. package/esm/form-template/form-template.d.ts +17 -0
  60. package/esm/form-template/form-template.js +57 -126
  61. package/esm/form-template/form-template.js.map +1 -0
  62. package/esm/form-template/index.d.ts +2 -0
  63. package/esm/form-template/index.js +2 -1
  64. package/esm/form-template/index.js.map +1 -0
  65. package/esm/index.d.ts +21 -0
  66. package/esm/index.js +3 -2
  67. package/esm/index.js.map +1 -0
  68. package/esm/multiple-choice-list/index.d.ts +2 -0
  69. package/esm/multiple-choice-list/index.js +2 -1
  70. package/esm/multiple-choice-list/index.js.map +1 -0
  71. package/esm/multiple-choice-list/multiple-choice-list.d.ts +14 -0
  72. package/esm/multiple-choice-list/multiple-choice-list.js +39 -93
  73. package/esm/multiple-choice-list/multiple-choice-list.js.map +1 -0
  74. package/esm/plain-text/index.d.ts +2 -0
  75. package/esm/plain-text/index.js +2 -1
  76. package/esm/plain-text/index.js.map +1 -0
  77. package/esm/plain-text/plain-text.d.ts +12 -0
  78. package/esm/plain-text/plain-text.js +18 -27
  79. package/esm/plain-text/plain-text.js.map +1 -0
  80. package/esm/radio/index.d.ts +2 -0
  81. package/esm/radio/index.js +2 -1
  82. package/esm/radio/index.js.map +1 -0
  83. package/esm/radio/radio.d.ts +19 -0
  84. package/esm/radio/radio.js +38 -110
  85. package/esm/radio/radio.js.map +1 -0
  86. package/esm/select/index.d.ts +2 -0
  87. package/esm/select/index.js +2 -1
  88. package/esm/select/index.js.map +1 -0
  89. package/esm/select/select.d.ts +44 -0
  90. package/esm/select/select.js +55 -162
  91. package/esm/select/select.js.map +1 -0
  92. package/esm/slider/index.d.ts +2 -0
  93. package/esm/slider/index.js +2 -1
  94. package/esm/slider/index.js.map +1 -0
  95. package/esm/slider/slider.d.ts +24 -0
  96. package/esm/slider/slider.js +22 -63
  97. package/esm/slider/slider.js.map +1 -0
  98. package/esm/sub-form/index.d.ts +2 -0
  99. package/esm/sub-form/index.js +2 -1
  100. package/esm/sub-form/index.js.map +1 -0
  101. package/esm/sub-form/sub-form.d.ts +16 -0
  102. package/esm/sub-form/sub-form.js +29 -52
  103. package/esm/sub-form/sub-form.js.map +1 -0
  104. package/esm/switch/index.d.ts +2 -0
  105. package/esm/switch/index.js +2 -1
  106. package/esm/switch/index.js.map +1 -0
  107. package/esm/switch/switch.d.ts +18 -0
  108. package/esm/switch/switch.js +21 -62
  109. package/esm/switch/switch.js.map +1 -0
  110. package/esm/tabs/index.d.ts +2 -0
  111. package/esm/tabs/index.js +2 -1
  112. package/esm/tabs/index.js.map +1 -0
  113. package/esm/tabs/tabs.d.ts +19 -0
  114. package/esm/tabs/tabs.js +9 -73
  115. package/esm/tabs/tabs.js.map +1 -0
  116. package/esm/text-field/index.d.ts +2 -0
  117. package/esm/text-field/index.js +2 -1
  118. package/esm/text-field/index.js.map +1 -0
  119. package/esm/text-field/text-field.d.ts +10 -0
  120. package/esm/text-field/text-field.js +20 -38
  121. package/esm/text-field/text-field.js.map +1 -0
  122. package/esm/textarea/index.d.ts +2 -0
  123. package/esm/textarea/index.js +2 -1
  124. package/esm/textarea/index.js.map +1 -0
  125. package/esm/textarea/textarea.d.ts +13 -0
  126. package/esm/textarea/textarea.js +20 -42
  127. package/esm/textarea/textarea.js.map +1 -0
  128. package/esm/time-picker/index.d.ts +2 -0
  129. package/esm/time-picker/index.js +2 -1
  130. package/esm/time-picker/index.js.map +1 -0
  131. package/esm/time-picker/time-picker.d.ts +13 -0
  132. package/esm/time-picker/time-picker.js +35 -57
  133. package/esm/time-picker/time-picker.js.map +1 -0
  134. package/esm/validation-error/index.d.ts +2 -0
  135. package/esm/validation-error/index.js +2 -1
  136. package/esm/validation-error/index.js.map +1 -0
  137. package/esm/validation-error/validation-error.d.ts +6 -0
  138. package/esm/validation-error/validation-error.js +7 -6
  139. package/esm/validation-error/validation-error.js.map +1 -0
  140. package/esm/wizard/index.d.ts +2 -0
  141. package/esm/wizard/index.js +2 -1
  142. package/esm/wizard/index.js.map +1 -0
  143. package/esm/wizard/step-buttons.d.ts +33 -0
  144. package/esm/wizard/step-buttons.js +49 -104
  145. package/esm/wizard/step-buttons.js.map +1 -0
  146. package/esm/wizard/wizard-nav.d.ts +15 -0
  147. package/esm/wizard/wizard-nav.js +15 -33
  148. package/esm/wizard/wizard-nav.js.map +1 -0
  149. package/esm/wizard/wizard.d.ts +4 -0
  150. package/esm/wizard/wizard.js +21 -70
  151. package/esm/wizard/wizard.js.map +1 -0
  152. package/field-array/field-array.d.ts +54 -38
  153. package/field-array/field-array.js +138 -306
  154. package/field-array/field-array.js.map +1 -0
  155. package/field-array/index.js +22 -24
  156. package/field-array/index.js.map +1 -0
  157. package/form-field-grid/form-field-grid.d.ts +7 -5
  158. package/form-field-grid/form-field-grid.js +42 -28
  159. package/form-field-grid/form-field-grid.js.map +1 -0
  160. package/form-field-grid/index.js +23 -12
  161. package/form-field-grid/index.js.map +1 -0
  162. package/form-template/form-template.d.ts +17 -5
  163. package/form-template/form-template.js +78 -132
  164. package/form-template/form-template.js.map +1 -0
  165. package/form-template/index.js +22 -24
  166. package/form-template/index.js.map +1 -0
  167. package/index.d.ts +10 -29
  168. package/index.js +45 -146
  169. package/index.js.map +1 -0
  170. package/multiple-choice-list/index.js +22 -24
  171. package/multiple-choice-list/index.js.map +1 -0
  172. package/multiple-choice-list/multiple-choice-list.d.ts +12 -24
  173. package/multiple-choice-list/multiple-choice-list.js +53 -101
  174. package/multiple-choice-list/multiple-choice-list.js.map +1 -0
  175. package/package.json +9 -11
  176. package/plain-text/index.js +22 -24
  177. package/plain-text/index.js.map +1 -0
  178. package/plain-text/plain-text.d.ts +10 -10
  179. package/plain-text/plain-text.js +30 -33
  180. package/plain-text/plain-text.js.map +1 -0
  181. package/radio/index.js +22 -24
  182. package/radio/index.js.map +1 -0
  183. package/radio/radio.d.ts +17 -25
  184. package/radio/radio.js +56 -116
  185. package/radio/radio.js.map +1 -0
  186. package/select/index.js +22 -24
  187. package/select/index.js.map +1 -0
  188. package/select/select.d.ts +42 -27
  189. package/select/select.js +78 -172
  190. package/select/select.js.map +1 -0
  191. package/slider/index.js +22 -24
  192. package/slider/index.js.map +1 -0
  193. package/slider/slider.d.ts +22 -28
  194. package/slider/slider.js +39 -71
  195. package/slider/slider.js.map +1 -0
  196. package/sub-form/index.js +22 -24
  197. package/sub-form/index.js.map +1 -0
  198. package/sub-form/sub-form.d.ts +14 -16
  199. package/sub-form/sub-form.js +42 -56
  200. package/sub-form/sub-form.js.map +1 -0
  201. package/switch/index.js +22 -24
  202. package/switch/index.js.map +1 -0
  203. package/switch/switch.d.ts +16 -26
  204. package/switch/switch.js +43 -70
  205. package/switch/switch.js.map +1 -0
  206. package/tabs/index.js +22 -24
  207. package/tabs/index.js.map +1 -0
  208. package/tabs/tabs.d.ts +18 -14
  209. package/tabs/tabs.js +33 -82
  210. package/tabs/tabs.js.map +1 -0
  211. package/text-field/index.js +22 -24
  212. package/text-field/index.js.map +1 -0
  213. package/text-field/text-field.d.ts +8 -16
  214. package/text-field/text-field.js +37 -46
  215. package/text-field/text-field.js.map +1 -0
  216. package/textarea/index.js +22 -24
  217. package/textarea/index.js.map +1 -0
  218. package/textarea/textarea.d.ts +11 -17
  219. package/textarea/textarea.js +37 -50
  220. package/textarea/textarea.js.map +1 -0
  221. package/time-picker/index.js +22 -24
  222. package/time-picker/index.js.map +1 -0
  223. package/time-picker/time-picker.d.ts +11 -16
  224. package/time-picker/time-picker.js +52 -65
  225. package/time-picker/time-picker.js.map +1 -0
  226. package/tsconfig.cjs.json +8 -0
  227. package/tsconfig.demo.json +31 -0
  228. package/tsconfig.esm.json +8 -0
  229. package/tsconfig.json +17 -9
  230. package/validation-error/index.js +22 -24
  231. package/validation-error/index.js.map +1 -0
  232. package/validation-error/validation-error.d.ts +5 -4
  233. package/validation-error/validation-error.js +10 -11
  234. package/validation-error/validation-error.js.map +1 -0
  235. package/wizard/index.js +22 -24
  236. package/wizard/index.js.map +1 -0
  237. package/wizard/step-buttons.d.ts +33 -0
  238. package/wizard/step-buttons.js +68 -110
  239. package/wizard/step-buttons.js.map +1 -0
  240. package/wizard/wizard-nav.d.ts +15 -0
  241. package/wizard/wizard-nav.js +37 -37
  242. package/wizard/wizard-nav.js.map +1 -0
  243. package/wizard/wizard.d.ts +4 -28
  244. package/wizard/wizard.js +41 -79
  245. package/wizard/wizard.js.map +1 -0
@@ -1,114 +1,42 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _excluded = ["inputProps"],
5
- _excluded2 = ["name", "option", "isDisabled", "isReadOnly", "FormControlLabelProps", "RadioProps"],
6
- _excluded3 = ["name"],
7
- _excluded4 = ["options", "isDisabled", "label", "isRequired", "helperText", "description", "isReadOnly", "meta", "validateOnMount", "FormFieldGridProps", "FormControlProps", "FormLabelProps", "FormHelperTextProps", "FormControlLabelProps", "RadioProps"];
8
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
- import React from 'react';
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
13
  import { styled } from '@mui/material/styles';
12
- import MUIRadio from "@mui/material/Radio";
13
- import FormControlLabel from "@mui/material/FormControlLabel";
14
- import FormControl from "@mui/material/FormControl";
15
- import FormLabel from "@mui/material/FormLabel";
16
- import FormHelperText from "@mui/material/FormHelperText";
14
+ import { Radio as MUIRadio, FormControlLabel, FormControl, FormLabel, FormHelperText } from '@mui/material';
15
+ import { useFieldApi } from '@data-driven-forms/react-form-renderer';
17
16
  import FormFieldGrid from '../form-field-grid/form-field-grid';
18
17
  import { validationError } from '../validation-error/validation-error';
19
- import useFieldApi from "@data-driven-forms/react-form-renderer/use-field-api";
20
- var PREFIX = 'Radio';
21
- var classes = {
22
- grid: "".concat(PREFIX, "-grid")
23
- };
24
- var StyledFormFieldGrid = styled(FormFieldGrid)(function () {
25
- return _defineProperty({}, "&.".concat(classes.grid), {
26
- '&:first-of-type': {
27
- marginTop: 8
28
- }
29
- });
30
- });
31
- var RadioOption = function RadioOption(_ref2) {
32
- var name = _ref2.name,
33
- option = _ref2.option,
34
- isDisabled = _ref2.isDisabled,
35
- isReadOnly = _ref2.isReadOnly,
36
- FormControlLabelProps = _ref2.FormControlLabelProps,
37
- _ref2$RadioProps = _ref2.RadioProps,
38
- inputProps = _ref2$RadioProps.inputProps,
39
- RadioProps = _objectWithoutProperties(_ref2$RadioProps, _excluded),
40
- props = _objectWithoutProperties(_ref2, _excluded2);
41
- var _useFieldApi = useFieldApi({
42
- name: name,
43
- type: 'radio',
44
- value: option.value
45
- }),
46
- input = _useFieldApi.input;
47
- return /*#__PURE__*/React.createElement(FormControlLabel, _extends({
48
- key: "".concat(name, "-").concat(option.value),
49
- control: /*#__PURE__*/React.createElement(MUIRadio, _extends({}, input, {
50
- name: name,
51
- disabled: isDisabled || isReadOnly,
52
- onChange: function onChange() {
53
- return input.onChange(option.value);
54
- },
55
- inputProps: _objectSpread({
56
- readOnly: isReadOnly
57
- }, inputProps)
58
- }, RadioProps)),
59
- label: option.label
60
- }, FormControlLabelProps, props));
61
- };
62
- var Radio = function Radio(_ref3) {
63
- var name = _ref3.name,
64
- props = _objectWithoutProperties(_ref3, _excluded3);
65
- var _useFieldApi2 = useFieldApi(_objectSpread(_objectSpread({}, props), {}, {
66
- name: name,
67
- type: 'radio'
68
- })),
69
- _useFieldApi2$options = _useFieldApi2.options,
70
- options = _useFieldApi2$options === void 0 ? [] : _useFieldApi2$options,
71
- isDisabled = _useFieldApi2.isDisabled,
72
- label = _useFieldApi2.label,
73
- isRequired = _useFieldApi2.isRequired,
74
- helperText = _useFieldApi2.helperText,
75
- description = _useFieldApi2.description,
76
- isReadOnly = _useFieldApi2.isReadOnly,
77
- meta = _useFieldApi2.meta,
78
- validateOnMount = _useFieldApi2.validateOnMount,
79
- _useFieldApi2$FormFie = _useFieldApi2.FormFieldGridProps,
80
- FormFieldGridProps = _useFieldApi2$FormFie === void 0 ? {} : _useFieldApi2$FormFie,
81
- _useFieldApi2$FormCon = _useFieldApi2.FormControlProps,
82
- FormControlProps = _useFieldApi2$FormCon === void 0 ? {} : _useFieldApi2$FormCon,
83
- _useFieldApi2$FormLab = _useFieldApi2.FormLabelProps,
84
- FormLabelProps = _useFieldApi2$FormLab === void 0 ? {} : _useFieldApi2$FormLab,
85
- _useFieldApi2$FormHel = _useFieldApi2.FormHelperTextProps,
86
- FormHelperTextProps = _useFieldApi2$FormHel === void 0 ? {} : _useFieldApi2$FormHel,
87
- _useFieldApi2$FormCon2 = _useFieldApi2.FormControlLabelProps,
88
- FormControlLabelProps = _useFieldApi2$FormCon2 === void 0 ? {} : _useFieldApi2$FormCon2,
89
- _useFieldApi2$RadioPr = _useFieldApi2.RadioProps,
90
- RadioProps = _useFieldApi2$RadioPr === void 0 ? {} : _useFieldApi2$RadioPr,
91
- rest = _objectWithoutProperties(_useFieldApi2, _excluded4);
92
- var invalid = validationError(meta, validateOnMount);
93
- var text = invalid || (meta.touched || validateOnMount) && meta.warning || helperText || description;
94
- return /*#__PURE__*/React.createElement(StyledFormFieldGrid, _extends({
95
- className: classes.grid
96
- }, FormFieldGridProps), /*#__PURE__*/React.createElement(FormControl, _extends({
97
- required: isRequired,
98
- error: !!invalid,
99
- component: "fieldset"
100
- }, FormControlProps), /*#__PURE__*/React.createElement(FormLabel, _extends({
101
- component: "legend"
102
- }, FormLabelProps), label), options.map(function (option) {
103
- return /*#__PURE__*/React.createElement(RadioOption, _extends({
104
- key: option.value,
105
- name: name,
106
- option: option,
107
- isDisabled: isDisabled,
108
- isReadOnly: isReadOnly,
109
- FormControlLabelProps: FormControlLabelProps,
110
- RadioProps: RadioProps
111
- }, rest));
112
- }), text && /*#__PURE__*/React.createElement(FormHelperText, FormHelperTextProps, text)));
18
+ const PREFIX = 'Radio';
19
+ const classes = {
20
+ grid: `${PREFIX}-grid`,
113
21
  };
114
- export default Radio;
22
+ const StyledFormFieldGrid = styled(FormFieldGrid)(() => ({
23
+ [`&.${classes.grid}`]: {
24
+ '&:first-of-type': {
25
+ marginTop: 8,
26
+ },
27
+ },
28
+ }));
29
+ function RadioOption(_a) {
30
+ var { name, option, isDisabled, isReadOnly, FormControlLabelProps } = _a, _b = _a.RadioProps, _c = _b === void 0 ? {} : _b, { inputProps } = _c, RadioProps = __rest(_c, ["inputProps"]), props = __rest(_a, ["name", "option", "isDisabled", "isReadOnly", "FormControlLabelProps", "RadioProps"]);
31
+ const { input } = useFieldApi({ name, type: 'radio', value: option.value });
32
+ return (_jsx(FormControlLabel, Object.assign({ control: _jsx(MUIRadio, Object.assign({}, input, { name: name, disabled: isDisabled || isReadOnly, onChange: () => input.onChange(option.value), inputProps: Object.assign({ readOnly: isReadOnly }, inputProps) }, RadioProps)), label: option.label }, FormControlLabelProps, props), `${name}-${String(option.value)}`));
33
+ }
34
+ function Radio(_a) {
35
+ var { name } = _a, props = __rest(_a, ["name"]);
36
+ const _b = useFieldApi(Object.assign(Object.assign({}, props), { name, type: 'radio' })), { options = [], isDisabled, label, isRequired, helperText, description, isReadOnly, meta, validateOnMount, FormFieldGridProps = {}, FormControlProps = {}, FormLabelProps = {}, FormHelperTextProps = {}, FormControlLabelProps = {}, RadioProps = {} } = _b, rest = __rest(_b, ["options", "isDisabled", "label", "isRequired", "helperText", "description", "isReadOnly", "meta", "validateOnMount", "FormFieldGridProps", "FormControlProps", "FormLabelProps", "FormHelperTextProps", "FormControlLabelProps", "RadioProps"]);
37
+ const invalid = validationError(meta, validateOnMount);
38
+ const text = invalid || ((meta.touched || validateOnMount) && meta.warning) || helperText || description;
39
+ return (_jsx(StyledFormFieldGrid, Object.assign({ className: classes.grid }, FormFieldGridProps, { children: _jsxs(FormControl, Object.assign({ required: isRequired, error: !!invalid, component: "fieldset" }, FormControlProps, { children: [_jsx(FormLabel, Object.assign({ component: "legend" }, FormLabelProps, { children: label })), options.map((option) => (_jsx(RadioOption, Object.assign({ name: name || '', option: option, isDisabled: isDisabled, isReadOnly: isReadOnly, FormControlLabelProps: FormControlLabelProps, RadioProps: RadioProps }, rest), String(option.value)))), text && _jsx(FormHelperText, Object.assign({}, FormHelperTextProps, { children: text }))] })) })));
40
+ }
41
+ export default Radio;
42
+ //# sourceMappingURL=radio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio.js","sourceRoot":"","sources":["../../src/radio/radio.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE5G,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAIrE,OAAO,aAAa,MAAM,oCAAoC,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAGvE,MAAM,MAAM,GAAG,OAAO,CAAC;AAEvB,MAAM,OAAO,GAAG;IACd,IAAI,EAAE,GAAG,MAAM,OAAO;CACvB,CAAC;AAEF,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE;QACrB,iBAAiB,EAAE;YACjB,SAAS,EAAE,CAAC;SACb;KACF;CACF,CAAC,CAAC,CAAC;AAeJ,SAAS,WAAW,CAAkB,EAQhB;QARgB,EACpC,IAAI,EACJ,MAAM,EACN,UAAU,EACV,UAAU,EACV,qBAAqB,OAGD,EAFpB,kBAA8C,EAA9C,qBAA4C,EAAE,KAAA,EAA9C,EAAc,UAAU,OAAsB,EAAjB,UAAU,cAA3B,cAA6B,CAAF,EACpC,KAAK,cAP4B,qFAQrC,CADS;IAER,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC,EA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AW,CAAC;IAEzG,OAAO,CACL,KAAC,mBAAmB,kBAAC,SAAS,EAAE,OAAO,CAAC,IAAI,IAAM,kBAAkB,cAClE,MAAC,WAAW,kBAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,EAAC,UAAU,IAAK,gBAAgB,eAC5F,KAAC,SAAS,kBAAC,SAAS,EAAC,QAAQ,IAAK,cAAc,cAC7C,KAAK,IACI,EACX,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,KAAC,WAAW,kBAEV,IAAI,EAAE,IAAI,IAAI,EAAE,EAChB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,qBAAqB,EAAE,qBAAqB,EAC5C,UAAU,EAAE,UAAU,IAClB,IAAI,GAPH,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAQzB,CACH,CAAC,EACD,IAAI,IAAI,KAAC,cAAc,oBAAK,mBAAmB,cAAG,IAAI,IAAkB,KAC7D,IACM,CACvB,CAAC;AACJ,CAAC;AAED,eAAe,KAAK,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './select';
2
+ export * from './select';
@@ -1,2 +1,3 @@
1
1
  export { default } from './select';
2
- export * from './select';
2
+ export * from './select';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/select/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,cAAc,UAAU,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { BaseFieldProps } from '@data-driven-forms/react-form-renderer';
2
+ import type { SelectOption, OptionValue } from '@data-driven-forms/common';
3
+ export interface SelectProps<T = OptionValue> extends BaseFieldProps {
4
+ options?: SelectOption<T>[];
5
+ loadOptions?: (inputValue: string) => Promise<SelectOption<T>[]>;
6
+ isSearchable?: boolean;
7
+ isMulti?: boolean;
8
+ multiple?: boolean;
9
+ isClearable?: boolean;
10
+ disableClearable?: boolean;
11
+ hideSelectedOptions?: boolean;
12
+ closeMenuOnSelect?: boolean;
13
+ isFetching?: boolean;
14
+ noOptionsMessage?: () => string;
15
+ noOptionsText?: () => string;
16
+ loadingMessage?: string;
17
+ loadingText?: string;
18
+ placeholder?: string;
19
+ FormFieldGridProps?: Record<string, any>;
20
+ TextFieldProps?: {
21
+ inputProps?: Record<string, any>;
22
+ [key: string]: any;
23
+ };
24
+ inputProps?: Record<string, any>;
25
+ classNamePrefix?: string;
26
+ onInputChange?: (value: string) => void;
27
+ [key: string]: any;
28
+ }
29
+ /**
30
+ * Returns label of selected option
31
+ * @param {Object|Array} option currently selected option
32
+ * @param {Array<Object>} options all options available
33
+ * @returns {String}
34
+ */
35
+ export declare function getOptionLabel<T = OptionValue>(option: T | SelectOption<T> | undefined, options: SelectOption<T>[]): string;
36
+ /**
37
+ * Function that creates correct DDF select value format
38
+ * @param {Object|Array} option currently selected values
39
+ * @param {Boolean} isMulti multiple select flag
40
+ * @returns {Object|Array<Object>}
41
+ */
42
+ export declare function createValue<T = OptionValue>(option: T | SelectOption<T> | (T | SelectOption<T>)[] | null, isMulti: boolean): T | SelectOption<T> | (T | SelectOption<T>)[] | undefined;
43
+ declare function Select<T = OptionValue>(props: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
44
+ export default Select;
@@ -1,176 +1,69 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- import _typeof from "@babel/runtime/helpers/typeof";
5
- var _excluded = ["inputProps"],
6
- _excluded2 = ["value", "options", "label", "helperText", "validateOnMount", "meta", "isSearchable", "description", "classNamePrefix", "isMulti", "placeholder", "onInputChange", "isFetching", "noOptionsMessage", "hideSelectedOptions", "closeMenuOnSelect", "required", "onChange", "onFocus", "onBlur", "FormFieldGridProps", "TextFieldProps", "inputProps", "isClearable", "isDisabled", "loadingText"],
7
- _excluded3 = ["input", "isRequired", "isDisabled", "isReadOnly", "disabled", "multiple", "isMulti", "isClearable", "disableClearable", "loadingMessage", "loadingText", "noOptionsMessage", "noOptionsText", "closeMenuOnSelect"];
8
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
- import React, { useMemo } from 'react';
11
- import FormFieldGrid from '../form-field-grid/form-field-grid';
12
- import { validationError } from '../validation-error/validation-error';
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { useMemo } from 'react';
14
+ import { useFieldApi } from '@data-driven-forms/react-form-renderer';
13
15
  import DDFSelect from '@data-driven-forms/common/select';
14
16
  import parseInternalValue from '@data-driven-forms/common/select/parse-internal-value';
15
- import useFieldApi from "@data-driven-forms/react-form-renderer/use-field-api";
16
- import TextField from "@mui/material/TextField";
17
- import CircularProgress from "@mui/material/CircularProgress";
17
+ import { TextField, CircularProgress } from '@mui/material';
18
18
  import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
19
- import Autocomplete from "@mui/material/Autocomplete";
19
+ import { Autocomplete } from '@mui/material';
20
+ import FormFieldGrid from '../form-field-grid/form-field-grid';
21
+ import { validationError } from '../validation-error/validation-error';
20
22
  /**
21
23
  * Returns label of selected option
22
24
  * @param {Object|Array} option currently selected option
23
- * @param {Array<Object>} options all options avaiable
25
+ * @param {Array<Object>} options all options available
24
26
  * @returns {String}
25
27
  */
26
- var _getOptionLabel = function getOptionLabel(option, options) {
27
- if (typeof option === 'undefined') {
28
- return '';
29
- }
30
- if (option === '') {
31
- return '';
32
- }
33
- if (Array.isArray(option) && option.length === 0) {
34
- return '';
35
- }
36
- if (_typeof(option) === 'object') {
37
- return option.label;
38
- }
39
- var item = options.find(function (_ref) {
40
- var value = _ref.value;
41
- return value === option;
42
- });
43
- return item && item.label || '';
44
- };
45
-
28
+ export function getOptionLabel(option, options) {
29
+ if (typeof option === 'undefined') {
30
+ return '';
31
+ }
32
+ if (option === '') {
33
+ return '';
34
+ }
35
+ if (Array.isArray(option) && option.length === 0) {
36
+ return '';
37
+ }
38
+ if (typeof option === 'object') {
39
+ return String(option.label);
40
+ }
41
+ const item = options.find(({ value }) => value === option);
42
+ return (item && String(item.label)) || '';
43
+ }
46
44
  /**
47
45
  * Function that creates correct DDF select value format
48
46
  * @param {Object|Array} option currently selected values
49
47
  * @param {Boolean} isMulti multiple select flag
50
48
  * @returns {Object|Array<Object>}
51
49
  */
52
- export { _getOptionLabel as getOptionLabel };
53
- export var createValue = function createValue(option, isMulti) {
54
- if (isMulti) {
55
- return Array.isArray(option) ? option.map(function (item) {
56
- return _typeof(item) === 'object' ? item : {
57
- value: item
58
- };
59
- }) : option;
60
- }
61
- return option;
62
- };
63
- var InternalSelect = function InternalSelect(_ref2) {
64
- var value = _ref2.value,
65
- options = _ref2.options,
66
- label = _ref2.label,
67
- helperText = _ref2.helperText,
68
- validateOnMount = _ref2.validateOnMount,
69
- meta = _ref2.meta,
70
- isSearchable = _ref2.isSearchable,
71
- description = _ref2.description,
72
- classNamePrefix = _ref2.classNamePrefix,
73
- isMulti = _ref2.isMulti,
74
- _ref2$placeholder = _ref2.placeholder,
75
- placeholder = _ref2$placeholder === void 0 ? 'Please choose' : _ref2$placeholder,
76
- _onInputChange = _ref2.onInputChange,
77
- isFetching = _ref2.isFetching,
78
- noOptionsMessage = _ref2.noOptionsMessage,
79
- hideSelectedOptions = _ref2.hideSelectedOptions,
80
- closeMenuOnSelect = _ref2.closeMenuOnSelect,
81
- required = _ref2.required,
82
- _onChange = _ref2.onChange,
83
- onFocus = _ref2.onFocus,
84
- onBlur = _ref2.onBlur,
85
- _ref2$FormFieldGridPr = _ref2.FormFieldGridProps,
86
- FormFieldGridProps = _ref2$FormFieldGridPr === void 0 ? {} : _ref2$FormFieldGridPr,
87
- _ref2$TextFieldProps = _ref2.TextFieldProps,
88
- _ref2$TextFieldProps2 = _ref2$TextFieldProps === void 0 ? {} : _ref2$TextFieldProps,
89
- textFieldInputProps = _ref2$TextFieldProps2.inputProps,
90
- TextFieldProps = _objectWithoutProperties(_ref2$TextFieldProps2, _excluded),
91
- _ref2$inputProps = _ref2.inputProps,
92
- inputProps = _ref2$inputProps === void 0 ? {} : _ref2$inputProps,
93
- isClearable = _ref2.isClearable,
94
- isDisabled = _ref2.isDisabled,
95
- _ref2$loadingText = _ref2.loadingText,
96
- loadingText = _ref2$loadingText === void 0 ? 'Loading...' : _ref2$loadingText,
97
- rest = _objectWithoutProperties(_ref2, _excluded2);
98
- var invalid = validationError(meta, validateOnMount);
99
- // When isMulti is true, the "parseInternalValue" always creates new value array, we need to memoize it to not create new array instance
100
- // Memo is required to fix https://github.com/data-driven-forms/react-forms/issues/1366
101
- var internalValue = useMemo(function () {
102
- return parseInternalValue(value, isMulti);
103
- }, [value, isMulti]);
104
- return /*#__PURE__*/React.createElement(FormFieldGrid, FormFieldGridProps, /*#__PURE__*/React.createElement(Autocomplete, _extends({
105
- filterSelectedOptions: hideSelectedOptions,
106
- disabled: isDisabled,
107
- disableClearable: isClearable,
108
- popupIcon: isFetching ? /*#__PURE__*/React.createElement(CircularProgress, {
109
- size: 20,
110
- color: "inherit"
111
- }) : /*#__PURE__*/React.createElement(ArrowDropDownIcon, null),
112
- fullWidth: true,
113
- loadingText: loadingText
114
- }, rest, {
115
- renderInput: function renderInput(params) {
116
- return /*#__PURE__*/React.createElement(TextField, _extends({
117
- onFocus: onFocus,
118
- onBlur: onBlur
119
- }, params, {
120
- required: required,
121
- error: !!invalid,
122
- helperText: invalid || (meta.touched || validateOnMount) && meta.warning || helperText || description,
123
- label: label,
124
- margin: "normal"
125
- }, TextFieldProps, {
126
- inputProps: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, params.inputProps), textFieldInputProps), inputProps), {}, {
127
- readOnly: !isSearchable,
128
- placeholder: !internalValue || internalValue.length === 0 ? placeholder : undefined
129
- })
130
- }));
131
- },
132
- noOptionsText: noOptionsMessage(),
133
- onInputChange: function onInputChange(_event, value) {
134
- return _onInputChange(value);
135
- },
136
- options: options,
137
- multiple: isMulti,
138
- getOptionLabel: function getOptionLabel(option) {
139
- return _getOptionLabel(option, options);
140
- },
141
- value: typeof internalValue === 'undefined' ? null : internalValue,
142
- onChange: function onChange(_event, option) {
143
- return _onChange(createValue(option, isMulti));
144
- },
145
- loading: isFetching
146
- })));
147
- };
148
- var Select = function Select(props) {
149
- var _useFieldApi = useFieldApi(props),
150
- input = _useFieldApi.input,
151
- isRequired = _useFieldApi.isRequired,
152
- isDisabled = _useFieldApi.isDisabled,
153
- isReadOnly = _useFieldApi.isReadOnly,
154
- disabled = _useFieldApi.disabled,
155
- multiple = _useFieldApi.multiple,
156
- isMulti = _useFieldApi.isMulti,
157
- isClearable = _useFieldApi.isClearable,
158
- disableClearable = _useFieldApi.disableClearable,
159
- loadingMessage = _useFieldApi.loadingMessage,
160
- loadingText = _useFieldApi.loadingText,
161
- noOptionsMessage = _useFieldApi.noOptionsMessage,
162
- noOptionsText = _useFieldApi.noOptionsText,
163
- closeMenuOnSelect = _useFieldApi.closeMenuOnSelect,
164
- rest = _objectWithoutProperties(_useFieldApi, _excluded3);
165
- return /*#__PURE__*/React.createElement(DDFSelect, _extends({}, input, {
166
- isMulti: multiple || isMulti,
167
- required: isRequired,
168
- disabled: isDisabled || isReadOnly || disabled,
169
- disableClearable: !isClearable || disableClearable,
170
- loadingText: loadingMessage || loadingText,
171
- noOptionsMessage: noOptionsMessage || noOptionsText
172
- }, rest, {
173
- SelectComponent: InternalSelect
174
- }));
175
- };
176
- export default Select;
50
+ export function createValue(option, isMulti) {
51
+ if (isMulti) {
52
+ return Array.isArray(option) ? option.map((item) => (typeof item === 'object' ? item : { value: item })) : option;
53
+ }
54
+ return option;
55
+ }
56
+ function InternalSelect(_a) {
57
+ var { value, options, label, helperText, validateOnMount, meta, isSearchable, description, classNamePrefix, isMulti, placeholder = 'Please choose', onInputChange, isFetching, noOptionsMessage, hideSelectedOptions, closeMenuOnSelect, required, onChange, onFocus, onBlur, FormFieldGridProps = {} } = _a, _b = _a.TextFieldProps, _c = _b === void 0 ? {} : _b, { inputProps: textFieldInputProps } = _c, TextFieldProps = __rest(_c, ["inputProps"]), { inputProps = {}, isClearable, isDisabled, loadingText = 'Loading...' } = _a, rest = __rest(_a, ["value", "options", "label", "helperText", "validateOnMount", "meta", "isSearchable", "description", "classNamePrefix", "isMulti", "placeholder", "onInputChange", "isFetching", "noOptionsMessage", "hideSelectedOptions", "closeMenuOnSelect", "required", "onChange", "onFocus", "onBlur", "FormFieldGridProps", "TextFieldProps", "inputProps", "isClearable", "isDisabled", "loadingText"]);
58
+ const invalid = validationError(meta, validateOnMount);
59
+ // When isMulti is true, the "parseInternalValue" always creates new value array, we need to memoize it to not create new array instance
60
+ // Memo is required to fix https://github.com/data-driven-forms/react-forms/issues/1366
61
+ const internalValue = useMemo(() => parseInternalValue(value, isMulti), [value, isMulti]);
62
+ return (_jsx(FormFieldGrid, Object.assign({}, FormFieldGridProps, { children: _jsx(Autocomplete, Object.assign({ filterSelectedOptions: hideSelectedOptions, disabled: isDisabled, disableClearable: isClearable, popupIcon: isFetching ? _jsx(CircularProgress, { size: 20, color: "inherit" }) : _jsx(ArrowDropDownIcon, {}), fullWidth: true, loadingText: loadingText }, rest, { renderInput: (params) => (_jsx(TextField, Object.assign({ onFocus: onFocus, onBlur: onBlur }, params, { required: required, error: !!invalid, helperText: invalid || ((meta.touched || validateOnMount) && meta.warning) || helperText || description, label: label, margin: "normal" }, TextFieldProps, { inputProps: Object.assign(Object.assign(Object.assign(Object.assign({}, params.inputProps), textFieldInputProps), inputProps), { readOnly: !isSearchable, placeholder: !internalValue || internalValue.length === 0 ? placeholder : undefined }) }))), noOptionsText: noOptionsMessage && noOptionsMessage(), onInputChange: (_event, value) => onInputChange(value), options: options, multiple: isMulti, getOptionLabel: (option) => getOptionLabel(option, options), value: typeof internalValue === 'undefined' ? null : internalValue, onChange: (_event, option) => onChange(createValue(option, isMulti)), loading: isFetching })) })));
63
+ }
64
+ function Select(props) {
65
+ const _a = useFieldApi(props), { input, isRequired, isDisabled, isReadOnly, disabled, multiple, isMulti, isClearable, disableClearable, loadingMessage, loadingText, noOptionsMessage, noOptionsText, closeMenuOnSelect } = _a, rest = __rest(_a, ["input", "isRequired", "isDisabled", "isReadOnly", "disabled", "multiple", "isMulti", "isClearable", "disableClearable", "loadingMessage", "loadingText", "noOptionsMessage", "noOptionsText", "closeMenuOnSelect"]);
66
+ return (_jsx(DDFSelect, Object.assign({}, input, { isMulti: multiple || isMulti, required: isRequired, disabled: isDisabled || isReadOnly || disabled, disableClearable: !isClearable || disableClearable, loadingText: loadingMessage || loadingText, noOptionsMessage: noOptionsMessage || noOptionsText }, rest, { SelectComponent: InternalSelect })));
67
+ }
68
+ export default Select;
69
+ //# sourceMappingURL=select.js.map
@@ -0,0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AC,CAAC,CAAC,aAAa,EAClE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACpE,OAAO,EAAE,UAAU,IACnB,IACY,CACjB,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAkB,KAAqB;IACpD,MAAM,KAgBF,WAAW,CAAC,KAAK,CAAC,EAhBhB,EACJ,KAAK,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,iBAAiB,OAEG,EADjB,IAAI,cAfH,oNAgBL,CAAqB,CAAC;IAEvB,OAAO,CACL,KAAC,SAAS,oBACJ,KAAK,IACT,OAAO,EAAE,QAAQ,IAAI,OAAO,EAC5B,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,UAAU,IAAI,UAAU,IAAI,QAAQ,EAC9C,gBAAgB,EAAE,CAAC,WAAW,IAAI,gBAAgB,EAClD,WAAW,EAAE,cAAc,IAAI,WAAW,EAC1C,gBAAgB,EAAE,gBAAgB,IAAI,aAAa,IAC/C,IAAI,IACR,eAAe,EAAE,cAAc,IAC/B,CACH,CAAC;AACJ,CAAC;AAED,eAAe,MAAM,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './slider';
2
+ export * from './slider';
@@ -1,2 +1,3 @@
1
1
  export { default } from './slider';
2
- export * from './slider';
2
+ export * from './slider';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/slider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,cAAc,UAAU,CAAC"}
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import type { FormControlProps, FormGroupProps, FormHelperTextProps, SliderProps as MUISliderProps, FormLabelProps, GridProps } from '@mui/material';
3
+ import type { BaseFieldProps } from '@data-driven-forms/react-form-renderer';
4
+ import type { FormFieldGridProps } from '../form-field-grid/form-field-grid';
5
+ export interface SliderProps extends BaseFieldProps {
6
+ FormFieldGridProps?: FormFieldGridProps;
7
+ FormControlProps?: FormControlProps;
8
+ FormGroupProps?: FormGroupProps;
9
+ FormLabelProps?: FormLabelProps;
10
+ FormHelperTextProps?: FormHelperTextProps;
11
+ before?: React.ReactNode;
12
+ after?: React.ReactNode;
13
+ InputGridProps?: GridProps;
14
+ BeforeGridProps?: GridProps;
15
+ SliderGridProps?: GridProps;
16
+ AfterGridProps?: GridProps;
17
+ min?: number;
18
+ max?: number;
19
+ step?: number;
20
+ SliderProps?: Omit<MUISliderProps, 'name' | 'value' | 'onChange' | 'onBlur' | 'onFocus'>;
21
+ [key: string]: any;
22
+ }
23
+ declare const Slider: React.FC<SliderProps>;
24
+ export default Slider;
@@ -1,66 +1,25 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["input", "isReadOnly", "isDisabled", "isRequired", "label", "helperText", "description", "validateOnMount", "meta", "FormFieldGridProps", "FormControlProps", "FormGroupProps", "FormLabelProps", "FormHelperTextProps", "before", "after", "InputGridProps", "BeforeGridProps", "SliderGridProps", "AfterGridProps"];
4
- import React from 'react';
5
- import FormControl from "@mui/material/FormControl";
6
- import FormGroup from "@mui/material/FormGroup";
7
- import FormHelperText from "@mui/material/FormHelperText";
8
- import MUISlider from "@mui/material/Slider";
9
- import FormLabel from "@mui/material/FormLabel";
10
- import Grid from "@mui/material/Grid";
11
- import useFieldApi from "@data-driven-forms/react-form-renderer/use-field-api";
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { FormControl, FormGroup, FormHelperText, Slider as MUISlider, FormLabel, Grid } from '@mui/material';
14
+ import { useFieldApi } from '@data-driven-forms/react-form-renderer';
12
15
  import FormFieldGrid from '../form-field-grid/form-field-grid';
13
16
  import { validationError } from '../validation-error/validation-error';
14
- var Slider = function Slider(props) {
15
- var _useFieldApi = useFieldApi(props),
16
- input = _useFieldApi.input,
17
- isReadOnly = _useFieldApi.isReadOnly,
18
- isDisabled = _useFieldApi.isDisabled,
19
- isRequired = _useFieldApi.isRequired,
20
- label = _useFieldApi.label,
21
- helperText = _useFieldApi.helperText,
22
- description = _useFieldApi.description,
23
- validateOnMount = _useFieldApi.validateOnMount,
24
- meta = _useFieldApi.meta,
25
- FormFieldGridProps = _useFieldApi.FormFieldGridProps,
26
- FormControlProps = _useFieldApi.FormControlProps,
27
- FormGroupProps = _useFieldApi.FormGroupProps,
28
- FormLabelProps = _useFieldApi.FormLabelProps,
29
- FormHelperTextProps = _useFieldApi.FormHelperTextProps,
30
- before = _useFieldApi.before,
31
- after = _useFieldApi.after,
32
- InputGridProps = _useFieldApi.InputGridProps,
33
- BeforeGridProps = _useFieldApi.BeforeGridProps,
34
- SliderGridProps = _useFieldApi.SliderGridProps,
35
- AfterGridProps = _useFieldApi.AfterGridProps,
36
- rest = _objectWithoutProperties(_useFieldApi, _excluded);
37
- var invalid = validationError(meta, validateOnMount);
38
- var text = invalid || (meta.touched || validateOnMount) && meta.warning || helperText || description;
39
- return /*#__PURE__*/React.createElement(FormFieldGrid, FormFieldGridProps, /*#__PURE__*/React.createElement(FormControl, _extends({
40
- fullWidth: true,
41
- required: isRequired,
42
- error: !!invalid,
43
- component: "fieldset"
44
- }, FormControlProps), /*#__PURE__*/React.createElement(FormGroup, FormGroupProps, /*#__PURE__*/React.createElement(FormLabel, _extends({
45
- component: "legend"
46
- }, FormLabelProps), label), /*#__PURE__*/React.createElement(Grid, _extends({
47
- container: true,
48
- spacing: 2,
49
- alignItems: "center"
50
- }, InputGridProps), before && /*#__PURE__*/React.createElement(Grid, _extends({
51
- item: true
52
- }, BeforeGridProps), before), /*#__PURE__*/React.createElement(Grid, _extends({
53
- item: true,
54
- xs: true
55
- }, SliderGridProps), /*#__PURE__*/React.createElement(MUISlider, _extends({}, input, {
56
- value: input.value || (rest.max + rest.min) / 2 || 50
57
- }, rest, {
58
- disabled: isDisabled || isReadOnly,
59
- onChange: function onChange(_e, value) {
60
- return input.onChange(value);
61
- }
62
- }))), after && /*#__PURE__*/React.createElement(Grid, _extends({
63
- item: true
64
- }, AfterGridProps), after)), text && /*#__PURE__*/React.createElement(FormHelperText, FormHelperTextProps, text))));
17
+ const Slider = (props) => {
18
+ const _a = useFieldApi(props), { input, isReadOnly, isDisabled, isRequired, label, helperText, description, validateOnMount, meta, FormFieldGridProps = {}, FormControlProps = {}, FormGroupProps = {}, FormLabelProps = {}, FormHelperTextProps = {}, before, after, InputGridProps = {}, BeforeGridProps = {}, SliderGridProps = {}, AfterGridProps = {}, min = 0, max = 100, SliderProps = {} } = _a, rest = __rest(_a, ["input", "isReadOnly", "isDisabled", "isRequired", "label", "helperText", "description", "validateOnMount", "meta", "FormFieldGridProps", "FormControlProps", "FormGroupProps", "FormLabelProps", "FormHelperTextProps", "before", "after", "InputGridProps", "BeforeGridProps", "SliderGridProps", "AfterGridProps", "min", "max", "SliderProps"]);
19
+ const invalid = validationError(meta, validateOnMount);
20
+ const text = invalid || ((meta.touched || validateOnMount) && meta.warning) || helperText || description;
21
+ const defaultValue = (max + min) / 2;
22
+ return (_jsx(FormFieldGrid, Object.assign({}, FormFieldGridProps, { children: _jsx(FormControl, Object.assign({ fullWidth: true, required: isRequired, error: !!invalid, component: "fieldset" }, FormControlProps, { children: _jsxs(FormGroup, Object.assign({}, FormGroupProps, { children: [_jsx(FormLabel, Object.assign({ component: "legend" }, FormLabelProps, { children: label })), _jsxs(Grid, Object.assign({ container: true, spacing: 2, alignItems: "center" }, InputGridProps, { children: [before && (_jsx(Grid, Object.assign({ item: true }, BeforeGridProps, { children: before }))), _jsx(Grid, Object.assign({ item: true, xs: true }, SliderGridProps, { children: _jsx(MUISlider, Object.assign({}, input, { value: input.value || defaultValue, min: min, max: max, disabled: isDisabled || isReadOnly, onChange: (_e, value) => input.onChange(value) }, SliderProps, rest)) })), after && (_jsx(Grid, Object.assign({ item: true }, AfterGridProps, { children: after })))] })), text && _jsx(FormHelperText, Object.assign({}, FormHelperTextProps, { children: text }))] })) })) })));
65
23
  };
66
- export default Slider;
24
+ export default Slider;
25
+ //# sourceMappingURL=slider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slider.js","sourceRoot":"","sources":["../../src/slider/slider.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,IAAI,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE7G,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAGrE,OAAO,aAAa,MAAM,oCAAoC,CAAC;AAE/D,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAsBvE,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE;IAC9C,MAAM,KAyBF,WAAW,CAAC,KAAK,CAAC,EAzBhB,EACJ,KAAK,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,KAAK,EACL,UAAU,EACV,WAAW,EACX,eAAe,EACf,IAAI,EACJ,kBAAkB,GAAG,EAAE,EACvB,gBAAgB,GAAG,EAAE,EACrB,cAAc,GAAG,EAAE,EACnB,cAAc,GAAG,E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ClC,QAAQ,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAC1C,WAAW,EACX,IAAI,EACR,IACG,EACN,KAAK,IAAI,CACR,KAAC,IAAI,kBAAC,IAAI,UAAK,cAAc,cAC1B,KAAK,IACD,CACR,KACI,EACN,IAAI,IAAI,KAAC,cAAc,oBAAK,mBAAmB,cAAG,IAAI,IAAkB,KAC/D,IACA,IACA,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './sub-form';
2
+ export * from './sub-form';
@@ -1,2 +1,3 @@
1
1
  export { default } from './sub-form';
2
- export * from './sub-form';
2
+ export * from './sub-form';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sub-form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,cAAc,YAAY,CAAC"}