@elliemae/ds-number-range-field 1.60.0 → 2.0.0-alpha.12
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/cjs/DSNumberRangeField.js +25 -43
- package/cjs/DSNumberRangeField.stories.js +18 -0
- package/cjs/impl/NumberRangeFieldImpl.js +72 -79
- package/cjs/index.js +1 -10
- package/cjs/stories/DSNumberRangeField-overview.stories.js +26 -0
- package/esm/DSNumberRangeField.js +22 -40
- package/esm/DSNumberRangeField.stories.js +9 -0
- package/esm/impl/NumberRangeFieldImpl.js +70 -75
- package/esm/index.js +0 -9
- package/esm/stories/DSNumberRangeField-overview.stories.js +17 -0
- package/package.json +37 -12
- package/types/DSNumberRangeField.d.ts +107 -0
- package/types/DSNumberRangeField.stories.d.ts +7 -0
- package/types/impl/NumberRangeFieldImpl.d.ts +18 -0
- package/types/index.d.ts +1 -0
- package/types/stories/DSNumberRangeField-overview.stories.d.ts +1 -0
- package/DSNumberRangeField/package.json +0 -10
- package/cjs/DSNumberRangeField.js.map +0 -1
- package/cjs/impl/NumberRangeFieldImpl.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/esm/DSNumberRangeField.js.map +0 -1
- package/esm/impl/NumberRangeFieldImpl.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/impl/NumberRangeFieldImpl/package.json +0 -10
|
@@ -2,49 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('react');
|
|
6
7
|
var reactDesc = require('react-desc');
|
|
7
|
-
var
|
|
8
|
-
require('@babel/runtime/helpers/extends');
|
|
9
|
-
require('@babel/runtime/helpers/defineProperty');
|
|
10
|
-
require('@babel/runtime/helpers/slicedToArray');
|
|
11
|
-
require('@elliemae/ds-classnames');
|
|
12
|
-
require('@elliemae/ds-form');
|
|
8
|
+
var NumberRangeFieldImpl = require('./impl/NumberRangeFieldImpl.js');
|
|
13
9
|
|
|
14
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
11
|
|
|
16
|
-
var
|
|
12
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
17
13
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
placeholderTo = _ref$placeholderTo === void 0 ? 'To' : _ref$placeholderTo,
|
|
37
|
-
_ref$stepFrom = _ref.stepFrom,
|
|
38
|
-
stepFrom = _ref$stepFrom === void 0 ? 1 : _ref$stepFrom,
|
|
39
|
-
_ref$stepTo = _ref.stepTo,
|
|
40
|
-
stepTo = _ref$stepTo === void 0 ? 1 : _ref$stepTo,
|
|
41
|
-
_ref$value = _ref.value,
|
|
42
|
-
value = _ref$value === void 0 ? [] : _ref$value,
|
|
43
|
-
_ref$separator = _ref.separator,
|
|
44
|
-
separator = _ref$separator === void 0 ? '-' : _ref$separator,
|
|
45
|
-
maskOptions = _ref.maskOptions,
|
|
46
|
-
type = _ref.type;
|
|
47
|
-
return /*#__PURE__*/React__default['default'].createElement(impl_NumberRangeFieldImpl, {
|
|
14
|
+
const DSNumberRangeField = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
containerProps = {},
|
|
17
|
+
maxFrom = null,
|
|
18
|
+
minFrom = 0,
|
|
19
|
+
maxTo = null,
|
|
20
|
+
minTo = 0,
|
|
21
|
+
onChange = () => null,
|
|
22
|
+
placeholderFrom = 'From',
|
|
23
|
+
placeholderTo = 'To',
|
|
24
|
+
stepFrom = 1,
|
|
25
|
+
stepTo = 1,
|
|
26
|
+
value = [],
|
|
27
|
+
separator = '-',
|
|
28
|
+
maskOptions,
|
|
29
|
+
type
|
|
30
|
+
} = _ref;
|
|
31
|
+
return /*#__PURE__*/_jsx__default["default"](NumberRangeFieldImpl, {
|
|
48
32
|
containerProps: containerProps,
|
|
49
33
|
maxFrom: maxFrom,
|
|
50
34
|
maxTo: maxTo,
|
|
@@ -62,7 +46,7 @@ var DSNumberRangeField = function DSNumberRangeField(_ref) {
|
|
|
62
46
|
});
|
|
63
47
|
};
|
|
64
48
|
|
|
65
|
-
|
|
49
|
+
const numberRangeFieldProps = {
|
|
66
50
|
containerProps: reactDesc.PropTypes.object.description('Set of Properties attached to the main container'),
|
|
67
51
|
maxFrom: reactDesc.PropTypes.number.description('Maximum number accepted in `From` field').defaultValue(null),
|
|
68
52
|
minFrom: reactDesc.PropTypes.number.description('Minimum number accepted in `From` field').defaultValue(0),
|
|
@@ -78,10 +62,8 @@ var numberRangeFieldProps = {
|
|
|
78
62
|
maskOptions: reactDesc.PropTypes.object.description('Object with mask configurations'),
|
|
79
63
|
type: reactDesc.PropTypes.string.description('Type of input')
|
|
80
64
|
};
|
|
81
|
-
|
|
82
|
-
var NumberRangeFieldWithSchema = reactDesc.describe(DSNumberRangeField);
|
|
65
|
+
const NumberRangeFieldWithSchema = reactDesc.describe(DSNumberRangeField);
|
|
83
66
|
NumberRangeFieldWithSchema.propTypes = numberRangeFieldProps;
|
|
84
67
|
|
|
85
68
|
exports.NumberRangeFieldWithSchema = NumberRangeFieldWithSchema;
|
|
86
|
-
exports[
|
|
87
|
-
//# sourceMappingURL=DSNumberRangeField.js.map
|
|
69
|
+
exports["default"] = DSNumberRangeField;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var DSNumberRangeField = require('@elliemae/ds-number-range-field');
|
|
6
|
+
var DSNumberRangeFieldOverview_stories = require('./stories/DSNumberRangeField-overview.stories.js');
|
|
7
|
+
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var DSNumberRangeField__default = /*#__PURE__*/_interopDefaultLegacy(DSNumberRangeField);
|
|
11
|
+
|
|
12
|
+
var DSNumberRangeField_stories = {
|
|
13
|
+
title: 'NumberRangeField',
|
|
14
|
+
component: DSNumberRangeField__default["default"]
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.Overview = DSNumberRangeFieldOverview_stories.Overview;
|
|
18
|
+
exports["default"] = DSNumberRangeField_stories;
|
|
@@ -1,55 +1,52 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
4
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
11
|
+
var react = require('react');
|
|
7
12
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
8
13
|
var dsForm = require('@elliemae/ds-form');
|
|
14
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
15
|
|
|
10
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
17
|
|
|
12
|
-
var
|
|
18
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
13
19
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
14
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
15
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
20
|
|
|
17
21
|
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; }
|
|
18
22
|
|
|
19
|
-
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__default[
|
|
23
|
+
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__default["default"](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; }
|
|
24
|
+
const {
|
|
25
|
+
cssClassName,
|
|
26
|
+
classNameElement,
|
|
27
|
+
classNameBlock
|
|
28
|
+
} = dsClassnames.convertPropToCssClassName('query-builder-addon-number-range-field');
|
|
20
29
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var _useState = React.useState(),
|
|
43
|
-
_useState2 = _slicedToArray__default['default'](_useState, 2),
|
|
44
|
-
valueFrom = _useState2[0],
|
|
45
|
-
setValueFrom = _useState2[1];
|
|
46
|
-
|
|
47
|
-
var _useState3 = React.useState(),
|
|
48
|
-
_useState4 = _slicedToArray__default['default'](_useState3, 2),
|
|
49
|
-
valueTo = _useState4[0],
|
|
50
|
-
setValueTo = _useState4[1];
|
|
51
|
-
|
|
52
|
-
React.useEffect(function () {
|
|
30
|
+
const DSSearchFieldImpl = _ref => {
|
|
31
|
+
let {
|
|
32
|
+
onChange,
|
|
33
|
+
containerProps,
|
|
34
|
+
maxFrom,
|
|
35
|
+
maxTo,
|
|
36
|
+
minFrom,
|
|
37
|
+
minTo,
|
|
38
|
+
placeholderFrom,
|
|
39
|
+
placeholderTo,
|
|
40
|
+
separator,
|
|
41
|
+
stepFrom,
|
|
42
|
+
stepTo,
|
|
43
|
+
value,
|
|
44
|
+
maskOptions,
|
|
45
|
+
type
|
|
46
|
+
} = _ref;
|
|
47
|
+
const [valueFrom, setValueFrom] = react.useState();
|
|
48
|
+
const [valueTo, setValueTo] = react.useState();
|
|
49
|
+
react.useEffect(() => {
|
|
53
50
|
if (Array.isArray(value)) {
|
|
54
51
|
setValueFrom(value[0]);
|
|
55
52
|
setValueTo(value[1]);
|
|
@@ -58,55 +55,51 @@ var DSSearchFieldImpl = function DSSearchFieldImpl(_ref) {
|
|
|
58
55
|
}
|
|
59
56
|
}, [value]);
|
|
60
57
|
|
|
61
|
-
|
|
58
|
+
const handleOnChange = (newValueFrom, newValueTo) => {
|
|
62
59
|
setValueFrom(newValueFrom);
|
|
63
60
|
setValueTo(newValueTo);
|
|
64
61
|
onChange([newValueFrom, newValueTo]);
|
|
65
62
|
};
|
|
66
63
|
|
|
67
|
-
|
|
64
|
+
const maskConfig = _objectSpread({
|
|
68
65
|
prefix: '',
|
|
69
66
|
includeThousandsSeparator: false
|
|
70
67
|
}, maskOptions);
|
|
71
68
|
|
|
72
|
-
return /*#__PURE__*/
|
|
73
|
-
className: "".concat(cssClassName)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
"data-testid": "ds-number-range-field__to-input"
|
|
108
|
-
})));
|
|
69
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
70
|
+
className: "".concat(cssClassName),
|
|
71
|
+
children: /*#__PURE__*/_jsx__default["default"]("div", {
|
|
72
|
+
className: classNameBlock('wrapper')
|
|
73
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](dsForm.DSInputMask, {
|
|
74
|
+
type: type,
|
|
75
|
+
max: maxFrom,
|
|
76
|
+
min: minFrom,
|
|
77
|
+
step: stepFrom,
|
|
78
|
+
value: valueFrom === null || valueFrom === void 0 ? void 0 : valueFrom.toString(),
|
|
79
|
+
placeholder: placeholderFrom,
|
|
80
|
+
mask: number => dsForm.MASK_TYPES.NUMBER(maskConfig)(number),
|
|
81
|
+
onChange: e => {
|
|
82
|
+
const newValueFrom = e.target.value;
|
|
83
|
+
handleOnChange(newValueFrom, valueTo);
|
|
84
|
+
},
|
|
85
|
+
"data-testid": "ds-number-range-field__from-input"
|
|
86
|
+
}), /*#__PURE__*/_jsx__default["default"]("div", {
|
|
87
|
+
className: classNameElement('separator')
|
|
88
|
+
}, void 0, separator), /*#__PURE__*/_jsx__default["default"](dsForm.DSInputMask, {
|
|
89
|
+
type: type,
|
|
90
|
+
max: maxTo,
|
|
91
|
+
min: minTo,
|
|
92
|
+
step: stepTo,
|
|
93
|
+
value: valueTo === null || valueTo === void 0 ? void 0 : valueTo.toString(),
|
|
94
|
+
placeholder: placeholderTo,
|
|
95
|
+
mask: number => dsForm.MASK_TYPES.NUMBER(maskConfig)(number),
|
|
96
|
+
onChange: e => {
|
|
97
|
+
const newValueTo = e.target.value;
|
|
98
|
+
handleOnChange(valueFrom, newValueTo);
|
|
99
|
+
},
|
|
100
|
+
"data-testid": "ds-number-range-field__to-input"
|
|
101
|
+
}))
|
|
102
|
+
}));
|
|
109
103
|
};
|
|
110
104
|
|
|
111
105
|
module.exports = DSSearchFieldImpl;
|
|
112
|
-
//# sourceMappingURL=NumberRangeFieldImpl.js.map
|
package/cjs/index.js
CHANGED
|
@@ -3,17 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var DSNumberRangeField = require('./DSNumberRangeField.js');
|
|
6
|
-
require('react');
|
|
7
|
-
require('react-desc');
|
|
8
|
-
require('./impl/NumberRangeFieldImpl.js');
|
|
9
|
-
require('@babel/runtime/helpers/extends');
|
|
10
|
-
require('@babel/runtime/helpers/defineProperty');
|
|
11
|
-
require('@babel/runtime/helpers/slicedToArray');
|
|
12
|
-
require('@elliemae/ds-classnames');
|
|
13
|
-
require('@elliemae/ds-form');
|
|
14
6
|
|
|
15
7
|
|
|
16
8
|
|
|
17
9
|
exports.NumberRangeFieldWithSchema = DSNumberRangeField.NumberRangeFieldWithSchema;
|
|
18
|
-
exports
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
10
|
+
exports["default"] = DSNumberRangeField["default"];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var DSNumberRangeField = require('@elliemae/ds-number-range-field');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
+
|
|
12
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
13
|
+
var DSNumberRangeField__default = /*#__PURE__*/_interopDefaultLegacy(DSNumberRangeField);
|
|
14
|
+
|
|
15
|
+
const Overview = () => {
|
|
16
|
+
const [value, setValue] = react.useState([1, 2]);
|
|
17
|
+
return /*#__PURE__*/_jsx__default["default"](DSNumberRangeField__default["default"], {
|
|
18
|
+
containerProps: {
|
|
19
|
+
id: 'my-custom-id'
|
|
20
|
+
},
|
|
21
|
+
onChange: setValue,
|
|
22
|
+
value: value
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.Overview = Overview;
|
|
@@ -1,42 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
2
3
|
import { PropTypes, describe } from 'react-desc';
|
|
3
4
|
import DSSearchFieldImpl from './impl/NumberRangeFieldImpl.js';
|
|
4
|
-
import '@babel/runtime/helpers/esm/extends';
|
|
5
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
6
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
7
|
-
import '@elliemae/ds-classnames';
|
|
8
|
-
import '@elliemae/ds-form';
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
placeholderTo = _ref$placeholderTo === void 0 ? 'To' : _ref$placeholderTo,
|
|
29
|
-
_ref$stepFrom = _ref.stepFrom,
|
|
30
|
-
stepFrom = _ref$stepFrom === void 0 ? 1 : _ref$stepFrom,
|
|
31
|
-
_ref$stepTo = _ref.stepTo,
|
|
32
|
-
stepTo = _ref$stepTo === void 0 ? 1 : _ref$stepTo,
|
|
33
|
-
_ref$value = _ref.value,
|
|
34
|
-
value = _ref$value === void 0 ? [] : _ref$value,
|
|
35
|
-
_ref$separator = _ref.separator,
|
|
36
|
-
separator = _ref$separator === void 0 ? '-' : _ref$separator,
|
|
37
|
-
maskOptions = _ref.maskOptions,
|
|
38
|
-
type = _ref.type;
|
|
39
|
-
return /*#__PURE__*/React.createElement(DSSearchFieldImpl, {
|
|
6
|
+
const DSNumberRangeField = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
containerProps = {},
|
|
9
|
+
maxFrom = null,
|
|
10
|
+
minFrom = 0,
|
|
11
|
+
maxTo = null,
|
|
12
|
+
minTo = 0,
|
|
13
|
+
onChange = () => null,
|
|
14
|
+
placeholderFrom = 'From',
|
|
15
|
+
placeholderTo = 'To',
|
|
16
|
+
stepFrom = 1,
|
|
17
|
+
stepTo = 1,
|
|
18
|
+
value = [],
|
|
19
|
+
separator = '-',
|
|
20
|
+
maskOptions,
|
|
21
|
+
type
|
|
22
|
+
} = _ref;
|
|
23
|
+
return /*#__PURE__*/_jsx(DSSearchFieldImpl, {
|
|
40
24
|
containerProps: containerProps,
|
|
41
25
|
maxFrom: maxFrom,
|
|
42
26
|
maxTo: maxTo,
|
|
@@ -54,7 +38,7 @@ var DSNumberRangeField = function DSNumberRangeField(_ref) {
|
|
|
54
38
|
});
|
|
55
39
|
};
|
|
56
40
|
|
|
57
|
-
|
|
41
|
+
const numberRangeFieldProps = {
|
|
58
42
|
containerProps: PropTypes.object.description('Set of Properties attached to the main container'),
|
|
59
43
|
maxFrom: PropTypes.number.description('Maximum number accepted in `From` field').defaultValue(null),
|
|
60
44
|
minFrom: PropTypes.number.description('Minimum number accepted in `From` field').defaultValue(0),
|
|
@@ -70,9 +54,7 @@ var numberRangeFieldProps = {
|
|
|
70
54
|
maskOptions: PropTypes.object.description('Object with mask configurations'),
|
|
71
55
|
type: PropTypes.string.description('Type of input')
|
|
72
56
|
};
|
|
73
|
-
|
|
74
|
-
var NumberRangeFieldWithSchema = describe(DSNumberRangeField);
|
|
57
|
+
const NumberRangeFieldWithSchema = describe(DSNumberRangeField);
|
|
75
58
|
NumberRangeFieldWithSchema.propTypes = numberRangeFieldProps;
|
|
76
59
|
|
|
77
60
|
export { NumberRangeFieldWithSchema, DSNumberRangeField as default };
|
|
78
|
-
//# sourceMappingURL=DSNumberRangeField.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import DSNumberRangeField from '@elliemae/ds-number-range-field';
|
|
2
|
+
export { Overview } from './stories/DSNumberRangeField-overview.stories.js';
|
|
3
|
+
|
|
4
|
+
var DSNumberRangeField_stories = {
|
|
5
|
+
title: 'NumberRangeField',
|
|
6
|
+
component: DSNumberRangeField
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { DSNumberRangeField_stories as default };
|
|
@@ -1,46 +1,45 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
8
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
9
|
+
import { useState, useEffect } from 'react';
|
|
5
10
|
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
6
11
|
import { DSInputMask, MASK_TYPES } from '@elliemae/ds-form';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
13
|
|
|
8
14
|
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; }
|
|
9
15
|
|
|
10
16
|
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; }
|
|
17
|
+
const {
|
|
18
|
+
cssClassName,
|
|
19
|
+
classNameElement,
|
|
20
|
+
classNameBlock
|
|
21
|
+
} = convertPropToCssClassName('query-builder-addon-number-range-field');
|
|
11
22
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var _useState = useState(),
|
|
34
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
-
valueFrom = _useState2[0],
|
|
36
|
-
setValueFrom = _useState2[1];
|
|
37
|
-
|
|
38
|
-
var _useState3 = useState(),
|
|
39
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
40
|
-
valueTo = _useState4[0],
|
|
41
|
-
setValueTo = _useState4[1];
|
|
42
|
-
|
|
43
|
-
useEffect(function () {
|
|
23
|
+
const DSSearchFieldImpl = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
onChange,
|
|
26
|
+
containerProps,
|
|
27
|
+
maxFrom,
|
|
28
|
+
maxTo,
|
|
29
|
+
minFrom,
|
|
30
|
+
minTo,
|
|
31
|
+
placeholderFrom,
|
|
32
|
+
placeholderTo,
|
|
33
|
+
separator,
|
|
34
|
+
stepFrom,
|
|
35
|
+
stepTo,
|
|
36
|
+
value,
|
|
37
|
+
maskOptions,
|
|
38
|
+
type
|
|
39
|
+
} = _ref;
|
|
40
|
+
const [valueFrom, setValueFrom] = useState();
|
|
41
|
+
const [valueTo, setValueTo] = useState();
|
|
42
|
+
useEffect(() => {
|
|
44
43
|
if (Array.isArray(value)) {
|
|
45
44
|
setValueFrom(value[0]);
|
|
46
45
|
setValueTo(value[1]);
|
|
@@ -49,55 +48,51 @@ var DSSearchFieldImpl = function DSSearchFieldImpl(_ref) {
|
|
|
49
48
|
}
|
|
50
49
|
}, [value]);
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
const handleOnChange = (newValueFrom, newValueTo) => {
|
|
53
52
|
setValueFrom(newValueFrom);
|
|
54
53
|
setValueTo(newValueTo);
|
|
55
54
|
onChange([newValueFrom, newValueTo]);
|
|
56
55
|
};
|
|
57
56
|
|
|
58
|
-
|
|
57
|
+
const maskConfig = _objectSpread({
|
|
59
58
|
prefix: '',
|
|
60
59
|
includeThousandsSeparator: false
|
|
61
60
|
}, maskOptions);
|
|
62
61
|
|
|
63
|
-
return /*#__PURE__*/
|
|
64
|
-
className: "".concat(cssClassName)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
"data-testid": "ds-number-range-field__to-input"
|
|
99
|
-
})));
|
|
62
|
+
return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
63
|
+
className: "".concat(cssClassName),
|
|
64
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
65
|
+
className: classNameBlock('wrapper')
|
|
66
|
+
}, void 0, /*#__PURE__*/_jsx(DSInputMask, {
|
|
67
|
+
type: type,
|
|
68
|
+
max: maxFrom,
|
|
69
|
+
min: minFrom,
|
|
70
|
+
step: stepFrom,
|
|
71
|
+
value: valueFrom === null || valueFrom === void 0 ? void 0 : valueFrom.toString(),
|
|
72
|
+
placeholder: placeholderFrom,
|
|
73
|
+
mask: number => MASK_TYPES.NUMBER(maskConfig)(number),
|
|
74
|
+
onChange: e => {
|
|
75
|
+
const newValueFrom = e.target.value;
|
|
76
|
+
handleOnChange(newValueFrom, valueTo);
|
|
77
|
+
},
|
|
78
|
+
"data-testid": "ds-number-range-field__from-input"
|
|
79
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
80
|
+
className: classNameElement('separator')
|
|
81
|
+
}, void 0, separator), /*#__PURE__*/_jsx(DSInputMask, {
|
|
82
|
+
type: type,
|
|
83
|
+
max: maxTo,
|
|
84
|
+
min: minTo,
|
|
85
|
+
step: stepTo,
|
|
86
|
+
value: valueTo === null || valueTo === void 0 ? void 0 : valueTo.toString(),
|
|
87
|
+
placeholder: placeholderTo,
|
|
88
|
+
mask: number => MASK_TYPES.NUMBER(maskConfig)(number),
|
|
89
|
+
onChange: e => {
|
|
90
|
+
const newValueTo = e.target.value;
|
|
91
|
+
handleOnChange(valueFrom, newValueTo);
|
|
92
|
+
},
|
|
93
|
+
"data-testid": "ds-number-range-field__to-input"
|
|
94
|
+
}))
|
|
95
|
+
}));
|
|
100
96
|
};
|
|
101
97
|
|
|
102
98
|
export { DSSearchFieldImpl as default };
|
|
103
|
-
//# sourceMappingURL=NumberRangeFieldImpl.js.map
|
package/esm/index.js
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
1
|
export { NumberRangeFieldWithSchema, default } from './DSNumberRangeField.js';
|
|
2
|
-
import 'react';
|
|
3
|
-
import 'react-desc';
|
|
4
|
-
import './impl/NumberRangeFieldImpl.js';
|
|
5
|
-
import '@babel/runtime/helpers/esm/extends';
|
|
6
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
8
|
-
import '@elliemae/ds-classnames';
|
|
9
|
-
import '@elliemae/ds-form';
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import DSNumberRangeField from '@elliemae/ds-number-range-field';
|
|
5
|
+
|
|
6
|
+
const Overview = () => {
|
|
7
|
+
const [value, setValue] = useState([1, 2]);
|
|
8
|
+
return /*#__PURE__*/_jsx(DSNumberRangeField, {
|
|
9
|
+
containerProps: {
|
|
10
|
+
id: 'my-custom-id'
|
|
11
|
+
},
|
|
12
|
+
onChange: setValue,
|
|
13
|
+
value: value
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { Overview };
|
package/package.json
CHANGED
|
@@ -1,14 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-number-range-field",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.12",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"description": "ICE MT - Dimsum - Number Range Field",
|
|
6
|
+
"module": "./esm/index.js",
|
|
7
|
+
"main": "./cjs/index.js",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./esm/index.js",
|
|
12
|
+
"require": "./cjs/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./impl/NumberRangeFieldImpl": {
|
|
15
|
+
"import": "./esm/impl/NumberRangeFieldImpl.js",
|
|
16
|
+
"require": "./cjs/impl/NumberRangeFieldImpl.js"
|
|
17
|
+
},
|
|
18
|
+
"./DSNumberRangeField": {
|
|
19
|
+
"import": "./esm/DSNumberRangeField.js",
|
|
20
|
+
"require": "./cjs/DSNumberRangeField.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
8
23
|
"sideEffects": [
|
|
9
24
|
"*.css",
|
|
10
25
|
"*.scss"
|
|
11
26
|
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"npm": ">=7",
|
|
33
|
+
"node": ">=14"
|
|
34
|
+
},
|
|
35
|
+
"author": "ICE MT",
|
|
12
36
|
"scripts": {
|
|
13
37
|
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
14
38
|
"prebuild": "exit 0",
|
|
@@ -16,18 +40,19 @@
|
|
|
16
40
|
"build": "node ../../scripts/build/build.js"
|
|
17
41
|
},
|
|
18
42
|
"dependencies": {
|
|
19
|
-
"@elliemae/ds-
|
|
20
|
-
"@elliemae/ds-
|
|
21
|
-
"@elliemae/ds-number-range-field": "
|
|
22
|
-
"react-desc": "
|
|
43
|
+
"@elliemae/ds-classnames": "2.0.0-alpha.12",
|
|
44
|
+
"@elliemae/ds-form": "2.0.0-alpha.12",
|
|
45
|
+
"@elliemae/ds-number-range-field": "2.0.0-alpha.12",
|
|
46
|
+
"react-desc": "~4.1.3"
|
|
23
47
|
},
|
|
24
48
|
"peerDependencies": {
|
|
25
|
-
"lodash": "^4.17.
|
|
26
|
-
"react": "~17.0.
|
|
27
|
-
"react-dom": "^17.0.
|
|
49
|
+
"lodash": "^4.17.21",
|
|
50
|
+
"react": "~17.0.2",
|
|
51
|
+
"react-dom": "^17.0.2"
|
|
28
52
|
},
|
|
29
53
|
"publishConfig": {
|
|
30
54
|
"access": "public",
|
|
31
|
-
"directory": "dist"
|
|
55
|
+
"directory": "dist",
|
|
56
|
+
"generateSubmodules": true
|
|
32
57
|
}
|
|
33
58
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
declare const DSNumberRangeField: {
|
|
4
|
+
({ containerProps, maxFrom, minFrom, maxTo, minTo, onChange, placeholderFrom, placeholderTo, stepFrom, stepTo, value, separator, maskOptions, type, }: {
|
|
5
|
+
containerProps?: {} | undefined;
|
|
6
|
+
maxFrom?: null | undefined;
|
|
7
|
+
minFrom?: number | undefined;
|
|
8
|
+
maxTo?: null | undefined;
|
|
9
|
+
minTo?: number | undefined;
|
|
10
|
+
onChange?: (() => null) | undefined;
|
|
11
|
+
placeholderFrom?: string | undefined;
|
|
12
|
+
placeholderTo?: string | undefined;
|
|
13
|
+
stepFrom?: number | undefined;
|
|
14
|
+
stepTo?: number | undefined;
|
|
15
|
+
value?: never[] | undefined;
|
|
16
|
+
separator?: string | undefined;
|
|
17
|
+
maskOptions: any;
|
|
18
|
+
type: any;
|
|
19
|
+
}): JSX.Element;
|
|
20
|
+
propTypes: {
|
|
21
|
+
containerProps: {
|
|
22
|
+
defaultValue<T = unknown>(arg: T): {
|
|
23
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
24
|
+
};
|
|
25
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
26
|
+
};
|
|
27
|
+
maxFrom: {
|
|
28
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
29
|
+
};
|
|
30
|
+
minFrom: {
|
|
31
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
32
|
+
};
|
|
33
|
+
maxTo: {
|
|
34
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
35
|
+
};
|
|
36
|
+
minTo: {
|
|
37
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
38
|
+
};
|
|
39
|
+
onChange: {
|
|
40
|
+
defaultValue<T = unknown>(arg: T): {
|
|
41
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
42
|
+
};
|
|
43
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
44
|
+
};
|
|
45
|
+
placeholderFrom: {
|
|
46
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
47
|
+
};
|
|
48
|
+
placeholderTo: {
|
|
49
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
50
|
+
};
|
|
51
|
+
stepFrom: {
|
|
52
|
+
defaultValue<T = unknown>(arg: T): {
|
|
53
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
54
|
+
};
|
|
55
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
56
|
+
};
|
|
57
|
+
stepTo: {
|
|
58
|
+
defaultValue<T = unknown>(arg: T): {
|
|
59
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
60
|
+
};
|
|
61
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
62
|
+
};
|
|
63
|
+
value: {
|
|
64
|
+
defaultValue<T = unknown>(arg: T): {
|
|
65
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
66
|
+
};
|
|
67
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
68
|
+
};
|
|
69
|
+
separator: {
|
|
70
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
71
|
+
};
|
|
72
|
+
maskOptions: {
|
|
73
|
+
defaultValue<T = unknown>(arg: T): {
|
|
74
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
75
|
+
};
|
|
76
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
77
|
+
};
|
|
78
|
+
type: {
|
|
79
|
+
defaultValue<T = unknown>(arg: T): {
|
|
80
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
81
|
+
};
|
|
82
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
declare const NumberRangeFieldWithSchema: {
|
|
87
|
+
(props?: {
|
|
88
|
+
containerProps?: {} | undefined;
|
|
89
|
+
maxFrom?: null | undefined;
|
|
90
|
+
minFrom?: number | undefined;
|
|
91
|
+
maxTo?: null | undefined;
|
|
92
|
+
minTo?: number | undefined;
|
|
93
|
+
onChange?: (() => null) | undefined;
|
|
94
|
+
placeholderFrom?: string | undefined;
|
|
95
|
+
placeholderTo?: string | undefined;
|
|
96
|
+
stepFrom?: number | undefined;
|
|
97
|
+
stepTo?: number | undefined;
|
|
98
|
+
value?: never[] | undefined;
|
|
99
|
+
separator?: string | undefined;
|
|
100
|
+
maskOptions: any;
|
|
101
|
+
type: any;
|
|
102
|
+
} | undefined): JSX.Element;
|
|
103
|
+
propTypes: unknown;
|
|
104
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
105
|
+
};
|
|
106
|
+
export { NumberRangeFieldWithSchema };
|
|
107
|
+
export default DSNumberRangeField;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export const title: string;
|
|
3
|
+
export { DSNumberRangeField as component };
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
export * from "./stories/DSNumberRangeField-overview.stories";
|
|
7
|
+
import DSNumberRangeField from "@elliemae/ds-number-range-field";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const DSSearchFieldImpl: ({ onChange, containerProps, maxFrom, maxTo, minFrom, minTo, placeholderFrom, placeholderTo, separator, stepFrom, stepTo, value, maskOptions, type, }: {
|
|
3
|
+
onChange: any;
|
|
4
|
+
containerProps: any;
|
|
5
|
+
maxFrom: any;
|
|
6
|
+
maxTo: any;
|
|
7
|
+
minFrom: any;
|
|
8
|
+
minTo: any;
|
|
9
|
+
placeholderFrom: any;
|
|
10
|
+
placeholderTo: any;
|
|
11
|
+
separator: any;
|
|
12
|
+
stepFrom: any;
|
|
13
|
+
stepTo: any;
|
|
14
|
+
value: any;
|
|
15
|
+
maskOptions: any;
|
|
16
|
+
type: any;
|
|
17
|
+
}) => JSX.Element;
|
|
18
|
+
export default DSSearchFieldImpl;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, NumberRangeFieldWithSchema } from './DSNumberRangeField';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function Overview(): JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DSNumberRangeField.js","sources":["../../src/DSNumberRangeField.tsx"],"sourcesContent":["import React from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport NumberRangeFieldImpl from './impl/NumberRangeFieldImpl';\n\nconst DSNumberRangeField = ({\n containerProps = {},\n maxFrom = null,\n minFrom = 0,\n maxTo = null,\n minTo = 0,\n onChange = () => null,\n placeholderFrom = 'From',\n placeholderTo = 'To',\n stepFrom = 1,\n stepTo = 1,\n value = [],\n separator = '-',\n maskOptions,\n type,\n}) => (\n <NumberRangeFieldImpl\n containerProps={containerProps}\n maxFrom={maxFrom}\n maxTo={maxTo}\n minFrom={minFrom}\n minTo={minTo}\n onChange={onChange}\n placeholderFrom={placeholderFrom}\n placeholderTo={placeholderTo}\n separator={separator}\n stepFrom={stepFrom}\n stepTo={stepTo}\n value={value}\n maskOptions={maskOptions}\n type={type}\n />\n);\n\nconst numberRangeFieldProps = {\n containerProps: PropTypes.object.description(\n 'Set of Properties attached to the main container',\n ),\n maxFrom: PropTypes.number\n .description('Maximum number accepted in `From` field')\n .defaultValue(null),\n minFrom: PropTypes.number\n .description('Minimum number accepted in `From` field')\n .defaultValue(0),\n maxTo: PropTypes.number\n .description('Maximum number accepted in `To` field')\n .defaultValue(null),\n minTo: PropTypes.number\n .description('Minimum number accepted in `To` field')\n .defaultValue(0),\n onChange: PropTypes.func.description(\n 'Function executed when the value on the fields changes',\n ),\n placeholderFrom: PropTypes.string\n .description('Placeholder value for the `From` field')\n .defaultValue('From'),\n placeholderTo: PropTypes.string\n .description('Placeholder value for the `To` field')\n .defaultValue('To'),\n stepFrom: PropTypes.number.description(\n 'Amount of units the `From` field value increases/decreases',\n ),\n stepTo: PropTypes.number.description(\n 'Amount of units the `To` field value increases/decreases',\n ),\n value: PropTypes.shape([PropTypes.number, PropTypes.number]).description(\n 'Array with the values of both fields',\n ),\n separator: PropTypes.string\n .description('Character that separates fields')\n .defaultValue('-'),\n maskOptions: PropTypes.object.description('Object with mask configurations'),\n type: PropTypes.string.description('Type of input'),\n};\n\nDSNumberRangeField.propTypes = numberRangeFieldProps;\n\nconst NumberRangeFieldWithSchema = describe(DSNumberRangeField);\nNumberRangeFieldWithSchema.propTypes = numberRangeFieldProps;\n\nexport { NumberRangeFieldWithSchema };\nexport default DSNumberRangeField;\n"],"names":["DSNumberRangeField","containerProps","maxFrom","minFrom","maxTo","minTo","onChange","placeholderFrom","placeholderTo","stepFrom","stepTo","value","separator","maskOptions","type","React","NumberRangeFieldImpl","numberRangeFieldProps","PropTypes","object","description","number","defaultValue","func","string","shape","propTypes","NumberRangeFieldWithSchema","describe"],"mappings":";;;;;;;;;;;;;;;;;IAIMA,kBAAkB,GAAG,SAArBA,kBAAqB;AAAA,iCACzBC,cADyB;AAAA,MACzBA,cADyB,oCACR,EADQ;AAAA,0BAEzBC,OAFyB;AAAA,MAEzBA,OAFyB,6BAEf,IAFe;AAAA,0BAGzBC,OAHyB;AAAA,MAGzBA,OAHyB,6BAGf,CAHe;AAAA,wBAIzBC,KAJyB;AAAA,MAIzBA,KAJyB,2BAIjB,IAJiB;AAAA,wBAKzBC,KALyB;AAAA,MAKzBA,KALyB,2BAKj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EMU,0BAA0B,GAAGC,kBAAQ,CAAC5B,kBAAD;AAC3C2B,0BAA0B,CAACD,SAA3B,GAAuCT,qBAAvC;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NumberRangeFieldImpl.js","sources":["../../../src/impl/NumberRangeFieldImpl.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React, { useState, useEffect } from 'react';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { DSInputMask, MASK_TYPES } from '@elliemae/ds-form';\n\nconst { cssClassName, classNameElement, classNameBlock } = convertPropToCssClassName(\n 'query-builder-addon-number-range-field',\n);\n\nconst DSSearchFieldImpl = ({\n onChange,\n containerProps,\n maxFrom,\n maxTo,\n minFrom,\n minTo,\n placeholderFrom,\n placeholderTo,\n separator,\n stepFrom,\n stepTo,\n value,\n maskOptions,\n type,\n}) => {\n const [valueFrom, setValueFrom] = useState();\n const [valueTo, setValueTo] = useState();\n\n useEffect(() => {\n if (Array.isArray(value)) {\n setValueFrom(value[0]);\n setValueTo(value[1]);\n } else {\n setValueFrom(value);\n }\n }, [value]);\n\n const handleOnChange = (newValueFrom, newValueTo) => {\n setValueFrom(newValueFrom);\n setValueTo(newValueTo);\n onChange([newValueFrom, newValueTo]);\n };\n\n const maskConfig = {\n prefix: '',\n includeThousandsSeparator: false,\n ...maskOptions,\n };\n\n return (\n <div {...containerProps} className={`${cssClassName}`}>\n <div className={classNameBlock('wrapper')}>\n <DSInputMask\n type={type}\n max={maxFrom}\n min={minFrom}\n step={stepFrom}\n value={valueFrom?.toString()}\n placeholder={placeholderFrom}\n mask={(number) => MASK_TYPES.NUMBER(maskConfig)(number)}\n onChange={(e) => {\n const newValueFrom = e.target.value;\n handleOnChange(newValueFrom, valueTo);\n }}\n data-testid=\"ds-number-range-field__from-input\"\n />\n <div className={classNameElement('separator')}>{separator}</div>\n <DSInputMask\n type={type}\n max={maxTo}\n min={minTo}\n step={stepTo}\n value={valueTo?.toString()}\n placeholder={placeholderTo}\n mask={(number) => MASK_TYPES.NUMBER(maskConfig)(number)}\n onChange={(e) => {\n const newValueTo = e.target.value;\n handleOnChange(valueFrom, newValueTo);\n }}\n data-testid=\"ds-number-range-field__to-input\"\n />\n </div>\n </div>\n );\n};\n\nexport default DSSearchFieldImpl;\n"],"names":["convertPropToCssClassName","cssClassName","classNameElement","classNameBlock","DSSearchFieldImpl","onChange","containerProps","maxFrom","maxTo","minFrom","minTo","placeholderFrom","placeholderTo","separator","stepFrom","stepTo","value","maskOptions","type","useState","valueFrom","setValueFrom","valueTo","setValueTo","useEffect","Array","isArray","handleOnChange","newValueFrom","newValueTo","maskConfig","prefix","includeThousandsSeparator","React","DSInputMask","toString","number","MASK_TYPES","NUMBER","e","target"],"mappings":";;;;;;;;;;;;;;;;;;;;AAKA,4BAA2DA,sCAAyB,CAClF,wCADkF,CAApF;AAAA,IAAQC,YAAR,yBAAQA,YAAR;AAAA,IAAsBC,gBAAtB,yBAAsBA,gBAAtB;AAAA,IAAwCC,cAAxC,yBAAwCA,cAAxC;;IAIMC,iBAAiB,GAAG,SAApBA,iBAAoB,OAepB;AAAA,MAdJC,QAcI,QAdJA,QAcI;AAAA,MAbJC,cAaI,QAbJA,cAaI;AAAA,MAZJC,OAYI,QAZJA,OAYI;AAAA,MAXJC,KAWI,QAXJA,KAWI;AAAA,MAVJC,OAUI,QAVJA,OAUI;AAAA,MATJC,KASI,QATJA,KASI;AAAA,MARJC,eAQI,QARJA,eAQI;AAAA,MAPJC,aAOI,QAPJA,aAOI;AAAA,MANJC,SAMI,QANJA,SAMI;AAAA,MALJC,QAKI,QALJA,QAKI;AAAA,MAJJC,MAII,QAJJA,MAII;AAAA,MAHJC,KAGI,QAHJA,KAGI;AAAA,MAFJC,WAEI,QAFJA,WAEI;AAAA,MADJC,IACI,QADJA,IACI;;AACJ,kBAAkCC,cAAQ,EAA1C;AAAA;AAAA,MAAOC,SAAP;AAAA,MAAkBC,YAAlB;;AACA,mBAA8BF,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AACG,CAAD,EAAO;AACf,UAAMX,YAAY,GAAGW,CAAC,CAACC,MAAF,CAASxB,KAA9B;AACAW,MAAAA,cAAc,CAACC,YAAD,EAAeN,OAAf,CAAd;AACD,KAXH;AAYE,mBAAY;AAZd,IADF,eAeEW;AAAK,IAAA,SAAS,EAAE/B,gBAAgB,CAAC,WAAD;AAAhC,KAAgDW,SAAhD,CAfF,eAgBEoB,wCAACC,kBAAD;AACE,IAAA,IAAI,EAAEhB,IADR;AAEE,IAAA,GAAG,EAAEV,KAFP;AAGE,IAAA,GAAG,EAAEE,KAHP;AAIE,IAAA,IAAI,EAAEK,MAJR;AAKE,IAAA,KAAK,EAAEO,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEa,QAAT,EALT;AAME,IAAA,WAAW,EAAEvB,aANf;AAOE,IAAA,IAAI,EAAE,cAACwB,MAAD;AAAA,aAAYC,iBAAU,CAACC,MAAX,CAAkBR,UAAlB,EAA8BM,MAA9B,CAAZ;AAAA,KAPR;AAQE,IAAA,QAAQ,EAAE,kBAACG,CAAD,EAAO;AACf,UAAMV,UAAU,GAAGU,CAAC,CAACC,MAAF,CAASxB,KAA5B;AACAW,MAAAA,cAAc,CAACP,SAAD,EAAYS,UAAZ,CAAd;AACD,KAXH;AAYE,mBAAY;AAZd,IAhBF,CADF,CADF;AAmCD;;;;"}
|
package/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DSNumberRangeField.js","sources":["../../src/DSNumberRangeField.tsx"],"sourcesContent":["import React from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport NumberRangeFieldImpl from './impl/NumberRangeFieldImpl';\n\nconst DSNumberRangeField = ({\n containerProps = {},\n maxFrom = null,\n minFrom = 0,\n maxTo = null,\n minTo = 0,\n onChange = () => null,\n placeholderFrom = 'From',\n placeholderTo = 'To',\n stepFrom = 1,\n stepTo = 1,\n value = [],\n separator = '-',\n maskOptions,\n type,\n}) => (\n <NumberRangeFieldImpl\n containerProps={containerProps}\n maxFrom={maxFrom}\n maxTo={maxTo}\n minFrom={minFrom}\n minTo={minTo}\n onChange={onChange}\n placeholderFrom={placeholderFrom}\n placeholderTo={placeholderTo}\n separator={separator}\n stepFrom={stepFrom}\n stepTo={stepTo}\n value={value}\n maskOptions={maskOptions}\n type={type}\n />\n);\n\nconst numberRangeFieldProps = {\n containerProps: PropTypes.object.description(\n 'Set of Properties attached to the main container',\n ),\n maxFrom: PropTypes.number\n .description('Maximum number accepted in `From` field')\n .defaultValue(null),\n minFrom: PropTypes.number\n .description('Minimum number accepted in `From` field')\n .defaultValue(0),\n maxTo: PropTypes.number\n .description('Maximum number accepted in `To` field')\n .defaultValue(null),\n minTo: PropTypes.number\n .description('Minimum number accepted in `To` field')\n .defaultValue(0),\n onChange: PropTypes.func.description(\n 'Function executed when the value on the fields changes',\n ),\n placeholderFrom: PropTypes.string\n .description('Placeholder value for the `From` field')\n .defaultValue('From'),\n placeholderTo: PropTypes.string\n .description('Placeholder value for the `To` field')\n .defaultValue('To'),\n stepFrom: PropTypes.number.description(\n 'Amount of units the `From` field value increases/decreases',\n ),\n stepTo: PropTypes.number.description(\n 'Amount of units the `To` field value increases/decreases',\n ),\n value: PropTypes.shape([PropTypes.number, PropTypes.number]).description(\n 'Array with the values of both fields',\n ),\n separator: PropTypes.string\n .description('Character that separates fields')\n .defaultValue('-'),\n maskOptions: PropTypes.object.description('Object with mask configurations'),\n type: PropTypes.string.description('Type of input'),\n};\n\nDSNumberRangeField.propTypes = numberRangeFieldProps;\n\nconst NumberRangeFieldWithSchema = describe(DSNumberRangeField);\nNumberRangeFieldWithSchema.propTypes = numberRangeFieldProps;\n\nexport { NumberRangeFieldWithSchema };\nexport default DSNumberRangeField;\n"],"names":["DSNumberRangeField","containerProps","maxFrom","minFrom","maxTo","minTo","onChange","placeholderFrom","placeholderTo","stepFrom","stepTo","value","separator","maskOptions","type","NumberRangeFieldImpl","numberRangeFieldProps","PropTypes","object","description","number","defaultValue","func","string","shape","propTypes","NumberRangeFieldWithSchema","describe"],"mappings":";;;;;;;;;IAIMA,kBAAkB,GAAG,SAArBA,kBAAqB;AAAA,iCACzBC,cADyB;AAAA,MACzBA,cADyB,oCACR,EADQ;AAAA,0BAEzBC,OAFyB;AAAA,MAEzBA,OAFyB,6BAEf,IAFe;AAAA,0BAGzBC,OAHyB;AAAA,MAGzBA,OAHyB,6BAGf,CAHe;AAAA,wBAIzBC,KAJyB;AAAA,MAIzBA,KAJyB,2BAIjB,IAJiB;AAAA,wBAKzBC,KALyB;AAAA,MAKzBA,KALyB,2BAKjB,CALiB;AAAA,2BAMzBC,QANyB;AAAA,MAMzBA,QANyB,8BAMd;AAAA,WAAM,IAAN;AAAA,GANc;AAAA,kCAOzBC,eAPyB;AAAA,MAOzBA,eAPyB,qCAOP,MAPO;AAAA,gCAQzBC,aARyB;AAAA,MAQzBA,aARyB,mCAQT,IARS;AAAA,2BASzBC,QATyB;AAAA,MASzBA,QATyB,8BASd,CATc;AAAA,yBAUzBC,MAVyB;AAAA,MAUzBA,MAVyB,4BAUhB,CAVgB;AAAA,wBAWzBC,KAXyB;AAAA,MAWzBA,KAXyB,2BAWjB,EAXiB;AAAA,4BAYzBC,SAZyB;AAAA,MAYzBA,SAZyB,+BAYb,GAZa;AAAA,MAazBC,WAbyB,QAazBA,WAbyB;AAAA,MAczBC,IAdyB,QAczBA,IAdyB;AAAA,sBAgBzB,oBAACC,iBAAD;AACE,IAAA,cAAc,EAAEd,cADlB;AAEE,IAAA,OAAO,EAAEC,OAFX;AAGE,IAAA,KAAK,EAAEE,KAHT;AAIE,IAAA,OAAO,EAAED,OAJX;AAKE,IAAA,KAAK,EAAEE,KALT;AAME,IAAA,QAAQ,EAAEC,QANZ;AAOE,IAAA,eAAe,EAAEC,eAPnB;AAQE,IAAA,aAA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ACO,KAAV,CAAgB,CAACP,SAAS,CAACG,MAAX,EAAmBH,SAAS,CAACG,MAA7B,CAAhB,EAAsDD,WAAtD,CACL,sCADK,CA/BqB;AAkC5BP,EAAAA,SAAS,EAAEK,SAAS,CAACM,MAAV,CACRJ,WADQ,CACI,iCADJ,EAERE,YAFQ,CAEK,GAFL,CAlCiB;AAqC5BR,EAAAA,WAAW,EAAEI,SAAS,CAACC,MAAV,CAAiBC,WAAjB,CAA6B,iCAA7B,CArCe;AAsC5BL,EAAAA,IAAI,EAAEG,SAAS,CAACM,MAAV,CAAiBJ,WAAjB,CAA6B,eAA7B;AAtCsB,CAA9B;AAyCAnB,kBAAkB,CAACyB,SAAnB,GAA+BT,qBAA/B;IAEMU,0BAA0B,GAAGC,QAAQ,CAAC3B,kBAAD;AAC3C0B,0BAA0B,CAACD,SAA3B,GAAuCT,qBAAvC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NumberRangeFieldImpl.js","sources":["../../../src/impl/NumberRangeFieldImpl.tsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React, { useState, useEffect } from 'react';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { DSInputMask, MASK_TYPES } from '@elliemae/ds-form';\n\nconst { cssClassName, classNameElement, classNameBlock } = convertPropToCssClassName(\n 'query-builder-addon-number-range-field',\n);\n\nconst DSSearchFieldImpl = ({\n onChange,\n containerProps,\n maxFrom,\n maxTo,\n minFrom,\n minTo,\n placeholderFrom,\n placeholderTo,\n separator,\n stepFrom,\n stepTo,\n value,\n maskOptions,\n type,\n}) => {\n const [valueFrom, setValueFrom] = useState();\n const [valueTo, setValueTo] = useState();\n\n useEffect(() => {\n if (Array.isArray(value)) {\n setValueFrom(value[0]);\n setValueTo(value[1]);\n } else {\n setValueFrom(value);\n }\n }, [value]);\n\n const handleOnChange = (newValueFrom, newValueTo) => {\n setValueFrom(newValueFrom);\n setValueTo(newValueTo);\n onChange([newValueFrom, newValueTo]);\n };\n\n const maskConfig = {\n prefix: '',\n includeThousandsSeparator: false,\n ...maskOptions,\n };\n\n return (\n <div {...containerProps} className={`${cssClassName}`}>\n <div className={classNameBlock('wrapper')}>\n <DSInputMask\n type={type}\n max={maxFrom}\n min={minFrom}\n step={stepFrom}\n value={valueFrom?.toString()}\n placeholder={placeholderFrom}\n mask={(number) => MASK_TYPES.NUMBER(maskConfig)(number)}\n onChange={(e) => {\n const newValueFrom = e.target.value;\n handleOnChange(newValueFrom, valueTo);\n }}\n data-testid=\"ds-number-range-field__from-input\"\n />\n <div className={classNameElement('separator')}>{separator}</div>\n <DSInputMask\n type={type}\n max={maxTo}\n min={minTo}\n step={stepTo}\n value={valueTo?.toString()}\n placeholder={placeholderTo}\n mask={(number) => MASK_TYPES.NUMBER(maskConfig)(number)}\n onChange={(e) => {\n const newValueTo = e.target.value;\n handleOnChange(valueFrom, newValueTo);\n }}\n data-testid=\"ds-number-range-field__to-input\"\n />\n </div>\n </div>\n );\n};\n\nexport default DSSearchFieldImpl;\n"],"names":["convertPropToCssClassName","cssClassName","classNameElement","classNameBlock","DSSearchFieldImpl","onChange","containerProps","maxFrom","maxTo","minFrom","minTo","placeholderFrom","placeholderTo","separator","stepFrom","stepTo","value","maskOptions","type","useState","valueFrom","setValueFrom","valueTo","setValueTo","useEffect","Array","isArray","handleOnChange","newValueFrom","newValueTo","maskConfig","prefix","includeThousandsSeparator","toString","number","MASK_TYPES","NUMBER","e","target"],"mappings":";;;;;;;;;;;AAKA,4BAA2DA,yBAAyB,CAClF,wCADkF,CAApF;AAAA,IAAQC,YAAR,yBAAQA,YAAR;AAAA,IAAsBC,gBAAtB,yBAAsBA,gBAAtB;AAAA,IAAwCC,cAAxC,yBAAwCA,cAAxC;;IAIMC,iBAAiB,GAAG,SAApBA,iBAAoB,OAepB;AAAA,MAdJC,QAcI,QAdJA,QAcI;AAAA,MAbJC,cAaI,QAbJA,cAaI;AAAA,MAZJC,OAYI,QAZJA,OAYI;AAAA,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