colibri-ui 0.7.57 → 0.7.59

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.
Files changed (225) hide show
  1. package/Badge/Badge.module.css +13 -15
  2. package/Badge/Control/Control.module.css +1 -1
  3. package/Button/Button.module.css +44 -30
  4. package/Button/index.props.d.ts +1 -1
  5. package/Calendar/components/ContinueButton/index.d.ts +10 -0
  6. package/Calendar/components/ContinueButton/index.js +45 -0
  7. package/Calendar/components/ContinueButton/index.module.css +4 -0
  8. package/Calendar/components/Month/Month.d.ts +15 -0
  9. package/Calendar/components/Month/Month.js +142 -0
  10. package/Calendar/components/Month/index.module.css +143 -0
  11. package/Calendar/components/Presets/index.d.ts +19 -0
  12. package/Calendar/components/Presets/index.js +68 -0
  13. package/Calendar/components/Presets/index.module.css +28 -0
  14. package/Calendar/index.d.ts +20 -0
  15. package/Calendar/index.js +196 -0
  16. package/Calendar/index.module.css +98 -0
  17. package/Calendar/package.json +6 -0
  18. package/Calendar/utils/getMonthWeeks.d.ts +20 -0
  19. package/Calendar/utils/getMonthWeeks.js +81 -0
  20. package/Calendar/utils/getNumberOfMonthsBetweenDates.d.ts +4 -0
  21. package/Calendar/utils/getNumberOfMonthsBetweenDates.js +21 -0
  22. package/Calendar/utils/getPresets.d.ts +10 -0
  23. package/Calendar/utils/getStartMonth.d.ts +6 -0
  24. package/Calendar/utils/getStartMonth.js +15 -0
  25. package/Checkbox/Checkbox.module.css +14 -14
  26. package/Checkbox/index.js +1 -1
  27. package/Counter/Counter.module.css +3 -3
  28. package/Dropdown/Dropdown.module.css +7 -7
  29. package/Dropdown/index.js +3 -2
  30. package/Grid/Grid.module.css +5 -10
  31. package/Grid/Item/Grid-Item.module.css +1 -1
  32. package/Grid/Item/index.js +4 -2
  33. package/Grid/Item/index.props.d.ts +2 -1
  34. package/Icons/Check.d.ts +4 -0
  35. package/Icons/Check.js +41 -0
  36. package/Icons/Setting.d.ts +4 -0
  37. package/Image/Image.module.css +5 -6
  38. package/InputRadio/InputRadio.module.css +7 -9
  39. package/Menu/Menu.module.css +3 -3
  40. package/Menu/components/MenuItem/MenuItem.module.css +8 -7
  41. package/Menu/components/MenuItem/index.d.ts +2 -2
  42. package/Menu/components/MenuItem/index.js +9 -9
  43. package/Menu/index.d.ts +3 -2
  44. package/Menu/index.js +3 -4
  45. package/Menu/index.props.d.ts +2 -7
  46. package/Modal/Modal.module.css +19 -19
  47. package/Modal/components/Content/Content.module.css +1 -1
  48. package/Modal/index.js +4 -4
  49. package/RadioGroup/index.d.ts +2 -1
  50. package/Select/components/MenuOverlay/index.d.ts +11 -0
  51. package/Select/components/MenuOverlay/index.js +63 -0
  52. package/Select/components/MenuOverlay/index.module.css +4 -0
  53. package/Select/components/MenuOverlayItem/index.d.ts +13 -0
  54. package/Select/components/MenuOverlayItem/index.js +45 -0
  55. package/Select/index.d.ts +1 -1
  56. package/Select/index.js +19 -34
  57. package/Select/{Select.module.css → index.module.css} +12 -17
  58. package/Select/index.props.d.ts +6 -3
  59. package/Skeleton/Skeleton.module.css +4 -4
  60. package/Switch/Switch.module.css +22 -22
  61. package/Switch/index.js +1 -1
  62. package/Theme/colors/common.d.ts +27 -0
  63. package/Theme/colors/common.js +28 -0
  64. package/Theme/colors/index.d.ts +48 -0
  65. package/Theme/colors/index.js +12 -0
  66. package/Theme/colors/theme_buenos_aires.d.ts +47 -0
  67. package/Theme/colors/theme_buenos_aires.js +40 -0
  68. package/Theme/colors/theme_default.d.ts +47 -0
  69. package/Theme/colors/theme_default.js +40 -0
  70. package/Theme/global.css +7 -5
  71. package/Theme/index.d.ts +12 -0
  72. package/Theme/themes/buenos_aires.js +7 -7
  73. package/Theme/themes/default.d.ts +12 -0
  74. package/Theme/themes/default.js +94 -82
  75. package/TimeSelect/Label/index.d.ts +8 -0
  76. package/TimeSelect/helpers.d.ts +7 -0
  77. package/TimeSelect/index.d.ts +7 -0
  78. package/TimeSelect/index.props.d.ts +4 -0
  79. package/TimeSelect/package.json +6 -0
  80. package/Typography/Typography.module.css +3 -3
  81. package/Typography/index.d.ts +2 -2
  82. package/Typography/index.js +3 -3
  83. package/Typography/index.props.d.ts +2 -1
  84. package/base/BaseInput/BaseInput.module.css +4 -4
  85. package/base/BaseInput/index.js +1 -1
  86. package/base/InputRoot/InputRoot.module.css +22 -20
  87. package/base/InputRoot/index.js +5 -5
  88. package/esm/Badge/Badge.module.css +13 -15
  89. package/esm/Badge/Control/Control.module.css +1 -1
  90. package/esm/Badge/Control/index.js +2 -2
  91. package/esm/Badge/index.js +2 -2
  92. package/esm/Button/Button.module.css +44 -30
  93. package/esm/Button/index.js +5 -5
  94. package/esm/Button/index.props.d.ts +1 -1
  95. package/esm/Calendar/components/ContinueButton/index.d.ts +10 -0
  96. package/esm/Calendar/components/ContinueButton/index.js +37 -0
  97. package/esm/Calendar/components/ContinueButton/index.module.css +4 -0
  98. package/esm/Calendar/components/Month/Month.d.ts +15 -0
  99. package/esm/Calendar/components/Month/Month.js +116 -0
  100. package/esm/Calendar/components/Month/index.module.css +143 -0
  101. package/esm/Calendar/components/Presets/index.d.ts +19 -0
  102. package/esm/Calendar/components/Presets/index.js +42 -0
  103. package/esm/Calendar/components/Presets/index.module.css +28 -0
  104. package/esm/Calendar/index.d.ts +20 -0
  105. package/esm/Calendar/index.js +186 -0
  106. package/esm/Calendar/index.module.css +98 -0
  107. package/esm/Calendar/utils/getMonthWeeks.d.ts +20 -0
  108. package/esm/Calendar/utils/getMonthWeeks.js +79 -0
  109. package/esm/Calendar/utils/getNumberOfMonthsBetweenDates.d.ts +4 -0
  110. package/esm/Calendar/utils/getNumberOfMonthsBetweenDates.js +19 -0
  111. package/esm/Calendar/utils/getPresets.d.ts +10 -0
  112. package/esm/Calendar/utils/getStartMonth.d.ts +6 -0
  113. package/esm/Calendar/utils/getStartMonth.js +13 -0
  114. package/esm/Checkbox/Checkbox.module.css +14 -14
  115. package/esm/Checkbox/index.js +9 -9
  116. package/esm/ClickOutside/index.js +3 -3
  117. package/esm/Counter/Counter.module.css +3 -3
  118. package/esm/Counter/index.js +8 -8
  119. package/esm/DotsLoader/index.js +6 -6
  120. package/esm/Dropdown/Dropdown.module.css +7 -7
  121. package/esm/Dropdown/index.js +9 -8
  122. package/esm/Grid/Grid.module.css +5 -10
  123. package/esm/Grid/Item/Grid-Item.module.css +1 -1
  124. package/esm/Grid/Item/index.js +6 -4
  125. package/esm/Grid/Item/index.props.d.ts +2 -1
  126. package/esm/Grid/index.js +2 -2
  127. package/esm/Icons/Cart.js +3 -3
  128. package/esm/Icons/Check.d.ts +4 -0
  129. package/esm/Icons/Check.js +33 -0
  130. package/esm/Icons/Chevron.js +3 -3
  131. package/esm/Icons/Close.js +3 -3
  132. package/esm/Icons/EyeClosed.js +3 -3
  133. package/esm/Icons/EyeOpen.js +4 -4
  134. package/esm/Icons/Help.js +3 -3
  135. package/esm/Icons/Info.js +3 -3
  136. package/esm/Icons/Minus.js +3 -3
  137. package/esm/Icons/More.js +5 -5
  138. package/esm/Icons/Plus.js +5 -5
  139. package/esm/Icons/Setting.d.ts +4 -0
  140. package/esm/Icons/Trash.js +3 -3
  141. package/esm/Icons/User.js +4 -4
  142. package/esm/Image/Image.module.css +5 -6
  143. package/esm/Image/index.js +4 -4
  144. package/esm/Input/index.js +4 -4
  145. package/esm/InputRadio/InputRadio.module.css +7 -9
  146. package/esm/InputRadio/index.js +7 -7
  147. package/esm/Menu/Menu.module.css +3 -3
  148. package/esm/Menu/components/MenuItem/MenuItem.module.css +8 -7
  149. package/esm/Menu/components/MenuItem/index.d.ts +2 -2
  150. package/esm/Menu/components/MenuItem/index.js +11 -11
  151. package/esm/Menu/index.d.ts +3 -2
  152. package/esm/Menu/index.js +5 -6
  153. package/esm/Menu/index.props.d.ts +2 -7
  154. package/esm/Modal/Modal.module.css +19 -19
  155. package/esm/Modal/components/Close/index.js +2 -2
  156. package/esm/Modal/components/Content/Content.module.css +1 -1
  157. package/esm/Modal/components/Content/index.js +2 -2
  158. package/esm/Modal/components/Title/index.js +3 -3
  159. package/esm/Modal/index.js +13 -13
  160. package/esm/RadioGroup/Radio.js +2 -2
  161. package/esm/RadioGroup/index.d.ts +2 -1
  162. package/esm/RadioGroup/index.js +3 -3
  163. package/esm/Select/components/MenuOverlay/index.d.ts +11 -0
  164. package/esm/Select/components/MenuOverlay/index.js +53 -0
  165. package/esm/Select/components/MenuOverlay/index.module.css +4 -0
  166. package/esm/Select/components/MenuOverlayItem/index.d.ts +13 -0
  167. package/esm/Select/components/MenuOverlayItem/index.js +37 -0
  168. package/esm/Select/index.d.ts +1 -1
  169. package/esm/Select/index.js +26 -41
  170. package/esm/Select/{Select.module.css → index.module.css} +12 -17
  171. package/esm/Select/index.props.d.ts +6 -3
  172. package/esm/Separator/index.js +2 -2
  173. package/esm/Skeleton/Skeleton.module.css +4 -4
  174. package/esm/Skeleton/index.js +3 -3
  175. package/esm/Switch/Switch.module.css +22 -22
  176. package/esm/Switch/index.js +6 -6
  177. package/esm/Theme/colors/common.d.ts +27 -0
  178. package/esm/Theme/colors/common.js +20 -0
  179. package/esm/Theme/colors/index.d.ts +48 -0
  180. package/esm/Theme/colors/index.js +8 -0
  181. package/esm/Theme/colors/theme_buenos_aires.d.ts +47 -0
  182. package/esm/Theme/colors/theme_buenos_aires.js +31 -0
  183. package/esm/Theme/colors/theme_default.d.ts +47 -0
  184. package/esm/Theme/colors/theme_default.js +31 -0
  185. package/esm/Theme/global.css +7 -5
  186. package/esm/Theme/index.d.ts +12 -0
  187. package/esm/Theme/themes/buenos_aires.js +1 -1
  188. package/esm/Theme/themes/default.d.ts +12 -0
  189. package/esm/Theme/themes/default.js +13 -1
  190. package/esm/TimeSelect/Label/index.d.ts +8 -0
  191. package/esm/TimeSelect/helpers.d.ts +7 -0
  192. package/esm/TimeSelect/index.d.ts +7 -0
  193. package/esm/TimeSelect/index.props.d.ts +4 -0
  194. package/esm/Typography/Typography.module.css +3 -3
  195. package/esm/Typography/index.d.ts +2 -2
  196. package/esm/Typography/index.js +5 -5
  197. package/esm/Typography/index.props.d.ts +2 -1
  198. package/esm/base/BaseInput/BaseInput.module.css +4 -4
  199. package/esm/base/BaseInput/index.js +3 -3
  200. package/esm/base/FormField/index.js +4 -4
  201. package/esm/base/InputRoot/InputRoot.module.css +22 -20
  202. package/esm/base/InputRoot/index.js +8 -8
  203. package/esm/helpers/date/index.d.ts +11 -0
  204. package/esm/helpers/date/index.js +69 -0
  205. package/esm/index.d.ts +3 -1
  206. package/esm/index.js +2 -0
  207. package/esm/libs/numbers/leadingZeros.d.ts +4 -0
  208. package/esm/libs/numbers/leadingZeros.js +12 -0
  209. package/esm/libs/requestIdleCallback/index.d.ts +5 -0
  210. package/esm/libs/requestIdleCallback/index.js +9 -0
  211. package/esm/theme_default_variables.css +12 -0
  212. package/helpers/date/index.d.ts +11 -0
  213. package/helpers/date/index.js +79 -0
  214. package/index.d.ts +3 -1
  215. package/index.js +43 -39
  216. package/libs/numbers/leadingZeros.d.ts +4 -0
  217. package/libs/numbers/leadingZeros.js +14 -0
  218. package/libs/requestIdleCallback/index.d.ts +5 -0
  219. package/libs/requestIdleCallback/index.js +11 -0
  220. package/package.json +2 -1
  221. package/theme_default_variables.css +12 -0
  222. package/Theme/color.d.ts +0 -118
  223. package/Theme/color.js +0 -88
  224. package/esm/Theme/color.d.ts +0 -118
  225. package/esm/Theme/color.js +0 -72
