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,27 +1,26 @@
1
1
  .root {
2
- color: var(--palette-black);
3
- padding: 0 12px;
4
- box-sizing: border-box;
5
- display: inline-flex;
6
2
  align-items: center;
7
- justify-content: center;
3
+ border: 1px solid;
4
+ border-radius: var(--button-border-radius);
5
+ box-sizing: border-box;
6
+ color: 0.15s linear;
8
7
  cursor: pointer;
9
- gap: 8px;
8
+ display: inline-flex;
10
9
  flex-shrink: 0;
11
- border: 1px solid;
10
+ font-size: 15px;
12
11
  font-style: normal;
13
12
  font-weight: 400;
13
+ gap: 8px;
14
14
  height: 36px;
15
- font-size: 15px;
15
+ justify-content: center;
16
16
  line-height: 36px;
17
- transition: transform 0.1s ease-out;
18
- color: 0.15s linear;
19
- transform: scale(1);
20
17
  overflow: hidden;
21
- white-space: nowrap;
18
+ padding: 0 12px;
22
19
  text-overflow: ellipsis;
20
+ transform: scale(1);
21
+ transition: transform 0.1s ease-out;
22
+ white-space: nowrap;
23
23
  width: fit-content;
24
- border-radius: var(--button-border-radius);
25
24
  }
26
25
  .root_icon {
27
26
  border-radius: 50%;
@@ -43,11 +42,11 @@
43
42
  width: 100%;
44
43
  }
45
44
  .root_disabled {
46
- cursor: not-allowed;
47
- pointer-events: none;
48
- color: var(--button-primary-color-disabled);
49
45
  background-color: var(--button-primary-background-color-disabled);
50
46
  border-color: var(--button-primary-border-color-disabled);
47
+ color: var(--button-primary-color-disabled);
48
+ cursor: not-allowed;
49
+ pointer-events: none;
51
50
  }
52
51
 
53
52
  .icon {
@@ -55,75 +54,90 @@
55
54
  }
56
55
 
57
56
  .size_xs {
58
- height: 29px;
59
57
  font-size: 12px;
58
+ height: 29px;
60
59
  line-height: 29px;
61
60
  }
62
61
  .size_s {
63
- height: 32px;
64
62
  font-size: 13px;
63
+ height: 32px;
65
64
  line-height: 32px;
66
65
  }
67
66
  .size_m {
68
- height: 36px;
69
67
  font-size: 15px;
68
+ height: 36px;
70
69
  line-height: 36px;
71
70
  }
72
71
  .size_l {
73
- height: 42px;
74
72
  font-size: 18px;
73
+ height: 42px;
75
74
  line-height: 42px;
76
75
  }
77
76
 
78
77
  .variant_primary {
79
- color: var(--button-primary-color);
80
78
  background-color: var(--button-primary-background-color);
81
79
  border-color: var(--button-primary-border-color);
80
+ color: var(--button-primary-color);
82
81
  }
83
82
  .variant_primary:hover {
84
- color: var(--button-primary-color-hovered);
85
83
  background-color: var(--button-primary-background-color-hovered);
86
84
  border-color: var(--button-primary-border-color-hovered);
85
+ color: var(--button-primary-color-hovered);
87
86
  }
88
87
  .variant_primary:active {
89
- color: var(--button-primary-color-active);
90
88
  background-color: var(--button-primary-background-color-active);
91
89
  border-color: var(--button-primary-border-color-active);
90
+ color: var(--button-primary-color-active);
92
91
  }
93
92
  .variant_secondary {
94
- color: var(--button-secondary-color);
95
93
  background-color: var(--button-secondary-background-color);
96
94
  border-color: var(--button-secondary-border-color);
95
+ color: var(--button-secondary-color);
97
96
  }
98
97
  .variant_secondary:hover {
99
- color: var(--button-secondary-color-hovered);
100
98
  background-color: var(--button-secondary-background-color-hovered);
101
99
  border-color: var(--button-secondary-border-color-hovered);
100
+ color: var(--button-secondary-color-hovered);
102
101
  }
