linear-react-components-ui 1.1.20-rc.3 → 1.1.20

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 (46) hide show
  1. package/lib/assets/styles/calendar.scss +64 -30
  2. package/lib/assets/styles/datepicker.scss +26 -6
  3. package/lib/assets/styles/periodpicker.scss +60 -20
  4. package/lib/assets/styles/sidenav.scss +1 -1
  5. package/lib/assets/styles/tabs.scss +32 -15
  6. package/lib/calendar/DangerCalendar.d.ts +1 -0
  7. package/lib/calendar/InfoCalendar.d.ts +1 -0
  8. package/lib/calendar/PrimaryCalendar.d.ts +1 -0
  9. package/lib/calendar/SuccessCalendar.d.ts +1 -0
  10. package/lib/calendar/WarningCalendar.d.ts +1 -0
  11. package/lib/calendar/base/Day.d.ts +1 -0
  12. package/lib/calendar/base/Day.js +6 -2
  13. package/lib/calendar/base/Month.d.ts +2 -1
  14. package/lib/calendar/base/Month.js +2 -0
  15. package/lib/calendar/base/Week.d.ts +1 -0
  16. package/lib/calendar/base/index.d.ts +1 -0
  17. package/lib/calendar/base/index.js +61 -13
  18. package/lib/calendar/index.d.ts +1 -0
  19. package/lib/calendar/types.d.ts +5 -0
  20. package/lib/dialog/base/Content.js +5 -4
  21. package/lib/dialog/base/Header.js +0 -1
  22. package/lib/dialog/base/index.js +26 -3
  23. package/lib/drawer/Drawer.js +1 -1
  24. package/lib/inputs/date/Dialog.js +5 -4
  25. package/lib/inputs/date/Dropdown.js +13 -7
  26. package/lib/inputs/date/helpers.d.ts +1 -11
  27. package/lib/inputs/date/helpers.js +1 -14
  28. package/lib/inputs/date/index.js +127 -95
  29. package/lib/inputs/date/types.d.ts +7 -6
  30. package/lib/inputs/period/Dialog.d.ts +1 -1
  31. package/lib/inputs/period/Dialog.js +5 -3
  32. package/lib/inputs/period/Dropdown.js +16 -8
  33. package/lib/inputs/period/PeriodList.js +3 -12
  34. package/lib/inputs/period/index.js +210 -74
  35. package/lib/inputs/period/types.d.ts +10 -8
  36. package/lib/inputs/select/ActionButtons.js +3 -2
  37. package/lib/inputs/select/multiple/index.js +10 -4
  38. package/lib/inputs/select/simple/index.js +10 -4
  39. package/lib/inputs/select/types.d.ts +4 -0
  40. package/lib/inputs/types.d.ts +1 -0
  41. package/lib/tabs/DropdownTabs.js +21 -7
  42. package/lib/tabs/context.d.ts +1 -1
  43. package/lib/tabs/context.js +3 -3
  44. package/lib/tabs/types.d.ts +2 -1
  45. package/lib/toolbar/types.d.ts +2 -1
  46. package/package.json +1 -1
@@ -6,23 +6,31 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = require("react");
8
8
  var _reactDom = _interopRequireDefault(require("react-dom"));
9
- var _helper = _interopRequireDefault(require("./helper"));
10
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- const body = document.getElementsByTagName('body')[0];
10
+ const CALENDAR_MIN_WIDTH = 250;
12
11
  const Dropdown = props => {
12
+ const {
13
+ children,
14
+ dropdownRef,
15
+ containerRef,
16
+ inputDimensions
17
+ } = props;
13
18
  const elementRef = (0, _react.useRef)(document.createElement('div'));
19
+ const width = inputDimensions && inputDimensions.width || CALENDAR_MIN_WIDTH;
14
20
  (0, _react.useEffect)(() => {
15
21
  elementRef.current.className = 'datepicker-component';
16
- elementRef.current.setAttribute('style', (0, _helper.default)(props));
17
- body.appendChild(elementRef.current);
18
- props.dropdownRef(elementRef.current);
22
+ elementRef.current.style.width = String(width).concat('px');
23
+ elementRef.current.style.top = String(inputDimensions?.bottom).concat('px');
24
+ containerRef.current?.appendChild(elementRef.current);
25
+ dropdownRef(elementRef.current);
19
26
  return () => {
20
- body.removeChild(elementRef.current);
27
+ containerRef.current?.removeChild(elementRef.current);
21
28
  };
22
29
  }, []);
23
30
  (0, _react.useEffect)(() => {
24
- elementRef.current.setAttribute('style', (0, _helper.default)(props));
31
+ elementRef.current.style.width = String(width).concat('px');
32
+ elementRef.current.style.top = String(props.inputDimensions?.bottom).concat('px');
25
33
  }, [props]);
26
- return /*#__PURE__*/_reactDom.default.createPortal(props.children, elementRef.current);
34
+ return /*#__PURE__*/_reactDom.default.createPortal(children, elementRef.current);
27
35
  };
