colibri-ui 0.8.84 → 0.8.87

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 (257) hide show
  1. package/Accordion/Accordion.module.css +4 -0
  2. package/Accordion/index.js +15 -23
  3. package/Autocomplete/Autocomplete.js +101 -132
  4. package/Avatar/Avatar.module.css +6 -0
  5. package/Avatar/index.js +102 -89
  6. package/Badge/Badge.module.css +2 -1
  7. package/Badge/Control/index.js +5 -3
  8. package/Badge/index.js +16 -16
  9. package/Button/index.js +23 -20
  10. package/Button/tokens.js +2 -2
  11. package/Calendar/Calendar.js +171 -269
  12. package/Card/Card.js +26 -32
  13. package/Checkbox/index.js +46 -43
  14. package/Chip/Chip.module.css +2 -1
  15. package/Chip/index.js +15 -15
  16. package/ClickOutside/index.js +10 -13
  17. package/CodeField/CodeField.js +113 -170
  18. package/Counter/Counter.module.css +2 -1
  19. package/Counter/index.js +21 -20
  20. package/Datepicker/components/DatePicker/index.js +81 -102
  21. package/Datepicker/index.js +17 -16
  22. package/DotsLoader/index.js +23 -15
  23. package/Drawer/Drawer.js +84 -98
  24. package/Drawer/Drawer.module.css +2 -1
  25. package/Drawer/index.props.d.ts +2 -0
  26. package/Dropdown/index.js +55 -68
  27. package/Dropzone/Dropzone.js +78 -168
  28. package/Dropzone/Dropzone.module.css +2 -1
  29. package/Editable/Editable.js +44 -57
  30. package/Grid/Item/index.js +11 -13
  31. package/Grid/index.js +15 -21
  32. package/Icons/ArrowNext.js +7 -8
  33. package/Icons/Cart.js +7 -8
  34. package/Icons/Check.js +7 -8
  35. package/Icons/Chevron.js +7 -8
  36. package/Icons/Close.js +6 -6
  37. package/Icons/Copy.js +7 -8
  38. package/Icons/Cross.js +6 -6
  39. package/Icons/CrossFill.js +7 -8
  40. package/Icons/Edit.js +7 -8
  41. package/Icons/Exit.js +7 -8
  42. package/Icons/EyeClosed.js +7 -8
  43. package/Icons/EyeOpen.js +7 -8
  44. package/Icons/Help.js +6 -6
  45. package/Icons/Info.js +7 -8
  46. package/Icons/Minus.js +7 -8
  47. package/Icons/More.js +7 -8
  48. package/Icons/Plus.js +7 -8
  49. package/Icons/Setting.js +7 -8
  50. package/Icons/Shield.js +7 -8
  51. package/Icons/Trash.js +7 -8
  52. package/Icons/User.js +7 -8
  53. package/Image/Image.module.css +4 -0
  54. package/Image/index.d.ts +1 -1
  55. package/Image/index.js +44 -37
  56. package/Input/index.d.ts +1 -1
  57. package/Input/index.js +37 -25
  58. package/Input/index.props.d.ts +1 -1
  59. package/InputRadio/index.js +32 -24
  60. package/List/List.js +81 -76
  61. package/Menu/Menu.module.css +2 -1
  62. package/Menu/components/MenuItem/index.js +17 -14
  63. package/Menu/index.js +22 -23
  64. package/Modal/components/Body/index.js +9 -8
  65. package/Modal/components/Close/Close.module.css +4 -0
  66. package/Modal/components/Close/index.js +13 -14
  67. package/Modal/components/Content/index.js +5 -6
  68. package/Modal/components/Footer/index.js +5 -3
  69. package/Modal/components/Header/index.js +13 -12
  70. package/Modal/components/Title/index.js +10 -9
  71. package/Modal/context.js +3 -3
  72. package/Modal/index.js +46 -68
  73. package/MultiSelect/components/MenuOverlay/index.js +48 -61
  74. package/MultiSelect/components/MenuOverlayItem/index.js +13 -14
  75. package/MultiSelect/index.js +72 -100
  76. package/MultiSelect/index.module.css +2 -1
  77. package/MultiSelect/utils/index.js +8 -18
  78. package/NumberInput/NumberInput.js +80 -112
  79. package/Portal/index.js +6 -10
  80. package/Progress/Progress.js +45 -58
  81. package/RadioGroup/Radio.js +29 -32
  82. package/RadioGroup/index.js +43 -46
  83. package/Rating/Rating.js +50 -63
  84. package/Select/components/MenuOverlay/index.js +16 -25
  85. package/Select/components/MenuOverlayItem/index.js +13 -11
  86. package/Select/index.js +39 -48
  87. package/Select/index.module.css +2 -1
  88. package/Separator/index.js +5 -6
  89. package/Sheet/Sheet.js +98 -122
  90. package/Sheet/Sheet.module.css +4 -2
  91. package/Sheet/index.props.d.ts +2 -0
  92. package/Skeleton/index.js +25 -30
  93. package/Slider/Slider.js +83 -119
  94. package/Status/index.js +17 -18
  95. package/Switch/Switch.module.css +2 -1
  96. package/Switch/index.js +22 -15
  97. package/TabsMenu/Tab/Tab.js +14 -10
  98. package/TabsMenu/Tab/Tab.module.css +2 -1
  99. package/TabsMenu/index.js +25 -26
  100. package/TabsPanels/Panel/index.js +6 -4
  101. package/TabsPanels/index.js +13 -10
  102. package/TextArea/index.d.ts +1 -1
  103. package/TextArea/index.js +30 -19
  104. package/Theme/breakpoints.js +5 -11
  105. package/Theme/colors/theme_buenos_aires.js +14 -14
  106. package/Theme/colors/theme_jaipur.js +14 -14
  107. package/Theme/global.css +0 -1
  108. package/Theme/index.js +1 -1
  109. package/TimeSelect/Label/index.js +11 -13
  110. package/TimeSelect/helpers.js +23 -42
  111. package/TimeSelect/index.js +32 -38
  112. package/Tooltip/index.js +36 -42
  113. package/Typography/Typography.module.css +1365 -0
  114. package/Typography/index.js +24 -13
  115. package/Typography/index.props.d.ts +13 -1
  116. package/base/BaseInput/index.js +10 -8
  117. package/base/FormField/index.d.ts +1 -1
  118. package/base/FormField/index.js +27 -22
  119. package/base/FormField/index.props.d.ts +4 -0
  120. package/base/InputRoot/index.js +27 -27
  121. package/esm/Accordion/Accordion.module.css +4 -0
  122. package/esm/Accordion/index.js +15 -21
  123. package/esm/Autocomplete/Autocomplete.js +101 -130
  124. package/esm/Avatar/Avatar.module.css +6 -0
  125. package/esm/Avatar/index.js +102 -88
  126. package/esm/Badge/Badge.module.css +2 -1
  127. package/esm/Badge/Control/index.js +5 -3
  128. package/esm/Badge/index.js +16 -15
  129. package/esm/Button/index.js +23 -19
  130. package/esm/Button/tokens.js +2 -2
  131. package/esm/Calendar/Calendar.js +171 -267
  132. package/esm/Card/Card.js +26 -32
  133. package/esm/Checkbox/index.js +46 -42
  134. package/esm/Chip/Chip.module.css +2 -1
  135. package/esm/Chip/index.js +15 -14
  136. package/esm/ClickOutside/index.js +10 -13
  137. package/esm/CodeField/CodeField.js +113 -169
  138. package/esm/Counter/Counter.module.css +2 -1
  139. package/esm/Counter/index.js +21 -19
  140. package/esm/Datepicker/components/DatePicker/index.js +81 -101
  141. package/esm/Datepicker/index.js +17 -16
  142. package/esm/DotsLoader/index.js +23 -14
  143. package/esm/Drawer/Drawer.js +84 -97
  144. package/esm/Drawer/Drawer.module.css +2 -1
  145. package/esm/Drawer/index.props.d.ts +2 -0
  146. package/esm/Dropdown/index.js +55 -66
  147. package/esm/Dropzone/Dropzone.js +78 -165
  148. package/esm/Dropzone/Dropzone.module.css +2 -1
  149. package/esm/Editable/Editable.js +44 -56
  150. package/esm/Grid/Item/index.js +11 -12
  151. package/esm/Grid/index.js +15 -21
  152. package/esm/Icons/ArrowNext.js +7 -8
  153. package/esm/Icons/Cart.js +7 -8
  154. package/esm/Icons/Check.js +7 -8
  155. package/esm/Icons/Chevron.js +7 -8
  156. package/esm/Icons/Close.js +6 -6
  157. package/esm/Icons/Copy.js +7 -8
  158. package/esm/Icons/Cross.js +6 -6
  159. package/esm/Icons/CrossFill.js +7 -8
  160. package/esm/Icons/Edit.js +7 -8
  161. package/esm/Icons/Exit.js +7 -8
  162. package/esm/Icons/EyeClosed.js +7 -8
  163. package/esm/Icons/EyeOpen.js +7 -8
  164. package/esm/Icons/Help.js +6 -6
  165. package/esm/Icons/Info.js +7 -8
  166. package/esm/Icons/Minus.js +7 -8
  167. package/esm/Icons/More.js +7 -8
  168. package/esm/Icons/Plus.js +7 -8
  169. package/esm/Icons/Setting.js +7 -8
  170. package/esm/Icons/Shield.js +7 -8
  171. package/esm/Icons/Trash.js +7 -8
  172. package/esm/Icons/User.js +7 -8
  173. package/esm/Image/Image.module.css +4 -0
  174. package/esm/Image/index.d.ts +1 -1
  175. package/esm/Image/index.js +44 -36
  176. package/esm/Input/index.d.ts +1 -1
  177. package/esm/Input/index.js +38 -26
  178. package/esm/Input/index.props.d.ts +1 -1
  179. package/esm/InputRadio/index.js +32 -23
  180. package/esm/List/List.js +81 -75
  181. package/esm/Menu/Menu.module.css +2 -1
  182. package/esm/Menu/components/MenuItem/index.js +17 -13
  183. package/esm/Menu/index.js +22 -23
  184. package/esm/Modal/components/Body/index.js +9 -7
  185. package/esm/Modal/components/Close/Close.module.css +4 -0
  186. package/esm/Modal/components/Close/index.js +13 -14
  187. package/esm/Modal/components/Content/index.js +5 -6
  188. package/esm/Modal/components/Footer/index.js +5 -3
  189. package/esm/Modal/components/Header/index.js +13 -11
  190. package/esm/Modal/components/Title/index.js +10 -9
  191. package/esm/Modal/context.js +3 -3
  192. package/esm/Modal/index.js +50 -70
  193. package/esm/MultiSelect/components/MenuOverlay/index.js +48 -60
  194. package/esm/MultiSelect/components/MenuOverlayItem/index.js +13 -14
  195. package/esm/MultiSelect/index.js +72 -97
  196. package/esm/MultiSelect/index.module.css +2 -1
  197. package/esm/MultiSelect/utils/index.js +8 -14
  198. package/esm/NumberInput/NumberInput.js +80 -111
  199. package/esm/Portal/index.js +6 -9
  200. package/esm/Progress/Progress.js +45 -58
  201. package/esm/RadioGroup/Radio.js +29 -32
  202. package/esm/RadioGroup/index.js +43 -45
  203. package/esm/Rating/Rating.js +50 -63
  204. package/esm/Select/components/MenuOverlay/index.js +16 -24
  205. package/esm/Select/components/MenuOverlayItem/index.js +13 -11
  206. package/esm/Select/index.js +39 -46
  207. package/esm/Select/index.module.css +2 -1
  208. package/esm/Separator/index.js +5 -6
  209. package/esm/Sheet/Sheet.js +98 -120
  210. package/esm/Sheet/Sheet.module.css +4 -2
  211. package/esm/Sheet/index.props.d.ts +2 -0
  212. package/esm/Skeleton/index.js +25 -30
  213. package/esm/Slider/Slider.js +83 -119
  214. package/esm/Status/index.js +17 -17
  215. package/esm/Switch/Switch.module.css +2 -1
  216. package/esm/Switch/index.js +22 -14
  217. package/esm/TabsMenu/Tab/Tab.js +14 -9
  218. package/esm/TabsMenu/Tab/Tab.module.css +2 -1
  219. package/esm/TabsMenu/index.js +25 -26
  220. package/esm/TabsPanels/Panel/index.js +6 -4
  221. package/esm/TabsPanels/index.js +13 -10
  222. package/esm/TextArea/index.d.ts +1 -1
  223. package/esm/TextArea/index.js +31 -20
  224. package/esm/Theme/breakpoints.js +5 -11
  225. package/esm/Theme/colors/theme_buenos_aires.js +14 -14
  226. package/esm/Theme/colors/theme_jaipur.js +14 -14
  227. package/esm/Theme/global.css +0 -1
  228. package/esm/Theme/index.js +1 -1
  229. package/esm/TimeSelect/Label/index.js +11 -13
  230. package/esm/TimeSelect/helpers.js +22 -37
  231. package/esm/TimeSelect/index.js +32 -38
  232. package/esm/Tooltip/index.js +36 -41
  233. package/esm/Typography/Typography.module.css +1365 -0
  234. package/esm/Typography/index.js +24 -12
  235. package/esm/Typography/index.props.d.ts +13 -1
  236. package/esm/base/BaseInput/index.js +10 -8
  237. package/esm/base/FormField/index.d.ts +1 -1
  238. package/esm/base/FormField/index.js +27 -21
  239. package/esm/base/FormField/index.props.d.ts +4 -0
  240. package/esm/base/InputRoot/index.js +27 -26
  241. package/esm/helpers/date/index.js +4 -8
  242. package/esm/hooks/useMediaSizes/index.js +9 -15
  243. package/esm/hooks/useModalStack/index.js +6 -9
  244. package/esm/hooks/useOnClickOutside/index.js +6 -6
  245. package/esm/hooks/useScrollLock/index.js +10 -9
  246. package/esm/hooks/useTrapFocus/index.js +8 -10
  247. package/esm/index.d.ts +1 -1
  248. package/esm/lib/keyboard.js +2 -4
  249. package/helpers/date/index.js +21 -32
  250. package/hooks/useMediaSizes/index.js +9 -15
  251. package/hooks/useModalStack/index.js +6 -9
  252. package/hooks/useOnClickOutside/index.js +6 -6
  253. package/hooks/useScrollLock/index.js +10 -9
  254. package/hooks/useTrapFocus/index.js +8 -10
  255. package/index.d.ts +1 -1
  256. package/lib/keyboard.js +2 -4
  257. package/package.json +5 -1