@@ -1,19 +1,14 @@
1
- .root {
2
- display: grid;
3
- grid-gap: 10px;
4
- }
5
-
6
1
  .root {
7
2
  display: flex;
8
3
  flex-wrap: wrap;
9
4
  }
10
5
 
11
- .root {
12
- display: grid;
13
- grid-auto-rows: minmax(150px, auto);
14
- }
15
-
16
6
  @supports (display: grid) {
7
+ .root {
8
+ display: grid;
9
+ grid-auto-rows: minmax(150px, auto);
10
+ grid-gap: 10px;
11
+ }
17
12
  .root > * {
18
13
  margin: 0;
19
14
  }
@@ -3,7 +3,7 @@
3
3
  }
4
4
 
5
5
  .item {
6
+ flex: 1 1 250px;
6
7
  margin-left: 5px;
7
8
  margin-right: 5px;
8
- flex: 1 1 250px;
9
9
  }
@@ -17,9 +17,11 @@ var GridItem = function GridItem(_a) {
17
17
  var children = _a.children,
18
18
  _c = _a.fullWidth,
19
19
  fullWidth = _c === void 0 ? false : _c,
20
- className = _a.className;
20
+ className = _a.className,
21
+ style = _a.style;
21
22
  return /*#__PURE__*/React__default.default.createElement("div", {
22
- className: classNames__default.default(styles__default.default.item, (_b = {}, _b[styles__default.default.full] = fullWidth, _b), className)
23
+ className: classNames__default.default(styles__default.default.item, (_b = {}, _b[styles__default.default.full] = fullWidth, _b), className),
24
+ style: style
23
25
  }, children);
24
26
  };
