colibri-ui 0.7.127 → 0.7.129

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.
@@ -40,8 +40,8 @@
40
40
  }
41
41
  .checked::after {
42
42
  block-size: 8px;
43
- border-block-end: 2px solid var(--palette-black);
44
- border-inline-end: 2px solid var(--palette-black);
43
+ border-block-end: 2px solid var(--palette-white);
44
+ border-inline-end: 2px solid var(--palette-white);
45
45
  box-sizing: content-box;
46
46
  content: "";
47
47
  display: block;
@@ -57,8 +57,8 @@
57
57
  box-shadow: 0 0 0 2px var(--palette-alert);
58
58
  }
59
59
  .variant_primary_checked::after {
60
- border-block-end: 2px solid var(--palette-black);
61
- border-inline-end: 2px solid var(--palette-black);
60
+ border-block-end: 2px solid var(--palette-white);
61
+ border-inline-end: 2px solid var(--palette-white);
62
62
  }
63
63
 
64
64
  .control {
@@ -1,4 +1,4 @@
1
- .root {
1
+ .chip {
2
2
  cursor: pointer;
3
3
  display: inline-block;
4
4
  }
@@ -41,18 +41,18 @@
41
41
  }
42
42
  .inner[data-size=s] {
43
43
  border-radius: 32px;
44
- font-size: 15px;
45
- line-height: 32px;
44
+ font-size: 0.875rem;
45
+ line-height: 2.2;
46
46
  }
47
47
  .inner[data-size=m] {
48
48
  border-radius: 36px;
49
- font-size: 16px;
50
- line-height: 36px;
49
+ font-size: 1rem;
50
+ line-height: 2.3;
51
51
  }
52
52
  .inner[data-size=l] {
53
53
  border-radius: 44px;
54
- font-size: 18px;
55
- line-height: 44px;
54
+ font-size: 1.15rem;
55
+ line-height: 2.4;
56
56
  }
57
57
 
58
58
  .content {
@@ -60,7 +60,7 @@
60
60
  display: flex;
61
61
  justify-content: flex-start;
62
62
  max-width: 200px;
63
- padding: 0 20px;
63
+ padding: 0 1rem;
64
64
  user-select: none;
65
65
  }
66
66
 
@@ -72,8 +72,12 @@
72
72
 
73
73
  .icon-right {
74
74
  align-items: center;
75
+ color: var(--palette-bg-5);
75
76
  display: flex;
76
77
  justify-content: center;
77
78
  margin-left: -11px;
78
- padding-right: 18px;
79
+ padding-right: 0.8rem;
80
+ }
81
+ .icon-right:hover {
82
+ color: var(--palette-black);
79
83
  }
package/Chip/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var tslib = require('tslib');
5
6
  var React = require('react');
6
7
  var classNames = require('classnames/bind');
7
8
  var styles = require('./Chip.module.css');
@@ -13,34 +14,40 @@ var classNames__default = /*#__PURE__*/_interopDefault(classNames);
13
14
  var styles__default = /*#__PURE__*/_interopDefault(styles);
14
15
 
15
16
  var clx = classNames__default.default.bind(styles__default.default);
16
- var Chip = function Chip(props) {
17
- var children = props.children,
18
- iconOnRight = props.iconOnRight,
19
- isActive = props.isActive,
20
- onClick = props.onClick,
21
- onIconOnRightClick = props.onIconOnRightClick,
22
- _a = props.size,
23
- size = _a === void 0 ? "m" : _a,
24
- _b = props.testID,
25
- testID = _b === void 0 ? "chip" : _b;
26
- return /*#__PURE__*/React__default.default.createElement("span", {
27
- className: clx("root"),
17
+ var Chip = function Chip(_a) {
18
+ var children = _a.children,
19
+ iconEnd = _a.iconEnd,
20
+ isActive = _a.isActive,
21
+ onClick = _a.onClick,
22
+ onClickIcon = _a.onClickIcon,
23
+ _b = _a.size,
24
+ size = _b === void 0 ? "m" : _b,
25
+ _c = _a.testID,
26
+ testID = _c === void 0 ? "chip" : _c,
27
+ props = tslib.__rest(_a, ["children", "iconEnd", "isActive", "onClick", "onClickIcon", "size", "testID"]);
28
+ return /*#__PURE__*/React__default.default.createElement("span", tslib.__assign({
29
+ className: clx("chip"),
28
30
  "data-testid": testID
29
- }, /*#__PURE__*/React__default.default.createElement("span", {
31
+ }, props), /*#__PURE__*/React__default.default.createElement("span", {
30
32
  className: clx("inner", {
31
- inner_active: isActive,
32
- inner_inactive: !isActive
33
+ inner_active: iconEnd || isActive,
34
+ inner_inactive: !iconEnd && !isActive
33
35
  }),
34
36
  "data-size": size
35
37
  }, /*#__PURE__*/React__default.default.createElement("span", {
36
38
  className: clx("content"),
39
+ "aria-pressed": isActive,
40
+ role: "button",
41
+ tabIndex: 0,
37
42
  onClick: onClick
38
43
  }, /*#__PURE__*/React__default.default.createElement("span", {
39
44
  className: clx("content-inner")
40
- }, children)), iconOnRight && (/*#__PURE__*/React__default.default.createElement("span", {
45
+ }, children)), iconEnd && (/*#__PURE__*/React__default.default.createElement("span", {
41
46
  className: clx("icon-right"),
42
- onClick: onIconOnRightClick || onClick
43
- }, iconOnRight))));
47
+ role: "button",
48
+ tabIndex: 0,
49
+ onClick: onClickIcon
50
+ }, iconEnd))));
44
51
  };
