intelicoreact 0.0.3 → 0.0.7

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 (227) hide show
  1. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +6 -2
  2. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.scss +92 -63
  3. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.stories.js +2 -4
  4. package/dist/Atomic/FormElements/DateTime/DateTime.stories.js +1 -3
  5. package/dist/Atomic/FormElements/DoubleString/DoubleString.stories.js +0 -2
  6. package/dist/Atomic/FormElements/Dropdown/Dropdown.js +56 -25
  7. package/dist/Atomic/FormElements/Dropdown/Dropdown.scss +26 -3
  8. package/dist/Atomic/FormElements/Dropdown/Dropdown.stories.js +40 -11
  9. package/dist/Atomic/FormElements/Header/Header.js +7 -9
  10. package/dist/Atomic/FormElements/Header/Header.scss +16 -5
  11. package/dist/Atomic/FormElements/Header/Header.stories.js +0 -2
  12. package/dist/Atomic/FormElements/Input/Input.js +101 -98
  13. package/dist/Atomic/FormElements/Input/Input.scss +26 -19
  14. package/dist/Atomic/FormElements/Input/Input.stories.js +48 -27
  15. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +89 -0
  16. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +46 -0
  17. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +259 -0
  18. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.scss +594 -0
  19. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +244 -0
  20. package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +489 -0
  21. package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +156 -0
  22. package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +46 -0
  23. package/dist/Atomic/FormElements/InputDateRange/dependencies.js +249 -0
  24. package/dist/Atomic/FormElements/InputsRow/InputsRow.js +29 -6
  25. package/dist/Atomic/FormElements/InputsRow/InputsRow.scss +1 -3
  26. package/dist/Atomic/FormElements/InputsRow/InputsRow.stories.js +0 -2
  27. package/dist/Atomic/FormElements/Label/Label.js +4 -13
  28. package/dist/Atomic/FormElements/Label/Label.scss +3 -3
  29. package/dist/Atomic/FormElements/Label/Label.stories.js +5 -6
  30. package/dist/Atomic/FormElements/Modal/Modal.js +5 -7
  31. package/dist/Atomic/FormElements/Modal/Modal.scss +61 -7
  32. package/dist/Atomic/FormElements/Modal/Modal.stories.js +64 -18
  33. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +3 -5
  34. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.scss +1 -3
  35. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.stories.js +0 -2
  36. package/dist/Atomic/FormElements/NavLine/NavLine.js +1 -1
  37. package/dist/Atomic/FormElements/NavLine/NavLine.scss +4 -6
  38. package/dist/Atomic/FormElements/NavLine/NavLine.stories.js +20 -12
  39. package/dist/Atomic/FormElements/RadioInput/RadioInput.stories.js +0 -2
  40. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +167 -0
  41. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.scss +101 -0
  42. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.stories.js +81 -0
  43. package/dist/Atomic/FormElements/RangeInputs/RangeInputs.stories.js +0 -2
  44. package/dist/Atomic/FormElements/Switcher/Switcher.stories.js +0 -2
  45. package/dist/Atomic/FormElements/Table/Partials/TdHeader.js +2 -2
  46. package/dist/Atomic/FormElements/Table/Table.scss +1 -1
  47. package/dist/Atomic/FormElements/Table/TdTypes/TdActions.js +4 -4
  48. package/dist/Atomic/FormElements/Table/TdTypes/TdPriority.js +2 -2
  49. package/dist/Atomic/FormElements/Table/TdTypes/TdTypes.scss +4 -6
  50. package/dist/Atomic/FormElements/Table/TdTypes/TdWeight.js +2 -2
  51. package/dist/Atomic/FormElements/Tag/Tag.js +1 -1
  52. package/dist/Atomic/FormElements/Tag/Tag.stories.js +0 -2
  53. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +2 -2
  54. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.stories.js +0 -2
  55. package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.stories.js +0 -2
  56. package/dist/Atomic/FormElements/Textarea/Textarea.scss +1 -1
  57. package/dist/Atomic/FormElements/Textarea/Textarea.stories.js +0 -2
  58. package/dist/Atomic/FormElements/TimeRange/TimeRange.js +1 -1
  59. package/dist/Atomic/FormElements/TimeRange/TimeRange.stories.js +0 -2
  60. package/dist/Atomic/MainMenu/MainMenu.js +3 -3
  61. package/dist/Atomic/MainMenu/MainMenu.scss +2 -2
  62. package/dist/Atomic/MainMenu/MainMenu.stories.js +11 -11
  63. package/dist/Atomic/UI/Accordion/Accordion.scss +2 -2
  64. package/dist/Atomic/UI/Accordion/Accordion.stories.js +4 -4
  65. package/dist/Atomic/UI/Accordion/AccordionItem.js +1 -1
  66. package/dist/Atomic/UI/AdvancedTag/AdvTag.js +3 -3
  67. package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +4 -3
  68. package/dist/Atomic/UI/AdvancedTag/AdvancedTags.scss +3 -5
  69. package/dist/Atomic/UI/AdvancedTag/AdvancedTags.stories.js +1 -3
  70. package/dist/Atomic/UI/Alert/Alert.scss +7 -0
  71. package/dist/Atomic/UI/Alert/Alert.stories.js +1 -3
  72. package/dist/Atomic/UI/Arrow/Arrow.js +80 -0
  73. package/dist/Atomic/UI/Arrow/Arrow.scss +19 -0
  74. package/dist/Atomic/UI/Arrow/Arrow.stories.js +46 -0
  75. package/dist/Atomic/UI/Button/Button.js +10 -19
  76. package/dist/Atomic/UI/Button/Button.scss +69 -41
  77. package/dist/Atomic/UI/Button/Button.stories.js +9 -25
  78. package/dist/Atomic/UI/Calendar/Calendar.js +146 -0
  79. package/dist/Atomic/UI/Calendar/Calendar.scss +544 -0
  80. package/dist/Atomic/UI/Calendar/Calendar.stories.js +38 -0
  81. package/dist/Atomic/UI/Header/partials/default_ava.png +0 -0
  82. package/dist/Atomic/UI/Hint/Hint.js +8 -13
  83. package/dist/Atomic/UI/Hint/Hint.scss +8 -12
  84. package/dist/Atomic/UI/Hint/Hint.stories.js +3 -4
  85. package/dist/Atomic/UI/Price/Price.js +33 -0
  86. package/dist/Atomic/UI/Price/Price.stories.js +42 -0
  87. package/dist/Atomic/UI/Status/Status.scss +1 -1
  88. package/dist/Atomic/UI/Status/Status.stories.js +4 -3
  89. package/dist/Functions/useClickOutside.js +25 -0
  90. package/dist/Functions/utils.js +10 -2
  91. package/dist/Molecular/Datepicker/Datepicker.js +451 -0
  92. package/dist/Molecular/Datepicker/Datepicker.scss +8 -0
  93. package/dist/Molecular/Datepicker/Datepicker.stories.js +44 -0
  94. package/dist/Molecular/Datepicker/components/Calendar.js +156 -0
  95. package/dist/Molecular/FormElements/FormElement.js +40 -0
  96. package/dist/Molecular/FormElements/FormElement.scss +8 -0
  97. package/dist/Molecular/FormElements/FormElement.stories.js +73 -0
  98. package/dist/scss/_vars.scss +3 -1
  99. package/dist/scss/main.scss +3 -3
  100. package/package.json +11 -6
  101. package/src/Atomic/FormElements/CheckboxInput/CheckboxInput.js +12 -2
  102. package/src/Atomic/FormElements/CheckboxInput/CheckboxInput.scss +92 -63
  103. package/src/Atomic/FormElements/CheckboxInput/CheckboxInput.stories.js +5 -6
  104. package/src/Atomic/FormElements/DateTime/DateTime.stories.js +1 -3
  105. package/src/Atomic/FormElements/DoubleString/DoubleString.stories.js +0 -2
  106. package/src/Atomic/FormElements/Dropdown/Dropdown.js +70 -29
  107. package/src/Atomic/FormElements/Dropdown/Dropdown.scss +26 -3
  108. package/src/Atomic/FormElements/Dropdown/Dropdown.stories.js +37 -16
  109. package/src/Atomic/FormElements/Header/Header.js +8 -9
  110. package/src/Atomic/FormElements/Header/Header.scss +16 -5
  111. package/src/Atomic/FormElements/Header/Header.stories.js +0 -2
  112. package/src/Atomic/FormElements/Input/Input.js +83 -73
  113. package/src/Atomic/FormElements/Input/Input.scss +26 -19
  114. package/src/Atomic/FormElements/Input/Input.stories.js +34 -29
  115. package/src/Atomic/FormElements/InputCalendar/InputCalendar.js +43 -0
  116. package/src/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +27 -0
  117. package/src/Atomic/FormElements/InputDateRange/InputDateRange.js +241 -0
  118. package/src/Atomic/FormElements/InputDateRange/InputDateRange.scss +594 -0
  119. package/src/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +149 -0
  120. package/src/Atomic/FormElements/InputDateRange/components/Datepicker.js +409 -0
  121. package/src/Atomic/FormElements/InputDateRange/components/OpenedPart.js +114 -0
  122. package/src/Atomic/FormElements/InputDateRange/components/SelectItem.js +24 -0
  123. package/src/Atomic/FormElements/InputDateRange/dependencies.js +161 -0
  124. package/src/Atomic/FormElements/InputsRow/InputsRow.js +28 -5
  125. package/src/Atomic/FormElements/InputsRow/InputsRow.scss +1 -3
  126. package/src/Atomic/FormElements/InputsRow/InputsRow.stories.js +0 -2
  127. package/src/Atomic/FormElements/Label/Label.js +3 -6
  128. package/src/Atomic/FormElements/Label/Label.scss +3 -3
  129. package/src/Atomic/FormElements/Label/Label.stories.js +6 -6
  130. package/src/Atomic/FormElements/Modal/Modal.js +5 -8
  131. package/src/Atomic/FormElements/Modal/Modal.scss +61 -7
  132. package/src/Atomic/FormElements/Modal/Modal.stories.js +60 -15
  133. package/src/Atomic/FormElements/MultiSelect/MultiSelect.js +3 -5
  134. package/src/Atomic/FormElements/MultiSelect/MultiSelect.scss +1 -3
  135. package/src/Atomic/FormElements/MultiSelect/MultiSelect.stories.js +1 -2
  136. package/src/Atomic/FormElements/NavLine/NavLine.js +3 -3
  137. package/src/Atomic/FormElements/NavLine/NavLine.scss +4 -6
  138. package/src/Atomic/FormElements/NavLine/NavLine.stories.js +23 -13
  139. package/src/Atomic/FormElements/RadioInput/RadioInput.stories.js +0 -2
  140. package/src/Atomic/FormElements/RangeCalendar/RangeCalendar.js +146 -0
  141. package/src/Atomic/FormElements/RangeCalendar/RangeCalendar.scss +101 -0
  142. package/src/Atomic/FormElements/RangeCalendar/RangeCalendar.stories.js +54 -0
  143. package/src/Atomic/FormElements/RangeInputs/RangeInputs.stories.js +0 -1
  144. package/src/Atomic/FormElements/Switcher/Switcher.stories.js +0 -2
  145. package/src/Atomic/FormElements/Table/Partials/TdHeader.js +1 -1
  146. package/src/Atomic/FormElements/Table/Table.scss +1 -1
  147. package/src/Atomic/FormElements/Table/TdTypes/TdActions.js +4 -4
  148. package/src/Atomic/FormElements/Table/TdTypes/TdPriority.js +3 -3
  149. package/src/Atomic/FormElements/Table/TdTypes/TdTypes.scss +4 -6
  150. package/src/Atomic/FormElements/Table/TdTypes/TdWeight.js +2 -2
  151. package/src/Atomic/FormElements/Tag/Tag.js +2 -2
  152. package/src/Atomic/FormElements/Tag/Tag.stories.js +0 -2
  153. package/src/Atomic/FormElements/TagsDropdown/TagsDropdown.js +3 -3
  154. package/src/Atomic/FormElements/TagsDropdown/TagsDropdown.stories.js +0 -2
  155. package/src/Atomic/FormElements/TextSwitcher/TextSwitcher.stories.js +0 -2
  156. package/src/Atomic/FormElements/Textarea/Textarea.scss +1 -1
  157. package/src/Atomic/FormElements/Textarea/Textarea.stories.js +0 -2
  158. package/src/Atomic/FormElements/TimeRange/TimeRange.js +1 -1
  159. package/src/Atomic/FormElements/TimeRange/TimeRange.stories.js +0 -2
  160. package/src/Atomic/MainMenu/MainMenu.js +3 -3
  161. package/src/Atomic/MainMenu/MainMenu.scss +2 -2
  162. package/src/Atomic/MainMenu/MainMenu.stories.js +11 -11
  163. package/src/Atomic/UI/Accordion/Accordion.scss +2 -2
  164. package/src/Atomic/UI/Accordion/Accordion.stories.js +4 -4
  165. package/src/Atomic/UI/Accordion/AccordionItem.js +1 -1
  166. package/src/Atomic/UI/AdvancedTag/AdvTag.js +3 -3
  167. package/src/Atomic/UI/AdvancedTag/AdvancedTags.js +3 -3
  168. package/src/Atomic/UI/AdvancedTag/AdvancedTags.scss +3 -5
  169. package/src/Atomic/UI/AdvancedTag/AdvancedTags.stories.js +1 -3
  170. package/src/Atomic/UI/Alert/Alert.scss +7 -0
  171. package/src/Atomic/UI/Alert/Alert.stories.js +1 -3
  172. package/src/Atomic/UI/Arrow/Arrow.js +41 -0
  173. package/src/Atomic/UI/Arrow/Arrow.scss +19 -0
  174. package/src/Atomic/UI/Arrow/Arrow.stories.js +32 -0
  175. package/src/Atomic/UI/Button/Button.js +6 -10
  176. package/src/Atomic/UI/Button/Button.scss +69 -41
  177. package/src/Atomic/UI/Button/Button.stories.js +9 -25
  178. package/src/Atomic/UI/Calendar/Calendar.js +109 -0
  179. package/src/Atomic/UI/Calendar/Calendar.scss +544 -0
  180. package/src/Atomic/UI/Calendar/Calendar.stories.js +24 -0
  181. package/src/Atomic/UI/Header/partials/default_ava.png +0 -0
  182. package/src/Atomic/UI/Hint/Hint.js +6 -9
  183. package/src/Atomic/UI/Hint/Hint.scss +8 -12
  184. package/src/Atomic/UI/Hint/Hint.stories.js +3 -3
  185. package/src/Atomic/UI/Price/Price.js +20 -0
  186. package/src/Atomic/UI/Price/Price.stories.js +30 -0
  187. package/src/Atomic/UI/Status/Status.scss +1 -1
  188. package/src/Atomic/UI/Status/Status.stories.js +4 -3
  189. package/src/Functions/useClickOutside.js +15 -0
  190. package/src/Functions/utils.js +6 -0
  191. package/src/Molecular/Datepicker/Datepicker.js +346 -0
  192. package/src/Molecular/Datepicker/Datepicker.scss +8 -0
  193. package/src/Molecular/Datepicker/Datepicker.stories.js +27 -0
  194. package/src/Molecular/Datepicker/components/Calendar.js +118 -0
  195. package/src/Molecular/FormElements/FormElement.js +18 -0
  196. package/src/Molecular/FormElements/FormElement.scss +8 -0
  197. package/src/Molecular/FormElements/FormElement.stories.js +59 -0
  198. package/src/scss/_vars.scss +3 -1
  199. package/src/scss/main.scss +3 -3
  200. package/dist/scss/anme/_anme-bootstrap-grid.scss +0 -748
  201. package/dist/scss/anme/_anme-elements.scss +0 -269
  202. package/dist/scss/anme/_anme-grid.scss +0 -111
  203. package/dist/scss/anme/_anme-justify.scss +0 -111
  204. package/dist/scss/anme/_anme-mixins-media.scss +0 -116
  205. package/dist/scss/anme/_anme-mixins.scss +0 -166
  206. package/dist/scss/anme/_anme-normalize.scss +0 -8
  207. package/dist/scss/anme/_anme-overall.scss +0 -34
  208. package/dist/scss/anme/_anme-padding-margins.scss +0 -419
  209. package/dist/scss/anme/_anme-table.scss +0 -81
  210. package/dist/scss/anme/_anme-theme.scss +0 -275
  211. package/dist/scss/anme/_anme-vars.scss +0 -91
  212. package/dist/scss/anme/_code-styling.scss +0 -23
  213. package/dist/scss/anme/styles.scss +0 -12
  214. package/src/scss/anme/_anme-bootstrap-grid.scss +0 -748
  215. package/src/scss/anme/_anme-elements.scss +0 -269
  216. package/src/scss/anme/_anme-grid.scss +0 -111
  217. package/src/scss/anme/_anme-justify.scss +0 -111
  218. package/src/scss/anme/_anme-mixins-media.scss +0 -116
  219. package/src/scss/anme/_anme-mixins.scss +0 -166
  220. package/src/scss/anme/_anme-normalize.scss +0 -8
  221. package/src/scss/anme/_anme-overall.scss +0 -34
  222. package/src/scss/anme/_anme-padding-margins.scss +0 -419
  223. package/src/scss/anme/_anme-table.scss +0 -81
  224. package/src/scss/anme/_anme-theme.scss +0 -275
  225. package/src/scss/anme/_anme-vars.scss +0 -91
  226. package/src/scss/anme/_code-styling.scss +0 -23
  227. package/src/scss/anme/styles.scss +0 -12