25
27
 
@@ -1,6 +1,7 @@
1
- import type { ReactNode } from "react";
1
+ import type { CSSProperties, ReactNode } from "react";
2
2
  export type GridItemProps = {
3
3
  children: ReactNode;
4
4
  fullWidth?: boolean;
5
5
  className?: string;
6
+ style?: CSSProperties;
6
7
  };
@@ -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;
package/Icons/Check.js ADDED
@@ -0,0 +1,41 @@
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 Check = /*#__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
+ ref: ref
25
+ }, props, {
26
+ viewBox: "0 0 24 24",
27
+ fill: "none"
28
+ }), /*#__PURE__*/React__default.default.createElement("g", {
29
+ clipPath: "url(#a)"
30
+ }, /*#__PURE__*/React__default.default.createElement("path", {
31
+ fill: fill,
32
+ d: "m9.109 15.441-5.23-5.402L2 11.69 9.075 19 21.443 6.682 19.595 5z"
33
+ })), /*#__PURE__*/React__default.default.createElement("defs", null, /*#__PURE__*/React__default.default.createElement("clipPath", {
34
+ id: "a"
35
+ }, /*#__PURE__*/React__default.default.createElement("path", {
36
+ fill: "#fff",
37
+ d: "M0 0h24v24H0z"
38
+ }))));
39
+ });
40
+
41
+ exports.default = Check;
@@ -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;
@@ -1,18 +1,17 @@
1
1
  .root {
2
+ height: 100%;
3
+ left: 0;
2
4
  position: absolute;
3
5
  top: 0;
4
- left: 0;
5
6
  width: 100%;
6
- height: 100%;
7
7
  }