45
52
 
46
53
  exports.default = Chip;
@@ -3,8 +3,8 @@ export type ChipProps = {
3
3
  size?: Size;
4
4
  testID?: string;
5
5
  isActive?: boolean;
6
- iconOnRight?: React.ReactNode;
6
+ iconEnd?: React.ReactNode;
7
7
  onClick?: () => void;
8
- onIconOnRightClick?: () => void;
8
+ onClickIcon?: () => void;
9
9
  };
10
10
  export {};
@@ -26,6 +26,7 @@ var DatePicker = function DatePicker(_a) {
26
26
  return /*#__PURE__*/React__default.default.createElement(index.default, {
27
27
  placement: "bottom",
28
28
  preventAutoClose: true,
29
+ preventOverflow: true,
29
30
  fontSize: 14,
30
31
  trigger: ["click"],
31
32
  overlay: /*#__PURE__*/React__default.default.createElement(index$1.default, {
package/Dropdown/index.js CHANGED
@@ -37,38 +37,46 @@ var Dropdown = function Dropdown(_a) {
37
37
  preventOverflow = _f === void 0 ? false : _f,
38
38
  _g = _a.preventAutoClose,
39
39
  preventAutoClose = _g === void 0 ? false : _g,
40
- _h = _a.samewidth,
41
- samewidth = _h === void 0 ? false : _h;
42
- var _j = React.useState(null),
43
- controlElement = _j[0],
44
- setControlElement = _j[1];
40
+ _h = _a.flip,
41
+ flip = _h === void 0 ? true : _h,
42
+ _j = _a.samewidth,
43
+ samewidth = _j === void 0 ? false : _j;
45
44
  var _k = React.useState(null),
46
- popperElement = _k[0],
47
- setPopperElement = _k[1];
48
- var _l = React.useState(false),
49
- visible = _l[0],
50
- setVisible = _l[1];
45
+ controlElement = _k[0],
46
+ setControlElement = _k[1];
47
+ var _l = React.useState(null),
48
+ popperElement = _l[0],
49
+ setPopperElement = _l[1];
50
+ var _m = React.useState(false),
51
+ visible = _m[0],
52
+ setVisible = _m[1];
51
53
  var isVisible = visibleProp && visible && !disabled;
52
- var _m = reactPopper.usePopper(controlElement, popperElement, {
54
+ var _o = reactPopper.usePopper(controlElement, popperElement, {
53
55
  placement: placement,
54
56
  strategy: strategy,
55
57
  modifiers: [{
56
58
  name: "flip",
57
- enabled: false
59
+ enabled: flip,
60
+ options: {
61
+ fallbackPlacements: ['top']
62
+ }
58
63
  }, {
59
64
  name: "preventOverflow",
60
65
  enabled: preventOverflow
61
66
  }]
62
67
  }),
63
- popperStyles = _m.styles,
64
- attributes = _m.attributes,
65
- update = _m.update;
68
+ popperStyles = _o.styles,
69
+ attributes = _o.attributes,
70
+ update = _o.update;
66
71
  var isNotComponent = typeof children === "string";
67
72
  var reference = React.useMemo(function () {
68
73
  return React.Children.only(isNotComponent ? /*#__PURE__*/React__default.default.createElement("button", null, children) : children);
69
74
  }, [children, isNotComponent]);
70
- var onToggle = React.useCallback(function (e) {
71
- e.stopPropagation();
75
+ var onToggle = React.useCallback(function (event) {
76
+ var _a;
77
+ if ((_a = event.target) === null || _a === void 0 ? void 0 : _a.closest('[data-ignore-click="true"]')) {
78
+ return;
79
+ }
72
80
  setVisible(function (state) {
73
81
  return !state;
74
82
  });
@@ -15,5 +15,6 @@ export type DropdownProps = {
15
15
  visible?: boolean;
16
16
  preventOverflow?: boolean;
17
17
  preventAutoClose?: boolean;
18
+ flip?: boolean;
18
19
  samewidth?: boolean;
19
20
  };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { Props } from "./index.props";
3
+ declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<SVGSVGElement>>;
4
+ export default _default;
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var React = require('react');
7
+
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var React__default = /*#__PURE__*/_interopDefault(React);
11
+
12
+ var CrossFill = /*#__PURE__*/React.forwardRef(function (_a, ref) {
13
+ var _b = _a.fill,
14
+ fill = _b === void 0 ? "currentColor" : _b,
15
+ _c = _a.width,
16
+ width = _c === void 0 ? 24 : _c,
17
+ _d = _a.height,
18
+ height = _d === void 0 ? 24 : _d,
19
+ props = tslib.__rest(_a, ["fill", "width", "height"]);
20
+ return /*#__PURE__*/React__default.default.createElement("svg", tslib.__assign({
21
+ xmlns: "http://www.w3.org/2000/svg",
22
+ width: width,
23
+ height: height,
24
+ fill: fill,
25
+ viewBox: "0 0 24 24",
26
+ ref: ref
27
+ }, props), /*#__PURE__*/React__default.default.createElement("path", {
28
+ d: "M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"
29
+ }));
30
+ });
31
+
32
+ exports.default = CrossFill;
package/Icons/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { default as ArrowNext } from "./ArrowNext";
2
2
  export { default as Cart } from "./Cart";
3
3
  export { default as Chevron } from "./Chevron";
4
4
  export { default as Close } from "./Close";
5
+ export { default as CrossFill } from "./CrossFill";
5
6
  export { default as Edit } from "./Edit";
6
7
  export { default as Exit } from "./Exit";
7
8
  export { default as EyeOpen } from "./EyeOpen";
package/Icons/index.js CHANGED
@@ -4,6 +4,7 @@ var ArrowNext = require('./ArrowNext.js');
4
4
  var Cart = require('./Cart.js');
5
5
  var Chevron = require('./Chevron.js');
6
6
  var Close = require('./Close.js');
7
+ var CrossFill = require('./CrossFill.js');
7
8
  var Edit = require('./Edit.js');
8
9
  var Exit = require('./Exit.js');
9
10
  var EyeOpen = require('./EyeOpen.js');
@@ -23,6 +24,7 @@ exports.ArrowNext = ArrowNext.default;
23
24
  exports.Cart = Cart.default;
24
25
  exports.Chevron = Chevron.default;
25
26
  exports.Close = Close.default;
27
+ exports.CrossFill = CrossFill.default;
26
28
  exports.Edit = Edit.default;
27
29
  exports.Exit = Exit.default;
28
30
  exports.EyeOpen = EyeOpen.default;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { MultiSelectProps } from "./index.props";
3
- declare const MultiSelect: ({ className, groups, zIndex, fontSize, disabled, fullWidth, required, label, hint, error, size, placeholder, name, }: MultiSelectProps) => React.JSX.Element;
3
+ declare const MultiSelect: ({ className, groups, zIndex, fontSize, disabled, fullWidth, required, label, hint, error, size, placeholder, name, type, }: MultiSelectProps) => React.JSX.Element;
4
4
  export default MultiSelect;
@@ -9,10 +9,13 @@ var index$2 = require('../Dropdown/index.js');
9
9
  var index$4 = require('../base/InputRoot/index.js');
10
10
  var index$1 = require('../base/FormField/index.js');
11
11
  require('../Icons/index.js');
12
+ var index$5 = require('../Chip/index.js');
13
+ var generateUniqID = require('../helpers/generateUniqID.js');
12
14
  var styles = require('./index.module.css');
13
15
  var index$3 = require('./components/MenuOverlay/index.js');
14
16
  var index = require('./utils/index.js');
15
17
  var Chevron = require('../Icons/Chevron.js');
18
+ var CrossFill = require('../Icons/CrossFill.js');
16
19
 
17
20
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
18
21
 
@@ -53,7 +56,8 @@ var MultiSelect = function MultiSelect(_a) {
53
56
  _c = _a.size,
54
57
  size = _c === void 0 ? "m" : _c,
55
58
  placeholder = _a.placeholder,
56
- name = _a.name;
59
+ name = _a.name,
60
+ type = _a.type;
57
61
  var _d = React.useState(false),
58
62
  isOpen = _d[0],
59
63
  setIsOpen = _d[1];
@@ -87,7 +91,10 @@ var MultiSelect = function MultiSelect(_a) {
87
91
  return group.options.filter(function (option) {
88
92
  return option.selected;
89
93
  }).map(function (option) {
90
- return option.label;
94
+ return {
95
+ label: option.label,
96
+ key: index.createGroupOptionString(group.value, option.value)
97
+ };
91
98
  });
92
99
  });
93
100
  }, [preparedGroups]);
@@ -111,7 +118,38 @@ var MultiSelect = function MultiSelect(_a) {
111
118
  onChange: handleChange
112
119
  }),
113
120
  samewidth: true
114
- }, /*#__PURE__*/React__default.default.createElement(index$4.default, {
121
+ }, type === "chip" ? (/*#__PURE__*/React__default.default.createElement(index$4.default, {
122
+ error: error,
123
+ size: size,
124
+ className: clx(styles__default.default.root, {
125
+ auto: !!prepraredLabel.length
126
+ }),
127
+ endIcon: /*#__PURE__*/React__default.default.createElement(Chevron.default, {
128
+ className: clx(styles__default.default.icon, {
129
+ icon_isOpen: isOpen ? 1 : 0
130
+ })
131
+ }),
132
+ disabled: !!disabled
133
+ }, /*#__PURE__*/React__default.default.createElement("div", {
134
+ className: clx(styles__default.default["base-input"], styles__default.default["base-input-flex"])
135
+ }, prepraredLabel.length ? (/*#__PURE__*/React__default.default.createElement(React__default.default.Fragment, null, prepraredLabel.map(function (option, index) {
136
+ return /*#__PURE__*/React__default.default.createElement(index$5.default, {
137
+ size: "s",
138
+ iconEnd: /*#__PURE__*/React__default.default.createElement(CrossFill.default, null),
139
+ "data-ignore-click": true,
140
+ key: generateUniqID.default(index),
141
+ onClickIcon: function onClickIcon() {
142
+ return handleChange(option.key);
143
+ }
144
+ }, option.label);
145
+ }))) : (/*#__PURE__*/React__default.default.createElement("span", {
146
+ className: clx(styles__default.default.placeholder)
147
+ }, placeholder))), /*#__PURE__*/React__default.default.createElement("input", {
148
+ type: "hidden",
149
+ name: name,
150
+ tabIndex: -1,
151
+ value: value || ""
152
+ }))) : (/*#__PURE__*/React__default.default.createElement(index$4.default, {
115
153
  error: error,
116
154
  size: size,
117
155
  className: clx(styles__default.default.root),
@@ -122,7 +160,7 @@ var MultiSelect = function MultiSelect(_a) {
122
160
  }),
123
161
  disabled: !!disabled
124
162
  }, /*#__PURE__*/React__default.default.createElement("div", {
125
- className: clx(styles__default.default["base-input"])
163
+ className: clx(styles__default.default["base-input"], styles__default.default["base-input-text"])
126
164
  }, prepraredLabel.length ? prepraredLabel.join(", ") : (/*#__PURE__*/React__default.default.createElement("span", {
127
165
  className: clx(styles__default.default.placeholder)
128
166
  }, placeholder))), /*#__PURE__*/React__default.default.createElement("input", {
@@ -130,7 +168,7 @@ var MultiSelect = function MultiSelect(_a) {
130
168
  name: name,
131
169
  tabIndex: -1,
132
170
  value: value || ""
133
- }))));
171
+ })))));
134
172
  };
135
173
 
136
174
  exports.default = MultiSelect;
@@ -2,6 +2,11 @@
2
2
  cursor: pointer;
3
3
  }
