siam-ui-utils 3.0.28 → 3.0.30
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/CustomBootstrap.js +9 -9
- package/dist/_virtual/_commonjsHelpers.js +7 -7
- package/dist/_virtual/events.js +6 -6
- package/dist/_virtual/events2.js +5 -5
- package/dist/_virtual/index.js +8 -8
- package/dist/_virtual/index2.js +5 -5
- package/dist/_virtual/react-dropzone.js +8 -8
- package/dist/_virtual/react-dropzone2.js +5 -5
- package/dist/assets/img/copiar.png.js +5 -5
- package/dist/assets/img/take-photo.jpg.js +5 -5
- package/dist/constants.js +9 -9
- package/dist/copy-link/index.js +60 -60
- package/dist/copy-link/styles.css +37 -37
- package/dist/custom-input/CustomInputCheckbox.js +36 -36
- package/dist/custom-input/CustomInputCurrency.js +85 -85
- package/dist/custom-input/CustomInputFile.js +46 -46
- package/dist/custom-input/CustomInputRadio.js +67 -67
- package/dist/custom-input/constant.js +5 -5
- package/dist/custom-input/index.js +12 -14
- package/dist/custom-input/index.js.map +1 -1
- package/dist/drag-and-dropzone/config.js +59 -59
- package/dist/drag-and-dropzone/index.js +39 -39
- package/dist/dropzone/Input.js +77 -77
- package/dist/dropzone/Layout.js +50 -50
- package/dist/dropzone/Preview.js +117 -117
- package/dist/dropzone/SubmitButton.js +34 -34
- package/dist/dropzone/assets/cancel.svg.js +5 -5
- package/dist/dropzone/assets/remove.svg.js +5 -5
- package/dist/dropzone/assets/restart.svg.js +5 -5
- package/dist/dropzone/index.js +514 -514
- package/dist/dropzone/utils.js +93 -93
- package/dist/dropzone-uploader/base/index.js +135 -135
- package/dist/dropzone-uploader/index.js +7 -7
- package/dist/dropzone-uploader/styled/index.js +149 -149
- package/dist/iconos/constants-svg.js +666 -666
- package/dist/iconos/icon-button-svg.js +50 -50
- package/dist/iconos/index.js +24 -24
- package/dist/iconos/styled-icon.js +26 -26
- package/dist/index.js +4 -4
- package/dist/intl-messages/index.js +11 -11
- package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +8 -8
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +13 -13
- package/dist/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +8 -8
- package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +13 -13
- package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +9 -9
- package/dist/node_modules/classnames/index.js +62 -62
- package/dist/node_modules/dom-helpers/esm/addClass.js +10 -10
- package/dist/node_modules/dom-helpers/esm/hasClass.js +8 -8
- package/dist/node_modules/dom-helpers/esm/removeClass.js +16 -16
- package/dist/node_modules/events/events.js +372 -372
- package/dist/node_modules/react-dropzone-component/dist/react-dropzone.js +1023 -1023
- package/dist/node_modules/react-multi-select-component/dist/esm/index.js +178 -178
- package/dist/node_modules/react-transition-group/esm/CSSTransition.js +275 -275
- package/dist/node_modules/react-transition-group/esm/Transition.js +441 -441
- package/dist/node_modules/react-transition-group/esm/TransitionGroup.js +146 -146
- package/dist/node_modules/react-transition-group/esm/TransitionGroupContext.js +6 -6
- package/dist/node_modules/react-transition-group/esm/config.js +7 -7
- package/dist/node_modules/react-transition-group/esm/utils/ChildMapping.js +100 -100
- package/dist/node_modules/react-transition-group/esm/utils/PropTypes.js +24 -24
- package/dist/node_modules/react-transition-group/esm/utils/reflow.js +7 -7
- package/dist/react-notifications/Notification.js +73 -73
- package/dist/react-notifications/NotificationContainer.js +59 -59
- package/dist/react-notifications/NotificationManager.js +174 -174
- package/dist/react-notifications/Notifications.js +72 -72
- package/dist/react-notifications/constants.js +26 -26
- package/dist/react-notifications/index.js +11 -11
- package/dist/select/custom-select/constants.js +8 -8
- package/dist/select/custom-select/index.js +90 -90
- package/dist/select/custom-select-input/index.js +12 -12
- package/dist/select/index.js +9 -9
- package/dist/select/multi-select/badge-label-multi-select.js +29 -29
- package/dist/select/multi-select/index.css +23 -23
- package/dist/select/multi-select/index.js +63 -63
- package/dist/select/multi-select/styled-component.js +24 -24
- package/dist/timer/index.js +60 -60
- package/dist/timer/styles.css +58 -58
- package/dist/tomar-foto/index.js +62 -62
- package/dist/view-layout/button-editor.js +14 -14
- package/dist/view-layout/constants.js +11 -11
- package/dist/view-layout/editor-layer.js +28 -28
- package/dist/view-layout/index.js +53 -53
- package/dist/view-layout/slot-wrapper.js +39 -39
- package/dist/view-layout/styles.css +126 -126
- package/dist/where-by-room/index.js +20 -20
- package/dist/where-by-room/room.js +78 -78
- package/package.json +1 -1
- package/dist/_virtual/browser.js +0 -8
- package/dist/_virtual/browser.js.map +0 -1
- package/dist/_virtual/warning.js +0 -8
- package/dist/_virtual/warning.js.map +0 -1
- package/dist/custom-input/customInputMask/children-wrapper.js +0 -12
- package/dist/custom-input/customInputMask/children-wrapper.js.map +0 -1
- package/dist/custom-input/customInputMask/constants.js +0 -19
- package/dist/custom-input/customInputMask/constants.js.map +0 -1
- package/dist/custom-input/customInputMask/hooks.js +0 -159
- package/dist/custom-input/customInputMask/hooks.js.map +0 -1
- package/dist/custom-input/customInputMask/index.js +0 -184
- package/dist/custom-input/customInputMask/index.js.map +0 -1
- package/dist/custom-input/customInputMask/utils/defer.js +0 -11
- package/dist/custom-input/customInputMask/utils/defer.js.map +0 -1
- package/dist/custom-input/customInputMask/utils/helpers.js +0 -42
- package/dist/custom-input/customInputMask/utils/helpers.js.map +0 -1
- package/dist/custom-input/customInputMask/utils/input.js +0 -25
- package/dist/custom-input/customInputMask/utils/input.js.map +0 -1
- package/dist/custom-input/customInputMask/utils/mask.js +0 -220
- package/dist/custom-input/customInputMask/utils/mask.js.map +0 -1
- package/dist/custom-input/customInputMask/utils/parse-mask.js +0 -72
- package/dist/custom-input/customInputMask/utils/parse-mask.js.map +0 -1
- package/dist/custom-input/customInputMask/validate-props.js +0 -35
- package/dist/custom-input/customInputMask/validate-props.js.map +0 -1
- package/dist/node_modules/invariant/browser.js +0 -39
- package/dist/node_modules/invariant/browser.js.map +0 -1
- package/dist/node_modules/warning/warning.js +0 -51
- package/dist/node_modules/warning/warning.js.map +0 -1
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
|
-
const ChildrenWrapper = forwardRef((props, ref) => {
|
|
3
|
-
const child = React.Children.only(props.children);
|
|
4
|
-
return React.cloneElement(child, {
|
|
5
|
-
...props,
|
|
6
|
-
ref
|
|
7
|
-
});
|
|
8
|
-
});
|
|
9
|
-
export {
|
|
10
|
-
ChildrenWrapper as default
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=children-wrapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"children-wrapper.js","sources":["../../../src/custom-input/customInputMask/children-wrapper.js"],"sourcesContent":["import React, { forwardRef } from \"react\";\r\n\r\nconst ChildrenWrapper = forwardRef((props, ref) => {\r\n const child = React.Children.only(props.children);\r\n\r\n return React.cloneElement(child, {\r\n ...props,\r\n ref\r\n });\r\n});\r\n\r\nexport default ChildrenWrapper;\r\n"],"names":[],"mappings":";AAEK,MAAC,kBAAkB,WAAW,CAAC,OAAO,QAAQ;AACjD,QAAM,QAAQ,MAAM,SAAS,KAAK,MAAM,QAAQ;AAEhD,SAAO,MAAM,aAAa,OAAO;AAAA,IAC/B,GAAG;AAAA,IACH;AAAA,EACJ,CAAG;AACH,CAAC;"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const CONTROLLED_PROPS = [
|
|
2
|
-
"disabled",
|
|
3
|
-
"onBlur",
|
|
4
|
-
"onChange",
|
|
5
|
-
"onFocus",
|
|
6
|
-
"onMouseDown",
|
|
7
|
-
"readOnly",
|
|
8
|
-
"value"
|
|
9
|
-
];
|
|
10
|
-
const defaultFormatChars = {
|
|
11
|
-
"9": /[0-9]/,
|
|
12
|
-
a: /[A-Za-z]/,
|
|
13
|
-
"*": /[A-Za-z0-9]/
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
CONTROLLED_PROPS,
|
|
17
|
-
defaultFormatChars
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../src/custom-input/customInputMask/constants.js"],"sourcesContent":["export const CONTROLLED_PROPS = [\r\n \"disabled\",\r\n \"onBlur\",\r\n \"onChange\",\r\n \"onFocus\",\r\n \"onMouseDown\",\r\n \"readOnly\",\r\n \"value\"\r\n];\r\n\r\nexport const defaultFormatChars = {\r\n \"9\": /[0-9]/,\r\n a: /[A-Za-z]/,\r\n \"*\": /[A-Za-z0-9]/\r\n};\r\n"],"names":[],"mappings":"AAAY,MAAC,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEY,MAAC,qBAAqB;AAAA,EAChC,KAAK;AAAA,EACL,GAAG;AAAA,EACH,KAAK;AACP;"}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { useRef, useEffect, useCallback, useLayoutEffect } from "react";
|
|
2
|
-
import { cancelDefer, defer } from "./utils/defer.js";
|
|
3
|
-
import { getInputSelection, isInputFocused, setInputSelection } from "./utils/input.js";
|
|
4
|
-
import { isDOMElement } from "./utils/helpers.js";
|
|
5
|
-
function useInputElement(inputRef) {
|
|
6
|
-
return useCallback(() => {
|
|
7
|
-
let input = inputRef.current;
|
|
8
|
-
const isDOMNode = typeof window !== "undefined" && isDOMElement(input);
|
|
9
|
-
if (!input || !isDOMNode) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
if (input.nodeName !== "INPUT") {
|
|
13
|
-
input = input.querySelector("input");
|
|
14
|
-
}
|
|
15
|
-
if (!input) {
|
|
16
|
-
throw new Error(
|
|
17
|
-
"react-input-mask: inputComponent doesn't contain input node"
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
return input;
|
|
21
|
-
}, [inputRef]);
|
|
22
|
-
}
|
|
23
|
-
function useDeferLoop(callback) {
|
|
24
|
-
const deferIdRef = useRef(null);
|
|
25
|
-
const runLoop = useCallback(() => {
|
|
26
|
-
if (deferIdRef.current !== null) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
function loop() {
|
|
30
|
-
callback();
|
|
31
|
-
deferIdRef.current = defer(loop);
|
|
32
|
-
}
|
|
33
|
-
loop();
|
|
34
|
-
}, [callback]);
|
|
35
|
-
const stopLoop = useCallback(() => {
|
|
36
|
-
cancelDefer(deferIdRef.current);
|
|
37
|
-
deferIdRef.current = null;
|
|
38
|
-
}, []);
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (deferIdRef.current) {
|
|
41
|
-
stopLoop();
|
|
42
|
-
runLoop();
|
|
43
|
-
}
|
|
44
|
-
}, [runLoop, stopLoop]);
|
|
45
|
-
useEffect(cancelDefer, []);
|
|
46
|
-
return [runLoop, stopLoop];
|
|
47
|
-
}
|
|
48
|
-
function useSelection(inputRef, isMasked) {
|
|
49
|
-
const selectionRef = useRef({ start: null, end: null });
|
|
50
|
-
const getInputElement = useInputElement(inputRef);
|
|
51
|
-
const getSelection = useCallback(() => {
|
|
52
|
-
const input = getInputElement();
|
|
53
|
-
return getInputSelection(input);
|
|
54
|
-
}, [getInputElement]);
|
|
55
|
-
const getLastSelection = useCallback(() => {
|
|
56
|
-
return selectionRef.current;
|
|
57
|
-
}, []);
|
|
58
|
-
const setSelection = useCallback(
|
|
59
|
-
(selection) => {
|
|
60
|
-
const input = getInputElement();
|
|
61
|
-
if (!input || !isInputFocused(input)) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
setInputSelection(input, selection.start, selection.end);
|
|
65
|
-
selectionRef.current = getSelection();
|
|
66
|
-
},
|
|
67
|
-
[getInputElement, getSelection]
|
|
68
|
-
);
|
|
69
|
-
const selectionLoop = useCallback(() => {
|
|
70
|
-
selectionRef.current = getSelection();
|
|
71
|
-
}, [getSelection]);
|
|
72
|
-
const [runSelectionLoop, stopSelectionLoop] = useDeferLoop(selectionLoop);
|
|
73
|
-
useLayoutEffect(() => {
|
|
74
|
-
if (!isMasked) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const input = getInputElement();
|
|
78
|
-
input.addEventListener("focus", runSelectionLoop);
|
|
79
|
-
input.addEventListener("blur", stopSelectionLoop);
|
|
80
|
-
if (isInputFocused(input)) {
|
|
81
|
-
runSelectionLoop();
|
|
82
|
-
}
|
|
83
|
-
return () => {
|
|
84
|
-
input.removeEventListener("focus", runSelectionLoop);
|
|
85
|
-
input.removeEventListener("blur", stopSelectionLoop);
|
|
86
|
-
stopSelectionLoop();
|
|
87
|
-
};
|
|
88
|
-
});
|
|
89
|
-
return { getSelection, getLastSelection, setSelection };
|
|
90
|
-
}
|
|
91
|
-
function useValue(inputRef, initialValue) {
|
|
92
|
-
const getInputElement = useInputElement(inputRef);
|
|
93
|
-
const valueRef = useRef(initialValue);
|
|
94
|
-
const getValue = useCallback(() => {
|
|
95
|
-
const input = getInputElement();
|
|
96
|
-
return input.value;
|
|
97
|
-
}, [getInputElement]);
|
|
98
|
-
const getLastValue = useCallback(() => {
|
|
99
|
-
return valueRef.current;
|
|
100
|
-
}, []);
|
|
101
|
-
const setValue = useCallback(
|
|
102
|
-
(newValue) => {
|
|
103
|
-
valueRef.current = newValue;
|
|
104
|
-
const input = getInputElement();
|
|
105
|
-
if (input) {
|
|
106
|
-
input.value = newValue;
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
[getInputElement]
|
|
110
|
-
);
|
|
111
|
-
return {
|
|
112
|
-
getValue,
|
|
113
|
-
getLastValue,
|
|
114
|
-
setValue
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function useInputState(initialValue, isMasked) {
|
|
118
|
-
const inputRef = useRef();
|
|
119
|
-
const { getSelection, getLastSelection, setSelection } = useSelection(
|
|
120
|
-
inputRef,
|
|
121
|
-
isMasked
|
|
122
|
-
);
|
|
123
|
-
const { getValue, getLastValue, setValue } = useValue(inputRef, initialValue);
|
|
124
|
-
function getLastInputState() {
|
|
125
|
-
return {
|
|
126
|
-
value: getLastValue(),
|
|
127
|
-
selection: getLastSelection()
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
function getInputState() {
|
|
131
|
-
return {
|
|
132
|
-
value: getValue(),
|
|
133
|
-
selection: getSelection()
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
function setInputState({ value, selection }) {
|
|
137
|
-
setValue(value);
|
|
138
|
-
setSelection(selection);
|
|
139
|
-
}
|
|
140
|
-
return {
|
|
141
|
-
inputRef,
|
|
142
|
-
getInputState,
|
|
143
|
-
getLastInputState,
|
|
144
|
-
setInputState
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
function usePrevious(value) {
|
|
148
|
-
const ref = useRef();
|
|
149
|
-
useEffect(() => {
|
|
150
|
-
ref.current = value;
|
|
151
|
-
});
|
|
152
|
-
return ref.current;
|
|
153
|
-
}
|
|
154
|
-
export {
|
|
155
|
-
useInputElement,
|
|
156
|
-
useInputState,
|
|
157
|
-
usePrevious
|
|
158
|
-
};
|
|
159
|
-
//# sourceMappingURL=hooks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sources":["../../../src/custom-input/customInputMask/hooks.js"],"sourcesContent":["import { useCallback, useEffect, useLayoutEffect, useRef } from \"react\";\r\n\r\nimport { defer, cancelDefer } from \"./utils/defer\";\r\nimport {\r\n setInputSelection,\r\n getInputSelection,\r\n isInputFocused\r\n} from \"./utils/input\";\r\nimport { isDOMElement } from \"./utils/helpers\";\r\n\r\nexport function useInputElement(inputRef) {\r\n return useCallback(() => {\r\n let input = inputRef.current;\r\n const isDOMNode = typeof window !== \"undefined\" && isDOMElement(input);\r\n\r\n // workaround for react-test-renderer\r\n // https://github.com/sanniassin/react-input-mask/issues/147\r\n if (!input || !isDOMNode) {\r\n return null;\r\n }\r\n\r\n if (input.nodeName !== \"INPUT\") {\r\n input = input.querySelector(\"input\");\r\n }\r\n\r\n if (!input) {\r\n throw new Error(\r\n \"react-input-mask: inputComponent doesn't contain input node\"\r\n );\r\n }\r\n\r\n return input;\r\n }, [inputRef]);\r\n}\r\n\r\nfunction useDeferLoop(callback) {\r\n const deferIdRef = useRef(null);\r\n\r\n const runLoop = useCallback(() => {\r\n // If there are simulated focus events, runLoop could be\r\n // called multiple times without blur or re-render\r\n if (deferIdRef.current !== null) {\r\n return;\r\n }\r\n\r\n function loop() {\r\n callback();\r\n deferIdRef.current = defer(loop);\r\n }\r\n\r\n loop();\r\n }, [callback]);\r\n\r\n const stopLoop = useCallback(() => {\r\n cancelDefer(deferIdRef.current);\r\n deferIdRef.current = null;\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (deferIdRef.current) {\r\n stopLoop();\r\n runLoop();\r\n }\r\n }, [runLoop, stopLoop]);\r\n\r\n useEffect(cancelDefer, []);\r\n\r\n return [runLoop, stopLoop];\r\n}\r\n\r\nfunction useSelection(inputRef, isMasked) {\r\n const selectionRef = useRef({ start: null, end: null });\r\n const getInputElement = useInputElement(inputRef);\r\n\r\n const getSelection = useCallback(() => {\r\n const input = getInputElement();\r\n return getInputSelection(input);\r\n }, [getInputElement]);\r\n\r\n const getLastSelection = useCallback(() => {\r\n return selectionRef.current;\r\n }, []);\r\n\r\n const setSelection = useCallback(\r\n selection => {\r\n const input = getInputElement();\r\n\r\n // Don't change selection on unfocused input\r\n // because Safari sets focus on selection change (#154)\r\n if (!input || !isInputFocused(input)) {\r\n return;\r\n }\r\n\r\n setInputSelection(input, selection.start, selection.end);\r\n\r\n // Use actual selection in case the requested one was out of range\r\n selectionRef.current = getSelection();\r\n },\r\n [getInputElement, getSelection]\r\n );\r\n\r\n const selectionLoop = useCallback(() => {\r\n selectionRef.current = getSelection();\r\n }, [getSelection]);\r\n const [runSelectionLoop, stopSelectionLoop] = useDeferLoop(selectionLoop);\r\n\r\n useLayoutEffect(() => {\r\n if (!isMasked) {\r\n return;\r\n }\r\n\r\n const input = getInputElement();\r\n input.addEventListener(\"focus\", runSelectionLoop);\r\n input.addEventListener(\"blur\", stopSelectionLoop);\r\n\r\n if (isInputFocused(input)) {\r\n runSelectionLoop();\r\n }\r\n\r\n return () => {\r\n input.removeEventListener(\"focus\", runSelectionLoop);\r\n input.removeEventListener(\"blur\", stopSelectionLoop);\r\n\r\n stopSelectionLoop();\r\n };\r\n });\r\n\r\n return { getSelection, getLastSelection, setSelection };\r\n}\r\n\r\nfunction useValue(inputRef, initialValue) {\r\n const getInputElement = useInputElement(inputRef);\r\n const valueRef = useRef(initialValue);\r\n\r\n const getValue = useCallback(() => {\r\n const input = getInputElement();\r\n return input.value;\r\n }, [getInputElement]);\r\n\r\n const getLastValue = useCallback(() => {\r\n return valueRef.current;\r\n }, []);\r\n\r\n const setValue = useCallback(\r\n newValue => {\r\n valueRef.current = newValue;\r\n\r\n const input = getInputElement();\r\n if (input) {\r\n input.value = newValue;\r\n }\r\n },\r\n [getInputElement]\r\n );\r\n\r\n return {\r\n getValue,\r\n getLastValue,\r\n setValue\r\n };\r\n}\r\n\r\nexport function useInputState(initialValue, isMasked) {\r\n const inputRef = useRef();\r\n const { getSelection, getLastSelection, setSelection } = useSelection(\r\n inputRef,\r\n isMasked\r\n );\r\n const { getValue, getLastValue, setValue } = useValue(inputRef, initialValue);\r\n\r\n function getLastInputState() {\r\n return {\r\n value: getLastValue(),\r\n selection: getLastSelection()\r\n };\r\n }\r\n\r\n function getInputState() {\r\n return {\r\n value: getValue(),\r\n selection: getSelection()\r\n };\r\n }\r\n\r\n function setInputState({ value, selection }) {\r\n setValue(value);\r\n setSelection(selection);\r\n }\r\n\r\n return {\r\n inputRef,\r\n getInputState,\r\n getLastInputState,\r\n setInputState\r\n };\r\n}\r\n\r\nexport function usePrevious(value) {\r\n const ref = useRef();\r\n useEffect(() => {\r\n ref.current = value;\r\n });\r\n return ref.current;\r\n}"],"names":[],"mappings":";;;;AAUO,SAAS,gBAAgB,UAAU;AACtC,SAAO,YAAY,MA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QAAM,EAAE,cAAc,kBAAkB,aAAY,IAAK;AAAA,IACrD;AAAA,IACA;AAAA,EACR;AACI,QAAM,EAAE,UAAU,cAAc,SAAQ,IAAK,SAAS,UAAU,YAAY;AAE5E,WAAS,oBAAoB;AACzB,WAAO;AAAA,MACH,OAAO,aAAY;AAAA,MACnB,WAAW,iBAAgB;AAAA,IACvC;AAAA,EACI;AAEA,WAAS,gBAAgB;AACrB,WAAO;AAAA,MACH,OAAO,SAAQ;AAAA,MACf,WAAW,aAAY;AAAA,IACnC;AAAA,EACI;AAEA,WAAS,cAAc,EAAE,OAAO,aAAa;AACzC,aAAS,KAAK;AACd,iBAAa,SAAS;AAAA,EAC1B;AAEA,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACR;AACA;AAEO,SAAS,YAAY,OAAO;AAC/B,QAAM,MAAM;AACZ,YAAU,MAAM;AACZ,QAAI,UAAU;AAAA,EAClB,CAAC;AACD,SAAO,IAAI;AACf;"}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useLayoutEffect } from "react";
|
|
3
|
-
import { usePrevious, useInputState, useInputElement } from "./hooks.js";
|
|
4
|
-
import { validateMaxLength, validateMaskPlaceholder, validateChildren } from "./validate-props.js";
|
|
5
|
-
import { defer } from "./utils/defer.js";
|
|
6
|
-
import { isInputFocused } from "./utils/input.js";
|
|
7
|
-
import { toString, getElementDocument, isFunction } from "./utils/helpers.js";
|
|
8
|
-
import MaskUtils from "./utils/mask.js";
|
|
9
|
-
import ChildrenWrapper from "./children-wrapper.js";
|
|
10
|
-
const CustomInputMask = forwardRef(function CustomInputMask2(props, forwardedRef) {
|
|
11
|
-
const {
|
|
12
|
-
alwaysShowMask,
|
|
13
|
-
children,
|
|
14
|
-
mask,
|
|
15
|
-
maskPlaceholder,
|
|
16
|
-
beforeMaskedStateChange,
|
|
17
|
-
...restProps
|
|
18
|
-
} = props;
|
|
19
|
-
validateMaxLength(props);
|
|
20
|
-
validateMaskPlaceholder(props);
|
|
21
|
-
const maskUtils = new MaskUtils({ mask, maskPlaceholder });
|
|
22
|
-
const isMasked = !!mask;
|
|
23
|
-
const isEditable = !restProps.disabled && !restProps.readOnly;
|
|
24
|
-
const isControlled = props.value !== null && props.value !== void 0;
|
|
25
|
-
const previousIsMasked = usePrevious(isMasked);
|
|
26
|
-
const initialValue = toString(
|
|
27
|
-
(isControlled ? props.value : props.defaultValue) || ""
|
|
28
|
-
);
|
|
29
|
-
const {
|
|
30
|
-
inputRef,
|
|
31
|
-
getInputState,
|
|
32
|
-
setInputState,
|
|
33
|
-
getLastInputState
|
|
34
|
-
} = useInputState(initialValue, isMasked);
|
|
35
|
-
const getInputElement = useInputElement(inputRef);
|
|
36
|
-
function onChange(event) {
|
|
37
|
-
const currentState = getInputState();
|
|
38
|
-
const previousState = getLastInputState();
|
|
39
|
-
let newInputState = maskUtils.processChange(currentState, previousState);
|
|
40
|
-
if (beforeMaskedStateChange) {
|
|
41
|
-
newInputState = beforeMaskedStateChange({
|
|
42
|
-
currentState,
|
|
43
|
-
previousState,
|
|
44
|
-
nextState: newInputState
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
setInputState(newInputState);
|
|
48
|
-
props.onChange?.(event);
|
|
49
|
-
}
|
|
50
|
-
function onFocus(event) {
|
|
51
|
-
inputRef.current = event.target;
|
|
52
|
-
const currentValue = getInputState().value;
|
|
53
|
-
if (isMasked && !maskUtils.isValueFilled(currentValue)) {
|
|
54
|
-
let newValue = maskUtils.formatValue(currentValue);
|
|
55
|
-
let newSelection = maskUtils.getDefaultSelectionForValue(newValue);
|
|
56
|
-
let newInputState = { value: newValue, selection: newSelection };
|
|
57
|
-
if (beforeMaskedStateChange) {
|
|
58
|
-
newInputState = beforeMaskedStateChange({
|
|
59
|
-
currentState: getInputState(),
|
|
60
|
-
nextState: newInputState
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
setInputState(newInputState);
|
|
64
|
-
if (newValue !== currentValue) {
|
|
65
|
-
props.onChange?.(event);
|
|
66
|
-
}
|
|
67
|
-
defer(() => {
|
|
68
|
-
setInputState(getLastInputState());
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
props.onFocus?.(event);
|
|
72
|
-
}
|
|
73
|
-
function onBlur(event) {
|
|
74
|
-
const currentValue = getInputState().value;
|
|
75
|
-
const lastValue = getLastInputState().value;
|
|
76
|
-
if (isMasked && !alwaysShowMask && maskUtils.isValueEmpty(lastValue)) {
|
|
77
|
-
let newInputState = {
|
|
78
|
-
value: "",
|
|
79
|
-
selection: { start: null, end: null }
|
|
80
|
-
};
|
|
81
|
-
if (beforeMaskedStateChange) {
|
|
82
|
-
newInputState = beforeMaskedStateChange({
|
|
83
|
-
currentState: getInputState(),
|
|
84
|
-
nextState: newInputState
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
setInputState(newInputState);
|
|
88
|
-
if (newInputState.value !== currentValue) {
|
|
89
|
-
props.onChange?.(event);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
props.onBlur?.(event);
|
|
93
|
-
}
|
|
94
|
-
function onMouseDown(event) {
|
|
95
|
-
const input = getInputElement();
|
|
96
|
-
const { value } = getInputState();
|
|
97
|
-
const inputDocument = getElementDocument(input);
|
|
98
|
-
if (!isInputFocused(input) && !maskUtils.isValueFilled(value)) {
|
|
99
|
-
const startX = event.clientX;
|
|
100
|
-
const startY = event.clientY;
|
|
101
|
-
const startTime = Date.now();
|
|
102
|
-
const onMouseUp = (e) => {
|
|
103
|
-
inputDocument.removeEventListener("mouseup", onMouseUp);
|
|
104
|
-
if (!isInputFocused(input)) return;
|
|
105
|
-
const deltaX = Math.abs(e.clientX - startX);
|
|
106
|
-
const deltaY = Math.abs(e.clientY - startY);
|
|
107
|
-
const timeDelta = Date.now() - startTime;
|
|
108
|
-
if (Math.max(deltaX, deltaY) <= 10 && timeDelta <= 200 || Math.max(deltaX, deltaY) <= 5 && timeDelta <= 300) {
|
|
109
|
-
const lastState2 = getLastInputState();
|
|
110
|
-
setInputState({
|
|
111
|
-
...lastState2,
|
|
112
|
-
selection: maskUtils.getDefaultSelectionForValue(lastState2.value)
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
inputDocument.addEventListener("mouseup", onMouseUp);
|
|
117
|
-
}
|
|
118
|
-
props.onMouseDown?.(event);
|
|
119
|
-
}
|
|
120
|
-
if (isMasked && isControlled) {
|
|
121
|
-
const input = getInputElement();
|
|
122
|
-
const isFocused = input && isInputFocused(input);
|
|
123
|
-
let newValue = isFocused || alwaysShowMask || props.value ? maskUtils.formatValue(props.value) : props.value;
|
|
124
|
-
if (beforeMaskedStateChange) {
|
|
125
|
-
newValue = beforeMaskedStateChange({
|
|
126
|
-
nextState: { value: newValue, selection: { start: null, end: null } }
|
|
127
|
-
}).value;
|
|
128
|
-
}
|
|
129
|
-
setInputState({
|
|
130
|
-
...getLastInputState(),
|
|
131
|
-
value: newValue
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
const lastState = getLastInputState();
|
|
135
|
-
useLayoutEffect(() => {
|
|
136
|
-
if (!isMasked) return;
|
|
137
|
-
const input = getInputElement();
|
|
138
|
-
const isFocused = isInputFocused(input);
|
|
139
|
-
const currentState = getInputState();
|
|
140
|
-
let newState = { ...currentState };
|
|
141
|
-
if (!isControlled) {
|
|
142
|
-
const formatted = maskUtils.formatValue(currentState.value);
|
|
143
|
-
const shouldShow = !maskUtils.isValueEmpty(formatted) || isFocused || alwaysShowMask;
|
|
144
|
-
newState.value = shouldShow ? formatted : "";
|
|
145
|
-
}
|
|
146
|
-
if (isFocused && !previousIsMasked) {
|
|
147
|
-
newState.selection = maskUtils.getDefaultSelectionForValue(newState.value);
|
|
148
|
-
}
|
|
149
|
-
if (beforeMaskedStateChange) {
|
|
150
|
-
newState = beforeMaskedStateChange({
|
|
151
|
-
currentState,
|
|
152
|
-
nextState: newState
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
setInputState(newState);
|
|
156
|
-
});
|
|
157
|
-
const inputProps = {
|
|
158
|
-
...restProps,
|
|
159
|
-
onFocus,
|
|
160
|
-
onBlur,
|
|
161
|
-
onChange: isMasked && isEditable ? onChange : props.onChange,
|
|
162
|
-
onMouseDown: isMasked && isEditable ? onMouseDown : props.onMouseDown,
|
|
163
|
-
value: isMasked && isControlled ? lastState.value : props.value,
|
|
164
|
-
ref: (node) => {
|
|
165
|
-
inputRef.current = node;
|
|
166
|
-
if (isFunction(forwardedRef)) {
|
|
167
|
-
forwardedRef(node);
|
|
168
|
-
} else if (forwardedRef && typeof forwardedRef === "object") {
|
|
169
|
-
forwardedRef.current = node;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
if (children) {
|
|
174
|
-
validateChildren(props, children);
|
|
175
|
-
return /* @__PURE__ */ jsx(ChildrenWrapper, { ...inputProps, children });
|
|
176
|
-
}
|
|
177
|
-
return /* @__PURE__ */ jsx("input", { ...inputProps });
|
|
178
|
-
});
|
|
179
|
-
CustomInputMask.displayName = "CustomInputMask";
|
|
180
|
-
export {
|
|
181
|
-
CustomInputMask,
|
|
182
|
-
CustomInputMask as default
|
|
183
|
-
};
|
|
184
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/custom-input/customInputMask/index.jsx"],"sourcesContent":["import React, { useLayoutEffect, forwardRef } from \"react\";\r\n\r\nimport { useInputState, useInputElement, usePrevious } from \"./hooks\";\r\nimport {\r\n validateMaxLength,\r\n validateChildren,\r\n validateMaskPlaceholder\r\n} from \"./validate-props\";\r\n\r\nimport { defer } from \"./utils/defer\";\r\nimport { isInputFocused } from \"./utils/input\";\r\nimport { isFunction, toString, getElementDocument } from \"./utils/helpers\";\r\nimport MaskUtils from \"./utils/mask\";\r\nimport ChildrenWrapper from \"./children-wrapper\";\r\n\r\nexport const CustomInputMask = forwardRef(function CustomInputMask(props, forwardedRef) {\r\n const {\r\n alwaysShowMask,\r\n children,\r\n mask,\r\n maskPlaceholder,\r\n beforeMaskedStateChange,\r\n ...restProps\r\n } = props;\r\n\r\n validateMaxLength(props);\r\n validateMaskPlaceholder(props);\r\n\r\n const maskUtils = new MaskUtils({ mask, maskPlaceholder });\r\n\r\n const isMasked = !!mask;\r\n const isEditable = !restProps.disabled && !restProps.readOnly;\r\n const isControlled = props.value !== null && props.value !== undefined;\r\n const previousIsMasked = usePrevious(isMasked);\r\n const initialValue = toString(\r\n (isControlled ? props.value : props.defaultValue) || \"\"\r\n );\r\n\r\n const {\r\n inputRef,\r\n getInputState,\r\n setInputState,\r\n getLastInputState\r\n } = useInputState(initialValue, isMasked);\r\n\r\n const getInputElement = useInputElement(inputRef);\r\n\r\n function onChange(event) {\r\n const currentState = getInputState();\r\n const previousState = getLastInputState();\r\n let newInputState = maskUtils.processChange(currentState, previousState);\r\n\r\n if (beforeMaskedStateChange) {\r\n newInputState = beforeMaskedStateChange({\r\n currentState,\r\n previousState,\r\n nextState: newInputState\r\n });\r\n }\r\n\r\n setInputState(newInputState);\r\n props.onChange?.(event);\r\n }\r\n\r\n function onFocus(event) {\r\n inputRef.current = event.target;\r\n\r\n const currentValue = getInputState().value;\r\n\r\n if (isMasked && !maskUtils.isValueFilled(currentValue)) {\r\n let newValue = maskUtils.formatValue(currentValue);\r\n let newSelection = maskUtils.getDefaultSelectionForValue(newValue);\r\n let newInputState = { value: newValue, selection: newSelection };\r\n\r\n if (beforeMaskedStateChange) {\r\n newInputState = beforeMaskedStateChange({\r\n currentState: getInputState(),\r\n nextState: newInputState\r\n });\r\n }\r\n\r\n setInputState(newInputState);\r\n\r\n if (newValue !== currentValue) {\r\n props.onChange?.(event);\r\n }\r\n\r\n defer(() => {\r\n setInputState(getLastInputState());\r\n });\r\n }\r\n\r\n props.onFocus?.(event);\r\n }\r\n\r\n function onBlur(event) {\r\n const currentValue = getInputState().value;\r\n const lastValue = getLastInputState().value;\r\n\r\n if (isMasked && !alwaysShowMask && maskUtils.isValueEmpty(lastValue)) {\r\n let newInputState = {\r\n value: \"\",\r\n selection: { start: null, end: null }\r\n };\r\n\r\n if (beforeMaskedStateChange) {\r\n newInputState = beforeMaskedStateChange({\r\n currentState: getInputState(),\r\n nextState: newInputState\r\n });\r\n }\r\n\r\n setInputState(newInputState);\r\n\r\n if (newInputState.value !== currentValue) {\r\n props.onChange?.(event);\r\n }\r\n }\r\n\r\n props.onBlur?.(event);\r\n }\r\n\r\n function onMouseDown(event) {\r\n const input = getInputElement();\r\n const { value } = getInputState();\r\n const inputDocument = getElementDocument(input);\r\n\r\n if (!isInputFocused(input) && !maskUtils.isValueFilled(value)) {\r\n const startX = event.clientX;\r\n const startY = event.clientY;\r\n const startTime = Date.now();\r\n\r\n const onMouseUp = e => {\r\n inputDocument.removeEventListener(\"mouseup\", onMouseUp);\r\n\r\n if (!isInputFocused(input)) return;\r\n\r\n const deltaX = Math.abs(e.clientX - startX);\r\n const deltaY = Math.abs(e.clientY - startY);\r\n const timeDelta = Date.now() - startTime;\r\n\r\n if (\r\n (Math.max(deltaX, deltaY) <= 10 && timeDelta <= 200) ||\r\n (Math.max(deltaX, deltaY) <= 5 && timeDelta <= 300)\r\n ) {\r\n const lastState = getLastInputState();\r\n setInputState({\r\n ...lastState,\r\n selection: maskUtils.getDefaultSelectionForValue(lastState.value)\r\n });\r\n }\r\n };\r\n\r\n inputDocument.addEventListener(\"mouseup\", onMouseUp);\r\n }\r\n\r\n props.onMouseDown?.(event);\r\n }\r\n\r\n if (isMasked && isControlled) {\r\n const input = getInputElement();\r\n const isFocused = input && isInputFocused(input);\r\n\r\n let newValue =\r\n isFocused || alwaysShowMask || props.value\r\n ? maskUtils.formatValue(props.value)\r\n : props.value;\r\n\r\n if (beforeMaskedStateChange) {\r\n newValue = beforeMaskedStateChange({\r\n nextState: { value: newValue, selection: { start: null, end: null } }\r\n }).value;\r\n }\r\n\r\n setInputState({\r\n ...getLastInputState(),\r\n value: newValue\r\n });\r\n }\r\n\r\n const lastState = getLastInputState();\r\n\r\n useLayoutEffect(() => {\r\n if (!isMasked) return;\r\n\r\n const input = getInputElement();\r\n const isFocused = isInputFocused(input);\r\n const currentState = getInputState();\r\n let newState = { ...currentState };\r\n\r\n if (!isControlled) {\r\n const formatted = maskUtils.formatValue(currentState.value);\r\n const shouldShow =\r\n !maskUtils.isValueEmpty(formatted) || isFocused || alwaysShowMask;\r\n\r\n newState.value = shouldShow ? formatted : \"\";\r\n }\r\n\r\n if (isFocused && !previousIsMasked) {\r\n newState.selection = maskUtils.getDefaultSelectionForValue(newState.value);\r\n }\r\n\r\n if (beforeMaskedStateChange) {\r\n newState = beforeMaskedStateChange({\r\n currentState,\r\n nextState: newState\r\n });\r\n }\r\n\r\n setInputState(newState);\r\n });\r\n\r\n const inputProps = {\r\n ...restProps,\r\n onFocus,\r\n onBlur,\r\n onChange: isMasked && isEditable ? onChange : props.onChange,\r\n onMouseDown: isMasked && isEditable ? onMouseDown : props.onMouseDown,\r\n value: isMasked && isControlled ? lastState.value : props.value,\r\n ref: node => {\r\n inputRef.current = node;\r\n\r\n if (isFunction(forwardedRef)) {\r\n forwardedRef(node);\r\n } else if (forwardedRef && typeof forwardedRef === \"object\") {\r\n forwardedRef.current = node;\r\n }\r\n }\r\n };\r\n\r\n if (children) {\r\n validateChildren(props, children);\r\n return <ChildrenWrapper {...inputProps}>{children}</ChildrenWrapper>;\r\n }\r\n\r\n return <input {...inputProps} />;\r\n});\r\n\r\nCustomInputMask.displayName = \"CustomInputMask\";\r\nexport default CustomInputMask;\r\n"],"names":["CustomInputMask","lastState"],"mappings":";;;;;;;;;AAeO,MAAM,kBAAkB,WAAW,SAASA,iBAAgB,OAAO,cAAc;AACpF,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACH;AAEJ,oBAAkB,KAAK;AACv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,IACpD,aAAa,YAAY,aAAa,cAAc,MAAM;AAAA,IAC1D,OAAO,YAAY,eAAe,UAAU,QAAQ,MAAM;AAAA,IAC1D,KAAK,CAAA,SAAQ;AACT,eAAS,UAAU;AAEnB,UAAI,WAAW,YAAY,GAAG;AAC1B,qBAAa,IAAI;AAAA,MACrB,WAAW,gBAAgB,OAAO,iBAAiB,UAAU;AACzD,qBAAa,UAAU;AAAA,MAC3B;AAAA,IACJ;AAAA,EAAA;AAGJ,MAAI,UAAU;AACV,qBAAiB,OAAO,QAAQ;AAChC,WAAO,oBAAC,iBAAA,EAAiB,GAAG,YAAa,SAAA,CAAS;AAAA,EACtD;AAEA,SAAO,oBAAC,SAAA,EAAO,GAAG,WAAA,CAAY;AAClC,CAAC;AAED,gBAAgB,cAAc;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defer.js","sources":["../../../../src/custom-input/customInputMask/utils/defer.js"],"sourcesContent":["export function defer(fn) {\r\n return requestAnimationFrame(fn);\r\n}\r\n\r\nexport function cancelDefer(deferId) {\r\n cancelAnimationFrame(deferId);\r\n}\r\n"],"names":[],"mappings":"AAAO,SAAS,MAAM,IAAI;AACxB,SAAO,sBAAsB,EAAE;AACjC;AAEO,SAAS,YAAY,SAAS;AACnC,uBAAqB,OAAO;AAC9B;"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
function getElementDocument(element) {
|
|
2
|
-
return element?.ownerDocument;
|
|
3
|
-
}
|
|
4
|
-
function getElementWindow(element) {
|
|
5
|
-
return getElementDocument(element)?.defaultView;
|
|
6
|
-
}
|
|
7
|
-
function isDOMElement(element) {
|
|
8
|
-
const elementWindow = getElementWindow(element);
|
|
9
|
-
return !!elementWindow && element instanceof elementWindow.HTMLElement;
|
|
10
|
-
}
|
|
11
|
-
function isFunction(value) {
|
|
12
|
-
return typeof value === "function";
|
|
13
|
-
}
|
|
14
|
-
function findLastIndex(array, predicate) {
|
|
15
|
-
for (let i = array.length - 1; i >= 0; i--) {
|
|
16
|
-
const x = array[i];
|
|
17
|
-
if (predicate(x, i)) {
|
|
18
|
-
return i;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return -1;
|
|
22
|
-
}
|
|
23
|
-
function repeat(string, n = 1) {
|
|
24
|
-
let result = "";
|
|
25
|
-
for (let i = 0; i < n; i++) {
|
|
26
|
-
result += string;
|
|
27
|
-
}
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
30
|
-
function toString(value) {
|
|
31
|
-
return `${value}`;
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
findLastIndex,
|
|
35
|
-
getElementDocument,
|
|
36
|
-
getElementWindow,
|
|
37
|
-
isDOMElement,
|
|
38
|
-
isFunction,
|
|
39
|
-
repeat,
|
|
40
|
-
toString
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../../src/custom-input/customInputMask/utils/helpers.js"],"sourcesContent":["// Element's window may differ from the one within React instance\r\n// if element rendered within iframe.\r\n// See https://github.com/sanniassin/react-input-mask/issues/182\r\nexport function getElementDocument(element) {\r\n return element?.ownerDocument;\r\n}\r\n\r\nexport function getElementWindow(element) {\r\n return getElementDocument(element)?.defaultView;\r\n}\r\n\r\nexport function isDOMElement(element) {\r\n const elementWindow = getElementWindow(element);\r\n return !!elementWindow && element instanceof elementWindow.HTMLElement;\r\n}\r\n\r\nexport function isFunction(value) {\r\n return typeof value === \"function\";\r\n}\r\n\r\nexport function findLastIndex(array, predicate) {\r\n for (let i = array.length - 1; i >= 0; i--) {\r\n const x = array[i];\r\n if (predicate(x, i)) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n}\r\n\r\nexport function repeat(string, n = 1) {\r\n let result = \"\";\r\n for (let i = 0; i < n; i++) {\r\n result += string;\r\n }\r\n return result;\r\n}\r\n\r\nexport function toString(value) {\r\n return `${value}`;\r\n}\r\n"],"names":[],"mappings":"AAGO,SAAS,mBAAmB,SAAS;AAC1C,SAAO,SAAS;AAClB;AAEO,SAAS,iBAAiB,SAAS;AACxC,SAAO,mBAAmB,OAAO,GAAG;AACtC;AAEO,SAAS,aAAa,SAAS;AACpC,QAAM,gBAAgB,iBAAiB,OAAO;AAC9C,SAAO,CAAC,CAAC,iBAAiB,mBAAmB,cAAc;AAC7D;AAEO,SAAS,WAAW,OAAO;AAChC,SAAO,OAAO,UAAU;AAC1B;AAEO,SAAS,cAAc,OAAO,WAAW;AAC9C,WAAS,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK;AAC1C,UAAM,IAAI,MAAM,CAAC;AACjB,QAAI,UAAU,GAAG,CAAC,GAAG;AACnB,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,OAAO,QAAQ,IAAI,GAAG;AACpC,MAAI,SAAS;AACb,WAAS,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,cAAU;AAAA,EACZ;AACA,SAAO;AACT;AAEO,SAAS,SAAS,OAAO;AAC9B,SAAO,GAAG,KAAK;AACjB;"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
function setInputSelection(input, start, end) {
|
|
2
|
-
if (end === void 0) {
|
|
3
|
-
end = start;
|
|
4
|
-
}
|
|
5
|
-
input.setSelectionRange(start, end);
|
|
6
|
-
}
|
|
7
|
-
function getInputSelection(input) {
|
|
8
|
-
const start = input.selectionStart;
|
|
9
|
-
const end = input.selectionEnd;
|
|
10
|
-
return {
|
|
11
|
-
start,
|
|
12
|
-
end,
|
|
13
|
-
length: end - start
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function isInputFocused(input) {
|
|
17
|
-
const inputDocument = input.ownerDocument;
|
|
18
|
-
return inputDocument.hasFocus() && inputDocument.activeElement === input;
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
getInputSelection,
|
|
22
|
-
isInputFocused,
|
|
23
|
-
setInputSelection
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=input.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sources":["../../../../src/custom-input/customInputMask/utils/input.js"],"sourcesContent":["export function setInputSelection(input, start, end) {\r\n if (end === undefined) {\r\n end = start;\r\n }\r\n input.setSelectionRange(start, end);\r\n}\r\n\r\nexport function getInputSelection(input) {\r\n const start = input.selectionStart;\r\n const end = input.selectionEnd;\r\n\r\n return {\r\n start,\r\n end,\r\n length: end - start\r\n };\r\n}\r\n\r\nexport function isInputFocused(input) {\r\n const inputDocument = input.ownerDocument;\r\n return inputDocument.hasFocus() && inputDocument.activeElement === input;\r\n}\r\n"],"names":[],"mappings":"AAAO,SAAS,kBAAkB,OAAO,OAAO,KAAK;AACnD,MAAI,QAAQ,QAAW;AACrB,UAAM;AAAA,EACR;AACA,QAAM,kBAAkB,OAAO,GAAG;AACpC;AAEO,SAAS,kBAAkB,OAAO;AACvC,QAAM,QAAQ,MAAM;AACpB,QAAM,MAAM,MAAM;AAElB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,QAAQ,MAAM;AAAA,EAClB;AACA;AAEO,SAAS,eAAe,OAAO;AACpC,QAAM,gBAAgB,MAAM;AAC5B,SAAO,cAAc,SAAQ,KAAM,cAAc,kBAAkB;AACrE;"}
|