28
36
  var _default = exports.default = Dropdown;
@@ -38,24 +38,15 @@ const PeriodList = _ref => {
38
38
  className: "dropdown-period"
39
39
  }, periodOptions.map(item => {
40
40
  const itemSelected = selected === item.id;
41
- return /*#__PURE__*/_react.default.createElement("div", {
42
- role: "button",
41
+ return /*#__PURE__*/_react.default.createElement("button", {
42
+ key: String('item-').concat(item.id),
43
43
  tabIndex: -1,
44
- onKeyDown: () => {},
45
- key: `item-${item.id}`,
46
44
  className: (0, _helper.getDropdownItemCssClass)(itemSelected),
47
45
  onClick: () => {
48
46
  const dates = item.id !== 'custom' ? (0, _helper.CalcDatesByPeriod)(item.id) : null;
49
47
  handleOnSelect(item.id, dates);
50
48
  }
51
- }, /*#__PURE__*/_react.default.createElement("span", {
52
- role: "button",
53
- className: "menubutton",
54
- tabIndex: -1,
55
- onKeyPress: () => {}
56
- }, /*#__PURE__*/_react.default.createElement("span", {
57
- className: "label"
58
- }, item.label)));
49
+ }, item.label);
59
50
  }));
60
51
  };
61
52
  var _default = exports.default = PeriodList;
@@ -14,6 +14,7 @@ var _buttons = _interopRequireDefault(require("../../buttons"));
14
14
  var _icons = _interopRequireDefault(require("../../icons"));
15
15
  var _Dialog = _interopRequireDefault(require("./Dialog"));
16
16
  var _hint = _interopRequireDefault(require("../../hint"));
17
+ var _gridlayout = _interopRequireDefault(require("../../gridlayout"));
17
18
  var helperBase = _interopRequireWildcard(require("../base/helpers"));
18
19
  require("../../assets/styles/periodpicker.scss");
19
20
  var _errorMessage = require("../errorMessage");
@@ -41,8 +42,11 @@ const PeriodPicker = props => {
41
42
  hint,
42
43
  hintPosition = 'below',
43
44
  themePopover = 'light',
44
- popoverAlign = 'left'
45
+ popoverAlign = 'left',
46
+ gridLayout
45
47
  } = props;
48
+ const idValueInitial = (0, _react.useId)();
49
+ const idValueFinal = (0, _react.useId)();
46
50
  const [valueInitial, setValueInitial] = (0, _react.useState)(props.value && (0, _moment.default)(props.value.initial, 'DD/MM/YYYY'));
47
51
  const [valueFinal, setValueFinal] = (0, _react.useState)(props.value && (0, _moment.default)(props.value.final, 'DD/MM/YYYY'));
48
52
  const [valuePeriodSelection, setValuePeriodSelection] = (0, _react.useState)('week');
