intelicoreact 0.0.6 → 0.0.9

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 (117) hide show
  1. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +6 -2
  2. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.scss +91 -60
  3. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.stories.js +2 -1
  4. package/dist/Atomic/FormElements/Dropdown/Dropdown.js +84 -28
  5. package/dist/Atomic/FormElements/Dropdown/Dropdown.scss +27 -3
  6. package/dist/Atomic/FormElements/Dropdown/Dropdown.stories.js +50 -7
  7. package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +20 -0
  8. package/dist/Atomic/FormElements/Dropdown/components/Loader.scss +57 -0
  9. package/dist/Atomic/FormElements/Input/Input.js +124 -50
  10. package/dist/Atomic/FormElements/Input/Input.stories.js +19 -15
  11. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +33 -31
  12. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +29 -19
  13. package/dist/Atomic/FormElements/InputDateRange/{components/InputDateRange.js → InputDateRange.js} +54 -62
  14. package/dist/Atomic/FormElements/InputDateRange/{components/InputDateRange.scss → InputDateRange.scss} +254 -228
  15. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +15 -160
  16. package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +72 -34
  17. package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +26 -11
  18. package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +14 -6
  19. package/dist/Atomic/FormElements/InputDateRange/{index.js → dependencies.js} +19 -18
  20. package/dist/Atomic/FormElements/NumericInput/NumericInput.js +292 -0
  21. package/dist/Atomic/FormElements/NumericInput/NumericInput.scss +135 -0
  22. package/dist/Atomic/FormElements/NumericInput/NumericInput.stories.js +117 -0
  23. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +10 -3
  24. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.scss +4 -4
  25. package/dist/Atomic/FormElements/Table/Table.scss +1 -1
  26. package/dist/Atomic/FormElements/Textarea/Textarea.scss +1 -1
  27. package/dist/Atomic/MainMenu/MainMenu.scss +2 -2
  28. package/dist/Atomic/UI/Accordion/Accordion.scss +2 -2
  29. package/dist/Atomic/UI/Arrow/Arrow.js +6 -6
  30. package/dist/Atomic/UI/Arrow/Arrow.scss +0 -3
  31. package/dist/Atomic/UI/Calendar/Calendar.js +8 -5
  32. package/dist/Atomic/UI/Calendar/Calendar.scss +19 -3
  33. package/dist/Atomic/UI/Calendar/Calendar.stories.js +3 -2
  34. package/dist/Atomic/UI/Status/Status.scss +1 -1
  35. package/dist/Constants/index.constants.js +8 -0
  36. package/dist/Functions/inputExecutor.js +58 -0
  37. package/dist/Molecular/Datepicker/Datepicker.js +451 -0
  38. package/dist/Molecular/Datepicker/Datepicker.scss +8 -0
  39. package/dist/Molecular/Datepicker/Datepicker.stories.js +44 -0
  40. package/dist/{Atomic/FormElements/Calendar → Molecular/Datepicker/components}/Calendar.js +50 -39
  41. package/dist/scss/_vars.scss +3 -1
  42. package/dist/scss/main.scss +1 -1
  43. package/package.json +5 -4
  44. package/src/Atomic/FormElements/CheckboxInput/CheckboxInput.js +12 -2
  45. package/src/Atomic/FormElements/CheckboxInput/CheckboxInput.scss +91 -60
  46. package/src/Atomic/FormElements/CheckboxInput/CheckboxInput.stories.js +4 -3
  47. package/src/Atomic/FormElements/Dropdown/Dropdown.js +104 -39
  48. package/src/Atomic/FormElements/Dropdown/Dropdown.scss +27 -3
  49. package/src/Atomic/FormElements/Dropdown/Dropdown.stories.js +42 -15
  50. package/src/Atomic/FormElements/Dropdown/components/DropdownLoader.js +16 -0
  51. package/src/Atomic/FormElements/Dropdown/components/Loader.scss +57 -0
  52. package/src/Atomic/FormElements/Input/Input.js +108 -37
  53. package/src/Atomic/FormElements/Input/Input.stories.js +43 -22
  54. package/src/Atomic/FormElements/InputCalendar/InputCalendar.js +18 -17
  55. package/src/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +17 -14
  56. package/src/Atomic/FormElements/InputDateRange/InputDateRange.js +219 -0
  57. package/src/Atomic/FormElements/InputDateRange/{components/InputDateRange.scss → InputDateRange.scss} +254 -228
  58. package/src/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +38 -117
  59. package/src/Atomic/FormElements/InputDateRange/components/Datepicker.js +92 -53
  60. package/src/Atomic/FormElements/InputDateRange/components/OpenedPart.js +14 -5
  61. package/src/Atomic/FormElements/InputDateRange/components/SelectItem.js +5 -3
  62. package/src/Atomic/FormElements/InputDateRange/{index.js → dependencies.js} +16 -12
  63. package/src/Atomic/FormElements/NumericInput/NumericInput.js +263 -0
  64. package/src/Atomic/FormElements/NumericInput/NumericInput.scss +135 -0
  65. package/src/Atomic/FormElements/NumericInput/NumericInput.stories.js +78 -0
  66. package/src/Atomic/FormElements/RangeCalendar/RangeCalendar.js +6 -3
  67. package/src/Atomic/FormElements/RangeCalendar/RangeCalendar.scss +4 -4
  68. package/src/Atomic/FormElements/Table/Table.scss +1 -1
  69. package/src/Atomic/FormElements/Textarea/Textarea.scss +1 -1
  70. package/src/Atomic/MainMenu/MainMenu.scss +2 -2
  71. package/src/Atomic/UI/Accordion/Accordion.scss +2 -2
  72. package/src/Atomic/UI/Arrow/Arrow.js +4 -4
  73. package/src/Atomic/UI/Arrow/Arrow.scss +0 -3
  74. package/src/Atomic/UI/Calendar/Calendar.js +4 -4
  75. package/src/Atomic/UI/Calendar/Calendar.scss +19 -3
  76. package/src/Atomic/UI/Calendar/Calendar.stories.js +2 -1
  77. package/src/Atomic/UI/Status/Status.scss +1 -1
  78. package/src/Constants/index.constants.js +41 -0
  79. package/src/Functions/inputExecutor.js +53 -0
  80. package/src/Functions/utils.js +4 -1
  81. package/src/Molecular/Datepicker/Datepicker.js +346 -0
  82. package/src/Molecular/Datepicker/Datepicker.scss +8 -0
  83. package/src/Molecular/Datepicker/Datepicker.stories.js +27 -0
  84. package/src/Molecular/Datepicker/components/Calendar.js +118 -0
  85. package/src/scss/_vars.scss +3 -1
  86. package/src/scss/main.scss +1 -1
  87. package/dist/Atomic/FormElements/Calendar/Calendar.scss +0 -543
  88. package/dist/Atomic/FormElements/Calendar/Calendar.stories.js +0 -33
  89. package/dist/scss/anme/_anme-bootstrap-grid.scss +0 -748
  90. package/dist/scss/anme/_anme-elements.scss +0 -269
  91. package/dist/scss/anme/_anme-grid.scss +0 -111
  92. package/dist/scss/anme/_anme-justify.scss +0 -111
  93. package/dist/scss/anme/_anme-mixins-media.scss +0 -116
  94. package/dist/scss/anme/_anme-mixins.scss +0 -166
  95. package/dist/scss/anme/_anme-normalize.scss +0 -8
  96. package/dist/scss/anme/_anme-overall.scss +0 -34
  97. package/dist/scss/anme/_anme-padding-margins.scss +0 -419
  98. package/dist/scss/anme/_anme-table.scss +0 -81
  99. package/dist/scss/anme/_anme-theme.scss +0 -275
  100. package/dist/scss/anme/_anme-vars.scss +0 -91
  101. package/dist/scss/anme/_code-styling.scss +0 -23
  102. package/dist/scss/anme/styles.scss +0 -12
  103. package/src/Atomic/FormElements/InputDateRange/components/InputDateRange.js +0 -230
  104. package/src/scss/anme/_anme-bootstrap-grid.scss +0 -748
  105. package/src/scss/anme/_anme-elements.scss +0 -269
  106. package/src/scss/anme/_anme-grid.scss +0 -111
  107. package/src/scss/anme/_anme-justify.scss +0 -111
  108. package/src/scss/anme/_anme-mixins-media.scss +0 -116
  109. package/src/scss/anme/_anme-mixins.scss +0 -166
  110. package/src/scss/anme/_anme-normalize.scss +0 -8
  111. package/src/scss/anme/_anme-overall.scss +0 -34
  112. package/src/scss/anme/_anme-padding-margins.scss +0 -419
  113. package/src/scss/anme/_anme-table.scss +0 -81
  114. package/src/scss/anme/_anme-theme.scss +0 -275
  115. package/src/scss/anme/_anme-vars.scss +0 -91
  116. package/src/scss/anme/_code-styling.scss +0 -23
  117. package/src/scss/anme/styles.scss +0 -12