@@ -0,0 +1,161 @@
1
+ import React, { useState, useEffect, useRef, useCallback } from 'react';
2
+ import moment from 'moment-timezone';
3
+
4
+ import InputDateRange from './InputDateRange';
5
+
6
+ export const useClickOutside = (hideComponent, additionalComponent) => {
7
+ const ref = useRef(null);
8
+
9
+ const checkCondition = target =>
10
+ (additionalComponent
11
+ ? !ref.current?.contains(target) && !additionalComponent?.contains(target)
12
+ : !ref.current?.contains(target));
13
+
14
+ const handleClickOutside = useCallback(
15
+ ({ target }) => {
16
+ if (checkCondition(target)) hideComponent();
17
+ },
18
+ [hideComponent],
19
+ );
20
+
21
+ useEffect(() => {
22
+ document.addEventListener('mousedown', handleClickOutside, true);
23
+ return () => {
24
+ document.removeEventListener('mousedown', handleClickOutside, true);
25
+ };
26
+ }, []);
27
+
28
+ return ref;
29
+ };
30
+
31
+ export const useToggle = initialState => {
32
+ const [isToggled, setToggle] = useState(!!initialState);
33
+ const toggle = useCallback(() => setToggle(isOn => !isOn), []);
34
+ const toggleOn = useCallback(() => setToggle(true), []);
35
+ const toggleOff = useCallback(() => setToggle(false), []);
36
+
37
+ return {
38
+ isToggled,
39
+ toggle,
40
+ toggleOn,
41
+ toggleOff,
42
+ };
43
+ };
44
+
45
+ export const INTERVALS = {
46
+ today: {
47
+ label: 'today',
48
+ start: () => moment().startOf('day'),
49
+ end: () => moment().add(1, 'day').startOf('day'),
50
+ },
51
+ yesterday: {
52
+ label: 'yesterday',
53
+ start: () => moment().subtract(1, 'day').startOf('day'),
54
+ end: () => moment().startOf('day'),
55
+ },
56
+ thisWeek: {
57
+ label: 'This Week',
58
+ start: () => moment().startOf('week'),
59
+ end: () => moment().add(1, 'day').startOf('day'),
60
+ },
61
+ lastWeek: {
62
+ label: 'Last Week',
63
+ start: () => moment().subtract(1, 'week').startOf('week'),
64
+ end: () => moment().startOf('week'),
65
+ },
66
+ last3Days: {
67
+ label: 'Last 3 Days',
68
+ start: () => moment().subtract(2, 'day').startOf('day'),
69
+ end: () => moment().add(1, 'day').startOf('day'),
70
+ },
71
+ last7Days: {
72
+ label: 'Last 7 Days',
73
+ start: () => moment().subtract(6, 'day').startOf('day'),
74
+ end: () => moment().add(1, 'day').startOf('day'),
75
+ },
76
+ last14Days: {
77
+ label: 'Last 14 Days',
78
+ start: () => moment().subtract(13, 'day').startOf('day'),
79
+ end: () => moment().add(1, 'day').startOf('day'),
80
+ },
81
+ thisMonth: {
82
+ label: 'This Month',
83
+ start: () => moment().startOf('month'),
84
+ end: () => moment().add(1, 'day').startOf('day'),
85
+ },
86
+ lastMonth: {
87
+ label: 'Last Month',
88
+ start: () => moment().subtract(1, 'month').startOf('month'),
89
+ end: () => moment().startOf('month'),
90
+ },
91
+ last6Months: {
92
+ label: 'Last 6 Months',
93
+ start: () => moment().subtract(6, 'month').startOf('month'),
94
+ end: () => moment().startOf('month'),
95
+ },
96
+ thisYear: {
97
+ label: 'This Year',
98
+ start: () => moment().startOf('year'),
99
+ end: () => moment().add(1, 'day').startOf('day'),
100
+ },
101
+ lastYear: {
102
+ label: 'Last Year',
103
+ start: () => moment().subtract(1, 'year').startOf('year'),
104
+ end: () => moment().startOf('year'),
105
+ },
106
+ allTime: {
107
+ label: 'All Time',
108
+ start: () => null,
109
+ end: () => null,
110
+ }
111
+ };
112
+ export const ALL_TIME_KEY = 'allTime';
113
+ export const CUSTOM_INTERVAL_KEY = 'customDate';
114
+ export const CUSTOM_INTERVAL_KEY_TEXT = 'Custom Date';
115
+
116
+ export const getActualDateRange = inputDateRange => {
117
+ const actualIntervalKey = (() => {
118
+ if (inputDateRange.intervalKey && Object.keys(INTERVALS).includes(inputDateRange.intervalKey)) {
119
+ return inputDateRange.intervalKey;
120
+ } else if (inputDateRange.start && inputDateRange.end) {
121
+ for (const [key, interval] of Object.entries(INTERVALS)) {
122
+ if (
123
+ moment(inputDateRange.start).isSame(interval.start()) &&
124
+ moment(inputDateRange.end).isSame(interval.end())
125
+ ) {
126
+ return key;
127
+ }
128
+ }
129
+ return CUSTOM_INTERVAL_KEY;
130
+ }
131
+ return ALL_TIME_KEY;
132
+ })();
133
+ if (actualIntervalKey === ALL_TIME_KEY) return {
134
+ intervalKey: ALL_TIME_KEY,
135
+ start: null,
136
+ end: null,
137
+ compare: inputDateRange.compare,
138
+ startPrevDate: null,
139
+ endPrevDate:null
140
+ };
141
+ const actualValues = {
142
+ // intervalKey: inputDateRange.intervalKey || customIntervalKey,
143
+ intervalKey: actualIntervalKey || CUSTOM_INTERVAL_KEY,
144
+ start:
145
+ inputDateRange.intervalKey === CUSTOM_INTERVAL_KEY
146
+ ? inputDateRange?.start
147
+ : INTERVALS[inputDateRange.intervalKey]?.start()?.format('YYYY-MM-DDTHH:mm'),
148
+ end:
149
+ inputDateRange.intervalKey === CUSTOM_INTERVAL_KEY
150
+ ? inputDateRange?.end
151
+ : INTERVALS[inputDateRange.intervalKey]?.end()?.format('YYYY-MM-DDTHH:mm'),
152
+ compare: inputDateRange.compare,
153
+ };
154
+
155
+ if (actualValues.compare) {
156
+ const intervalHoursCount = moment(actualValues.end).diff(actualValues.start, 'hours');
157
+ actualValues.startPrevDate = moment(actualValues.start).subtract(intervalHoursCount, 'hours').toDate();
158
+ actualValues.endPrevDate = actualValues.start;
159
+ }
160
+ return actualValues;
161
+ };
@@ -1,13 +1,36 @@
1
1
  import React, { useState } from 'react';
