@helpdice/ui 2.6.0 → 2.6.1-beta.1

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.
@@ -3583,11 +3583,244 @@ var InputCurrency = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3583
3583
 
3584
3584
  var CurrencyInput = withScale(InputCurrency);
3585
3585
 
3586
+ var _excluded$c = ["xs", "sm", "md", "lg", "xl", "justify", "direction", "alignItems", "alignContent", "children", "className"];
3587
+ var getItemLayout = function getItemLayout(val) {
3588
+ var display = val === 0 ? 'display: none;' : 'display: inherit;';
3589
+ if (typeof val === 'number') {
3590
+ var width = 100 / 24 * val;
3591
+ var ratio = width > 100 ? '100%' : width < 0 ? '0' : "".concat(width, "%");
3592
+ return {
3593
+ grow: 0,
3594
+ display: display,
3595
+ width: ratio,
3596
+ basis: ratio
3597
+ };
3598
+ }
3599
+ return {
3600
+ grow: 1,
3601
+ display: display,
3602
+ width: '100%',
3603
+ basis: '0'
3604
+ };
3605
+ };
3606
+ var GridBasicItem = function GridBasicItem(_ref) {
3607
+ var _ref$xs = _ref.xs,
3608
+ xs = _ref$xs === void 0 ? false : _ref$xs,
3609
+ _ref$sm = _ref.sm,
3610
+ sm = _ref$sm === void 0 ? false : _ref$sm,
3611
+ _ref$md = _ref.md,
3612
+ md = _ref$md === void 0 ? false : _ref$md,
3613
+ _ref$lg = _ref.lg,
3614
+ lg = _ref$lg === void 0 ? false : _ref$lg,
3615
+ _ref$xl = _ref.xl,
3616
+ xl = _ref$xl === void 0 ? false : _ref$xl,
3617
+ justify = _ref.justify,
3618
+ direction = _ref.direction,
3619
+ alignItems = _ref.alignItems,
3620
+ alignContent = _ref.alignContent,
3621
+ children = _ref.children,
3622
+ _ref$className = _ref.className,
3623
+ className = _ref$className === void 0 ? '' : _ref$className,
3624
+ props = _objectWithoutProperties(_ref, _excluded$c);
3625
+ var theme$1 = theme.useTheme();
3626
+ var _useScale = useScale(),
3627
+ SCALES = _useScale.SCALES;
3628
+ var classes = React.useMemo(function () {
3629
+ var aligns = {
3630
+ justify: justify,
3631
+ direction: direction,
3632
+ alignItems: alignItems,
3633
+ alignContent: alignContent,
3634
+ xs: xs,
3635
+ sm: sm,
3636
+ md: md,
3637
+ lg: lg,
3638
+ xl: xl
3639
+ };
3640
+ var classString = Object.keys(aligns).reduce(function (pre, name) {
3641
+ if (aligns[name] !== undefined && aligns[name] !== false) return "".concat(pre, " ").concat(name);
3642
+ return pre;
3643
+ }, '');
3644
+ return classString.trim();
3645
+ }, [justify, direction, alignItems, alignContent, xs, sm, md, lg, xl]);
3646
+ var layout = React.useMemo(function () {
3647
+ return {
3648
+ xs: getItemLayout(xs),
3649
+ sm: getItemLayout(sm),
3650
+ md: getItemLayout(md),
3651
+ lg: getItemLayout(lg),
3652
+ xl: getItemLayout(xl)
3653
+ };
3654
+ }, [xs, sm, md, lg, xl]);
3655
+ return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread2(_objectSpread2({}, props), {}, {
3656
+ 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) || ""),
3657
+ children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
3658
+ id: "568430467",
3659
+ 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],
3660
+ 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, ";}}")
3661
+ })]
3662
+ }));
3663
+ };
3664
+ GridBasicItem.displayName = 'GridBasicItem';
3665
+
3666
+ var _excluded$b = ["children", "className"];
3667
+ var GridComponent = function GridComponent(_ref) {
3668
+ var children = _ref.children,
3669
+ _ref$className = _ref.className,
3670
+ className = _ref$className === void 0 ? '' : _ref$className,
3671
+ props = _objectWithoutProperties(_ref, _excluded$b);
3672
+ var _useScale = useScale(),
3673
+ SCALES = _useScale.SCALES;
3674
+ var _styles$className = {
3675
+ styles: /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
3676
+ id: "1271839607",
3677
+ 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)')],
3678
+ 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)'), ";}")
3679
+ }),
3680
+ 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)')]]])
3681
+ },
3682
+ resolveClassName = _styles$className.className,
3683
+ styles = _styles$className.styles;
3684
+ var classes = theme.useClasses(resolveClassName, className);
3685
+ return /*#__PURE__*/jsxRuntime.jsxs(GridBasicItem, _objectSpread2(_objectSpread2({
3686
+ className: classes
3687
+ }, props), {}, {
3688
+ children: [children, styles]
3689
+ }));
3690
+ };
3691
+ GridComponent.displayName = 'Grid';
3692
+ var Grid = withScale(GridComponent);
3693
+
3694
+ var _excluded$a = ["gap", "wrap", "children", "className"];
3695
+ var GridContainerComponent = function GridContainerComponent(_ref) {
3696
+ var _ref$gap = _ref.gap,
3697
+ gap = _ref$gap === void 0 ? 0 : _ref$gap,
3698
+ _ref$wrap = _ref.wrap,
3699
+ wrap = _ref$wrap === void 0 ? 'wrap' : _ref$wrap,
3700
+ children = _ref.children,
3701
+ _ref$className = _ref.className,
3702
+ className = _ref$className === void 0 ? '' : _ref$className,
3703
+ props = _objectWithoutProperties(_ref, _excluded$a);
3704
+ var _useScale = useScale(),
3705
+ unit = _useScale.unit,
3706
+ SCALES = _useScale.SCALES;
3707
+ var gapUnit = React.useMemo(function () {
3708
+ return "calc(".concat(gap, " * ").concat(unit, " * 1/3)");
3709
+ }, [gap, unit]);
3710
+ var _styles$className = {
3711
+ styles: /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
3712
+ id: "3631618093",
3713
+ 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)')],
3714
+ 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)'), ";}")
3715
+ }),
3716
+ 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)')]]])
3717
+ },
3718
+ resolveClassName = _styles$className.className,
3719
+ styles = _styles$className.styles;
3720
+ var classes = theme.useClasses(resolveClassName, className);
3721
+ return /*#__PURE__*/jsxRuntime.jsxs(GridBasicItem, _objectSpread2(_objectSpread2({
3722
+ className: classes
3723
+ }, props), {}, {
3724
+ children: [children, styles]
3725
+ }));
3726
+ };
3727
+ GridContainerComponent.displayName = 'GridContainer';
3728
+ var GridContainer = withScale(GridContainerComponent);
3729
+
3730
+ Grid.Container = GridContainer;
3731
+
3732
+ function parseCurrency(value) {
3733
+ var _trimmed$match;
3734
+ var trimmed = value.trim();
3735
+
3736
+ // Extract currency symbol
3737
+ var currencySymbol = ((_trimmed$match = trimmed.match(/[^\d.,\s]/)) === null || _trimmed$match === void 0 ? void 0 : _trimmed$match[0]) || "";
3738
+
3739
+ // Remove everything except digits, comma, dot
3740
+ var numericPart = trimmed.replace(/[^\d.,]/g, "");
3741
+
3742
+ // Convert comma to dot if needed
3743
+ var normalized = numericPart.replace(",", ".");
3744
+ return {
3745
+ amount: Number(normalized),
3746
+ currency: currencySymbol
3747
+ };
3748
+ }
3749
+ function CurrencyRangeInput(_ref) {
3750
+ var prefix = _ref.prefix,
3751
+ allowDecimals = _ref.allowDecimals,
3752
+ onChange = _ref.onChange,
3753
+ intlConfig = _ref.intlConfig,
3754
+ children = _ref.children,
3755
+ error = _ref.error,
3756
+ helperText = _ref.helperText;
3757
+ var _React$useState = React.useState({
3758
+ min: '0',
3759
+ max: '0',
3760
+ currency: ''
3761
+ }),
3762
+ _React$useState2 = _slicedToArray(_React$useState, 2),
3763
+ value = _React$useState2[0],
3764
+ setValue = _React$useState2[1];
3765
+ React.useEffect(function () {
3766
+ var min = parseCurrency(value.min);
3767
+ var max = parseCurrency(value.max);
3768
+ if (max.amount > min.amount) {
3769
+ if (onChange) onChange({
3770
+ min: min.amount,
3771
+ max: max.amount,
3772
+ currency: min.currency
3773
+ });
3774
+ }
3775
+ }, [value]);
3776
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
3777
+ className: "with-label",
3778
+ children: [children && /*#__PURE__*/jsxRuntime.jsx(InputBlockLabel, {
3779
+ children: children
3780
+ }), /*#__PURE__*/jsxRuntime.jsxs(Grid.Container, {
3781
+ gap: 2,
3782
+ children: [/*#__PURE__*/jsxRuntime.jsx(Grid, {
3783
+ children: /*#__PURE__*/jsxRuntime.jsx(Input.Currency, {
3784
+ onChange: function onChange(e) {
3785
+ return setValue(function (prev) {
3786
+ return _objectSpread2(_objectSpread2({}, prev), {}, {
3787
+ min: e.target.value
3788
+ });
3789
+ });
3790
+ },
3791
+ intlConfig: intlConfig,
3792
+ prefix: prefix,
3793
+ placeholder: "Min",
3794
+ allowDecimals: allowDecimals
3795
+ })
3796
+ }), /*#__PURE__*/jsxRuntime.jsx(Grid, {
3797
+ children: /*#__PURE__*/jsxRuntime.jsx(Input.Currency, {
3798
+ onChange: function onChange(e) {
3799
+ return setValue(function (prev) {
3800
+ return _objectSpread2(_objectSpread2({}, prev), {}, {
3801
+ max: e.target.value
3802
+ });
3803
+ });
3804
+ },
3805
+ intlConfig: intlConfig,
3806
+ prefix: prefix,
3807
+ placeholder: "Max",
3808
+ allowDecimals: allowDecimals
3809
+ })
3810
+ })]
3811
+ }), helperText && /*#__PURE__*/jsxRuntime.jsx(InputError, {
3812
+ error: error,
3813
+ text: helperText
3814
+ })]
3815
+ });
3816
+ }
3817
+
3586
3818
  /* "use client" */
