@helpdice/ui 2.6.0 → 2.6.1-beta.0
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 +246 -14
- package/dist/container/index.js +7 -0
- package/dist/expandable/index.js +7 -0
- package/dist/index.js +321 -228
- package/dist/input/index.d.ts +2 -0
- package/dist/input/index.js +246 -14
- package/dist/input/input-currency-range.d.ts +8 -0
- package/dist/table/index.js +232 -146
- package/esm/expandable/expand.js +7 -0
- package/esm/input/index.d.ts +2 -0
- package/esm/input/index.js +2 -0
- package/esm/input/input-currency-range.d.ts +8 -0
- package/esm/input/input-currency-range.js +83 -0
- package/package.json +1 -1
package/dist/input/index.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ import Textarea from '../textarea';
|
|
|
3
3
|
import InputPassword from './password';
|
|
4
4
|
import PhoneInput from './input-phone';
|
|
5
5
|
import CurrencyInput from './input-currency';
|
|
6
|
+
import CurrencyRangeInput from './input-currency-range';
|
|
6
7
|
export type InputComponentType = typeof Input & {
|
|
7
8
|
Textarea: typeof Textarea;
|
|
8
9
|
Password: typeof InputPassword;
|
|
9
10
|
Phone: typeof PhoneInput;
|
|
10
11
|
Currency: typeof CurrencyInput;
|
|
12
|
+
CurrencyRange: typeof CurrencyRangeInput;
|
|
11
13
|
};
|
|
12
14
|
export { getColors } from './styles';
|
|
13
15
|
export type { InputProps } from './input-field';
|
package/dist/input/index.js
CHANGED
|
@@ -825,7 +825,7 @@ var generateGetAllScaleProps = function generateGetAllScaleProps(props) {
|
|
|
825
825
|
return getAllScaleProps;
|
|
826
826
|
};
|
|
827
827
|
|
|
828
|
-
var _excluded$
|
|
828
|
+
var _excluded$9 = ["children"];
|
|
829
829
|
var reduceScaleCoefficient = function reduceScaleCoefficient(scale) {
|
|
830
830
|
if (scale === 1) return scale;
|
|
831
831
|
var diff = Math.abs((scale - 1) / 2);
|
|
@@ -835,7 +835,7 @@ var withScale = function withScale(Render) {
|
|
|
835
835
|
var ScaleFC = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
836
836
|
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31;
|
|
837
837
|
var children = _ref.children,
|
|
838
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
838
|
+
props = _objectWithoutProperties(_ref, _excluded$9);
|
|
839
839
|
var _useTheme = theme.useTheme(),
|
|
840
840
|
layout = _useTheme.layout;
|
|
841
841
|
var paddingLeft = props.paddingLeft,
|
|
@@ -920,7 +920,7 @@ var withScale = function withScale(Render) {
|
|
|
920
920
|
return ScaleFC;
|
|
921
921
|
};
|
|
922
922
|
|
|
923
|
-
var _excluded$
|
|
923
|
+
var _excluded$8 = ["children", "tag", "className", "color"];
|
|
924
924
|
var getTypeColor = function getTypeColor(type, palette) {
|
|
925
925
|
var colors = {
|
|
926
926
|
"default": 'inherit',
|
|
@@ -938,7 +938,7 @@ var TextChild = function TextChild(_ref) {
|
|
|
938
938
|
className = _ref$className === void 0 ? '' : _ref$className,
|
|
939
939
|
_ref$color = _ref.color,
|
|
940
940
|
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
941
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
941
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
942
942
|
var Component = tag;
|
|
943
943
|
var theme$1 = theme.useTheme();
|
|
944
944
|
var _useScale = useScale(),
|
|
@@ -986,7 +986,7 @@ var TextChild = function TextChild(_ref) {
|
|
|
986
986
|
};
|
|
987
987
|
TextChild.displayName = 'TextChild';
|
|
988
988
|
|
|
989
|
-
var _excluded$
|
|
989
|
+
var _excluded$7 = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "children", "className", "display", "alignItems", "justify"];
|
|
990
990
|
var _getModifierChild = function getModifierChild(tags, children) {
|
|
991
991
|
if (!tags.length) return children;
|
|
992
992
|
var nextTag = tags.slice(1, tags.length);
|
|
@@ -1033,7 +1033,7 @@ var TextComponent = function TextComponent(_ref) {
|
|
|
1033
1033
|
display = _ref$display === void 0 ? 'block' : _ref$display,
|
|
1034
1034
|
alignItems = _ref.alignItems,
|
|
1035
1035
|
justify = _ref.justify,
|
|
1036
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1036
|
+
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
1037
1037
|
var elements = {
|
|
1038
1038
|
h1: h1,
|
|
1039
1039
|
h2: h2,
|
|
@@ -1228,7 +1228,7 @@ var getColors = function getColors(palette, status) {
|
|
|
1228
1228
|
return colors[status];
|
|
1229
1229
|
};
|
|
1230
1230
|
|
|
1231
|
-
var _excluded$
|
|
1231
|
+
var _excluded$6 = ["label", "labelRight", "error", "color", "helperText", "type", "icon", "variant", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "onEnter", "autoComplete", "placeholder", "children", "disabled", "fullWidth", "required"];
|
|
1232
1232
|
var simulateChangeEvent = function simulateChangeEvent(el, event) {
|
|
1233
1233
|
return _objectSpread2(_objectSpread2({}, event), {}, {
|
|
1234
1234
|
target: el,
|
|
@@ -1275,7 +1275,7 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1275
1275
|
_ref$fullWidth = _ref.fullWidth,
|
|
1276
1276
|
fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
|
|
1277
1277
|
required = _ref.required,
|
|
1278
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1278
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
1279
1279
|
var theme$1 = theme.useTheme();
|
|
1280
1280
|
var _useScale = useScale(),
|
|
1281
1281
|
SCALES = _useScale.SCALES;
|
|
@@ -1429,7 +1429,7 @@ tuple('hover', 'click');
|
|
|
1429
1429
|
tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
|
|
1430
1430
|
tuple('start', 'center', 'end', 'left', 'right');
|
|
1431
1431
|
|
|
1432
|
-
var _excluded$
|
|
1432
|
+
var _excluded$5 = ["type", "disabled", "readOnly", "onFocus", "onBlur", "className", "initialValue", "onChange", "value", "placeholder", "helperText", "error", "label", "required", "resize"];
|
|
1433
1433
|
tuple('none', 'both', 'horizontal', 'vertical', 'initial', 'inherit');
|
|
1434
1434
|
var TextareaComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1435
1435
|
var _ref$type = _ref.type,
|
|
@@ -1453,7 +1453,7 @@ var TextareaComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1453
1453
|
required = _ref.required,
|
|
1454
1454
|
_ref$resize = _ref.resize,
|
|
1455
1455
|
resize = _ref$resize === void 0 ? 'none' : _ref$resize,
|
|
1456
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1456
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
1457
1457
|
var theme$1 = theme.useTheme();
|
|
1458
1458
|
var _useScale = useScale(),
|
|
1459
1459
|
SCALES = _useScale.SCALES;
|
|
@@ -1577,11 +1577,11 @@ var PasswordIcon = function PasswordIcon(_ref) {
|
|
|
1577
1577
|
};
|
|
1578
1578
|
var MemoPasswordIcon = /*#__PURE__*/React.memo(PasswordIcon);
|
|
1579
1579
|
|
|
1580
|
-
var _excluded$
|
|
1580
|
+
var _excluded$4 = ["hideToggle", "children"];
|
|
1581
1581
|
var InputPasswordComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
1582
1582
|
var hideToggle = _ref.hideToggle,
|
|
1583
1583
|
children = _ref.children,
|
|
1584
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1584
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
1585
1585
|
var _useScale = useScale(),
|
|
1586
1586
|
getAllScaleProps = _useScale.getAllScaleProps;
|
|
1587
1587
|
var inputRef = React.useRef(null);
|
|
@@ -3189,7 +3189,7 @@ var repositionCursor = function repositionCursor(_ref) {
|
|
|
3189
3189
|
};
|
|
3190
3190
|
};
|
|
3191
3191
|
|
|
3192
|
-
var _excluded = ["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"];
|
|
3192
|
+
var _excluded$3 = ["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"];
|
|
3193
3193
|
var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3194
3194
|
var _ref$allowDecimals = _ref.allowDecimals,
|
|
3195
3195
|
allowDecimals = _ref$allowDecimals === void 0 ? true : _ref$allowDecimals,
|
|
@@ -3231,7 +3231,7 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3231
3231
|
_ref$formatValueOnBlu = _ref.formatValueOnBlur,
|
|
3232
3232
|
formatValueOnBlur = _ref$formatValueOnBlu === void 0 ? true : _ref$formatValueOnBlu,
|
|
3233
3233
|
children = _ref.children,
|
|
3234
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
3234
|
+
props = _objectWithoutProperties(_ref, _excluded$3);
|
|
3235
3235
|
var _useScale = useScale(),
|
|
3236
3236
|
SCALES = _useScale.SCALES;
|
|
3237
3237
|
var theme$1 = theme.useTheme();
|
|
@@ -3533,11 +3533,243 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3533
3533
|
|
|
3534
3534
|
var CurrencyInput = withScale(InputCurrency);
|
|
3535
3535
|
|
|
3536
|
+
var _excluded$2 = ["xs", "sm", "md", "lg", "xl", "justify", "direction", "alignItems", "alignContent", "children", "className"];
|
|
3537
|
+
var getItemLayout = function getItemLayout(val) {
|
|
3538
|
+
var display = val === 0 ? 'display: none;' : 'display: inherit;';
|
|
3539
|
+
if (typeof val === 'number') {
|
|
3540
|
+
var width = 100 / 24 * val;
|
|
3541
|
+
var ratio = width > 100 ? '100%' : width < 0 ? '0' : "".concat(width, "%");
|
|
3542
|
+
return {
|
|
3543
|
+
grow: 0,
|
|
3544
|
+
display: display,
|
|
3545
|
+
width: ratio,
|
|
3546
|
+
basis: ratio
|
|
3547
|
+
};
|
|
3548
|
+
}
|
|
3549
|
+
return {
|
|
3550
|
+
grow: 1,
|
|
3551
|
+
display: display,
|
|
3552
|
+
width: '100%',
|
|
3553
|
+
basis: '0'
|
|
3554
|
+
};
|
|
3555
|
+
};
|
|
3556
|
+
var GridBasicItem = function GridBasicItem(_ref) {
|
|
3557
|
+
var _ref$xs = _ref.xs,
|
|
3558
|
+
xs = _ref$xs === void 0 ? false : _ref$xs,
|
|
3559
|
+
_ref$sm = _ref.sm,
|
|
3560
|
+
sm = _ref$sm === void 0 ? false : _ref$sm,
|
|
3561
|
+
_ref$md = _ref.md,
|
|
3562
|
+
md = _ref$md === void 0 ? false : _ref$md,
|
|
3563
|
+
_ref$lg = _ref.lg,
|
|
3564
|
+
lg = _ref$lg === void 0 ? false : _ref$lg,
|
|
3565
|
+
_ref$xl = _ref.xl,
|
|
3566
|
+
xl = _ref$xl === void 0 ? false : _ref$xl,
|
|
3567
|
+
justify = _ref.justify,
|
|
3568
|
+
direction = _ref.direction,
|
|
3569
|
+
alignItems = _ref.alignItems,
|
|
3570
|
+
alignContent = _ref.alignContent,
|
|
3571
|
+
children = _ref.children,
|
|
3572
|
+
_ref$className = _ref.className,
|
|
3573
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
3574
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
3575
|
+
var theme$1 = theme.useTheme();
|
|
3576
|
+
var _useScale = useScale(),
|
|
3577
|
+
SCALES = _useScale.SCALES;
|
|
3578
|
+
var classes = React.useMemo(function () {
|
|
3579
|
+
var aligns = {
|
|
3580
|
+
justify: justify,
|
|
3581
|
+
direction: direction,
|
|
3582
|
+
alignItems: alignItems,
|
|
3583
|
+
alignContent: alignContent,
|
|
3584
|
+
xs: xs,
|
|
3585
|
+
sm: sm,
|
|
3586
|
+
md: md,
|
|
3587
|
+
lg: lg,
|
|
3588
|
+
xl: xl
|
|
3589
|
+
};
|
|
3590
|
+
var classString = Object.keys(aligns).reduce(function (pre, name) {
|
|
3591
|
+
if (aligns[name] !== undefined && aligns[name] !== false) return "".concat(pre, " ").concat(name);
|
|
3592
|
+
return pre;
|
|
3593
|
+
}, '');
|
|
3594
|
+
return classString.trim();
|
|
3595
|
+
}, [justify, direction, alignItems, alignContent, xs, sm, md, lg, xl]);
|
|
3596
|
+
var layout = React.useMemo(function () {
|
|
3597
|
+
return {
|
|
3598
|
+
xs: getItemLayout(xs),
|
|
3599
|
+
sm: getItemLayout(sm),
|
|
3600
|
+
md: getItemLayout(md),
|
|
3601
|
+
lg: getItemLayout(lg),
|
|
3602
|
+
xl: getItemLayout(xl)
|
|
3603
|
+
};
|
|
3604
|
+
}, [xs, sm, md, lg, xl]);
|
|
3605
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
3606
|
+
className: _JSXStyle.dynamic([["568430467", [SCALES.font(1, 'inherit'), SCALES.height(1, 'auto'), justify, direction, alignContent, alignItems, layout.xs.grow, layout.xs.width, layout.xs.basis, layout.xs.display, theme$1.breakpoints.sm.min, layout.sm.grow, layout.sm.width, layout.sm.basis, layout.sm.display, theme$1.breakpoints.md.min, layout.md.grow, layout.md.width, layout.md.basis, layout.md.display, theme$1.breakpoints.lg.min, layout.lg.grow, layout.lg.width, layout.lg.basis, layout.lg.display, theme$1.breakpoints.xl.min, layout.xl.grow, layout.xl.width, layout.xl.basis, layout.xl.display]]]) + " " + (props && props.className != null && props.className || theme.useClasses('item', classes, className) || ""),
|
|
3607
|
+
children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
3608
|
+
id: "568430467",
|
|
3609
|
+
dynamic: [SCALES.font(1, 'inherit'), SCALES.height(1, 'auto'), justify, direction, alignContent, alignItems, layout.xs.grow, layout.xs.width, layout.xs.basis, layout.xs.display, theme$1.breakpoints.sm.min, layout.sm.grow, layout.sm.width, layout.sm.basis, layout.sm.display, theme$1.breakpoints.md.min, layout.md.grow, layout.md.width, layout.md.basis, layout.md.display, theme$1.breakpoints.lg.min, layout.lg.grow, layout.lg.width, layout.lg.basis, layout.lg.display, theme$1.breakpoints.xl.min, layout.xl.grow, layout.xl.width, layout.xl.basis, layout.xl.display],
|
|
3610
|
+
children: ".item.__jsx-style-dynamic-selector{font-size:".concat(SCALES.font(1, 'inherit'), ";height:").concat(SCALES.height(1, 'auto'), ";}.justify.__jsx-style-dynamic-selector{-webkit-box-pack:").concat(justify, ";-webkit-justify-content:").concat(justify, ";-ms-flex-pack:").concat(justify, ";justify-content:").concat(justify, ";}.direction.__jsx-style-dynamic-selector{-webkit-flex-direction:").concat(direction, ";-ms-flex-direction:").concat(direction, ";flex-direction:").concat(direction, ";}.alignContent.__jsx-style-dynamic-selector{-webkit-align-content:").concat(alignContent, ";-ms-flex-line-pack:").concat(alignContent, ";align-content:").concat(alignContent, ";}.alignItems.__jsx-style-dynamic-selector{-webkit-align-items:").concat(alignItems, ";-webkit-box-align:").concat(alignItems, ";-ms-flex-align:").concat(alignItems, ";align-items:").concat(alignItems, ";}.xs.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.xs.grow, ";-webkit-flex-grow:").concat(layout.xs.grow, ";-ms-flex-positive:").concat(layout.xs.grow, ";flex-grow:").concat(layout.xs.grow, ";max-width:").concat(layout.xs.width, ";-webkit-flex-basis:").concat(layout.xs.basis, ";-ms-flex-preferred-size:").concat(layout.xs.basis, ";flex-basis:").concat(layout.xs.basis, ";").concat(layout.xs.display, ";}@media only screen and (min-width:").concat(theme$1.breakpoints.sm.min, "){.sm.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.sm.grow, ";-webkit-flex-grow:").concat(layout.sm.grow, ";-ms-flex-positive:").concat(layout.sm.grow, ";flex-grow:").concat(layout.sm.grow, ";max-width:").concat(layout.sm.width, ";-webkit-flex-basis:").concat(layout.sm.basis, ";-ms-flex-preferred-size:").concat(layout.sm.basis, ";flex-basis:").concat(layout.sm.basis, ";").concat(layout.sm.display, ";}}@media only screen and (min-width:").concat(theme$1.breakpoints.md.min, "){.md.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.md.grow, ";-webkit-flex-grow:").concat(layout.md.grow, ";-ms-flex-positive:").concat(layout.md.grow, ";flex-grow:").concat(layout.md.grow, ";max-width:").concat(layout.md.width, ";-webkit-flex-basis:").concat(layout.md.basis, ";-ms-flex-preferred-size:").concat(layout.md.basis, ";flex-basis:").concat(layout.md.basis, ";").concat(layout.md.display, ";}}@media only screen and (min-width:").concat(theme$1.breakpoints.lg.min, "){.lg.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.lg.grow, ";-webkit-flex-grow:").concat(layout.lg.grow, ";-ms-flex-positive:").concat(layout.lg.grow, ";flex-grow:").concat(layout.lg.grow, ";max-width:").concat(layout.lg.width, ";-webkit-flex-basis:").concat(layout.lg.basis, ";-ms-flex-preferred-size:").concat(layout.lg.basis, ";flex-basis:").concat(layout.lg.basis, ";").concat(layout.lg.display, ";}}@media only screen and (min-width:").concat(theme$1.breakpoints.xl.min, "){.xl.__jsx-style-dynamic-selector{-webkit-box-flex:").concat(layout.xl.grow, ";-webkit-flex-grow:").concat(layout.xl.grow, ";-ms-flex-positive:").concat(layout.xl.grow, ";flex-grow:").concat(layout.xl.grow, ";max-width:").concat(layout.xl.width, ";-webkit-flex-basis:").concat(layout.xl.basis, ";-ms-flex-preferred-size:").concat(layout.xl.basis, ";flex-basis:").concat(layout.xl.basis, ";").concat(layout.xl.display, ";}}")
|
|
3611
|
+
})]
|
|
3612
|
+
}));
|
|
3613
|
+
};
|
|
3614
|
+
GridBasicItem.displayName = 'GridBasicItem';
|
|
3615
|
+
|
|
3616
|
+
var _excluded$1 = ["children", "className"];
|
|
3617
|
+
var GridComponent = function GridComponent(_ref) {
|
|
3618
|
+
var children = _ref.children,
|
|
3619
|
+
_ref$className = _ref.className,
|
|
3620
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
3621
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
3622
|
+
var _useScale = useScale(),
|
|
3623
|
+
SCALES = _useScale.SCALES;
|
|
3624
|
+
var _styles$className = {
|
|
3625
|
+
styles: /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
3626
|
+
id: "1271839607",
|
|
3627
|
+
dynamic: [SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0, 'var(--grid-gap-unit)'), SCALES.pr(0, 'var(--grid-gap-unit)'), SCALES.pb(0, 'var(--grid-gap-unit)'), SCALES.pl(0, 'var(--grid-gap-unit)')],
|
|
3628
|
+
children: "div.__jsx-style-dynamic-selector{margin:".concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";box-sizing:border-box;padding:").concat(SCALES.pt(0, 'var(--grid-gap-unit)'), " ").concat(SCALES.pr(0, 'var(--grid-gap-unit)'), " ").concat(SCALES.pb(0, 'var(--grid-gap-unit)'), " ").concat(SCALES.pl(0, 'var(--grid-gap-unit)'), ";}")
|
|
3629
|
+
}),
|
|
3630
|
+
className: _JSXStyle.dynamic([["1271839607", [SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.pt(0, 'var(--grid-gap-unit)'), SCALES.pr(0, 'var(--grid-gap-unit)'), SCALES.pb(0, 'var(--grid-gap-unit)'), SCALES.pl(0, 'var(--grid-gap-unit)')]]])
|
|
3631
|
+
},
|
|
3632
|
+
resolveClassName = _styles$className.className,
|
|
3633
|
+
styles = _styles$className.styles;
|
|
3634
|
+
var classes = theme.useClasses(resolveClassName, className);
|
|
3635
|
+
return /*#__PURE__*/jsxRuntime.jsxs(GridBasicItem, _objectSpread2(_objectSpread2({
|
|
3636
|
+
className: classes
|
|
3637
|
+
}, props), {}, {
|
|
3638
|
+
children: [children, styles]
|
|
3639
|
+
}));
|
|
3640
|
+
};
|
|
3641
|
+
GridComponent.displayName = 'Grid';
|
|
3642
|
+
var Grid = withScale(GridComponent);
|
|
3643
|
+
|
|
3644
|
+
var _excluded = ["gap", "wrap", "children", "className"];
|
|
3645
|
+
var GridContainerComponent = function GridContainerComponent(_ref) {
|
|
3646
|
+
var _ref$gap = _ref.gap,
|
|
3647
|
+
gap = _ref$gap === void 0 ? 0 : _ref$gap,
|
|
3648
|
+
_ref$wrap = _ref.wrap,
|
|
3649
|
+
wrap = _ref$wrap === void 0 ? 'wrap' : _ref$wrap,
|
|
3650
|
+
children = _ref.children,
|
|
3651
|
+
_ref$className = _ref.className,
|
|
3652
|
+
className = _ref$className === void 0 ? '' : _ref$className,
|
|
3653
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
3654
|
+
var _useScale = useScale(),
|
|
3655
|
+
unit = _useScale.unit,
|
|
3656
|
+
SCALES = _useScale.SCALES;
|
|
3657
|
+
var gapUnit = React.useMemo(function () {
|
|
3658
|
+
return "calc(".concat(gap, " * ").concat(unit, " * 1/3)");
|
|
3659
|
+
}, [gap, unit]);
|
|
3660
|
+
var _styles$className = {
|
|
3661
|
+
styles: /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
|
|
3662
|
+
id: "3631618093",
|
|
3663
|
+
dynamic: [gapUnit, wrap, SCALES.width(1, 'var(--grid-container-width)'), SCALES.mt(0, 'var(--grid-container-margin)'), SCALES.mr(0, 'var(--grid-container-margin)'), SCALES.mb(0, 'var(--grid-container-margin)'), SCALES.ml(0, 'var(--grid-container-margin)')],
|
|
3664
|
+
children: "div.__jsx-style-dynamic-selector{--grid-gap-unit:".concat(gapUnit, ";--grid-container-margin:calc(-1 * var(--grid-gap-unit));--grid-container-width:calc(100% + var(--grid-gap-unit) * 2);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:").concat(wrap, ";-ms-flex-wrap:").concat(wrap, ";flex-wrap:").concat(wrap, ";box-sizing:border-box;width:").concat(SCALES.width(1, 'var(--grid-container-width)'), ";margin:").concat(SCALES.mt(0, 'var(--grid-container-margin)'), " ").concat(SCALES.mr(0, 'var(--grid-container-margin)'), " ").concat(SCALES.mb(0, 'var(--grid-container-margin)'), " ").concat(SCALES.ml(0, 'var(--grid-container-margin)'), ";}")
|
|
3665
|
+
}),
|
|
3666
|
+
className: _JSXStyle.dynamic([["3631618093", [gapUnit, wrap, SCALES.width(1, 'var(--grid-container-width)'), SCALES.mt(0, 'var(--grid-container-margin)'), SCALES.mr(0, 'var(--grid-container-margin)'), SCALES.mb(0, 'var(--grid-container-margin)'), SCALES.ml(0, 'var(--grid-container-margin)')]]])
|
|
3667
|
+
},
|
|
3668
|
+
resolveClassName = _styles$className.className,
|
|
3669
|
+
styles = _styles$className.styles;
|
|
3670
|
+
var classes = theme.useClasses(resolveClassName, className);
|
|
3671
|
+
return /*#__PURE__*/jsxRuntime.jsxs(GridBasicItem, _objectSpread2(_objectSpread2({
|
|
3672
|
+
className: classes
|
|
3673
|
+
}, props), {}, {
|
|
3674
|
+
children: [children, styles]
|
|
3675
|
+
}));
|
|
3676
|
+
};
|
|
3677
|
+
GridContainerComponent.displayName = 'GridContainer';
|
|
3678
|
+
var GridContainer = withScale(GridContainerComponent);
|
|
3679
|
+
|
|
3680
|
+
Grid.Container = GridContainer;
|
|
3681
|
+
|
|
3682
|
+
function parseCurrency(value) {
|
|
3683
|
+
var _trimmed$match;
|
|
3684
|
+
var trimmed = value.trim();
|
|
3685
|
+
|
|
3686
|
+
// Extract currency symbol
|
|
3687
|
+
var currencySymbol = ((_trimmed$match = trimmed.match(/[^\d.,\s]/)) === null || _trimmed$match === void 0 ? void 0 : _trimmed$match[0]) || "";
|
|
3688
|
+
|
|
3689
|
+
// Remove everything except digits, comma, dot
|
|
3690
|
+
var numericPart = trimmed.replace(/[^\d.,]/g, "");
|
|
3691
|
+
|
|
3692
|
+
// Convert comma to dot if needed
|
|
3693
|
+
var normalized = numericPart.replace(",", ".");
|
|
3694
|
+
return {
|
|
3695
|
+
amount: Number(normalized),
|
|
3696
|
+
currency: currencySymbol
|
|
3697
|
+
};
|
|
3698
|
+
}
|
|
3699
|
+
function CurrencyRangeInput(_ref) {
|
|
3700
|
+
var prefix = _ref.prefix,
|
|
3701
|
+
allowDecimals = _ref.allowDecimals,
|
|
3702
|
+
onChange = _ref.onChange,
|
|
3703
|
+
intlConfig = _ref.intlConfig,
|
|
3704
|
+
children = _ref.children;
|
|
3705
|
+
var _React$useState = React.useState({
|
|
3706
|
+
min: '0',
|
|
3707
|
+
max: '0',
|
|
3708
|
+
currency: ''
|
|
3709
|
+
}),
|
|
3710
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3711
|
+
value = _React$useState2[0],
|
|
3712
|
+
setValue = _React$useState2[1];
|
|
3713
|
+
React.useEffect(function () {
|
|
3714
|
+
var min = parseCurrency(value.min);
|
|
3715
|
+
var max = parseCurrency(value.max);
|
|
3716
|
+
if (max.amount > min.amount) {
|
|
3717
|
+
if (onChange) onChange({
|
|
3718
|
+
target: {
|
|
3719
|
+
value: {
|
|
3720
|
+
min: min.amount,
|
|
3721
|
+
max: max.amount,
|
|
3722
|
+
currency: min.currency
|
|
3723
|
+
}
|
|
3724
|
+
}
|
|
3725
|
+
});
|
|
3726
|
+
}
|
|
3727
|
+
}, [value]);
|
|
3728
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3729
|
+
className: "with-label",
|
|
3730
|
+
children: [children && /*#__PURE__*/jsxRuntime.jsx(InputBlockLabel, {
|
|
3731
|
+
children: children
|
|
3732
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(Grid.Container, {
|
|
3733
|
+
gap: 2,
|
|
3734
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Grid, {
|
|
3735
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Input.Currency, {
|
|
3736
|
+
onChange: function onChange(e) {
|
|
3737
|
+
return setValue(function (prev) {
|
|
3738
|
+
return _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
3739
|
+
min: e.target.value
|
|
3740
|
+
});
|
|
3741
|
+
});
|
|
3742
|
+
},
|
|
3743
|
+
intlConfig: intlConfig,
|
|
3744
|
+
prefix: prefix,
|
|
3745
|
+
placeholder: "Min",
|
|
3746
|
+
allowDecimals: allowDecimals
|
|
3747
|
+
})
|
|
3748
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Grid, {
|
|
3749
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Input.Currency, {
|
|
3750
|
+
onChange: function onChange(e) {
|
|
3751
|
+
return setValue(function (prev) {
|
|
3752
|
+
return _objectSpread2(_objectSpread2({}, prev), {}, {
|
|
3753
|
+
max: e.target.value
|
|
3754
|
+
});
|
|
3755
|
+
});
|
|
3756
|
+
},
|
|
3757
|
+
intlConfig: intlConfig,
|
|
3758
|
+
prefix: prefix,
|
|
3759
|
+
placeholder: "Max",
|
|
3760
|
+
allowDecimals: allowDecimals
|
|
3761
|
+
})
|
|
3762
|
+
})]
|
|
3763
|
+
})]
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3766
|
+
|
|
3536
3767
|
/* "use client" */
|
|
3537
3768
|
Input.Textarea = Textarea;
|
|
3538
3769
|
Input.Password = InputPassword;
|
|
3539
3770
|
Input.Phone = PhoneInput$1;
|
|
3540
3771
|
Input.Currency = CurrencyInput;
|
|
3772
|
+
Input.CurrencyRange = CurrencyRangeInput;
|
|
3541
3773
|
|
|
3542
3774
|
exports.InputError = InputError;
|
|
3543
3775
|
exports.InputLabel = InputBlockLabel;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CurrencyInputProps } from "./input-currency-props";
|
|
2
|
+
import React from "react";
|
|
3
|
+
type Override<T, U> = Omit<T, keyof U> & U;
|
|
4
|
+
type CurrencyRangeProps = Override<CurrencyInputProps, {
|
|
5
|
+
onChange: (e: any) => void;
|
|
6
|
+
}>;
|
|
7
|
+
declare function CurrencyRangeInput({ prefix, allowDecimals, onChange, intlConfig, children }: CurrencyRangeProps): React.JSX.Element;
|
|
8
|
+
export default CurrencyRangeInput;
|