@@ -0,0 +1,263 @@
1
+ import React, { useState, useEffect, useRef } from 'react';
2
+ import cn from 'classnames';
3
+ import { Minus, Plus } from 'react-feather';
4
+ import InputMask from 'react-input-mask';
5
+ import { KEYBOARD_SERVICE_KEYS } from '../../../Constants/index.constants';
6
+ import { formatInput } from '../../../Functions/inputExecutor';
7
+
8
+ import './NumericInput.scss';
9
+
10
+ let timerOutside;
11
+ let timerFocus;
12
+
13
+ const NumericInput = ({
14
+ onChange,
15
+ disabled,
16
+ withDelete,
17
+ numStep = 1,
18
+ min = 0,
19
+ max,
20
+ value,
21
+ placeholder,
22
+ className,
23
+ onBlur,
24
+ onFocus,
25
+ onKeyUp,
26
+ mask,
27
+ maskChar,
28
+ formatChars,
29
+ error,
30
+ icon,
31
+ symbolsLimit,
32
+ isNotBlinkErrors,
33
+ blinkTime,
34
+ isPriceInput,
35
+ isFocusDefault = false
36
+ }) => {
37
+ const DEFAULT_BLINK_TIME = 200;
38
+
39
+ //REFS
40
+ const inputRef = useRef(null);
41
+ const decRef = useRef(null);
42
+ const incRef = useRef(null);
43
+ const wrapRef = useRef(null);
44
+
45
+ const previousValueRef = useRef(value);
46
+
47
+ // STATES
48
+ const [inputValue, setInputValue] = useState(value || min || '');
49
+ const [inputValueFormated, setInputValueFormated] = useState(inputValue);
50
+ const [intMemoVal, setIntMemoVal] = useState(0);
51
+
52
+ const [isFocused, setIsFocused] = useState(false);
53
+ const [isEditing, setEditing] = useState(false);
54
+
55
+ const [isAttemptToChange, setIsAttemptToChange] = useState(false);
56
+ const [isToHighlightError, setIsToHighlightError] = useState(false);
57
+
58
+ const { onlyNumbers } = formatInput;
59
+ const { addCommas, removeComma } = formatInput.priceInput;
60
+
61
+ // HANDLES
62
+ const handle = {
63
+ change: (e) => {
64
+ let inputValue = e.target ? onlyNumbers(e.target.value) : e;
65
+
66
+ if (
67
+ inputValue &&
68
+ (decRef.current.contains(e.target) || incRef.current.contains(e.target))
69
+ ) {
70
+ inputValue = parseFloat(inputValue);
71
+ if (min && +min > inputValue) {
72
+ inputValue = min;
73
+ } else if (max && +max < inputValue) inputValue = max;
74
+ }
75
+ if (symbolsLimit) {
76
+ inputValue = inputValue.toString().substring(0, +symbolsLimit);
77
+ }
78
+ setInputValue(inputValue.toString());
79
+ },
80
+ clear: () => {
81
+ handle.change(min || '');
82
+ },
83
+ focus: (e) => {
84
+ if (isFocused) return;
85
+ setIsFocused(true);
86
+ if (onFocus) onFocus(e);
87
+ },
88
+ blur: (e) => {
89
+ if (!isFocused) return;
90
+
91
+ setIsFocused(false);
92
+ setEditing(false);
93
+
94
+ if (onBlur) onBlur(e);
95
+ },
96
+ keyUp: (e) => {
97
+ if (!isNotBlinkErrors) {
98
+ const changedValue = '' + (value ?? '');
99
+ const previousValue = '' + (previousValueRef.current ?? '');
100
+ const currentSet = (() => {
101
+ if (previousValue.length < changedValue.length)
102
+ return value
103
+ .toString()
104
+ .slice(previousValue.length - changedValue.length);
105
+ else return changedValue.toString().includes(e.key) ? e.key : '';
106
+ })();
107
+
108
+ if (
109
+ !KEYBOARD_SERVICE_KEYS.includes(e.key) &&
110
+ changedValue === previousValue
111
+ )
112
+ setIsAttemptToChange(true);
113
+
114
+ if (KEYBOARD_SERVICE_KEYS.includes(e.key) || !currentSet)
115
+ previousValueRef.current = value;
116
+ else previousValueRef.current = previousValue + currentSet[0];
117
+ }
118
+
119
+ if (onKeyUp) onKeyUp(e.keyCode, e.target.value);
120
+ },
121
+ decrement: (e) => {
122
+ handle.change(intMemoVal - +numStep);
123
+ },
124
+ increment: (e) => {
125
+ handle.change(intMemoVal + +numStep);
126
+ }
127
+ };
128
+
129
+ //Check Outside Click
130
+ useEffect(() => {
131
+ const handleClickOutside = (event) => {
132
+ if (!wrapRef.current.contains(event.target)) {
133
+ setIsFocused(false);
134
+ }
135
+ };
136
+
137
+ document.addEventListener('mousedown', handleClickOutside, true);
138
+ return () =>
139
+ document.removeEventListener('mousedown', handleClickOutside, true);
140
+ }, []);
141
+
142
+ useEffect(() => {
143
+ if (!isNotBlinkErrors && isAttemptToChange) {
144
+ setIsAttemptToChange(false);
145
+ setIsToHighlightError(true);
146
+ setTimeout(() => {
147
+ setIsToHighlightError(false);
148
+ }, blinkTime || DEFAULT_BLINK_TIME);
149
+ }
150
+ }, [isAttemptToChange]);
151
+
152
+ //On Input Value Change
153
+ useEffect(() => {
154
+ if (inputValue !== value) setIsFocused(true);
155
+
156
+ setInputValueFormated(
157
+ isPriceInput
158
+ ? isFocused
159
+ ? removeComma(inputValue)
160
+ : addCommas(inputValue)
161
+ : inputValue
162
+ );
163
+ setIntMemoVal(parseInt(inputValue));
164
+
165
+ if (typeof onChange === 'function') onChange(inputValue?.toString());
166
+ }, [inputValue]);
167
+
168
+ //On Integer Value Change
169
+ useEffect(() => {
170
+ if (isNaN(intMemoVal)) setIntMemoVal(min || 0);
171
+ }, [intMemoVal]);
172
+
173
+ //On Focuse Change
174
+ useEffect(() => {
175
+ setInputValueFormated(
176
+ isPriceInput
177
+ ? isFocused
178
+ ? removeComma(inputValue)
179
+ : addCommas(inputValue)
180
+ : inputValue
181
+ );
182
+
183
+ if (isFocused) {
184
+ if (typeof onFocus === 'function') onFocus({ target: inputRef?.current });
185
+ inputRef?.current?.focus();
186
+ } else {
187
+ if (typeof onBlur === 'function') onBlur({ target: inputRef?.current });
188
+ inputRef?.current?.blur();
189
+ }
190
+ }, [isFocused]);
191
+
192
+ useEffect(() => {
193
+ if (inputRef?.current && typeof isFocusDefault === 'boolean')
194
+ setIsFocused(isFocusDefault);
195
+ setEditing(isFocusDefault)
196
+ }, [inputRef, isFocusDefault]);
197
+
198
+ function renderInput() {
199
+ const uniProps = {
200
+ className: `input ${className || ''}`,
201
+ placeholder,
202
+ value: inputValueFormated,
203
+ disabled,
204
+ onChange: handle.change,
205
+ onFocus: () => {
206
+ setIsFocused(true);
207
+ setEditing(true);
208
+ },
209
+ onBlur: () => setEditing(false),
210
+ onKeyUp: handle.keyUp,
211
+ min,
212
+ max,
213
+ ...(maskChar ? { maskChar } : {}),
214
+ ...(formatChars ? { formatChars } : {})
215
+ };
216
+
217
+ return (
218
+ <>
219
+ <input {...uniProps} ref={inputRef} type='text' />
220
+
221
+ <div className='input__nums'>
222
+ <button
223
+ ref={decRef}
224
+ onMouseDown={(e) => handle.decrement(e)}
225
+ className={cn(`input__num-btn`, { disabled: +value <= min })}
226
+ >
227
+ <Minus />
228
+ </button>
229
+ <button
230
+ ref={incRef}
231
+ onMouseDown={(e) => handle.increment(e)}
232
+ className={cn(`input__num-btn`, { disabled: +value >= max })}
233
+ >
234
+ <Plus />
235
+ </button>
236
+ </div>
237
+ </>
238
+ );
239
+ }
240
+
241
+ return (
242
+ <div
243
+ ref={wrapRef}
244
+ className={cn(
245
+ `input__wrap`,
246
+ { [`input__wrap_focus`]: isFocused },
247
+ { [`input__wrap_error`]: error || isToHighlightError },
248
+ { [`input__wrap_disabled`]: disabled }
249
+ )}
250
+ >
251
+ {renderInput()}
252
+ {icon}
253
+ {withDelete && (
254
+ <span
255
+ className={cn(`input__close`, { hidden: !inputValue })}
256
+ onClick={() => handle.clear()}
257
+ />
258
+ )}
259
+ </div>
260
+ );
261
+ };
262
+
263
+ export default NumericInput;
@@ -0,0 +1,135 @@
1
+ .input {
2
+ position: relative;
3
+ word-break: break-all;
4
+ border: none;
5
+ background: none;
6
+ padding: 0 10px;
7
+ width: 100%;
8
+ &::-webkit-outer-spin-button,
9
+ &::-webkit-inner-spin-button {
10
+ -webkit-appearance: none;
11
+ }
12
+
13
+ &__wrap {
14
+ display: flex;
15
+ align-items: center;
16
+ border: 1px solid #e2e5ec;
17
+ box-sizing: border-box;
18
+ background-color: #fff;
19
+ height: 28px;
20
+ border-radius: 4px;
21
+
22
+ &_focus {
23
+ border-color: #6b81dd;
24
+ filter: drop-shadow(0px 0px 4px rgba(93, 120, 255, 0.5));
25
+ }
26
+
27
+ &_disabled {
28
+ background: #f7f8fa;
29
+ opacity: 0.5;
30
+ border-color: #a6acb1;
31
+ pointer-events: none;
32
+ }
33
+
34
+ &_error {
35
+ border-color: #f06d8d;
36
+ }
37
+ }
38
+
39
+ &_disabled {
40
+ background: #f7f8fa;
41
+ opacity: 0.5;
42
+ border-color: #a6acb1;
43
+ pointer-events: none;
44
+ }
45
+
46
+ &_error {
47
+ border-color: #f06d8d;
48
+ }
49
+
50
+ svg {
51
+ margin-right: 4px;
52
+ }
53
+
54
+ &__input {
55
+ width: 100%;
56
+ height: 100%;
57
+ box-sizing: border-box;
58
+ font-size: 13px;
59
+ font-weight: 400;
60
+ color: #1e1e2d;
61
+ border: none;
62
+ padding: 0 5px;
63
+ border-radius: 4px;
64
+ }
65
+
66
+ &__close {
67
+ position: relative;
68
+ opacity: 0.6;
69
+ width: 14px;
70
+ height: 14px;
71
+ background: none;
72
+ cursor: pointer;
73
+ margin-right: 4px;
74
+ visibility: hidden;
75
+ pointer-events: none;
76
+ &:hover {
77
+ opacity: 1;
78
+ }
79
+
80
+ &:before,
81
+ &:after {
82
+ content: '';
83
+ position: absolute;
84
+ top: 0;
85
+ left: 0;
86
+ right: 0;
87
+ margin: auto;
88
+ height: 14px;
89
+ width: 2px;
90
+ background-color: #9aa0b9;
91
+ }
92
+
93
+ &:before {
94
+ transform: rotate(45deg);
95
+ }
96
+
97
+ &:after {
98
+ transform: rotate(-45deg);
99
+ }
100
+ }
101
+
102
+ &__nums {
103
+ display: flex;
104
+ align-items: center;
105
+ height: 100%;
106
+ }
107
+
108
+ &__num-btn {
109
+ cursor: pointer;
110
+ display: flex;
111
+ align-items: center;
112
+ justify-content: center;
113
+ height: 100%;
114
+ width: 24px;
115
+ border-left: 1px solid #e2e5ec;
116
+ background: none;
117
+ font-size: 20px;
118
+ user-select: none;
119
+ &.disabled {
120
+ opacity: 0.3;
121
+ }
122
+ svg {
123
+ margin-right: 0;
124
+ }
125
+ }
126
+
127
+ &-label {
128
+ margin-bottom: 5px;
129
+ }
130
+ }
131
+
132
+ .input__wrap:hover .input__close {
133
+ visibility: visible;
134
+ pointer-events: all;
135
+ }
@@ -0,0 +1,78 @@
1
+ import React, { useState } from 'react';
2
+ import { User } from 'react-feather';
3
+ import NumericInput from './NumericInput';
4
+
5
+ global.lng = 'en';
6
+
7
+ export default {
8
+ title: 'Form Elements/NumericInput',
9
+ component: NumericInput,
10
+ argTypes: {
11
+ disabled: {
12
+ description: 'boolean'
13
+ },
14
+ isFocusDefault: {
15
+ description: 'boolean - if true, input will be focused on mount'
16
+ },
17
+ isInitialFocus: {
18
+ description: 'boolean - if true, the input will be focused on mount'
19
+ },
20
+ error: {
21
+ description: 'text - coloring input if is errored'
22
+ },
23
+ isPriceInput: {
24
+ description: 'boolean - if true, the input will be styled as PriceInput'
25
+ },
26
+ withDelete: {
27
+ description: 'boolean - add clear-cross by hover'
28
+ },
29
+ numStep: {
30
+ description: 'number/text - plus/minus buttons factor (default: 1)'
31
+ },
32
+ min: {
33
+ description: 'number/text - minimal number for numeric input'
34
+ },
35
+ max: {
36
+ description: 'number/text - maximal number for numeric input'
37
+ },
38
+ placeholder: {
39
+ description: 'text'
40
+ },
41
+ icon: { description: 'JSX' },
42
+ value: { description: '(* - required prop)' },
43
+ className: { description: 'string' },
44
+ mask: {
45
+ description:
46
+ 'string: force input to masked https://www.npmjs.com/package/react-input-mask'
47
+ },
48
+ symbolsLimit: {
49
+ description: 'Set limit of symbols in input, overhead will be ignored'
50
+ },
51
+ onBlur: { description: 'custom callback on blur' },
52
+ onFocus: { description: 'custom callback on focus' },
53
+ onKeyUp: { description: 'custom callback on keyup, returns event keyCode' }
54
+ }
55
+ };
56
+
57
+ const Template = (args) => {
58
+ const [value, setValue] = useState('15000');
59
+ return <NumericInput {...args} value={value} onChange={setValue} />;
60
+ };
61
+
62
+ export const NumericInputTemplate = Template.bind({});
63
+
64
+ NumericInputTemplate.args = {
65
+ disabled: false,
66
+ isFocusDefault: false,
67
+ error: '',
68
+ isPriceInput: false,
69
+ mask: '',
70
+ withDelete: true,
71
+ isNumeric: false,
72
+ numStep: 100,
73
+ min: '0',
74
+ max: '15000',
75
+ symbolsLimit: 5,
76
+ placeholder: 'Placeholder',
77
+ icon: <User />
78
+ };
@@ -19,7 +19,8 @@ const RangeCalendar = props => {
19
19
  onHover = () => {},
20
20
  startPrevDate,
21
21
  endPrevDate,
22
- limitRange
22
+ limitRange,
23
+ isShortWeekNames
23
24
  } = props;