@@ -51,52 +55,117 @@ const PeriodPicker = props => {
51
55
  const [showPeriodSelection, setShowPeriodSelection] = (0, _react.useState)(false);
52
56
  const [inputDimensions, setInputDimensions] = (0, _react.useState)();
53
57
  const [onDenied, setOnDenied] = (0, _react.useState)();
58
+ const [currentTypeDate, setCurrentTypeDate] = (0, _react.useState)('valueInitial');
54
59
  const wrapperBaseInputPeriodRef = (0, _react.useRef)(null);
55
60
  const inputContainerRef = (0, _react.useRef)(null);
56
61
  const inputInitialRef = (0, _react.useRef)(null);
57
62
  const buttonOpenRef = (0, _react.useRef)(null);
63
+ const currentDateButtonRef = (0, _react.useRef)();
58
64
  const buttonSelectPeriodRef = (0, _react.useRef)(null);
59
65
  const dropdownCalendarContainer = (0, _react.useRef)(null);
60
66
  const dropdownPeriodContainer = (0, _react.useRef)(null);
61
67
  const inputFinalRef = (0, _react.useRef)(null);
68
+ const calendarContainerRef = (0, _react.useRef)(null);
62
69
  const onScreenResize = () => {
63
- const inputDimensionsAux = inputContainerRef?.current?.getBoundingClientRect();
64
- setInputDimensions(inputDimensionsAux);
70
+ setInputDimensions(inputContainerRef?.current?.getBoundingClientRect());
65
71
  };
66
- const onClickOutside = event => {
67
- const {
68
- target
69
- } = event;
70
- if (target === inputContainerRef.current || target === inputInitialRef.current || target === inputFinalRef.current || target === buttonOpenRef.current || target === buttonSelectPeriodRef.current) {
71
- return;
72
+ const onBlurWithoutWrapper = event => {
73
+ const focusOnAnotherField = !wrapperBaseInputPeriodRef.current?.contains(event.relatedTarget);
74
+ if (!showCalendarInDialog && showCalendarValueInitial && focusOnAnotherField) {
75
+ setShowCalendarValueInitial(false);
72
76
  }
73
- if (dropdownCalendarContainer.current && dropdownCalendarContainer.current.contains(target)) {
74
- return;
77
+ if (!showCalendarInDialog && showCalendarValueFinal && focusOnAnotherField) {
78
+ setShowCalendarValueFinal(false);
75
79
  }
76
- if (dropdownPeriodContainer.current && dropdownPeriodContainer.current.contains(target)) return;
77
- setShowCalendarValueInitial(false);
78
- setShowCalendarValueFinal(false);
79
- setShowPeriodSelection(false);
80
80
  };
81
- const onCloseCalendarWithoutFocus = event => {
82
- if (event.key === 'Tab') {
83
- if (wrapperBaseInputPeriodRef.current && wrapperBaseInputPeriodRef.current.contains(document.activeElement) && document.activeElement instanceof HTMLInputElement) {
81
+ const onKeyDownPress = event => {
82
+ const {
83
+ target
84
+ } = event;
85
+ const targetElement = target;
86
+ if (calendarContainerRef.current && event && event.key && event.key === 'Escape') {
87
+ event.preventDefault();
88
+ targetElement.focus();
89
+ if (showCalendarValueInitial) {
90
+ if (targetElement.id !== 'valueInitial') {
91
+ inputInitialRef.current?.focus();
92
+ }
84
93
  setShowCalendarValueInitial(false);
94
+ }
95
+ if (showCalendarValueFinal) {
96
+ if (targetElement.id !== 'valueFinal') {
97
+ inputFinalRef.current?.focus();
98
+ }
99
+ setShowCalendarValueFinal(false);
100
+ }
101
+ if (showPeriodSelection) {
102
+ setShowPeriodSelection(false);
103
+ inputFinalRef.current?.focus();
85
104
  setShowCalendarValueFinal(false);
86
105
  }
87
106
  }
107
+ if (calendarContainerRef.current && event && event.key && event.key === 'Tab') {
108
+ const buttonForNavigateCalendar = calendarContainerRef.current?.getElementsByClassName('navbutton');
109
+ const datePicked = calendarContainerRef.current?.getElementsByClassName('-selectedday');
110
+ const buttonDatePicked = datePicked[0].firstChild;
111
+ const buttonsForFocus = Array.from([...buttonForNavigateCalendar, buttonDatePicked]);
112
+ const firstElement = buttonsForFocus[0];
113
+ const lastElement = buttonsForFocus[buttonsForFocus.length - 1];
114
+ const calendarOpenedIsInitial = calendarContainerRef.current.id === 'valueInitial';
115
+ if (!event.shiftKey && showCalendarValueInitial && document.activeElement === inputInitialRef.current) {
116
+ event.preventDefault();
117
+ firstElement.focus();
118
+ }
119
+ if (event.shiftKey && calendarOpenedIsInitial && document.activeElement === firstElement) {
120
+ event.preventDefault();
121
+ inputInitialRef.current?.focus();
122
+ }
123
+ if (!event.shiftKey && calendarOpenedIsInitial && document.activeElement === lastElement) {
124
+ event.preventDefault();
125
+ inputFinalRef.current?.focus();
126
+ }
127
+ }
128
+ event.stopPropagation();
129
+ };
130
+ const keepPositionCalendarByScroll = () => {
131
+ const inputDateDimensions = inputContainerRef.current?.getBoundingClientRect();
132
+ const positionTop = inputDateDimensions && inputDateDimensions.bottom;
133
+ if (dropdownCalendarContainer && dropdownCalendarContainer.current && inputDateDimensions) {
134
+ dropdownCalendarContainer.current.style.top = String(positionTop).concat('px');
135
+ }
88
136
  };
89
137
  (0, _react.useEffect)(() => {
90
138
  window.addEventListener('resize', onScreenResize);
91
- document.addEventListener('click', onClickOutside);
92
- document.addEventListener('keydown', onCloseCalendarWithoutFocus);
139
+ document.addEventListener('scroll', keepPositionCalendarByScroll);
140
+ document.getElementById('modal-dialog-content')?.addEventListener('scroll', keepPositionCalendarByScroll);
93
141
  if (inputContainerRef.current) onScreenResize();
142
+ if (inputInitialRef && inputInitialRef.current) inputInitialRef.current.id = idValueInitial;
143
+ if (inputFinalRef && inputFinalRef.current) inputFinalRef.current.id = idValueFinal;
94
144
  return () => {
95
145
  window.removeEventListener('resize', onScreenResize);
96
- document.removeEventListener('click', onClickOutside);
97
- document.removeEventListener('keydown', onCloseCalendarWithoutFocus);
146
+ document.removeEventListener('scroll', keepPositionCalendarByScroll);
147
+ document.getElementById('modal-dialog-content')?.removeEventListener('scroll', keepPositionCalendarByScroll);
98
148
  };
99
149
  }, []);
150
+ (0, _react.useEffect)(() => {
151
+ document.addEventListener('keydown', onKeyDownPress);
152
+ return () => {
153
+ document.removeEventListener('keydown', onKeyDownPress);
154
+ };
155
+ }, [showCalendarValueFinal, showCalendarValueInitial, showPeriodSelection, calendarContainerRef.current]);
156
+ (0, _react.useEffect)(() => {
157
+ if (valueFinal && valueInitial && (0, _moment.default)(valueFinal).isBefore((0, _moment.default)(valueInitial))) {
158
+ setValueInitial(valueFinal);
159
+ setValueFinal(valueInitial);
160
+ } else if (props.onChange) {
161
+ const initial = valueInitial ? valueInitial.format('YYYY-MM-DD') : '';
162
+ const final = valueFinal ? valueFinal.format('YYYY-MM-DD') : '';
163
+ props.onChange(undefined, '', {
164
+ initial,
165
+ final
166
+ });
167
+ }
168
+ }, [valueInitial, valueFinal]);
100
169
  (0, _react.useEffect)(() => {
101
170
  if (props.value && !((0, _moment.default)(props.value.initial).isSame(valueInitial) || (0, _moment.default)(props.value.final).isSame(valueFinal))) {
102
171
  const {
@@ -117,17 +186,62 @@ const PeriodPicker = props => {
117
186
  }, [props.value]);
118
187
  const openCalendar = calendarName => {
119
188
  if (calendarName === 'valueInitial') {
189
+ setCurrentTypeDate('valueInitial');
120
190
  setShowCalendarValueFinal(false);
121
- setShowCalendarValueInitial(true);
122
- } else {
191
+ if (!showCalendarValueInitial) {
192
+ inputInitialRef.current?.focus();
193
+ if (showCalendarInDialog) {
194
+ setTimeout(() => {
195
+ currentDateButtonRef.current?.focus();
196
+ }, 100);
197
+ }
198
+ setShowCalendarValueInitial(true);
199
+ }
200
+ }
201
+ if (calendarName === 'valueFinal') {
202
+ setCurrentTypeDate('valueFinal');
123
203
  setShowCalendarValueInitial(false);
124
- setShowCalendarValueFinal(true);
204
+ if (!showCalendarValueFinal) {
205
+ inputFinalRef.current?.focus();
206
+ if (showCalendarInDialog) {
207
+ setTimeout(() => {
208
+ currentDateButtonRef.current?.focus();
209
+ }, 100);
210
+ }
211
+ setShowCalendarValueFinal(true);
212
+ }
125
213
  }
126
- setShowPeriodSelection(false);
127
214
  if (inputContainerRef.current) {
128
215
  setInputDimensions(inputContainerRef.current.getBoundingClientRect());
129
216
  }
130
217
  };
218
+ const closeCalendar = calendarName => {
219
+ if (calendarName === 'valueInitial') {
220
+ inputInitialRef.current?.focus();
221
+ }
222
+ if (calendarName === 'valueFinal') {
223
+ inputFinalRef.current?.focus();
224
+ }
225
+ setShowCalendarValueInitial(false);
226
+ setShowCalendarValueFinal(false);
227
+ };
228
+ const onCloseDateDialog = calendarName => {
229
+ setTimeout(() => {
230
+ if (calendarName === 'valueInitial') {
231
+ inputInitialRef.current?.focus();
232
+ setShowCalendarValueInitial(false);
233
+ }
234
+ if (calendarName === 'valueFinal') {
235
+ inputFinalRef.current?.focus();
236
+ setShowCalendarValueFinal(false);
237
+ }
238
+ if (calendarName === 'periodSelection') {
239
+ setShowPeriodSelection(false);
240
+ inputFinalRef.current?.focus();
241
+ setShowCalendarValueFinal(false);
242
+ }
243
+ }, 100);
244
+ };
131
245
  const onInputFocus = e => {
132
246
  const {
133
247
  name
@@ -210,26 +324,29 @@ const PeriodPicker = props => {
210
324
  } = props;
211
325
  return disabled || onDenied && (onDenied.disabled || onDenied.hideContent);
212
326
  };
213
- const getButtonOpen = () => {
327
+ const getButtonOpen = (0, _react.useCallback)(() => {
214
328
  if (!showButtonOpen) return null;
215
329
  return /*#__PURE__*/_react.default.createElement(_buttons.default, {
216
330
  key: "button-open",
217
331
  boxShadow: false,
332
+ disabled: shouldDisable(),
333
+ customClass: "calendar-button",
218
334
  icon: /*#__PURE__*/_react.default.createElement(_icons.default, {
219
335
  name: "calendar"
220
336
  }),
221
337
  onClick: () => {
222
- inputInitialRef.current?.focus();
223
- openCalendar('valueInitial');
338
+ if (showCalendarValueFinal || showCalendarValueInitial) {
339
+ closeCalendar(currentTypeDate);
340
+ } else {
341
+ openCalendar(currentTypeDate);
342
+ }
224
343
  },
225
- customClass: "calendar-button",
226
344
  tabIndex: -1,
227
345
  targetRef: ref => {
228
346
  buttonOpenRef.current = ref;
229
- },
230
- disabled: shouldDisable()
347
+ }
231
348
  });
232
- };
349
+ }, [showCalendarValueFinal, showCalendarValueInitial]);
233
350
  const getPeriodSelection = (valuePeriodSelectionAux, setPeriodDates) => /*#__PURE__*/_react.default.createElement(_PeriodList.default, {
234
351
  selected: valuePeriodSelectionAux,
235
352
  handleOnSelect: setPeriodDates
@@ -242,31 +359,39 @@ const PeriodPicker = props => {
242
359
  setInputDimensions(inputContainerRef.current.getBoundingClientRect());
243
360
  }
244
361
  };
245
- const getButtonSelectPeriod = () => /*#__PURE__*/_react.default.createElement(_buttons.default, {
246
- key: "button-select-period",
247
- boxShadow: false,
248
- icon: /*#__PURE__*/_react.default.createElement(_icons.default, {
249
- name: "more1"
250
- }),
251
- onBlur: () => setTimeout(() => setShowPeriodSelection(false), 100),
252
- onClick: () => openPeriodSelecion(),
253
- customClass: "calendar-button",
254
- tabIndex: -1,
255
- targetRef: ref => {
256
- buttonSelectPeriodRef.current = ref;
257
- },
258
- disabled: shouldDisable()
259
- });
362
+ const closePeriodSelection = () => {
363
+ setShowPeriodSelection(false);
364
+ inputFinalRef.current?.focus();
365
+ setShowCalendarValueFinal(false);
366
+ };
367
+ const getButtonSelectPeriod = (0, _react.useCallback)(() => {
368
+ return /*#__PURE__*/_react.default.createElement(_buttons.default, {
369
+ key: "button-select-period",
370
+ disabled: shouldDisable(),
371
+ tabIndex: -1,
372
+ customClass: "calendar-button",
373
+ icon: /*#__PURE__*/_react.default.createElement(_icons.default, {
374
+ name: "more1"
375
+ }),
376
+ onBlur: () => setTimeout(() => setShowPeriodSelection(false), 100),
377
+ onClick: () => !showPeriodSelection ? openPeriodSelecion() : closePeriodSelection(),
378
+ targetRef: ref => {
379
+ buttonSelectPeriodRef.current = ref;
380
+ }
381
+ });
382
+ }, [showPeriodSelection]);
260
383
  const getCalendar = (value, calendarColorStyleCalendar, valueDateName) => /*#__PURE__*/_react.default.createElement(_calendar.default, {
384
+ colorStyle: calendarColorStyleCalendar,
261
385
  currentDate: value !== undefined ? (0, _moment.default)(value) : (0, _moment.default)(),
262
- onDateChange: date => {
263
- setValue({
264
- target: {
265
- name: valueDateName
266
- }
267
- }, date);
386
+ calendarContainer: ref => {
387
+ calendarContainerRef.current = ref;
268
388
  },
269
- colorStyle: calendarColorStyleCalendar
389
+ onDateChange: date => setValue({
390
+ target: {
391
+ name: valueDateName
392
+ }
393
+ }, date),
394
+ currentDateButton: buttonElement => currentDateButtonRef.current = buttonElement
270
395
  });
271
396
  const setPeriodDates = (selected, dates) => {
272
397
  if (selected === 'custom') {
@@ -283,64 +408,69 @@ const PeriodPicker = props => {
283
408
  if (shouldCloseOnSelect) {
284
409
  setShowPeriodSelection(false);
285
410
  }
411
+ inputFinalRef.current?.focus();
412
+ setShowCalendarValueFinal(false);
286
413
  };
287
- const getWrapperComponentCalendarValueInitial = () => {
414
+ const getCalendarInitial = () => {
288
415
  if (onDenied && onDenied.readOnly) return null;
416
+ if (calendarContainerRef && calendarContainerRef.current) calendarContainerRef.current.id = 'valueInitial';
289
417
  if (showCalendarInDialog) {
290
418
  return /*#__PURE__*/_react.default.createElement(_Dialog.default, {
419
+ handlerClose: () => onCloseDateDialog('valueInitial'),
291
420
  dialogSize: dialogSize,
292
421
  onOpenChange: setShowCalendarValueInitial
293
422
  }, getCalendar(valueInitial, calendarColorStyle, 'valueInitial'));
294
423
  }
295
424
  return /*#__PURE__*/_react.default.createElement(_Dropdown.default, {
296
- targetElement: inputContainerRef.current,
297
- topPosition: inputDimensions ? inputDimensions.top + inputDimensions.height + 5 : '',
298
- leftPosition: inputDimensions ? inputDimensions.left : '',
299
- width: inputDimensions ? inputDimensions.width : '',
425
+ containerRef: wrapperBaseInputPeriodRef,
426
+ showButtonOpen: showButtonOpen,
427
+ inputDimensions: inputDimensions,
300
428
  dropdownRef: el => {
301
429
  dropdownCalendarContainer.current = el;
302
430
  }
303
431
  }, getCalendar(valueInitial, calendarColorStyle, 'valueInitial'));
304
432
  };
305
- const getWrapperComponentCalendarValueFinal = () => {
433
+ const getCalendarFinal = () => {
306
434
  if (onDenied && onDenied.readOnly) return null;
435
+ if (calendarContainerRef && calendarContainerRef.current) calendarContainerRef.current.id = 'valueFinal';
307
436
  if (showCalendarInDialog) {
308
437
  return /*#__PURE__*/_react.default.createElement(_Dialog.default, {
438
+ handlerClose: () => onCloseDateDialog('valueFinal'),
309
439
  dialogSize: dialogSize,
310
440
  onOpenChange: setShowCalendarValueFinal
311
441
  }, getCalendar(valueFinal, calendarColorStyle, 'valueFinal'));
312
442
  }
313
443
  return /*#__PURE__*/_react.default.createElement(_Dropdown.default, {
314
- targetElement: inputContainerRef.current,
315
- topPosition: inputDimensions ? inputDimensions.top + inputDimensions.height + 5 : '',
316
- leftPosition: inputDimensions ? inputDimensions.left : '',
317
- width: inputDimensions ? inputDimensions.width : '',
444
+ containerRef: wrapperBaseInputPeriodRef,
445
+ showButtonOpen: showButtonOpen,
446
+ inputDimensions: inputDimensions,
318
447
  dropdownRef: el => {
319
448
  dropdownCalendarContainer.current = el;
320
449
  }
321
450
  }, getCalendar(valueFinal, calendarColorStyle, 'valueFinal'));
322
451
  };
323
- const getWrapperComponentPeriodSelection = () => {
452
+ const getPeriodOfDatesSelection = () => {
324
453
  if (showCalendarInDialog) {
325
454
  return /*#__PURE__*/_react.default.createElement(_Dialog.default, {
455
+ handlerClose: () => onCloseDateDialog('periodSelection'),
326
456
  dialogSize: dialogSize,
327
457
  onOpenChange: setShowPeriodSelection
328
458
  }, getPeriodSelection(valuePeriodSelection, setPeriodDates));
329
459
  }
330
460
  return /*#__PURE__*/_react.default.createElement(_Dropdown.default, {
331
- targetElement: inputContainerRef.current,
332
- topPosition: inputDimensions ? inputDimensions.top + inputDimensions.height + 5 : '',
333
- leftPosition: inputDimensions ? inputDimensions.left : '',
334
- width: inputDimensions ? inputDimensions.width : '',
461
+ containerRef: wrapperBaseInputPeriodRef,
462
+ showButtonOpen: showButtonOpen,
463
+ inputDimensions: inputDimensions,
335
464
  dropdownRef: el => {
336
- dropdownPeriodContainer.current = el;
465
+ dropdownCalendarContainer.current = el;
337
466
  }
338
467
  }, getPeriodSelection(valuePeriodSelection, setPeriodDates));
339
468
  };
340
469
  if (onDenied && onDenied.unvisible) return null;
341
- return /*#__PURE__*/_react.default.createElement("div", {
470
+ const component = () => /*#__PURE__*/_react.default.createElement("div", {
342
471
  ref: wrapperBaseInputPeriodRef,
343
- className: "input-base-component"
472
+ onBlur: onBlurWithoutWrapper,
473
+ className: "input-base-component datepicker-period-container"
344
474
  }, props.label && /*#__PURE__*/_react.default.createElement("div", {
345
475
  className: "labelcontainer"
346
476
  }, /*#__PURE__*/_react.default.createElement(_textContent.default, {
@@ -376,6 +506,7 @@ const PeriodPicker = props => {
376
506
  }))}`,
377
507
  ref: inputContainerRef
378
508
  }, /*#__PURE__*/_react.default.createElement(_BaseMask.default, {
509
+ gridLayout: undefined,
379
510
  permissionAttr: props.permissionAttr,
380
511
  name: "valueInitial",
381
512
  value: !valueInitial ? '' : (0, _moment.default)(valueInitial).format('DD/MM/YYYY'),
@@ -397,6 +528,7 @@ const PeriodPicker = props => {
397
528
  name: "arrow_right",
398
529
  customClass: "separation_icon"
399
530
  }), /*#__PURE__*/_react.default.createElement(_BaseMask.default, {
531
+ gridLayout: undefined,
400
532
  permissionAttr: props.permissionAttr,
401
533
  name: "valueFinal",
402
534
  value: !valueFinal ? '' : (0, _moment.default)(valueFinal).format('DD/MM/YYYY'),
@@ -412,12 +544,16 @@ const PeriodPicker = props => {
412
544
  },
413
545
  handlerSetOnDenied: denied => setOnDenied(denied),
414
546
  required: props.required
415
- }), getButtonOpen(), getButtonSelectPeriod()), showCalendarValueInitial && getWrapperComponentCalendarValueInitial(), showCalendarValueFinal && getWrapperComponentCalendarValueFinal(), showPeriodSelection && getWrapperComponentPeriodSelection(), /*#__PURE__*/_react.default.createElement(_hint.default, {
547
+ }), getButtonOpen(), getButtonSelectPeriod()), showCalendarValueInitial && getCalendarInitial(), showCalendarValueFinal && getCalendarFinal(), showPeriodSelection && getPeriodOfDatesSelection(), /*#__PURE__*/_react.default.createElement(_hint.default, {
416
548
  visible: !!hint && hintPosition === 'below',
417
549
  customClass: "hint",
418
550
  description: hint
419
551
  }), /*#__PURE__*/_react.default.createElement(_errorMessage.ErrorMessage, {
420
552
  messages: props.errorMessages
421
553
  }));
554
+ return !gridLayout ? component() : /*#__PURE__*/_react.default.createElement(_gridlayout.default, {
555
+ customClass: "-withinput",
556
+ cols: gridLayout
557
+ }, component());
422
558
  };
423
559
  var _default = exports.default = PeriodPicker;
@@ -1,5 +1,5 @@
1
1
  import { Moment } from 'moment';
2
- import { ReactNode } from 'react';
2
+ import { ReactNode, RefObject } from 'react';
3
3
  import { ColorStyles } from '../../@types/ColorStyles.js';
4
4
  import { Period } from '../../@types/Period.js';
5
5
  import { PermissionAttr } from '../../@types/PermissionAttr.js';
@@ -9,6 +9,7 @@ import '../../internals/types.js';
9
9
  import '../../@types/Position.js';
10
10
 
11
11
  type DateTypes = 'today' | 'week' | 'lastweek' | 'last15' | 'month' | 'lastmonth';
12
+ type TypeCurrentDate = 'valueInitial' | 'valueFinal';
12
13
  interface ChangeInputPeriodEvent {
13
14
  target: {
14
15
  value?: string;
@@ -26,14 +27,14 @@ interface IDialogProps {
26
27
  width: string;
27
28
  height: string;
28
29
  };
30
+ handlerClose: (open: boolean) => void;
29
31
  }
30
32
  interface IPeriodDropdownProps {
31
- topPosition: number | string;
32
- leftPosition: number | string;
33
- width: number | string;
34
- children: JSX.Element | JSX.Element[];
35
- dropdownRef: (el: HTMLElement) => void;
36
- targetElement?: HTMLDivElement | HTMLInputElement | null;
33
+ children: ReactNode | ReactNode[];
34
+ dropdownRef: (el: HTMLDivElement) => void;
35
+ containerRef: RefObject<HTMLDivElement | HTMLElement>;
36
+ showButtonOpen: boolean;
37
+ inputDimensions?: DOMRect;
37
38
  }
38
39
  interface IPeriodPickerProps {
39
40
  label?: string;
@@ -62,6 +63,7 @@ interface IPeriodPickerProps {
62
63
  hintPosition?: 'below' | 'onLabelRight';
63
64
  onBlur?: (e: CustomInputEvent) => void;
64
65
  onFocus?: (e: CustomInputEvent) => void;
66
+ gridLayout?: string;
65
67
  themePopover?: 'light' | 'dark';
66
68
  popoverAlign?: 'right' | 'left';
67
69
  }
@@ -70,4 +72,4 @@ interface IPeriodListProps {
70
72
  selected?: string;
71
73
  }
72
74
 
73
- export { ChangeInputPeriodEvent, DateTypes, IDialogProps, IPeriodDropdownProps, IPeriodListProps, IPeriodOptions, IPeriodPickerProps };
75
+ export { ChangeInputPeriodEvent, DateTypes, IDialogProps, IPeriodDropdownProps, IPeriodListProps, IPeriodOptions, IPeriodPickerProps, TypeCurrentDate };
@@ -13,10 +13,11 @@ const ActionButtons = props => {
13
13
  showClearButton = true,
14
14
  dropDownOpened,
15
15
  handlerOpenClose,
16
- handlerClear
16
+ handlerClear,
17
+ customClassForSideButtons
17
18
  } = props;
18
19
  return /*#__PURE__*/_react.default.createElement("div", {
19
- className: "actionbuttonsselect"
20
+ className: `actionbuttonsselect ${customClassForSideButtons}`
20
21
  }, showClearButton && /*#__PURE__*/_react.default.createElement("button", {
21
22
  disabled: disabled,
22
23
  tabIndex: -1,
@@ -29,7 +29,11 @@ const MultipleSelect = props => {
29
29
  showClearButton,
30
30
  rightElements = [],
31
31
  hint,
32
- hintPosition = 'below'
32
+ hintPosition = 'below',
33
+ customClassForLabel,
34
+ customClassForWrapper,
35
+ customClassForInputContent,
36
+ customClassForSideButtons
33
37
  } = props;
34
38
  const [dataCombo, setDataCombo] = (0, _react.useState)(dataSource);
35
39
  const [currents, setCurrents] = (0, _react.useState)([]);
@@ -233,8 +237,9 @@ const MultipleSelect = props => {
233
237
  },
234
238
  onClick: onFocus,
235
239
  onKeyDown: onInputKeyDown,
236
- customClassForWrapper: `selectwrapper ${(props.readOnly || shouldDisable() || shouldBeReadOnly()) && ' -undigitable'}`,
237
- customClassForInputContent: "multiselect",
240
+ customClassForLabel: customClassForLabel,
241
+ customClassForWrapper: `selectwrapper ${(props.readOnly || shouldDisable() || shouldBeReadOnly()) && ' -undigitable'} ${customClassForWrapper}`,
242
+ customClassForInputContent: `multiselect ${customClassForInputContent}`,
238
243
  inputBaseRef: r => {
239
244
  selectWrapper.current = r;
240
245
  },
@@ -248,7 +253,8 @@ const MultipleSelect = props => {
248
253
  if (shouldDisable()) return null;
249
254
  return onClearClick();
250
255
  },
251
- handlerOpenClose: onOpenClose
256
+ handlerOpenClose: onOpenClose,
257
+ customClassForSideButtons: customClassForSideButtons
252
258
  })]
253
259
  }), /*#__PURE__*/_react.default.createElement(_Selecteds.default, _extends({}, props, {
254
260
  currents: currents,
@@ -35,7 +35,11 @@ const SimpleSelect = props => {
35
35
  allOptions = undefined,
36
36
  showClearButton = false,
37
37
  searchNotFoundText,
38
- rightElements = []
38
+ rightElements = [],
39
+ customClassForWrapper,
40
+ customClassForInputContent,
41
+ customClassForLabel,
42
+ customClassForSideButtons
39
43
  } = props;
40
44
  const descriptionKeyIsString = typeof descriptionKey === 'string';
41
45
  const dataSourceWithAllOptions = allOptions ? [{
@@ -262,8 +266,9 @@ const SimpleSelect = props => {
262
266
  },
263
267
  onClick: onFocus,
264
268
  onKeyDown: onInputKeyDown,
265
- customClassForWrapper: `selectwrapper ${(undigitable || searchOnDropdown || shouldBeReadOnly()) && ' -undigitable'}`,
266
- customClassForInputContent: "multiselect",
269
+ customClassForLabel: customClassForLabel,
270
+ customClassForWrapper: `selectwrapper ${(undigitable || searchOnDropdown || shouldBeReadOnly()) && ' -undigitable'} ${customClassForWrapper}`,
271
+ customClassForInputContent: `multiselect ${customClassForInputContent}`,
267
272
  inputBaseRef: r => {
268
273
  selectWrapper.current = r;
269
274
  },
@@ -277,7 +282,8 @@ const SimpleSelect = props => {
277
282
  if (shouldDisable()) return null;
278
283
  return onClearClick();
279
284
  },
280
- handlerOpenClose: onOpenClose
285
+ handlerOpenClose: onOpenClose,
286
+ customClassForSideButtons: customClassForSideButtons
281
287
  })]
282
288
  })), opened && /*#__PURE__*/_react.default.createElement(_Dropdown.default, _extends({}, props, {
283
289
  opened: opened,
@@ -50,6 +50,10 @@ interface ISimpleSelectProps {
50
50
  onFocus?: () => void;
51
51
  allOptions?: AllOptions;
52
52
  inputRef?: MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void);
53
+ customClassForWrapper?: string;
54
+ customClassForInputContent?: string;
55
+ customClassForLabel?: string;
56
+ customClassForSideButtons?: string;
53
57
  rightElements?: JSX.Element[];
54
58
  hintPosition?: 'below' | 'onLabelRight';
55
59
  themePopover?: 'light' | 'dark';