@producteca/producteca-ui-kit 1.21.1-beta.0 → 1.21.1-beta.1

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 (152) hide show
  1. package/dist/components/alert/alert.d.ts +17 -0
  2. package/dist/components/breadcrumb/breadcrumb.d.ts +15 -0
  3. package/dist/components/breadcrumb/index.d.ts +2 -0
  4. package/dist/components/button/button.d.ts +17 -0
  5. package/dist/components/chip/chip.d.ts +13 -0
  6. package/dist/components/chip/index.d.ts +2 -0
  7. package/dist/components/icons/customIcon/customIcon.d.ts +16 -0
  8. package/dist/components/icons/fileIcon/fileIcon.d.ts +5 -0
  9. package/dist/components/icons/{index.js → index.d.ts} +1 -1
  10. package/dist/components/icons/mailIcon/mailIcon.d.ts +5 -0
  11. package/dist/components/icons/parameters.d.ts +51 -0
  12. package/dist/components/icons/priceCloseIcon/priceCloseIcon.d.ts +5 -0
  13. package/dist/components/icons/priceDownIcon/priceDownIcon.d.ts +5 -0
  14. package/dist/components/icons/searchPublication/searchPublication.d.ts +5 -0
  15. package/dist/components/image/image.d.ts +11 -0
  16. package/dist/components/image/index.d.ts +1 -0
  17. package/dist/components/{index.js → index.d.ts} +1 -1
  18. package/dist/components/inputs/checkboxInput/checkboxInput.d.ts +9 -0
  19. package/dist/components/inputs/checkboxInput/checkboxInputGroup.d.ts +22 -0
  20. package/dist/components/inputs/checkboxInput/{index.js → index.d.ts} +2 -1
  21. package/dist/components/inputs/datePicker/datePicker.d.ts +5 -0
  22. package/dist/components/inputs/datePicker/datePickerCustomStyles.d.ts +8 -0
  23. package/dist/components/inputs/datePicker/datePickerTypes.d.ts +14 -0
  24. package/dist/components/inputs/datePicker/datePickerUtils.d.ts +68 -0
  25. package/dist/components/inputs/datePicker/index.d.ts +3 -0
  26. package/dist/components/inputs/dateRangePicker/dateFormater.d.ts +7 -0
  27. package/dist/components/inputs/dateRangePicker/dateRangePicker.d.ts +5 -0
  28. package/dist/components/inputs/dateRangePicker/dateRangePickerTypes.d.ts +14 -0
  29. package/dist/components/inputs/dateRangePicker/dateRangePickerUtils.d.ts +9 -0
  30. package/dist/components/inputs/dateRangePicker/index.d.ts +4 -0
  31. package/dist/components/inputs/formField/formField.d.ts +10 -0
  32. package/dist/components/inputs/formField/passwordInput.d.ts +4 -0
  33. package/dist/components/inputs/formField/textInput.d.ts +25 -0
  34. package/dist/components/inputs/{index.js → index.d.ts} +1 -1
  35. package/dist/components/inputs/searcher/searcher.d.ts +28 -0
  36. package/dist/components/inputs/selectField/selectField.d.ts +42 -0
  37. package/dist/components/inputs/switchInput/index.d.ts +4 -0
  38. package/dist/components/inputs/switchInput/switchInput.d.ts +31 -0
  39. package/dist/components/loaders/index.d.ts +2 -0
  40. package/dist/components/loaders/progressbar/progressbar.d.ts +8 -0
  41. package/dist/components/loaders/spinner/spinner.d.ts +6 -0
  42. package/dist/components/menuAction/index.d.ts +1 -0
  43. package/dist/components/menuAction/menuAction.d.ts +18 -0
  44. package/dist/components/menuAction/menuActionCustomStyles.d.ts +4 -0
  45. package/dist/components/modals/index.d.ts +1 -0
  46. package/dist/components/modals/warningModal/index.d.ts +1 -0
  47. package/dist/components/modals/warningModal/warningModal.d.ts +17 -0
  48. package/dist/components/patterns/actionBar/actionBar.d.ts +26 -0
  49. package/dist/components/patterns/copyButton/copyButton.d.ts +11 -0
  50. package/dist/components/patterns/copyButton/index.d.ts +1 -0
  51. package/dist/components/patterns/emptyState/emptyState.d.ts +11 -0
  52. package/dist/components/patterns/headerSection/headerSection.d.ts +14 -0
  53. package/dist/components/patterns/headerSection/index.d.ts +1 -0
  54. package/dist/components/patterns/iconWithIdentifier/iconWithIdentifier.d.ts +11 -0
  55. package/dist/components/patterns/iconWithIdentifier/index.d.ts +1 -0
  56. package/dist/components/patterns/{index.js → index.d.ts} +1 -1
  57. package/dist/components/patterns/linkWithIcon/index.d.ts +1 -0
  58. package/dist/components/patterns/linkWithIcon/linkWithIcon.d.ts +14 -0
  59. package/dist/components/tabs/index.d.ts +2 -0
  60. package/dist/components/tabs/tabs.d.ts +17 -0
  61. package/dist/components/tooltip/index.d.ts +3 -0
  62. package/dist/components/tooltip/overflowChecker.d.ts +5 -0
  63. package/dist/components/tooltip/tooltip.d.ts +20 -0
  64. package/dist/favicon.svg +43 -0
  65. package/dist/hooks/useReduxFormField.d.ts +26 -0
  66. package/dist/{index.js → index.d.ts} +1 -1
  67. package/dist/locales/description.d.ts +15 -0
  68. package/dist/locales/es.d.ts +227 -0
  69. package/dist/locales/index.d.ts +2 -0
  70. package/dist/locales/translator.d.ts +3 -0
  71. package/dist/producteca-ui-kit.cjs.js +508 -3
  72. package/dist/producteca-ui-kit.es.js +43799 -3
  73. package/dist/producteca-ui-kit.umd.js +508 -9
  74. package/dist/style.css +1 -0
  75. package/dist/styles/colors.d.ts +25 -0
  76. package/dist/styles/theme.d.ts +2 -0
  77. package/dist/validators/errorMessage.d.ts +5 -0
  78. package/dist/validators/index.d.ts +2 -0
  79. package/dist/validators/validation.d.ts +21 -0
  80. package/package.json +4 -4
  81. package/dist/components/alert/alert.js +0 -37
  82. package/dist/components/breadcrumb/breadcrumb.js +0 -33
  83. package/dist/components/breadcrumb/index.js +0 -2
  84. package/dist/components/button/button.js +0 -34
  85. package/dist/components/chip/chip.js +0 -27
  86. package/dist/components/chip/index.js +0 -1
  87. package/dist/components/icons/customIcon/customIcon.js +0 -41
  88. package/dist/components/icons/fileIcon/fileIcon.js +0 -14
  89. package/dist/components/icons/mailIcon/mailIcon.js +0 -14
  90. package/dist/components/icons/parameters.js +0 -26
  91. package/dist/components/icons/priceCloseIcon/priceCloseIcon.js +0 -14
  92. package/dist/components/icons/priceDownIcon/priceDownIcon.js +0 -14
  93. package/dist/components/icons/searchPublication/searchPublication.js +0 -14
  94. package/dist/components/image/image.js +0 -26
  95. package/dist/components/image/index.js +0 -1
  96. package/dist/components/inputs/checkboxInput/checkboxInput.js +0 -35
  97. package/dist/components/inputs/checkboxInput/checkboxInputGroup.js +0 -58
  98. package/dist/components/inputs/datePicker/datePicker.js +0 -143
  99. package/dist/components/inputs/datePicker/datePickerCustomStyles.js +0 -145
  100. package/dist/components/inputs/datePicker/datePickerTypes.js +0 -1
  101. package/dist/components/inputs/datePicker/datePickerUtils.js +0 -109
  102. package/dist/components/inputs/datePicker/index.js +0 -2
  103. package/dist/components/inputs/dateRangePicker/dateFormater.js +0 -28
  104. package/dist/components/inputs/dateRangePicker/dateRangePicker.js +0 -118
  105. package/dist/components/inputs/dateRangePicker/dateRangePickerTypes.js +0 -1
  106. package/dist/components/inputs/dateRangePicker/dateRangePickerUtils.js +0 -67
  107. package/dist/components/inputs/dateRangePicker/index.js +0 -2
  108. package/dist/components/inputs/formField/formField.js +0 -35
  109. package/dist/components/inputs/formField/passwordInput.js +0 -22
  110. package/dist/components/inputs/formField/textInput.js +0 -79
  111. package/dist/components/inputs/searcher/searcher.js +0 -112
  112. package/dist/components/inputs/selectField/selectField.js +0 -183
  113. package/dist/components/inputs/switchInput/index.js +0 -2
  114. package/dist/components/inputs/switchInput/switchInput.js +0 -77
  115. package/dist/components/loaders/index.js +0 -2
  116. package/dist/components/loaders/progressbar/progressbar.js +0 -37
  117. package/dist/components/loaders/spinner/spinner.js +0 -15
  118. package/dist/components/menuAction/index.js +0 -1
  119. package/dist/components/menuAction/menuAction.js +0 -67
  120. package/dist/components/menuAction/menuActionCustomStyles.js +0 -13
  121. package/dist/components/modals/index.js +0 -1
  122. package/dist/components/modals/warningModal/index.js +0 -1
  123. package/dist/components/modals/warningModal/warningModal.js +0 -41
  124. package/dist/components/patterns/actionBar/actionBar.js +0 -38
  125. package/dist/components/patterns/copyButton/copyButton.js +0 -69
  126. package/dist/components/patterns/copyButton/index.js +0 -1
  127. package/dist/components/patterns/emptyState/emptyState.js +0 -17
  128. package/dist/components/patterns/headerSection/headerSection.js +0 -17
  129. package/dist/components/patterns/headerSection/index.js +0 -1
  130. package/dist/components/patterns/iconWithIdentifier/iconWithIdentifier.js +0 -12
  131. package/dist/components/patterns/iconWithIdentifier/index.js +0 -1
  132. package/dist/components/patterns/linkWithIcon/index.js +0 -1
  133. package/dist/components/patterns/linkWithIcon/linkWithIcon.js +0 -26
  134. package/dist/components/tabs/index.js +0 -1
  135. package/dist/components/tabs/tabs.js +0 -70
  136. package/dist/components/tooltip/index.js +0 -2
  137. package/dist/components/tooltip/overflowChecker.js +0 -27
  138. package/dist/components/tooltip/tooltip.js +0 -97
  139. package/dist/hooks/useReduxFormField.js +0 -34
  140. package/dist/locales/description.js +0 -15
  141. package/dist/locales/es.js +0 -227
  142. package/dist/locales/index.js +0 -2
  143. package/dist/locales/translator.js +0 -20
  144. package/dist/styles/colors.js +0 -67
  145. package/dist/styles/styles/colors.tsx +0 -88
  146. package/dist/styles/styles/global.module.scss +0 -85
  147. package/dist/styles/styles/theme.tsx +0 -24
  148. package/dist/styles/styles/variables.module.scss +0 -74
  149. package/dist/styles/theme.js +0 -22
  150. package/dist/validators/errorMessage.js +0 -15
  151. package/dist/validators/index.js +0 -2
  152. package/dist/validators/validation.js +0 -25