103
102
  .variant_secondary:active {
104
- color: var(--button-secondary-color-active);
105
103
  background-color: var(--button-secondary-background-color-active);
106
104
  border-color: var(--button-secondary-border-color-active);
105
+ color: var(--button-secondary-color-active);
107
106
  }
108
107
  .variant_pseudo {
109
- color: var(--button-pseudo-color);
110
108
  background-color: var(--button-pseudo-background-color);
111
109
  border-color: var(--button-pseudo-border-color);
110
+ color: var(--button-pseudo-color);
112
111
  }
113
112
  .variant_pseudo:hover {
114
- color: var(--button-pseudo-color-hovered);
115
113
  background-color: var(--button-pseudo-background-color-hovered);
116
114
  border-color: var(--button-pseudo-border-color-hovered);
115
+ color: var(--button-pseudo-color-hovered);
117
116
  }
118
117
  .variant_pseudo:active {
119
- color: var(--button-pseudo-color-active);
120
118
  background-color: var(--button-pseudo-background-color-active);
121
119
  border-color: var(--button-pseudo-border-color-active);
120
+ color: var(--button-pseudo-color-active);
121
+ }
122
+ .variant_outline {
123
+ background-color: var(--button-outline-background-color);
124
+ border-color: var(--button-outline-border-color);
125
+ color: var(--button-outline-color);
126
+ }
127
+ .variant_outline:hover {
128
+ background-color: var(--button-outline-background-color-hovered);
129
+ border-color: var(--button-outline-border-color-hovered);
130
+ color: var(--button-outline-color-hovered);
131
+ }
132
+ .variant_outline:active {
133
+ background-color: var(--button-outline-background-color-active);
134
+ border-color: var(--button-outline-border-color-active);
135
+ color: var(--button-outline-color-active);
122
136
  }
123
137
  .variant_clear {
124
- color: var(--button-clear-color);
125
138
  background-color: transparent;
126
139
  border-color: transparent;
140
+ color: var(--button-clear-color);
127
141
  }
