@pedidopago/ui 1.3.1 → 1.3.2
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.
- package/dist/components/Alert/alert.test.js +8 -8
- package/dist/components/Alert/index.d.ts +2 -2
- package/dist/components/Alert/index.d.ts.map +1 -1
- package/dist/components/Alert/index.js +7 -26
- package/dist/components/Alert/styles.d.ts +0 -12
- package/dist/components/Alert/styles.d.ts.map +1 -1
- package/dist/components/Alert/styles.js +4 -22
- package/dist/components/Alert/types.d.ts +5 -22
- package/dist/components/Alert/types.d.ts.map +1 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +11 -2
- package/dist/components/Button/styles.js +1 -1
- package/dist/components/Button/types.d.ts +1 -0
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/DateInput/DateInput-example.d.ts +2 -2
- package/dist/components/DateInput/DateInput-example.d.ts.map +1 -1
- package/dist/components/DateInput/DateInput-example.js +10 -15
- package/dist/components/DateInput/dateInput.test.js +4 -4
- package/dist/components/DateInput/index.d.ts +2 -2
- package/dist/components/DateInput/index.d.ts.map +1 -1
- package/dist/components/DateInput/index.js +65 -136
- package/dist/components/DateInput/styles.d.ts +7 -29
- package/dist/components/DateInput/styles.d.ts.map +1 -1
- package/dist/components/DateInput/styles.js +15 -19
- package/dist/components/DateInput/types.d.ts +7 -14
- package/dist/components/DateInput/types.d.ts.map +1 -1
- package/dist/components/DatePicker/datepicker.test.js +8 -8
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +4 -8
- package/dist/components/DatePicker/types.d.ts +3 -4
- package/dist/components/DatePicker/types.d.ts.map +1 -1
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +4 -5
- package/dist/components/Input/styles.d.ts +1 -0
- package/dist/components/Input/styles.d.ts.map +1 -1
- package/dist/components/Input/styles.js +34 -33
- package/dist/components/Label/index.d.ts +2 -2
- package/dist/components/Label/index.d.ts.map +1 -1
- package/dist/components/Label/index.js +12 -23
- package/dist/components/Label/label.test.d.ts +2 -0
- package/dist/components/Label/label.test.d.ts.map +1 -0
- package/dist/components/Label/label.test.js +105 -0
- package/dist/components/Label/styles.js +1 -1
- package/dist/components/Label/types.d.ts +5 -6
- package/dist/components/Label/types.d.ts.map +1 -1
- package/dist/components/Modal/styles.d.ts.map +1 -1
- package/dist/components/Modal/styles.js +3 -3
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +21 -15
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js +13 -3
- package/dist/components/Table/styles.d.ts.map +1 -1
- package/dist/components/Table/styles.js +5 -8
- package/dist/components/Toast/components/Toast.d.ts.map +1 -1
- package/dist/components/Toast/components/Toast.js +6 -7
- package/dist/components/Toast/contexts/ToastProvider.d.ts.map +1 -1
- package/dist/components/Toast/contexts/ToastProvider.js +3 -1
- package/dist/components/Toast/toast.test.js +10 -10
- package/dist/components/Toast/types.d.ts +8 -15
- package/dist/components/Toast/types.d.ts.map +1 -1
- package/dist/components/Tooltip/components/TooltipLabel.d.ts +4 -0
- package/dist/components/Tooltip/components/TooltipLabel.d.ts.map +1 -0
- package/dist/components/Tooltip/components/TooltipLabel.js +59 -0
- package/dist/components/Tooltip/index.d.ts +2 -2
- package/dist/components/Tooltip/index.d.ts.map +1 -1
- package/dist/components/Tooltip/index.js +91 -74
- package/dist/components/Tooltip/styles.d.ts +6 -14
- package/dist/components/Tooltip/styles.d.ts.map +1 -1
- package/dist/components/Tooltip/styles.js +9 -31
- package/dist/components/Tooltip/types.d.ts +17 -19
- package/dist/components/Tooltip/types.d.ts.map +1 -1
- package/dist/components/Typography/styles.d.ts +2 -2
- package/package.json +1 -1
|
@@ -3,27 +3,23 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.DateInput =
|
|
6
|
+
exports.DateInput = DateInput;
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
var _useOnClickOutside = require("../../shared/hooks/useOnClickOutside");
|
|
8
|
+
var _styles = require("./styles");
|
|
11
9
|
|
|
12
|
-
var
|
|
10
|
+
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
13
11
|
|
|
14
|
-
var
|
|
12
|
+
var _Input = _interopRequireDefault(require("../Input"));
|
|
15
13
|
|
|
16
14
|
var _DatePicker = _interopRequireDefault(require("../DatePicker"));
|
|
17
15
|
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
var _SelectButton = require("./components/SelectButton");
|
|
16
|
+
var _react = require("react");
|
|
21
17
|
|
|
22
|
-
var
|
|
18
|
+
var _useOnClickOutside = require("../../shared/hooks/useOnClickOutside");
|
|
23
19
|
|
|
24
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
21
|
|
|
26
|
-
var _excluded = ["label", "
|
|
22
|
+
var _excluded = ["label", "placeholder", "alert", "helperText", "value", "locales", "localeOptions", "onChange"];
|
|
27
23
|
|
|
28
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
25
|
|
|
@@ -49,141 +45,74 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
49
45
|
|
|
50
46
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
valueDateProp = _ref.valueDate,
|
|
48
|
+
// TODO: Mudar a posição do datepicker dependendo da posição dele aberto.
|
|
49
|
+
function DateInput(_ref) {
|
|
50
|
+
var label = _ref.label,
|
|
51
|
+
placeholder = _ref.placeholder,
|
|
52
|
+
alert = _ref.alert,
|
|
53
|
+
helperText = _ref.helperText,
|
|
54
|
+
value = _ref.value,
|
|
55
|
+
locales = _ref.locales,
|
|
56
|
+
localeOptions = _ref.localeOptions,
|
|
57
|
+
onChange = _ref.onChange,
|
|
63
58
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
64
59
|
|
|
65
|
-
var _useState = (0, _react.useState)(
|
|
60
|
+
var _useState = (0, _react.useState)(),
|
|
66
61
|
_useState2 = _slicedToArray(_useState, 2),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var removeYearFromDate = (0, _react.useCallback)(function (date) {
|
|
79
|
-
var dateArray = date.split('/');
|
|
80
|
-
return "".concat(dateArray[0], "/").concat(dateArray[1]);
|
|
81
|
-
}, []);
|
|
82
|
-
var placeholder = type === 'range' ? 'DD/MM - DD/MM' : 'DD/MM/AAAA';
|
|
83
|
-
var hasRangePeriodSelected = Array.isArray(selectedPeriod);
|
|
84
|
-
var formattedDate = (0, _react.useCallback)(function () {
|
|
85
|
-
if (type === 'range') {
|
|
86
|
-
if (Array.isArray(selectedPeriod)) {
|
|
87
|
-
var startDate = removeYearFromDate(selectedPeriod[0]);
|
|
88
|
-
var endDate = removeYearFromDate(selectedPeriod[1]);
|
|
89
|
-
var rangeDate = [startDate, endDate];
|
|
90
|
-
return rangeDate.join(' - ');
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return selectedPeriod || valueDateProp && valueDateProp[0];
|
|
95
|
-
}, [type, selectedPeriod]);
|
|
96
|
-
var datePickerContainerAnimationVariant = {
|
|
97
|
-
fadeIn: {
|
|
98
|
-
opacity: 1,
|
|
99
|
-
y: 0
|
|
100
|
-
},
|
|
101
|
-
fadeOut: {
|
|
102
|
-
opacity: 0,
|
|
103
|
-
y: -20
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
(0, _useOnClickOutside.useOnClickOutside)(datePickerRef, function () {
|
|
107
|
-
setIsDatePickerOpen(false);
|
|
62
|
+
currentValue = _useState2[0],
|
|
63
|
+
setCurrentValue = _useState2[1];
|
|
64
|
+
|
|
65
|
+
var _useState3 = (0, _react.useState)(false),
|
|
66
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
67
|
+
datePickerOpen = _useState4[0],
|
|
68
|
+
setDatePickerOpen = _useState4[1];
|
|
69
|
+
|
|
70
|
+
var containerRef = (0, _react.useRef)(null);
|
|
71
|
+
(0, _useOnClickOutside.useOnClickOutside)(containerRef, function () {
|
|
72
|
+
setDatePickerOpen(false);
|
|
108
73
|
});
|
|
109
74
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
var textColor = (0, _getColorValue.getColorValue)(colorMode === 'dark' ? 'neutral.neutral2' : 'neutral.neutral5', theme);
|
|
117
|
-
|
|
118
|
-
var valueDate = function valueDate() {
|
|
119
|
-
if (selectedPeriod) {
|
|
120
|
-
switch (type) {
|
|
121
|
-
case 'date':
|
|
122
|
-
{
|
|
123
|
-
var _selectedPeriod$toStr = selectedPeriod.toString().split('/'),
|
|
124
|
-
_selectedPeriod$toStr2 = _slicedToArray(_selectedPeriod$toStr, 3),
|
|
125
|
-
day = _selectedPeriod$toStr2[0],
|
|
126
|
-
month = _selectedPeriod$toStr2[1],
|
|
127
|
-
year = _selectedPeriod$toStr2[2];
|
|
128
|
-
|
|
129
|
-
return [new Date("".concat(month, "/").concat(day, "/").concat(year))];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
case 'range':
|
|
133
|
-
{
|
|
134
|
-
if (hasRangePeriodSelected) {
|
|
135
|
-
var _selectedPeriod$0$toS = selectedPeriod[0].toString().split('/'),
|
|
136
|
-
_selectedPeriod$0$toS2 = _slicedToArray(_selectedPeriod$0$toS, 3),
|
|
137
|
-
startDay = _selectedPeriod$0$toS2[0],
|
|
138
|
-
startMonth = _selectedPeriod$0$toS2[1],
|
|
139
|
-
startYear = _selectedPeriod$0$toS2[2];
|
|
140
|
-
|
|
141
|
-
var _selectedPeriod$1$toS = selectedPeriod[1].toString().split('/'),
|
|
142
|
-
_selectedPeriod$1$toS2 = _slicedToArray(_selectedPeriod$1$toS, 3),
|
|
143
|
-
endDay = _selectedPeriod$1$toS2[0],
|
|
144
|
-
endMonth = _selectedPeriod$1$toS2[1],
|
|
145
|
-
endYear = _selectedPeriod$1$toS2[2];
|
|
146
|
-
|
|
147
|
-
var startDate = "".concat(startMonth, "/").concat(startDay, "/").concat(startYear);
|
|
148
|
-
var endDate = "".concat(endMonth, "/").concat(endDay, "/").concat(endYear);
|
|
149
|
-
return [startDate, endDate];
|
|
150
|
-
} else {
|
|
151
|
-
return [new Date(), new Date()];
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
};
|
|
75
|
+
function selectDate(value) {
|
|
76
|
+
setCurrentValue(value);
|
|
77
|
+
setDatePickerOpen(false);
|
|
78
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
79
|
+
}
|
|
157
80
|
|
|
81
|
+
(0, _react.useEffect)(function () {
|
|
82
|
+
setCurrentValue(value);
|
|
83
|
+
}, [value]);
|
|
158
84
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.DateInputContainer, {
|
|
159
|
-
|
|
160
|
-
children: [
|
|
161
|
-
|
|
162
|
-
|
|
85
|
+
ref: containerRef,
|
|
86
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Input.default, {
|
|
87
|
+
label: label,
|
|
88
|
+
placeholder: placeholder,
|
|
89
|
+
helperText: helperText,
|
|
90
|
+
alert: alert,
|
|
91
|
+
withIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
92
|
+
name: "calendar"
|
|
93
|
+
}),
|
|
94
|
+
value: currentValue ? Array.isArray(currentValue) ? "".concat(currentValue[0].toLocaleDateString(locales, localeOptions), " - ").concat(currentValue[1].toLocaleDateString(locales, localeOptions)) : currentValue.toLocaleDateString(locales) : '',
|
|
163
95
|
onClick: function onClick() {
|
|
164
|
-
return
|
|
96
|
+
return setDatePickerOpen(!datePickerOpen);
|
|
97
|
+
}
|
|
98
|
+
}), datePickerOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.DatePickerContainer, {
|
|
99
|
+
position: 'bottom',
|
|
100
|
+
variants: {
|
|
101
|
+
fadeIn: {
|
|
102
|
+
opacity: 1,
|
|
103
|
+
y: 0
|
|
104
|
+
},
|
|
105
|
+
fadeOut: {
|
|
106
|
+
opacity: 0,
|
|
107
|
+
y: -20
|
|
108
|
+
}
|
|
165
109
|
},
|
|
166
|
-
label: label,
|
|
167
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.CalendarText, {
|
|
168
|
-
textColor: textColor,
|
|
169
|
-
children: formattedDate() || placeholder
|
|
170
|
-
})
|
|
171
|
-
}), isDatePickerOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.DatePickerContainer, {
|
|
172
|
-
position: position,
|
|
173
|
-
variants: datePickerContainerAnimationVariant,
|
|
174
110
|
initial: "fadeOut",
|
|
175
111
|
animate: "fadeIn",
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
return handleValueDate(value);
|
|
181
|
-
},
|
|
182
|
-
type: type
|
|
183
|
-
}))
|
|
112
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePicker.default, _objectSpread({
|
|
113
|
+
value: currentValue,
|
|
114
|
+
onChange: selectDate
|
|
115
|
+
}, rest))
|
|
184
116
|
})]
|
|
185
117
|
});
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
var DateInput = /*#__PURE__*/(0, _react.memo)(DateInputLayout);
|
|
189
|
-
exports.DateInput = DateInput;
|
|
118
|
+
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { StylePropsPositionPicker } from './types';
|
|
3
|
+
export declare const DateInputContainer: import("@emotion/styled").StyledComponent<{
|
|
4
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
5
|
+
as?: import("react").ElementType<any> | undefined;
|
|
6
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
3
7
|
export declare const DatePickerContainer: import("@emotion/styled").StyledComponent<{
|
|
4
8
|
slot?: string | undefined;
|
|
5
9
|
title?: string | undefined;
|
|
6
10
|
color?: string | undefined;
|
|
7
11
|
translate?: "no" | "yes" | undefined;
|
|
12
|
+
id?: string | undefined;
|
|
8
13
|
hidden?: boolean | undefined;
|
|
9
14
|
className?: string | undefined;
|
|
10
|
-
id?: string | undefined;
|
|
11
15
|
lang?: string | undefined;
|
|
12
16
|
role?: import("react").AriaRole | undefined;
|
|
13
17
|
tabIndex?: number | undefined;
|
|
14
18
|
"aria-activedescendant"?: string | undefined;
|
|
15
19
|
"aria-atomic"?: (boolean | "false" | "true") | undefined;
|
|
16
|
-
"aria-autocomplete"?: "none" | "
|
|
20
|
+
"aria-autocomplete"?: "none" | "list" | "inline" | "both" | undefined;
|
|
17
21
|
"aria-busy"?: (boolean | "false" | "true") | undefined;
|
|
18
22
|
"aria-checked"?: boolean | "mixed" | "false" | "true" | undefined;
|
|
19
23
|
"aria-colcount"?: number | undefined;
|
|
@@ -255,30 +259,4 @@ export declare const DatePickerContainer: import("@emotion/styled").StyledCompon
|
|
|
255
259
|
} & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLDivElement> & {
|
|
256
260
|
theme?: import("@emotion/react").Theme | undefined;
|
|
257
261
|
} & StylePropsPositionPicker, {}, {}>;
|
|
258
|
-
export declare const DateInputContainer: import("@emotion/styled").StyledComponent<{
|
|
259
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
260
|
-
as?: import("react").ElementType<any> | undefined;
|
|
261
|
-
} & StylePropsDateInput, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
262
|
-
export declare const CalendarText: import("@emotion/styled").StyledComponent<{
|
|
263
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
264
|
-
as?: import("react").ElementType<any> | undefined;
|
|
265
|
-
} & import("../../@types").GenericStyledProps & import("react").ClassAttributes<HTMLParagraphElement> & import("react").HTMLAttributes<HTMLParagraphElement> & {
|
|
266
|
-
variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | undefined;
|
|
267
|
-
color?: import("../..").GlobalColorsProps | (string & {}) | undefined;
|
|
268
|
-
fontSize?: number | "display" | "tiny" | "xxxs" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "xxxl" | "giant" | undefined;
|
|
269
|
-
fontWeight?: "400" | "700" | "100" | "200" | "300" | "500" | "600" | "800" | "900" | "bold" | "normal" | undefined;
|
|
270
|
-
fontStyle?: "inherit" | "initial" | "normal" | "italic" | "oblique" | undefined;
|
|
271
|
-
lineHeight?: string | number | undefined;
|
|
272
|
-
textAlign?: "center" | "end" | "start" | undefined;
|
|
273
|
-
textTransform?: "none" | "capitalize" | "lowercase" | "uppercase" | undefined;
|
|
274
|
-
textDecoration?: "none" | "line-through" | "underline" | undefined;
|
|
275
|
-
letterSpacing?: string | number | undefined;
|
|
276
|
-
children?: import("react").ReactNode;
|
|
277
|
-
} & {
|
|
278
|
-
textColor: string;
|
|
279
|
-
} & {
|
|
280
|
-
children?: import("react").ReactNode;
|
|
281
|
-
} & {
|
|
282
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
283
|
-
}, {}, {}>;
|
|
284
262
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/styles.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,kBAAkB;;;yGAO9B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAS/B,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.DatePickerContainer = exports.DateInputContainer =
|
|
6
|
+
exports.DatePickerContainer = exports.DateInputContainer = void 0;
|
|
7
7
|
|
|
8
8
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
9
|
|
|
@@ -11,29 +11,25 @@ var _react = require("@emotion/react");
|
|
|
11
11
|
|
|
12
12
|
var _framerMotion = require("framer-motion");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _excluded = ["theme"];
|
|
15
15
|
|
|
16
|
-
var _templateObject, _templateObject2
|
|
16
|
+
var _templateObject, _templateObject2;
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
20
|
-
function
|
|
20
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
21
|
|
|
22
|
-
var
|
|
23
|
-
var theme = _ref.theme;
|
|
24
|
-
return theme.zIndex.level24;
|
|
25
|
-
}, function (_ref2) {
|
|
26
|
-
var _ref2$position = _ref2.position,
|
|
27
|
-
position = _ref2$position === void 0 ? 'bottom' : _ref2$position;
|
|
28
|
-
return position === 'bottom' ? (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n top: 60px;\n "]))) : (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n bottom: 60px;\n "])));
|
|
29
|
-
});
|
|
30
|
-
exports.DatePickerContainer = DatePickerContainer;
|
|
22
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
31
23
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
24
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
25
|
+
|
|
26
|
+
var DateInputContainer = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n input {\n cursor: pointer;\n caret-color: transparent;\n }\n"])));
|
|
36
27
|
|
|
37
28
|
exports.DateInputContainer = DateInputContainer;
|
|
38
|
-
var
|
|
39
|
-
|
|
29
|
+
var DatePickerContainer = (0, _styled.default)(_framerMotion.motion.div)(function (_ref) {
|
|
30
|
+
var theme = _ref.theme,
|
|
31
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
|
|
33
|
+
return (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n z-index: ", ";\n ", ";\n "])), theme.zIndex.level24, props.position === 'bottom' ? 'top: 66px;' : 'bottom: 66px;');
|
|
34
|
+
});
|
|
35
|
+
exports.DatePickerContainer = DatePickerContainer;
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import { FormEvent } from 'react';
|
|
2
1
|
import { DatePickerProps } from '../DatePicker/types';
|
|
3
|
-
|
|
4
|
-
default: string | FormEvent<HTMLInputElement> | string[];
|
|
5
|
-
};
|
|
6
|
-
export declare type StylePropsDateInput = {
|
|
7
|
-
fullWidth?: boolean;
|
|
8
|
-
};
|
|
2
|
+
import { InputAlertTypes } from '../Input/types';
|
|
9
3
|
export declare type StylePropsPositionPicker = {
|
|
10
4
|
position?: 'bottom' | 'top';
|
|
11
5
|
};
|
|
12
|
-
export interface
|
|
13
|
-
selectedPeriod: DateType['default'];
|
|
14
|
-
setSelectedPeriod: (newState: DateType['default']) => void;
|
|
6
|
+
export interface DateInputProps extends DatePickerProps {
|
|
15
7
|
label?: string;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
helperText?: string;
|
|
10
|
+
alert?: InputAlertTypes;
|
|
11
|
+
locales?: string | string[];
|
|
12
|
+
localeOptions?: Intl.DateTimeFormatOptions;
|
|
20
13
|
}
|
|
21
14
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,oBAAY,wBAAwB,GAAG;IACrC,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CAC7B,CAAC;AAEF,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,eAAe,CAAC;IAExB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;CAC5C"}
|
|
@@ -23,7 +23,7 @@ var setup = function setup(props) {
|
|
|
23
23
|
describe('DatePicker', function () {
|
|
24
24
|
it('should it render the datepicker component', function () {
|
|
25
25
|
var _setup = setup({
|
|
26
|
-
value:
|
|
26
|
+
value: new Date(),
|
|
27
27
|
onChange: jest.fn()
|
|
28
28
|
}),
|
|
29
29
|
container = _setup.container;
|
|
@@ -32,7 +32,7 @@ describe('DatePicker', function () {
|
|
|
32
32
|
});
|
|
33
33
|
it('should it render the datepicker as range type', function () {
|
|
34
34
|
var _setup2 = setup({
|
|
35
|
-
value:
|
|
35
|
+
value: new Date(),
|
|
36
36
|
onChange: jest.fn(),
|
|
37
37
|
type: 'range'
|
|
38
38
|
}),
|
|
@@ -42,7 +42,7 @@ describe('DatePicker', function () {
|
|
|
42
42
|
});
|
|
43
43
|
it('should it render the datepicker as extended variant', function () {
|
|
44
44
|
var _setup3 = setup({
|
|
45
|
-
value:
|
|
45
|
+
value: new Date(),
|
|
46
46
|
onChange: jest.fn(),
|
|
47
47
|
variant: 'extended'
|
|
48
48
|
}),
|
|
@@ -52,7 +52,7 @@ describe('DatePicker', function () {
|
|
|
52
52
|
});
|
|
53
53
|
it('should it render the datepicker with minimum and maximum dates', function () {
|
|
54
54
|
var _setup4 = setup({
|
|
55
|
-
value:
|
|
55
|
+
value: new Date(),
|
|
56
56
|
onChange: jest.fn(),
|
|
57
57
|
minDate: new Date(),
|
|
58
58
|
maxDate: new Date()
|
|
@@ -65,7 +65,7 @@ describe('DatePicker', function () {
|
|
|
65
65
|
var onChange = jest.fn();
|
|
66
66
|
|
|
67
67
|
var _setup5 = setup({
|
|
68
|
-
value:
|
|
68
|
+
value: new Date(),
|
|
69
69
|
onChange: onChange
|
|
70
70
|
}),
|
|
71
71
|
container = _setup5.container;
|
|
@@ -82,7 +82,7 @@ describe('DatePicker', function () {
|
|
|
82
82
|
var onChange = jest.fn();
|
|
83
83
|
|
|
84
84
|
var _setup6 = setup({
|
|
85
|
-
value:
|
|
85
|
+
value: new Date(),
|
|
86
86
|
onChange: onChange,
|
|
87
87
|
type: 'range'
|
|
88
88
|
}),
|
|
@@ -102,7 +102,7 @@ describe('DatePicker', function () {
|
|
|
102
102
|
var onChange = jest.fn();
|
|
103
103
|
|
|
104
104
|
var _setup7 = setup({
|
|
105
|
-
value:
|
|
105
|
+
value: new Date(),
|
|
106
106
|
onChange: onChange,
|
|
107
107
|
variant: 'extended'
|
|
108
108
|
}),
|
|
@@ -120,7 +120,7 @@ describe('DatePicker', function () {
|
|
|
120
120
|
var onChange = jest.fn();
|
|
121
121
|
|
|
122
122
|
var _setup8 = setup({
|
|
123
|
-
value:
|
|
123
|
+
value: new Date(),
|
|
124
124
|
onChange: onChange,
|
|
125
125
|
type: 'range',
|
|
126
126
|
variant: 'extended'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,QAAA,MAAM,UAAU,iEAQb,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/index.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,QAAA,MAAM,UAAU,iEAQb,eAAe,gBAuJjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -48,14 +48,12 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
48
48
|
_ref$type = _ref.type,
|
|
49
49
|
type = _ref$type === void 0 ? 'date' : _ref$type;
|
|
50
50
|
|
|
51
|
-
var _useState = (0, _react.useState)(value ?
|
|
51
|
+
var _useState = (0, _react.useState)(value ? Array.isArray(value) ? value[0] : value : new Date()),
|
|
52
52
|
_useState2 = _slicedToArray(_useState, 2),
|
|
53
53
|
startDate = _useState2[0],
|
|
54
54
|
setStartDate = _useState2[1];
|
|
55
55
|
|
|
56
|
-
var _useState3 = (0, _react.useState)(
|
|
57
|
-
return value ? new Date(value[1]) : startDate;
|
|
58
|
-
}),
|
|
56
|
+
var _useState3 = (0, _react.useState)(value ? Array.isArray(value) ? value[1] : value : startDate),
|
|
59
57
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
60
58
|
endDate = _useState4[0],
|
|
61
59
|
setEndDate = _useState4[1];
|
|
@@ -113,21 +111,19 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
113
111
|
var handleChange = function handleChange(newDate) {
|
|
114
112
|
if (type === 'date') {
|
|
115
113
|
setStartDate(newDate);
|
|
114
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newDate);
|
|
116
115
|
} else {
|
|
117
116
|
var startDateTime = startDate.getTime();
|
|
118
117
|
var currentDateTime = newDate.getTime();
|
|
119
118
|
|
|
120
119
|
if (currentDateTime > startDateTime && !isInTheRange(newDate)) {
|
|
121
120
|
setEndDate(newDate);
|
|
122
|
-
onChange === null || onChange === void 0 ? void 0 : onChange([startDate
|
|
123
|
-
return;
|
|
121
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([startDate, newDate]);
|
|
124
122
|
} else {
|
|
125
123
|
setEndDate(newDate);
|
|
126
124
|
setStartDate(newDate);
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
|
-
|
|
130
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newDate.toLocaleDateString());
|
|
131
127
|
};
|
|
132
128
|
|
|
133
129
|
var DatePickerContentProps = {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
2
1
|
import { ExtendThemeProps, GlobalColorsProps } from '../../shared/theme/theme.types';
|
|
3
|
-
export declare type DatePickerProps =
|
|
2
|
+
export declare type DatePickerProps = {
|
|
4
3
|
/**
|
|
5
4
|
* Sets the date picker's type.
|
|
6
5
|
* @default 'date'
|
|
@@ -14,7 +13,7 @@ export declare type DatePickerProps = HTMLAttributes<HTMLInputElement> & {
|
|
|
14
13
|
/**
|
|
15
14
|
* Sets the date picker's current/initial value.
|
|
16
15
|
*/
|
|
17
|
-
value?:
|
|
16
|
+
value?: Date | [Date, Date];
|
|
18
17
|
/**
|
|
19
18
|
* Sets the date picker's minimum month and year.
|
|
20
19
|
* @summary To set the minimum date, the date needs to be the first day of the month.
|
|
@@ -29,7 +28,7 @@ export declare type DatePickerProps = HTMLAttributes<HTMLInputElement> & {
|
|
|
29
28
|
* Callback function that is called when the date picker's value changes.
|
|
30
29
|
* @param {Date} date - The new date.
|
|
31
30
|
*/
|
|
32
|
-
onChange?: (date:
|
|
31
|
+
onChange?: (date: Date | [Date, Date]) => void;
|
|
33
32
|
color?: GlobalColorsProps | (string & {});
|
|
34
33
|
};
|
|
35
34
|
export declare type GenericStyledProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAErF,oBAAY,eAAe,GAAG;IAC5B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC;IAC/C,KAAK,CAAC,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;CAC3C,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,gBAAgB,GAAG;QACzB,aAAa,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;KAClD,CAAC;CACH,CAAC;AAEF,oBAAY,sBAAsB,GAAG;IACnC,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACjC,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,IAAI,CAAC;IACd,YAAY,EAAE,CAAC,WAAW,EAAE,IAAI,KAAK,OAAO,CAAC;IAC7C,eAAe,EAAE,CAAC,WAAW,EAAE,IAAI,KAAK,IAAI,CAAC;IAC7C,YAAY,EAAE,CAAC,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC;IACtC,gBAAgB,EAAE,CAAC,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC;IAC1C,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IACpC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;CAC9C,CAAC;AAEF,oBAAY,mBAAmB,GAAG;IAChC,IAAI,EAAE,IAAI,CAAC;IACX,gBAAgB,EAAE,CAAC,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC;CAC3C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAKpB,MAAM,OAAO,CAAC;AAoBf,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAKpB,MAAM,OAAO,CAAC;AAoBf,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,QAAA,MAAM,KAAK,sJA8FV,CAAC;AAGF,eAAe,KAAK,CAAC"}
|
|
@@ -40,8 +40,6 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
40
40
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
41
41
|
|
|
42
42
|
var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
43
|
-
var _inputRef$current2;
|
|
44
|
-
|
|
45
43
|
var placeholder = _ref.placeholder,
|
|
46
44
|
type = _ref.type,
|
|
47
45
|
disabled = _ref.disabled,
|
|
@@ -80,10 +78,11 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
80
78
|
(0, _react.useEffect)(function () {
|
|
81
79
|
var _inputRef$current;
|
|
82
80
|
|
|
83
|
-
((_inputRef$current = inputRef.current)
|
|
84
|
-
}
|
|
81
|
+
setHasValueOnInput(!!((_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.value));
|
|
82
|
+
});
|
|
85
83
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.InputGroupElement, {
|
|
86
|
-
|
|
84
|
+
withIcon: !!withIcon,
|
|
85
|
+
hasValueOnInput: placeholder || rest.value ? true : hasValueOnInput,
|
|
87
86
|
alert: alert,
|
|
88
87
|
withAddon: withAddon,
|
|
89
88
|
hasDisabled: disabled,
|
|
@@ -6,6 +6,7 @@ export declare const InputGroupElement: import("@emotion/styled").StyledComponen
|
|
|
6
6
|
as?: import("react").ElementType<any> | undefined;
|
|
7
7
|
} & InputComponentProps & {
|
|
8
8
|
hasDisabled?: boolean | undefined;
|
|
9
|
+
withIcon?: boolean | undefined;
|
|
9
10
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
10
11
|
export declare const InputColumn: import("@emotion/styled").StyledComponent<{
|
|
11
12
|
theme?: import("@emotion/react").Theme | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Input/styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Input/styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD,eAAO,MAAM,iBAAiB;;;;;;yGA4I7B,CAAC;AAEF,eAAO,MAAM,WAAW;;;yGASvB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;yGAKxB,CAAC;AAEF,eAAO,MAAM,eAAe;;;yGAK3B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;yGAarB,CAAC;AAEF,eAAO,MAAM,KAAK;;;+HA2BjB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;kHAgBtB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;2HAyCpB,CAAC;AAEF,eAAO,MAAM,MAAM;;;+GAQlB,CAAC;AAEF,eAAO,MAAM,UAAU;;;2GAItB,CAAC;AAEF,eAAO,MAAM,UAAU;;;wHAUtB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;yGAyCxB,CAAC;AAEF,eAAO,MAAM,YAAY;;;2GAOxB,CAAC"}
|