2
2
  import { v4 as uuid } from 'uuid';
3
- import { FiTrash2 } from 'react-feather';
3
+ import { Trash2 } from 'react-feather';
4
4
 
5
- import { handleObjectChange } from '../../../Functions/utils';
6
5
  import Input from '../Input/Input';
7
6
  import Button from '../../UI/Button/Button';
8
7
 
9
8
  import './InputsRow.scss';
10
9
 
10
+ const getRandomInRange = (min, max) => {
11
+ return Math.floor(Math.random() * (max - min + 1)) + min;
12
+ };
13
+
14
+ const handleObjectChange =
15
+ (updateObject, updateFunction) =>
16
+ (data, prop = '', isNumber) => {
17
+ let value;
18
+ if (data?.target) {
19
+ value = data.target.type === 'checkbox' ? data.target.checked : data.target.value;
20
+ } else value = data;
21
+
22
+ value = isNumber ? +value : value;
23
+
24
+ const props = prop.split('.');
25
+ const currentObject = props.reduce((res, chapter, index) => {
26
+ if (props.length !== index + 1) res = res[chapter];
27
+ return res;
28
+ }, updateObject);
29
+
30
+ currentObject[props.pop()] = value;
31
+ updateFunction();
32
+ };
33
+
11
34
  const InputsRow = ({ items, title, paramPlaceholder = '', valuePlaceholder = '', descriptionPlaceholder = '' }) => {
12
35
  const initialRows = [
13
36
  {
@@ -34,7 +57,7 @@ const InputsRow = ({ items, title, paramPlaceholder = '', valuePlaceholder = '',
34
57
  param: '',
35
58
  value: '',
36
59
  description: '',
37
- rowId: uuid()
60
+ rowId: getRandomInRange(1, 1000)
38
61
  }
39
62
  ];
40
63
  setRows(newRow);
@@ -75,13 +98,13 @@ const InputsRow = ({ items, title, paramPlaceholder = '', valuePlaceholder = '',
75
98
 
76
99
  {rows.length > 1 && (
77
100
  <div onClick={() => onDelete(index)} className="inputs-row--trash">
78
- <FiTrash2 />
101
+ <Trash2 />
79
102
  </div>
80
103
  )}
81
104
  </div>
82
105
  ))}
83
106
 
84
- {rows.length < 10 && <Button onClick={handleAddRow} text="Add row" className="inputs-row--add-btn" />}
107
+ {rows.length < 10 && <Button onClick={handleAddRow} label="Add row" className="inputs-row--add-btn" />}
85
108
  </div>
86
109
  );
87
110
  };
