colibri-ui 0.8.11 → 0.8.13

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/Counter/index.js CHANGED
@@ -26,9 +26,14 @@ var Counter = function Counter(_a) {
26
26
  onChange = _a.onChange,
27
27
  disabled = _a.disabled,
28
28
  className = _a.className;
29
- var lastNumValue = React.useRef(value);
30
29
  var minusDisabled = disabled || value <= min;
31
30
  var plusDisabled = disabled || value >= max;
31
+ var handleChange = function handleChange(delta) {
32
+ if (disabled) return;
33
+ var newValue = value + delta;
34
+ if (newValue < min || newValue > max) return;
35
+ onChange(newValue);
36
+ };
32
37
  return /*#__PURE__*/React__default.default.createElement("div", {
33
38
  className: clx(styles__default.default.root, {
34
39
  root_fullWidth: fullWidth ? 1 : 0
@@ -44,10 +49,9 @@ var Counter = function Counter(_a) {
44
49
  }),
45
50
  disabled: minusDisabled,
46
51
  type: "button",
47
- onClick: function onClick(e) {
48
- e.stopPropagation();
49
- onChange(value - 1);
50
- lastNumValue.current = value - 1;
52
+ onClick: function onClick(event) {
53
+ event.stopPropagation();
54
+ handleChange(-1);
51
55
  },
52
56
  "aria-label": "decrease"
53
57
  }), /*#__PURE__*/React__default.default.createElement("div", {
@@ -59,10 +63,9 @@ var Counter = function Counter(_a) {
59
63
  }),
60
64
  disabled: plusDisabled,
61
65
  type: "button",
62
- onClick: function onClick(e) {
63
- e.stopPropagation();
64
- onChange(value + 1);
65
- lastNumValue.current = value + 1;
66
+ onClick: function onClick(event) {
67
+ event.stopPropagation();
68
+ handleChange(1);
66
69
  },
67
70
  "aria-label": "increase"
68
71
  })));
@@ -40,6 +40,7 @@ var MultiSelect = function MultiSelect(_a) {
40
40
  required = _a.required,
41
41
  label = _a.label,
42
42
  hint = _a.hint,
43
+ style = _a.style,
43
44
  hasError = _a.hasError,
44
45
  _c = _a.size,
45
46
  size = _c === void 0 ? "m" : _c,
@@ -127,6 +128,7 @@ var MultiSelect = function MultiSelect(_a) {
127
128
  }, /*#__PURE__*/React__default.default.createElement(index$4.default, {
128
129
  hasError: hasError,
129
130
  size: size,
131
+ style: style,
130
132
  className: clx(styles__default.default.root, {
131
133
  root_auto: preparedLabel.length
132
134
  }),
@@ -1,3 +1,4 @@
1
+ import { CSSProperties } from "react";
1
2
  import type { FormFieldProps } from "../base/FormField/index.props";
2
3
  export type GroupOptions = {
3
4
  value: string;
@@ -31,6 +32,7 @@ export interface MultiSelectProps extends Omit<FormFieldProps, "children"> {
31
32
  placeholder?: string;
32
33
  name?: string;
33
34
  type?: Type;
35
+ style?: CSSProperties;
34
36
  value?: SelectedItem[];
35
37
  onChange?: (value: SelectedItem[]) => void;
36
38
  }
@@ -1,4 +1,4 @@
1
- import React__default, { useRef } from 'react';
1
+ import React__default from 'react';
2
2
  import classNames from 'classnames/bind';
3
3
  import Button from '../Button/index.js';
4
4
  import MinusIcon from '../Icons/Minus.js';
@@ -16,9 +16,14 @@ var Counter = function Counter(_a) {
16
16
  onChange = _a.onChange,
17
17
  disabled = _a.disabled,
18
18
  className = _a.className;
19
- var lastNumValue = useRef(value);
20
19
  var minusDisabled = disabled || value <= min;
21
20
  var plusDisabled = disabled || value >= max;
21
+ var handleChange = function handleChange(delta) {
22
+ if (disabled) return;
23
+ var newValue = value + delta;
24
+ if (newValue < min || newValue > max) return;
25
+ onChange(newValue);
26
+ };
22
27
  return /*#__PURE__*/React__default.createElement("div", {
23
28
  className: clx(styles.root, {
24
29
  root_fullWidth: fullWidth ? 1 : 0
@@ -34,10 +39,9 @@ var Counter = function Counter(_a) {
34
39
  }),
35
40
  disabled: minusDisabled,
36
41
  type: "button",
37
- onClick: function onClick(e) {
38
- e.stopPropagation();
39
- onChange(value - 1);
40
- lastNumValue.current = value - 1;
42
+ onClick: function onClick(event) {
43
+ event.stopPropagation();
44
+ handleChange(-1);
41
45
  },
42
46
  "aria-label": "decrease"
43
47
  }), /*#__PURE__*/React__default.createElement("div", {
@@ -49,10 +53,9 @@ var Counter = function Counter(_a) {
49
53
  }),
50
54
  disabled: plusDisabled,
51
55
  type: "button",
52
- onClick: function onClick(e) {
53
- e.stopPropagation();
54
- onChange(value + 1);
55
- lastNumValue.current = value + 1;
56
+ onClick: function onClick(event) {
57
+ event.stopPropagation();
58
+ handleChange(1);
56
59
  },
57
60
  "aria-label": "increase"
58
61
  })));
@@ -30,6 +30,7 @@ var MultiSelect = function MultiSelect(_a) {
30
30
  required = _a.required,
31
31
  label = _a.label,
32
32
  hint = _a.hint,
33
+ style = _a.style,
33
34
  hasError = _a.hasError,
34
35
  _c = _a.size,
35
36
  size = _c === void 0 ? "m" : _c,
@@ -117,6 +118,7 @@ var MultiSelect = function MultiSelect(_a) {
117
118
  }, /*#__PURE__*/React__default.createElement(InputRoot, {
118
119
  hasError: hasError,
119
120
  size: size,
121
+ style: style,
120
122
  className: clx(styles.root, {
121
123
  root_auto: preparedLabel.length
122
124
  }),
@@ -1,3 +1,4 @@
1
+ import { CSSProperties } from "react";
1
2
  import type { FormFieldProps } from "../base/FormField/index.props";
2
3
  export type GroupOptions = {
3
4
  value: string;
@@ -31,6 +32,7 @@ export interface MultiSelectProps extends Omit<FormFieldProps, "children"> {
31
32
  placeholder?: string;
32
33
  name?: string;
33
34
  type?: Type;
35
+ style?: CSSProperties;
34
36
  value?: SelectedItem[];
35
37
  onChange?: (value: SelectedItem[]) => void;
36
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "colibri-ui",
3
- "version": "0.8.11",
3
+ "version": "0.8.13",
4
4
  "description": "React UI components library",
5
5
  "main": "index.js",
6
6
  "scripts": {},