24
25
 
25
26
  const [days, setDays] = useState({});
@@ -87,7 +88,7 @@ const RangeCalendar = props => {
87
88
  onMouseOver={day && !isFutureDay ? () => onHover(day.date) : null}
88
89
  onMouseLeave={() => onHover(null)}
89
90
  >
90
- {day && day.date.getDate()}
91
+ <span className="calendar__day-num">{day && day.date.getDate()}</span>
91
92
  </div>
92
93
  );
93
94
  };
@@ -100,6 +101,8 @@ const RangeCalendar = props => {
100
101
  setDate(moment(date).add(1, 'month').toDate());
101
102
  };
102
103
 
104
+ const getFormatedWeekName = input => isShortWeekNames ? input.charAt(0) : input;
105
+
103
106
  return (
104
107
  <div className={cn('range-calendar', className)}>
105
108
  <div className="range-calendar-header">
@@ -126,7 +129,7 @@ const RangeCalendar = props => {
126
129
  {[...Array(7).keys()].map(dayOfWeek => {
127
130
  return (
128
131
  <div key={`day-of-week_${dayOfWeek}`} className="range-calendar__day range-calendar__day--title">
129
- {moment().weekday(dayOfWeek).format('dd').charAt(0)}
132
+ {getFormatedWeekName(moment().weekday(dayOfWeek).format('dd'))}
130
133
  </div>
131
134
  );
132
135
  })}
@@ -1,4 +1,4 @@
1
- .range-calendar {
1
+ .range-calendar, .calendar {
2
2
  width: 195px;
3
3
  min-height: 195px;
4
4
  display: flex;
@@ -12,7 +12,7 @@
12
12
  display: flex;
13
13
  justify-content: space-between;
14
14
  align-items: center;
15
-
15
+
16
16
  &__title {
17
17
  line-height: 20px;
18
18
  font-weight: 500;
@@ -27,7 +27,7 @@
27
27
  &__next, &__prev {
28
28
  width: 16px;
29
29
  height: 16px;
30
- background-color: #E2E6F8;
30
+ //background-color: #E2E6F8;
31
31
  border-radius: 5px;
32
32
  color: #171D33;
33
33
  }
@@ -98,4 +98,4 @@
98
98
  }
99
99
  }
100
100
  }
101
- }
101
+ }
@@ -1,4 +1,4 @@
1
- @import '../../../scss/anme/anme-vars';
1
+ @import '~anme/scss/anme-vars';
2
2
 