@@ -1,5 +1,3 @@
1
- @import "../../../scss/vars";
2
-
3
1
  .inputs-row {
4
2
  &--input {
5
3
  width: 200px;
@@ -20,7 +18,7 @@
20
18
  border-radius: 5px;
21
19
 
22
20
  svg {
23
- color: $color--secondary;
21
+ color: #f06d8d;
24
22
  }
25
23
  }
26
24
 
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
2
  import InputsRow from './InputsRow';
3
3
 
4
- import '../../../../scss/main.scss';
5
-
6
4
  global.lng = 'en';
7
5
 
8
6
  export default {
@@ -1,15 +1,12 @@
1
1
  import React from 'react';
2
- import cn from 'classnames';
3
2
  import Hint from '../../UI/Hint/Hint';
4
3
  import './Label.scss';
5
4
 
6
- const RC = 'label';
7
-
8
- const Label = ({ label, isBold, hint, hintSide, className, isRequired }) => (
9
- <span className={cn(`${RC}`, { [`${RC}_bold`]: isBold }, className)}>
5
+ const Label = ({ label, hint, isRequired }) => (
6
+ <span className="label">
10
7
  {label}
11
8
  {isRequired && <span className="label_isRequired">*</span>}
12
- {hint && <Hint hint={hint} side={hintSide} className={`${RC}-hint`} />}
9
+ {hint && <Hint hint={hint.text} side={hint.hintSide} className="label-hint" />}
13
10
  </span>
14
11
  );
15
12
 
@@ -1,9 +1,9 @@
1
- @import '../../../scss/vars';
2
-
3
1
  .label {
4
2
  display: flex;
5
- color: $color--dark;
3
+ color: #1e1e2d;
6
4
  font-size: 13px;
5
+ margin-bottom: 5px;
6
+ align-items: center;
7
7
 
8
8
  &_bold {
9
9
  font-weight: 500;
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
2
  import Label from './Label';
3
3
 
4
- import '../../../../scss/main.scss';
5
-
6
4
  global.lng = 'en';
5
+
7
6
  export default {
8
- title: 'Label',
7
+ title: 'Form Elements/Label',
9
8
  component: Label
10
9
  };
11
10
 
@@ -17,7 +16,8 @@ export const LabelTemplate = Template.bind({});
17
16
 
18
17
  LabelTemplate.args = {
19
18
  label: 'Label text',
20
- hint: 'Hint text',
21
- hintSide: 'bottom',
22
- isBold: true
19
+ hint: {
20
+ text: 'Hint text',
21
+ hintSide: 'bottom'
22
+ }
23
23
  };
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
2
  import cn from 'classnames';
3
- import { IoClose } from 'react-icons/io5';
3
+ import { X } from 'react-feather';
4
4
 
5
5
  import Button from '../../UI/Button/Button';
6
6
 
7
- import '../../../../scss/main.scss';
8
7
  import './Modal.scss';
9
8
 
10
9
  const Modal = ({
@@ -41,23 +40,21 @@ const Modal = ({
41
40
 
42
41
  <div className={cn(className, { [`modal-${size}`]: size }, `${isOpen ? 'modal' : 'hidden'}`)}>
43
42
  <div className={cn('modal__header', { [`modal__header-${variant}`]: variant })}>
44
- <span className={cn('modal__header-title', { [`modal__header-${variant}-title`]: variant })}>
45
- <span>{renderModalTitle()}</span>
46
- </span>
43
+ <span className={cn('modal__header-title', { [`modal__header-${variant}-title`]: variant })}>{renderModalTitle()}</span>
47
44
 
48
45
  <div onClick={closeModal} className={cn('modal-close-icon-box', { 'modal-close-icon-box-primary': variant === 'primary' })}>
49
- <IoClose className="modal-close-icon" />
46
+ <X className="modal-close-icon" />
50
47
  </div>
51
48
  </div>
52
49
 
53
50
  <div className="modal__body">{children}</div>
54
51
  {!noFooter && (
55
52
  <div className="modal__footer">
56
- <Button variant="dark-outline" onClick={closeModal} text={closeBtnText || 'Cancel'} />
53
+ <Button variant="dark-outline" onClick={closeModal} label={closeBtnText || 'Cancel'} />
57
54
  {!noConfirmBtn && (
58
55
  <Button
59
56
  onClick={() => handleConfirm()}
60
- text={confirmBtnLabel || mode?.[0].toUpperCase() + mode?.slice(1) || 'Apply'}
57
+ label={confirmBtnLabel || mode?.[0].toUpperCase() + mode?.slice(1) || 'Apply'}
61
58
  className="ml5"
62
59
  variant={confirmBtnVariant}
63
60
  />
@@ -1,6 +1,3 @@
1
- @import "../../../scss/anme/anme-vars";
2
- @import "../../../scss/anme/anme-mixins";
3
-
4
1
  .modal-overlay {
5
2
  position: fixed;
6
3
  top: 0;
@@ -36,7 +33,7 @@
36
33
  border-top-right-radius: 4px;
37
34
 
38
35
  &-primary {
39
- background-color: $color--primary;
36
+ background-color: #6b81dd;
40
37
 
41
38
  &-title {
42
39
  color: #ffff !important;
@@ -47,7 +44,7 @@
47
44
  &-title {
48
45
  font-size: 16px;
49
46
  font-weight: 400;
50
- color: $color--primary;
47
+ color: #6b81dd;
51
48
  }
52
49
  }
53
50
 
@@ -59,7 +56,59 @@
59
56
  border-bottom-left-radius: 4px;
60
57
  border-bottom-right-radius: 4px;
61
58
 
62
- @include custom-scroll2;
59
+ scrollbar-color: rgb(186, 194, 201) rgba(0, 0, 0, 0) !important;
60
+ scrollbar-width: thin !important;
61
+
62
+ scrollbar {
63
+ -moz-appearance: none !important;
64
+ }
65
+ scrollbarbutton {
66
+ -moz-appearance: none !important;
67
+ }
68
+ thumb {
69
+ -moz-appearance: none !important;
70
+ }
71
+ scrollcorner {
72
+ -moz-appearance: none !important;
73
+ resize: both;
74
+ }
75
+ // overflow-y: overlay;
76
+
77
+ &::-webkit-scrollbar {
78
+ width: 4px;
79
+ }
80
+
81
+ &::-webkit-scrollbar-thumb {
82
+ -webkit-border-radius: 3px;
83
+ border-radius: 3px;
84
+ background: #bac2c9;
85
+
86
+ &:hover {
87
+ background: #9aa0b9;
88
+ }
89
+ }
90
+
91
+ &::-webkit-scrollbar:horizontal {
92
+ height: 8px;
93
+ }
94
+
95
+ &::-webkit-scrollbar-track:horizontal {
96
+ background: inherit;
97
+ }
98
+
99
+ &::-webkit-scrollbar-thumb:horizontal {
100
+ -webkit-border-radius: 6px;
101
+ border-radius: 6px;
102
+ background: #bac2c9;
103
+ background-clip: padding-box;
104
+ border: 2px solid rgba(0, 0, 0, 0);
105
+
106
+ &:hover {
107
+ background: #9aa0b9;
108
+ border: 1px solid rgba(0, 0, 0, 0);
109
+ background-clip: padding-box;
110
+ }
111
+ }
63
112
  }
64
113
 
65
114
  &__footer {
@@ -87,6 +136,11 @@
87
136
  left: calc(50% - 210px);
88
137
  }
89
138
 
139
+ &-770 {
140
+ width: 770px;
141
+ left: calc(50% - 385px);
142
+ }
143
+
90
144
  &-870 {
91
145
  width: 870px;
92
146
  left: calc(50% - 435px);
@@ -163,7 +217,7 @@
163
217
  }
164
218
 
165
219
  .included-selector-modal {
166
- .simple-table {
220
+ .table {
167
221
  min-height: 400px;
168
222
  max-height: 500px;
169
223
  }
@@ -6,6 +6,25 @@ import Alert from '../../UI/Alert/Alert';
6
6
 
7
7
  global.lng = 'en';
8
8
 
9
+ const examples = [
10
+ JSON.stringify({ withConfirmation: { cancel: true } }),
11
+ JSON.stringify({ withConfirmation: { confirm: true } }),
12
+ JSON.stringify({ withConfirmation: { confirm: true, cancel: true } }),
13
+ JSON.stringify({
14
+ withConfirmation: {
15
+ title: 'some value',
16
+ children: 'some value',
17
+ confirmBtnLabel: 'some value'
18
+ }
19
+ })
20
+ ];
21
+ const confirmationDescrip =
22
+ 'If you pass the "withConfirmation" property, you will be able to request confirmation of the user\'s action.\n\n' +
23
+ `For example, if you want to request confirmation to close a modal window, pass the property like this: ${examples[0]}\n\n` +
24
+ `To confirm submit, pass the property like this: with Confirmation: ${examples[1]}\n\n` +
25
+ `If you want confirmation for each action, pass the property like this: with Confirmation: ${examples[2]}\n\n` +
26
+ `If you want to control the contents of the confirmation window, pass an object with values instead of boolean values, like this:\n\n${examples[3]}\n\n`;
27
+
9
28
  export default {
10
29
  title: 'Modal',
11
30
  component: Modal,
@@ -25,20 +44,17 @@ export default {
25
44
  size: {
26
45
  control: {
27
46
  type: 'select',
28
- options: ['default', '290', '420', '870', '950']
47
+ options: ['default', '290', '420', '870', '770', '950']
29
48
  }
30
- }
31
- },
32
- type: {
33
- control: {
34
- type: 'select',
35
- options: ['default', 'primary']
36
- }
37
- },
38
- size: {
39
- control: {
40
- type: 'select',
41
- options: ['default', '290', '420', '870', '950']
49
+ },
50
+ type: {
51
+ control: {
52
+ type: 'select',
53
+ options: ['default', 'primary']
54
+ }
55
+ },
56
+ withConfirmation: {
57
+ description: confirmationDescrip
42
58
  }
43
59
  }
44
60
  };
@@ -50,7 +66,15 @@ const Template = args => {
50
66
  return (
51
67
  <>
52
68
  <Button onClick={() => setIsOpen(true)} text="Show modal" />
53
- <Modal closeModal={closeModal} isOpen={isOpen} {...args}>
69
+ <Modal
70
+ {...args}
71
+ closeModal={closeModal}
72
+ submitHandler={() => {
73
+ args.submitHandler();
74
+ closeModal();
75
+ }}
76
+ isOpen={isOpen}
77
+ >
54
78
  <Alert message="Alert message" variant="error" className="mb5" />
55
79
  <Alert message="Alert message" variant="warning" className="mb5" />
56
80
  <Alert message="Alert message" variant="success" className="mb5" />
@@ -61,11 +85,32 @@ const Template = args => {
61
85
  };
62
86
 
63
87
  export const ModalTemplate = Template.bind({});
88
+ export const ModalWithConfirmation = Template.bind({});
64
89
 
65
- ModalTemplate.args = {
90
+ const mainProps = {
66
91
  title: 'Modal',
67
92
  variant: 'primary',
68
93
  mode: 'edit',
69
94
  size: '',
95
+ confirmBtnLabel: '',
96
+ submitHandler: () => {
97
+ console.log('Hi');
98
+ }
99
+ };
100
+
101
+ const confirmationProps = {
102
+ title: '',
103
+ children: '',
70
104
  confirmBtnLabel: ''
71
105
  };
106
+
107
+ const confirmationVariants = {
108
+ // confirm: { ...confirmationProps },
109
+ cancel: { ...confirmationProps }
110
+ };
111
+
112
+ ModalTemplate.args = { ...mainProps };
113
+ ModalWithConfirmation.args = {
114
+ ...mainProps,
115
+ withConfirmation: { ...confirmationVariants }
116
+ };
@@ -5,8 +5,6 @@ import CheckboxInput from '../CheckboxInput/CheckboxInput';
5
5
 
6
6
  import './MultiSelect.scss';
7
7
 
8
- const RC = 'multiselect';
9
-
10
8
  const MultiSelect = ({ options, chosenOptions, onChange }) => {
11
9
  const [searchValue, setSearchValue] = useState('');
12
10
 
@@ -21,16 +19,16 @@ const MultiSelect = ({ options, chosenOptions, onChange }) => {
21
19
  const filteredOptions = options.filter(({ label }) => label.toLowerCase().includes(searchValue.toLowerCase()));
22
20
 
23
21
  return (
24
- <div className={RC}>
22
+ <div className="multiselect">
25
23
  <Input value={searchValue} onChange={value => setSearchValue(value)} placeholder="Search" />
26
- <div className={`${RC}__list`}>
24
+ <div className="multiselect__list">
27
25
  {filteredOptions.map(({ label, value, id }) => (
28
26
  <CheckboxInput
29
27
  key={id}
30
28
  value={chosenOptions.includes(value)}
31
29
  label={label}
32
30
  onChange={state => checkHandler(state, value)}
33
- className={`${RC}__item`}
31
+ className="multiselect__item"
34
32
  />
35
33
  ))}
36
34
  </div>
@@ -1,10 +1,8 @@
1
- @import "../../../scss/vars";
2
-
3
1
  .multiselect {
4
2
  display: inline-flex;
5
3
  flex-direction: column;
6
4
  background-color: #fff;
7
- border: 1px solid $color--gray--light;
5
+ border: 1px solid #e2e5ec;
8
6
  border-radius: 4px;
9
7
  padding: 8px 10px;
10
8
 
@@ -1,9 +1,8 @@
1
1
  import React, { useState } from 'react';
2
2
  import MultiSelect from './MultiSelect';
3
3
 
4
- import '../../../../scss/main.scss';
5
-
6
4
  global.lng = 'en';
5
+
7
6
  export default {
8
7
  title: 'MultiSelect',
9
8
  component: MultiSelect
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Link } from 'react-router-dom';
2
+ import { NavLink } from 'react-router-dom';
3
3
  import cn from 'classnames';
4
4
  import * as Icons from 'react-feather';
5
5
 
@@ -34,7 +34,7 @@ const NavLine = ({ root, activeTab, variant, onChange, className, items, childre
34
34
  </div>
35
35
  </span>
36
36
  ) : (
37
- <Link
37
+ <NavLink
38
38
  to={`${root}${item.tabId}/`}
39
39
  key={`tab__${item.tabId}`}
40
40
  className={cn(
@@ -54,7 +54,7 @@ const NavLine = ({ root, activeTab, variant, onChange, className, items, childre
54
54
  <span className={cn({ 'nav-line__item--label': variant !== 'simple' })}>{item.label}</span>
55
55
  {item.count !== undefined ? <span className="nav-line--count ml5">({item.count || 0})</span> : null}
56
56
  </div>
57
- </Link>
57
+ </NavLink>
58
58
  );
59
59
  })}
60
60
  </div>
@@ -1,5 +1,3 @@
1
- @import "../../../scss/anme/anme-vars";
2
-
3
1
  .nav-line {
4
2
  &__inner {
5
3
  display: flex;
@@ -41,8 +39,8 @@
41
39
  font-weight: 500;
42
40
  border-top: 2px solid #6b81dd;
43
41
  cursor: default;
44
- border-left: 1px solid $color--border;
45
- border-right: 1px solid $color--border;
42
+ border-left: 1px solid #cfcfcf;
43
+ border-right: 1px solid #cfcfcf;
46
44
  text-decoration: none;
47
45
  }
48
46
  }
@@ -52,7 +50,7 @@
52
50
  flex-wrap: wrap;
53
51
  padding: 24px 32px;
54
52
  font-size: 13px;
55
- border-top: 1px solid $color--border;
53
+ border-top: 1px solid #cfcfcf;
56
54
  margin-left: -32px;
57
55
  margin-right: -32px;
58
56
  background-color: #f7fafc;
@@ -76,7 +74,7 @@
76
74
  cursor: pointer;
77
75
  font-size: 13px;
78
76
  color: #1e1e2d;
79
- border-bottom: 1px solid $color--border;
77
+ border-bottom: 1px solid #cfcfcf;
80
78
  user-select: none;
81
79
  margin-bottom: -1px;
82
80
  border-bottom: 2px solid transparent;