@helpdice/ui 2.6.1-beta.3 → 2.6.1-beta.5
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/auto-complete/index.js +67 -21
- package/dist/carousal/index.js +4 -3
- package/dist/copy-to-clipboard/index.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +77 -28
- package/dist/input/index.js +65 -19
- package/dist/input/input-currency-props.d.ts +1 -1
- package/dist/input/input-currency-range.d.ts +3 -8
- package/dist/table/index.js +71 -24
- package/esm/auto-complete/auto-complete.js +1 -1
- package/esm/carousal/Thumbs.js +3 -1
- package/esm/copy-to-clipboard/clipboard.js +2 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.js +1 -1
- package/esm/input/input-currency-props.d.ts +1 -1
- package/esm/input/input-currency-range.d.ts +3 -8
- package/esm/input/input-currency-range.js +56 -12
- package/esm/input/input-currency.js +9 -7
- package/esm/notetip/index.js +1 -1
- package/esm/table/table.js +3 -1
- package/package.json +2 -2
- /package/dist/notetip/{note-tip.d.ts → notetip.d.ts} +0 -0
- /package/esm/notetip/{note-tip.d.ts → notetip.d.ts} +0 -0
- /package/esm/notetip/{note-tip.js → notetip.js} +0 -0
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var theme = require('@helpdice/theme');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
-
var
|
|
8
|
+
var ArrowRight = require('@helpdice/icons/curved/ArrowRight');
|
|
9
9
|
|
|
10
10
|
function _arrayLikeToArray(r, a) {
|
|
11
11
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -3203,7 +3203,7 @@ var repositionCursor = function repositionCursor(_ref) {
|
|
|
3203
3203
|
};
|
|
3204
3204
|
};
|
|
3205
3205
|
|
|
3206
|
-
var _excluded$5 = ["allowDecimals", "allowNegativeValue", "id", "name", "className", "customInput", "decimalsLimit", "defaultValue", "disabled", "maxLength", "value", "fixedDecimalLength", "placeholder", "decimalScale", "prefix", "suffix", "intlConfig", "fullWidth", "step", "min", "max", "disableGroupSeparators", "disableAbbreviations", "decimalSeparator", "groupSeparator", "onChange", "onFocus", "onBlur", "onKeyDown", "onKeyUp", "transformRawValue", "formatValueOnBlur", "children"];
|
|
3206
|
+
var _excluded$5 = ["allowDecimals", "allowNegativeValue", "id", "name", "className", "customInput", "decimalsLimit", "defaultValue", "disabled", "maxLength", "value", "onValueChange", "fixedDecimalLength", "placeholder", "decimalScale", "prefix", "suffix", "intlConfig", "fullWidth", "step", "min", "max", "disableGroupSeparators", "disableAbbreviations", "decimalSeparator", "groupSeparator", "onChange", "onFocus", "onBlur", "onKeyDown", "onKeyUp", "transformRawValue", "formatValueOnBlur", "children"];
|
|
3207
3207
|
var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3208
3208
|
var _ref$allowDecimals = _ref.allowDecimals,
|
|
3209
3209
|
allowDecimals = _ref$allowDecimals === void 0 ? true : _ref$allowDecimals,
|
|
@@ -3219,6 +3219,7 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3219
3219
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
3220
3220
|
userMaxLength = _ref.maxLength,
|
|
3221
3221
|
userValue = _ref.value,
|
|
3222
|
+
onValueChange = _ref.onValueChange,
|
|
3222
3223
|
fixedDecimalLength = _ref.fixedDecimalLength,
|
|
3223
3224
|
placeholder = _ref.placeholder,
|
|
3224
3225
|
decimalScale = _ref.decimalScale,
|
|
@@ -3339,7 +3340,7 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3339
3340
|
return;
|
|
3340
3341
|
}
|
|
3341
3342
|
if (stringValue === '' || stringValue === '-' || stringValue === decimalSeparator) {
|
|
3342
|
-
|
|
3343
|
+
onValueChange && onValueChange(undefined, name, {
|
|
3343
3344
|
"float": null,
|
|
3344
3345
|
formatted: '',
|
|
3345
3346
|
value: ''
|
|
@@ -3377,15 +3378,15 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3377
3378
|
// });
|
|
3378
3379
|
|
|
3379
3380
|
setStateValue(formattedValue);
|
|
3380
|
-
if (
|
|
3381
|
+
if (onValueChange) {
|
|
3381
3382
|
var values = {
|
|
3382
3383
|
"float": numberValue,
|
|
3383
3384
|
formatted: formattedValue,
|
|
3384
3385
|
value: stringValue
|
|
3385
3386
|
};
|
|
3386
|
-
|
|
3387
|
+
onValueChange(stringValue, name, values);
|
|
3387
3388
|
}
|
|
3388
|
-
//
|
|
3389
|
+
// onValueChange && onValueChange(stringValue);
|
|
3389
3390
|
};
|
|
3390
3391
|
|
|
3391
3392
|
/**
|
|
@@ -3396,6 +3397,7 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3396
3397
|
value = _event$target.value,
|
|
3397
3398
|
selectionStart = _event$target.selectionStart;
|
|
3398
3399
|
processChange(value, selectionStart);
|
|
3400
|
+
if (onChange) onChange(event);
|
|
3399
3401
|
};
|
|
3400
3402
|
|
|
3401
3403
|
/**
|
|
@@ -3427,8 +3429,8 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3427
3429
|
var formattedValue = formatValue(_objectSpread2(_objectSpread2({}, formatValueOptions), {}, {
|
|
3428
3430
|
value: newValue
|
|
3429
3431
|
}));
|
|
3430
|
-
if (
|
|
3431
|
-
|
|
3432
|
+
if (onValueChange && formatValueOnBlur) {
|
|
3433
|
+
onValueChange(newValue, name, {
|
|
3432
3434
|
"float": numberValue,
|
|
3433
3435
|
formatted: formattedValue,
|
|
3434
3436
|
value: newValue
|
|
@@ -3745,6 +3747,15 @@ var GridContainer = withScale(GridContainerComponent);
|
|
|
3745
3747
|
|
|
3746
3748
|
Grid.Container = GridContainer;
|
|
3747
3749
|
|
|
3750
|
+
// function isDefaultValue(value: unknown): value is RangeValue {
|
|
3751
|
+
// return (
|
|
3752
|
+
// value instanceof RangeValue &&
|
|
3753
|
+
// value !== null &&
|
|
3754
|
+
// "min" in value &&
|
|
3755
|
+
// "max" in value
|
|
3756
|
+
// );
|
|
3757
|
+
// }
|
|
3758
|
+
|
|
3748
3759
|
function CurrencyRangeInput(_ref) {
|
|
3749
3760
|
var prefix = _ref.prefix,
|
|
3750
3761
|
allowDecimals = _ref.allowDecimals,
|
|
@@ -3753,8 +3764,8 @@ function CurrencyRangeInput(_ref) {
|
|
|
3753
3764
|
value = _ref.value,
|
|
3754
3765
|
_ref$defaultValue = _ref.defaultValue,
|
|
3755
3766
|
defaultValue = _ref$defaultValue === void 0 ? {
|
|
3756
|
-
min:
|
|
3757
|
-
max:
|
|
3767
|
+
min: "",
|
|
3768
|
+
max: ""
|
|
3758
3769
|
} : _ref$defaultValue,
|
|
3759
3770
|
onChange = _ref.onChange,
|
|
3760
3771
|
_ref$debounce = _ref.debounce,
|
|
@@ -3773,21 +3784,56 @@ function CurrencyRangeInput(_ref) {
|
|
|
3773
3784
|
}
|
|
3774
3785
|
}, [isControlled]);
|
|
3775
3786
|
|
|
3787
|
+
// function toNumber(value: string): number {
|
|
3788
|
+
// if (typeof value != "string") {
|
|
3789
|
+
// throw Error("Invalid default value")
|
|
3790
|
+
// }
|
|
3791
|
+
// let cleaned = value.trim();
|
|
3792
|
+
|
|
3793
|
+
// // Remove currency symbols and letters
|
|
3794
|
+
// cleaned = cleaned.replace(/[^\d.,-]/g, '');
|
|
3795
|
+
|
|
3796
|
+
// // If both comma and dot exist → detect format
|
|
3797
|
+
// if (cleaned.includes(',') && cleaned.includes('.')) {
|
|
3798
|
+
// // If comma appears after dot → European format
|
|
3799
|
+
// if (cleaned.lastIndexOf(',') > cleaned.lastIndexOf('.')) {
|
|
3800
|
+
// cleaned = cleaned.replace(/\./g, '').replace(',', '.');
|
|
3801
|
+
// } else {
|
|
3802
|
+
// cleaned = cleaned.replace(/,/g, '');
|
|
3803
|
+
// }
|
|
3804
|
+
// }
|
|
3805
|
+
// // If only comma exists → assume European decimal
|
|
3806
|
+
// else if (cleaned.includes(',')) {
|
|
3807
|
+
// cleaned = cleaned.replace(',', '.');
|
|
3808
|
+
// }
|
|
3809
|
+
|
|
3810
|
+
// return Number(cleaned);
|
|
3811
|
+
// }
|
|
3812
|
+
|
|
3813
|
+
function toNumber(value) {
|
|
3814
|
+
if (typeof value != "string") {
|
|
3815
|
+
throw Error("Invalid default value");
|
|
3816
|
+
}
|
|
3817
|
+
var cleaned = value.replace(/[^\d.-]/g, '');
|
|
3818
|
+
var result = Number(cleaned);
|
|
3819
|
+
return isNaN(result) ? 0 : result;
|
|
3820
|
+
}
|
|
3821
|
+
|
|
3776
3822
|
// Validation
|
|
3777
3823
|
var isInvalid = React.useMemo(function () {
|
|
3778
3824
|
if (!currentValue.min || !currentValue.max) return false;
|
|
3779
|
-
return currentValue.max <= currentValue.min;
|
|
3825
|
+
return toNumber(currentValue.max) <= toNumber(currentValue.min);
|
|
3780
3826
|
}, [currentValue]);
|
|
3781
3827
|
|
|
3782
3828
|
// Debounced onChange
|
|
3783
3829
|
React.useEffect(function () {
|
|
3784
3830
|
if (!onChange || isInvalid) return;
|
|
3831
|
+
// console.log(currentValue, isInvalid);
|
|
3785
3832
|
var handler = setTimeout(function () {
|
|
3786
3833
|
if (currentValue.min && currentValue.max) {
|
|
3787
3834
|
onChange({
|
|
3788
3835
|
min: currentValue.min,
|
|
3789
|
-
max: currentValue.max
|
|
3790
|
-
currency: ''
|
|
3836
|
+
max: currentValue.max
|
|
3791
3837
|
});
|
|
3792
3838
|
}
|
|
3793
3839
|
}, debounce);
|
|
@@ -3796,7 +3842,7 @@ function CurrencyRangeInput(_ref) {
|
|
|
3796
3842
|
};
|
|
3797
3843
|
}, [isInvalid, debounce, currentValue]);
|
|
3798
3844
|
var finalError = externalError !== null && externalError !== void 0 ? externalError : isInvalid;
|
|
3799
|
-
var finalHelperText =
|
|
3845
|
+
var finalHelperText = isInvalid ? "Max must be greater than min" : externalHelperText;
|
|
3800
3846
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3801
3847
|
className: "with-label",
|
|
3802
3848
|
children: [children && /*#__PURE__*/jsxRuntime.jsx(InputBlockLabel, {
|
|
@@ -3805,10 +3851,10 @@ function CurrencyRangeInput(_ref) {
|
|
|
3805
3851
|
gap: 2,
|
|
3806
3852
|
children: [/*#__PURE__*/jsxRuntime.jsx(Grid, {
|
|
3807
3853
|
children: /*#__PURE__*/jsxRuntime.jsx(Input.Currency, {
|
|
3808
|
-
value: currentValue.min,
|
|
3809
|
-
|
|
3854
|
+
value: toNumber(currentValue.min),
|
|
3855
|
+
onValueChange: function onValueChange(_, __, values) {
|
|
3810
3856
|
return setValue(_objectSpread2(_objectSpread2({}, currentValue), {}, {
|
|
3811
|
-
min:
|
|
3857
|
+
min: values === null || values === void 0 ? void 0 : values.formatted
|
|
3812
3858
|
}));
|
|
3813
3859
|
},
|
|
3814
3860
|
intlConfig: intlConfig,
|
|
@@ -3818,10 +3864,10 @@ function CurrencyRangeInput(_ref) {
|
|
|
3818
3864
|
})
|
|
3819
3865
|
}), /*#__PURE__*/jsxRuntime.jsx(Grid, {
|
|
3820
3866
|
children: /*#__PURE__*/jsxRuntime.jsx(Input.Currency, {
|
|
3821
|
-
value: currentValue.max,
|
|
3822
|
-
|
|
3867
|
+
value: toNumber(currentValue.max),
|
|
3868
|
+
onValueChange: function onValueChange(_, __, values) {
|
|
3823
3869
|
return setValue(_objectSpread2(_objectSpread2({}, currentValue), {}, {
|
|
3824
|
-
max:
|
|
3870
|
+
max: values === null || values === void 0 ? void 0 : values.formatted
|
|
3825
3871
|
}));
|
|
3826
3872
|
},
|
|
3827
3873
|
intlConfig: intlConfig,
|
|
@@ -4038,7 +4084,7 @@ var getSearchIcon = function getSearchIcon(searching) {
|
|
|
4038
4084
|
if (searching === undefined) return null;
|
|
4039
4085
|
return searching ? /*#__PURE__*/jsxRuntime.jsx(Loading, {
|
|
4040
4086
|
scale: +scale / 2
|
|
4041
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(
|
|
4087
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(ArrowRight, {});
|
|
4042
4088
|
};
|
|
4043
4089
|
var AutoCompleteComponent = /*#__PURE__*/React.forwardRef(function (_ref, userRef) {
|
|
4044
4090
|
var _ref$options = _ref.options,
|
package/dist/carousal/index.js
CHANGED
|
@@ -6,7 +6,8 @@ var React = require('react');
|
|
|
6
6
|
var require$$0 = require('react-is');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var theme = require('@helpdice/theme');
|
|
9
|
-
var
|
|
9
|
+
var ChevronLeft = require('@helpdice/icons/curved/ChevronLeft');
|
|
10
|
+
var ChevronRight = require('@helpdice/icons/curved/ChevronRight');
|
|
10
11
|
|
|
11
12
|
function _arrayLikeToArray(r, a) {
|
|
12
13
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -3206,7 +3207,7 @@ var Thumbs = /*#__PURE__*/function (_Component) {
|
|
|
3206
3207
|
zIndex: '2',
|
|
3207
3208
|
left: 0
|
|
3208
3209
|
},
|
|
3209
|
-
iconRight: /*#__PURE__*/jsxRuntime.jsx(
|
|
3210
|
+
iconRight: /*#__PURE__*/jsxRuntime.jsx(ChevronLeft, {}),
|
|
3210
3211
|
className: klass.ARROW_PREV(!hasPrev),
|
|
3211
3212
|
onClick: function onClick() {
|
|
3212
3213
|
return _this3.slideRight();
|
|
@@ -3244,7 +3245,7 @@ var Thumbs = /*#__PURE__*/function (_Component) {
|
|
|
3244
3245
|
zIndex: '2',
|
|
3245
3246
|
right: 0
|
|
3246
3247
|
},
|
|
3247
|
-
iconRight: /*#__PURE__*/jsxRuntime.jsx(
|
|
3248
|
+
iconRight: /*#__PURE__*/jsxRuntime.jsx(ChevronRight, {}),
|
|
3248
3249
|
className: klass.ARROW_NEXT(!hasNext),
|
|
3249
3250
|
onClick: function onClick() {
|
|
3250
3251
|
return _this3.slideLeft();
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var icons = require('@helpdice/icons');
|
|
7
6
|
var theme = require('@helpdice/theme');
|
|
8
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var Copy = require('@helpdice/icons/curved/Copy');
|
|
9
9
|
|
|
10
10
|
function _arrayLikeToArray(r, a) {
|
|
11
11
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -1709,7 +1709,7 @@ function Clipboard(props) {
|
|
|
1709
1709
|
onClick: function onClick() {
|
|
1710
1710
|
return _onClick;
|
|
1711
1711
|
},
|
|
1712
|
-
icon: /*#__PURE__*/jsxRuntime.jsx(
|
|
1712
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(Copy, {})
|
|
1713
1713
|
})]
|
|
1714
1714
|
});
|
|
1715
1715
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -94,9 +94,9 @@ export type { HUIThemes, HUserTheme } from './themes';
|
|
|
94
94
|
export { default as Toggle } from './toggle';
|
|
95
95
|
export type { ToggleProps } from './toggle';
|
|
96
96
|
export { default as Tooltip } from './tooltip';
|
|
97
|
-
export { default as Notetip } from './notetip/
|
|
97
|
+
export { default as Notetip } from './notetip/notetip';
|
|
98
98
|
export type { TooltipProps } from './tooltip';
|
|
99
|
-
export type { NotetipProps } from './notetip/
|
|
99
|
+
export type { NotetipProps } from './notetip/notetip';
|
|
100
100
|
export { default as Tree } from './tree';
|
|
101
101
|
export type { TreeProps } from './tree';
|
|
102
102
|
export { useTime, useTimer, useStopwatch } from './timer';
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var theme = require('@helpdice/theme');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var
|
|
6
|
+
var ArrowRight = require('@helpdice/icons/curved/ArrowRight');
|
|
7
7
|
var framerMotion = require('framer-motion');
|
|
8
8
|
var reactDom = require('react-dom');
|
|
9
9
|
var reactDom$1 = require('@floating-ui/react-dom');
|
|
10
10
|
var pro = require('@helpdice/pro');
|
|
11
|
+
var ChevronLeft = require('@helpdice/icons/curved/ChevronLeft');
|
|
12
|
+
var ChevronRight = require('@helpdice/icons/curved/ChevronRight');
|
|
11
13
|
var reactSyntaxHighlighter = require('react-syntax-highlighter');
|
|
12
14
|
var prism = require('react-syntax-highlighter/dist/cjs/styles/prism');
|
|
13
15
|
var require$$0 = require('react-is');
|
|
16
|
+
var Copy = require('@helpdice/icons/curved/Copy');
|
|
14
17
|
var isEqual = require('react-fast-compare');
|
|
15
18
|
|
|
16
19
|
function _interopNamespaceDefault(e) {
|
|
@@ -3540,7 +3543,7 @@ var repositionCursor = function repositionCursor(_ref) {
|
|
|
3540
3543
|
};
|
|
3541
3544
|
};
|
|
3542
3545
|
|
|
3543
|
-
var _excluded$1i = ["allowDecimals", "allowNegativeValue", "id", "name", "className", "customInput", "decimalsLimit", "defaultValue", "disabled", "maxLength", "value", "fixedDecimalLength", "placeholder", "decimalScale", "prefix", "suffix", "intlConfig", "fullWidth", "step", "min", "max", "disableGroupSeparators", "disableAbbreviations", "decimalSeparator", "groupSeparator", "onChange", "onFocus", "onBlur", "onKeyDown", "onKeyUp", "transformRawValue", "formatValueOnBlur", "children"];
|
|
3546
|
+
var _excluded$1i = ["allowDecimals", "allowNegativeValue", "id", "name", "className", "customInput", "decimalsLimit", "defaultValue", "disabled", "maxLength", "value", "onValueChange", "fixedDecimalLength", "placeholder", "decimalScale", "prefix", "suffix", "intlConfig", "fullWidth", "step", "min", "max", "disableGroupSeparators", "disableAbbreviations", "decimalSeparator", "groupSeparator", "onChange", "onFocus", "onBlur", "onKeyDown", "onKeyUp", "transformRawValue", "formatValueOnBlur", "children"];
|
|
3544
3547
|
var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3545
3548
|
var _ref$allowDecimals = _ref.allowDecimals,
|
|
3546
3549
|
allowDecimals = _ref$allowDecimals === void 0 ? true : _ref$allowDecimals,
|
|
@@ -3556,6 +3559,7 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3556
3559
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
3557
3560
|
userMaxLength = _ref.maxLength,
|
|
3558
3561
|
userValue = _ref.value,
|
|
3562
|
+
onValueChange = _ref.onValueChange,
|
|
3559
3563
|
fixedDecimalLength = _ref.fixedDecimalLength,
|
|
3560
3564
|
placeholder = _ref.placeholder,
|
|
3561
3565
|
decimalScale = _ref.decimalScale,
|
|
@@ -3676,7 +3680,7 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3676
3680
|
return;
|
|
3677
3681
|
}
|
|
3678
3682
|
if (stringValue === '' || stringValue === '-' || stringValue === decimalSeparator) {
|
|
3679
|
-
|
|
3683
|
+
onValueChange && onValueChange(undefined, name, {
|
|
3680
3684
|
"float": null,
|
|
3681
3685
|
formatted: '',
|
|
3682
3686
|
value: ''
|
|
@@ -3714,15 +3718,15 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3714
3718
|
// });
|
|
3715
3719
|
|
|
3716
3720
|
setStateValue(formattedValue);
|
|
3717
|
-
if (
|
|
3721
|
+
if (onValueChange) {
|
|
3718
3722
|
var values = {
|
|
3719
3723
|
"float": numberValue,
|
|
3720
3724
|
formatted: formattedValue,
|
|
3721
3725
|
value: stringValue
|
|
3722
3726
|
};
|
|
3723
|
-
|
|
3727
|
+
onValueChange(stringValue, name, values);
|
|
3724
3728
|
}
|
|
3725
|
-
//
|
|
3729
|
+
// onValueChange && onValueChange(stringValue);
|
|
3726
3730
|
};
|
|
3727
3731
|
|
|
3728
3732
|
/**
|
|
@@ -3733,6 +3737,7 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3733
3737
|
value = _event$target.value,
|
|
3734
3738
|
selectionStart = _event$target.selectionStart;
|
|
3735
3739
|
processChange(value, selectionStart);
|
|
3740
|
+
if (onChange) onChange(event);
|
|
3736
3741
|
};
|
|
3737
3742
|
|
|
3738
3743
|
/**
|
|
@@ -3764,8 +3769,8 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3764
3769
|
var formattedValue = formatValue(_objectSpread2(_objectSpread2({}, formatValueOptions), {}, {
|
|
3765
3770
|
value: newValue
|
|
3766
3771
|
}));
|
|
3767
|
-
if (
|
|
3768
|
-
|
|
3772
|
+
if (onValueChange && formatValueOnBlur) {
|
|
3773
|
+
onValueChange(newValue, name, {
|
|
3769
3774
|
"float": numberValue,
|
|
3770
3775
|
formatted: formattedValue,
|
|
3771
3776
|
value: newValue
|
|
@@ -4082,6 +4087,15 @@ var GridContainer = withScale(GridContainerComponent);
|
|
|
4082
4087
|
|
|
4083
4088
|
Grid.Container = GridContainer;
|
|
4084
4089
|
|
|
4090
|
+
// function isDefaultValue(value: unknown): value is RangeValue {
|
|
4091
|
+
// return (
|
|
4092
|
+
// value instanceof RangeValue &&
|
|
4093
|
+
// value !== null &&
|
|
4094
|
+
// "min" in value &&
|
|
4095
|
+
// "max" in value
|
|
4096
|
+
// );
|
|
4097
|
+
// }
|
|
4098
|
+
|
|
4085
4099
|
function CurrencyRangeInput(_ref) {
|
|
4086
4100
|
var prefix = _ref.prefix,
|
|
4087
4101
|
allowDecimals = _ref.allowDecimals,
|
|
@@ -4090,8 +4104,8 @@ function CurrencyRangeInput(_ref) {
|
|
|
4090
4104
|
value = _ref.value,
|
|
4091
4105
|
_ref$defaultValue = _ref.defaultValue,
|
|
4092
4106
|
defaultValue = _ref$defaultValue === void 0 ? {
|
|
4093
|
-
min:
|
|
4094
|
-
max:
|
|
4107
|
+
min: "",
|
|
4108
|
+
max: ""
|
|
4095
4109
|
} : _ref$defaultValue,
|
|
4096
4110
|
onChange = _ref.onChange,
|
|
4097
4111
|
_ref$debounce = _ref.debounce,
|
|
@@ -4110,21 +4124,56 @@ function CurrencyRangeInput(_ref) {
|
|
|
4110
4124
|
}
|
|
4111
4125
|
}, [isControlled]);
|
|
4112
4126
|
|
|
4127
|
+
// function toNumber(value: string): number {
|
|
4128
|
+
// if (typeof value != "string") {
|
|
4129
|
+
// throw Error("Invalid default value")
|
|
4130
|
+
// }
|
|
4131
|
+
// let cleaned = value.trim();
|
|
4132
|
+
|
|
4133
|
+
// // Remove currency symbols and letters
|
|
4134
|
+
// cleaned = cleaned.replace(/[^\d.,-]/g, '');
|
|
4135
|
+
|
|
4136
|
+
// // If both comma and dot exist → detect format
|
|
4137
|
+
// if (cleaned.includes(',') && cleaned.includes('.')) {
|
|
4138
|
+
// // If comma appears after dot → European format
|
|
4139
|
+
// if (cleaned.lastIndexOf(',') > cleaned.lastIndexOf('.')) {
|
|
4140
|
+
// cleaned = cleaned.replace(/\./g, '').replace(',', '.');
|
|
4141
|
+
// } else {
|
|
4142
|
+
// cleaned = cleaned.replace(/,/g, '');
|
|
4143
|
+
// }
|
|
4144
|
+
// }
|
|
4145
|
+
// // If only comma exists → assume European decimal
|
|
4146
|
+
// else if (cleaned.includes(',')) {
|
|
4147
|
+
// cleaned = cleaned.replace(',', '.');
|
|
4148
|
+
// }
|
|
4149
|
+
|
|
4150
|
+
// return Number(cleaned);
|
|
4151
|
+
// }
|
|
4152
|
+
|
|
4153
|
+
function toNumber(value) {
|
|
4154
|
+
if (typeof value != "string") {
|
|
4155
|
+
throw Error("Invalid default value");
|
|
4156
|
+
}
|
|
4157
|
+
var cleaned = value.replace(/[^\d.-]/g, '');
|
|
4158
|
+
var result = Number(cleaned);
|
|
4159
|
+
return isNaN(result) ? 0 : result;
|
|
4160
|
+
}
|
|
4161
|
+
|
|
4113
4162
|
// Validation
|
|
4114
4163
|
var isInvalid = React.useMemo(function () {
|
|
4115
4164
|
if (!currentValue.min || !currentValue.max) return false;
|
|
4116
|
-
return currentValue.max <= currentValue.min;
|
|
4165
|
+
return toNumber(currentValue.max) <= toNumber(currentValue.min);
|
|
4117
4166
|
}, [currentValue]);
|
|
4118
4167
|
|
|
4119
4168
|
// Debounced onChange
|
|
4120
4169
|
React.useEffect(function () {
|
|
4121
4170
|
if (!onChange || isInvalid) return;
|
|
4171
|
+
// console.log(currentValue, isInvalid);
|
|
4122
4172
|
var handler = setTimeout(function () {
|
|
4123
4173
|
if (currentValue.min && currentValue.max) {
|
|
4124
4174
|
onChange({
|
|
4125
4175
|
min: currentValue.min,
|
|
4126
|
-
max: currentValue.max
|
|
4127
|
-
currency: ''
|
|
4176
|
+
max: currentValue.max
|
|
4128
4177
|
});
|
|
4129
4178
|
}
|
|
4130
4179
|
}, debounce);
|
|
@@ -4133,7 +4182,7 @@ function CurrencyRangeInput(_ref) {
|
|
|
4133
4182
|
};
|
|
4134
4183
|
}, [isInvalid, debounce, currentValue]);
|
|
4135
4184
|
var finalError = externalError !== null && externalError !== void 0 ? externalError : isInvalid;
|
|
4136
|
-
var finalHelperText =
|
|
4185
|
+
var finalHelperText = isInvalid ? "Max must be greater than min" : externalHelperText;
|
|
4137
4186
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4138
4187
|
className: "with-label",
|
|
4139
4188
|
children: [children && /*#__PURE__*/jsxRuntime.jsx(InputBlockLabel, {
|
|
@@ -4142,10 +4191,10 @@ function CurrencyRangeInput(_ref) {
|
|
|
4142
4191
|
gap: 2,
|
|
4143
4192
|
children: [/*#__PURE__*/jsxRuntime.jsx(Grid, {
|
|
4144
4193
|
children: /*#__PURE__*/jsxRuntime.jsx(Input.Currency, {
|
|
4145
|
-
value: currentValue.min,
|
|
4146
|
-
|
|
4194
|
+
value: toNumber(currentValue.min),
|
|
4195
|
+
onValueChange: function onValueChange(_, __, values) {
|
|
4147
4196
|
return setValue(_objectSpread2(_objectSpread2({}, currentValue), {}, {
|
|
4148
|
-
min:
|
|
4197
|
+
min: values === null || values === void 0 ? void 0 : values.formatted
|
|
4149
4198
|
}));
|
|
4150
4199
|
},
|
|
4151
4200
|
intlConfig: intlConfig,
|
|
@@ -4155,10 +4204,10 @@ function CurrencyRangeInput(_ref) {
|
|
|
4155
4204
|
})
|
|
4156
4205
|
}), /*#__PURE__*/jsxRuntime.jsx(Grid, {
|
|
4157
4206
|
children: /*#__PURE__*/jsxRuntime.jsx(Input.Currency, {
|
|
4158
|
-
value: currentValue.max,
|
|
4159
|
-
|
|
4207
|
+
value: toNumber(currentValue.max),
|
|
4208
|
+
onValueChange: function onValueChange(_, __, values) {
|
|
4160
4209
|
return setValue(_objectSpread2(_objectSpread2({}, currentValue), {}, {
|
|
4161
|
-
max:
|
|
4210
|
+
max: values === null || values === void 0 ? void 0 : values.formatted
|
|
4162
4211
|
}));
|
|
4163
4212
|
},
|
|
4164
4213
|
intlConfig: intlConfig,
|
|
@@ -4375,7 +4424,7 @@ var getSearchIcon = function getSearchIcon(searching) {
|
|
|
4375
4424
|
if (searching === undefined) return null;
|
|
4376
4425
|
return searching ? /*#__PURE__*/jsxRuntime.jsx(Loading, {
|
|
4377
4426
|
scale: +scale / 2
|
|
4378
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(
|
|
4427
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(ArrowRight, {});
|
|
4379
4428
|
};
|
|
4380
4429
|
var AutoCompleteComponent = /*#__PURE__*/React.forwardRef(function (_ref, userRef) {
|
|
4381
4430
|
var _ref$options = _ref.options,
|
|
@@ -36618,7 +36667,7 @@ function TableComponent(tableProps) {
|
|
|
36618
36667
|
auto: true,
|
|
36619
36668
|
px: 0.6,
|
|
36620
36669
|
scale: 2 / 3,
|
|
36621
|
-
iconRight: /*#__PURE__*/jsxRuntime.jsx(
|
|
36670
|
+
iconRight: /*#__PURE__*/jsxRuntime.jsx(ChevronLeft, {})
|
|
36622
36671
|
})
|
|
36623
36672
|
}), /*#__PURE__*/jsxRuntime.jsx(Tooltip.Small, {
|
|
36624
36673
|
text: "Next",
|
|
@@ -36634,7 +36683,7 @@ function TableComponent(tableProps) {
|
|
|
36634
36683
|
iconRight: isLoading ? /*#__PURE__*/jsxRuntime.jsx(Loading, {
|
|
36635
36684
|
width: "20px",
|
|
36636
36685
|
height: "20px"
|
|
36637
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(
|
|
36686
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(ChevronRight, {})
|
|
36638
36687
|
})
|
|
36639
36688
|
})]
|
|
36640
36689
|
}), dataLength && viewLength && onPageChange ? /*#__PURE__*/jsxRuntime.jsxs(Pagination, {
|
|
@@ -36652,9 +36701,9 @@ function TableComponent(tableProps) {
|
|
|
36652
36701
|
limit: 5,
|
|
36653
36702
|
count: Number(dataLength / viewLength),
|
|
36654
36703
|
children: [/*#__PURE__*/jsxRuntime.jsx(Pagination.Next, {
|
|
36655
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
36704
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ChevronRight, {})
|
|
36656
36705
|
}), /*#__PURE__*/jsxRuntime.jsx(Pagination.Previous, {
|
|
36657
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
36706
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ChevronLeft, {})
|
|
36658
36707
|
})]
|
|
36659
36708
|
}) : null]
|
|
36660
36709
|
}) : null, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
@@ -41349,7 +41398,7 @@ var Thumbs = /*#__PURE__*/function (_Component) {
|
|
|
41349
41398
|
zIndex: '2',
|
|
41350
41399
|
left: 0
|
|
41351
41400
|
},
|
|
41352
|
-
iconRight: /*#__PURE__*/jsxRuntime.jsx(
|
|
41401
|
+
iconRight: /*#__PURE__*/jsxRuntime.jsx(ChevronLeft, {}),
|
|
41353
41402
|
className: klass.ARROW_PREV(!hasPrev),
|
|
41354
41403
|
onClick: function onClick() {
|
|
41355
41404
|
return _this3.slideRight();
|
|
@@ -41387,7 +41436,7 @@ var Thumbs = /*#__PURE__*/function (_Component) {
|
|
|
41387
41436
|
zIndex: '2',
|
|
41388
41437
|
right: 0
|
|
41389
41438
|
},
|
|
41390
|
-
iconRight: /*#__PURE__*/jsxRuntime.jsx(
|
|
41439
|
+
iconRight: /*#__PURE__*/jsxRuntime.jsx(ChevronRight, {}),
|
|
41391
41440
|
className: klass.ARROW_NEXT(!hasNext),
|
|
41392
41441
|
onClick: function onClick() {
|
|
41393
41442
|
return _this3.slideLeft();
|
|
@@ -42706,7 +42755,7 @@ function Clipboard(props) {
|
|
|
42706
42755
|
onClick: function onClick() {
|
|
42707
42756
|
return _onClick;
|
|
42708
42757
|
},
|
|
42709
|
-
icon: /*#__PURE__*/jsxRuntime.jsx(
|
|
42758
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(Copy, {})
|
|
42710
42759
|
})]
|
|
42711
42760
|
});
|
|
42712
42761
|
}
|