@chayns-components/core 5.0.24 → 5.0.26
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/lib/cjs/components/accordion/accordion-body/AccordionBody.js +1 -6
- package/lib/cjs/components/accordion/accordion-body/AccordionBody.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js +0 -27
- package/lib/cjs/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-content/AccordionContent.js +6 -13
- package/lib/cjs/components/accordion/accordion-content/AccordionContent.js.map +1 -1
- package/lib/cjs/components/accordion/accordion-content/AccordionContent.styles.js +0 -27
- package/lib/cjs/components/accordion/accordion-content/AccordionContent.styles.js.map +1 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js +5 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js +37 -0
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.js +6 -13
- package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.styles.js +1 -36
- package/lib/cjs/components/combobox/ComboBox.styles.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.types.js +12 -0
- package/lib/cjs/components/combobox/ComboBox.types.js.map +1 -0
- package/lib/cjs/components/combobox/combobox-item/ComboBoxItem.js.map +1 -1
- package/lib/cjs/components/filter/filter-content/FIlterContent.js.map +1 -1
- package/lib/cjs/components/list/List.js +97 -37
- package/lib/cjs/components/list/List.js.map +1 -1
- package/lib/cjs/components/list/list-item/ListItem.js +0 -9
- package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
- package/lib/cjs/components/number-input/NumberInput.js +213 -132
- package/lib/cjs/components/number-input/NumberInput.js.map +1 -1
- package/lib/cjs/components/popup/popup-content-wrapper/PopupContentWrapper.js +1 -4
- package/lib/cjs/components/popup/popup-content-wrapper/PopupContentWrapper.js.map +1 -1
- package/lib/cjs/components/popup/popup-content-wrapper/PopupContentWrapper.styles.js +0 -34
- package/lib/cjs/components/popup/popup-content-wrapper/PopupContentWrapper.styles.js.map +1 -1
- package/lib/cjs/components/scroll-view/ScrollView.js +10 -16
- package/lib/cjs/components/scroll-view/ScrollView.js.map +1 -1
- package/lib/cjs/components/scroll-view/ScrollView.styles.js +3 -38
- package/lib/cjs/components/scroll-view/ScrollView.styles.js.map +1 -1
- package/lib/cjs/components/search-box/SearchBox.styles.js +2 -29
- package/lib/cjs/components/search-box/SearchBox.styles.js.map +1 -1
- package/lib/cjs/components/search-box/search-box-body/SearchBoxBody.js +2 -6
- package/lib/cjs/components/search-box/search-box-body/SearchBoxBody.js.map +1 -1
- package/lib/cjs/components/search-box/search-box-body/SearchBoxBody.styles.js +0 -27
- package/lib/cjs/components/search-box/search-box-body/SearchBoxBody.styles.js.map +1 -1
- package/lib/cjs/components/text-area/TextArea.js +2 -6
- package/lib/cjs/components/text-area/TextArea.js.map +1 -1
- package/lib/cjs/components/text-area/TextArea.styles.js +2 -31
- package/lib/cjs/components/text-area/TextArea.styles.js.map +1 -1
- package/lib/cjs/index.js +3 -2
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/utils/calculate.js.map +1 -1
- package/lib/cjs/utils/numberInput.js +1 -0
- package/lib/cjs/utils/numberInput.js.map +1 -1
- package/lib/esm/components/accordion/accordion-body/AccordionBody.js +1 -6
- package/lib/esm/components/accordion/accordion-body/AccordionBody.js.map +1 -1
- package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js +0 -27
- package/lib/esm/components/accordion/accordion-body/AccordionBody.styles.js.map +1 -1
- package/lib/esm/components/accordion/accordion-content/AccordionContent.js +6 -13
- package/lib/esm/components/accordion/accordion-content/AccordionContent.js.map +1 -1
- package/lib/esm/components/accordion/accordion-content/AccordionContent.styles.js +0 -27
- package/lib/esm/components/accordion/accordion-content/AccordionContent.styles.js.map +1 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +6 -2
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js +38 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.styles.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.js +5 -12
- package/lib/esm/components/combobox/ComboBox.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.styles.js +1 -36
- package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.types.js +6 -0
- package/lib/esm/components/combobox/ComboBox.types.js.map +1 -0
- package/lib/esm/components/combobox/combobox-item/ComboBoxItem.js.map +1 -1
- package/lib/esm/components/filter/filter-content/FIlterContent.js.map +1 -1
- package/lib/esm/components/list/List.js +97 -37
- package/lib/esm/components/list/List.js.map +1 -1
- package/lib/esm/components/list/list-item/ListItem.js +0 -9
- package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
- package/lib/esm/components/number-input/NumberInput.js +213 -132
- package/lib/esm/components/number-input/NumberInput.js.map +1 -1
- package/lib/esm/components/popup/popup-content-wrapper/PopupContentWrapper.js +2 -5
- package/lib/esm/components/popup/popup-content-wrapper/PopupContentWrapper.js.map +1 -1
- package/lib/esm/components/popup/popup-content-wrapper/PopupContentWrapper.styles.js +0 -34
- package/lib/esm/components/popup/popup-content-wrapper/PopupContentWrapper.styles.js.map +1 -1
- package/lib/esm/components/scroll-view/ScrollView.js +10 -16
- package/lib/esm/components/scroll-view/ScrollView.js.map +1 -1
- package/lib/esm/components/scroll-view/ScrollView.styles.js +3 -38
- package/lib/esm/components/scroll-view/ScrollView.styles.js.map +1 -1
- package/lib/esm/components/search-box/SearchBox.styles.js +1 -28
- package/lib/esm/components/search-box/SearchBox.styles.js.map +1 -1
- package/lib/esm/components/search-box/search-box-body/SearchBoxBody.js +2 -6
- package/lib/esm/components/search-box/search-box-body/SearchBoxBody.js.map +1 -1
- package/lib/esm/components/search-box/search-box-body/SearchBoxBody.styles.js +0 -27
- package/lib/esm/components/search-box/search-box-body/SearchBoxBody.styles.js.map +1 -1
- package/lib/esm/components/text-area/TextArea.js +2 -6
- package/lib/esm/components/text-area/TextArea.js.map +1 -1
- package/lib/esm/components/text-area/TextArea.styles.js +1 -30
- package/lib/esm/components/text-area/TextArea.styles.js.map +1 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/utils/calculate.js.map +1 -1
- package/lib/esm/utils/numberInput.js +1 -0
- package/lib/esm/utils/numberInput.js.map +1 -1
- package/lib/types/components/accordion/accordion-body/AccordionBody.styles.d.ts +0 -2
- package/lib/types/components/accordion/accordion-content/AccordionContent.styles.d.ts +0 -2
- package/lib/types/components/color-scheme-provider/ColorSchemeProvider.styles.d.ts +7 -3
- package/lib/types/components/combobox/ComboBox.d.ts +2 -139
- package/lib/types/components/combobox/ComboBox.styles.d.ts +1 -3
- package/lib/types/components/combobox/ComboBox.types.d.ts +139 -0
- package/lib/types/components/combobox/combobox-item/ComboBoxItem.d.ts +1 -1
- package/lib/types/components/list/List.d.ts +0 -1
- package/lib/types/components/popup/popup-content-wrapper/PopupContentWrapper.styles.d.ts +0 -2
- package/lib/types/components/scroll-view/ScrollView.styles.d.ts +0 -2
- package/lib/types/components/search-box/SearchBox.styles.d.ts +0 -2
- package/lib/types/components/search-box/search-box-body/SearchBoxBody.styles.d.ts +0 -2
- package/lib/types/components/text-area/TextArea.styles.d.ts +0 -2
- package/lib/types/index.d.ts +3 -1
- package/lib/types/utils/calculate.d.ts +1 -1
- package/package.json +2 -2
|
@@ -4,155 +4,236 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
+
var _reactCompilerRuntime = require("react-compiler-runtime");
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _numberInput = require("../../constants/numberInput");
|
|
9
10
|
var _numberInput2 = require("../../utils/numberInput");
|
|
10
11
|
var _Input = _interopRequireDefault(require("../input/Input"));
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
-
const NumberInput =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
const NumberInput = t0 => {
|
|
15
|
+
"use memo";
|
|
16
|
+
|
|
17
|
+
const $ = (0, _reactCompilerRuntime.c)(41);
|
|
18
|
+
const {
|
|
19
|
+
isDecimalInput,
|
|
20
|
+
isMoneyInput,
|
|
21
|
+
isTimeInput,
|
|
22
|
+
isInvalid,
|
|
23
|
+
maxNumber: t1,
|
|
24
|
+
value,
|
|
25
|
+
shouldTriggerChangeOnFormat: t2,
|
|
26
|
+
placeholder,
|
|
27
|
+
onBlur,
|
|
28
|
+
isDisabled,
|
|
29
|
+
onChange,
|
|
30
|
+
shouldShowOnlyBottomBorder,
|
|
31
|
+
minNumber: t3
|
|
32
|
+
} = t0;
|
|
33
|
+
const maxNumber = t1 === undefined ? Infinity : t1;
|
|
34
|
+
const shouldTriggerChangeOnFormat = t2 === undefined ? true : t2;
|
|
35
|
+
const minNumber = t3 === undefined ? -Infinity : t3;
|
|
36
|
+
const [plainText, setPlainText] = (0, _react.useState)("");
|
|
37
|
+
const [formattedValue, setFormattedValue] = (0, _react.useState)("");
|
|
32
38
|
const [hasFocus, setHasFocus] = (0, _react.useState)(false);
|
|
33
39
|
const [shouldRemainPlaceholder, setShouldRemainPlaceholder] = (0, _react.useState)(false);
|
|
34
40
|
const [isValueInvalid, setIsValueInvalid] = (0, _react.useState)(false);
|
|
35
|
-
const localPlaceholder = placeholder ?? (isMoneyInput ?
|
|
41
|
+
const localPlaceholder = placeholder ?? (isMoneyInput ? "\u20AC" : undefined);
|
|
36
42
|
const initialInputRef = (0, _react.useRef)(true);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
const valueToCheck = sanitizedValueString.replaceAll(',', '.');
|
|
47
|
-
if (!(0, _numberInput2.isValidString)({
|
|
48
|
-
string: valueToCheck,
|
|
49
|
-
isMoneyInput,
|
|
50
|
-
isDecimalInput,
|
|
51
|
-
isTimeInput
|
|
52
|
-
})) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (maxNumber && Number(valueToCheck) > maxNumber || minNumber && Number(valueToCheck) < minNumber) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (newValue.length === 1 && newValue.match(/^[0-9]+$/) === null) {
|
|
59
|
-
setShouldRemainPlaceholder(true);
|
|
60
|
-
} else {
|
|
61
|
-
setShouldRemainPlaceholder(false);
|
|
62
|
-
}
|
|
63
|
-
setPlainText(sanitizedValueString.replaceAll('.', ','));
|
|
64
|
-
if (typeof onChange === 'function') {
|
|
65
|
-
onChange(sanitizedValueString.replaceAll('.', ','));
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
const onLocalBlur = () => {
|
|
69
|
-
const sanitizedValue = plainText;
|
|
70
|
-
let newIsInvalid = false;
|
|
71
|
-
let parsedNumber = null;
|
|
72
|
-
if (!isTimeInput) {
|
|
73
|
-
parsedNumber = (0, _numberInput2.parseFloatWithDecimals)({
|
|
74
|
-
stringValue: sanitizedValue.replace(',', '.').replaceAll(':', '').replace('€', ''),
|
|
75
|
-
decimals: isMoneyInput ? 2 : undefined
|
|
76
|
-
});
|
|
77
|
-
if (parsedNumber && parsedNumber !== 0 && (parsedNumber > maxNumber || parsedNumber < minNumber)) {
|
|
78
|
-
newIsInvalid = true;
|
|
43
|
+
let t4;
|
|
44
|
+
if ($[0] !== isDecimalInput || $[1] !== isMoneyInput || $[2] !== isTimeInput || $[3] !== maxNumber || $[4] !== minNumber || $[5] !== onChange) {
|
|
45
|
+
t4 = event => {
|
|
46
|
+
const newValue = event.target.value;
|
|
47
|
+
initialInputRef.current = false;
|
|
48
|
+
const sanitizedValueString = newValue.replace(_numberInput.NUMBER_CLEAR_REGEX, "");
|
|
49
|
+
if (isTimeInput && (sanitizedValueString.includes(":") && sanitizedValueString.length > 5 || !sanitizedValueString.includes(":") && sanitizedValueString.length > 4)) {
|
|
50
|
+
return;
|
|
79
51
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (isTimeInput) {
|
|
95
|
-
onBlur(newStringValue, newIsInvalid);
|
|
52
|
+
const valueToCheck = sanitizedValueString.replaceAll(",", ".");
|
|
53
|
+
if (!(0, _numberInput2.isValidString)({
|
|
54
|
+
string: valueToCheck,
|
|
55
|
+
isMoneyInput,
|
|
56
|
+
isDecimalInput,
|
|
57
|
+
isTimeInput
|
|
58
|
+
})) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (maxNumber && Number(valueToCheck) > maxNumber || minNumber && Number(valueToCheck) < minNumber) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (newValue.length === 1 && newValue.match(/^[0-9]+$/) === null) {
|
|
65
|
+
setShouldRemainPlaceholder(true);
|
|
96
66
|
} else {
|
|
97
|
-
|
|
67
|
+
setShouldRemainPlaceholder(false);
|
|
98
68
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
69
|
+
setPlainText(sanitizedValueString.replaceAll(".", ","));
|
|
70
|
+
if (typeof onChange === "function") {
|
|
71
|
+
onChange(sanitizedValueString.replaceAll(".", ","));
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
$[0] = isDecimalInput;
|
|
75
|
+
$[1] = isMoneyInput;
|
|
76
|
+
$[2] = isTimeInput;
|
|
77
|
+
$[3] = maxNumber;
|
|
78
|
+
$[4] = minNumber;
|
|
79
|
+
$[5] = onChange;
|
|
80
|
+
$[6] = t4;
|
|
81
|
+
} else {
|
|
82
|
+
t4 = $[6];
|
|
83
|
+
}
|
|
84
|
+
const onLocalChange = t4;
|
|
85
|
+
let t5;
|
|
86
|
+
if ($[7] !== isMoneyInput || $[8] !== isTimeInput || $[9] !== maxNumber || $[10] !== minNumber || $[11] !== onBlur || $[12] !== onChange || $[13] !== plainText || $[14] !== shouldTriggerChangeOnFormat) {
|
|
87
|
+
t5 = () => {
|
|
88
|
+
const sanitizedValue = plainText;
|
|
89
|
+
let newIsInvalid = false;
|
|
90
|
+
let parsedNumber = null;
|
|
91
|
+
if (!isTimeInput) {
|
|
92
|
+
parsedNumber = (0, _numberInput2.parseFloatWithDecimals)({
|
|
93
|
+
stringValue: sanitizedValue.replace(",", ".").replaceAll(":", "").replace("\u20AC", ""),
|
|
94
|
+
decimals: isMoneyInput ? 2 : undefined
|
|
95
|
+
});
|
|
96
|
+
if (parsedNumber && parsedNumber !== 0 && (parsedNumber > maxNumber || parsedNumber < minNumber)) {
|
|
97
|
+
newIsInvalid = true;
|
|
98
|
+
}
|
|
99
|
+
setIsValueInvalid(newIsInvalid);
|
|
100
|
+
}
|
|
101
|
+
const newStringValue = plainText.length === 0 ? "" : (0, _numberInput2.formateNumber)({
|
|
102
|
+
number: isTimeInput ? sanitizedValue : parsedNumber,
|
|
103
|
+
isMoneyInput,
|
|
104
|
+
isTimeInput
|
|
121
105
|
});
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
106
|
+
setFormattedValue(`${newStringValue} ${isMoneyInput ? "\u20AC" : ""}`);
|
|
107
|
+
setPlainText(newStringValue.replaceAll(".", ""));
|
|
108
|
+
setHasFocus(false);
|
|
109
|
+
if (typeof onChange === "function" && shouldTriggerChangeOnFormat) {
|
|
110
|
+
onChange(newStringValue.replaceAll(".", ""));
|
|
111
|
+
}
|
|
112
|
+
if (typeof onBlur === "function") {
|
|
113
|
+
if (isTimeInput) {
|
|
114
|
+
onBlur(newStringValue, newIsInvalid);
|
|
127
115
|
} else {
|
|
128
|
-
|
|
116
|
+
onBlur(parsedNumber, newIsInvalid);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
$[7] = isMoneyInput;
|
|
121
|
+
$[8] = isTimeInput;
|
|
122
|
+
$[9] = maxNumber;
|
|
123
|
+
$[10] = minNumber;
|
|
124
|
+
$[11] = onBlur;
|
|
125
|
+
$[12] = onChange;
|
|
126
|
+
$[13] = plainText;
|
|
127
|
+
$[14] = shouldTriggerChangeOnFormat;
|
|
128
|
+
$[15] = t5;
|
|
129
|
+
} else {
|
|
130
|
+
t5 = $[15];
|
|
131
|
+
}
|
|
132
|
+
const onLocalBlur = t5;
|
|
133
|
+
let t6;
|
|
134
|
+
if ($[16] !== formattedValue || $[17] !== onChange || $[18] !== shouldTriggerChangeOnFormat) {
|
|
135
|
+
t6 = () => {
|
|
136
|
+
setPlainText(formattedValue.replaceAll(".", "").replace("\u20AC", "").replaceAll(" ", ""));
|
|
137
|
+
if (typeof onChange === "function" && shouldTriggerChangeOnFormat) {
|
|
138
|
+
onChange(formattedValue.replaceAll(".", "").replace("\u20AC", "").replaceAll(" ", ""));
|
|
139
|
+
}
|
|
140
|
+
setIsValueInvalid(false);
|
|
141
|
+
setHasFocus(true);
|
|
142
|
+
};
|
|
143
|
+
$[16] = formattedValue;
|
|
144
|
+
$[17] = onChange;
|
|
145
|
+
$[18] = shouldTriggerChangeOnFormat;
|
|
146
|
+
$[19] = t6;
|
|
147
|
+
} else {
|
|
148
|
+
t6 = $[19];
|
|
149
|
+
}
|
|
150
|
+
const onLocalFocus = t6;
|
|
151
|
+
let t7;
|
|
152
|
+
let t8;
|
|
153
|
+
if ($[20] !== hasFocus || $[21] !== isMoneyInput || $[22] !== isTimeInput || $[23] !== maxNumber || $[24] !== minNumber || $[25] !== plainText) {
|
|
154
|
+
t7 = () => {
|
|
155
|
+
let parsedNumber_0 = null;
|
|
156
|
+
if (!isTimeInput) {
|
|
157
|
+
parsedNumber_0 = (0, _numberInput2.parseFloatWithDecimals)({
|
|
158
|
+
stringValue: plainText.replace(",", ".").replaceAll(":", "").replace("\u20AC", "").replaceAll(" ", ""),
|
|
159
|
+
decimals: isMoneyInput ? 2 : undefined
|
|
160
|
+
});
|
|
161
|
+
if (!hasFocus) {
|
|
162
|
+
if (parsedNumber_0 === null && initialInputRef.current) {
|
|
163
|
+
setIsValueInvalid(false);
|
|
164
|
+
} else {
|
|
165
|
+
setIsValueInvalid(parsedNumber_0 === null || parsedNumber_0 > maxNumber || parsedNumber_0 < minNumber);
|
|
166
|
+
}
|
|
129
167
|
}
|
|
130
168
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
169
|
+
setFormattedValue(plainText.length === 0 ? "" : `${(0, _numberInput2.formateNumber)({
|
|
170
|
+
number: isTimeInput ? plainText : parsedNumber_0,
|
|
171
|
+
isMoneyInput,
|
|
172
|
+
isTimeInput
|
|
173
|
+
})}${isMoneyInput ? " \u20AC" : ""}`);
|
|
174
|
+
};
|
|
175
|
+
t8 = [hasFocus, isMoneyInput, isTimeInput, maxNumber, minNumber, plainText];
|
|
176
|
+
$[20] = hasFocus;
|
|
177
|
+
$[21] = isMoneyInput;
|
|
178
|
+
$[22] = isTimeInput;
|
|
179
|
+
$[23] = maxNumber;
|
|
180
|
+
$[24] = minNumber;
|
|
181
|
+
$[25] = plainText;
|
|
182
|
+
$[26] = t7;
|
|
183
|
+
$[27] = t8;
|
|
184
|
+
} else {
|
|
185
|
+
t7 = $[26];
|
|
186
|
+
t8 = $[27];
|
|
187
|
+
}
|
|
188
|
+
(0, _react.useEffect)(t7, t8);
|
|
189
|
+
let t10;
|
|
190
|
+
let t9;
|
|
191
|
+
if ($[28] !== value) {
|
|
192
|
+
t9 = () => {
|
|
193
|
+
if (typeof value === "string") {
|
|
194
|
+
setPlainText(value.replace("\u20AC", "").replaceAll(" ", ""));
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
t10 = [value];
|
|
198
|
+
$[28] = value;
|
|
199
|
+
$[29] = t10;
|
|
200
|
+
$[30] = t9;
|
|
201
|
+
} else {
|
|
202
|
+
t10 = $[29];
|
|
203
|
+
t9 = $[30];
|
|
204
|
+
}
|
|
205
|
+
(0, _react.useEffect)(t9, t10);
|
|
206
|
+
const t11 = hasFocus ? plainText : formattedValue;
|
|
207
|
+
const t12 = typeof isInvalid === "boolean" ? isInvalid : isValueInvalid;
|
|
208
|
+
let t13;
|
|
209
|
+
if ($[31] !== isDisabled || $[32] !== localPlaceholder || $[33] !== onLocalBlur || $[34] !== onLocalChange || $[35] !== onLocalFocus || $[36] !== shouldRemainPlaceholder || $[37] !== shouldShowOnlyBottomBorder || $[38] !== t11 || $[39] !== t12) {
|
|
210
|
+
t13 = /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
211
|
+
shouldRemainPlaceholder: shouldRemainPlaceholder,
|
|
212
|
+
shouldShowOnlyBottomBorder: shouldShowOnlyBottomBorder,
|
|
213
|
+
inputMode: "decimal",
|
|
214
|
+
onChange: onLocalChange,
|
|
215
|
+
value: t11,
|
|
216
|
+
placeholder: localPlaceholder,
|
|
217
|
+
onBlur: onLocalBlur,
|
|
218
|
+
onFocus: onLocalFocus,
|
|
219
|
+
isDisabled: isDisabled,
|
|
220
|
+
isInvalid: t12,
|
|
221
|
+
shouldShowCenteredContent: shouldShowOnlyBottomBorder
|
|
222
|
+
});
|
|
223
|
+
$[31] = isDisabled;
|
|
224
|
+
$[32] = localPlaceholder;
|
|
225
|
+
$[33] = onLocalBlur;
|
|
226
|
+
$[34] = onLocalChange;
|
|
227
|
+
$[35] = onLocalFocus;
|
|
228
|
+
$[36] = shouldRemainPlaceholder;
|
|
229
|
+
$[37] = shouldShowOnlyBottomBorder;
|
|
230
|
+
$[38] = t11;
|
|
231
|
+
$[39] = t12;
|
|
232
|
+
$[40] = t13;
|
|
233
|
+
} else {
|
|
234
|
+
t13 = $[40];
|
|
235
|
+
}
|
|
236
|
+
return t13;
|
|
156
237
|
};
|
|
157
238
|
NumberInput.displayName = 'NumberInput';
|
|
158
239
|
var _default = exports.default = NumberInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.js","names":["_react","_interopRequireWildcard","require","_numberInput","_numberInput2","_Input","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","NumberInput","isDecimalInput","isMoneyInput","isTimeInput","isInvalid","maxNumber","Infinity","value","shouldTriggerChangeOnFormat","placeholder","onBlur","isDisabled","onChange","shouldShowOnlyBottomBorder","minNumber","plainText","setPlainText","useState","formattedValue","setFormattedValue","hasFocus","setHasFocus","shouldRemainPlaceholder","setShouldRemainPlaceholder","isValueInvalid","setIsValueInvalid","localPlaceholder","undefined","initialInputRef","useRef","onLocalChange","event","newValue","target","current","sanitizedValueString","replace","NUMBER_CLEAR_REGEX","includes","length","valueToCheck","replaceAll","isValidString","string","Number","match","onLocalBlur","sanitizedValue","newIsInvalid","parsedNumber","parseFloatWithDecimals","stringValue","decimals","newStringValue","formateNumber","number","onLocalFocus","useEffect","createElement","inputMode","onFocus","shouldShowCenteredContent","displayName","_default","exports"],"sources":["../../../../src/components/number-input/NumberInput.tsx"],"sourcesContent":["import React, { ChangeEventHandler, FC, useEffect, useRef, useState } from 'react';\nimport { NUMBER_CLEAR_REGEX } from '../../constants/numberInput';\nimport { formateNumber, isValidString, parseFloatWithDecimals } from '../../utils/numberInput';\nimport Input from '../input/Input';\n\nexport type NumberInputProps = {\n /**\n * Applies rules for decimal input.\n * Enables the user to input one zero as number before the comma\n */\n isDecimalInput?: boolean;\n /**\n * Whether the input is disabled\n */\n isDisabled?: boolean;\n /**\n * Whether the value is invalid.\n */\n isInvalid?: boolean;\n /**\n * Applies rules for money input.\n * Rules: only two decimal places, one zero before the comma\n */\n isMoneyInput?: boolean;\n /**\n * Whether the value should be formatted as a time.\n */\n isTimeInput?: boolean;\n /**\n * Limits the number to this value\n */\n maxNumber?: number;\n /**\n * Limits the number to this value\n */\n minNumber?: number;\n /**\n * Callback function that is called when the input gets out of focus\n */\n onBlur?: (newNumber: number | string | null, isInvalid: boolean) => void;\n /**\n * Callback function that is called when the input changes\n * It will pass the text from the input\n */\n onChange?: (newValue: string) => void;\n /**\n * Placeholder for the input field\n */\n placeholder?: string;\n /**\n * Whether only the bottom border should be displayed\n */\n shouldShowOnlyBottomBorder?: boolean;\n /**\n * Whether the onChange function should be triggert when the value is formatted on the focus or blur\n */\n shouldTriggerChangeOnFormat?: boolean;\n /**\n * The value, that should be displayed in the input, when it is in focus.\n * You can also pass a stringified number as default value.\n * NOTE: If you pass a stringified number, it will be formatted to the selected format\n */\n value?: string;\n};\n\nconst NumberInput: FC<NumberInputProps> = ({\n isDecimalInput,\n isMoneyInput,\n isTimeInput,\n isInvalid,\n maxNumber = Infinity,\n value,\n shouldTriggerChangeOnFormat = true,\n placeholder,\n onBlur,\n isDisabled,\n onChange,\n shouldShowOnlyBottomBorder,\n minNumber = -Infinity,\n}) => {\n // the plainText will be shown in the input, when it is in focus\n const [plainText, setPlainText] = useState<string>('');\n // the formattedValue will be shown in the input, when it is not in focus\n const [formattedValue, setFormattedValue] = useState<string>('');\n const [hasFocus, setHasFocus] = useState<boolean>(false);\n const [shouldRemainPlaceholder, setShouldRemainPlaceholder] = useState<boolean>(false);\n\n const [isValueInvalid, setIsValueInvalid] = useState(false);\n const localPlaceholder = placeholder ?? (isMoneyInput ? '€' : undefined);\n\n const initialInputRef = useRef(true);\n\n const onLocalChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n const newValue = event.target.value;\n\n initialInputRef.current = false;\n\n const sanitizedValueString = newValue\n // Removes everything except numbers, commas and points\n .replace(NUMBER_CLEAR_REGEX, '');\n\n if (\n isTimeInput &&\n ((sanitizedValueString.includes(':') && sanitizedValueString.length > 5) ||\n (!sanitizedValueString.includes(':') && sanitizedValueString.length > 4))\n ) {\n return;\n }\n\n const valueToCheck = sanitizedValueString.replaceAll(',', '.');\n\n if (!isValidString({ string: valueToCheck, isMoneyInput, isDecimalInput, isTimeInput })) {\n return;\n }\n\n if (\n (maxNumber && Number(valueToCheck) > maxNumber) ||\n (minNumber && Number(valueToCheck) < minNumber)\n ) {\n return;\n }\n\n if (newValue.length === 1 && newValue.match(/^[0-9]+$/) === null) {\n setShouldRemainPlaceholder(true);\n } else {\n setShouldRemainPlaceholder(false);\n }\n\n setPlainText(sanitizedValueString.replaceAll('.', ','));\n\n if (typeof onChange === 'function') {\n onChange(sanitizedValueString.replaceAll('.', ','));\n }\n };\n\n const onLocalBlur = () => {\n const sanitizedValue = plainText;\n let newIsInvalid = false;\n let parsedNumber = null;\n\n if (!isTimeInput) {\n parsedNumber = parseFloatWithDecimals({\n stringValue: sanitizedValue.replace(',', '.').replaceAll(':', '').replace('€', ''),\n decimals: isMoneyInput ? 2 : undefined,\n });\n\n if (\n parsedNumber &&\n parsedNumber !== 0 &&\n (parsedNumber > maxNumber || parsedNumber < minNumber)\n ) {\n newIsInvalid = true;\n }\n\n setIsValueInvalid(newIsInvalid);\n }\n\n const newStringValue =\n plainText.length === 0\n ? ''\n : formateNumber({\n number: isTimeInput ? sanitizedValue : parsedNumber,\n isMoneyInput,\n isTimeInput,\n });\n\n setFormattedValue(`${newStringValue} ${isMoneyInput ? '€' : ''}`);\n setPlainText(newStringValue.replaceAll('.', ''));\n setHasFocus(false);\n\n if (typeof onChange === 'function' && shouldTriggerChangeOnFormat) {\n onChange(newStringValue.replaceAll('.', ''));\n }\n\n if (typeof onBlur === 'function') {\n if (isTimeInput) {\n onBlur(newStringValue, newIsInvalid);\n } else {\n onBlur(parsedNumber, newIsInvalid);\n }\n }\n };\n\n const onLocalFocus = () => {\n // formattedValue will be a number string with german number format (e.g. 1.000,00)\n // It will remove all dots, so that the user can type in the number\n setPlainText(formattedValue.replaceAll('.', '').replace('€', '').replaceAll(' ', ''));\n\n // This will update the external state\n if (typeof onChange === 'function' && shouldTriggerChangeOnFormat) {\n onChange(formattedValue.replaceAll('.', '').replace('€', '').replaceAll(' ', ''));\n }\n\n setIsValueInvalid(false);\n setHasFocus(true);\n };\n\n // updates the formattedValue, when the value changes\n useEffect(() => {\n let parsedNumber = null;\n\n if (!isTimeInput) {\n parsedNumber = parseFloatWithDecimals({\n stringValue: plainText\n .replace(',', '.')\n .replaceAll(':', '')\n .replace('€', '')\n .replaceAll(' ', ''),\n decimals: isMoneyInput ? 2 : undefined,\n });\n\n // checks, if a given number is invalid, if the input is not in focus\n if (!hasFocus) {\n if (parsedNumber === null && initialInputRef.current) {\n setIsValueInvalid(false);\n } else {\n setIsValueInvalid(\n parsedNumber === null ||\n parsedNumber > maxNumber ||\n parsedNumber < minNumber,\n );\n }\n }\n }\n\n setFormattedValue(\n plainText.length === 0\n ? ''\n : `${formateNumber({\n number: isTimeInput ? plainText : parsedNumber,\n isMoneyInput,\n isTimeInput,\n })}${isMoneyInput ? ' €' : ''}`,\n );\n }, [hasFocus, isMoneyInput, isTimeInput, maxNumber, minNumber, plainText]);\n\n useEffect(() => {\n if (typeof value === 'string') {\n setPlainText(value.replace('€', '').replaceAll(' ', ''));\n }\n }, [value]);\n\n return (\n <Input\n shouldRemainPlaceholder={shouldRemainPlaceholder}\n shouldShowOnlyBottomBorder={shouldShowOnlyBottomBorder}\n inputMode=\"decimal\"\n onChange={onLocalChange}\n value={hasFocus ? plainText : formattedValue}\n placeholder={localPlaceholder}\n onBlur={onLocalBlur}\n onFocus={onLocalFocus}\n isDisabled={isDisabled}\n isInvalid={typeof isInvalid === 'boolean' ? isInvalid : isValueInvalid}\n shouldShowCenteredContent={shouldShowOnlyBottomBorder}\n />\n );\n};\n\nNumberInput.displayName = 'NumberInput';\n\nexport default NumberInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAmC,SAAAI,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,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AAC,EAAE,CAAClC,KAAK,CAAC,CAAC;EAEX,oBACIjC,MAAA,CAAAS,OAAA,CAAA2E,aAAA,CAAC/E,MAAA,CAAAI,OAAK;IACFuC,uBAAuB,EAAEA,uBAAwB;IACjDT,0BAA0B,EAAEA,0BAA2B;IACvD8C,SAAS,EAAC,SAAS;IACnB/C,QAAQ,EAAEkB,aAAc;IACxBvB,KAAK,EAAEa,QAAQ,GAAGL,SAAS,GAAGG,cAAe;IAC7CT,WAAW,EAAEiB,gBAAiB;IAC9BhB,MAAM,EAAEoC,WAAY;IACpBc,OAAO,EAAEJ,YAAa;IACtB7C,UAAU,EAAEA,UAAW;IACvBP,SAAS,EAAE,OAAOA,SAAS,KAAK,SAAS,GAAGA,SAAS,GAAGoB,cAAe;IACvEqC,yBAAyB,EAAEhD;EAA2B,CACzD,CAAC;AAEV,CAAC;AAEDb,WAAW,CAAC8D,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjF,OAAA,GAEzBiB,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"NumberInput.js","names":["_react","_interopRequireWildcard","require","_numberInput","_numberInput2","_Input","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","NumberInput","t0","$","_reactCompilerRuntime","c","isDecimalInput","isMoneyInput","isTimeInput","isInvalid","maxNumber","t1","value","shouldTriggerChangeOnFormat","t2","placeholder","onBlur","isDisabled","onChange","shouldShowOnlyBottomBorder","minNumber","t3","undefined","Infinity","plainText","setPlainText","useState","formattedValue","setFormattedValue","hasFocus","setHasFocus","shouldRemainPlaceholder","setShouldRemainPlaceholder","isValueInvalid","setIsValueInvalid","localPlaceholder","initialInputRef","useRef","t4","event","newValue","target","current","sanitizedValueString","replace","NUMBER_CLEAR_REGEX","includes","length","valueToCheck","replaceAll","isValidString","string","Number","match","onLocalChange","t5","sanitizedValue","newIsInvalid","parsedNumber","parseFloatWithDecimals","stringValue","decimals","newStringValue","formateNumber","number","onLocalBlur","t6","onLocalFocus","t7","t8","parsedNumber_0","useEffect","t10","t9","t11","t12","t13","createElement","inputMode","displayName","_default","exports"],"sources":["../../../../src/components/number-input/NumberInput.tsx"],"sourcesContent":["import React, { ChangeEventHandler, FC, useEffect, useRef, useState } from 'react';\nimport { NUMBER_CLEAR_REGEX } from '../../constants/numberInput';\nimport { formateNumber, isValidString, parseFloatWithDecimals } from '../../utils/numberInput';\nimport Input from '../input/Input';\n\nexport type NumberInputProps = {\n /**\n * Applies rules for decimal input.\n * Enables the user to input one zero as number before the comma\n */\n isDecimalInput?: boolean;\n /**\n * Whether the input is disabled\n */\n isDisabled?: boolean;\n /**\n * Whether the value is invalid.\n */\n isInvalid?: boolean;\n /**\n * Applies rules for money input.\n * Rules: only two decimal places, one zero before the comma\n */\n isMoneyInput?: boolean;\n /**\n * Whether the value should be formatted as a time.\n */\n isTimeInput?: boolean;\n /**\n * Limits the number to this value\n */\n maxNumber?: number;\n /**\n * Limits the number to this value\n */\n minNumber?: number;\n /**\n * Callback function that is called when the input gets out of focus\n */\n onBlur?: (newNumber: number | string | null, isInvalid: boolean) => void;\n /**\n * Callback function that is called when the input changes\n * It will pass the text from the input\n */\n onChange?: (newValue: string) => void;\n /**\n * Placeholder for the input field\n */\n placeholder?: string;\n /**\n * Whether only the bottom border should be displayed\n */\n shouldShowOnlyBottomBorder?: boolean;\n /**\n * Whether the onChange function should be triggert when the value is formatted on the focus or blur\n */\n shouldTriggerChangeOnFormat?: boolean;\n /**\n * The value, that should be displayed in the input, when it is in focus.\n * You can also pass a stringified number as default value.\n * NOTE: If you pass a stringified number, it will be formatted to the selected format\n */\n value?: string;\n};\n\nconst NumberInput: FC<NumberInputProps> = ({\n isDecimalInput,\n isMoneyInput,\n isTimeInput,\n isInvalid,\n maxNumber = Infinity,\n value,\n shouldTriggerChangeOnFormat = true,\n placeholder,\n onBlur,\n isDisabled,\n onChange,\n shouldShowOnlyBottomBorder,\n minNumber = -Infinity,\n}) => {\n 'use memo';\n\n // the plainText will be shown in the input, when it is in focus\n const [plainText, setPlainText] = useState<string>('');\n // the formattedValue will be shown in the input, when it is not in focus\n const [formattedValue, setFormattedValue] = useState<string>('');\n const [hasFocus, setHasFocus] = useState<boolean>(false);\n const [shouldRemainPlaceholder, setShouldRemainPlaceholder] = useState<boolean>(false);\n\n const [isValueInvalid, setIsValueInvalid] = useState(false);\n const localPlaceholder = placeholder ?? (isMoneyInput ? '€' : undefined);\n\n const initialInputRef = useRef(true);\n\n const onLocalChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n const newValue = event.target.value;\n\n initialInputRef.current = false;\n\n const sanitizedValueString = newValue\n // Removes everything except numbers, commas and points\n .replace(NUMBER_CLEAR_REGEX, '');\n\n if (\n isTimeInput &&\n ((sanitizedValueString.includes(':') && sanitizedValueString.length > 5) ||\n (!sanitizedValueString.includes(':') && sanitizedValueString.length > 4))\n ) {\n return;\n }\n\n const valueToCheck = sanitizedValueString.replaceAll(',', '.');\n\n if (!isValidString({ string: valueToCheck, isMoneyInput, isDecimalInput, isTimeInput })) {\n return;\n }\n\n if (\n (maxNumber && Number(valueToCheck) > maxNumber) ||\n (minNumber && Number(valueToCheck) < minNumber)\n ) {\n return;\n }\n\n if (newValue.length === 1 && newValue.match(/^[0-9]+$/) === null) {\n setShouldRemainPlaceholder(true);\n } else {\n setShouldRemainPlaceholder(false);\n }\n\n setPlainText(sanitizedValueString.replaceAll('.', ','));\n\n if (typeof onChange === 'function') {\n onChange(sanitizedValueString.replaceAll('.', ','));\n }\n };\n\n const onLocalBlur = () => {\n const sanitizedValue = plainText;\n let newIsInvalid = false;\n let parsedNumber = null;\n\n if (!isTimeInput) {\n parsedNumber = parseFloatWithDecimals({\n stringValue: sanitizedValue.replace(',', '.').replaceAll(':', '').replace('€', ''),\n decimals: isMoneyInput ? 2 : undefined,\n });\n\n if (\n parsedNumber &&\n parsedNumber !== 0 &&\n (parsedNumber > maxNumber || parsedNumber < minNumber)\n ) {\n newIsInvalid = true;\n }\n\n setIsValueInvalid(newIsInvalid);\n }\n\n const newStringValue =\n plainText.length === 0\n ? ''\n : formateNumber({\n number: isTimeInput ? sanitizedValue : parsedNumber,\n isMoneyInput,\n isTimeInput,\n });\n\n setFormattedValue(`${newStringValue} ${isMoneyInput ? '€' : ''}`);\n setPlainText(newStringValue.replaceAll('.', ''));\n setHasFocus(false);\n\n if (typeof onChange === 'function' && shouldTriggerChangeOnFormat) {\n onChange(newStringValue.replaceAll('.', ''));\n }\n\n if (typeof onBlur === 'function') {\n if (isTimeInput) {\n onBlur(newStringValue, newIsInvalid);\n } else {\n onBlur(parsedNumber, newIsInvalid);\n }\n }\n };\n\n const onLocalFocus = () => {\n // formattedValue will be a number string with german number format (e.g. 1.000,00)\n // It will remove all dots, so that the user can type in the number\n setPlainText(formattedValue.replaceAll('.', '').replace('€', '').replaceAll(' ', ''));\n\n // This will update the external state\n if (typeof onChange === 'function' && shouldTriggerChangeOnFormat) {\n onChange(formattedValue.replaceAll('.', '').replace('€', '').replaceAll(' ', ''));\n }\n\n setIsValueInvalid(false);\n setHasFocus(true);\n };\n\n // updates the formattedValue, when the value changes\n useEffect(() => {\n let parsedNumber = null;\n\n if (!isTimeInput) {\n parsedNumber = parseFloatWithDecimals({\n stringValue: plainText\n .replace(',', '.')\n .replaceAll(':', '')\n .replace('€', '')\n .replaceAll(' ', ''),\n decimals: isMoneyInput ? 2 : undefined,\n });\n\n // checks, if a given number is invalid, if the input is not in focus\n if (!hasFocus) {\n if (parsedNumber === null && initialInputRef.current) {\n setIsValueInvalid(false);\n } else {\n setIsValueInvalid(\n parsedNumber === null ||\n parsedNumber > maxNumber ||\n parsedNumber < minNumber,\n );\n }\n }\n }\n\n setFormattedValue(\n plainText.length === 0\n ? ''\n : `${formateNumber({\n number: isTimeInput ? plainText : parsedNumber,\n isMoneyInput,\n isTimeInput,\n })}${isMoneyInput ? ' €' : ''}`,\n );\n }, [hasFocus, isMoneyInput, isTimeInput, maxNumber, minNumber, plainText]);\n\n useEffect(() => {\n if (typeof value === 'string') {\n setPlainText(value.replace('€', '').replaceAll(' ', ''));\n }\n }, [value]);\n\n return (\n <Input\n shouldRemainPlaceholder={shouldRemainPlaceholder}\n shouldShowOnlyBottomBorder={shouldShowOnlyBottomBorder}\n inputMode=\"decimal\"\n onChange={onLocalChange}\n value={hasFocus ? plainText : formattedValue}\n placeholder={localPlaceholder}\n onBlur={onLocalBlur}\n onFocus={onLocalFocus}\n isDisabled={isDisabled}\n isInvalid={typeof isInvalid === 'boolean' ? isInvalid : isValueInvalid}\n shouldShowCenteredContent={shouldShowOnlyBottomBorder}\n />\n );\n};\n\nNumberInput.displayName = 'NumberInput';\n\nexport default NumberInput;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAmC,SAAAI,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GA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ACpBZ,0BAA0B,EAA1BA,0BAA0B;MAC5C2D,SAAS,EAAT,SAAS;MACTxB,QAAa,EAAbA,aAAa;MAChB1C,KAAqC,EAArC8D,GAAqC;MAC/BvC,WAAgB,EAAhBA,gBAAgB;MACrB8B,MAAW,EAAXA,WAAW;MACVE,OAAY,EAAZA,YAAY;MACTlD,UAAU,EAAVA,UAAU;MACXR,SAA2D,EAA3DkE,GAA2D;MAC3CxD,yBAA0B,EAA1BA;IAA0B,CACxD,CAAC;IAAAhB,CAAA,OAAAc,UAAA;IAAAd,CAAA,OAAAgC,gBAAA;IAAAhC,CAAA,OAAA8D,WAAA;IAAA9D,CAAA,OAAAmD,aAAA;IAAAnD,CAAA,OAAAgE,YAAA;IAAAhE,CAAA,OAAA4B,uBAAA;IAAA5B,CAAA,OAAAgB,0BAAA;IAAAhB,CAAA,OAAAuE,GAAA;IAAAvE,CAAA,OAAAwE,GAAA;IAAAxE,CAAA,OAAAyE,GAAA;EAAA;IAAAA,GAAA,GAAAzE,CAAA;EAAA;EAAA,OAZFyE,GAYE;AAAA,CAET;AAED3E,WAAW,CAAC8E,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjG,OAAA,GAEzBiB,WAAW","ignoreList":[]}
|
|
@@ -23,9 +23,6 @@ const PopupContentWrapper = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
23
23
|
const {
|
|
24
24
|
colorMode
|
|
25
25
|
} = (0, _chaynsApi.useSite)();
|
|
26
|
-
const {
|
|
27
|
-
browser
|
|
28
|
-
} = (0, _chaynsApi.getDevice)();
|
|
29
26
|
const isBottomLeftAlignment = alignment === _popup.PopupAlignment.BottomLeft;
|
|
30
27
|
const isTopLeftAlignment = alignment === _popup.PopupAlignment.TopLeft;
|
|
31
28
|
const isTopRightAlignment = alignment === _popup.PopupAlignment.TopRight;
|
|
@@ -74,7 +71,7 @@ const PopupContentWrapper = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
74
71
|
translateY(${y})
|
|
75
72
|
`
|
|
76
73
|
}, /*#__PURE__*/_react.default.createElement(_PopupContentWrapper.StyledPopupContentWrapperContent, {
|
|
77
|
-
|
|
74
|
+
className: "chayns-scrollbar",
|
|
78
75
|
$maxHeight: maxHeight
|
|
79
76
|
}, children));
|
|
80
77
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupContentWrapper.js","names":["_chaynsApi","require","_react","_interopRequireDefault","_popup","_PopupContentWrapper","e","__esModule","default","PopupContentWrapper","React","forwardRef","alignment","children","coordinates","offset","width","onMouseLeave","shouldScrollWithContent","onMouseEnter","maxHeight","ref","colorMode","useSite","
|
|
1
|
+
{"version":3,"file":"PopupContentWrapper.js","names":["_chaynsApi","require","_react","_interopRequireDefault","_popup","_PopupContentWrapper","e","__esModule","default","PopupContentWrapper","React","forwardRef","alignment","children","coordinates","offset","width","onMouseLeave","shouldScrollWithContent","onMouseEnter","maxHeight","ref","colorMode","useSite","isBottomLeftAlignment","PopupAlignment","BottomLeft","isTopLeftAlignment","TopLeft","isTopRightAlignment","TopRight","percentageOffsetX","percentageOffsetY","anchorOffsetX","anchorOffsetY","exitAndInitialY","createElement","StyledMotionPopupContentWrapper","animate","opacity","y","$colorMode","$offset","exit","initial","$position","$shouldScrollWithContent","style","left","x","top","transition","type","duration","transformTemplate","StyledPopupContentWrapperContent","className","$maxHeight","displayName","_default","exports"],"sources":["../../../../../src/components/popup/popup-content-wrapper/PopupContentWrapper.tsx"],"sourcesContent":["import { useSite } from 'chayns-api';\nimport React, { ReactNode, type MouseEventHandler } from 'react';\nimport { PopupAlignment, PopupCoordinates } from '../../../types/popup';\nimport {\n StyledMotionPopupContentWrapper,\n StyledPopupContentWrapperContent,\n} from './PopupContentWrapper.styles';\n\ntype PopupContentProps = {\n alignment: PopupAlignment;\n children: ReactNode;\n offset: number;\n coordinates: PopupCoordinates;\n onMouseLeave: MouseEventHandler<HTMLSpanElement>;\n onMouseEnter: MouseEventHandler<HTMLSpanElement>;\n shouldScrollWithContent: boolean;\n width: number;\n maxHeight?: number;\n};\n\nconst PopupContentWrapper = React.forwardRef<HTMLDivElement, PopupContentProps>(\n (\n {\n alignment,\n children,\n coordinates,\n offset,\n width,\n onMouseLeave,\n shouldScrollWithContent,\n onMouseEnter,\n maxHeight,\n },\n ref,\n ) => {\n const { colorMode } = useSite();\n\n const isBottomLeftAlignment = alignment === PopupAlignment.BottomLeft;\n const isTopLeftAlignment = alignment === PopupAlignment.TopLeft;\n const isTopRightAlignment = alignment === PopupAlignment.TopRight;\n\n const percentageOffsetX = isBottomLeftAlignment || isTopLeftAlignment ? -100 : 0;\n const percentageOffsetY = isTopRightAlignment || isTopLeftAlignment ? -100 : 0;\n\n const anchorOffsetX = isBottomLeftAlignment || isTopLeftAlignment ? 21 : -21;\n const anchorOffsetY = isTopRightAlignment || isTopLeftAlignment ? -21 : 21;\n\n const exitAndInitialY = isTopLeftAlignment || isTopRightAlignment ? -16 : 16;\n\n return (\n <StyledMotionPopupContentWrapper\n animate={{ opacity: 1, y: 0 }}\n $colorMode={colorMode}\n $offset={offset}\n exit={{ opacity: 0, y: exitAndInitialY }}\n initial={{ opacity: 0, y: exitAndInitialY }}\n $position={alignment}\n $shouldScrollWithContent={shouldScrollWithContent}\n ref={ref}\n data-ispopup=\"true\"\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n style={{ left: coordinates.x, top: coordinates.y, width }}\n transition={{ type: 'tween', duration: 0.15 }}\n transformTemplate={({ y = '0px' }) => `\n translateX(${percentageOffsetX}%)\n translateY(${percentageOffsetY}%)\n translateX(${anchorOffsetX}px)\n translateY(${anchorOffsetY}px)\n translateY(${y})\n `}\n >\n <StyledPopupContentWrapperContent\n className=\"chayns-scrollbar\"\n $maxHeight={maxHeight}\n >\n {children}\n </StyledPopupContentWrapperContent>\n </StyledMotionPopupContentWrapper>\n );\n },\n);\n\nPopupContentWrapper.displayName = 'PopupContent';\n\nexport default PopupContentWrapper;\n"],"mappings":";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|
94
94
|
`}
|
|
95
|
-
|
|
96
|
-
${({
|
|
97
|
-
$browser,
|
|
98
|
-
theme
|
|
99
|
-
}) => $browser === 'firefox' ? (0, _styledComponents.css)`
|
|
100
|
-
scrollbar-color: rgba(${theme['text-rgb']}, 0.15) transparent;
|
|
101
|
-
scrollbar-width: thin;
|
|
102
|
-
` : (0, _styledComponents.css)`
|
|
103
|
-
&::-webkit-scrollbar {
|
|
104
|
-
width: 10px;
|
|
105
|
-
height: 10px;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
&::-webkit-scrollbar-track {
|
|
109
|
-
background-color: transparent;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
&::-webkit-scrollbar-button {
|
|
113
|
-
background-color: transparent;
|
|
114
|
-
height: 5px;
|
|
115
|
-
width: 5px;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
&::-webkit-scrollbar-thumb {
|
|
119
|
-
background-color: rgba(${theme['text-rgb']}, 0.15);
|
|
120
|
-
border-radius: 20px;
|
|
121
|
-
background-clip: padding-box;
|
|
122
|
-
border: solid 3px transparent;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
&::-webkit-scrollbar-corner {
|
|
126
|
-
background-color: transparent;
|
|
127
|
-
}
|
|
128
|
-
`}
|
|
129
95
|
`;
|
|
130
96
|
//# sourceMappingURL=PopupContentWrapper.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupContentWrapper.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_popup","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionPopupContentWrapper","exports","styled","motion","div","theme","text","$shouldScrollWithContent","$position","$offset","PopupAlignment","TopLeft","css","BottomLeft","TopRight","BottomRight","undefined","StyledPopupContentWrapperContent","$maxHeight"
|
|
1
|
+
{"version":3,"file":"PopupContentWrapper.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_popup","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionPopupContentWrapper","exports","styled","motion","div","theme","text","$shouldScrollWithContent","$position","$offset","PopupAlignment","TopLeft","css","BottomLeft","TopRight","BottomRight","undefined","StyledPopupContentWrapperContent","$maxHeight"],"sources":["../../../../../src/components/popup/popup-content-wrapper/PopupContentWrapper.styles.ts"],"sourcesContent":["import { ColorMode } from 'chayns-api';\nimport { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport { PopupAlignment } from '../../../types/popup';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledMotionPopupContentWrapperProps = WithTheme<{\n $position: PopupAlignment;\n $colorMode: ColorMode;\n $offset: number;\n $shouldScrollWithContent: boolean;\n}>;\n\nexport const StyledMotionPopupContentWrapper = styled(\n motion.div,\n)<StyledMotionPopupContentWrapperProps>`\n background-color: ${({ theme }: StyledMotionPopupContentWrapperProps) => theme['000']};\n border-radius: 3px;\n box-shadow: 1px 3px 8px rgb(0 0 0 / 30%);\n color: ${({ theme }: StyledMotionPopupContentWrapperProps) => theme.text};\n z-index: 100;\n position: ${({ $shouldScrollWithContent }) =>\n $shouldScrollWithContent ? 'absolute' : 'fixed'};\n pointer-events: all;\n\n &::after {\n background-color: inherit;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n border-right: 1px solid rgba(0, 0, 0, 0.1);\n box-shadow: 2px 2px 8px rgb(4 3 4 / 10%);\n content: '';\n height: 14px;\n position: absolute;\n width: 14px;\n z-index: -2;\n\n ${({ $position, $offset }) => {\n switch ($position) {\n case PopupAlignment.TopLeft:\n return css`\n bottom: -7px;\n right: ${13 + $offset}px;\n transform: rotate(45deg);\n `;\n case PopupAlignment.BottomLeft:\n return css`\n top: -7px;\n right: ${13 + $offset}px;\n transform: rotate(225deg);\n `;\n case PopupAlignment.TopRight:\n return css`\n transform: rotate(45deg);\n bottom: -7px;\n left: ${13 + $offset}px;\n `;\n case PopupAlignment.BottomRight:\n return css`\n transform: rotate(225deg);\n top: -7px;\n left: ${13 + $offset}px;\n `;\n default:\n return undefined;\n }\n }}\n }\n\n &::before {\n background-color: inherit;\n border-radius: 3px;\n bottom: 0;\n content: '';\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -1;\n }\n`;\n\ntype StyledPopupContentWrapperContentProps = WithTheme<{\n $maxHeight?: number;\n}>;\n\nexport const StyledPopupContentWrapperContent = styled.div<StyledPopupContentWrapperContentProps>`\n height: 100%;\n width: 100%;\n\n ${({ $maxHeight }) =>\n $maxHeight &&\n css`\n max-height: ${$maxHeight}px;\n overflow-y: auto;\n overflow-x: hidden;\n `}\n`;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAsD,SAAAE,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAA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