3
3
  .table-header {
4
4
  &--weight-actions {
@@ -1,5 +1,5 @@
1
1
  @import "../../../scss/vars";
2
- @import "../../../scss/anme/anme-mixins";
2
+ @import "~anme/scss/anme-mixins";
3
3
 
4
4
  .textarea {
5
5
  border: 1px solid #e2e5ec;
@@ -1,5 +1,5 @@
1
- @import "../../scss/anme/anme-vars";
2
- @import "../../scss/anme/anme-mixins";
1
+ @import "~anme/scss/anme-vars";
2
+ @import "~anme/scss/anme-mixins";
3
3
 
4
4
  .main-menu {
5
5
  display: flex;
@@ -1,5 +1,5 @@
1
- @import '../../../scss/anme/anme-vars';
2
- @import '../../../scss/anme/anme-mixins';
1
+ @import '~anme/scss/anme-vars';
2
+ @import '~anme/scss/anme-mixins';
3
3
 
4
4
  .accordion {
5
5
  &--item {
@@ -17,20 +17,20 @@ const Arrow = ({type, className, onClick, disabled}) => {
17
17
  }, [ref.current]);
18
18
 
19
19
  return (
20
- <div
20
+ <div
21
21
  ref={ref}
22
22
  className={cn('arrow', `arrow_${type}`, className, {
23
23
  'arrow_disabled': disabled
24
24
  })}
25
25
  onClick={onClick} >
26
- {type !== 'right'
26
+ {type !== 'right'
27
27
  ? (
28
28
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
29
- <path d="M15 18L9 12L15 6" stroke={color} stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
29
+ <path d="M15 18L9 12L15 6" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
30
30
  </svg>
31
31
  ) : (
32
32
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
33
- <path d="M9 18L15 12L9 6" stroke={color} stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
33
+ <path d="M9 18L15 12L9 6" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
34
34
  </svg>
35
35
  )
36
36
  }
@@ -1,9 +1,6 @@
1
1
  .arrow {
2
2
  width: 24px;
3
3
  height: 24px;
4
- color: #1F7499;
5
- // cursor: pointer;
6
- // border: 1px solid #EAF2FF;
7
4
 
8
5
  &_disabled {
9
6
  pointer-events: none;
@@ -5,8 +5,8 @@ import { ChevronLeft, ChevronRight } from 'react-feather';
5
5
  import './Calendar.scss';
6
6
 
7
7
  export default function (props) {
8
- const { date, setDate, allowPrev = true, allowNext = true, params } = props;
9
- const { minDate, maxDate } = params;
8
+ const { date, setDate, allowPrev = true, allowNext = true, params, className } = props;
9
+ const { minDate = '01/01/1900', maxDate = moment().format('MM/DD/YYYY') } = params;
10
10
  const [days, setDays] = useState({});
11
11
  const [showDate, setShowDate] = useState(date);
12
12
 
@@ -70,7 +70,7 @@ export default function (props) {
70
70
  };
71
71
 
72
72
  return (
73
- <div className="calendar">
73
+ <div className={`calendar ${className ? className : ""}`}>
74
74
  <div className="calendar-header">
75
75
  <div className="calendar-header__prev">
76
76
  {allowPrev && (
@@ -92,7 +92,7 @@ export default function (props) {
92
92
  {[...Array(7).keys()].map((dayOfWeek) => {
93
93
  return (
94
94
  <div key={`day-of-week_${dayOfWeek}`} className="calendar__day calendar__day--title">
95
- {moment().weekday(dayOfWeek).format('dd').charAt(0)}
95
+ {moment().weekday(dayOfWeek).format('dd')}
96
96
  </div>
97
97
  );
98
98
  })}
@@ -425,7 +425,17 @@
425
425
  // box-shadow: 0 0 3px 0 rgb(0 123 255 / 50%);
426
426
  // }
427
427
  // }
428
+ .calendar-header {
429
+ display: flex;
430
+ justify-content: center;
431
+ align-items: center;
428
432
 
433
+ &__prev,
434
+ &__next{
435
+ display: flex;
436
+ height: auto;
437
+ }
438
+ }
429
439
  .calendar {
430
440
  background: #ffffff;
431
441
  border: 1px solid #e2e5ec;
@@ -507,15 +517,21 @@
507
517
  }
508
518
 
509
519
  &-container {
510
- width: 200px;
520
+ min-width: 200px;
521
+ position: relative;
522
+ .calendar {
523
+ position: absolute;
524
+ z-index: 9;
525
+ top: 100%;
526
+ padding: 10px 16px;
527
+ border: 1px solid var(--border-color);
528
+ }
511
529
  }
512
530
 
513
531
  &-dropdown {
514
532
  appearance: none;
515
533
  background-color: white;
516
534
  cursor: pointer;
517
- color: gray;
518
-
519
535
  width: 100%;
520
536
  height: 28px;
521
537
 
@@ -4,7 +4,7 @@ import Calendar from './Calendar';
4
4
  global.lng = 'en';
5
5
 
6
6
  export default {
7
- title: 'UI/Calendar',
7
+ title: 'Calendar',
8
8
  component: Calendar,
9
9
  };
10
10
 
@@ -20,4 +20,5 @@ CalendarTemplate.args = {
20
20
  date: '12/03/2021',
21
21
  params: {},
22
22
  setDate: () => null,
23
+ className: ''
23
24
  };