8
8
  .root img {
9
- width: 100%;
10
- height: 100%;
11
- visibility: visible;
12
- font: 0/0 a;
13
9
  border: 0;
10
+ height: 100%;
14
11
  object-fit: cover;
15
12
  text-indent: -100rem;
13
+ visibility: visible;
14
+ width: 100%;
16
15
  }
17
16
  .root img :-moz-broken {
18
17
  opacity: 0;
@@ -4,9 +4,7 @@
4
4
  }
5
5
 
6
6
  .text {
7
- flex-basis: auto;
8
- flex-grow: 1;
9
- flex-shrink: 1;
7
+ flex: 1 1 auto;
10
8
  line-height: 18px;
11
9
  margin-inline-start: 8px;
12
10
  }
@@ -52,21 +50,21 @@
52
50
  padding: 0;
53
51
  position: absolute;
54
52
  }
55
- .input:not(.input_disabled):not(.input_error):hover + .icon {
53
+ .input:not(.input_disabled, .input_error):hover + .icon {
56
54
  border-color: var(--inputradio-primary-background-color-hovered);
57
55
  }
58
- .input:not(.input_disabled):not(.input_error):focus + .icon {
56
+ .input:not(.input_disabled, .input_error):focus + .icon {
59
57
  box-shadow: 0 0 0 2px var(--inputradio-primary-box-shadow-focused);
60
58
  }
61
- .input:not(.input_disabled):not(.input_error):active + .icon {
59
+ .input:not(.input_disabled, .input_error):active + .icon {
62
60
  background-color: var(--inputradio-primary-background-color-focused);
63
61
  border-color: var(--inputradio-primary-border-color-focused);
64
62
  box-shadow: 0 0 0 2px var(--inputradio-primary-box-shadow-focused);
65
63
  }
66
- .input:not(.input_disabled):not(.input_error) .input_checked:hover + .icon {
64
+ .input:not(.input_disabled, .input_error) .input_checked:hover + .icon {
67
65
  border-color: var(--inputradio-primary-background-color-hovered);
68
66
  }
69
- .input:not(.input_disabled):not(.input_error) .input_checked:active + .icon {
67
+ .input:not(.input_disabled, .input_error) .input_checked:active + .icon {
70
68
  background-color: var(--palette-white);
71
69
  border: 4px solid var(--inputradio-primary-background-color-checked);
72
70
  }
@@ -79,12 +77,12 @@
79
77
  }
80
78
  .input_disabled + .icon::after {
81
79
  background-color: rgba(246, 246, 246, 0.8);
80
+ border-radius: 50%;
82
81
  content: "";
83
82
  display: block;
84
83
  inset: 0;
85
84
  margin: -1px;
86
85
  position: absolute;
87
- border-radius: 50%;
88
86
  }
89
87
  .input_checked:disabled + .icon::after {
90
88
  margin: -4px;
@@ -1,8 +1,8 @@
1
1
  .menu {
2
+ background: var(--palette-white);
3
+ color: var(--palette-black);
2
4
  margin: 0;
3
- text-align: left;
4
5
  padding: 0;
6
+ text-align: left;
5
7
  user-select: none;
6
- color: var(--palette-black);
7
- background: var(--palette-white);
8
8
  }
@@ -1,18 +1,19 @@
1
1
  .item {
2
+ align-items: center;
2
3
  cursor: pointer;
3
4
  display: flex;
4
- align-items: center;
5
- list-style: none;
6
- padding: 8px 6px;
5
+ font-size: 16px;
7
6
  font-style: normal;
8
7
  font-weight: 400;
9
- font-size: 16px;
8
+ justify-content: space-between;
10
9
  line-height: 22px;
10
+ list-style: none;
11
+ padding: 8px 6px;
11
12
  }
12
13
  .item > * {
13
- white-space: nowrap;
14
14
  overflow: hidden;
15
15
  text-overflow: ellipsis;
16
+ white-space: nowrap;
16
17
  }
17
18
 
18
19
  .variant_primary {
@@ -29,8 +30,8 @@
29
30
  }
30
31
 
31
32
  .disabled {
33
+ background-color: var(--palette-white);
34
+ color: var(--palette-bg-2);
32
35
  cursor: not-allowed;
33
36
  pointer-events: none;
34
- color: var(--palette-bg-2);
35
- background-color: var(--palette-white);
36
37
  }
@@ -1,4 +1,4 @@
1
- import type { FC } from "react";
1
+ import React from "react";
2
2
  import type { MenuItemProps } from "./index.props";
3
- declare const MenuItem: FC<MenuItemProps>;
3
+ declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLLIElement>>;
4
4
  export default MenuItem;
@@ -13,26 +13,26 @@ var classNames__default = /*#__PURE__*/_interopDefault(classNames);
13
13
  var styles__default = /*#__PURE__*/_interopDefault(styles);
14
14
 
15
15
  var clx = classNames__default.default.bind(styles__default.default);
16
- var MenuItem = function MenuItem(_a) {
16
+ var MenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
17
17
  var _b;
18
18
  var className = _a.className,
19
- _c = _a.isSelected,
20
- isSelected = _c === void 0 ? false : _c,
21
- _d = _a.variant,
22
- variant = _d === void 0 ? "primary" : _d,
19
+ isSelected = _a.isSelected,
20
+ _c = _a.variant,
21
+ variant = _c === void 0 ? "primary" : _c,
23
22
  disabled = _a.disabled,
24
23
  onClick = _a.onClick,
25
24
  children = _a.children;
26
25
  return /*#__PURE__*/React__default.default.createElement("li", {
26
+ ref: ref,
27
+ "data-component": "menu-item",
27
28
  style: {
28
- backgroundColor: isSelected ? "#B8D2FF" : ""
29
+ backgroundColor: isSelected ? "var(--palette-primary-1)" : "var(--palette-white)"
29
30
  },
30
- className: clx((_b = {
31
- item: true,
31
+ className: clx(styles__default.default.item, (_b = {
32
32
  disabled: disabled
33
33
  }, _b["variant_".concat(variant)] = !!variant, _b), className),
34
34
  onClick: onClick
35
35
  }, children);
36
- };
36
+ });
37
37
 
38
38
  exports.default = MenuItem;
package/Menu/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- import type { MenuProps } from "./index.props";
2
- declare const Menu: MenuProps;
1
+ import React from "react";
2
+ import type { Props } from "./index.props";
3
+ declare const Menu: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLUListElement>>;
3
4
  export default Menu;
package/Menu/index.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var classNames = require('classnames');
7
- var index = require('./components/MenuItem/index.js');
8
7
  var styles = require('./Menu.module.css');
9
8
 
10
9
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -13,7 +12,7 @@ var React__default = /*#__PURE__*/_interopDefault(React);
13
12
  var classNames__default = /*#__PURE__*/_interopDefault(classNames);
14
13
  var styles__default = /*#__PURE__*/_interopDefault(styles);
15
14
 
16
- var Menu = function Menu(_a) {
15
+ var Menu = /*#__PURE__*/React.forwardRef(function (_a, ref) {
17
16
  var selected = _a.selected,
18
17
  variant = _a.variant,
19
18
  className = _a.className,
@@ -37,9 +36,9 @@ var Menu = function Menu(_a) {
37
36
  });
38
37
  }, [children, selected, onClick]);
39
38
  return /*#__PURE__*/React__default.default.createElement("ul", {
39
+ ref: ref,
40
40
  className: classNames__default.default(styles__default.default.menu, className)
41
41
  }, renderChild);
42
- };
43
- Menu.Item = index.default;
42
+ });
44
43
 
45
44
  exports.default = Menu;
@@ -1,15 +1,10 @@
1
- import type { ReactElement, MouseEvent, FC } from "react";
2
- import type MenuItem from "./components/MenuItem";
1
+ import type { ReactElement, MouseEvent } from "react";
3
2
  import type { MenuItemProps } from "./components/MenuItem/index.props";
4
3
  export type MenuVariant = "primary";
5
- type Props = {
4
+ export type Props = {
6
5
  selected?: string[];
7
6
  variant?: MenuVariant;
8
7
  className?: string;
9
8
  onClick?: (key: string, e: MouseEvent) => void;
10
9
  children?: ReactElement<MenuItemProps> | ReactElement<MenuItemProps>[];
11
10
  };
12
- export interface MenuProps extends FC<Props> {
13
- Item: typeof MenuItem;
14
- }
15
- export {};
@@ -1,51 +1,51 @@
1
1
  .root {
2
+ bottom: 0;
3
+ height: 100%;
2
4
  position: fixed;
3
5
  top: 0;
4
- bottom: 0;
5
6
  width: 100%;
6
- height: 100%;
7
7
  z-index: 1000;
8
8
  }
9
9
 
10
- .titleWrapper {
11
- display: flex;
12
- justify-content: space-between;
10
+ .title-wrapper {
13
11
  align-items: center;
14
12
  border-bottom: 1px solid var(--palette-bg-2);
13
+ display: flex;
14
+ justify-content: space-between;
15
15
  }
16
16
 
17
- .closeWrapper {
17
+ .close-wrapper {
18
18
  display: flex;
19
19
  justify-content: flex-end;
20
20
  }
21
21
 
22
- .modalOverlay {
22
+ .modal-overlay {
23
+ background-color: rgba(0, 0, 0, 0.25);
24
+ bottom: 0;
25
+ height: 100%;
23
26
  position: fixed;
24
27
  top: 0;
25
- bottom: 0;
26
28
  width: 100%;
27
- height: 100%;
28
- background-color: rgba(0, 0, 0, 0.25);
29
29
  }
30
30
 
31
- .modalWrapper {
31
+ .modal-wrapper {
32
+ background-color: var(--palette-white);
33
+ display: flex;
34
+ flex-direction: column;
35
+ left: 50%;
32
36
  overflow: hidden;
33
37
  position: absolute;
34
- left: 50%;
35
38
  top: 50%;
36
39
  transform: translate(-50%, -50%);
37
- display: flex;
38
- flex-direction: column;
39
- background-color: var(--palette-white);
40
40
  }
41
- .modalWrapper_mobile {
41
+ .modal-wrapper_mobile {
42
42
  height: 100%;
43
43
  width: 100%;
44
44
  }
45
- .modalWrapper_desktop {
45
+ .modal-wrapper_desktop {
46
+ border: solid 1px var(--palette-bg-2);
47
+ border-radius: 8px;
46
48
  max-height: calc(100vh - 100px);
47
49
  max-width: calc(100vw - 100px);
48
50
  min-width: 515px;
49
- border: solid 1px var(--palette-bg-2);
50
- border-radius: 8px;
51
51
  }
@@ -1,6 +1,6 @@
1
1
  .root {
2
- overflow-y: auto;
3
2
  display: flex;
4
3
  min-height: 100%;
4
+ overflow-y: auto;
5
5
  padding: 10px;
6
6
  }
package/Modal/index.js CHANGED
@@ -49,20 +49,20 @@ var Modal = function Modal(_a) {
49
49
  return /*#__PURE__*/React__default.default.createElement(index$3.default, null, /*#__PURE__*/React__default.default.createElement("div", {
50
50
  className: clx(styles__default.default.root)
51
51
  }, /*#__PURE__*/React__default.default.createElement("div", {
52
- className: clx(styles__default.default.modalOverlay),
52
+ className: clx(styles__default.default["modal-overlay"]),
53
53
  onClick: onCloseHandler
54
54
  }), /*#__PURE__*/React__default.default.createElement("div", {
55
- className: clx(styles__default.default.modalWrapper, {
55
+ className: clx(styles__default.default["modal-wrapper"], {
56
56
  modalWrapper_desktop: isDesktop ? 1 : 0,
57
57
  modalWrapper_mobile: !isDesktop ? 1 : 0
58
58
  }, className),
59
59
  ref: modalRef
60
60
  }, title ? ( /*#__PURE__*/React__default.default.createElement("div", {
61
- className: clx(styles__default.default.titleWrapper)
61
+ className: clx(styles__default.default["title-wrapper"])
62
62
  }, /*#__PURE__*/React__default.default.createElement(index$4.default, null, title), /*#__PURE__*/React__default.default.createElement(index$5.default, {
63
63
  onClick: onCloseHandler
64
64
  }))) : ( /*#__PURE__*/React__default.default.createElement("div", {
65
- className: clx(styles__default.default.closeWrapper)
65
+ className: clx(styles__default.default["close-wrapper"])
66
66
  }, /*#__PURE__*/React__default.default.createElement(index$5.default, {
67
67
  onClick: onCloseHandler
68
68
  }))), /*#__PURE__*/React__default.default.createElement(index$6.default, null, children))));
@@ -1,4 +1,5 @@
1
- import React, { FC } from "react";
1
+ import React from "react";
2
+ import type { FC } from "react";
2
3
  export interface Option {
3
4
  id?: string;
4
5
  val: string | number;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ interface Props<T extends string> {
3
+ options: {
4
+ value: T;
5
+ label: React.ReactNode;
6
+ selected: boolean;
7
+ }[];
8
+ onChange: (value: T) => void;
9
+ }
10
+ declare const MenuOverlay: <T extends string>({ options, onChange }: Props<T>) => React.JSX.Element;
11
+ export default MenuOverlay;
@@ -0,0 +1,63 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var classNames = require('classnames/bind');
7
+ var index = require('../../../Menu/index.js');
8
+ var index$1 = require('../MenuOverlayItem/index.js');
9
+ var styles = require('./index.module.css');
10
+
11
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
+
13
+ var React__default = /*#__PURE__*/_interopDefault(React);
14
+ var classNames__default = /*#__PURE__*/_interopDefault(classNames);
15
+ var styles__default = /*#__PURE__*/_interopDefault(styles);
16
+
17
+ var clx = classNames__default.default.bind(styles__default.default);
18
+ var OFFSET_ITEMS_COUNT = 2;
19
+ var MenuOverlay = function MenuOverlay(_a) {
20
+ var options = _a.options,
21
+ onChange = _a.onChange;
22
+ var _b = React.useState(),
23
+ selected = _b[0],
24
+ setSelected = _b[1];
25
+ var _c = React.useState({
26
+ top: 0,
27
+ height: 0
28
+ }),
29
+ scrollView = _c[0],
30
+ setScrollView = _c[1];
31
+ var listRef = React.useRef(null);
32
+ var rootRef = React.useRef(null);
33
+ var handleSelect = React.useCallback(function (option, key) {
34
+ onChange(option.value);
35
+ setSelected(key.split(" "));
36
+ }, [onChange]);
37
+ React.useLayoutEffect(function () {
38
+ if (!rootRef || !rootRef.current) {
39
+ return;
40
+ }
41
+ rootRef.current.scrollTo({
42
+ top: scrollView.top - OFFSET_ITEMS_COUNT * scrollView.height
43
+ });
44
+ }, [scrollView, rootRef]);
45
+ return /*#__PURE__*/React__default.default.createElement("div", {
46
+ ref: rootRef,
47
+ className: clx(styles__default.default.root)
48
+ }, /*#__PURE__*/React__default.default.createElement(index.default, {
49
+ ref: listRef,
50
+ selected: selected
51
+ }, options.map(function (option, index) {
52
+ return /*#__PURE__*/React__default.default.createElement(index$1.default, {
53
+ setScrollView: setScrollView,
54
+ option: option,
55
+ key: "item-".concat(index),
56
+ onClick: function onClick() {
57
+ return handleSelect(option, "item-".concat(index));
58
+ }
59
+ });
60
+ })));
61
+ };
62
+
63
+ exports.default = MenuOverlay;
@@ -0,0 +1,4 @@
1
+ .root {
2
+ max-height: 140px;
3
+ overflow-y: auto;
4
+ }
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import type { Coordinates } from "../../index.props";
3
+ type SelectItemProps = {
4
+ option: {
5
+ value: string;
6
+ label: React.ReactNode;
7
+ selected: boolean;
8
+ };
9
+ onClick?: () => void;
10
+ setScrollView: (value: Coordinates) => void;
11
+ };
12
+ declare const SelectItem: ({ option, onClick, setScrollView }: SelectItemProps) => React.JSX.Element;
13
+ export default SelectItem;
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var index = require('../../../Menu/components/MenuItem/index.js');
7
+ var Check = require('../../../Icons/Check.js');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var React__default = /*#__PURE__*/_interopDefault(React);
12
+
13
+ var SelectItem = function SelectItem(_a) {
14
+ var option = _a.option,
15
+ onClick = _a.onClick,
16
+ setScrollView = _a.setScrollView;
17
+ var ref = React.useRef(null);
18
+ function scrollToItem() {
19
+ if (!ref.current) {
20
+ return;
21
+ }
22
+ var _a = ref.current,
23
+ offsetTop = _a.offsetTop,
24
+ offsetHeight = _a.offsetHeight;
25
+ setScrollView({
26
+ top: offsetTop,
27
+ height: offsetHeight
28
+ });
29
+ }
30
+ React.useLayoutEffect(function () {
31
+ if (option.selected) {
32
+ scrollToItem();
33
+ }
34
+ }, []);
35
+ return /*#__PURE__*/React__default.default.createElement(index.default, {
36
+ ref: ref,
37
+ onClick: onClick,
38
+ isSelected: option.selected
39
+ }, option.label, option.selected && /*#__PURE__*/React__default.default.createElement(Check.default, {
40
+ width: 16,
41
+ height: 16
42
+ }));
43
+ };
44
+
45
+ exports.default = SelectItem;
package/Select/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { SelectProps } from "./index.props";
3
- declare const Select: <T extends string | number>({ options, value, zIndex, label, hint, error, placeholder, disabled, listHeight, fullWidth, onChange, }: SelectProps<T>) => React.JSX.Element;
3
+ declare const Select: <T extends string>({ options, value, zIndex, label, hint, error, placeholder, disabled, fullWidth, onChange, }: SelectProps<T>) => React.JSX.Element;
4
4
  export default Select;