@elliemae/ds-zoom 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/DSZoom.js +86 -105
- package/cjs/components/utils.js +6 -13
- package/cjs/components/zoomOptions.js +0 -1
- package/cjs/index.js +1 -12
- package/esm/DSZoom.js +79 -96
- package/esm/components/utils.js +6 -13
- package/esm/components/zoomOptions.js +0 -1
- package/esm/index.js +0 -11
- package/package.json +43 -10
- package/types/DSZoom.d.ts +79 -0
- package/types/components/utils.d.ts +4 -0
- package/types/components/zoomOptions.d.ts +10 -0
- package/types/index.d.ts +2 -0
- package/types/tests/DSZoom.test.d.ts +1 -0
- package/DSZoom/package.json +0 -10
- package/cjs/DSZoom.js.map +0 -1
- package/cjs/components/utils.js.map +0 -1
- package/cjs/components/zoomOptions.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/components/utils/package.json +0 -10
- package/components/zoomOptions/package.json +0 -10
- package/esm/DSZoom.js.map +0 -1
- package/esm/components/utils.js.map +0 -1
- package/esm/components/zoomOptions.js.map +0 -1
- package/esm/index.js.map +0 -1
package/cjs/DSZoom.js
CHANGED
|
@@ -2,127 +2,110 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
5
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
8
7
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
9
|
-
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.find.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.find.js');
|
|
11
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
14
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
15
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
16
|
+
var react = require('react');
|
|
10
17
|
var reactDesc = require('react-desc');
|
|
11
18
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
12
19
|
var dsForm = require('@elliemae/ds-form');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
20
|
+
var zoomOptions = require('./components/zoomOptions.js');
|
|
21
|
+
var utils = require('./components/utils.js');
|
|
22
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
15
23
|
|
|
16
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
25
|
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
26
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
27
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
21
28
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
22
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
23
29
|
|
|
24
|
-
|
|
30
|
+
const _excluded = ["className", "disabled", "value", "onChange", "containerProps", "zoomOptions"];
|
|
25
31
|
|
|
26
|
-
var
|
|
27
|
-
var _ref$className = _ref.className,
|
|
28
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
29
|
-
_ref$disabled = _ref.disabled,
|
|
30
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
31
|
-
_ref$value = _ref.value,
|
|
32
|
-
value = _ref$value === void 0 ? undefined : _ref$value,
|
|
33
|
-
_ref$onChange = _ref.onChange,
|
|
34
|
-
_onChange = _ref$onChange === void 0 ? function () {
|
|
35
|
-
return null;
|
|
36
|
-
} : _ref$onChange,
|
|
37
|
-
_ref$containerProps = _ref.containerProps,
|
|
38
|
-
containerProps = _ref$containerProps === void 0 ? {} : _ref$containerProps,
|
|
39
|
-
_ref$zoomOptions = _ref.zoomOptions,
|
|
40
|
-
zoomOptions = _ref$zoomOptions === void 0 ? components_zoomOptions : _ref$zoomOptions,
|
|
41
|
-
otherProps = _objectWithoutProperties__default['default'](_ref, _excluded);
|
|
32
|
+
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; }
|
|
42
33
|
|
|
43
|
-
|
|
44
|
-
disabled: disabled
|
|
45
|
-
}),
|
|
46
|
-
cssClassName = _convertPropToCssClas.cssClassName;
|
|
34
|
+
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; }
|
|
47
35
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
_useState4 = _slicedToArray__default['default'](_useState3, 2),
|
|
59
|
-
selectedOption = _useState4[0],
|
|
60
|
-
setSelectedOption = _useState4[1];
|
|
36
|
+
const DSZoom = _ref => {
|
|
37
|
+
let {
|
|
38
|
+
className = '',
|
|
39
|
+
disabled = false,
|
|
40
|
+
value = undefined,
|
|
41
|
+
onChange = () => null,
|
|
42
|
+
containerProps = {},
|
|
43
|
+
zoomOptions: zoomOptions$1 = zoomOptions
|
|
44
|
+
} = _ref,
|
|
45
|
+
otherProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
61
46
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
47
|
+
const {
|
|
48
|
+
cssClassName
|
|
49
|
+
} = dsClassnames.convertPropToCssClassName('zoom-resize', className, {
|
|
50
|
+
disabled
|
|
51
|
+
});
|
|
52
|
+
const defaultOption = zoomOptions$1.find(option => option.default);
|
|
53
|
+
const [menuIsOpen, setMenuIsOpen] = react.useState(false);
|
|
54
|
+
const [selectedOption, setSelectedOption] = react.useState(defaultOption);
|
|
55
|
+
const [custom, setCustom] = react.useState(!value ? defaultOption : {
|
|
56
|
+
label: "".concat(utils.clean(value), "%"),
|
|
57
|
+
value: utils.clean(value),
|
|
65
58
|
id: 'custom'
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var options = [custom].concat(_toConsumableArray__default['default'](zoomOptions.filter(function (option) {
|
|
72
|
-
return !option.default;
|
|
73
|
-
})));
|
|
74
|
-
var currentValue = value || (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) || (custom === null || custom === void 0 ? void 0 : custom.value) || (defaultOption === null || defaultOption === void 0 ? void 0 : defaultOption.value);
|
|
75
|
-
return /*#__PURE__*/React__default['default'].createElement("div", _extends__default['default']({
|
|
59
|
+
});
|
|
60
|
+
const options = [custom, ...zoomOptions$1.filter(option => !option.default)];
|
|
61
|
+
const currentValue = value || (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) || (custom === null || custom === void 0 ? void 0 : custom.value) || (defaultOption === null || defaultOption === void 0 ? void 0 : defaultOption.value);
|
|
62
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread(_objectSpread({
|
|
76
63
|
className: "".concat(cssClassName)
|
|
77
|
-
}, containerProps, otherProps),
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
};
|
|
112
|
-
setCustom(newOption);
|
|
113
|
-
|
|
114
|
-
_onChange(newOption);
|
|
64
|
+
}, containerProps), otherProps), {}, {
|
|
65
|
+
children: /*#__PURE__*/_jsx__default["default"](dsForm.DSComboBox, {
|
|
66
|
+
searchable: true,
|
|
67
|
+
disabled: disabled,
|
|
68
|
+
menuIsOpen: menuIsOpen,
|
|
69
|
+
onChange: (valueChange, _ref2) => {
|
|
70
|
+
let {
|
|
71
|
+
action
|
|
72
|
+
} = _ref2;
|
|
73
|
+
const op = options.find(option => option.value === valueChange);
|
|
74
|
+
setSelectedOption(op);
|
|
75
|
+
onChange(op);
|
|
76
|
+
setMenuIsOpen(false);
|
|
77
|
+
|
|
78
|
+
if (action === 'select-option') {
|
|
79
|
+
document.activeElement.blur();
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
onClickDropdownIndicator: () => setMenuIsOpen(!menuIsOpen),
|
|
83
|
+
onInputChange: (valueInput, action) => {
|
|
84
|
+
if (valueInput || action.action === 'input-change') {
|
|
85
|
+
if (!valueInput) {
|
|
86
|
+
setCustom(defaultOption);
|
|
87
|
+
onChange(defaultOption);
|
|
88
|
+
} else if (!Number.isNaN(parseInt(valueInput, 10))) {
|
|
89
|
+
const cleanValue = parseInt(valueInput, 10);
|
|
90
|
+
const newOption = {
|
|
91
|
+
label: "".concat(cleanValue, "%"),
|
|
92
|
+
value: "".concat(cleanValue, "%"),
|
|
93
|
+
id: 'custom'
|
|
94
|
+
};
|
|
95
|
+
setCustom(newOption);
|
|
96
|
+
onChange(newOption);
|
|
97
|
+
}
|
|
115
98
|
}
|
|
116
|
-
}
|
|
117
99
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
100
|
+
setMenuIsOpen(false);
|
|
101
|
+
},
|
|
102
|
+
options: options,
|
|
103
|
+
value: currentValue
|
|
104
|
+
})
|
|
122
105
|
}));
|
|
123
106
|
};
|
|
124
107
|
|
|
125
|
-
|
|
108
|
+
const zoomProps = {
|
|
126
109
|
className: reactDesc.PropTypes.string.description('html class attribute'),
|
|
127
110
|
containerProps: reactDesc.PropTypes.object.description('Set of Properties attached to the main container'),
|
|
128
111
|
disabled: reactDesc.PropTypes.bool.description('disable component').defaultValue(false),
|
|
@@ -134,11 +117,9 @@ var zoomProps = {
|
|
|
134
117
|
default: reactDesc.PropTypes.bool
|
|
135
118
|
}).description('list of options to display in the select menu')
|
|
136
119
|
};
|
|
137
|
-
|
|
138
|
-
var ZoomWithSchema = reactDesc.describe(DSZoom);
|
|
120
|
+
const ZoomWithSchema = reactDesc.describe(DSZoom);
|
|
139
121
|
ZoomWithSchema.propTypes = zoomProps;
|
|
140
122
|
|
|
141
123
|
exports.DSZoom = DSZoom;
|
|
142
124
|
exports.ZoomWithSchema = ZoomWithSchema;
|
|
143
|
-
exports[
|
|
144
|
-
//# sourceMappingURL=DSZoom.js.map
|
|
125
|
+
exports["default"] = DSZoom;
|
package/cjs/components/utils.js
CHANGED
|
@@ -2,21 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var getFactor = function getFactor(value) {
|
|
12
|
-
return value / 100;
|
|
13
|
-
};
|
|
14
|
-
var clean = function clean(value) {
|
|
15
|
-
return value.replace(/\D/g, '').substring(0, 3);
|
|
16
|
-
};
|
|
5
|
+
require('core-js/modules/es.string.replace.js');
|
|
6
|
+
|
|
7
|
+
const getCurrentFont = () => Number(window.getComputedStyle(document.querySelector(':root')).getPropertyValue('font-size').match(/\d+/)[0]);
|
|
8
|
+
const setSize = size => document.querySelector(':root').setAttribute('style', "font-size: ".concat(size, "px"));
|
|
9
|
+
const getFactor = value => value / 100;
|
|
10
|
+
const clean = value => value.replace(/\D/g, '').substring(0, 3);
|
|
17
11
|
|
|
18
12
|
exports.clean = clean;
|
|
19
13
|
exports.getCurrentFont = getCurrentFont;
|
|
20
14
|
exports.getFactor = getFactor;
|
|
21
15
|
exports.setSize = setSize;
|
|
22
|
-
//# sourceMappingURL=utils.js.map
|
package/cjs/index.js
CHANGED
|
@@ -3,20 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var DSZoom = require('./DSZoom.js');
|
|
6
|
-
require('@babel/runtime/helpers/extends');
|
|
7
|
-
require('@babel/runtime/helpers/toConsumableArray');
|
|
8
|
-
require('@babel/runtime/helpers/slicedToArray');
|
|
9
|
-
require('@babel/runtime/helpers/objectWithoutProperties');
|
|
10
|
-
require('react');
|
|
11
|
-
require('react-desc');
|
|
12
|
-
require('@elliemae/ds-classnames');
|
|
13
|
-
require('@elliemae/ds-form');
|
|
14
|
-
require('./components/zoomOptions.js');
|
|
15
|
-
require('./components/utils.js');
|
|
16
6
|
|
|
17
7
|
|
|
18
8
|
|
|
19
9
|
exports.DSZoom = DSZoom.DSZoom;
|
|
20
10
|
exports.ZoomWithSchema = DSZoom.ZoomWithSchema;
|
|
21
|
-
exports
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
11
|
+
exports["default"] = DSZoom.DSZoom;
|
package/esm/DSZoom.js
CHANGED
|
@@ -1,116 +1,101 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
4
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
5
|
-
import
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.find.js';
|
|
7
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
10
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
11
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
12
|
+
import { useState } from 'react';
|
|
6
13
|
import { PropTypes, describe } from 'react-desc';
|
|
7
14
|
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
8
15
|
import { DSComboBox } from '@elliemae/ds-form';
|
|
9
16
|
import zoomDefaultOptions from './components/zoomOptions.js';
|
|
10
17
|
import { clean } from './components/utils.js';
|
|
18
|
+
import { jsx } from 'react/jsx-runtime';
|
|
11
19
|
|
|
12
|
-
|
|
20
|
+
const _excluded = ["className", "disabled", "value", "onChange", "containerProps", "zoomOptions"];
|
|
13
21
|
|
|
14
|
-
var
|
|
15
|
-
var _ref$className = _ref.className,
|
|
16
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
17
|
-
_ref$disabled = _ref.disabled,
|
|
18
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
19
|
-
_ref$value = _ref.value,
|
|
20
|
-
value = _ref$value === void 0 ? undefined : _ref$value,
|
|
21
|
-
_ref$onChange = _ref.onChange,
|
|
22
|
-
_onChange = _ref$onChange === void 0 ? function () {
|
|
23
|
-
return null;
|
|
24
|
-
} : _ref$onChange,
|
|
25
|
-
_ref$containerProps = _ref.containerProps,
|
|
26
|
-
containerProps = _ref$containerProps === void 0 ? {} : _ref$containerProps,
|
|
27
|
-
_ref$zoomOptions = _ref.zoomOptions,
|
|
28
|
-
zoomOptions = _ref$zoomOptions === void 0 ? zoomDefaultOptions : _ref$zoomOptions,
|
|
29
|
-
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
-
|
|
31
|
-
var _convertPropToCssClas = convertPropToCssClassName('zoom-resize', className, {
|
|
32
|
-
disabled: disabled
|
|
33
|
-
}),
|
|
34
|
-
cssClassName = _convertPropToCssClas.cssClassName;
|
|
35
|
-
|
|
36
|
-
var defaultOption = zoomOptions.find(function (option) {
|
|
37
|
-
return option.default;
|
|
38
|
-
});
|
|
22
|
+
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; }
|
|
39
23
|
|
|
40
|
-
|
|
41
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
42
|
-
menuIsOpen = _useState2[0],
|
|
43
|
-
setMenuIsOpen = _useState2[1];
|
|
24
|
+
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; }
|
|
44
25
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
26
|
+
const DSZoom = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
className = '',
|
|
29
|
+
disabled = false,
|
|
30
|
+
value = undefined,
|
|
31
|
+
onChange = () => null,
|
|
32
|
+
containerProps = {},
|
|
33
|
+
zoomOptions = zoomDefaultOptions
|
|
34
|
+
} = _ref,
|
|
35
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
49
36
|
|
|
50
|
-
|
|
37
|
+
const {
|
|
38
|
+
cssClassName
|
|
39
|
+
} = convertPropToCssClassName('zoom-resize', className, {
|
|
40
|
+
disabled
|
|
41
|
+
});
|
|
42
|
+
const defaultOption = zoomOptions.find(option => option.default);
|
|
43
|
+
const [menuIsOpen, setMenuIsOpen] = useState(false);
|
|
44
|
+
const [selectedOption, setSelectedOption] = useState(defaultOption);
|
|
45
|
+
const [custom, setCustom] = useState(!value ? defaultOption : {
|
|
51
46
|
label: "".concat(clean(value), "%"),
|
|
52
47
|
value: clean(value),
|
|
53
48
|
id: 'custom'
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var options = [custom].concat(_toConsumableArray(zoomOptions.filter(function (option) {
|
|
60
|
-
return !option.default;
|
|
61
|
-
})));
|
|
62
|
-
var currentValue = value || (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) || (custom === null || custom === void 0 ? void 0 : custom.value) || (defaultOption === null || defaultOption === void 0 ? void 0 : defaultOption.value);
|
|
63
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
49
|
+
});
|
|
50
|
+
const options = [custom, ...zoomOptions.filter(option => !option.default)];
|
|
51
|
+
const currentValue = value || (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) || (custom === null || custom === void 0 ? void 0 : custom.value) || (defaultOption === null || defaultOption === void 0 ? void 0 : defaultOption.value);
|
|
52
|
+
return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread(_objectSpread({
|
|
64
53
|
className: "".concat(cssClassName)
|
|
65
|
-
}, containerProps, otherProps),
|
|
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
|
-
|
|
99
|
-
};
|
|
100
|
-
setCustom(newOption);
|
|
101
|
-
|
|
102
|
-
_onChange(newOption);
|
|
54
|
+
}, containerProps), otherProps), {}, {
|
|
55
|
+
children: /*#__PURE__*/_jsx(DSComboBox, {
|
|
56
|
+
searchable: true,
|
|
57
|
+
disabled: disabled,
|
|
58
|
+
menuIsOpen: menuIsOpen,
|
|
59
|
+
onChange: (valueChange, _ref2) => {
|
|
60
|
+
let {
|
|
61
|
+
action
|
|
62
|
+
} = _ref2;
|
|
63
|
+
const op = options.find(option => option.value === valueChange);
|
|
64
|
+
setSelectedOption(op);
|
|
65
|
+
onChange(op);
|
|
66
|
+
setMenuIsOpen(false);
|
|
67
|
+
|
|
68
|
+
if (action === 'select-option') {
|
|
69
|
+
document.activeElement.blur();
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
onClickDropdownIndicator: () => setMenuIsOpen(!menuIsOpen),
|
|
73
|
+
onInputChange: (valueInput, action) => {
|
|
74
|
+
if (valueInput || action.action === 'input-change') {
|
|
75
|
+
if (!valueInput) {
|
|
76
|
+
setCustom(defaultOption);
|
|
77
|
+
onChange(defaultOption);
|
|
78
|
+
} else if (!Number.isNaN(parseInt(valueInput, 10))) {
|
|
79
|
+
const cleanValue = parseInt(valueInput, 10);
|
|
80
|
+
const newOption = {
|
|
81
|
+
label: "".concat(cleanValue, "%"),
|
|
82
|
+
value: "".concat(cleanValue, "%"),
|
|
83
|
+
id: 'custom'
|
|
84
|
+
};
|
|
85
|
+
setCustom(newOption);
|
|
86
|
+
onChange(newOption);
|
|
87
|
+
}
|
|
103
88
|
}
|
|
104
|
-
}
|
|
105
89
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
90
|
+
setMenuIsOpen(false);
|
|
91
|
+
},
|
|
92
|
+
options: options,
|
|
93
|
+
value: currentValue
|
|
94
|
+
})
|
|
110
95
|
}));
|
|
111
96
|
};
|
|
112
97
|
|
|
113
|
-
|
|
98
|
+
const zoomProps = {
|
|
114
99
|
className: PropTypes.string.description('html class attribute'),
|
|
115
100
|
containerProps: PropTypes.object.description('Set of Properties attached to the main container'),
|
|
116
101
|
disabled: PropTypes.bool.description('disable component').defaultValue(false),
|
|
@@ -122,9 +107,7 @@ var zoomProps = {
|
|
|
122
107
|
default: PropTypes.bool
|
|
123
108
|
}).description('list of options to display in the select menu')
|
|
124
109
|
};
|
|
125
|
-
|
|
126
|
-
var ZoomWithSchema = describe(DSZoom);
|
|
110
|
+
const ZoomWithSchema = describe(DSZoom);
|
|
127
111
|
ZoomWithSchema.propTypes = zoomProps;
|
|
128
112
|
|
|
129
113
|
export { DSZoom, ZoomWithSchema, DSZoom as default };
|
|
130
|
-
//# sourceMappingURL=DSZoom.js.map
|
package/esm/components/utils.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var getFactor = function getFactor(value) {
|
|
8
|
-
return value / 100;
|
|
9
|
-
};
|
|
10
|
-
var clean = function clean(value) {
|
|
11
|
-
return value.replace(/\D/g, '').substring(0, 3);
|
|
12
|
-
};
|
|
1
|
+
import 'core-js/modules/es.string.replace.js';
|
|
2
|
+
|
|
3
|
+
const getCurrentFont = () => Number(window.getComputedStyle(document.querySelector(':root')).getPropertyValue('font-size').match(/\d+/)[0]);
|
|
4
|
+
const setSize = size => document.querySelector(':root').setAttribute('style', "font-size: ".concat(size, "px"));
|
|
5
|
+
const getFactor = value => value / 100;
|
|
6
|
+
const clean = value => value.replace(/\D/g, '').substring(0, 3);
|
|
13
7
|
|
|
14
8
|
export { clean, getCurrentFont, getFactor, setSize };
|
|
15
|
-
//# sourceMappingURL=utils.js.map
|
package/esm/index.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
1
|
export { DSZoom, ZoomWithSchema, DSZoom as default } from './DSZoom.js';
|
|
2
|
-
import '@babel/runtime/helpers/esm/extends';
|
|
3
|
-
import '@babel/runtime/helpers/esm/toConsumableArray';
|
|
4
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
5
|
-
import '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
6
|
-
import 'react';
|
|
7
|
-
import 'react-desc';
|
|
8
|
-
import '@elliemae/ds-classnames';
|
|
9
|
-
import '@elliemae/ds-form';
|
|
10
|
-
import './components/zoomOptions.js';
|
|
11
|
-
import './components/utils.js';
|
|
12
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,14 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-zoom",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.12",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "
|
|
6
|
-
"module": "esm/index.js",
|
|
7
|
-
"main": "cjs/index.js",
|
|
5
|
+
"description": "ICE MT - Dimsum - Zoom",
|
|
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
|
+
"./DSZoom": {
|
|
15
|
+
"import": "./esm/DSZoom.js",
|
|
16
|
+
"require": "./cjs/DSZoom.js"
|
|
17
|
+
},
|
|
18
|
+
"./components/zoomOptions": {
|
|
19
|
+
"import": "./esm/components/zoomOptions.js",
|
|
20
|
+
"require": "./cjs/components/zoomOptions.js"
|
|
21
|
+
},
|
|
22
|
+
"./components/utils": {
|
|
23
|
+
"import": "./esm/components/utils.js",
|
|
24
|
+
"require": "./cjs/components/utils.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
8
27
|
"sideEffects": [
|
|
9
28
|
"*.css",
|
|
10
29
|
"*.scss"
|
|
11
30
|
],
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"npm": ">=7",
|
|
37
|
+
"node": ">=14"
|
|
38
|
+
},
|
|
39
|
+
"author": "ICE MT",
|
|
12
40
|
"scripts": {
|
|
13
41
|
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
14
42
|
"prebuild": "exit 0",
|
|
@@ -16,16 +44,21 @@
|
|
|
16
44
|
"build": "node ../../scripts/build/build.js"
|
|
17
45
|
},
|
|
18
46
|
"dependencies": {
|
|
19
|
-
"@elliemae/ds-classnames": "
|
|
20
|
-
"@elliemae/ds-form": "
|
|
21
|
-
"react-desc": "
|
|
47
|
+
"@elliemae/ds-classnames": "2.0.0-alpha.12",
|
|
48
|
+
"@elliemae/ds-form": "2.0.0-alpha.12",
|
|
49
|
+
"react-desc": "~4.1.3"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@testing-library/jest-dom": "~5.15.0",
|
|
53
|
+
"@testing-library/react": "~12.1.2"
|
|
22
54
|
},
|
|
23
55
|
"peerDependencies": {
|
|
24
|
-
"react": "^17.0.
|
|
25
|
-
"react-dom": "^17.0.
|
|
56
|
+
"react": "^17.0.2",
|
|
57
|
+
"react-dom": "^17.0.2"
|
|
26
58
|
},
|
|
27
59
|
"publishConfig": {
|
|
28
60
|
"access": "public",
|
|
29
|
-
"directory": "dist"
|
|
61
|
+
"directory": "dist",
|
|
62
|
+
"generateSubmodules": true
|
|
30
63
|
}
|
|
31
64
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
declare const DSZoom: {
|
|
4
|
+
({ className, disabled, value, onChange, containerProps, zoomOptions, ...otherProps }: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
value?: undefined;
|
|
9
|
+
onChange?: (() => null) | undefined;
|
|
10
|
+
containerProps?: {} | undefined;
|
|
11
|
+
zoomOptions?: ({
|
|
12
|
+
label: string;
|
|
13
|
+
value: string;
|
|
14
|
+
default?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
label: string;
|
|
17
|
+
value: string;
|
|
18
|
+
default: boolean;
|
|
19
|
+
})[] | undefined;
|
|
20
|
+
}): JSX.Element;
|
|
21
|
+
propTypes: {
|
|
22
|
+
className: {
|
|
23
|
+
defaultValue<T = unknown>(arg: T): {
|
|
24
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
25
|
+
};
|
|
26
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
27
|
+
};
|
|
28
|
+
containerProps: {
|
|
29
|
+
defaultValue<T = unknown>(arg: T): {
|
|
30
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
31
|
+
};
|
|
32
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
33
|
+
};
|
|
34
|
+
disabled: {
|
|
35
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
36
|
+
};
|
|
37
|
+
value: {
|
|
38
|
+
defaultValue<T = unknown>(arg: T): {
|
|
39
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
40
|
+
};
|
|
41
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
42
|
+
};
|
|
43
|
+
onChange: {
|
|
44
|
+
defaultValue<T = unknown>(arg: T): {
|
|
45
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
46
|
+
};
|
|
47
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
48
|
+
};
|
|
49
|
+
zoomOptions: {
|
|
50
|
+
defaultValue<T = unknown>(arg: T): {
|
|
51
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
52
|
+
};
|
|
53
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
declare const ZoomWithSchema: {
|
|
58
|
+
(props?: {
|
|
59
|
+
[x: string]: any;
|
|
60
|
+
className?: string | undefined;
|
|
61
|
+
disabled?: boolean | undefined;
|
|
62
|
+
value?: undefined;
|
|
63
|
+
onChange?: (() => null) | undefined;
|
|
64
|
+
containerProps?: {} | undefined;
|
|
65
|
+
zoomOptions?: ({
|
|
66
|
+
label: string;
|
|
67
|
+
value: string;
|
|
68
|
+
default?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
label: string;
|
|
71
|
+
value: string;
|
|
72
|
+
default: boolean;
|
|
73
|
+
})[] | undefined;
|
|
74
|
+
} | undefined): JSX.Element;
|
|
75
|
+
propTypes: unknown;
|
|
76
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
77
|
+
};
|
|
78
|
+
export { DSZoom, ZoomWithSchema };
|
|
79
|
+
export default DSZoom;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/DSZoom/package.json
DELETED
package/cjs/DSZoom.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DSZoom.js","sources":["../../src/DSZoom.tsx"],"sourcesContent":["/* eslint-disable indent */\nimport React, { useState } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { DSComboBox } from '@elliemae/ds-form';\nimport zoomDefaultOptions from './components/zoomOptions';\nimport { clean } from './components/utils';\n\nconst DSZoom = ({\n className = '',\n disabled = false,\n value = undefined,\n onChange = () => null,\n containerProps = {},\n zoomOptions = zoomDefaultOptions,\n ...otherProps\n}) => {\n const { cssClassName } = convertPropToCssClassName('zoom-resize', className, {\n disabled,\n });\n const defaultOption = zoomOptions.find((option) => option.default);\n const [menuIsOpen, setMenuIsOpen] = useState(false);\n const [selectedOption, setSelectedOption] = useState(defaultOption);\n const [custom, setCustom] = useState(\n !value\n ? defaultOption\n : {\n label: `${clean(value)}%`,\n value: clean(value),\n id: 'custom',\n },\n );\n const options = [custom, ...zoomOptions.filter((option) => !option.default)];\n\n const currentValue = value || selectedOption?.value || custom?.value || defaultOption?.value;\n\n return (\n <div className={`${cssClassName}`} {...containerProps} {...otherProps}>\n <DSComboBox\n searchable\n disabled={disabled}\n menuIsOpen={menuIsOpen}\n onChange={(valueChange, { action }) => {\n const op = options.find((option) => option.value === valueChange);\n setSelectedOption(op);\n onChange(op);\n setMenuIsOpen(false);\n if (action === 'select-option') {\n document.activeElement.blur();\n }\n }}\n onClickDropdownIndicator={() => setMenuIsOpen(!menuIsOpen)}\n onInputChange={(valueInput, action) => {\n if (valueInput || action.action === 'input-change') {\n if (!valueInput) {\n setCustom(defaultOption);\n onChange(defaultOption);\n } else if (!Number.isNaN(parseInt(valueInput, 10))) {\n const cleanValue = parseInt(valueInput, 10);\n const newOption = {\n label: `${cleanValue}%`,\n value: `${cleanValue}%`,\n id: 'custom',\n };\n setCustom(newOption);\n onChange(newOption);\n }\n }\n setMenuIsOpen(false);\n }}\n options={options}\n value={currentValue}\n />\n </div>\n );\n};\n\nconst zoomProps = {\n className: PropTypes.string.description('html class attribute'),\n containerProps: PropTypes.object.description('Set of Properties attached to the main container'),\n disabled: PropTypes.bool.description('disable component').defaultValue(false),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).description('current value'),\n onChange: PropTypes.func.description('function called when a new value is selected'),\n zoomOptions: PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n default: PropTypes.bool,\n }).description('list of options to display in the select menu'),\n};\n\nDSZoom.propTypes = zoomProps;\n\nconst ZoomWithSchema = describe(DSZoom);\nZoomWithSchema.propTypes = zoomProps;\n\nexport { DSZoom, ZoomWithSchema };\nexport default DSZoom;\n"],"names":["DSZoom","className","disabled","value","undefined","onChange","containerProps","zoomOptions","zoomDefaultOptions","otherProps","convertPropToCssClassName","cssClassName","defaultOption","find","option","default","useState","menuIsOpen","setMenuIsOpen","selectedOption","setSelectedOption","label","clean","id","custom","setCustom","options","filter","currentValue","React","DSComboBox","valueChange","action","op","document","activeElement","blur","valueInput","Number","isNaN","parseInt","cleanValue","newOption","zoomProps","PropTypes","string","description","object","bool","defaultValue","oneOfType","number","func","shape","propTypes","ZoomWithSchema","describe"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;IAQMA,MAAM,GAAG,SAATA,MAAS,OAQT;AAAA,4BAPJC,SAOI;AAAA,MAPJA,SAOI,+BAPQ,EAOR;AAAA,2BANJC,QAMI;AAAA,MANJA,QAMI,8BANO,KAMP;AAAA,wBALJC,KAKI;AAAA,MALJA,KAKI,2BALIC,SAKJ;AAAA,2BAJJC,QAII;AAAA,MAJJA,SAII,8BAJO;AAAA,WAAM,IAAN;AAAA,GAIP;AAAA,iCAHJC,cAGI;AAAA,MAHJA,cAGI,oCAHa,EAGb;AAAA,8BAFJC,WAEI;AAAA,MAFJA,WAEI,iCAFUC,sBAEV;AAAA,MADDC,UACC;;AACJ,8BAAyBC,sCAAyB,CAAC,aAAD,EAAgBT,SAAhB,EAA2B;AAC3EC,IAAAA,QAAQ,EAARA;AAD2E,GAA3B,CAAlD;AAAA,MAAQS,YAAR,yBAAQA,YAAR;;AAGA,MAAMC,aAAa,GAAGL,WAAW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ACC,MAAV,CAAiBC,WAAjB,CAA6B,sBAA7B,CADK;AAEhBxC,EAAAA,cAAc,EAAEsC,mBAAS,CAACG,MAAV,CAAiBD,WAAjB,CAA6B,kDAA7B,CAFA;AAGhB5C,EAAAA,QAAQ,EAAE0C,mBAAS,CAACI,IAAV,CAAeF,WAAf,CAA2B,mBAA3B,EAAgDG,YAAhD,CAA6D,KAA7D,CAHM;AAIhB9C,EAAAA,KAAK,EAAEyC,mBAAS,CAACM,SAAV,CAAoB,CAACN,mBAAS,CAACC,MAAX,EAAmBD,mBAAS,CAACO,MAA7B,EAAqCP,mBAAS,CAACG,MAA/C,CAApB,EAA4ED,WAA5E,CAAwF,eAAxF,CAJS;AAKhBzC,EAAAA,QAAQ,EAAEuC,mBAAS,CAACQ,IAAV,CAAeN,WAAf,CAA2B,8CAA3B,CALM;AAMhBvC,EAAAA,WAAW,EAAEqC,mBAAS,CAACS,KAAV,CAAgB;AAC3BhC,IAAAA,KAAK,EAAEuB,mBAAS,CAACM,SAAV,CAAoB,CAACN,mBAAS,CAACC,MAAX,EAAmBD,mBAAS,CAACO,MAA7B,CAApB,CADoB;AAE3BhD,IAAAA,KAAK,EAAEyC,mBAAS,CAACM,SAAV,CAAoB,CAACN,mBAAS,CAACC,MAAX,EAAmBD,mBAAS,CAACO,MAA7B,CAApB,CAFoB;AAG3BpC,IAAAA,OAAO,EAAE6B,mBAAS,CAACI;AAHQ,GAAhB,EAIVF,WAJU,CAIE,+CAJF;AANG,CAAlB;AAaA9C,MAAM,CAACsD,SAAP,GAAmBX,SAAnB;IAEMY,cAAc,GAAGC,kBAAQ,CAACxD,MAAD;AAC/BuD,cAAc,CAACD,SAAf,GAA2BX,SAA3B;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/components/utils.tsx"],"sourcesContent":["export const getCurrentFont = () =>\n Number(\n window\n .getComputedStyle(document.querySelector(':root'))\n .getPropertyValue('font-size')\n .match(/\\d+/)[0],\n );\nexport const setSize = (size) =>\n document.querySelector(':root').setAttribute('style', `font-size: ${size}px`);\n\nexport const getFactor = (value) => value / 100;\n\nexport const clean = (value) => value.replace(/\\D/g, '').substring(0, 3);\n"],"names":["getCurrentFont","Number","window","getComputedStyle","document","querySelector","getPropertyValue","match","setSize","size","setAttribute","getFactor","value","clean","replace","substring"],"mappings":";;;;IAAaA,cAAc,GAAG,SAAjBA,cAAiB;AAAA,SAC5BC,MAAM,CACJC,MAAM,CACHC,gBADH,CACoBC,QAAQ,CAACC,aAAT,CAAuB,OAAvB,CADpB,EAEGC,gBAFH,CAEoB,WAFpB,EAGGC,KAHH,CAGS,KAHT,EAGgB,CAHhB,CADI,CADsB;AAAA;IAOjBC,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD;AAAA,SACrBL,QAAQ,CAACC,aAAT,CAAuB,OAAvB,EAAgCK,YAAhC,CAA6C,OAA7C,uBAAoED,IAApE,QADqB;AAAA;IAGVE,SAAS,GAAG,SAAZA,SAAY,CAACC,KAAD;AAAA,SAAWA,KAAK,GAAG,GAAnB;AAAA;IAEZC,KAAK,GAAG,SAARA,KAAQ,CAACD,KAAD;AAAA,SAAWA,KAAK,CAACE,OAAN,CAAc,KAAd,EAAqB,EAArB,EAAyBC,SAAzB,CAAmC,CAAnC,EAAsC,CAAtC,CAAX;AAAA;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zoomOptions.js","sources":["../../../src/components/zoomOptions.tsx"],"sourcesContent":["export default [\n {\n label: '25%',\n value: '25',\n },\n {\n label: '50%',\n value: '50',\n },\n {\n label: '75%',\n value: '75',\n },\n {\n label: '100%',\n value: '100',\n default: true,\n },\n {\n label: '125%',\n value: '125',\n },\n {\n label: '150%',\n value: '150',\n },\n {\n label: '175%',\n value: '175',\n },\n {\n label: '200%',\n value: '200',\n },\n];\n"],"names":["label","value","default"],"mappings":";;AAAA,yBAAe,CACb;AACEA,EAAAA,KAAK,EAAE,KADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CADa,EAKb;AACED,EAAAA,KAAK,EAAE,KADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CALa,EASb;AACED,EAAAA,KAAK,EAAE,KADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CATa,EAab;AACED,EAAAA,KAAK,EAAE,MADT;AAEEC,EAAAA,KAAK,EAAE,KAFT;AAGEC,EAAAA,OAAO,EAAE;AAHX,CAba,EAkBb;AACEF,EAAAA,KAAK,EAAE,MADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CAlBa,EAsBb;AACED,EAAAA,KAAK,EAAE,MADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CAtBa,EA0Bb;AACED,EAAAA,KAAK,EAAE,MADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CA1Ba,EA8Bb;AACED,EAAAA,KAAK,EAAE,MADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CA9Ba,CAAf;;;;"}
|
package/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
package/esm/DSZoom.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DSZoom.js","sources":["../../src/DSZoom.tsx"],"sourcesContent":["/* eslint-disable indent */\nimport React, { useState } from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { convertPropToCssClassName } from '@elliemae/ds-classnames';\nimport { DSComboBox } from '@elliemae/ds-form';\nimport zoomDefaultOptions from './components/zoomOptions';\nimport { clean } from './components/utils';\n\nconst DSZoom = ({\n className = '',\n disabled = false,\n value = undefined,\n onChange = () => null,\n containerProps = {},\n zoomOptions = zoomDefaultOptions,\n ...otherProps\n}) => {\n const { cssClassName } = convertPropToCssClassName('zoom-resize', className, {\n disabled,\n });\n const defaultOption = zoomOptions.find((option) => option.default);\n const [menuIsOpen, setMenuIsOpen] = useState(false);\n const [selectedOption, setSelectedOption] = useState(defaultOption);\n const [custom, setCustom] = useState(\n !value\n ? defaultOption\n : {\n label: `${clean(value)}%`,\n value: clean(value),\n id: 'custom',\n },\n );\n const options = [custom, ...zoomOptions.filter((option) => !option.default)];\n\n const currentValue = value || selectedOption?.value || custom?.value || defaultOption?.value;\n\n return (\n <div className={`${cssClassName}`} {...containerProps} {...otherProps}>\n <DSComboBox\n searchable\n disabled={disabled}\n menuIsOpen={menuIsOpen}\n onChange={(valueChange, { action }) => {\n const op = options.find((option) => option.value === valueChange);\n setSelectedOption(op);\n onChange(op);\n setMenuIsOpen(false);\n if (action === 'select-option') {\n document.activeElement.blur();\n }\n }}\n onClickDropdownIndicator={() => setMenuIsOpen(!menuIsOpen)}\n onInputChange={(valueInput, action) => {\n if (valueInput || action.action === 'input-change') {\n if (!valueInput) {\n setCustom(defaultOption);\n onChange(defaultOption);\n } else if (!Number.isNaN(parseInt(valueInput, 10))) {\n const cleanValue = parseInt(valueInput, 10);\n const newOption = {\n label: `${cleanValue}%`,\n value: `${cleanValue}%`,\n id: 'custom',\n };\n setCustom(newOption);\n onChange(newOption);\n }\n }\n setMenuIsOpen(false);\n }}\n options={options}\n value={currentValue}\n />\n </div>\n );\n};\n\nconst zoomProps = {\n className: PropTypes.string.description('html class attribute'),\n containerProps: PropTypes.object.description('Set of Properties attached to the main container'),\n disabled: PropTypes.bool.description('disable component').defaultValue(false),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).description('current value'),\n onChange: PropTypes.func.description('function called when a new value is selected'),\n zoomOptions: PropTypes.shape({\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n default: PropTypes.bool,\n }).description('list of options to display in the select menu'),\n};\n\nDSZoom.propTypes = zoomProps;\n\nconst ZoomWithSchema = describe(DSZoom);\nZoomWithSchema.propTypes = zoomProps;\n\nexport { DSZoom, ZoomWithSchema };\nexport default DSZoom;\n"],"names":["DSZoom","className","disabled","value","undefined","onChange","containerProps","zoomOptions","zoomDefaultOptions","otherProps","convertPropToCssClassName","cssClassName","defaultOption","find","option","default","useState","menuIsOpen","setMenuIsOpen","selectedOption","setSelectedOption","label","clean","id","custom","setCustom","options","filter","currentValue","valueChange","action","op","document","activeElement","blur","valueInput","Number","isNaN","parseInt","cleanValue","newOption","zoomProps","PropTypes","string","description","object","bool","defaultValue","oneOfType","number","func","shape","propTypes","ZoomWithSchema","describe"],"mappings":";;;;;;;;;;;;;IAQMA,MAAM,GAAG,SAATA,MAAS,OAQT;AAAA,4BAPJC,SAOI;AAAA,MAPJA,SAOI,+BAPQ,EAOR;AAAA,2BANJC,QAMI;AAAA,MANJA,QAMI,8BANO,KAMP;AAAA,wBALJC,KAKI;AAAA,MALJA,KAKI,2BALIC,SAKJ;AAAA,2BAJJC,QAII;AAAA,MAJJA,SAII,8BAJO;AAAA,WAAM,IAAN;AAAA,GAIP;AAAA,iCAHJC,cAGI;AAAA,MAHJA,cAGI,oCAHa,EAGb;AAAA,8BAFJC,WAEI;AAAA,MAFJA,WAEI,iCAFUC,kBAEV;AAAA,MADDC,UACC;;AACJ,8BAAyBC,yBAAyB,CAAC,aAAD,EAAgBT,SAAhB,EAA2B;AAC3EC,IAAAA,QAAQ,EAARA;AAD2E,GAA3B,CAAlD;AAAA,MAAQS,YAAR,yBAAQA,YAAR;;AAGA,MAAMC,aAAa,GAAGL,WAAW,CAACM,IAAZ,CAAiB,UAACC,MAAD;AAAA,WAAYA,MAAM,CAACC,OAAnB;AAAA,GAAjB,CAAtB;;AACA,kBAAoCC,QAAQ,CAAC,KAAD,CAA5C;AAAA;AAAA,MAAOC,UAAP;AAAA,MAAmBC,aAAnB;;AACA,mBAA4CF,QAAQ,CAACJ,aAAD,CAApD;AAAA;AAAA,MAAOO,cAAP;AAAA,MAAuBC,iBAAvB;;AACA,mBAA4BJ,QAAQ,CAClC,CAACb,KAAD,GACIS,aADJ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mBD,SAAS,CAACO,MAA7B,EAAqCP,SAAS,CAACG,MAA/C,CAApB,EAA4ED,WAA5E,CAAwF,eAAxF,CAJS;AAKhBvC,EAAAA,QAAQ,EAAEqC,SAAS,CAACQ,IAAV,CAAeN,WAAf,CAA2B,8CAA3B,CALM;AAMhBrC,EAAAA,WAAW,EAAEmC,SAAS,CAACS,KAAV,CAAgB;AAC3B9B,IAAAA,KAAK,EAAEqB,SAAS,CAACM,SAAV,CAAoB,CAACN,SAAS,CAACC,MAAX,EAAmBD,SAAS,CAACO,MAA7B,CAApB,CADoB;AAE3B9C,IAAAA,KAAK,EAAEuC,SAAS,CAACM,SAAV,CAAoB,CAACN,SAAS,CAACC,MAAX,EAAmBD,SAAS,CAACO,MAA7B,CAApB,CAFoB;AAG3BlC,IAAAA,OAAO,EAAE2B,SAAS,CAACI;AAHQ,GAAhB,EAIVF,WAJU,CAIE,+CAJF;AANG,CAAlB;AAaA5C,MAAM,CAACoD,SAAP,GAAmBX,SAAnB;IAEMY,cAAc,GAAGC,QAAQ,CAACtD,MAAD;AAC/BqD,cAAc,CAACD,SAAf,GAA2BX,SAA3B;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/components/utils.tsx"],"sourcesContent":["export const getCurrentFont = () =>\n Number(\n window\n .getComputedStyle(document.querySelector(':root'))\n .getPropertyValue('font-size')\n .match(/\\d+/)[0],\n );\nexport const setSize = (size) =>\n document.querySelector(':root').setAttribute('style', `font-size: ${size}px`);\n\nexport const getFactor = (value) => value / 100;\n\nexport const clean = (value) => value.replace(/\\D/g, '').substring(0, 3);\n"],"names":["getCurrentFont","Number","window","getComputedStyle","document","querySelector","getPropertyValue","match","setSize","size","setAttribute","getFactor","value","clean","replace","substring"],"mappings":"IAAaA,cAAc,GAAG,SAAjBA,cAAiB;AAAA,SAC5BC,MAAM,CACJC,MAAM,CACHC,gBADH,CACoBC,QAAQ,CAACC,aAAT,CAAuB,OAAvB,CADpB,EAEGC,gBAFH,CAEoB,WAFpB,EAGGC,KAHH,CAGS,KAHT,EAGgB,CAHhB,CADI,CADsB;AAAA;IAOjBC,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD;AAAA,SACrBL,QAAQ,CAACC,aAAT,CAAuB,OAAvB,EAAgCK,YAAhC,CAA6C,OAA7C,uBAAoED,IAApE,QADqB;AAAA;IAGVE,SAAS,GAAG,SAAZA,SAAY,CAACC,KAAD;AAAA,SAAWA,KAAK,GAAG,GAAnB;AAAA;IAEZC,KAAK,GAAG,SAARA,KAAQ,CAACD,KAAD;AAAA,SAAWA,KAAK,CAACE,OAAN,CAAc,KAAd,EAAqB,EAArB,EAAyBC,SAAzB,CAAmC,CAAnC,EAAsC,CAAtC,CAAX;AAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"zoomOptions.js","sources":["../../../src/components/zoomOptions.tsx"],"sourcesContent":["export default [\n {\n label: '25%',\n value: '25',\n },\n {\n label: '50%',\n value: '50',\n },\n {\n label: '75%',\n value: '75',\n },\n {\n label: '100%',\n value: '100',\n default: true,\n },\n {\n label: '125%',\n value: '125',\n },\n {\n label: '150%',\n value: '150',\n },\n {\n label: '175%',\n value: '175',\n },\n {\n label: '200%',\n value: '200',\n },\n];\n"],"names":["label","value","default"],"mappings":"AAAA,yBAAe,CACb;AACEA,EAAAA,KAAK,EAAE,KADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CADa,EAKb;AACED,EAAAA,KAAK,EAAE,KADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CALa,EASb;AACED,EAAAA,KAAK,EAAE,KADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CATa,EAab;AACED,EAAAA,KAAK,EAAE,MADT;AAEEC,EAAAA,KAAK,EAAE,KAFT;AAGEC,EAAAA,OAAO,EAAE;AAHX,CAba,EAkBb;AACEF,EAAAA,KAAK,EAAE,MADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CAlBa,EAsBb;AACED,EAAAA,KAAK,EAAE,MADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CAtBa,EA0Bb;AACED,EAAAA,KAAK,EAAE,MADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CA1Ba,EA8Bb;AACED,EAAAA,KAAK,EAAE,MADT;AAEEC,EAAAA,KAAK,EAAE;AAFT,CA9Ba,CAAf;;;;"}
|
package/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|