3587
3819
  Input.Textarea = Textarea;
3588
3820
  Input.Password = InputPassword;
3589
3821
  Input.Phone = PhoneInput$1;
3590
3822
  Input.Currency = CurrencyInput;
3823
+ Input.CurrencyRange = CurrencyRangeInput;
3591
3824
 
3592
3825
  var lodash$1 = {exports: {}};
3593
3826
 
@@ -20869,152 +21102,6 @@ var SelectDropdown = /*#__PURE__*/React.forwardRef(function (_ref, dropdownRef)
20869
21102
  });
20870
21103
  SelectDropdown.displayName = 'SelectDropdown';
20871
21104
 
20872
- var _excluded$c = ["xs", "sm", "md", "lg", "xl", "justify", "direction", "alignItems", "alignContent", "children", "className"];
20873
- var getItemLayout = function getItemLayout(val) {
20874
- var display = val === 0 ? 'display: none;' : 'display: inherit;';
20875
- if (typeof val === 'number') {
20876
- var width = 100 / 24 * val;
20877
- var ratio = width > 100 ? '100%' : width < 0 ? '0' : "".concat(width, "%");
20878
- return {
20879
- grow: 0,
20880
- display: display,
20881
- width: ratio,
20882
- basis: ratio
20883
- };
20884
- }
20885
- return {
20886
- grow: 1,
20887
- display: display,
20888
- width: '100%',
20889
- basis: '0'
20890
- };
20891
- };
20892
- var GridBasicItem = function GridBasicItem(_ref) {
20893
- var _ref$xs = _ref.xs,
20894
- xs = _ref$xs === void 0 ? false : _ref$xs,
20895
- _ref$sm = _ref.sm,
20896
- sm = _ref$sm === void 0 ? false : _ref$sm,
20897
- _ref$md = _ref.md,
20898
- md = _ref$md === void 0 ? false : _ref$md,
20899
- _ref$lg = _ref.lg,
20900
- lg = _ref$lg === void 0 ? false : _ref$lg,
20901
- _ref$xl = _ref.xl,
20902
- xl = _ref$xl === void 0 ? false : _ref$xl,
20903
- justify = _ref.justify,
20904
- direction = _ref.direction,
20905
- alignItems = _ref.alignItems,
20906
- alignContent = _ref.alignContent,
20907
- children = _ref.children,
20908
- _ref$className = _ref.className,
20909
- className = _ref$className === void 0 ? '' : _ref$className,
20910
- props = _objectWithoutProperties(_ref, _excluded$c);
20911
- var theme$1 = theme.useTheme();
20912
- var _useScale = useScale(),
20913
- SCALES = _useScale.SCALES;
20914
- var classes = React.useMemo(function () {
20915
- var aligns = {
20916
- justify: justify,
20917
- direction: direction,
20918
- alignItems: alignItems,
20919
- alignContent: alignContent,
20920
- xs: xs,
20921
- sm: sm,
20922
- md: md,
20923
- lg: lg,
20924
- xl: xl
20925
- };
20926
- var classString = Object.keys(aligns).reduce(function (pre, name) {
20927
- if (aligns[name] !== undefined && aligns[name] !== false) return "".concat(pre, " ").concat(name);
20928
- return pre;
20929
- }, '');
20930
- return classString.trim();
20931
- }, [justify, direction, alignItems, alignContent, xs, sm, md, lg, xl]);
20932
- var layout = React.useMemo(function () {
20933
- return {
20934
- xs: getItemLayout(xs),
20935
- sm: getItemLayout(sm),
20936
- md: getItemLayout(md),
20937
- lg: getItemLayout(lg),
20938
- xl: getItemLayout(xl)
20939
- };
20940
- }, [xs, sm, md, lg, xl]);
20941
- return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread2(_objectSpread2({}, props), {}, {
20942
- 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) || ""),
20943
- children: [children, /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
20944
- id: "568430467",
20945
- 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],
20946
- 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, ";}}")
20947
- })]
20948
- }));
20949
- };
20950
- GridBasicItem.displayName = 'GridBasicItem';
20951
-
20952
- var _excluded$b = ["children", "className"];
20953
- var GridComponent = function GridComponent(_ref) {
20954
- var children = _ref.children,
20955
- _ref$className = _ref.className,
20956
- className = _ref$className === void 0 ? '' : _ref$className,
20957
- props = _objectWithoutProperties(_ref, _excluded$b);
20958
- var _useScale = useScale(),
20959
- SCALES = _useScale.SCALES;
20960
- var _styles$className = {
20961
- styles: /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
20962
- id: "1271839607",
20963
- 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)')],
20964
- 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)'), ";}")
20965
- }),
20966
- 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)')]]])
20967
- },
20968
- resolveClassName = _styles$className.className,
20969
- styles = _styles$className.styles;
20970
- var classes = theme.useClasses(resolveClassName, className);
20971
- return /*#__PURE__*/jsxRuntime.jsxs(GridBasicItem, _objectSpread2(_objectSpread2({
20972
- className: classes
20973
- }, props), {}, {
20974
- children: [children, styles]
20975
- }));
20976
- };
20977
- GridComponent.displayName = 'Grid';
20978
- var Grid = withScale(GridComponent);
20979
-
20980
- var _excluded$a = ["gap", "wrap", "children", "className"];
20981
- var GridContainerComponent = function GridContainerComponent(_ref) {
20982
- var _ref$gap = _ref.gap,
20983
- gap = _ref$gap === void 0 ? 0 : _ref$gap,
20984
- _ref$wrap = _ref.wrap,
20985
- wrap = _ref$wrap === void 0 ? 'wrap' : _ref$wrap,
20986
- children = _ref.children,
20987
- _ref$className = _ref.className,
20988
- className = _ref$className === void 0 ? '' : _ref$className,
20989
- props = _objectWithoutProperties(_ref, _excluded$a);
20990
- var _useScale = useScale(),
20991
- unit = _useScale.unit,
20992
- SCALES = _useScale.SCALES;
20993
- var gapUnit = React.useMemo(function () {
20994
- return "calc(".concat(gap, " * ").concat(unit, " * 1/3)");
20995
- }, [gap, unit]);
20996
- var _styles$className = {
20997
- styles: /*#__PURE__*/jsxRuntime.jsx(_JSXStyle, {
20998
- id: "3631618093",
20999
- 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)')],
21000
- 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)'), ";}")
21001
- }),
21002
- 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)')]]])
21003
- },
21004
- resolveClassName = _styles$className.className,
21005
- styles = _styles$className.styles;
21006
- var classes = theme.useClasses(resolveClassName, className);
21007
- return /*#__PURE__*/jsxRuntime.jsxs(GridBasicItem, _objectSpread2(_objectSpread2({
21008
- className: classes
21009
- }, props), {}, {
21010
- children: [children, styles]
21011
- }));
21012
- };
21013
- GridContainerComponent.displayName = 'GridContainer';
21014
- var GridContainer = withScale(GridContainerComponent);
21015
-
21016
- Grid.Container = GridContainer;
21017
-
21018
21105
  var SelectIconClear = function SelectIconClear(_ref) {
21019
21106
  var onClick = _ref.onClick;
21020
21107
  var theme$1 = theme.useTheme();
@@ -31,6 +31,7 @@ var Expandable = function Expandable(_ref) {
31
31
 
32
32
  // Measure content height and detect overflow
33
33
  useEffect(function () {
34
+ var _contentRef$current$q, _contentRef$current;
34
35
  var el = contentRef.current;
35
36
  if (!el) return;
36
37
  var updateHeight = function updateHeight() {
@@ -44,6 +45,12 @@ var Expandable = function Expandable(_ref) {
44
45
  setFadeColor(parentBg || "#fff");
45
46
  };
46
47
  updateHeight();
48
+ var images = (_contentRef$current$q = (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.querySelectorAll("img")) !== null && _contentRef$current$q !== void 0 ? _contentRef$current$q : [];
49
+ if (images) {
50
+ images.forEach(function (img) {
51
+ return img.addEventListener("load", updateHeight);
52
+ });
53
+ }
47
54
  var observer = new ResizeObserver(updateHeight);
48
55
  observer.observe(el);
49
56
  return function () {
@@ -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';
@@ -4,10 +4,12 @@ import Textarea from '../textarea';
4
4
  import InputPassword from './password';
5
5
  import PhoneInput from './input-phone';
6
6
  import CurrencyInput from './input-currency';
7
+ import CurrencyRangeInput from './input-currency-range';
7
8
  Input.Textarea = Textarea;
8
9
  Input.Password = InputPassword;
9
10
  Input.Phone = PhoneInput;
10
11
  Input.Currency = CurrencyInput;
12
+ Input.CurrencyRange = CurrencyRangeInput;
11
13
  export { getColors } from './styles';
12
14
  export { default as InputLabel, InputError } from "./input-block-label";
13
15
  export default Input;
@@ -0,0 +1,10 @@
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: (val: any) => void;
6
+ error?: boolean;
7
+ helperText?: string;
8
+ }>;
9
+ declare function CurrencyRangeInput({ prefix, allowDecimals, onChange, intlConfig, children, error, helperText }: CurrencyRangeProps): React.JSX.Element;
10
+ export default CurrencyRangeInput;
@@ -0,0 +1,84 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import Grid from "../grid";
4
+ import Input from ".";
5
+ import React, { useEffect } from "react";
6
+ import InputBlockLabel, { InputError } from "./input-block-label";
7
+ function parseCurrency(value) {
8
+ var _trimmed$match;
9
+ var trimmed = value.trim();
10
+
11
+ // Extract currency symbol
12
+ var currencySymbol = ((_trimmed$match = trimmed.match(/[^\d.,\s]/)) === null || _trimmed$match === void 0 ? void 0 : _trimmed$match[0]) || "";
13
+
14
+ // Remove everything except digits, comma, dot
15
+ var numericPart = trimmed.replace(/[^\d.,]/g, "");
16
+
17
+ // Convert comma to dot if needed
18
+ var normalized = numericPart.replace(",", ".");
19
+ return {
20
+ amount: Number(normalized),
21
+ currency: currencySymbol
22
+ };
23
+ }
24
+ function CurrencyRangeInput(_ref) {
25
+ var prefix = _ref.prefix,
26
+ allowDecimals = _ref.allowDecimals,
27
+ onChange = _ref.onChange,
28
+ intlConfig = _ref.intlConfig,
29
+ children = _ref.children,
30
+ error = _ref.error,
31
+ helperText = _ref.helperText;
32
+ var _React$useState = React.useState({
33
+ min: '0',
34
+ max: '0',
35
+ currency: ''
36
+ }),
37
+ _React$useState2 = _slicedToArray(_React$useState, 2),
38
+ value = _React$useState2[0],
39
+ setValue = _React$useState2[1];
40
+ useEffect(function () {
41
+ var min = parseCurrency(value.min);
42
+ var max = parseCurrency(value.max);
43
+ if (max.amount > min.amount) {
44
+ if (onChange) onChange({
45
+ min: min.amount,
46
+ max: max.amount,
47
+ currency: min.currency
48
+ });
49
+ }
50
+ }, [value]);
51
+ return /*#__PURE__*/React.createElement("div", {
52
+ className: "with-label"
53
+ }, children && /*#__PURE__*/React.createElement(InputBlockLabel, null, children), /*#__PURE__*/React.createElement(Grid.Container, {
54
+ gap: 2
55
+ }, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Input.Currency, {
56
+ onChange: function onChange(e) {
57
+ return setValue(function (prev) {
58
+ return _extends({}, prev, {
59
+ min: e.target.value
60
+ });
61
+ });
62
+ },
63
+ intlConfig: intlConfig,
64
+ prefix: prefix,
65
+ placeholder: "Min",
66
+ allowDecimals: allowDecimals
67
+ })), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Input.Currency, {
68
+ onChange: function onChange(e) {
69
+ return setValue(function (prev) {
70
+ return _extends({}, prev, {
71
+ max: e.target.value
72
+ });
73
+ });
74
+ },
75
+ intlConfig: intlConfig,
76
+ prefix: prefix,
77
+ placeholder: "Max",
78
+ allowDecimals: allowDecimals
79
+ }))), helperText && /*#__PURE__*/React.createElement(InputError, {
80
+ error: error,
81
+ text: helperText
82
+ }));
83
+ }
84
+ export default CurrencyRangeInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpdice/ui",
3
- "version": "2.6.0",
3
+ "version": "2.6.1-beta.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "unpkg": "dist/index.min.js",