@@ -2,118 +2,88 @@ import { __rest } from 'tslib';
2
2
  import React, { forwardRef, useRef } from 'react';
3
3
  import styles from './Slider.module.css';
4
4
 
5
- var cx = function cx() {
6
- for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {
7
- classNames[_key] = arguments[_key];
8
- }
9
- return classNames.filter(Boolean).join(" ");
10
- };
11
- var clamp = function clamp(value, min, max) {
12
- return Math.min(max, Math.max(min, value));
13
- };
14
- var decimals = function decimals(value) {
5
+ const cx = (...classNames) => classNames.filter(Boolean).join(" ");
6
+ const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
7
+ const decimals = value => {
15
8
  var _a;
16
9
  return ((_a = String(value).split(".")[1]) !== null && _a !== void 0 ? _a : "").length;
17
10
  };
18
- var normalize = function normalize(value, min, max, step) {
19
- var snapped = min + Math.round((clamp(value, min, max) - min) / step) * step;
11
+ const normalize = (value, min, max, step) => {
12
+ const snapped = min + Math.round((clamp(value, min, max) - min) / step) * step;
20
13
  return Number(clamp(snapped, min, max).toFixed(Math.max(decimals(step), decimals(min))));
21
14
  };
22
- var Slider = /*#__PURE__*/forwardRef(function SliderComponent(props, ref) {
15
+ const Slider = /*#__PURE__*/forwardRef(function SliderComponent(props, ref) {
23
16
  var _a;
24
- var _props$mode = props.mode,
25
- mode = _props$mode === void 0 ? "single" : _props$mode,
26
- value = props.value,
27
- onChange = props.onChange,
28
- onChangeCommitted = props.onChangeCommitted,
29
- _props$min = props.min,
30
- min = _props$min === void 0 ? 0 : _props$min,
31
- _props$max = props.max,
32
- max = _props$max === void 0 ? 100 : _props$max,
33
- _props$step = props.step,
34
- step = _props$step === void 0 ? 1 : _props$step,
35
- label = props.label,
36
- labelContent = props.labelContent,
37
- _props$labelPlacement = props.labelPlacement,
38
- labelPlacement = _props$labelPlacement === void 0 ? "top" : _props$labelPlacement,
39
- _props$orientation = props.orientation,
40
- orientation = _props$orientation === void 0 ? "horizontal" : _props$orientation,
41
- _props$reversed = props.reversed,
42
- reversed = _props$reversed === void 0 ? false : _props$reversed,
43
- _props$disabled = props.disabled,
44
- disabled = _props$disabled === void 0 ? false : _props$disabled,
45
- _props$size = props.size,
46
- size = _props$size === void 0 ? "m" : _props$size,
47
- _props$view = props.view,
48
- view = _props$view === void 0 ? "default" : _props$view,
49
- _props$pointerSize = props.pointerSize,
50
- pointerSize = _props$pointerSize === void 0 ? "small" : _props$pointerSize,
51
- _props$pointerVisibil = props.pointerVisibility,
52
- pointerVisibility = _props$pointerVisibil === void 0 ? "always" : _props$pointerVisibil,
53
- _props$showValue = props.showValue,
54
- showValue = _props$showValue === void 0 ? false : _props$showValue,
55
- _props$valueFormatter = props.valueFormatter,
56
- valueFormatter = _props$valueFormatter === void 0 ? function (current) {
57
- return current;
58
- } : _props$valueFormatter,
59
- _props$ticks = props.ticks,
60
- ticks = _props$ticks === void 0 ? [] : _props$ticks,
61
- _props$tickType = props.tickType,
62
- tickType = _props$tickType === void 0 ? "bullet" : _props$tickType,
63
- ariaLabel = props.ariaLabel,
64
- name = props.name,
65
- className = props.className,
17
+ const {
18
+ mode = "single",
19
+ value,
20
+ onChange,
21
+ onChangeCommitted,
22
+ min = 0,
23
+ max = 100,
24
+ step = 1,
25
+ label,
26
+ labelContent,
27
+ labelPlacement = "top",
28
+ orientation = "horizontal",
29
+ reversed = false,
30
+ disabled = false,
31
+ size = "m",
32
+ view = "default",
33
+ pointerSize = "small",
34
+ pointerVisibility = "always",
35
+ showValue = false,
36
+ valueFormatter = current => current,
37
+ ticks = [],
38
+ tickType = "bullet",
39
+ ariaLabel,
40
+ name,
41
+ className
42
+ } = props,
66
43
  rest = __rest(props, ["mode", "value", "onChange", "onChangeCommitted", "min", "max", "step", "label", "labelContent", "labelPlacement", "orientation", "reversed", "disabled", "size", "view", "pointerSize", "pointerVisibility", "showValue", "valueFormatter", "ticks", "tickType", "ariaLabel", "name", "className"]);
67
- var trackRef = useRef(null);
68
- var activeThumb = useRef(0);
69
- var range = max - min || 1;
70
- var values = mode === "range" ? [normalize(value[0], min, max, step), normalize(value[1], min, max, step)] : [min, normalize(value, min, max, step)];
71
- var low = Math.min(values[0], values[1]);
72
- var high = Math.max(values[0], values[1]);
73
- var toPercent = function toPercent(current) {
74
- return (current - min) / range * 100;
75
- };
76
- var toVisualPercent = function toVisualPercent(current) {
77
- return reversed ? 100 - toPercent(current) : toPercent(current);
78
- };
79
- var thumbPercents = [toVisualPercent(values[0]), toVisualPercent(values[1])];
80
- var lowPercent = mode === "range" ? Math.min.apply(Math, thumbPercents) : 0;
81
- var highPercent = mode === "range" ? Math.max.apply(Math, thumbPercents) : thumbPercents[1];
82
- var minDistance = mode === "range" ? Math.max(0, (_a = props.minDistance) !== null && _a !== void 0 ? _a : 0) : 0;
83
- var emitValue = function emitValue(index, nextValue) {
84
- var committed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
85
- var next = normalize(nextValue, min, max, step);
44
+ const trackRef = useRef(null);
45
+ const activeThumb = useRef(0);
46
+ const range = max - min || 1;
47
+ const values = mode === "range" ? [normalize(value[0], min, max, step), normalize(value[1], min, max, step)] : [min, normalize(value, min, max, step)];
48
+ const low = Math.min(values[0], values[1]);
49
+ const high = Math.max(values[0], values[1]);
50
+ const toPercent = current => (current - min) / range * 100;
51
+ const toVisualPercent = current => reversed ? 100 - toPercent(current) : toPercent(current);
52
+ const thumbPercents = [toVisualPercent(values[0]), toVisualPercent(values[1])];
53
+ const lowPercent = mode === "range" ? Math.min(...thumbPercents) : 0;
54
+ const highPercent = mode === "range" ? Math.max(...thumbPercents) : thumbPercents[1];
55
+ const minDistance = mode === "range" ? Math.max(0, (_a = props.minDistance) !== null && _a !== void 0 ? _a : 0) : 0;
56
+ const emitValue = (index, nextValue, committed = false) => {
57
+ const next = normalize(nextValue, min, max, step);
86
58
  if (mode === "single") {
87
59
  if (committed) onChangeCommitted === null || onChangeCommitted === void 0 ? void 0 : onChangeCommitted(next);else onChange(next);
88
60
  return;
89
61
  }
90
- var current = values;
91
- var nextRange = index === 0 ? [Math.min(next, current[1] - minDistance), current[1]] : [current[0], Math.max(next, current[0] + minDistance)];
62
+ const current = values;
63
+ const nextRange = index === 0 ? [Math.min(next, current[1] - minDistance), current[1]] : [current[0], Math.max(next, current[0] + minDistance)];
92
64
  if (committed) onChangeCommitted === null || onChangeCommitted === void 0 ? void 0 : onChangeCommitted(nextRange);else onChange(nextRange);
93
65
  };
94
- var valueFromPointer = function valueFromPointer(event) {
66
+ const valueFromPointer = event => {
95
67
  var _a;
96
- var rect = (_a = trackRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
68
+ const rect = (_a = trackRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
97
69
  if (!rect) return min;
98
- var rawRatio = orientation === "horizontal" ? (event.clientX - rect.left) / rect.width : (rect.bottom - event.clientY) / rect.height;
99
- var ratio = reversed ? 1 - rawRatio : rawRatio;
70
+ const rawRatio = orientation === "horizontal" ? (event.clientX - rect.left) / rect.width : (rect.bottom - event.clientY) / rect.height;
71
+ const ratio = reversed ? 1 - rawRatio : rawRatio;
100
72
  return min + clamp(ratio, 0, 1) * range;
101
73
  };
102
- var handlePointerDown = function handlePointerDown(event) {
74
+ const handlePointerDown = event => {
103
75
  if (disabled || event.target instanceof HTMLInputElement) return;
104
- var nextValue = valueFromPointer(event);
76
+ const nextValue = valueFromPointer(event);
105
77
  activeThumb.current = mode === "range" && Math.abs(nextValue - values[0]) <= Math.abs(nextValue - values[1]) ? 0 : 1;
106
78
  event.currentTarget.setPointerCapture(event.pointerId);
107
79
  emitValue(activeThumb.current, nextValue);
108
80
  };
109
- var normalizedTicks = ticks.map(function (tick) {
110
- return typeof tick === "number" ? {
111
- value: tick,
112
- label: tick
113
- } : tick;
114
- });
115
- var horizontal = orientation === "horizontal";
116
- var labelNode = labelPlacement !== "none" && (label || labelContent) && (/*#__PURE__*/React.createElement("div", {
81
+ const normalizedTicks = ticks.map(tick => typeof tick === "number" ? {
82
+ value: tick,
83
+ label: tick
84
+ } : tick);
85
+ const horizontal = orientation === "horizontal";
86
+ const labelNode = labelPlacement !== "none" && (label || labelContent) && (/*#__PURE__*/React.createElement("div", {
117
87
  className: styles.label_wrapper
118
88
  }, labelContent && (/*#__PURE__*/React.createElement("span", {
119
89
  className: styles.label_content
@@ -122,24 +92,24 @@ var Slider = /*#__PURE__*/forwardRef(function SliderComponent(props, ref) {
122
92
  }, label)));
123
93
  return /*#__PURE__*/React.createElement("div", Object.assign({}, rest, {
124
94
  ref: ref,
125
- className: cx(styles.root, styles[size], styles[view], styles[orientation], styles["pointer_".concat(pointerSize)], pointerVisibility === "hover" && styles.pointer_on_hover, labelPlacement === "left" && styles.label_left, reversed && styles.reversed, disabled && styles.disabled, className)
95
+ className: cx(styles.root, styles[size], styles[view], styles[orientation], styles[`pointer_${pointerSize}`], pointerVisibility === "hover" && styles.pointer_on_hover, labelPlacement === "left" && styles.label_left, reversed && styles.reversed, disabled && styles.disabled, className)
126
96
  }), labelPlacement === "top" && labelNode, /*#__PURE__*/React.createElement("div", {
127
97
  className: styles.main
128
98
  }, labelPlacement === "left" && labelNode, /*#__PURE__*/React.createElement("div", {
129
99
  className: cx(styles.slider_area, mode === "range" && styles.range),
130
100
  style: {
131
- "--slider-low": "".concat(thumbPercents[0], "%"),
132
- "--slider-high": "".concat(thumbPercents[1], "%")
101
+ "--slider-low": `${thumbPercents[0]}%`,
102
+ "--slider-high": `${thumbPercents[1]}%`
133
103
  }
134
104
  }, /*#__PURE__*/React.createElement("div", {
135
105
  ref: trackRef,
136
106
  className: cx(styles.track, tickType === "separator" && styles.segmented),
137
107
  onPointerDown: handlePointerDown,
138
- onPointerMove: function onPointerMove(event) {
108
+ onPointerMove: event => {
139
109
  if (disabled || !event.currentTarget.hasPointerCapture(event.pointerId)) return;
140
110
  emitValue(activeThumb.current, valueFromPointer(event));
141
111
  },
142
- onPointerUp: function onPointerUp(event) {
112
+ onPointerUp: event => {
143
113
  if (!event.currentTarget.hasPointerCapture(event.pointerId)) return;
144
114
  event.currentTarget.releasePointerCapture(event.pointerId);
145
115
  emitValue(activeThumb.current, valueFromPointer(event), true);
@@ -147,28 +117,28 @@ var Slider = /*#__PURE__*/forwardRef(function SliderComponent(props, ref) {
147
117
  }, /*#__PURE__*/React.createElement("span", {
148
118
  className: styles.fill,
149
119
  style: horizontal ? {
150
- left: "".concat(lowPercent, "%"),
151
- width: "".concat(highPercent - lowPercent, "%")
120
+ left: `${lowPercent}%`,
121
+ width: `${highPercent - lowPercent}%`
152
122
  } : {
153
- bottom: "".concat(lowPercent, "%"),
154
- height: "".concat(highPercent - lowPercent, "%")
123
+ bottom: `${lowPercent}%`,
124
+ height: `${highPercent - lowPercent}%`
155
125
  }
156
- }), normalizedTicks.map(function (tick) {
157
- var percent = toVisualPercent(clamp(tick.value, min, max));
158
- var filled = tick.value >= low && tick.value <= high;
126
+ }), normalizedTicks.map(tick => {
127
+ const percent = toVisualPercent(clamp(tick.value, min, max));
128
+ const filled = tick.value >= low && tick.value <= high;
159
129
  return /*#__PURE__*/React.createElement("span", {
160
130
  key: tick.value,
161
131
  className: cx(styles.tick, filled && styles.tick_filled),
162
132
  style: horizontal ? {
163
- left: "".concat(percent, "%")
133
+ left: `${percent}%`
164
134
  } : {
165
- bottom: "".concat(percent, "%")
135
+ bottom: `${percent}%`
166
136
  }
167
137
  }, /*#__PURE__*/React.createElement("i", null), tick.label != null && /*#__PURE__*/React.createElement("b", null, tick.label));
168
- })), (mode === "range" ? [0, 1] : [1]).map(function (index) {
169
- var current = values[index];
170
- var inputName = Array.isArray(name) ? name[index] : name;
171
- var inputLabel = Array.isArray(ariaLabel) ? ariaLabel[index] : ariaLabel;
138
+ })), (mode === "range" ? [0, 1] : [1]).map(index => {
139
+ const current = values[index];
140
+ const inputName = Array.isArray(name) ? name[index] : name;
141
+ const inputLabel = Array.isArray(ariaLabel) ? ariaLabel[index] : ariaLabel;
172
142
  return /*#__PURE__*/React.createElement(React.Fragment, {
173
143
  key: index
174
144
  }, /*#__PURE__*/React.createElement("input", {
@@ -181,21 +151,15 @@ var Slider = /*#__PURE__*/forwardRef(function SliderComponent(props, ref) {
181
151
  name: inputName,
182
152
  "aria-label": inputLabel,
183
153
  disabled: disabled,
184
- onChange: function onChange(event) {
185
- return emitValue(index, Number(event.currentTarget.value));
186
- },
187
- onPointerUp: function onPointerUp(event) {
188
- return emitValue(index, Number(event.currentTarget.value), true);
189
- },
190
- onKeyUp: function onKeyUp(event) {
191
- return emitValue(index, Number(event.currentTarget.value), true);
192
- }
154
+ onChange: event => emitValue(index, Number(event.currentTarget.value)),
155
+ onPointerUp: event => emitValue(index, Number(event.currentTarget.value), true),
156
+ onKeyUp: event => emitValue(index, Number(event.currentTarget.value), true)
193
157
  }), showValue && (/*#__PURE__*/React.createElement("span", {
194
158
  className: styles.current_value,
195
159
  style: horizontal ? {
196
- left: "".concat(toVisualPercent(current), "%")
160
+ left: `${toVisualPercent(current)}%`
197
161
  } : {
198
- bottom: "".concat(toVisualPercent(current), "%")
162
+ bottom: `${toVisualPercent(current)}%`
199
163
  }
200
164
  }, valueFormatter(current))));
201
165
  }))));
@@ -1,23 +1,23 @@
1
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
1
  import React from 'react';
3
2
  import clsx from 'clsx';
4
3
  import styles from './index.module.css';
5
4
 
6
- var Status = function Status(_ref) {
7
- var className = _ref.className,
8
- indicator = _ref.indicator,
9
- _ref$showIndicator = _ref.showIndicator,
10
- showIndicator = _ref$showIndicator === void 0 ? true : _ref$showIndicator,
11
- _ref$tag = _ref.tag,
12
- Component = _ref$tag === void 0 ? "span" : _ref$tag,
13
- children = _ref.children,
14
- type = _ref.type;
15
- return /*#__PURE__*/React.createElement(Component, {
16
- className: clsx(styles.root, _defineProperty({}, styles["root_".concat(type)], Boolean(type)), className)
17
- }, showIndicator && (/*#__PURE__*/React.createElement("span", {
18
- className: clsx(styles.indicator, _defineProperty({}, styles["indicator_custom"], Boolean(indicator))),
19
- "aria-hidden": "true"
20
- }, indicator)), children);
21
- };
5
+ const Status = ({
6
+ className,
7
+ indicator,
8
+ showIndicator = true,
9
+ tag: Component = "span",
10
+ children,
11
+ type
12
+ }) => (/*#__PURE__*/React.createElement(Component, {
13
+ className: clsx(styles.root, {
14
+ [styles[`root_${type}`]]: Boolean(type)
15
+ }, className)
16
+ }, showIndicator && (/*#__PURE__*/React.createElement("span", {
17
+ className: clsx(styles.indicator, {
18
+ [styles["indicator_custom"]]: Boolean(indicator)
19
+ }),
20
+ "aria-hidden": "true"
21
+ }, indicator)), children));
22
22
 
23
23
  export { Status };
@@ -92,7 +92,8 @@
92
92
  color: var(--component-control-text);
93
93
  font-size: var(--component-control-font-size);
94
94
  line-height: 1.4;
95
- user-select: none;
95
+ -webkit-user-select: none;
96
+ user-select: none;
96
97
  }
97
98
 
98
99
  .root_disabled .text {
@@ -1,23 +1,25 @@
1
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
1
  import { __rest } from 'tslib';
3
2
  import React from 'react';
4
3
  import clsx from 'clsx';
5
4
  import { Typography } from '../Typography/index.js';
6
5
  import styles from './Switch.module.css';
7
6
 
8
- var Switch = function Switch(_a) {
9
- var disabled = _a.disabled,
10
- className = _a.className,
11
- _a$variant = _a.variant,
12
- variant = _a$variant === void 0 ? "primary" : _a$variant,
13
- hint = _a.hint,
14
- hasError = _a.hasError,
15
- id = _a.id,
16
- label = _a.label,
17
- ref = _a.ref,
7
+ const Switch = _a => {
8
+ var {
9
+ disabled,
10
+ className,
11
+ variant = "primary",
12
+ hint,
13
+ hasError,
14
+ id,
15
+ label,
16
+ ref
17
+ } = _a,
18
18
  props = __rest(_a, ["disabled", "className", "variant", "hint", "hasError", "id", "label", "ref"]);
19
19
  return /*#__PURE__*/React.createElement("div", {
20
- className: clsx(styles.root, _defineProperty({}, styles["root_disabled"], Boolean(disabled)), className)
20
+ className: clsx(styles.root, {
21
+ [styles["root_disabled"]]: Boolean(disabled)
22
+ }, className)
21
23
  }, /*#__PURE__*/React.createElement("label", {
22
24
  className: styles.label,
23
25
  htmlFor: id
@@ -28,13 +30,19 @@ var Switch = function Switch(_a) {
28
30
  type: "checkbox",
29
31
  disabled: disabled
30
32
  }, props)), /*#__PURE__*/React.createElement("div", {
31
- className: clsx(styles.wrapper, _defineProperty(_defineProperty(_defineProperty({}, styles["wrapper_variant_".concat(variant)], Boolean(variant)), styles["wrapper_disabled"], Boolean(disabled)), styles["wrapper_error"], Boolean(hasError)))
33
+ className: clsx(styles.wrapper, {
34
+ [styles[`wrapper_variant_${variant}`]]: Boolean(variant),
35
+ [styles["wrapper_disabled"]]: Boolean(disabled),
36
+ [styles["wrapper_error"]]: Boolean(hasError)
37
+ })
32
38
  }, /*#__PURE__*/React.createElement("div", {
33
39
  className: styles["base-switch"]
34
40
  })), label && /*#__PURE__*/React.createElement("span", {
35
41
  className: styles.text
36
42
  }, label)), hint && (/*#__PURE__*/React.createElement(Typography, {
37
- className: clsx(_defineProperty({}, styles.hint_error, hasError)),
43
+ className: clsx({
44
+ [styles.hint_error]: hasError
45
+ }),
38
46
  variant: hasError ? "alert" : "secondary",
39
47
  tag: "span"
40
48
  }, hint)));
@@ -1,21 +1,26 @@
1
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
1
  import { __rest } from 'tslib';
3
2
  import React from 'react';
4
3
  import clsx from 'clsx';
5
4
  import styles from './Tab.module.css';
6
5
 
7
- var Tab = function Tab(_a) {
8
- var innerRef = _a.innerRef,
9
- active = _a.active,
10
- className = _a.className,
11
- content = _a.content,
12
- disabled = _a.disabled,
13
- size = _a.size,
6
+ const Tab = _a => {
7
+ var {
8
+ innerRef,
9
+ active,
10
+ className,
11
+ content,
12
+ disabled,
13
+ size
14
+ } = _a,
14
15
  props = __rest(_a, ["innerRef", "active", "className", "content", "disabled", "size"]);
15
16
  return /*#__PURE__*/React.createElement("li", Object.assign({}, props, {
16
17
  "aria-selected": active,
17
18
  ref: innerRef,
18
- className: clsx(styles.tab, _defineProperty(_defineProperty(_defineProperty({}, styles["tab_inactive"], Boolean(!active)), styles["tab_active"], Boolean(active)), styles["tab_disabled"], Boolean(disabled)), className),
19
+ className: clsx(styles.tab, {
20
+ [styles["tab_inactive"]]: Boolean(!active),
21
+ [styles["tab_active"]]: Boolean(active),
22
+ [styles["tab_disabled"]]: Boolean(disabled)
23
+ }, className),
19
24
  "data-size": size,
20
25
  role: "tab",
21
26
  tabIndex: disabled ? undefined : active ? 0 : -1
@@ -6,7 +6,8 @@
6
6
  transition-duration: 0.3s;
7
7
  transition-property: background, box-shadow, transform;
8
8
  transition-timing-function: ease;
9
- user-select: none;
9
+ -webkit-user-select: none;
10
+ user-select: none;
10
11
  white-space: nowrap;
11
12
  }
12
13
  .tab[data-size=xs] {
@@ -5,41 +5,38 @@ import { isKey, Keys } from '../lib/keyboard.js';
5
5
  import { Tab } from './Tab/Tab.js';
6
6
  import styles from './TabsMenu.module.css';
7
7
 
8
- var TabsMenu = function TabsMenu(_a) {
9
- var activeTab = _a.activeTab,
10
- onChange = _a.onChange,
11
- className = _a.className,
12
- innerRef = _a.innerRef,
13
- tabs = _a.tabs,
14
- _a$size = _a.size,
15
- size = _a$size === void 0 ? "m" : _a$size,
8
+ const TabsMenu = _a => {
9
+ var {
10
+ activeTab,
11
+ onChange,
12
+ className,
13
+ innerRef,
14
+ tabs,
15
+ size = "m"
16
+ } = _a,
16
17
  props = __rest(_a, ["activeTab", "onChange", "className", "innerRef", "tabs", "size"]);
17
- var tabsRefs = useMemo(function () {
18
- return tabs.map(function () {
19
- return /*#__PURE__*/createRef();
20
- });
21
- }, [tabs]);
22
- var onKeyDown = useCallback(function (event) {
18
+ const tabsRefs = useMemo(() => tabs.map(() => /*#__PURE__*/createRef()), [tabs]);
19
+ const onKeyDown = useCallback(event => {
23
20
  if (isKey(event.key, [Keys.LEFT, Keys.DOWN, Keys.RIGHT, Keys.UP])) {
24
21
  event.preventDefault();
25
- var nextTabMenuIndex = 0;
26
- var direction = isKey(event.key, [Keys.LEFT, Keys.UP]) ? -1 : 1;
27
- for (var i = 0; i < tabs.length; i++) {
22
+ let nextTabMenuIndex = 0;
23
+ const direction = isKey(event.key, [Keys.LEFT, Keys.UP]) ? -1 : 1;
24
+ for (let i = 0; i < tabs.length; i++) {
28
25
  if (tabs[i].id === activeTab) {
29
26
  nextTabMenuIndex = i;
30
27
  break;
31
28
  }
32
29
  }
33
- for (var _i = nextTabMenuIndex; _i < tabs.length; _i += direction) {
30
+ for (let i = nextTabMenuIndex; i < tabs.length; i += direction) {
34
31
  nextTabMenuIndex += direction;
35
- var isEdge = nextTabMenuIndex >= tabs.length || nextTabMenuIndex < 0;
36
- var isTabNonDisabled = tabs[nextTabMenuIndex] && !tabs[nextTabMenuIndex].disabled;
32
+ const isEdge = nextTabMenuIndex >= tabs.length || nextTabMenuIndex < 0;
33
+ const isTabNonDisabled = tabs[nextTabMenuIndex] && !tabs[nextTabMenuIndex].disabled;
37
34
  if (isEdge || isTabNonDisabled) {
38
35
  break;
39
36
  }
40
37
  }
41
- var nextTabMenu = tabs[nextTabMenuIndex];
42
- var nextTabMenuRef = tabsRefs[nextTabMenuIndex];
38
+ const nextTabMenu = tabs[nextTabMenuIndex];
39
+ const nextTabMenuRef = tabsRefs[nextTabMenuIndex];
43
40
  if (nextTabMenu !== undefined && nextTabMenuRef !== undefined && nextTabMenuRef.current !== null && (nextTabMenu.onClick !== undefined || onChange !== undefined)) {
44
41
  nextTabMenuRef.current.focus();
45
42
  if (nextTabMenu.onClick !== undefined) {
@@ -56,15 +53,17 @@ var TabsMenu = function TabsMenu(_a) {
56
53
  className: clsx(styles.root, className),
57
54
  ref: innerRef,
58
55
  role: "tablist"
59
- }), tabs.map(function (_a, index) {
60
- var id = _a.id,
61
- disabled = _a.disabled,
56
+ }), tabs.map((_a, index) => {
57
+ var {
58
+ id,
59
+ disabled
60
+ } = _a,
62
61
  tabProps = __rest(_a, ["id", "disabled"]);
63
62
  return /*#__PURE__*/React.createElement(Tab, Object.assign({}, tabProps, {
64
63
  innerRef: tabsRefs[index],
65
64
  disabled: disabled,
66
65
  size: size,
67
- onClick: disabled || !onChange && !tabProps.onClick ? undefined : function (event) {
66
+ onClick: disabled || !onChange && !tabProps.onClick ? undefined : event => {
68
67
  if (tabProps.onClick !== undefined) {
69
68
  tabProps.onClick(event);
70
69
  }
@@ -2,10 +2,12 @@ import { __rest } from 'tslib';
2
2
  import React from 'react';
3
3
  import clsx from 'clsx';
4
4
 
5
- var TabsPanel = function TabsPanel(_a) {
6
- var content = _a.content,
7
- className = _a.className,
8
- id = _a.id,
5
+ const TabsPanel = _a => {
6
+ var {
7
+ content,
8
+ className,
9
+ id
10
+ } = _a,
9
11
  props = __rest(_a, ["content", "className", "id"]);
10
12
  return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
11
13
  id: id,
@@ -3,13 +3,15 @@ import React from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { TabsPanel } from './Panel/index.js';
5
5
 
6
- var TabsPanels = function TabsPanels(_a) {
7
- var activePanel = _a.activePanel,
8
- className = _a.className,
9
- innerRef = _a.innerRef,
10
- panels = _a.panels,
6
+ const TabsPanels = _a => {
7
+ var {
8
+ activePanel,
9
+ className,
10
+ innerRef,
11
+ panels
12
+ } = _a,
11
13
  props = __rest(_a, ["activePanel", "className", "innerRef", "panels"]);
12
- var currentPanel = panels.reduce(function (acc, panel) {
14
+ const currentPanel = panels.reduce((acc, panel) => {
13
15
  if (acc !== null) {
14
16
  return acc;
15
17
  }
@@ -18,15 +20,16 @@ var TabsPanels = function TabsPanels(_a) {
18
20
  if (!currentPanel) {
19
21
  return null;
20
22
  }
21
- var id = currentPanel.id,
22
- content = currentPanel.content,
23
+ const {
24
+ id,
25
+ content
26
+ } = currentPanel,
23
27
  panelProps = __rest(currentPanel, ["id", "content"]);
24
28
  return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
25
29
  ref: innerRef,
26
- role: "menutabpanels",
27
30
  className: clsx(className)
28
31
  }), /*#__PURE__*/React.createElement(TabsPanel, Object.assign({
29
- "aria-labelledby": "tab-".concat(activePanel),
32
+ "aria-labelledby": `tab-${activePanel}`,
30
33
  id: id,
31
34
  content: content
32
35
  }, panelProps)));
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
2
  import type { ITextAreaProps } from "./index.props";
3
- export declare const TextArea: ({ className, value, minRows, maxRows, onChange, label, required, hasError, hint, disabled, inputRef, ref, ...props }: ITextAreaProps) => React.JSX.Element;
3
+ export declare const TextArea: ({ className, value, minRows, maxRows, onChange, label, required, hasError, hint, disabled, inputRef, ref, id, ...props }: ITextAreaProps) => React.JSX.Element;