128
142
  .variant_clear:hover {
129
143
  color: var(--button-clear-color-hovered);
@@ -1,5 +1,5 @@
1
1
  import { __rest, __assign } from 'tslib';
2
- import React, { forwardRef } from 'react';
2
+ import React__default, { forwardRef } from 'react';
3
3
  import classNames from 'classnames/bind';
4
4
  import styles from './Button.module.css';
5
5
 
@@ -19,7 +19,7 @@ var Button = /*#__PURE__*/forwardRef(function (_a, ref) {
19
19
  disabled = _a.disabled,
20
20
  onClick = _a.onClick,
21
21
  props = __rest(_a, ["className", "fullWidth", "variant", "iconStart", "iconEnd", "icon", "size", "children", "disabled", "onClick"]);
22
- return /*#__PURE__*/React.createElement("button", __assign({
22
+ return /*#__PURE__*/React__default.createElement("button", __assign({
23
23
  onClick: onClick,
24
24
  ref: ref,
25
25
  className: clx(styles.root, (_b = {
@@ -29,11 +29,11 @@ var Button = /*#__PURE__*/forwardRef(function (_a, ref) {
29
29
  }, _b["size_".concat(size)] = !!size, _b["variant_".concat(variant)] = !!variant, _b), className),
30
30
  disabled: disabled,
31
31
  "data-cy": "button"
32
- }, props), icon && /*#__PURE__*/React.createElement("span", {
32
+ }, props), icon && /*#__PURE__*/React__default.createElement("span", {
33
33
  className: clx(styles.icon)
34
- }, icon), iconStart && /*#__PURE__*/React.createElement("span", {
34
+ }, icon), iconStart && /*#__PURE__*/React__default.createElement("span", {
35
35
  className: clx(styles.icon)
36
- }, iconStart), children && children, iconEnd && /*#__PURE__*/React.createElement("span", {
36
+ }, iconStart), children && children, iconEnd && /*#__PURE__*/React__default.createElement("span", {
37
37
  className: clx(styles.icon)
38
38
  }, iconEnd));
39
39
  });
@@ -1,5 +1,5 @@
1
1
  import type { ButtonHTMLAttributes, ReactNode } from "react";
2
- export type ButtonVariant = "primary" | "secondary" | "pseudo" | "clear";
2
+ export type ButtonVariant = "primary" | "secondary" | "outline" | "pseudo" | "clear";
3
3
  export type ButtonSize = "xs" | "s" | "m" | "l";
4
4
  export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
5
5
  variant?: ButtonVariant;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ type Props = {
3
+ isChanged: boolean;
4
+ selectedDate?: string;
5
+ selectedPeriod?: number;
6
+ onContinue: () => void;
7
+ onCancel: () => void;
8
+ };
9
+ export declare const ContinueButton: React.FC<Props>;
10
+ export {};
@@ -0,0 +1,37 @@
1
+ import React__default, { useMemo, useCallback } from 'react';
2
+ import classNames from 'classnames/bind';
3
+ import Button from '../../../Button/index.js';
4
+ import { requestIdleCallback } from '../../../libs/requestIdleCallback/index.js';
5
+ import { getPeriodDates } from '../../../helpers/date/index.js';
6
+ import styles from './index.module.css';
7
+
8
+ var clx = classNames.bind(styles);
9
+ var ContinueButton = function ContinueButton(_a) {
10
+ var selectedDate = _a.selectedDate,
11
+ selectedPeriod = _a.selectedPeriod,
12
+ isChanged = _a.isChanged,
13
+ onContinue = _a.onContinue,
14
+ onCancel = _a.onCancel;
15
+ var selectedDates = useMemo(function () {
16
+ if (selectedDate && selectedPeriod) {
17
+ return getPeriodDates(selectedDate, selectedPeriod);
18
+ }
19
+ return null;
20
+ }, [selectedDate, selectedPeriod]);
21
+ var handleClick = useCallback(function () {
22
+ requestIdleCallback(function () {
23
+ return isChanged ? onContinue() : onCancel();
24
+ }, {
25
+ timeout: 200
26
+ });
27
+ }, [isChanged, onContinue, onCancel]);
28
+ return /*#__PURE__*/React__default.createElement("div", {
29
+ className: clx(styles.root),
30
+ "data-component": "Calendar__ContinueButton"
31
+ }, /*#__PURE__*/React__default.createElement(Button, {
32
+ size: "l",
33
+ onClick: handleClick
34
+ }, isChanged && selectedDates ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Select ", selectedDates) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Cancel")));
35
+ };
36
+
37
+ export { ContinueButton };
@@ -0,0 +1,4 @@
1
+ .root button {
2
+ display: block;
3
+ width: 100%;
4
+ }
@@ -0,0 +1,15 @@
1
+ import type { FunctionComponent } from "react";
2
+ export interface FCWithElements<T = {}> extends FunctionComponent<T> {
3
+ }
4
+ type Props = {
5
+ today: string;
6
+ startDate: Date;
7
+ activeDays?: string[];
8
+ selectedDate?: string;
9
+ selectedPeriod?: number;
10
+ onDayClick: (date: string) => void;
11
+ offsetLeft: number;
12
+ availableDates?: string[];
13
+ };
14
+ export declare const Month: FCWithElements<Props>;
15
+ export {};
@@ -0,0 +1,116 @@
1
+ import { __spreadArray, __assign } from 'tslib';
2
+ import * as React from 'react';
3
+ import classNames from 'classnames/bind';
4
+ import { leadingZeros } from '../../../libs/numbers/leadingZeros.js';
5
+ import Typography from '../../../Typography/index.js';
6
+ import { getUpperMonthName, getShortWeekDayNameByIndex } from '../../../helpers/date/index.js';
7
+ import { getMonthWeeks } from '../../utils/getMonthWeeks.js';
8
+ import styles from './index.module.css';
9
+
10
+ var clx = classNames.bind(styles);
11
+ var Item = function Item(_a) {
12
+ var isSelected = _a.isSelected,
13
+ isInSelectedRange = _a.isInSelectedRange,
14
+ isStartOfSelection = _a.isStartOfSelection,
15
+ isEndOfSelection = _a.isEndOfSelection,
16
+ children = _a.children;
17
+ var noSelection = isStartOfSelection && isEndOfSelection ? styles["no-selection"] : "";
18
+ var startClass = isStartOfSelection && !isEndOfSelection ? styles["start-of-selection"] : "";
19
+ var endClass = isEndOfSelection && !isStartOfSelection ? styles["end-of-selection"] : "";
20
+ var firstChildClass = isEndOfSelection ? styles["first-child"] : "";
21
+ var lastChildClass = isStartOfSelection ? styles["last-child"] : "";
22
+ if (isSelected) {
23
+ return /*#__PURE__*/React.createElement("li", {
24
+ className: clx(styles["selected-range-day"], styles["selected-day"], noSelection, startClass, endClass, firstChildClass, lastChildClass)
25
+ }, children);
26
+ } else if (isInSelectedRange) {
27
+ return /*#__PURE__*/React.createElement("li", {
28
+ className: clx(styles["selected-range-day"])
29
+ }, children);
30
+ }
31
+ return /*#__PURE__*/React.createElement("li", {
32
+ className: clx(styles.day)
33
+ }, children);
34
+ };
35
+ var Month = function Month(props) {
36
+ var year = props.startDate.getFullYear();
37
+ var month = leadingZeros(props.startDate.getMonth() + 1, 2);
38
+ return /*#__PURE__*/React.createElement("div", {
39
+ "data-component": "Month",
40
+ className: clx(styles.root),
41
+ style: {
42
+ left: props.offsetLeft ? "".concat(props.offsetLeft, "px") : undefined
43
+ }
44
+ }, /*#__PURE__*/React.createElement("div", {
45
+ className: clx(styles["month-name"])
46
+ }, /*#__PURE__*/React.createElement(Typography, {
47
+ tag: "span",
48
+ size: "h3"
49
+ }, getUpperMonthName(props.startDate))), /*#__PURE__*/React.createElement("div", {
50
+ className: clx(styles.table)
51
+ }, /*#__PURE__*/React.createElement("ul", {
52
+ className: clx(styles.legend)
53
+ }, __spreadArray([], Array(7), true).map(function (empty) {
54
+ var rest = [];
55
+ for (var _i = 1; _i < arguments.length; _i++) {
56
+ rest[_i - 1] = arguments[_i];
57
+ }
58
+ var index = rest[0] + 1;
59
+ return /*#__PURE__*/React.createElement("li", {
60
+ className: clx(styles.day),
61
+ key: index
62
+ }, /*#__PURE__*/React.createElement(Typography, {
63
+ style: {
64
+ opacity: index > 5 ? 80 : 30,
65
+ color: index > 5 ? "var(--typography-alert)" : "var(--palette-black)"
66
+ }
67
+ }, getShortWeekDayNameByIndex(index)));
68
+ })), getMonthWeeks(props).map(function (days) {
69
+ var rest1 = [];
70
+ for (var _i = 1; _i < arguments.length; _i++) {
71
+ rest1[_i - 1] = arguments[_i];
72
+ }
73
+ return /*#__PURE__*/React.createElement("ul", {
74
+ key: "week-".concat(rest1[0]),
75
+ className: clx(styles.week)
76
+ }, days.map(function (day) {
77
+ var rest2 = [];
78
+ for (var _i = 1; _i < arguments.length; _i++) {
79
+ rest2[_i - 1] = arguments[_i];
80
+ }
81
+ var key = "day-".concat(rest2[0]);
82
+ if (day.isDummy) {
83
+ return /*#__PURE__*/React.createElement("li", {
84
+ className: clx(styles.day),
85
+ key: key
86
+ });
87
+ }
88
+ var attrs = {
89
+ isStartOfSelection: day.isStartOfSelection,
90
+ isEndOfSelection: day.isEndOfSelection,
91
+ isSelected: day.isSelected,
92
+ isInSelectedRange: day.isInSelectedRange
93
+ };
94
+ var dayInnerActive = day.isActive ? styles["day-inner-active"] : "";
95
+ return /*#__PURE__*/React.createElement(Item, __assign({}, attrs, {
96
+ key: key
97
+ }), /*#__PURE__*/React.createElement("button", {
98
+ className: clx(styles["day-inner"], dayInnerActive),
99
+ style: {
100
+ background: day.isSelected ? "var(--palette-bg-2)" : "transparent"
101
+ },
102
+ onClick: day.isActive ? function () {
103
+ return props.onDayClick([year, month, leadingZeros(day.day, 2)].join("-"));
104
+ } : undefined
105
+ }, /*#__PURE__*/React.createElement(Typography, {
106
+ size: "s",
107
+ style: {
108
+ opacity: day.isActive ? 80 : 30,
109
+ color: day.isActive ? "rgba(0, 0, 0, 0.8)" : "rgba(0, 0, 0, 0.3)"
110
+ }
111
+ }, day.day)));
112
+ }));
113
+ })));
114
+ };
115
+
116
+ export { Month };
@@ -0,0 +1,143 @@
1
+ .root {
2
+ box-sizing: border-box;
3
+ padding: 0 16px;
4
+ width: 100%;
5
+ }
6
+
7
+ .month-name {
8
+ padding: 6px 0 25px;
9
+ text-align: center;
10
+ }
11
+
12
+ .table {
13
+ display: table;
14
+ width: 100%;
15
+ }
16
+
17
+ .week {
18
+ align-items: stretch;
19
+ display: flex;
20
+ flex-wrap: nowrap;
21
+ justify-content: space-between;
22
+ list-style: none;
23
+ margin: 0;
24
+ padding: 0;
25
+ }
26
+
27
+ .day {
28
+ display: block;
29
+ height: 32px;
30
+ position: relative;
31
+ text-align: center;
32
+ width: 32px;
33
+ }
34
+
35
+ .legend {
36
+ align-items: stretch;
37
+ display: flex;
38
+ flex-wrap: nowrap;
39
+ font-size: 14px;
40
+ justify-content: space-between;
41
+ line-height: 20px;
42
+ list-style: none;
43
+ margin: 0;
44
+ padding: 0;
45
+ text-align: center;
46
+ text-transform: capitalize;
47
+ }
48
+
49
+ .selected-range-day {
50
+ display: block;
51
+ height: 32px;
52
+ position: relative;
53
+ text-align: center;
54
+ width: 32px;
55
+ z-index: 0;
56
+ }
57
+ .selected-range-day:hover {
58
+ z-index: 1;
59
+ }
60
+ .selected-range-day::before {
61
+ background: #f5f5f5;
62
+ content: "";
63
+ display: block;
64
+ height: 100%;
65
+ left: -50%;
66
+ position: absolute;
67
+ top: 0;
68
+ width: 200%;
69
+ }
70
+ .selected-range-day:first-child::before {
71
+ left: 0;
72
+ width: 150%;
73
+ }
74
+ .selected-range-day:last-child::before {
75
+ left: auto;
76
+ right: 0;
77
+ width: 150%;
78
+ }
79
+
80
+ .selected-day {
81
+ z-index: 2;
82
+ }
83
+ .selected-day::before {
84
+ display: "block";
85
+ left: auto;
86
+ right: auto;
87
+ width: 90%;
88
+ }
89
+ .selected-day:first-child::before {
90
+ display: "block";
91
+ left: 50%;
92
+ width: 90%;
93
+ }
94
+ .selected-day:last-child::before {
95
+ display: "block";
96
+ right: 50%;
97
+ width: 90%;
98
+ }
99
+ .selected-day + .selected-day, .selected-day + .selected-day:hover {
100
+ z-index: 4 !important;
101
+ }
102
+
103
+ .no-selection::before {
104
+ display: none;
105
+ }
106
+
107
+ .start-of-selection::before {
108
+ left: 50%;
109
+ right: auto;
110
+ }
111
+
112
+ .end-of-selection::before {
113
+ left: auto;
114
+ right: 50%;
115
+ }
116
+
117
+ .first-child:first-child::before {
118
+ display: none;
119
+ }
120
+
121
+ .last-child:last-child::before {
122
+ display: none;
123
+ }
124
+
125
+ .day-inner {
126
+ border: 0;
127
+ border-radius: 6px;
128
+ display: inline-block;
129
+ height: 32px;
130
+ outline: 0;
131
+ padding: 0;
132
+ position: relative;
133
+ text-align: center;
134
+ transition: background 0.3s ease;
135
+ width: 32px;
136
+ }
137
+
138
+ .day-inner-active {
139
+ cursor: pointer;
140
+ }
141
+ .day-inner-active:hover {
142
+ background: var(--palette-bg-2);
143
+ }
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+ export declare enum PRESETS {
3
+ TODAY = "today",
4
+ TOMORROW = "tomorrow",
5
+ WEEKENDS = "weekends",
6
+ CURWEEK = "currWeek",
7
+ NEXTWEEK = "nextWeek"
8
+ }
9
+ export type Preset = {
10
+ name: string;
11
+ date: string;
12
+ period: number;
13
+ };
14
+ type Props = {
15
+ presets: Preset[];
16
+ onPresetSelect(preset: Preset): void;
17
+ };
18
+ export declare const Presets: React.FunctionComponent<Props>;
19
+ export {};
@@ -0,0 +1,42 @@
1
+ import * as React from 'react';
2
+ import classNames from 'classnames/bind';
3
+ import Button from '../../../Button/index.js';
4
+ import styles from './index.module.css';
5
+
6
+ var clx = classNames.bind(styles);
7
+ var PRESETS;
8
+ (function (PRESETS) {
9
+ PRESETS["TODAY"] = "today";
10
+ PRESETS["TOMORROW"] = "tomorrow";
11
+ PRESETS["WEEKENDS"] = "weekends";
12
+ PRESETS["CURWEEK"] = "currWeek";
13
+ PRESETS["NEXTWEEK"] = "nextWeek";
14
+ })(PRESETS || (PRESETS = {}));
15
+ var Presets = function Presets(_a) {
16
+ var presets = _a.presets,
17
+ onPresetSelect = _a.onPresetSelect;
18
+ return /*#__PURE__*/React.createElement("div", {
19
+ "data-component": "Calendar_Presets"
20
+ }, /*#__PURE__*/React.createElement("div", {
21
+ className: clx(styles["native-scroll-inner"])
22
+ }, /*#__PURE__*/React.createElement("div", {
23
+ className: clx(styles.inner)
24
+ }, presets.map(function (preset) {
25
+ var rest = [];
26
+ for (var _i = 1; _i < arguments.length; _i++) {
27
+ rest[_i - 1] = arguments[_i];
28
+ }
29
+ return /*#__PURE__*/React.createElement("div", {
30
+ className: clx(styles.item),
31
+ key: "preset=".concat(rest[0])
32
+ }, /*#__PURE__*/React.createElement(Button, {
33
+ variant: "outline",
34
+ onClick: function onClick() {
35
+ return onPresetSelect(preset);
36
+ },
37
+ size: "m"
38
+ }, preset.name));
39
+ }))));
40
+ };
41
+
42
+ export { PRESETS, Presets };
@@ -0,0 +1,28 @@
1
+ .native-scroll-inner {
2
+ -webkit-overflow-scrolling: touch;
3
+ overflow-x: auto;
4
+ transform: translate3d(0, 0, 0);
5
+ }
6
+
7
+ .inner {
8
+ align-items: stretch;
9
+ display: flex;
10
+ flex-wrap: nowrap;
11
+ justify-content: space-between;
12
+ }
13
+
14
+ .item {
15
+ flex-grow: 1;
16
+ padding: 0 4px;
17
+ }
18
+ .item > button {
19
+ display: block;
20
+ padding: 0 8px;
21
+ width: 100%;
22
+ }
23
+ .item:first-child {
24
+ padding-left: 16px;
25
+ }
26
+ .item:last-child {
27
+ padding-right: 16px;
28
+ }
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import type { Preset } from "./components/Presets";
3
+ type ChangePayload = {
4
+ date: string;
5
+ period: number;
6
+ };
7
+ type Props = {
8
+ today: string;
9
+ selectedDate?: string;
10
+ selectedPeriod?: number;
11
+ canSelectRange?: boolean;
12
+ activeDates?: string[];
13
+ datePresets?: Preset[];
14
+ availableDates?: string[];
15
+ onChange?: (payload: ChangePayload) => void;
16
+ onCancel?: () => void;
17
+ withContinueButton?: boolean;
18
+ };
19
+ declare const Calendar: React.FC<Props>;
20
+ export default Calendar;