@elliemae/ds-zoom 3.0.0-next.2 → 3.0.0-next.3
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/dist/cjs/DSZoom.js +151 -0
- package/dist/cjs/DSZoom.js.map +7 -0
- package/dist/cjs/components/utils.js +41 -0
- package/dist/cjs/components/utils.js.map +7 -0
- package/dist/cjs/components/zoomOptions.js +69 -0
- package/dist/cjs/components/zoomOptions.js.map +7 -0
- package/dist/cjs/index.js +36 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/esm/DSZoom.js +124 -0
- package/dist/esm/DSZoom.js.map +7 -0
- package/dist/esm/components/utils.js +12 -0
- package/dist/esm/components/utils.js.map +7 -0
- package/dist/esm/components/zoomOptions.js +40 -0
- package/dist/esm/components/zoomOptions.js.map +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +7 -0
- package/package.json +33 -24
- package/cjs/DSZoom.js +0 -125
- package/cjs/components/utils.js +0 -15
- package/cjs/components/zoomOptions.js +0 -30
- package/cjs/index.js +0 -11
- package/esm/DSZoom.js +0 -113
- package/esm/components/utils.js +0 -8
- package/esm/components/zoomOptions.js +0 -28
- package/esm/index.js +0 -1
- package/types/DSZoom.d.ts +0 -79
- package/types/components/utils.d.ts +0 -4
- package/types/components/zoomOptions.d.ts +0 -10
- package/types/index.d.ts +0 -2
- package/types/tests/DSZoom.test.d.ts +0 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
22
|
+
var __objRest = (source, exclude) => {
|
|
23
|
+
var target = {};
|
|
24
|
+
for (var prop in source)
|
|
25
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
26
|
+
target[prop] = source[prop];
|
|
27
|
+
if (source != null && __getOwnPropSymbols)
|
|
28
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
29
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
30
|
+
target[prop] = source[prop];
|
|
31
|
+
}
|
|
32
|
+
return target;
|
|
33
|
+
};
|
|
34
|
+
var __export = (target, all) => {
|
|
35
|
+
for (var name in all)
|
|
36
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
37
|
+
};
|
|
38
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
39
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
40
|
+
for (let key of __getOwnPropNames(module2))
|
|
41
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
42
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
43
|
+
}
|
|
44
|
+
return target;
|
|
45
|
+
};
|
|
46
|
+
var __toESM = (module2, isNodeMode) => {
|
|
47
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
48
|
+
};
|
|
49
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
50
|
+
return (module2, temp) => {
|
|
51
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
52
|
+
};
|
|
53
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
54
|
+
var DSZoom_exports = {};
|
|
55
|
+
__export(DSZoom_exports, {
|
|
56
|
+
DSZoom: () => DSZoom,
|
|
57
|
+
ZoomWithSchema: () => ZoomWithSchema,
|
|
58
|
+
default: () => DSZoom_default
|
|
59
|
+
});
|
|
60
|
+
var React = __toESM(require("react"));
|
|
61
|
+
var import_react = __toESM(require("react"));
|
|
62
|
+
var import_react_desc = require("react-desc");
|
|
63
|
+
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
64
|
+
var import_ds_form = require("@elliemae/ds-form");
|
|
65
|
+
var import_zoomOptions = __toESM(require("./components/zoomOptions"));
|
|
66
|
+
var import_utils = require("./components/utils");
|
|
67
|
+
const DSZoom = (_a) => {
|
|
68
|
+
var _b = _a, {
|
|
69
|
+
className = "",
|
|
70
|
+
disabled = false,
|
|
71
|
+
value = void 0,
|
|
72
|
+
onChange = () => null,
|
|
73
|
+
containerProps = {},
|
|
74
|
+
zoomOptions = import_zoomOptions.default
|
|
75
|
+
} = _b, otherProps = __objRest(_b, [
|
|
76
|
+
"className",
|
|
77
|
+
"disabled",
|
|
78
|
+
"value",
|
|
79
|
+
"onChange",
|
|
80
|
+
"containerProps",
|
|
81
|
+
"zoomOptions"
|
|
82
|
+
]);
|
|
83
|
+
const { cssClassName } = (0, import_ds_classnames.convertPropToCssClassName)("zoom-resize", className, {
|
|
84
|
+
disabled
|
|
85
|
+
});
|
|
86
|
+
const defaultOption = zoomOptions.find((option) => option.default);
|
|
87
|
+
const [menuIsOpen, setMenuIsOpen] = (0, import_react.useState)(false);
|
|
88
|
+
const [selectedOption, setSelectedOption] = (0, import_react.useState)(defaultOption);
|
|
89
|
+
const [custom, setCustom] = (0, import_react.useState)(!value ? defaultOption : {
|
|
90
|
+
label: `${(0, import_utils.clean)(value)}%`,
|
|
91
|
+
value: (0, import_utils.clean)(value),
|
|
92
|
+
id: "custom"
|
|
93
|
+
});
|
|
94
|
+
const options = [custom, ...zoomOptions.filter((option) => !option.default)];
|
|
95
|
+
const currentValue = value || selectedOption?.value || custom?.value || defaultOption?.value;
|
|
96
|
+
return /* @__PURE__ */ import_react.default.createElement("div", __spreadValues(__spreadValues({
|
|
97
|
+
className: `${cssClassName}`
|
|
98
|
+
}, containerProps), otherProps), /* @__PURE__ */ import_react.default.createElement(import_ds_form.DSComboBox, {
|
|
99
|
+
searchable: true,
|
|
100
|
+
disabled,
|
|
101
|
+
menuIsOpen,
|
|
102
|
+
onChange: (valueChange, { action }) => {
|
|
103
|
+
const op = options.find((option) => option.value === valueChange);
|
|
104
|
+
setSelectedOption(op);
|
|
105
|
+
onChange(op);
|
|
106
|
+
setMenuIsOpen(false);
|
|
107
|
+
if (action === "select-option") {
|
|
108
|
+
document.activeElement.blur();
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
onClickDropdownIndicator: () => setMenuIsOpen(!menuIsOpen),
|
|
112
|
+
onInputChange: (valueInput, action) => {
|
|
113
|
+
if (valueInput || action.action === "input-change") {
|
|
114
|
+
if (!valueInput) {
|
|
115
|
+
setCustom(defaultOption);
|
|
116
|
+
onChange(defaultOption);
|
|
117
|
+
} else if (!Number.isNaN(parseInt(valueInput, 10))) {
|
|
118
|
+
const cleanValue = parseInt(valueInput, 10);
|
|
119
|
+
const newOption = {
|
|
120
|
+
label: `${cleanValue}%`,
|
|
121
|
+
value: `${cleanValue}%`,
|
|
122
|
+
id: "custom"
|
|
123
|
+
};
|
|
124
|
+
setCustom(newOption);
|
|
125
|
+
onChange(newOption);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
setMenuIsOpen(false);
|
|
129
|
+
},
|
|
130
|
+
options,
|
|
131
|
+
value: currentValue
|
|
132
|
+
}));
|
|
133
|
+
};
|
|
134
|
+
const zoomProps = {
|
|
135
|
+
className: import_react_desc.PropTypes.string.description("html class attribute"),
|
|
136
|
+
containerProps: import_react_desc.PropTypes.object.description("Set of Properties attached to the main container"),
|
|
137
|
+
disabled: import_react_desc.PropTypes.bool.description("disable component").defaultValue(false),
|
|
138
|
+
value: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number, import_react_desc.PropTypes.object]).description("current value"),
|
|
139
|
+
onChange: import_react_desc.PropTypes.func.description("function called when a new value is selected"),
|
|
140
|
+
zoomOptions: import_react_desc.PropTypes.shape({
|
|
141
|
+
label: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number]),
|
|
142
|
+
value: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.string, import_react_desc.PropTypes.number]),
|
|
143
|
+
default: import_react_desc.PropTypes.bool
|
|
144
|
+
}).description("list of options to display in the select menu")
|
|
145
|
+
};
|
|
146
|
+
DSZoom.propTypes = zoomProps;
|
|
147
|
+
const ZoomWithSchema = (0, import_react_desc.describe)(DSZoom);
|
|
148
|
+
ZoomWithSchema.propTypes = zoomProps;
|
|
149
|
+
var DSZoom_default = DSZoom;
|
|
150
|
+
module.exports = __toCommonJS(DSZoom_exports);
|
|
151
|
+
//# sourceMappingURL=DSZoom.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSZoom.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAgC;AAChC,wBAAoC;AACpC,2BAA0C;AAC1C,qBAA2B;AAC3B,yBAA+B;AAC/B,mBAAsB;AAEtB,MAAM,SAAS,CAAC,OAQV;AARU,eACd;AAAA,gBAAY;AAAA,IACZ,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,WAAW,MAAM;AAAA,IACjB,iBAAiB;AAAA,IACjB,cAAc;AAAA,MANA,IAOX,uBAPW,IAOX;AAAA,IANH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,QAAM,EAAE,iBAAiB,oDAA0B,eAAe,WAAW;AAAA,IAC3E;AAAA;AAEF,QAAM,gBAAgB,YAAY,KAAK,CAAC,WAAW,OAAO;AAC1D,QAAM,CAAC,YAAY,iBAAiB,2BAAS;AAC7C,QAAM,CAAC,gBAAgB,qBAAqB,2BAAS;AACrD,QAAM,CAAC,QAAQ,aAAa,2BAC1B,CAAC,QACG,gBACA;AAAA,IACE,OAAO,GAAG,wBAAM;AAAA,IAChB,OAAO,wBAAM;AAAA,IACb,IAAI;AAAA;AAGZ,QAAM,UAAU,CAAC,QAAQ,GAAG,YAAY,OAAO,CAAC,WAAW,CAAC,OAAO;AAEnE,QAAM,eAAe,SAAS,gBAAgB,SAAS,QAAQ,SAAS,eAAe;AAEvF,SACE,mDAAC,OAAD;AAAA,IAAK,WAAW,GAAG;AAAA,KAAoB,iBAAoB,aACzD,mDAAC,2BAAD;AAAA,IACE,YAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,UAAU,CAAC,aAAa,EAAE,aAAa;AACrC,YAAM,KAAK,QAAQ,KAAK,CAAC,WAAW,OAAO,UAAU;AACrD,wBAAkB;AAClB,eAAS;AACT,oBAAc;AACd,UAAI,WAAW,iBAAiB;AAC9B,iBAAS,cAAc;AAAA;AAAA;AAAA,IAG3B,0BAA0B,MAAM,cAAc,CAAC;AAAA,IAC/C,eAAe,CAAC,YAAY,WAAW;AACrC,UAAI,cAAc,OAAO,WAAW,gBAAgB;AAClD,YAAI,CAAC,YAAY;AACf,oBAAU;AACV,mBAAS;AAAA,mBACA,CAAC,OAAO,MAAM,SAAS,YAAY,MAAM;AAClD,gBAAM,aAAa,SAAS,YAAY;AACxC,gBAAM,YAAY;AAAA,YAChB,OAAO,GAAG;AAAA,YACV,OAAO,GAAG;AAAA,YACV,IAAI;AAAA;AAEN,oBAAU;AACV,mBAAS;AAAA;AAAA;AAGb,oBAAc;AAAA;AAAA,IAEhB;AAAA,IACA,OAAO;AAAA;AAAA;AAMf,MAAM,YAAY;AAAA,EAChB,WAAW,4BAAU,OAAO,YAAY;AAAA,EACxC,gBAAgB,4BAAU,OAAO,YAAY;AAAA,EAC7C,UAAU,4BAAU,KAAK,YAAY,qBAAqB,aAAa;AAAA,EACvE,OAAO,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU,QAAQ,4BAAU,SAAS,YAAY;AAAA,EAC/F,UAAU,4BAAU,KAAK,YAAY;AAAA,EACrC,aAAa,4BAAU,MAAM;AAAA,IAC3B,OAAO,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU;AAAA,IACxD,OAAO,4BAAU,UAAU,CAAC,4BAAU,QAAQ,4BAAU;AAAA,IACxD,SAAS,4BAAU;AAAA,KAClB,YAAY;AAAA;AAGjB,OAAO,YAAY;AAEnB,MAAM,iBAAiB,gCAAS;AAChC,eAAe,YAAY;AAG3B,IAAO,iBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var utils_exports = {};
|
|
29
|
+
__export(utils_exports, {
|
|
30
|
+
clean: () => clean,
|
|
31
|
+
getCurrentFont: () => getCurrentFont,
|
|
32
|
+
getFactor: () => getFactor,
|
|
33
|
+
setSize: () => setSize
|
|
34
|
+
});
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
const getCurrentFont = () => Number(window.getComputedStyle(document.querySelector(":root")).getPropertyValue("font-size").match(/\d+/)[0]);
|
|
37
|
+
const setSize = (size) => document.querySelector(":root").setAttribute("style", `font-size: ${size}px`);
|
|
38
|
+
const getFactor = (value) => value / 100;
|
|
39
|
+
const clean = (value) => value.replace(/\D/g, "").substring(0, 3);
|
|
40
|
+
module.exports = __toCommonJS(utils_exports);
|
|
41
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/utils.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,iBAAiB,MAC5B,OACE,OACG,iBAAiB,SAAS,cAAc,UACxC,iBAAiB,aACjB,MAAM,OAAO;AAEb,MAAM,UAAU,CAAC,SACtB,SAAS,cAAc,SAAS,aAAa,SAAS,cAAc;AAE/D,MAAM,YAAY,CAAC,UAAU,QAAQ;AAErC,MAAM,QAAQ,CAAC,UAAU,MAAM,QAAQ,OAAO,IAAI,UAAU,GAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var zoomOptions_exports = {};
|
|
29
|
+
__export(zoomOptions_exports, {
|
|
30
|
+
default: () => zoomOptions_default
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var zoomOptions_default = [
|
|
34
|
+
{
|
|
35
|
+
label: "25%",
|
|
36
|
+
value: "25"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: "50%",
|
|
40
|
+
value: "50"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: "75%",
|
|
44
|
+
value: "75"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "100%",
|
|
48
|
+
value: "100",
|
|
49
|
+
default: true
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: "125%",
|
|
53
|
+
value: "125"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: "150%",
|
|
57
|
+
value: "150"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: "175%",
|
|
61
|
+
value: "175"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: "200%",
|
|
65
|
+
value: "200"
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
module.exports = __toCommonJS(zoomOptions_exports);
|
|
69
|
+
//# sourceMappingURL=zoomOptions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/zoomOptions.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,IAAO,sBAAQ;AAAA,EACb;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,SAAS;AAAA;AAAA,EAEX;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var src_exports = {};
|
|
29
|
+
__export(src_exports, {
|
|
30
|
+
default: () => import_DSZoom.default
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
__reExport(src_exports, require("./DSZoom"));
|
|
34
|
+
var import_DSZoom = __toESM(require("./DSZoom"));
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export * from './DSZoom';\nexport { default } from './DSZoom';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc;AACd,oBAAwB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
var __objRest = (source, exclude) => {
|
|
18
|
+
var target = {};
|
|
19
|
+
for (var prop in source)
|
|
20
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
+
target[prop] = source[prop];
|
|
22
|
+
if (source != null && __getOwnPropSymbols)
|
|
23
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
29
|
+
import * as React from "react";
|
|
30
|
+
import React2, { useState } from "react";
|
|
31
|
+
import { describe, PropTypes } from "react-desc";
|
|
32
|
+
import { convertPropToCssClassName } from "@elliemae/ds-classnames";
|
|
33
|
+
import { DSComboBox } from "@elliemae/ds-form";
|
|
34
|
+
import zoomDefaultOptions from "./components/zoomOptions";
|
|
35
|
+
import { clean } from "./components/utils";
|
|
36
|
+
const DSZoom = (_a) => {
|
|
37
|
+
var _b = _a, {
|
|
38
|
+
className = "",
|
|
39
|
+
disabled = false,
|
|
40
|
+
value = void 0,
|
|
41
|
+
onChange = () => null,
|
|
42
|
+
containerProps = {},
|
|
43
|
+
zoomOptions = zoomDefaultOptions
|
|
44
|
+
} = _b, otherProps = __objRest(_b, [
|
|
45
|
+
"className",
|
|
46
|
+
"disabled",
|
|
47
|
+
"value",
|
|
48
|
+
"onChange",
|
|
49
|
+
"containerProps",
|
|
50
|
+
"zoomOptions"
|
|
51
|
+
]);
|
|
52
|
+
const { cssClassName } = convertPropToCssClassName("zoom-resize", className, {
|
|
53
|
+
disabled
|
|
54
|
+
});
|
|
55
|
+
const defaultOption = zoomOptions.find((option) => option.default);
|
|
56
|
+
const [menuIsOpen, setMenuIsOpen] = useState(false);
|
|
57
|
+
const [selectedOption, setSelectedOption] = useState(defaultOption);
|
|
58
|
+
const [custom, setCustom] = useState(!value ? defaultOption : {
|
|
59
|
+
label: `${clean(value)}%`,
|
|
60
|
+
value: clean(value),
|
|
61
|
+
id: "custom"
|
|
62
|
+
});
|
|
63
|
+
const options = [custom, ...zoomOptions.filter((option) => !option.default)];
|
|
64
|
+
const currentValue = value || selectedOption?.value || custom?.value || defaultOption?.value;
|
|
65
|
+
return /* @__PURE__ */ React2.createElement("div", __spreadValues(__spreadValues({
|
|
66
|
+
className: `${cssClassName}`
|
|
67
|
+
}, containerProps), otherProps), /* @__PURE__ */ React2.createElement(DSComboBox, {
|
|
68
|
+
searchable: true,
|
|
69
|
+
disabled,
|
|
70
|
+
menuIsOpen,
|
|
71
|
+
onChange: (valueChange, { action }) => {
|
|
72
|
+
const op = options.find((option) => option.value === valueChange);
|
|
73
|
+
setSelectedOption(op);
|
|
74
|
+
onChange(op);
|
|
75
|
+
setMenuIsOpen(false);
|
|
76
|
+
if (action === "select-option") {
|
|
77
|
+
document.activeElement.blur();
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
onClickDropdownIndicator: () => setMenuIsOpen(!menuIsOpen),
|
|
81
|
+
onInputChange: (valueInput, action) => {
|
|
82
|
+
if (valueInput || action.action === "input-change") {
|
|
83
|
+
if (!valueInput) {
|
|
84
|
+
setCustom(defaultOption);
|
|
85
|
+
onChange(defaultOption);
|
|
86
|
+
} else if (!Number.isNaN(parseInt(valueInput, 10))) {
|
|
87
|
+
const cleanValue = parseInt(valueInput, 10);
|
|
88
|
+
const newOption = {
|
|
89
|
+
label: `${cleanValue}%`,
|
|
90
|
+
value: `${cleanValue}%`,
|
|
91
|
+
id: "custom"
|
|
92
|
+
};
|
|
93
|
+
setCustom(newOption);
|
|
94
|
+
onChange(newOption);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
setMenuIsOpen(false);
|
|
98
|
+
},
|
|
99
|
+
options,
|
|
100
|
+
value: currentValue
|
|
101
|
+
}));
|
|
102
|
+
};
|
|
103
|
+
const zoomProps = {
|
|
104
|
+
className: PropTypes.string.description("html class attribute"),
|
|
105
|
+
containerProps: PropTypes.object.description("Set of Properties attached to the main container"),
|
|
106
|
+
disabled: PropTypes.bool.description("disable component").defaultValue(false),
|
|
107
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).description("current value"),
|
|
108
|
+
onChange: PropTypes.func.description("function called when a new value is selected"),
|
|
109
|
+
zoomOptions: PropTypes.shape({
|
|
110
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
111
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
112
|
+
default: PropTypes.bool
|
|
113
|
+
}).description("list of options to display in the select menu")
|
|
114
|
+
};
|
|
115
|
+
DSZoom.propTypes = zoomProps;
|
|
116
|
+
const ZoomWithSchema = describe(DSZoom);
|
|
117
|
+
ZoomWithSchema.propTypes = zoomProps;
|
|
118
|
+
var DSZoom_default = DSZoom;
|
|
119
|
+
export {
|
|
120
|
+
DSZoom,
|
|
121
|
+
ZoomWithSchema,
|
|
122
|
+
DSZoom_default as default
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=DSZoom.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSZoom.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* 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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACCA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,SAAS,CAAC,OAQV;AARU,eACd;AAAA,gBAAY;AAAA,IACZ,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,WAAW,MAAM;AAAA,IACjB,iBAAiB;AAAA,IACjB,cAAc;AAAA,MANA,IAOX,uBAPW,IAOX;AAAA,IANH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,QAAM,EAAE,iBAAiB,0BAA0B,eAAe,WAAW;AAAA,IAC3E;AAAA;AAEF,QAAM,gBAAgB,YAAY,KAAK,CAAC,WAAW,OAAO;AAC1D,QAAM,CAAC,YAAY,iBAAiB,SAAS;AAC7C,QAAM,CAAC,gBAAgB,qBAAqB,SAAS;AACrD,QAAM,CAAC,QAAQ,aAAa,SAC1B,CAAC,QACG,gBACA;AAAA,IACE,OAAO,GAAG,MAAM;AAAA,IAChB,OAAO,MAAM;AAAA,IACb,IAAI;AAAA;AAGZ,QAAM,UAAU,CAAC,QAAQ,GAAG,YAAY,OAAO,CAAC,WAAW,CAAC,OAAO;AAEnE,QAAM,eAAe,SAAS,gBAAgB,SAAS,QAAQ,SAAS,eAAe;AAEvF,SACE,qCAAC,OAAD;AAAA,IAAK,WAAW,GAAG;AAAA,KAAoB,iBAAoB,aACzD,qCAAC,YAAD;AAAA,IACE,YAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,UAAU,CAAC,aAAa,EAAE,aAAa;AACrC,YAAM,KAAK,QAAQ,KAAK,CAAC,WAAW,OAAO,UAAU;AACrD,wBAAkB;AAClB,eAAS;AACT,oBAAc;AACd,UAAI,WAAW,iBAAiB;AAC9B,iBAAS,cAAc;AAAA;AAAA;AAAA,IAG3B,0BAA0B,MAAM,cAAc,CAAC;AAAA,IAC/C,eAAe,CAAC,YAAY,WAAW;AACrC,UAAI,cAAc,OAAO,WAAW,gBAAgB;AAClD,YAAI,CAAC,YAAY;AACf,oBAAU;AACV,mBAAS;AAAA,mBACA,CAAC,OAAO,MAAM,SAAS,YAAY,MAAM;AAClD,gBAAM,aAAa,SAAS,YAAY;AACxC,gBAAM,YAAY;AAAA,YAChB,OAAO,GAAG;AAAA,YACV,OAAO,GAAG;AAAA,YACV,IAAI;AAAA;AAEN,oBAAU;AACV,mBAAS;AAAA;AAAA;AAGb,oBAAc;AAAA;AAAA,IAEhB;AAAA,IACA,OAAO;AAAA;AAAA;AAMf,MAAM,YAAY;AAAA,EAChB,WAAW,UAAU,OAAO,YAAY;AAAA,EACxC,gBAAgB,UAAU,OAAO,YAAY;AAAA,EAC7C,UAAU,UAAU,KAAK,YAAY,qBAAqB,aAAa;AAAA,EACvE,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,QAAQ,UAAU,SAAS,YAAY;AAAA,EAC/F,UAAU,UAAU,KAAK,YAAY;AAAA,EACrC,aAAa,UAAU,MAAM;AAAA,IAC3B,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU;AAAA,IACxD,OAAO,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU;AAAA,IACxD,SAAS,UAAU;AAAA,KAClB,YAAY;AAAA;AAGjB,OAAO,YAAY;AAEnB,MAAM,iBAAiB,SAAS;AAChC,eAAe,YAAY;AAG3B,IAAO,iBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const getCurrentFont = () => Number(window.getComputedStyle(document.querySelector(":root")).getPropertyValue("font-size").match(/\d+/)[0]);
|
|
3
|
+
const setSize = (size) => document.querySelector(":root").setAttribute("style", `font-size: ${size}px`);
|
|
4
|
+
const getFactor = (value) => value / 100;
|
|
5
|
+
const clean = (value) => value.replace(/\D/g, "").substring(0, 3);
|
|
6
|
+
export {
|
|
7
|
+
clean,
|
|
8
|
+
getCurrentFont,
|
|
9
|
+
getFactor,
|
|
10
|
+
setSize
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/utils.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,iBAAiB,MAC5B,OACE,OACG,iBAAiB,SAAS,cAAc,UACxC,iBAAiB,aACjB,MAAM,OAAO;AAEb,MAAM,UAAU,CAAC,SACtB,SAAS,cAAc,SAAS,aAAa,SAAS,cAAc;AAE/D,MAAM,YAAY,CAAC,UAAU,QAAQ;AAErC,MAAM,QAAQ,CAAC,UAAU,MAAM,QAAQ,OAAO,IAAI,UAAU,GAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
var zoomOptions_default = [
|
|
3
|
+
{
|
|
4
|
+
label: "25%",
|
|
5
|
+
value: "25"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
label: "50%",
|
|
9
|
+
value: "50"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: "75%",
|
|
13
|
+
value: "75"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: "100%",
|
|
17
|
+
value: "100",
|
|
18
|
+
default: true
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "125%",
|
|
22
|
+
value: "125"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: "150%",
|
|
26
|
+
value: "150"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: "175%",
|
|
30
|
+
value: "175"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: "200%",
|
|
34
|
+
value: "200"
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
export {
|
|
38
|
+
zoomOptions_default as default
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=zoomOptions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/zoomOptions.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
+
"mappings": "AAAA;ACAA,IAAO,sBAAQ;AAAA,EACb;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA,IACP,SAAS;AAAA;AAAA,EAEX;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA,EAET;AAAA,IACE,OAAO;AAAA,IACP,OAAO;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSZoom';\nexport { default } from './DSZoom';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-zoom",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Zoom",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"module": "./dist/esm/index.js",
|
|
10
|
+
"main": "./dist/cjs/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
|
-
"import": "./esm/index.js",
|
|
12
|
-
"require": "./cjs/index.js"
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/cjs/index.js"
|
|
13
16
|
},
|
|
14
17
|
"./DSZoom": {
|
|
15
|
-
"import": "./esm/DSZoom.js",
|
|
16
|
-
"require": "./cjs/DSZoom.js"
|
|
18
|
+
"import": "./dist/esm/DSZoom.js",
|
|
19
|
+
"require": "./dist/cjs/DSZoom.js"
|
|
17
20
|
},
|
|
18
21
|
"./components/zoomOptions": {
|
|
19
|
-
"import": "./esm/components/zoomOptions.js",
|
|
20
|
-
"require": "./cjs/components/zoomOptions.js"
|
|
22
|
+
"import": "./dist/esm/components/zoomOptions.js",
|
|
23
|
+
"require": "./dist/cjs/components/zoomOptions.js"
|
|
21
24
|
},
|
|
22
25
|
"./components/utils": {
|
|
23
|
-
"import": "./esm/components/utils.js",
|
|
24
|
-
"require": "./cjs/components/utils.js"
|
|
26
|
+
"import": "./dist/esm/components/utils.js",
|
|
27
|
+
"require": "./dist/cjs/components/utils.js"
|
|
25
28
|
}
|
|
26
29
|
},
|
|
27
30
|
"sideEffects": [
|
|
@@ -33,23 +36,23 @@
|
|
|
33
36
|
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
34
37
|
},
|
|
35
38
|
"engines": {
|
|
36
|
-
"
|
|
37
|
-
"node": ">=
|
|
39
|
+
"pnpm": ">=6",
|
|
40
|
+
"node": ">=16"
|
|
38
41
|
},
|
|
39
42
|
"author": "ICE MT",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
43
|
+
"jestSonar": {
|
|
44
|
+
"sonar56x": true,
|
|
45
|
+
"reportPath": "reports",
|
|
46
|
+
"reportFile": "tests.xml",
|
|
47
|
+
"indent": 4
|
|
45
48
|
},
|
|
46
49
|
"dependencies": {
|
|
47
|
-
"@elliemae/ds-classnames": "3.0.0-next.
|
|
48
|
-
"@elliemae/ds-form": "3.0.0-next.
|
|
50
|
+
"@elliemae/ds-classnames": "3.0.0-next.3",
|
|
51
|
+
"@elliemae/ds-form": "3.0.0-next.3",
|
|
49
52
|
"react-desc": "~4.1.3"
|
|
50
53
|
},
|
|
51
54
|
"devDependencies": {
|
|
52
|
-
"@testing-library/jest-dom": "~5.15.
|
|
55
|
+
"@testing-library/jest-dom": "~5.15.1",
|
|
53
56
|
"@testing-library/react": "~12.1.2"
|
|
54
57
|
},
|
|
55
58
|
"peerDependencies": {
|
|
@@ -58,7 +61,13 @@
|
|
|
58
61
|
},
|
|
59
62
|
"publishConfig": {
|
|
60
63
|
"access": "public",
|
|
61
|
-
"
|
|
62
|
-
|
|
64
|
+
"typeSafety": false
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
68
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
69
|
+
"lint": "node ../../scripts/lint.mjs",
|
|
70
|
+
"dts": "node ../../scripts/dts.mjs",
|
|
71
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
|
|
63
72
|
}
|
|
64
73
|
}
|
package/cjs/DSZoom.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
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');
|
|
17
|
-
var reactDesc = require('react-desc');
|
|
18
|
-
var dsClassnames = require('@elliemae/ds-classnames');
|
|
19
|
-
var dsForm = require('@elliemae/ds-form');
|
|
20
|
-
var zoomOptions = require('./components/zoomOptions.js');
|
|
21
|
-
var utils = require('./components/utils.js');
|
|
22
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
23
|
-
|
|
24
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
|
-
|
|
26
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
27
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
28
|
-
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
29
|
-
|
|
30
|
-
const _excluded = ["className", "disabled", "value", "onChange", "containerProps", "zoomOptions"];
|
|
31
|
-
|
|
32
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
33
|
-
|
|
34
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
|
-
|
|
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);
|
|
46
|
-
|
|
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),
|
|
58
|
-
id: 'custom'
|
|
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({
|
|
63
|
-
className: "".concat(cssClassName)
|
|
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
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
setMenuIsOpen(false);
|
|
101
|
-
},
|
|
102
|
-
options: options,
|
|
103
|
-
value: currentValue
|
|
104
|
-
})
|
|
105
|
-
}));
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const zoomProps = {
|
|
109
|
-
className: reactDesc.PropTypes.string.description('html class attribute'),
|
|
110
|
-
containerProps: reactDesc.PropTypes.object.description('Set of Properties attached to the main container'),
|
|
111
|
-
disabled: reactDesc.PropTypes.bool.description('disable component').defaultValue(false),
|
|
112
|
-
value: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number, reactDesc.PropTypes.object]).description('current value'),
|
|
113
|
-
onChange: reactDesc.PropTypes.func.description('function called when a new value is selected'),
|
|
114
|
-
zoomOptions: reactDesc.PropTypes.shape({
|
|
115
|
-
label: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number]),
|
|
116
|
-
value: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number]),
|
|
117
|
-
default: reactDesc.PropTypes.bool
|
|
118
|
-
}).description('list of options to display in the select menu')
|
|
119
|
-
};
|
|
120
|
-
const ZoomWithSchema = reactDesc.describe(DSZoom);
|
|
121
|
-
ZoomWithSchema.propTypes = zoomProps;
|
|
122
|
-
|
|
123
|
-
exports.DSZoom = DSZoom;
|
|
124
|
-
exports.ZoomWithSchema = ZoomWithSchema;
|
|
125
|
-
exports["default"] = DSZoom;
|
package/cjs/components/utils.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
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);
|
|
11
|
-
|
|
12
|
-
exports.clean = clean;
|
|
13
|
-
exports.getCurrentFont = getCurrentFont;
|
|
14
|
-
exports.getFactor = getFactor;
|
|
15
|
-
exports.setSize = setSize;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var zoomDefaultOptions = [{
|
|
4
|
-
label: '25%',
|
|
5
|
-
value: '25'
|
|
6
|
-
}, {
|
|
7
|
-
label: '50%',
|
|
8
|
-
value: '50'
|
|
9
|
-
}, {
|
|
10
|
-
label: '75%',
|
|
11
|
-
value: '75'
|
|
12
|
-
}, {
|
|
13
|
-
label: '100%',
|
|
14
|
-
value: '100',
|
|
15
|
-
default: true
|
|
16
|
-
}, {
|
|
17
|
-
label: '125%',
|
|
18
|
-
value: '125'
|
|
19
|
-
}, {
|
|
20
|
-
label: '150%',
|
|
21
|
-
value: '150'
|
|
22
|
-
}, {
|
|
23
|
-
label: '175%',
|
|
24
|
-
value: '175'
|
|
25
|
-
}, {
|
|
26
|
-
label: '200%',
|
|
27
|
-
value: '200'
|
|
28
|
-
}];
|
|
29
|
-
|
|
30
|
-
module.exports = zoomDefaultOptions;
|
package/cjs/index.js
DELETED
package/esm/DSZoom.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
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';
|
|
13
|
-
import { PropTypes, describe } from 'react-desc';
|
|
14
|
-
import { convertPropToCssClassName } from '@elliemae/ds-classnames';
|
|
15
|
-
import { DSComboBox } from '@elliemae/ds-form';
|
|
16
|
-
import zoomDefaultOptions from './components/zoomOptions.js';
|
|
17
|
-
import { clean } from './components/utils.js';
|
|
18
|
-
import { jsx } from 'react/jsx-runtime';
|
|
19
|
-
|
|
20
|
-
const _excluded = ["className", "disabled", "value", "onChange", "containerProps", "zoomOptions"];
|
|
21
|
-
|
|
22
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
-
|
|
24
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
-
|
|
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);
|
|
36
|
-
|
|
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 : {
|
|
46
|
-
label: "".concat(clean(value), "%"),
|
|
47
|
-
value: clean(value),
|
|
48
|
-
id: 'custom'
|
|
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({
|
|
53
|
-
className: "".concat(cssClassName)
|
|
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
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
setMenuIsOpen(false);
|
|
91
|
-
},
|
|
92
|
-
options: options,
|
|
93
|
-
value: currentValue
|
|
94
|
-
})
|
|
95
|
-
}));
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const zoomProps = {
|
|
99
|
-
className: PropTypes.string.description('html class attribute'),
|
|
100
|
-
containerProps: PropTypes.object.description('Set of Properties attached to the main container'),
|
|
101
|
-
disabled: PropTypes.bool.description('disable component').defaultValue(false),
|
|
102
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).description('current value'),
|
|
103
|
-
onChange: PropTypes.func.description('function called when a new value is selected'),
|
|
104
|
-
zoomOptions: PropTypes.shape({
|
|
105
|
-
label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
106
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
107
|
-
default: PropTypes.bool
|
|
108
|
-
}).description('list of options to display in the select menu')
|
|
109
|
-
};
|
|
110
|
-
const ZoomWithSchema = describe(DSZoom);
|
|
111
|
-
ZoomWithSchema.propTypes = zoomProps;
|
|
112
|
-
|
|
113
|
-
export { DSZoom, ZoomWithSchema, DSZoom as default };
|
package/esm/components/utils.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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);
|
|
7
|
-
|
|
8
|
-
export { clean, getCurrentFont, getFactor, setSize };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
var zoomDefaultOptions = [{
|
|
2
|
-
label: '25%',
|
|
3
|
-
value: '25'
|
|
4
|
-
}, {
|
|
5
|
-
label: '50%',
|
|
6
|
-
value: '50'
|
|
7
|
-
}, {
|
|
8
|
-
label: '75%',
|
|
9
|
-
value: '75'
|
|
10
|
-
}, {
|
|
11
|
-
label: '100%',
|
|
12
|
-
value: '100',
|
|
13
|
-
default: true
|
|
14
|
-
}, {
|
|
15
|
-
label: '125%',
|
|
16
|
-
value: '125'
|
|
17
|
-
}, {
|
|
18
|
-
label: '150%',
|
|
19
|
-
value: '150'
|
|
20
|
-
}, {
|
|
21
|
-
label: '175%',
|
|
22
|
-
value: '175'
|
|
23
|
-
}, {
|
|
24
|
-
label: '200%',
|
|
25
|
-
value: '200'
|
|
26
|
-
}];
|
|
27
|
-
|
|
28
|
-
export { zoomDefaultOptions as default };
|
package/esm/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { DSZoom, ZoomWithSchema, DSZoom as default } from './DSZoom.js';
|
package/types/DSZoom.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
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(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
24
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
25
|
-
};
|
|
26
|
-
isRequired: import("react-desc").PropTypesDescValue;
|
|
27
|
-
};
|
|
28
|
-
containerProps: {
|
|
29
|
-
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
30
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
31
|
-
};
|
|
32
|
-
isRequired: import("react-desc").PropTypesDescValue;
|
|
33
|
-
};
|
|
34
|
-
disabled: {
|
|
35
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
36
|
-
};
|
|
37
|
-
value: {
|
|
38
|
-
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
39
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
40
|
-
};
|
|
41
|
-
isRequired: import("react-desc").PropTypesDescValue;
|
|
42
|
-
};
|
|
43
|
-
onChange: {
|
|
44
|
-
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
45
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
46
|
-
};
|
|
47
|
-
isRequired: import("react-desc").PropTypesDescValue;
|
|
48
|
-
};
|
|
49
|
-
zoomOptions: {
|
|
50
|
-
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
51
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
52
|
-
};
|
|
53
|
-
isRequired: import("react-desc").PropTypesDescValue;
|
|
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
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|