@@ -1,35 +0,0 @@
1
- var __rest = this && this.__rest || function (s, e) {
2
- var t = {};
3
- for (var p in s) {
4
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
5
- }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
6
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
7
- }
8
- return t;
9
- };
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- import CheckboxInputGroup from './checkboxInputGroup';
12
- export var CheckboxInput = function CheckboxInput(_a) {
13
- var name = _a.name,
14
- checked = _a.checked,
15
- onChange = _a.onChange,
16
- label = _a.label,
17
- title = _a.title,
18
- _a$disabled = _a.disabled,
19
- disabled = _a$disabled === undefined ? false : _a$disabled,
20
- _a$size = _a.size,
21
- size = _a$size === undefined ? 'lg' : _a$size,
22
- input = _a.input,
23
- _a$type = _a.type,
24
- type = _a$type === undefined ? 'checkbox' : _a$type,
25
- props = __rest(_a, ["name", "checked", "onChange", "label", "title", "disabled", "size", "input", "type"]);
26
-
27
- var item = {
28
- id: name + "-single",
29
- label: label,
30
- checked: checked,
31
- disabled: disabled
32
- };
33
- return _jsx(CheckboxInputGroup, Object.assign({}, props, { name: name, items: [item], onChange: onChange, title: title, type: type, size: size, input: input }));
34
- };
35
- export default CheckboxInput;
@@ -1,58 +0,0 @@
1
- var __rest = this && this.__rest || function (s, e) {
2
- var t = {};
3
- for (var p in s) {
4
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
5
- }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
6
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
7
- }
8
- return t;
9
- };
10
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
11
- import styles from './checkboxInput.module.scss';
12
- import _ from 'lodash';
13
- import { useReduxFormField } from '../../../hooks/useReduxFormField';
14
- export var CheckboxInputGroup = function CheckboxInputGroup(_a) {
15
- var title = _a.title,
16
- name = _a.name,
17
- _a$type = _a.type,
18
- type = _a$type === undefined ? 'checkbox' : _a$type,
19
- items = _a.items,
20
- onChange = _a.onChange,
21
- _a$size = _a.size,
22
- size = _a$size === undefined ? 'lg' : _a$size,
23
- input = _a.input,
24
- props = __rest(_a, ["title", "name", "type", "items", "onChange", "size", "input"]);
25
-
26
- var _useReduxFormField = useReduxFormField({
27
- input: input,
28
- onChange: onChange,
29
- transformValue: function transformValue(event) {
30
- var _event$target = event.target,
31
- checked = _event$target.checked,
32
- inputName = _event$target.name;
33
-
34
- if (input) {
35
- var newValue = Object.assign({}, input.value);
36
- newValue[inputName] = checked;
37
- return newValue;
38
- }
39
- return event;
40
- }
41
- }),
42
- handleChange = _useReduxFormField.handleChange,
43
- handleBlur = _useReduxFormField.handleBlur;
44
-
45
- return _jsxs("div", { className: styles['checkbox-input-container'], children: [title && _jsxs("label", { className: styles['title'], children: [" ", title, " "] }), _jsx("div", { className: styles['checkbox-input-items'] + " " + styles[size], children: _.map(items, function (_a) {
46
- var id = _a.id,
47
- itemName = _a.name,
48
- label = _a.label,
49
- disabled = _a.disabled,
50
- checked = _a.checked,
51
- value = _a.value,
52
- itemProps = __rest(_a, ["id", "name", "label", "disabled", "checked", "value"]);
53
-
54
- var inputId = id || itemName || name;
55
- return _jsxs("label", { htmlFor: inputId, className: "" + (disabled ? styles['disabled'] : ''), children: [_jsx("input", Object.assign({}, props, itemProps, { id: inputId, type: type, name: itemName || name, checked: input && itemName ? _.get(input.value, itemName) : checked, disabled: disabled, onChange: handleChange, onBlur: handleBlur })), _jsxs("span", { children: [" ", label, " "] })] }, inputId);
56
- }) })] });
57
- };
58
- export default CheckboxInputGroup;
@@ -1,143 +0,0 @@
1
- import _slicedToArray from "babel-runtime/helpers/slicedToArray";
2
- var __rest = this && this.__rest || function (s, e) {
3
- var t = {};
4
- for (var p in s) {
5
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6
- }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
8
- }
9
- return t;
10
- };
11
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
- import { useState, useEffect } from 'react';
13
- import { DatePicker as MUIDatePicker } from '@mui/x-date-pickers/DatePicker';
14
- import { DateTimePicker as MUIDateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
15
- import { TimePicker as MUITimePicker } from '@mui/x-date-pickers/TimePicker';
16
- import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
17
- import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
18
- import { ErrorMessage, formValidation } from '../../../validators';
19
- import errorStyles from '../../../validators/errorMessage.module.scss';
20
- import { useReduxFormField } from '../../../hooks/useReduxFormField';
21
- import { FormField } from '../formField/formField';
22
- import { getPickerProps, getFinalFormat, getPickerTypeFromFormat } from './datePickerUtils';
23
- import styles from './datePicker.module.scss';
24
- import clsx from 'clsx';
25
- import dayjs from 'dayjs';
26
- import { includes } from 'lodash';
27
- import 'dayjs/locale/es';
28
- export var DatePickerInput = function DatePickerInput(props) {
29
- var _a;
30
-
31
- var meta = props.meta,
32
- name = props.name,
33
- _props$value = props.value,
34
- value = _props$value === undefined ? null : _props$value,
35
- _props$disabled = props.disabled,
36
- disabled = _props$disabled === undefined ? false : _props$disabled,
37
- _props$required = props.required,
38
- required = _props$required === undefined ? false : _props$required,
39
- placeholder = props.placeholder,
40
- _props$size = props.size,
41
- size = _props$size === undefined ? 'md' : _props$size,
42
- _props$noErrors = props.noErrors,
43
- noErrors = _props$noErrors === undefined ? false : _props$noErrors,
44
- label = props.label,
45
- minDate = props.minDate,
46
- maxDate = props.maxDate,
47
- format = props.format,
48
- isValid = props.isValid,
49
- onChange = props.onChange,
50
- input = props.input,
51
- otherProps = __rest(props, ["meta", "name", "value", "disabled", "required", "placeholder", "size", "noErrors", "label", "minDate", "maxDate", "format", "isValid", "onChange", "input"]);
52
-
53
- var finalFormat = getFinalFormat(format);
54
- var pickerType = getPickerTypeFromFormat(format);
55
- var inputValue = (_a = input === null || input === void 0 ? void 0 : input.value) !== null && _a !== void 0 ? _a : value;
56
-
57
- var _useState = useState(inputValue),
58
- _useState2 = _slicedToArray(_useState, 2),
59
- currentValue = _useState2[0],
60
- setCurrentValue = _useState2[1];
61
-
62
- var _useState3 = useState(false),
63
- _useState4 = _slicedToArray(_useState3, 2),
64
- isOpen = _useState4[0],
65
- setIsOpen = _useState4[1];
66
-
67
- var validationProps = { meta: meta, value: inputValue, isValid: isValid, required: props.required };
68
- var validated = formValidation(validationProps);
69
- useEffect(function () {
70
- setCurrentValue(inputValue);
71
- }, [inputValue]);
72
-
73
- var _useReduxFormField = useReduxFormField({
74
- input: input,
75
- onChange: onChange ? function (date) {
76
- var syntheticEvent = {
77
- target: {
78
- value: date ? date.format(finalFormat) : '',
79
- name: name
80
- }
81
- };
82
- onChange(syntheticEvent);
83
- } : undefined,
84
- transformValue: function transformValue(date) {
85
- setCurrentValue(date);
86
- return date ? date.toDate() : null;
87
- }
88
- }),
89
- fieldHandleChange = _useReduxFormField.handleChange;
90
-
91
- var _handleChange = function _handleChange(date) {
92
- setCurrentValue(date ? date.format(finalFormat) : null);
93
- fieldHandleChange(date);
94
- };
95
- var _handleClear = function _handleClear() {
96
- setCurrentValue(null);
97
- fieldHandleChange(null);
98
- setIsOpen(false);
99
- };
100
- var _handleOpen = function _handleOpen() {
101
- setIsOpen(!isOpen);
102
- };
103
- var _handleClose = function _handleClose() {
104
- setIsOpen(false);
105
- };
106
- dayjs.locale('es');
107
- var Picker = function Picker() {
108
- var commonProps = getPickerProps({
109
- currentValue: currentValue,
110
- finalFormat: finalFormat,
111
- disabled: disabled,
112
- minDate: minDate,
113
- maxDate: maxDate,
114
- placeholder: placeholder,
115
- name: name,
116
- onChange: _handleChange,
117
- onClear: _handleClear,
118
- onOpen: _handleOpen,
119
- onClose: _handleClose,
120
- open: isOpen,
121
- otherProps: otherProps
122
- });
123
- switch (pickerType) {
124
- case 'year':
125
- return _jsx(MUIDatePicker, Object.assign({}, commonProps, { views: ['year'] }));
126
- case 'time':
127
- return _jsx(MUITimePicker, Object.assign({}, commonProps, { views: includes(finalFormat, 's') ? ['hours', 'minutes', 'seconds'] : ['hours', 'minutes'] }));
128
- case 'dateTime':
129
- return _jsx(MUIDateTimePicker, Object.assign({}, commonProps));
130
- case 'date':
131
- default:
132
- return _jsx(MUIDatePicker, Object.assign({}, commonProps));
133
- }
134
- };
135
- return _jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: "es", children: _jsxs("div", { className: clsx(styles[size], validated ? errorStyles[validated] : '', styles['date-picker']), children: [_jsx(Picker, {}), !noErrors && _jsx(ErrorMessage, { validationProps: validationProps })] }) });
136
- };
137
- export var DatePicker = function DatePicker(_a) {
138
- var label = _a.label,
139
- rightAdornment = _a.rightAdornment,
140
- props = __rest(_a, ["label", "rightAdornment"]);
141
-
142
- return _jsx(FormField, Object.assign({ type: "date", label: label, rightAdornment: rightAdornment }, props));
143
- };
@@ -1,145 +0,0 @@
1
- export var datePickerLayoutStyles = {
2
- '& .MuiDayCalendar-slideTransition': {
3
- minHeight: '200px'
4
- },
5
- '& .MuiDialogActions-root': {
6
- display: 'none'
7
- },
8
- '& .MuiPickersLayout-actionBar': {
9
- display: 'none'
10
- },
11
- '& .MuiDateCalendar-root': {
12
- height: 'min-content !important'
13
- },
14
- '& .MuiPickersCalendarHeader-label': {
15
- fontFamily: "Poppins, Open Sans, Helvetica, Arial, sans-serif",
16
- fontSize: '14px',
17
- color: '#797979',
18
- fontWeight: 600,
19
- textTransform: 'capitalize'
20
- },
21
- '& .MuiDayCalendar-weekDayLabel': {
22
- fontFamily: "Poppins, Open Sans, Helvetica, Arial, sans-serif",
23
- fontSize: '12px',
24
- color: '#797979',
25
- fontWeight: 600
26
- }
27
- };
28
- export var datePickerInputStyles = {
29
- '& .MuiOutlinedInput-root': {
30
- '&:hover': {
31
- '& .MuiOutlinedInput-notchedOutline': {
32
- borderColor: '#ACACAC'
33
- }
34
- },
35
- '&.Mui-focused': {
36
- '& .MuiOutlinedInput-notchedOutline': {
37
- borderColor: '#252525'
38
- }
39
- },
40
- '&.Mui-disabled': {
41
- '& .MuiOutlinedInput-notchedOutline': {
42
- borderColor: '#D7D7D7'
43
- }
44
- }
45
- }
46
- };
47
- export var datePickerDayStyles = {
48
- fontFamily: "Poppins, Open Sans, Helvetica, Arial, sans-serif",
49
- fontSize: '12px',
50
- backgroundColor: 'white',
51
- color: '#252525',
52
- borderRadius: '4px',
53
- '&.MuiPickersDay-root': {
54
- fontSize: '14px',
55
- textTransform: 'capitalize'
56
- },
57
- '&.MuiPickersDay-today': {
58
- backgroundColor: 'white',
59
- color: '#252525',
60
- border: '1px solid #252525'
61
- },
62
- '&.Mui-selected': {
63
- backgroundColor: '#0066ff',
64
- color: 'white',
65
- border: 'none',
66
- '&:hover': {
67
- backgroundColor: '#0066ff',
68
- borderColor: 'none'
69
- },
70
- '&:focus': {
71
- backgroundColor: '#0066ff',
72
- borderColor: 'none'
73
- }
74
- },
75
- '&:hover:not(.Mui-selected)': {
76
- color: '#252525',
77
- backgroundColor: '#EDEDED',
78
- borderColor: 'none'
79
- }
80
- };
81
- export var datePickerDigitalClockStyles = {
82
- '& .MuiMultiSectionDigitalClock-root': {
83
- '& .MuiList-root.MuiList-padding.MuiMultiSectionDigitalClockSection-root': {
84
- '&::after': {
85
- display: 'none'
86
- }
87
- },
88
- '& .MuiButtonBase-root.MuiMenuItem-root.MuiMenuItem-gutters': {
89
- fontFamily: "Poppins, Open Sans, Helvetica, Arial, sans-serif",
90
- backgroundColor: 'white',
91
- color: '#252525',
92
- borderRadius: '4px',
93
- width: '32px',
94
- height: '32px',
95
- margin: '4px 0 0 4px',
96
- fontSize: ' 14px',
97
- '&.Mui-selected': {
98
- backgroundColor: '#0066ff',
99
- color: 'white',
100
- '&:hover': {
101
- backgroundColor: '#0066ff'
102
- },
103
- '&:focus': {
104
- backgroundColor: '#0066ff'
105
- }
106
- },
107
- '&:hover:not(.Mui-selected)': {
108
- color: '#252525',
109
- backgroundColor: '#EDEDED'
110
- }
111
- }
112
- }
113
- };
114
- export var datePickerYearStyles = {
115
- '& .MuiYearCalendar-root': {
116
- '& .MuiPickersYear-root': {
117
- '& .MuiPickersYear-yearButton': {
118
- fontFamily: "Poppins, Open Sans, Helvetica, Arial, sans-serif",
119
- fontSize: '14px',
120
- backgroundColor: 'white',
121
- color: '#252525',
122
- borderRadius: '4px',
123
- '&.Mui-selected': {
124
- backgroundColor: '#0066ff',
125
- color: 'white',
126
- '&:hover': {
127
- backgroundColor: '#0066ff'
128
- },
129
- '&:focus': {
130
- backgroundColor: '#0066ff'
131
- }
132
- },
133
- '&:hover:not(.Mui-selected)': {
134
- backgroundColor: '#EDEDED',
135
- color: '#252525'
136
- }
137
- }
138
- }
139
- }
140
- };
141
- export var datePickerPopperStyles = {
142
- '& .MuiPickersPopper-paper': {
143
- boxShadow: '0px 5px 5px -3px rgb(205 205 205 / 20%), 0px 8px 14px 1px rgb(165 165 165 / 14%), 0px 3px 14px 2px rgb(219 219 219 / 6%)'
144
- }
145
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,109 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { TextField } from '@mui/material';
3
- import CalendarTodayIcon from '@mui/icons-material/CalendarToday';
4
- import CloseRoundedIcon from '@mui/icons-material/CloseRounded';
5
- import dayjs from 'dayjs';
6
- import customParseFormat from 'dayjs/plugin/customParseFormat';
7
- import CustomIcon from '../../icons/customIcon/customIcon';
8
- import styles from './datePicker.module.scss';
9
- import { datePickerLayoutStyles, datePickerDayStyles, datePickerDigitalClockStyles, datePickerYearStyles, datePickerInputStyles, datePickerPopperStyles } from './datePickerCustomStyles';
10
- import { omit, includes } from "lodash";
11
- import locale from '../../../locales';
12
- dayjs.extend(customParseFormat);
13
- export var ActionComponent = function ActionComponent(_ref) {
14
- var showClearIcon = _ref.showClearIcon,
15
- onClear = _ref.onClear,
16
- onOpen = _ref.onOpen;
17
- return _jsxs("div", { className: styles['calendar-icon-container'], children: [showClearIcon && _jsx("div", { onClick: onClear, className: styles['clear-icon'], children: _jsx(CustomIcon, { children: _jsx(CloseRoundedIcon, {}) }) }), _jsx("div", { className: styles['divider-line'] }), _jsx("div", { onClick: onOpen, className: styles['calendar-icon'], children: _jsx(CustomIcon, { size: "12", children: _jsx(CalendarTodayIcon, {}) }) })] });
18
- };
19
- export var getPickerTypeFromFormat = function getPickerTypeFromFormat(format) {
20
- if (!format) {
21
- return 'date';
22
- }
23
- if (/^Y+$/.test(format)) {
24
- return 'year';
25
- }
26
- if (/^[Hhms:]+$/.test(format)) {
27
- return 'time';
28
- }
29
- if (includes(format, 'H') || includes(format, 'h') || includes(format, 'm') || includes(format, 's')) {
30
- return 'dateTime';
31
- }
32
- return 'date';
33
- };
34
- export var getFinalFormat = function getFinalFormat(format) {
35
- if (format) return format;
36
- return 'DD/MM/YYYY';
37
- };
38
- export var getPlaceholderByFormat = function getPlaceholderByFormat(format, customPlaceholder) {
39
- if (customPlaceholder) return customPlaceholder;
40
- var pickerType = getPickerTypeFromFormat(format);
41
- switch (pickerType) {
42
- case 'year':
43
- return locale("datePicker.selectYear");
44
- case 'time':
45
- return locale("datePicker.selectTime");
46
- case 'dateTime':
47
- return locale("datePicker.selectDateTime");
48
- case 'date':
49
- default:
50
- return locale("datePicker.selectDate");
51
- }
52
- };
53
- export var convertToDate = function convertToDate(val, format) {
54
- if (!val) return null;
55
- if (typeof val === 'string') {
56
- var parsed = dayjs(val, format, true);
57
- return parsed.isValid() ? parsed : null;
58
- }
59
- if (val instanceof Date) {
60
- return dayjs(val);
61
- }
62
- if (typeof val === 'number') {
63
- return dayjs(val);
64
- }
65
- return null;
66
- };
67
- export var getPickerProps = function getPickerProps(_ref2) {
68
- var currentValue = _ref2.currentValue,
69
- finalFormat = _ref2.finalFormat,
70
- onChange = _ref2.onChange,
71
- disabled = _ref2.disabled,
72
- minDate = _ref2.minDate,
73
- maxDate = _ref2.maxDate,
74
- placeholder = _ref2.placeholder,
75
- name = _ref2.name,
76
- otherProps = _ref2.otherProps,
77
- onClear = _ref2.onClear,
78
- onOpen = _ref2.onOpen,
79
- onClose = _ref2.onClose,
80
- open = _ref2.open;
81
- return {
82
- open: open,
83
- value: convertToDate(currentValue, finalFormat),
84
- onAccept: onChange,
85
- onClose: onClose,
86
- disabled: disabled,
87
- minDate: minDate ? dayjs(minDate) : undefined,
88
- maxDate: maxDate ? dayjs(maxDate) : undefined,
89
- format: finalFormat,
90
- slots: {
91
- textField: TextField
92
- },
93
- slotProps: {
94
- textField: Object.assign({ placeholder: getPlaceholderByFormat(finalFormat, placeholder), name: name, onClick: onOpen, variant: 'outlined', fullWidth: true, className: styles['date-input'], sx: datePickerInputStyles, InputProps: {
95
- style: { cursor: 'pointer' },
96
- endAdornment: _jsx(ActionComponent, { showClearIcon: !!currentValue, onClear: onClear, onOpen: onOpen })
97
- } }, omit(otherProps, "type")),
98
- layout: {
99
- sx: Object.assign(Object.assign(Object.assign({}, datePickerLayoutStyles), datePickerDigitalClockStyles), datePickerYearStyles)
100
- },
101
- day: {
102
- sx: datePickerDayStyles
103
- },
104
- popper: {
105
- sx: datePickerPopperStyles
106
- }
107
- }
108
- };
109
- };
@@ -1,2 +0,0 @@
1
- export * from './datePicker';
2
- export * from './datePickerCustomStyles';
@@ -1,28 +0,0 @@
1
- import _ from "lodash";
2
- export var formatDate = function formatDate(date, format) {
3
- var _pad = function _pad(n) {
4
- return _.padStart(String(n), 2, "0");
5
- };
6
- var map = {
7
- YYYY: String(date.getFullYear()),
8
- MM: _pad(date.getMonth() + 1),
9
- DD: _pad(date.getDate()),
10
- HH: _pad(date.getHours()),
11
- mm: _pad(date.getMinutes()),
12
- ss: _pad(date.getSeconds())
13
- };
14
- return _.reduce(map, function (acc, value, token) {
15
- return _.replace(acc, token, value);
16
- }, format);
17
- };
18
- export var formatRangeLimits = function formatRangeLimits(range) {
19
- if (!range) return undefined;
20
- var from = new Date(range.from);
21
- from.setHours(0, 0, 0);
22
- var to = new Date(range.to);
23
- to.setHours(23, 59, 59);
24
- return {
25
- from: from,
26
- to: to
27
- };
28
- };
@@ -1,118 +0,0 @@
1
- import _slicedToArray from "babel-runtime/helpers/slicedToArray";
2
- var __rest = this && this.__rest || function (s, e) {
3
- var t = {};
4
- for (var p in s) {
5
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6
- }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
8
- }
9
- return t;
10
- };
11
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
- import { useState } from 'react';
13
- import { DayPicker } from 'react-day-picker';
14
- import * as Popover from '@radix-ui/react-popover';
15
- import { es } from "react-day-picker/locale";
16
- import { ErrorMessage, formValidation } from '../../../validators';
17
- import { useReduxFormField } from '../../../hooks/useReduxFormField';
18
- import styles from './dateRangePicker.module.scss';
19
- import errorStyles from '../../../validators/errorMessage.module.scss';
20
- import { FormField } from "../formField/formField";
21
- import clsx from 'clsx';
22
- import 'react-day-picker/dist/style.css';
23
- import { CustomWeekday, fromInputValue, getDisplayRange, getDisabledDays } from './dateRangePickerUtils';
24
- import { ActionComponent } from '../datePicker/datePickerUtils';
25
- import { formatRangeLimits } from "./dateFormater";
26
- export var DateRangePickerInput = function DateRangePickerInput(props) {
27
- var _a;
28
-
29
- var meta = props.meta,
30
- name = props.name,
31
- _props$value = props.value,
32
- value = _props$value === undefined ? null : _props$value,
33
- _props$disabled = props.disabled,
34
- disabled = _props$disabled === undefined ? false : _props$disabled,
35
- _props$required = props.required,
36
- required = _props$required === undefined ? false : _props$required,
37
- placeholder = props.placeholder,
38
- _props$size = props.size,
39
- size = _props$size === undefined ? 'md' : _props$size,
40
- _props$noErrors = props.noErrors,
41
- noErrors = _props$noErrors === undefined ? false : _props$noErrors,
42
- label = props.label,
43
- _props$format = props.format,
44
- format = _props$format === undefined ? 'DD/MM/YYYY' : _props$format,
45
- isValid = props.isValid,
46
- onChange = props.onChange,
47
- input = props.input,
48
- minDate = props.minDate,
49
- maxDate = props.maxDate,
50
- otherProps = __rest(props, ["meta", "name", "value", "disabled", "required", "placeholder", "size", "noErrors", "label", "format", "isValid", "onChange", "input", "minDate", "maxDate"]);
51
-
52
- var currentValue = (_a = input === null || input === void 0 ? void 0 : input.value) !== null && _a !== void 0 ? _a : value;
53
- var validationProps = { meta: meta, value: currentValue, isValid: isValid, required: props.required };
54
- var validated = formValidation(validationProps);
55
-
56
- var _useReduxFormField = useReduxFormField({
57
- input: input,
58
- onChange: onChange ? function (range) {
59
- var syntheticEvent = {
60
- target: {
61
- value: formatRangeLimits(range),
62
- name: name
63
- }
64
- };
65
- onChange(syntheticEvent);
66
- } : undefined
67
- }),
68
- fieldHandleChange = _useReduxFormField.handleChange,
69
- handleBlur = _useReduxFormField.handleBlur;
70
-
71
- var handleSelect = function handleSelect(range) {
72
- fieldHandleChange(range);
73
- if ((range === null || range === void 0 ? void 0 : range.from) && (range === null || range === void 0 ? void 0 : range.to) && (range === null || range === void 0 ? void 0 : range.from) !== (range === null || range === void 0 ? void 0 : range.to)) {
74
- setIsOpen(false);
75
- }
76
- };
77
- var handleClear = function handleClear() {
78
- fieldHandleChange(undefined);
79
- };
80
- var selectedRange = fromInputValue(currentValue);
81
- var displayValue = getDisplayRange(selectedRange, format);
82
-
83
- var _useState = useState(false),
84
- _useState2 = _slicedToArray(_useState, 2),
85
- isOpen = _useState2[0],
86
- setIsOpen = _useState2[1];
87
-
88
- var getInitialMonth = function getInitialMonth() {
89
- return (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.from) || (selectedRange === null || selectedRange === void 0 ? void 0 : selectedRange.to) || new Date();
90
- };
91
- return _jsxs("div", { className: clsx(styles['date-range-picker'], styles[size], validated ? errorStyles[validated] : '', disabled ? styles['disabled'] : '', isOpen ? styles['focused'] : ''), children: [_jsxs(Popover.Root, { open: isOpen && !disabled, onOpenChange: setIsOpen, children: [_jsx(Popover.Trigger, { asChild: true, children: _jsxs("div", { className: styles['input-wrapper'], children: [_jsx("input", Object.assign({ type: "text", name: name, value: displayValue, placeholder: placeholder || format, readOnly: true, onBlur: handleBlur }, otherProps)), _jsx(ActionComponent, { onOpen: function onOpen() {
92
- return setIsOpen(!isOpen);
93
- }, showClearIcon: !!displayValue, onClear: handleClear })] }) }), _jsx(Popover.Portal, { children: _jsx(Popover.Content, { className: styles['popover-content'], sideOffset: 4, align: "start", side: "bottom", avoidCollisions: true, collisionPadding: 8, children: _jsx(DayPicker, { mode: "range", locale: es, selected: selectedRange, onSelect: handleSelect, numberOfMonths: 2, defaultMonth: getInitialMonth(), disabled: getDisabledDays(disabled, minDate, maxDate), className: styles['day-picker'], animate: true, classNames: {
94
- months: styles['months'],
95
- month: styles['month'],
96
- month_caption: styles['month-caption'],
97
- nav: styles['nav'],
98
- weekdays: styles['weekdays'],
99
- weekday: styles['weekday'],
100
- week: styles['week'],
101
- day: styles['day'],
102
- selected: styles['selected'],
103
- range_start: styles['range-start'],
104
- range_middle: styles['range-middle'],
105
- range_end: styles['range-end'],
106
- disabled: styles['disabled']
107
- }, components: {
108
- Weekday: CustomWeekday
109
- } }) }) })] }), !noErrors && _jsx(ErrorMessage, { validationProps: validationProps })] });
110
- };
111
- export var DateRangePicker = function DateRangePicker(_a) {
112
- var label = _a.label,
113
- rightAdornment = _a.rightAdornment,
114
- value = _a.value,
115
- props = __rest(_a, ["label", "rightAdornment", "value"]);
116
-
117
- return _jsx(FormField, Object.assign({ type: "dateRange", label: label, rightAdornment: rightAdornment, value: value }, props));
118
- };