4
4
 
5
+ .root.auto {
6
+ height: auto;
7
+ min-height: 36px;
8
+ }
9
+
5
10
  .icon_isOpen {
6
11
  transform: rotate(180deg);
7
12
  }
@@ -16,15 +21,24 @@
16
21
  display: inline-block;
17
22
  flex: 1;
18
23
  margin: 7px 0;
19
- overflow: hidden;
20
- text-overflow: ellipsis;
21
- white-space: nowrap;
22
24
  width: 100%;
23
25
  }
24
26
  .base-input ::placeholder {
25
27
  color: var(--palette-bg-2);
26
28
  }
27
29
 
30
+ .base-input-text {
31
+ overflow: hidden;
32
+ text-overflow: ellipsis;
33
+ white-space: nowrap;
34
+ }
35
+
36
+ .base-input-flex {
37
+ display: inline-flex;
38
+ flex-wrap: wrap;
39
+ gap: 0.3rem;
40
+ }
41
+
28
42
  .placeholder {
29
43
  color: var(--input-primary-plaseholder-color);
30
44
  display: block;
@@ -14,6 +14,7 @@ export type GroupProps = {
14
14
  options: GroupOptions[];
15
15
  };
16
16
  type Size = "s" | "m" | "l";
17
+ type Type = "chip";
17
18
  export interface MultiSelectProps extends Omit<FormFieldProps, "children"> {
18
19
  groups: GroupProps[];
19
20
  className?: string;
@@ -25,5 +26,6 @@ export interface MultiSelectProps extends Omit<FormFieldProps, "children"> {
25
26
  size?: Size;
26
27
  placeholder?: string;
27
28
  name?: string;
29
+ type?: Type;
28
30
  }
29
31
  export {};
@@ -23,9 +23,11 @@ var InputRoot = /*#__PURE__*/React.forwardRef(function (_a, ref) {
23
23
  variant = _c === void 0 ? "primary" : _c,
24
24
  disabled = _a.disabled,
25
25
  error = _a.error,
26
+ style = _a.style,
26
27
  size = _a.size;
27
28
  return /*#__PURE__*/React__default.default.createElement("div", {
28
29
  ref: ref,
30
+ style: style,
29
31
  className: clx(styles__default.default.root, (_b = {}, _b["variant_".concat(variant, "_disabled")] = disabled ? 1 : 0, _b["variant_".concat(variant, "_error")] = error ? 1 : 0, _b["size_".concat(size)] = !!size, _b["variant_".concat(variant)] = !!variant, _b), className)
30
32
  }, startIcon && /*#__PURE__*/React__default.default.createElement("div", {
31
33
  className: clx(styles__default.default["base-icon"])
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import type { CSSProperties, ReactNode } from "react";
2
2
  export type Size = "s" | "m" | "l";
3
3
  export type Variant = "primary";
4
4
  export type InputProps = {
@@ -9,4 +9,5 @@ export type InputProps = {
9
9
  startIcon?: ReactNode;
10
10
  endIcon?: ReactNode;
11
11
  size?: Size;
12
+ style?: CSSProperties;
12
13
  };
@@ -40,8 +40,8 @@
40
40
  }
41
41
  .checked::after {
42
42
  block-size: 8px;
43
- border-block-end: 2px solid var(--palette-black);
44
- border-inline-end: 2px solid var(--palette-black);
43
+ border-block-end: 2px solid var(--palette-white);
44
+ border-inline-end: 2px solid var(--palette-white);
45
45
  box-sizing: content-box;
46
46
  content: "";
47
47
  display: block;
@@ -57,8 +57,8 @@
57
57
  box-shadow: 0 0 0 2px var(--palette-alert);
58
58
  }
59
59
  .variant_primary_checked::after {
60
- border-block-end: 2px solid var(--palette-black);
61
- border-inline-end: 2px solid var(--palette-black);
60
+ border-block-end: 2px solid var(--palette-white);
61
+ border-inline-end: 2px solid var(--palette-white);
62
62
  }
63
63
 
64
64
  .control {
@@ -1,4 +1,4 @@
1
- .root {
1
+ .chip {
2
2
  cursor: pointer;
3
3
  display: inline-block;
4
4
  }
@@ -41,18 +41,18 @@
41
41
  }
42
42
  .inner[data-size=s] {
43
43
  border-radius: 32px;
44
- font-size: 15px;
45
- line-height: 32px;
44
+ font-size: 0.875rem;
45
+ line-height: 2.2;
46
46
  }
47
47
  .inner[data-size=m] {
48
48
  border-radius: 36px;
49
- font-size: 16px;
50
- line-height: 36px;
49
+ font-size: 1rem;
50
+ line-height: 2.3;
51
51
  }
52
52
  .inner[data-size=l] {
53
53
  border-radius: 44px;
54
- font-size: 18px;
55
- line-height: 44px;
54
+ font-size: 1.15rem;
55
+ line-height: 2.4;
56
56
  }
57
57
 
58
58
  .content {
@@ -60,7 +60,7 @@
60
60
  display: flex;
61
61
  justify-content: flex-start;
62
62
  max-width: 200px;
63
- padding: 0 20px;
63
+ padding: 0 1rem;
64
64
  user-select: none;
65
65
  }
66
66
 
@@ -72,8 +72,12 @@
72
72
 
73
73
  .icon-right {
74
74
  align-items: center;
75
+ color: var(--palette-bg-5);
75
76
  display: flex;
76
77
  justify-content: center;
77
78
  margin-left: -11px;
78
- padding-right: 18px;
79
+ padding-right: 0.8rem;
80
+ }
81
+ .icon-right:hover {
82
+ color: var(--palette-black);
79
83
  }
package/esm/Chip/index.js CHANGED
@@ -1,36 +1,43 @@
1
+ import { __rest, __assign } from 'tslib';
1
2
  import React__default from 'react';
2
3
  import classNames from 'classnames/bind';
3
4
  import styles from './Chip.module.css';
4
5
 
5
6
  var clx = classNames.bind(styles);
6
- var Chip = function Chip(props) {
7
- var children = props.children,
8
- iconOnRight = props.iconOnRight,
9
- isActive = props.isActive,
10
- onClick = props.onClick,
11
- onIconOnRightClick = props.onIconOnRightClick,
12
- _a = props.size,
13
- size = _a === void 0 ? "m" : _a,
14
- _b = props.testID,
15
- testID = _b === void 0 ? "chip" : _b;
16
- return /*#__PURE__*/React__default.createElement("span", {
17
- className: clx("root"),
7
+ var Chip = function Chip(_a) {
8
+ var children = _a.children,
9
+ iconEnd = _a.iconEnd,
10
+ isActive = _a.isActive,
11
+ onClick = _a.onClick,
12
+ onClickIcon = _a.onClickIcon,
13
+ _b = _a.size,
14
+ size = _b === void 0 ? "m" : _b,
15
+ _c = _a.testID,
16
+ testID = _c === void 0 ? "chip" : _c,
17
+ props = __rest(_a, ["children", "iconEnd", "isActive", "onClick", "onClickIcon", "size", "testID"]);
18
+ return /*#__PURE__*/React__default.createElement("span", __assign({
19
+ className: clx("chip"),
18
20
  "data-testid": testID
19
- }, /*#__PURE__*/React__default.createElement("span", {
21
+ }, props), /*#__PURE__*/React__default.createElement("span", {
20
22
  className: clx("inner", {
21
- inner_active: isActive,
22
- inner_inactive: !isActive
23
+ inner_active: iconEnd || isActive,
24
+ inner_inactive: !iconEnd && !isActive
23
25
  }),
24
26
  "data-size": size
25
27
  }, /*#__PURE__*/React__default.createElement("span", {
26
28
  className: clx("content"),
29
+ "aria-pressed": isActive,
30
+ role: "button",
31
+ tabIndex: 0,
27
32
  onClick: onClick
28
33
  }, /*#__PURE__*/React__default.createElement("span", {
29
34
  className: clx("content-inner")
30
- }, children)), iconOnRight && (/*#__PURE__*/React__default.createElement("span", {
35
+ }, children)), iconEnd && (/*#__PURE__*/React__default.createElement("span", {
31
36
  className: clx("icon-right"),
32
- onClick: onIconOnRightClick || onClick
33
- }, iconOnRight))));
37
+ role: "button",
38
+ tabIndex: 0,
39
+ onClick: onClickIcon
40
+ }, iconEnd))));
34
41
  };
35
42
 
36
43
  export { Chip as default };
@@ -3,8 +3,8 @@ export type ChipProps = {
3
3
  size?: Size;
4
4
  testID?: string;
5
5
  isActive?: boolean;
6
- iconOnRight?: React.ReactNode;
6
+ iconEnd?: React.ReactNode;
7
7
  onClick?: () => void;
8
- onIconOnRightClick?: () => void;
8
+ onClickIcon?: () => void;
9
9
  };
10
10
  export {};
@@ -16,6 +16,7 @@ var DatePicker = function DatePicker(_a) {
16
16
  return /*#__PURE__*/React__default.createElement(Dropdown, {
17
17
  placement: "bottom",
18
18
  preventAutoClose: true,
19
+ preventOverflow: true,
19
20
  fontSize: 14,
20
21
  trigger: ["click"],
21
22
  overlay: /*#__PURE__*/React__default.createElement(Calendar, {
@@ -27,38 +27,46 @@ var Dropdown = function Dropdown(_a) {
27
27
  preventOverflow = _f === void 0 ? false : _f,
28
28
  _g = _a.preventAutoClose,
29
29
  preventAutoClose = _g === void 0 ? false : _g,
30
- _h = _a.samewidth,
31
- samewidth = _h === void 0 ? false : _h;
32
- var _j = useState(null),
33
- controlElement = _j[0],
34
- setControlElement = _j[1];
30
+ _h = _a.flip,
31
+ flip = _h === void 0 ? true : _h,
32
+ _j = _a.samewidth,
33
+ samewidth = _j === void 0 ? false : _j;
35
34
  var _k = useState(null),
36
- popperElement = _k[0],
37
- setPopperElement = _k[1];
38
- var _l = useState(false),
39
- visible = _l[0],
40
- setVisible = _l[1];
35
+ controlElement = _k[0],
36
+ setControlElement = _k[1];
37
+ var _l = useState(null),
38
+ popperElement = _l[0],
39
+ setPopperElement = _l[1];
40
+ var _m = useState(false),
41
+ visible = _m[0],
42
+ setVisible = _m[1];
41
43
  var isVisible = visibleProp && visible && !disabled;
42
- var _m = usePopper(controlElement, popperElement, {
44
+ var _o = usePopper(controlElement, popperElement, {
43
45
  placement: placement,
44
46
  strategy: strategy,
45
47
  modifiers: [{
46
48
  name: "flip",
47
- enabled: false
49
+ enabled: flip,
50
+ options: {
51
+ fallbackPlacements: ['top']
52
+ }
48
53
  }, {
49
54
  name: "preventOverflow",
50
55
  enabled: preventOverflow
51
56
  }]
52
57
  }),
53
- popperStyles = _m.styles,
54
- attributes = _m.attributes,
55
- update = _m.update;
58
+ popperStyles = _o.styles,
59
+ attributes = _o.attributes,
60
+ update = _o.update;
56
61
  var isNotComponent = typeof children === "string";
57
62
  var reference = useMemo(function () {
58
63
  return Children.only(isNotComponent ? /*#__PURE__*/React__default.createElement("button", null, children) : children);
59
64
  }, [children, isNotComponent]);
60
- var onToggle = useCallback(function (e) {
61
- e.stopPropagation();
65
+ var onToggle = useCallback(function (event) {
66
+ var _a;
67
+ if ((_a = event.target) === null || _a === void 0 ? void 0 : _a.closest('[data-ignore-click="true"]')) {
68
+ return;
69
+ }
62
70
  setVisible(function (state) {
63
71
  return !state;
64
72
  });
@@ -15,5 +15,6 @@ export type DropdownProps = {
15
15
  visible?: boolean;
16
16
  preventOverflow?: boolean;
17
17
  preventAutoClose?: boolean;
18
+ flip?: boolean;
18
19
  samewidth?: boolean;
19
20
  };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { Props } from "./index.props";
3
+ declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<SVGSVGElement>>;
4
+ export default _default;
@@ -0,0 +1,24 @@
1
+ import { __rest, __assign } from 'tslib';
2
+ import React__default, { forwardRef } from 'react';
3
+
4
+ var CrossFill = /*#__PURE__*/forwardRef(function (_a, ref) {
5
+ var _b = _a.fill,
6
+ fill = _b === void 0 ? "currentColor" : _b,
7
+ _c = _a.width,
8
+ width = _c === void 0 ? 24 : _c,
9
+ _d = _a.height,
10
+ height = _d === void 0 ? 24 : _d,
11
+ props = __rest(_a, ["fill", "width", "height"]);
12
+ return /*#__PURE__*/React__default.createElement("svg", __assign({
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ width: width,
15
+ height: height,
16
+ fill: fill,
17
+ viewBox: "0 0 24 24",
18
+ ref: ref
19
+ }, props), /*#__PURE__*/React__default.createElement("path", {
20
+ d: "M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"
21
+ }));
22
+ });
23
+
24
+ export { CrossFill as default };
@@ -2,6 +2,7 @@ export { default as ArrowNext } from "./ArrowNext";
2
2
  export { default as Cart } from "./Cart";
3
3
  export { default as Chevron } from "./Chevron";
4
4
  export { default as Close } from "./Close";
5
+ export { default as CrossFill } from "./CrossFill";
5
6
  export { default as Edit } from "./Edit";
6
7
  export { default as Exit } from "./Exit";
7
8
  export { default as EyeOpen } from "./EyeOpen";
@@ -2,6 +2,7 @@ export { default as ArrowNext } from './ArrowNext.js';
2
2
  export { default as Cart } from './Cart.js';
3
3
  export { default as Chevron } from './Chevron.js';
4
4
  export { default as Close } from './Close.js';
5
+ export { default as CrossFill } from './CrossFill.js';
5
6
  export { default as Edit } from './Edit.js';
6
7
  export { default as Exit } from './Exit.js';
7
8
  export { default as EyeOpen } from './EyeOpen.js';
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { MultiSelectProps } from "./index.props";
3
- declare const MultiSelect: ({ className, groups, zIndex, fontSize, disabled, fullWidth, required, label, hint, error, size, placeholder, name, }: MultiSelectProps) => React.JSX.Element;
3
+ declare const MultiSelect: ({ className, groups, zIndex, fontSize, disabled, fullWidth, required, label, hint, error, size, placeholder, name, type, }: MultiSelectProps) => React.JSX.Element;
4
4
  export default MultiSelect;
@@ -5,10 +5,13 @@ import Dropdown from '../Dropdown/index.js';
5
5
  import InputRoot from '../base/InputRoot/index.js';
6
6
  import FormField from '../base/FormField/index.js';
7
7
  import '../Icons/index.js';
8
+ import Chip from '../Chip/index.js';
9
+ import generateUniqID from '../helpers/generateUniqID.js';
8
10
  import styles from './index.module.css';
9
11
  import MenuOverlay from './components/MenuOverlay/index.js';
10
12
  import { createGroupOptionString } from './utils/index.js';
11
13
  import Chevron from '../Icons/Chevron.js';
14
+ import CrossFill from '../Icons/CrossFill.js';
12
15
 
13
16
  var clx = classNames.bind(styles);
14
17
  var sortedItems = function sortedItems(items) {
@@ -43,7 +46,8 @@ var MultiSelect = function MultiSelect(_a) {
43
46
  _c = _a.size,
44
47
  size = _c === void 0 ? "m" : _c,
45
48
  placeholder = _a.placeholder,
46
- name = _a.name;
49
+ name = _a.name,
50
+ type = _a.type;
47
51
  var _d = useState(false),
48
52
  isOpen = _d[0],
49
53
  setIsOpen = _d[1];
@@ -77,7 +81,10 @@ var MultiSelect = function MultiSelect(_a) {
77
81
  return group.options.filter(function (option) {
78
82
  return option.selected;
79
83
  }).map(function (option) {
80
- return option.label;
84
+ return {
85
+ label: option.label,
86
+ key: createGroupOptionString(group.value, option.value)
87
+ };
81
88
  });
82
89
  });
83
90
  }, [preparedGroups]);
@@ -101,7 +108,38 @@ var MultiSelect = function MultiSelect(_a) {
101
108
  onChange: handleChange
102
109
  }),
103
110
  samewidth: true
104
- }, /*#__PURE__*/React__default.createElement(InputRoot, {
111
+ }, type === "chip" ? (/*#__PURE__*/React__default.createElement(InputRoot, {
112
+ error: error,
113
+ size: size,
114
+ className: clx(styles.root, {
115
+ auto: !!prepraredLabel.length
116
+ }),
117
+ endIcon: /*#__PURE__*/React__default.createElement(Chevron, {
118
+ className: clx(styles.icon, {
119
+ icon_isOpen: isOpen ? 1 : 0
120
+ })
121
+ }),
122
+ disabled: !!disabled
123
+ }, /*#__PURE__*/React__default.createElement("div", {
124
+ className: clx(styles["base-input"], styles["base-input-flex"])
125
+ }, prepraredLabel.length ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, prepraredLabel.map(function (option, index) {
126
+ return /*#__PURE__*/React__default.createElement(Chip, {
127
+ size: "s",
128
+ iconEnd: /*#__PURE__*/React__default.createElement(CrossFill, null),
129
+ "data-ignore-click": true,
130
+ key: generateUniqID(index),
131
+ onClickIcon: function onClickIcon() {
132
+ return handleChange(option.key);
133
+ }
134
+ }, option.label);
135
+ }))) : (/*#__PURE__*/React__default.createElement("span", {
136
+ className: clx(styles.placeholder)
137
+ }, placeholder))), /*#__PURE__*/React__default.createElement("input", {
138
+ type: "hidden",
139
+ name: name,
140
+ tabIndex: -1,
141
+ value: value || ""
142
+ }))) : (/*#__PURE__*/React__default.createElement(InputRoot, {
105
143
  error: error,
106
144
  size: size,
107
145
  className: clx(styles.root),
@@ -112,7 +150,7 @@ var MultiSelect = function MultiSelect(_a) {
112
150
  }),
113
151
  disabled: !!disabled
114
152
  }, /*#__PURE__*/React__default.createElement("div", {
115
- className: clx(styles["base-input"])
153
+ className: clx(styles["base-input"], styles["base-input-text"])
116
154
  }, prepraredLabel.length ? prepraredLabel.join(", ") : (/*#__PURE__*/React__default.createElement("span", {
117
155
  className: clx(styles.placeholder)
118
156
  }, placeholder))), /*#__PURE__*/React__default.createElement("input", {
@@ -120,7 +158,7 @@ var MultiSelect = function MultiSelect(_a) {
120
158
  name: name,
121
159
  tabIndex: -1,
122
160
  value: value || ""
123
- }))));
161
+ })))));
124
162
  };
125
163
 
126
164
  export { MultiSelect as default };
@@ -2,6 +2,11 @@
2
2
  cursor: pointer;
3
3
  }
4
4
 
5
+ .root.auto {
6
+ height: auto;
7
+ min-height: 36px;
8
+ }
9
+
5
10
  .icon_isOpen {
6
11
  transform: rotate(180deg);
7
12
  }
@@ -16,15 +21,24 @@
16
21
  display: inline-block;
17
22
  flex: 1;
18
23
  margin: 7px 0;
19
- overflow: hidden;
20
- text-overflow: ellipsis;
21
- white-space: nowrap;
22
24
  width: 100%;
23
25
  }
24
26
  .base-input ::placeholder {
25
27
  color: var(--palette-bg-2);
26
28
  }
27
29
 
30
+ .base-input-text {
31
+ overflow: hidden;
32
+ text-overflow: ellipsis;
33
+ white-space: nowrap;
34
+ }
35
+
36
+ .base-input-flex {
37
+ display: inline-flex;
38
+ flex-wrap: wrap;
39
+ gap: 0.3rem;
40
+ }
41
+
28
42
  .placeholder {
29
43
  color: var(--input-primary-plaseholder-color);
30
44
  display: block;
@@ -14,6 +14,7 @@ export type GroupProps = {
14
14
  options: GroupOptions[];
15
15
  };
16
16
  type Size = "s" | "m" | "l";
17
+ type Type = "chip";
17
18
  export interface MultiSelectProps extends Omit<FormFieldProps, "children"> {
18
19
  groups: GroupProps[];
19
20
  className?: string;
@@ -25,5 +26,6 @@ export interface MultiSelectProps extends Omit<FormFieldProps, "children"> {
25
26
  size?: Size;
26
27
  placeholder?: string;
27
28
  name?: string;
29
+ type?: Type;
28
30
  }
29
31
  export {};
@@ -13,9 +13,11 @@ var InputRoot = /*#__PURE__*/forwardRef(function (_a, ref) {
13
13
  variant = _c === void 0 ? "primary" : _c,
14
14
  disabled = _a.disabled,
15
15
  error = _a.error,
16
+ style = _a.style,
16
17
  size = _a.size;
17
18
  return /*#__PURE__*/React__default.createElement("div", {
18
19
  ref: ref,
20
+ style: style,
19
21
  className: clx(styles.root, (_b = {}, _b["variant_".concat(variant, "_disabled")] = disabled ? 1 : 0, _b["variant_".concat(variant, "_error")] = error ? 1 : 0, _b["size_".concat(size)] = !!size, _b["variant_".concat(variant)] = !!variant, _b), className)
20
22
  }, startIcon && /*#__PURE__*/React__default.createElement("div", {
21
23
  className: clx(styles["base-icon"])
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import type { CSSProperties, ReactNode } from "react";
2
2
  export type Size = "s" | "m" | "l";
3
3
  export type Variant = "primary";
4
4
  export type InputProps = {
@@ -9,4 +9,5 @@ export type InputProps = {
9
9
  startIcon?: ReactNode;
10
10
  endIcon?: ReactNode;
11
11
  size?: Size;
12
+ style?: CSSProperties;
12
13
  };
package/esm/index.js CHANGED
@@ -39,6 +39,7 @@ export { default as ArrowNext } from './Icons/ArrowNext.js';
39
39
  export { default as Cart } from './Icons/Cart.js';
40
40
  export { default as Chevron } from './Icons/Chevron.js';
41
41
  export { default as Close } from './Icons/Close.js';
42
+ export { default as CrossFill } from './Icons/CrossFill.js';
42
43
  export { default as Edit } from './Icons/Edit.js';
43
44
  export { default as Exit } from './Icons/Exit.js';
44
45
  export { default as EyeOpen } from './Icons/EyeOpen.js';
package/index.js CHANGED
@@ -41,6 +41,7 @@ var ArrowNext = require('./Icons/ArrowNext.js');
41
41
  var Cart = require('./Icons/Cart.js');
42
42
  var Chevron = require('./Icons/Chevron.js');
43
43
  var Close = require('./Icons/Close.js');
44
+ var CrossFill = require('./Icons/CrossFill.js');
44
45
  var Edit = require('./Icons/Edit.js');
45
46
  var Exit = require('./Icons/Exit.js');
46
47
  var EyeOpen = require('./Icons/EyeOpen.js');
@@ -97,6 +98,7 @@ exports.ArrowNext = ArrowNext.default;
97
98
  exports.Cart = Cart.default;
98
99
  exports.Chevron = Chevron.default;
99
100
  exports.Close = Close.default;
101
+ exports.CrossFill = CrossFill.default;
100
102
  exports.Edit = Edit.default;
101
103
  exports.Exit = Exit.default;
102
104
  exports.EyeOpen = EyeOpen.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "colibri-ui",
3
- "version": "0.7.127",
3
+ "version": "0.7.129",
4
4
  "description": "React UI components library",
5
5
  "main": "index.js",
6
6
  "scripts": {},