@pedidopago/ui 1.3.28 → 1.3.29
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/DateInput/components/ModalWrapper/index.d.ts.map +1 -1
- package/dist/components/DateInput/components/ModalWrapper/index.js +4 -3
- package/dist/components/DateInput/components/ModalWrapper/styles.d.ts +2 -1
- package/dist/components/DateInput/components/ModalWrapper/styles.d.ts.map +1 -1
- package/dist/components/DateInput/components/ModalWrapper/styles.js +2 -2
- package/dist/components/DateInput/components/ModalWrapper/types.d.ts +2 -0
- package/dist/components/DateInput/components/ModalWrapper/types.d.ts.map +1 -1
- package/dist/components/DateInput/index.d.ts +1 -1
- package/dist/components/DateInput/index.d.ts.map +1 -1
- package/dist/components/DateInput/index.js +11 -6
- package/dist/components/DateInput/types.d.ts +2 -0
- package/dist/components/DateInput/types.d.ts.map +1 -1
- package/dist/components/DatePicker/components/DatePickerContent.d.ts +1 -1
- package/dist/components/DatePicker/components/DatePickerContent.d.ts.map +1 -1
- package/dist/components/DatePicker/components/DatePickerContent.js +13 -7
- package/dist/components/DatePicker/index.d.ts +1 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +67 -19
- package/dist/components/DatePicker/styles.d.ts +1 -0
- package/dist/components/DatePicker/styles.d.ts.map +1 -1
- package/dist/components/DatePicker/styles.js +2 -2
- package/dist/components/DatePicker/types.d.ts +6 -2
- package/dist/components/DatePicker/types.d.ts.map +1 -1
- package/dist/components/Pagination/styles.d.ts.map +1 -1
- package/dist/components/Pagination/styles.js +3 -3
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.d.ts.map +1 -1
- package/dist/components/Slider/index.js +38 -3
- package/dist/components/Slider/types.d.ts +1 -0
- package/dist/components/Slider/types.d.ts.map +1 -1
- package/dist/components/Tabs/components/Tabs.js +1 -1
- package/dist/shared/formatters/format-number.d.ts +6 -0
- package/dist/shared/formatters/format-number.d.ts.map +1 -0
- package/dist/shared/formatters/format-number.js +47 -0
- package/dist/shared/formatters/types.d.ts +6 -0
- package/dist/shared/formatters/types.d.ts.map +1 -0
- package/dist/shared/formatters/types.js +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,YAAY,8GAmBxB,CAAC"}
|
|
@@ -13,13 +13,13 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
13
13
|
|
|
14
14
|
var ModalWrapper = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
15
15
|
var open = _ref.open,
|
|
16
|
-
|
|
17
|
-
left = _ref$left === void 0 ? '50vw' : _ref$left,
|
|
16
|
+
left = _ref.left,
|
|
18
17
|
_ref$top = _ref.top,
|
|
19
18
|
top = _ref$top === void 0 ? '' : _ref$top,
|
|
20
19
|
_ref$offsetX = _ref.offsetX,
|
|
21
20
|
offsetX = _ref$offsetX === void 0 ? '0px' : _ref$offsetX,
|
|
22
21
|
maxWidth = _ref.maxWidth,
|
|
22
|
+
right = _ref.right,
|
|
23
23
|
children = _ref.children;
|
|
24
24
|
var optionsContainerRef = (0, _react.useRef)(null);
|
|
25
25
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
@@ -29,7 +29,8 @@ var ModalWrapper = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
29
29
|
ref: optionsContainerRef,
|
|
30
30
|
open: open,
|
|
31
31
|
maxWidth: typeof maxWidth === 'number' ? "".concat(maxWidth, "px") : maxWidth,
|
|
32
|
-
left: "calc(".concat(left, " + ").concat(offsetX, ")"),
|
|
32
|
+
left: left && "calc(".concat(left, " + ").concat(offsetX, ")"),
|
|
33
|
+
right: right && "calc(".concat(right, " + ").concat(offsetX, ")"),
|
|
33
34
|
top: top,
|
|
34
35
|
children: children
|
|
35
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/styles.ts"],"names":[],"mappings":";AAIA,UAAU,0BAA0B;IAClC,IAAI,EAAE,OAAO,CAAC;IAEd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/styles.ts"],"names":[],"mappings":";AAIA,UAAU,0BAA0B;IAClC,IAAI,EAAE,OAAO,CAAC;IAEd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCA6BjC,CAAC"}
|
|
@@ -11,7 +11,7 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
|
11
11
|
|
|
12
12
|
var _framerMotion = require("framer-motion");
|
|
13
13
|
|
|
14
|
-
var _templateObject;
|
|
14
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
15
15
|
|
|
16
16
|
var _excluded = ["theme"];
|
|
17
17
|
|
|
@@ -27,6 +27,6 @@ var ModalWrapperContainer = (0, _styled.default)(_framerMotion.motion.div)(funct
|
|
|
27
27
|
var theme = _ref.theme,
|
|
28
28
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
29
29
|
|
|
30
|
-
return (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: auto;\n position: fixed;\n
|
|
30
|
+
return (0, _react.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: auto;\n position: fixed;\n ", "\n ", "\n top: ", ";\n z-index: ", ";\n opacity: ", ";\n pointer-events: ", ";\n transition: opacity ease ", ";\n background: ", ";\n border-radius: ", ";\n box-shadow: ", ";\n\n li {\n list-style: none;\n }\n "])), props.left && (0, _react.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n left: ", ";\n "])), props.left), props.right && (0, _react.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n right: ", ";\n "])), props.right), props.top, theme.zIndex.level24, props.open ? 1 : 0, props.open ? 'auto' : 'none', theme.transition.speed, theme.colors.background.light, theme.borderRadius.default, theme.shadow.level3);
|
|
31
31
|
});
|
|
32
32
|
exports.ModalWrapperContainer = ModalWrapperContainer;
|
|
@@ -4,6 +4,8 @@ export interface ModalWrapperProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
4
4
|
open: boolean;
|
|
5
5
|
/** Optional. Sets the left position where the modal will be shown. */
|
|
6
6
|
left?: string;
|
|
7
|
+
/** Optional. Sets the right position where the modal will be shown. */
|
|
8
|
+
right?: string;
|
|
7
9
|
/** Optional. Sets the top position where the modal will be shown. */
|
|
8
10
|
top?: string;
|
|
9
11
|
/** Optional. Offsets the Modal horizontally. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,iBAAkB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACvE,mCAAmC;IACnC,IAAI,EAAE,OAAO,CAAC;IAEd,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/DateInput/components/ModalWrapper/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,iBAAkB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACvE,mCAAmC;IACnC,IAAI,EAAE,OAAO,CAAC;IAEd,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DateInputProps } from './types';
|
|
3
|
-
export declare function DateInput({ label, placeholder, alert, helperText, value, locales, localeOptions, minDate, maxDate, onChange, disabled, ...rest }: DateInputProps): JSX.Element;
|
|
3
|
+
export declare function DateInput({ label, placeholder, alert, helperText, value, locales, localeOptions, minDate, maxDate, onChange, disabled, datePickerPosition, disableWeekendDays, ...rest }: DateInputProps): JSX.Element;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/index.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,WAAW,EACX,KAAK,EACL,UAAU,EACV,KAAK,EACL,OAAO,EACP,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAgB,EAChB,GAAG,IAAI,EACR,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/index.tsx"],"names":[],"mappings":";AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,WAAW,EACX,KAAK,EACL,UAAU,EACV,KAAK,EACL,OAAO,EACP,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAgB,EAChB,kBAA2B,EAC3B,kBAAkB,EAClB,GAAG,IAAI,EACR,EAAE,cAAc,eA0GhB"}
|
|
@@ -23,7 +23,7 @@ var _useDisableBodyScroll = require("../../shared/hooks/useDisableBodyScroll");
|
|
|
23
23
|
|
|
24
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
25
|
|
|
26
|
-
var _excluded = ["label", "placeholder", "alert", "helperText", "value", "locales", "localeOptions", "minDate", "maxDate", "onChange", "disabled"];
|
|
26
|
+
var _excluded = ["label", "placeholder", "alert", "helperText", "value", "locales", "localeOptions", "minDate", "maxDate", "onChange", "disabled", "datePickerPosition", "disableWeekendDays"];
|
|
27
27
|
|
|
28
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
29
|
|
|
@@ -50,7 +50,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
50
50
|
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
51
|
|
|
52
52
|
function DateInput(_ref) {
|
|
53
|
-
var _containerRef$current, _containerRef$current3, _containerRef$current4, _containerRef$current5;
|
|
53
|
+
var _containerRef$current, _containerRef$current3, _containerRef$current4, _containerRef$current5, _containerRef$current6, _containerRef$current7;
|
|
54
54
|
|
|
55
55
|
var label = _ref.label,
|
|
56
56
|
placeholder = _ref.placeholder,
|
|
@@ -64,6 +64,9 @@ function DateInput(_ref) {
|
|
|
64
64
|
onChange = _ref.onChange,
|
|
65
65
|
_ref$disabled = _ref.disabled,
|
|
66
66
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
67
|
+
_ref$datePickerPositi = _ref.datePickerPosition,
|
|
68
|
+
datePickerPosition = _ref$datePickerPositi === void 0 ? 'left' : _ref$datePickerPositi,
|
|
69
|
+
disableWeekendDays = _ref.disableWeekendDays,
|
|
67
70
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
68
71
|
|
|
69
72
|
var containerRef = (0, _react.useRef)(null);
|
|
@@ -118,7 +121,7 @@ function DateInput(_ref) {
|
|
|
118
121
|
}),
|
|
119
122
|
disabled: disabled,
|
|
120
123
|
tabIndex: disabled ? -1 : 0,
|
|
121
|
-
value: currentValue ? Array.isArray(currentValue) ? "".concat(currentValue[0].toLocaleDateString(locales, localeOptions), " - ").concat(currentValue[1].toLocaleDateString(locales, localeOptions)) : new Date(currentValue).toLocaleDateString() : '',
|
|
124
|
+
value: currentValue ? Array.isArray(currentValue) ? String(currentValue[0]) !== String(currentValue[1]) ? "".concat(currentValue[0].toLocaleDateString(locales, localeOptions), " - ").concat(currentValue[1].toLocaleDateString(locales, localeOptions)) : new Date(currentValue[0]).toLocaleDateString() : new Date(currentValue).toLocaleDateString() : '',
|
|
122
125
|
onClick: toggleOptionsAreaView,
|
|
123
126
|
onMouseOver: handleRepositionModal
|
|
124
127
|
}), datePickerOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
@@ -130,15 +133,17 @@ function DateInput(_ref) {
|
|
|
130
133
|
}
|
|
131
134
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalWrapper.ModalWrapper, {
|
|
132
135
|
open: datePickerOpen,
|
|
133
|
-
left: "".concat((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getBoundingClientRect().left, "px"),
|
|
134
|
-
|
|
136
|
+
left: datePickerPosition === 'left' ? "".concat((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getBoundingClientRect().left, "px") : undefined,
|
|
137
|
+
right: datePickerPosition === 'right' ? "".concat(window.innerWidth - Number(containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 ? void 0 : _containerRef$current4.offsetLeft) - Number(containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current5 = containerRef.current) === null || _containerRef$current5 === void 0 ? void 0 : _containerRef$current5.offsetWidth), "px") : undefined,
|
|
138
|
+
top: Number(positionContainer) < 540 ? "calc(".concat(((_containerRef$current6 = containerRef.current) === null || _containerRef$current6 === void 0 ? void 0 : _containerRef$current6.getBoundingClientRect().bottom) || 0, "px + 10px)") : "calc(".concat(((_containerRef$current7 = containerRef.current) === null || _containerRef$current7 === void 0 ? void 0 : _containerRef$current7.getBoundingClientRect().top) || 0, "px - ", 360, "px)"),
|
|
135
139
|
ref: optionsModalRef,
|
|
136
140
|
maxWidth: "auto",
|
|
137
141
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePicker.default, _objectSpread({
|
|
138
142
|
value: currentValue,
|
|
139
143
|
onChange: selectDate,
|
|
140
144
|
minDate: minDate,
|
|
141
|
-
maxDate: maxDate
|
|
145
|
+
maxDate: maxDate,
|
|
146
|
+
disableWeekendDays: disableWeekendDays
|
|
142
147
|
}, rest))
|
|
143
148
|
})]
|
|
144
149
|
})
|
|
@@ -1 +1 @@
|
|
|
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;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;IAC3C,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;
|
|
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;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC;IAC3C,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DatePickerContentProps } from '../types';
|
|
3
|
-
export declare const DatePickerContent: ({ type, date, startDate, endDate, isInTheRange, maxDate, minDate, handleChange, handleMouseOver, handleChangeDate, variant, enableYearPicker, handleToggleYearPicker, }: DatePickerContentProps) => JSX.Element;
|
|
3
|
+
export declare const DatePickerContent: ({ type, date, startDate, endDate, isInTheRange, maxDate, minDate, handleChange, handleMouseOver, handleChangeDate, variant, enableYearPicker, handleToggleYearPicker, hideNextMonthButton, hidePrevMonthButton, disableWeekendDays, }: DatePickerContentProps) => JSX.Element;
|
|
4
4
|
//# sourceMappingURL=DatePickerContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerContent.d.ts","sourceRoot":"","sources":["../../../../src/components/DatePicker/components/DatePickerContent.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"DatePickerContent.d.ts","sourceRoot":"","sources":["../../../../src/components/DatePicker/components/DatePickerContent.tsx"],"names":[],"mappings":";AAkBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,eAAO,MAAM,iBAAiB,0OAiB3B,sBAAsB,gBAyOxB,CAAC"}
|
|
@@ -42,7 +42,10 @@ var DatePickerContent = function DatePickerContent(_ref) {
|
|
|
42
42
|
handleChangeDate = _ref.handleChangeDate,
|
|
43
43
|
variant = _ref.variant,
|
|
44
44
|
enableYearPicker = _ref.enableYearPicker,
|
|
45
|
-
handleToggleYearPicker = _ref.handleToggleYearPicker
|
|
45
|
+
handleToggleYearPicker = _ref.handleToggleYearPicker,
|
|
46
|
+
hideNextMonthButton = _ref.hideNextMonthButton,
|
|
47
|
+
hidePrevMonthButton = _ref.hidePrevMonthButton,
|
|
48
|
+
disableWeekendDays = _ref.disableWeekendDays;
|
|
46
49
|
|
|
47
50
|
var handleChangeSelectDate = function handleChangeSelectDate(newDate) {
|
|
48
51
|
handleChangeDate(newDate);
|
|
@@ -122,7 +125,7 @@ var DatePickerContent = function DatePickerContent(_ref) {
|
|
|
122
125
|
onClick: function onClick() {
|
|
123
126
|
return handleChangeMonth(date.getMonth(), 'down');
|
|
124
127
|
},
|
|
125
|
-
isHidden: minDate && minDate.getMonth() === date.getMonth(),
|
|
128
|
+
isHidden: minDate && minDate.getMonth() === date.getMonth() || hidePrevMonthButton,
|
|
126
129
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
127
130
|
name: "arrow-left"
|
|
128
131
|
})
|
|
@@ -140,7 +143,7 @@ var DatePickerContent = function DatePickerContent(_ref) {
|
|
|
140
143
|
onClick: function onClick() {
|
|
141
144
|
return handleChangeMonth(date.getMonth(), 'up');
|
|
142
145
|
},
|
|
143
|
-
isHidden: maxDate && maxDate.getMonth() === date.getMonth(),
|
|
146
|
+
isHidden: maxDate && maxDate.getMonth() === date.getMonth() || hideNextMonthButton,
|
|
144
147
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
145
148
|
name: "arrow-right"
|
|
146
149
|
})
|
|
@@ -178,11 +181,13 @@ var DatePickerContent = function DatePickerContent(_ref) {
|
|
|
178
181
|
var dateMonth = isPreviousMonth ? date.getMonth() - 1 : isNextMonth ? date.getMonth() + 1 : date.getMonth();
|
|
179
182
|
var cellDate = new Date(date.getFullYear(), dateMonth, day);
|
|
180
183
|
var cellTitle = cellDate.toLocaleDateString();
|
|
181
|
-
var isToday = cellDate.
|
|
182
|
-
var isStartDateOfRange =
|
|
183
|
-
|
|
184
|
+
var isToday = cellDate.getTime() === Date.now();
|
|
185
|
+
var isStartDateOfRange = // setHours(0, 0, 0, 0) set the time to midnight
|
|
186
|
+
cellDate.getTime() === startDate.setHours(0, 0, 0, 0);
|
|
187
|
+
var isEndDateOfRange = cellDate.getTime() === endDate.getTime();
|
|
184
188
|
var outOfCurrentMonthInRange = type === 'range' && (isPreviousMonth || isNextMonth);
|
|
185
|
-
var
|
|
189
|
+
var isWeekendDay = disableWeekendDays ? cellDate.getDay() === 0 || cellDate.getDay() === 6 : false;
|
|
190
|
+
var isDisabled = day === 0 || minDate && cellDate.getTime() < minDate.getTime() || maxDate && cellDate.getTime() > maxDate.getTime() || outOfCurrentMonthInRange || isWeekendDay;
|
|
186
191
|
var isExtended = variant === 'extended';
|
|
187
192
|
var removeZeros = days.filter(function (day) {
|
|
188
193
|
return day !== 0;
|
|
@@ -191,6 +196,7 @@ var DatePickerContent = function DatePickerContent(_ref) {
|
|
|
191
196
|
role: "gridcell",
|
|
192
197
|
title: cellTitle,
|
|
193
198
|
"data-date": cellDate,
|
|
199
|
+
isTheSameDate: cellDate.getTime() === endDate.getTime() && cellDate.getTime() === startDate.getTime(),
|
|
194
200
|
tabIndex: -1,
|
|
195
201
|
disabled: isDisabled,
|
|
196
202
|
"aria-label": cellDate.toLocaleDateString('pt-BR', {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DatePickerProps } from './types';
|
|
3
|
-
declare const DatePicker: ({ value, onChange, minDate, maxDate, variant, color, type, }: DatePickerProps) => JSX.Element;
|
|
3
|
+
declare const DatePicker: ({ value, onChange, minDate: minDateProp, maxDate: maxDateProp, variant, color, type, disableWeekendDays, }: DatePickerProps) => JSX.Element;
|
|
4
4
|
export default DatePicker;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,
|
|
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,+GASb,eAAe,gBAiNjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -40,37 +40,82 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
40
40
|
var DatePicker = function DatePicker(_ref) {
|
|
41
41
|
var value = _ref.value,
|
|
42
42
|
onChange = _ref.onChange,
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
minDateProp = _ref.minDate,
|
|
44
|
+
maxDateProp = _ref.maxDate,
|
|
45
45
|
_ref$variant = _ref.variant,
|
|
46
46
|
variant = _ref$variant === void 0 ? 'compact' : _ref$variant,
|
|
47
47
|
color = _ref.color,
|
|
48
48
|
_ref$type = _ref.type,
|
|
49
|
-
type = _ref$type === void 0 ? 'date' : _ref$type
|
|
49
|
+
type = _ref$type === void 0 ? 'date' : _ref$type,
|
|
50
|
+
disableWeekendDays = _ref.disableWeekendDays;
|
|
51
|
+
var date = (0, _react.useMemo)(function () {
|
|
52
|
+
return new Date();
|
|
53
|
+
}, []);
|
|
54
|
+
var minDate = new Date(minDateProp);
|
|
55
|
+
var maxDate = new Date(maxDateProp);
|
|
56
|
+
|
|
57
|
+
var _useState = (0, _react.useState)(function () {
|
|
58
|
+
if (value) {
|
|
59
|
+
return Array.isArray(value) ? new Date(value[0]) : new Date(value);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (maxDateProp && minDateProp) {
|
|
63
|
+
return maxDate <= date ? new Date(maxDate.getFullYear(), maxDate.getMonth() - 1) : maxDate;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (minDateProp) {
|
|
67
|
+
return minDate > date ? minDate : date;
|
|
68
|
+
}
|
|
50
69
|
|
|
51
|
-
|
|
70
|
+
if (maxDateProp) {
|
|
71
|
+
return maxDate < date ? new Date(maxDate.getFullYear(), maxDate.getMonth() - (variant === 'compact' ? 0 : 1)) : date;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return date;
|
|
75
|
+
}),
|
|
52
76
|
_useState2 = _slicedToArray(_useState, 2),
|
|
53
77
|
startDate = _useState2[0],
|
|
54
78
|
setStartDate = _useState2[1];
|
|
55
79
|
|
|
56
|
-
var _useState3 = (0, _react.useState)(value ? Array.isArray(value) ? value[1] : value : startDate),
|
|
80
|
+
var _useState3 = (0, _react.useState)(value ? Array.isArray(value) ? new Date(value[1]) : new Date(value) : startDate),
|
|
57
81
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
58
82
|
endDate = _useState4[0],
|
|
59
83
|
setEndDate = _useState4[1];
|
|
60
84
|
|
|
85
|
+
var endDateMonth = endDate.getMonth();
|
|
86
|
+
var startDateMonth = startDate.getMonth();
|
|
87
|
+
|
|
61
88
|
var _useState5 = (0, _react.useState)(function () {
|
|
62
|
-
|
|
89
|
+
if (Array.isArray(value) && value !== null && value !== void 0 && value[1]) {
|
|
90
|
+
if (maxDateProp) {
|
|
91
|
+
if (startDateMonth === endDateMonth && endDateMonth === maxDate.getMonth()) return endDate;
|
|
92
|
+
if (startDateMonth === endDateMonth) return new Date(endDate.getFullYear(), endDateMonth + 1);
|
|
93
|
+
return endDate;
|
|
94
|
+
} else {
|
|
95
|
+
return startDateMonth === endDateMonth ? new Date(endDate.getFullYear(), endDateMonth + 1) : endDate;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (maxDateProp) {
|
|
100
|
+
return maxDate.getMonth() === startDateMonth ? maxDate : new Date(startDate.getFullYear(), startDateMonth + 1, 1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return new Date(startDate.getFullYear(), startDateMonth + 1, 1);
|
|
63
104
|
}),
|
|
64
105
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
65
|
-
|
|
66
|
-
|
|
106
|
+
secondCalendarDate = _useState6[0],
|
|
107
|
+
setSecondCalendarDate = _useState6[1];
|
|
67
108
|
|
|
68
109
|
var _useState7 = (0, _react.useState)(function () {
|
|
69
|
-
|
|
110
|
+
if (variant === 'extended' && secondCalendarDate.getMonth() === maxDate.getMonth()) {
|
|
111
|
+
return Array.isArray(value) && startDateMonth !== endDateMonth ? startDate : new Date(secondCalendarDate.getFullYear(), secondCalendarDate.getMonth() - 1);
|
|
112
|
+
} else {
|
|
113
|
+
return new Date(startDate.getFullYear(), startDateMonth);
|
|
114
|
+
}
|
|
70
115
|
}),
|
|
71
116
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
72
|
-
|
|
73
|
-
|
|
117
|
+
firstCalendarDate = _useState8[0],
|
|
118
|
+
setFirstCalendarDate = _useState8[1];
|
|
74
119
|
|
|
75
120
|
var _useState9 = (0, _react.useState)(false),
|
|
76
121
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
@@ -91,13 +136,12 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
91
136
|
rowCells.forEach(function (cell) {
|
|
92
137
|
var cellDate = new Date(String(cell.getAttribute('data-date')));
|
|
93
138
|
var isCurrentOverCell = cellDate.toLocaleString() === currentDate.toLocaleString();
|
|
94
|
-
var
|
|
95
|
-
var isBiggerThanStartDate = cellDate.getTime() > startDate.getTime();
|
|
139
|
+
var isBiggerThanStartDate = cellDate.getTime() >= startDate.getTime();
|
|
96
140
|
var isSmallerThanCurrentDate = cellDate.getTime() < currentDate.getTime();
|
|
97
141
|
cell.classList.remove('is-hover');
|
|
98
142
|
|
|
99
|
-
if (endDate.
|
|
100
|
-
if (
|
|
143
|
+
if (endDate.getTime() === startDate.getTime()) {
|
|
144
|
+
if (isBiggerThanStartDate && (isSmallerThanCurrentDate || isCurrentOverCell)) {
|
|
101
145
|
cell.classList.add('is-hover');
|
|
102
146
|
isCurrentOverCell ? cell.classList.add('is-current') : cell.classList.remove('is-current');
|
|
103
147
|
} else {
|
|
@@ -116,7 +160,7 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
116
160
|
var startDateTime = startDate.getTime();
|
|
117
161
|
var currentDateTime = newDate.getTime();
|
|
118
162
|
|
|
119
|
-
if (currentDateTime
|
|
163
|
+
if (currentDateTime >= startDateTime && !isInTheRange(newDate)) {
|
|
120
164
|
setEndDate(newDate);
|
|
121
165
|
onChange === null || onChange === void 0 ? void 0 : onChange([startDate, newDate]);
|
|
122
166
|
} else {
|
|
@@ -150,24 +194,28 @@ var DatePicker = function DatePicker(_ref) {
|
|
|
150
194
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.DatePickerContentContainer, {
|
|
151
195
|
isExtended: variant === 'extended',
|
|
152
196
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_framerMotion.AnimatePresence, {
|
|
153
|
-
|
|
197
|
+
exitBeforeEnter: true,
|
|
154
198
|
children: !openYearPicker ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
155
199
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePickerContent.DatePickerContent, _objectSpread(_objectSpread(_objectSpread({}, DatePickerContentProps), variant !== 'extended' && {
|
|
156
200
|
handleToggleYearPicker: handleToggleYearPicker,
|
|
157
201
|
enableYearPicker: !maxDate && !minDate
|
|
158
202
|
}), {}, {
|
|
159
203
|
date: firstCalendarDate,
|
|
204
|
+
minDate: DatePickerContentProps.minDate,
|
|
160
205
|
maxDate: variant === 'extended' && !maxDate ? firstCalendarLimit : variant === 'extended' ? maxDate && new Date(maxDate).getTime() < firstCalendarLimit.getTime() ? DatePickerContentProps.maxDate : firstCalendarLimit : DatePickerContentProps.maxDate,
|
|
206
|
+
disableWeekendDays: disableWeekendDays,
|
|
161
207
|
handleChangeDate: function handleChangeDate(newDate) {
|
|
162
208
|
return setFirstCalendarDate(newDate);
|
|
163
209
|
}
|
|
164
210
|
})), variant === 'extended' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePickerContent.DatePickerContent, _objectSpread(_objectSpread({}, DatePickerContentProps), {}, {
|
|
165
211
|
date: secondCalendarDate,
|
|
166
|
-
minDate:
|
|
212
|
+
minDate: DatePickerContentProps.minDate,
|
|
167
213
|
maxDate: DatePickerContentProps.maxDate,
|
|
168
214
|
handleChangeDate: function handleChangeDate(newDate) {
|
|
169
215
|
setSecondCalendarDate(newDate);
|
|
170
|
-
}
|
|
216
|
+
},
|
|
217
|
+
hidePrevMonthButton: secondCalendarDate.getMonth() - 1 === firstCalendarDate.getMonth() || secondCalendarDate.getMonth() === 0 && firstCalendarDate.getMonth() === 11,
|
|
218
|
+
disableWeekendDays: disableWeekendDays
|
|
171
219
|
}))]
|
|
172
220
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_DateYearPicker.DateYearPicker, {
|
|
173
221
|
date: firstCalendarDate,
|
|
@@ -52,6 +52,7 @@ export declare const DatePickerTableCell: import("@emotion/styled").StyledCompon
|
|
|
52
52
|
isStartDateOfRange?: boolean | undefined;
|
|
53
53
|
isFirstDayOfMonth?: boolean | undefined;
|
|
54
54
|
isLastDayOfMonth?: boolean | undefined;
|
|
55
|
+
isTheSameDate?: boolean | undefined;
|
|
55
56
|
disabled?: boolean | undefined;
|
|
56
57
|
}, import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, {}>;
|
|
57
58
|
export declare const DatePickerTableCellSpan: import("@emotion/styled").StyledComponent<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/styles.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,0BAA0B;;;;gBACzB,OAAO;yGAkBpB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;yGAG/B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;yGAM5B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;yGAqBjC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;qHAqBlC,CAAC;AAEF,eAAO,MAAM,cAAc;;;yGAE1B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;uIAc/B,CAAC;AACF,eAAO,MAAM,kBAAkB;;;;;mHAkB9B,CAAC;AAEF,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/styles.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,0BAA0B;;;;gBACzB,OAAO;yGAkBpB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;yGAG/B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;yGAM5B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;yGAqBjC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;qHAqBlC,CAAC;AAEF,eAAO,MAAM,cAAc;;;yGAE1B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;uIAc/B,CAAC;AACF,eAAO,MAAM,kBAAkB;;;;;mHAkB9B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;+HAsJ/B,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;gIAGnC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;yGAGnC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;yGAG9B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;yGA+B9B,CAAC"}
|
|
@@ -73,7 +73,7 @@ var DatePickerTableRow = _styled.default.tr(_templateObject8 || (_templateObject
|
|
|
73
73
|
|
|
74
74
|
exports.DatePickerTableRow = DatePickerTableRow;
|
|
75
75
|
|
|
76
|
-
var DatePickerTableCell = _styled.default.td(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n position: relative;\n height: 0;\n padding: 12px;\n text-align: center;\n font-family: inherit;\n font-size: 0.75rem;\n font-weight: 600;\n border-radius: 50%;\n cursor: pointer;\n background-color: ", ";\n\n color: ", ";\n\n user-select: none;\n\n transition: background 150ms ease;\n\n ", "\n\n ", "\n\n ", "\n\n &:hover {\n background-color: ", ";\n }\n\n ", "\n\n &.is-current {\n
|
|
76
|
+
var DatePickerTableCell = _styled.default.td(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n position: relative;\n height: 0;\n padding: 12px;\n text-align: center;\n font-family: inherit;\n font-size: 0.75rem;\n font-weight: 600;\n border-radius: 50%;\n cursor: pointer;\n background-color: ", ";\n\n color: ", ";\n\n user-select: none;\n\n transition: background 150ms ease;\n\n ", "\n\n ", "\n\n ", "\n\n &:hover {\n background-color: ", ";\n }\n\n ", "\n\n &.is-current[aria-selected='false']:before {\n border-radius: 0 50% 50% 0 !important;\n }\n\n &.is-current[aria-selected='true']:before {\n display: none;\n }\n"])), function (props) {
|
|
77
77
|
return !props.isPrevNextMonth && !props.disabled && (props.isSelected || props.isEndDateOfRange) ? (0, _getColorValue.getColorValue)(props.theme.colorSelected, props.theme) : 'transparent';
|
|
78
78
|
}, function (props) {
|
|
79
79
|
return props.isPrevNextMonth ? props.theme.colors.neutral.neutral2 : props.isSelected || props.isEndDateOfRange ? props.theme.colors.body.light : props['aria-selected'] ? (0, _getColorValue.getColorValue)(props.theme.colorSelected, props.theme) : props.theme.colors.neutral.black;
|
|
@@ -82,7 +82,7 @@ var DatePickerTableCell = _styled.default.td(_templateObject9 || (_templateObjec
|
|
|
82
82
|
}, function (props) {
|
|
83
83
|
return props.isToday && !props.isSelected && !props.isEndDateOfRange && "\n &:after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100%;\n height: 100%;\n border-radius: 50%;\n border: solid 1px ".concat(props.theme.colors.neutral.neutral2, ";\n transform: translate(-50%, -50%);\n }\n ");
|
|
84
84
|
}, function (props) {
|
|
85
|
-
return (props.isInTheRange || props.isEndDateOfRange || props.isStartDateOfRange) && "\n &:before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100%;\n height: 96%;\n border-radius: ".concat(props.isStartDateOfRange ? '50% 0 0 50% !important' : props.isEndDateOfRange ? '0 50% 50% 0 !important' : props.isFirstDayOfMonth ? '4px 0 0 4px' : props.isLastDayOfMonth ? '0 4px 4px 0' : '0', ";\n \n background-color: ").concat(!props.isPrevNextMonth && !props.disabled ? (0, _colorCheck.parseHexColorToRgba)((0, _getColorValue.getColorValue)(props.theme.colorSelected, props.theme), 0.1) : 'transparent', "; \n transform: translate(-50%, -50%);\n }\n ");
|
|
85
|
+
return !props.isTheSameDate && (props.isInTheRange || props.isEndDateOfRange || props.isStartDateOfRange) && "\n \n &:before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100%;\n height: 96%;\n border-radius: ".concat(props.isStartDateOfRange ? '50% 0 0 50% !important' : props.isEndDateOfRange ? '0 50% 50% 0 !important' : props.isFirstDayOfMonth ? '4px 0 0 4px' : props.isLastDayOfMonth ? '0 4px 4px 0' : '0', ";\n \n background-color: ").concat(!props.isPrevNextMonth && !props.disabled ? (0, _colorCheck.parseHexColorToRgba)((0, _getColorValue.getColorValue)(props.theme.colorSelected, props.theme), 0.1) : 'transparent', "; \n transform: translate(-50%, -50%);\n }\n ");
|
|
86
86
|
}, function (props) {
|
|
87
87
|
return !props.isSelected && !props.isEndDateOfRange && (0, _colorCheck.parseHslColorToString)((0, _colorToGray.convertColor)((0, _getColorValue.getColorValue)(props.theme.colorSelected, props.theme)).neutral1);
|
|
88
88
|
}, function (props) {
|
|
@@ -18,18 +18,19 @@ export declare type DatePickerProps = {
|
|
|
18
18
|
* Sets the date picker's minimum month and year.
|
|
19
19
|
* @summary To set the minimum date, the date needs to be the first day of the month.
|
|
20
20
|
*/
|
|
21
|
-
minDate?: Date;
|
|
21
|
+
minDate?: Date | number | string;
|
|
22
22
|
/**
|
|
23
23
|
* Sets the date picker's maximum month and year.
|
|
24
24
|
* @summary To set the maximum date, the date needs to be the first day of the month.
|
|
25
25
|
*/
|
|
26
|
-
maxDate?: Date;
|
|
26
|
+
maxDate?: Date | number | string;
|
|
27
27
|
/**
|
|
28
28
|
* Callback function that is called when the date picker's value changes.
|
|
29
29
|
* @param {Date} date - The new date.
|
|
30
30
|
*/
|
|
31
31
|
onChange?: (date: Date | [Date, Date]) => void;
|
|
32
32
|
color?: GlobalColorsProps | (string & {});
|
|
33
|
+
disableWeekendDays?: boolean;
|
|
33
34
|
};
|
|
34
35
|
export declare type GenericStyledProps = {
|
|
35
36
|
theme?: ExtendThemeProps & {
|
|
@@ -51,6 +52,9 @@ export declare type DatePickerContentProps = {
|
|
|
51
52
|
maxDate?: Date;
|
|
52
53
|
type?: 'date' | 'range';
|
|
53
54
|
color?: 'primary' | 'secondary' | 'tertiary';
|
|
55
|
+
hideNextMonthButton?: boolean;
|
|
56
|
+
hidePrevMonthButton?: boolean;
|
|
57
|
+
disableWeekendDays?: boolean;
|
|
54
58
|
};
|
|
55
59
|
export declare type DateYearPickerProps = {
|
|
56
60
|
date: Date;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IACjC;;;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;IAC1C,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,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;IAC7C,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,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":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Pagination/styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAqC5C,eAAO,MAAM,cAAc;;;iIAe1B,CAAC;AAEF,eAAO,MAAM,cAAc;;;6HAK1B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;yIA2C5B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/Pagination/styles.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAqC5C,eAAO,MAAM,cAAc;;;iIAe1B,CAAC;AAEF,eAAO,MAAM,cAAc;;;6HAK1B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;yIA2C5B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;yIA6BpC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;yIA4BhC,CAAC;AAEF,eAAO,MAAM,aAAa;;;+HAQzB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;6HA0BpB,CAAC;AAEF,eAAO,MAAM,aAAa;;;yGAEzB,CAAC"}
|
|
@@ -59,7 +59,7 @@ var PreviousNavigationButton = _styled.default.button(_templateObject11 || (_tem
|
|
|
59
59
|
shape = _ref5.shape,
|
|
60
60
|
grayColor = _ref5.grayColor,
|
|
61
61
|
color = _ref5.color;
|
|
62
|
-
return (0, _react.css)(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n border-radius: 8px 0 0 8px;\n border: 2px solid
|
|
62
|
+
return (0, _react.css)(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n border-radius: 8px 0 0 8px;\n border: 2px solid\n ", ";\n color: ", ";\n background: none;\n min-width: 72px;\n height: 100%;\n cursor: pointer;\n transition: 0.2s;\n\n ", "\n ", "\n "])), disabled ? theme.colors.neutral.neutral1 : grayColor || theme.colors.tertiary.default, disabled ? theme.colors.neutral.neutral1 : grayColor || theme.colors.tertiary.default, !disabled ? (0, _react.css)(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n &:hover,\n &:active {\n border-color: ", ";\n color: ", ";\n }\n "])), color || theme.colors.tertiary.default, color || theme.colors.tertiary.default) : (0, _react.css)(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n cursor: not-allowed;\n "]))), shape === 'circular' && (0, _react.css)(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n border-radius: 50%;\n min-width: 42px;\n "]))));
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
exports.PreviousNavigationButton = PreviousNavigationButton;
|
|
@@ -71,7 +71,7 @@ var NextNavigationButton = _styled.default.button(_templateObject16 || (_templat
|
|
|
71
71
|
grayColor = _ref6.grayColor,
|
|
72
72
|
saturationColor = _ref6.saturationColor,
|
|
73
73
|
color = _ref6.color;
|
|
74
|
-
return (0, _react.css)(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n border-radius: 0 8px 8px 0;\n border: 2px solid
|
|
74
|
+
return (0, _react.css)(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n border-radius: 0 8px 8px 0;\n border: 2px solid\n ", ";\n color: ", ";\n background: none;\n min-width: 72px;\n height: 100%;\n cursor: pointer;\n transition: 0.2s;\n ", "\n ", "\n "])), disabled ? theme.colors.neutral.neutral1 : grayColor || theme.colors.tertiary.default, disabled ? theme.colors.neutral.neutral1 : grayColor || theme.colors.tertiary.default, !disabled ? (0, _react.css)(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n &:hover,\n &:active {\n border-color: ", ";\n color: ", ";\n }\n "])), color || theme.colors.tertiary.default, color || theme.colors.tertiary.default) : (0, _react.css)(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n cursor: not-allowed;\n "]))), shape === 'circular' && (0, _react.css)(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n border-radius: 50%;\n min-width: 42px;\n "]))));
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
exports.NextNavigationButton = NextNavigationButton;
|
|
@@ -79,7 +79,7 @@ exports.NextNavigationButton = NextNavigationButton;
|
|
|
79
79
|
var SmallPageInfo = _styled.default.span(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n font-weight: 600;\n display: block;\n min-width: 60px;\n font-size: 16px;\n line-height: 1.5;\n color: ", ";\n margin: 0 24px;\n"])), function (_ref7) {
|
|
80
80
|
var grayColor = _ref7.grayColor,
|
|
81
81
|
theme = _ref7.theme;
|
|
82
|
-
return grayColor || theme.colors.
|
|
82
|
+
return grayColor || theme.colors.neutral.neutral5;
|
|
83
83
|
});
|
|
84
84
|
|
|
85
85
|
exports.SmallPageInfo = SmallPageInfo;
|
|
@@ -14,6 +14,7 @@ declare const Slider: import("react").ForwardRefExoticComponent<{
|
|
|
14
14
|
} & {
|
|
15
15
|
valueSlider: number | number[];
|
|
16
16
|
onChangeSlider: (value: number | number[], index?: number | undefined) => void;
|
|
17
|
+
minMaxFormat?: "number" | "currency-BRL" | "percentage" | undefined;
|
|
17
18
|
} & InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>;
|
|
18
19
|
export default Slider;
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,mBAAmB,EAEpB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,mBAAmB,EAEpB,MAAM,OAAO,CAAC;AAOf,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;4FAoGX,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
|
10
|
+
var _formatNumber = require("../../shared/formatters/format-number");
|
|
11
|
+
|
|
10
12
|
var _Flex = _interopRequireDefault(require("../Flex"));
|
|
11
13
|
|
|
12
14
|
var _SliderSelector = require("./components/SliderSelector");
|
|
@@ -15,7 +17,7 @@ var _styles = require("./styles");
|
|
|
15
17
|
|
|
16
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
19
|
|
|
18
|
-
var _excluded = ["valueSlider", "onChangeSlider", "step", "max", "min", "fullSize", "direction", "valueLabelDisplay"];
|
|
20
|
+
var _excluded = ["valueSlider", "onChangeSlider", "step", "max", "min", "fullSize", "direction", "valueLabelDisplay", "minMaxFormat"];
|
|
19
21
|
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
@@ -63,6 +65,8 @@ var Slider = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
63
65
|
direction = _ref$direction === void 0 ? 'horizontal' : _ref$direction,
|
|
64
66
|
_ref$valueLabelDispla = _ref.valueLabelDisplay,
|
|
65
67
|
valueLabelDisplay = _ref$valueLabelDispla === void 0 ? 'off' : _ref$valueLabelDispla,
|
|
68
|
+
_ref$minMaxFormat = _ref.minMaxFormat,
|
|
69
|
+
minMaxFormat = _ref$minMaxFormat === void 0 ? 'number' : _ref$minMaxFormat,
|
|
66
70
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
67
71
|
|
|
68
72
|
var _useState = (0, _react.useState)(valueSlider),
|
|
@@ -107,6 +111,37 @@ var Slider = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
107
111
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
108
112
|
return sliderRef.current;
|
|
109
113
|
});
|
|
114
|
+
|
|
115
|
+
var minMaxFormatter = function minMaxFormatter() {
|
|
116
|
+
switch (minMaxFormat) {
|
|
117
|
+
case 'currency-BRL':
|
|
118
|
+
return {
|
|
119
|
+
min: (0, _formatNumber.formatCurrency)({
|
|
120
|
+
amount: min
|
|
121
|
+
}),
|
|
122
|
+
max: (0, _formatNumber.formatCurrency)({
|
|
123
|
+
amount: max
|
|
124
|
+
})
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
case 'percentage':
|
|
128
|
+
return {
|
|
129
|
+
min: "".concat(min, "%"),
|
|
130
|
+
max: "".concat(max, "%")
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
default:
|
|
134
|
+
return {
|
|
135
|
+
min: min,
|
|
136
|
+
max: max
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
var _minMaxFormatter = minMaxFormatter(),
|
|
142
|
+
formattedMin = _minMaxFormatter.min,
|
|
143
|
+
formattedMax = _minMaxFormatter.max;
|
|
144
|
+
|
|
110
145
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.SliderContent, {
|
|
111
146
|
direction: direction,
|
|
112
147
|
fullSize: fullSize,
|
|
@@ -117,9 +152,9 @@ var Slider = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
117
152
|
justifyContent: "space-between",
|
|
118
153
|
alignItems: "flex-end",
|
|
119
154
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SliderExtremesText, {
|
|
120
|
-
children:
|
|
155
|
+
children: formattedMin
|
|
121
156
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SliderExtremesText, {
|
|
122
|
-
children:
|
|
157
|
+
children: formattedMax
|
|
123
158
|
})]
|
|
124
159
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SliderSelector.SliderSelector, _objectSpread({
|
|
125
160
|
ref: sliderRef,
|
|
@@ -19,6 +19,7 @@ declare type IGenericSliderProps = {
|
|
|
19
19
|
export declare type ISliderProps = IGenericSliderProps & {
|
|
20
20
|
valueSlider: number | number[];
|
|
21
21
|
onChangeSlider: (value: number | number[], index?: number) => void;
|
|
22
|
+
minMaxFormat?: 'currency-BRL' | 'percentage' | 'number';
|
|
22
23
|
};
|
|
23
24
|
export declare type ISliderSelectorProps = IGenericSliderProps & {
|
|
24
25
|
valueSliderSelector: number | number[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,aAAK,mBAAmB,GAAG;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC/C,UAAU,CAAC,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAChC,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACtC,iBAAiB,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;CAC3D,CAAC;AAEF,oBAAY,YAAY,GAAG,mBAAmB,GAAG;IAC/C,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC/B,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Slider/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,aAAK,mBAAmB,GAAG;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC/C,UAAU,CAAC,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAChC,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACtC,iBAAiB,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;CAC3D,CAAC;AAEF,oBAAY,YAAY,GAAG,mBAAmB,GAAG;IAC/C,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC/B,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACnE,YAAY,CAAC,EAAE,cAAc,GAAG,YAAY,GAAG,QAAQ,CAAC;CACzD,CAAC;AAEF,oBAAY,oBAAoB,GAAG,mBAAmB,GAAG;IACvD,mBAAmB,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACvC,sBAAsB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACtE,CAAC;AAEF,oBAAY,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAChF,UAAU,CAAC,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC/C,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;CACvC,CAAC;AAEF,oBAAY,mBAAmB,GAAG;IAChC,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACtC,UAAU,EAAE,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;CAC/C,CAAC"}
|
|
@@ -96,7 +96,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
96
96
|
setIndicatorWidth(activeTabRef.current.offsetWidth);
|
|
97
97
|
setIndicatorLeft(activeTabRef.current.offsetLeft);
|
|
98
98
|
}
|
|
99
|
-
}, [value]);
|
|
99
|
+
}, [value, activeTabRef]);
|
|
100
100
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.TabsContainer, {
|
|
101
101
|
fullWidth: fullWidth || squeeze,
|
|
102
102
|
indicatorColor: indicatorColor,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FormatCurrency } from './types';
|
|
2
|
+
export declare function formatCurrency({ amount, currency, locale }: FormatCurrency): string;
|
|
3
|
+
export declare function formatNumber(number: string): string;
|
|
4
|
+
export declare function sanitizeNumber(number: string): string;
|
|
5
|
+
export declare function formatCurrencyWithoutSymbol(value: string): string;
|
|
6
|
+
//# sourceMappingURL=format-number.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-number.d.ts","sourceRoot":"","sources":["../../../src/shared/formatters/format-number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,QAAgB,EAAE,MAAgB,EAAE,EAAE,cAAc,UAK5F;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,UAG1C;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,UAO5C;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,UAaxD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.formatCurrency = formatCurrency;
|
|
7
|
+
exports.formatCurrencyWithoutSymbol = formatCurrencyWithoutSymbol;
|
|
8
|
+
exports.formatNumber = formatNumber;
|
|
9
|
+
exports.sanitizeNumber = sanitizeNumber;
|
|
10
|
+
|
|
11
|
+
function formatCurrency(_ref) {
|
|
12
|
+
var amount = _ref.amount,
|
|
13
|
+
_ref$currency = _ref.currency,
|
|
14
|
+
currency = _ref$currency === void 0 ? 'BRL' : _ref$currency,
|
|
15
|
+
_ref$locale = _ref.locale,
|
|
16
|
+
locale = _ref$locale === void 0 ? 'pt-BR' : _ref$locale;
|
|
17
|
+
return new Intl.NumberFormat(locale, {
|
|
18
|
+
style: 'currency',
|
|
19
|
+
currency: currency
|
|
20
|
+
}).format(amount);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function formatNumber(number) {
|
|
24
|
+
if (number) return number.replace(/[^\d.,]/g, ''); // Removes any character that is not a number, comma or dot.
|
|
25
|
+
|
|
26
|
+
return '';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function sanitizeNumber(number) {
|
|
30
|
+
return number ? number.replace(/[^\d.,]/g, '') // Removes any character that is not a number, comma or dot.
|
|
31
|
+
.replace(/(\.|,)(?=\d*(\.|,))/g, '') // Removes any dot or comma but the last one.
|
|
32
|
+
.replace(/,(\d*)$/, '.$1') // Assures the last dot or comma is a dot.
|
|
33
|
+
: '';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function formatCurrencyWithoutSymbol(value) {
|
|
37
|
+
if (value) {
|
|
38
|
+
var sanitizedNumber = sanitizeNumber(value);
|
|
39
|
+
return new Intl.NumberFormat('pt-BR', {
|
|
40
|
+
style: 'currency',
|
|
41
|
+
currency: 'BRL',
|
|
42
|
+
minimumFractionDigits: 2
|
|
43
|
+
}).format(Number(sanitizedNumber)).replace('R$', '');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shared/formatters/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|