carbon-react 125.9.1 → 125.9.3
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/esm/components/numeral-date/numeral-date.component.js +2 -3
- package/esm/components/pages/page/page.style.js +1 -2
- package/esm/components/pages/pages.component.js +2 -8
- package/esm/components/pages/pages.config.js +0 -4
- package/esm/components/pages/pages.style.js +0 -1
- package/lib/components/numeral-date/numeral-date.component.js +2 -3
- package/lib/components/pages/page/page.style.js +1 -2
- package/lib/components/pages/pages.component.js +2 -8
- package/lib/components/pages/pages.config.js +0 -4
- package/lib/components/pages/pages.style.js +0 -1
- package/package.json +1 -1
|
@@ -37,15 +37,14 @@ const validationMessages = (locale, month, daysInMonth) => ({
|
|
|
37
37
|
yyyy: locale.numeralDate.validation.year()
|
|
38
38
|
});
|
|
39
39
|
const getDaysInMonth = (month, year) => {
|
|
40
|
-
if (month
|
|
40
|
+
if (!month || +month > 12 || +month < 1) {
|
|
41
41
|
return 31;
|
|
42
42
|
}
|
|
43
43
|
const currentDate = new Date();
|
|
44
44
|
const computedYear = +(year || currentDate.getFullYear());
|
|
45
|
-
const computedMonth = +(month || currentDate.getMonth() + 1);
|
|
46
45
|
|
|
47
46
|
// passing 0 as the third argument ensures we handle for months being 0 indexed
|
|
48
|
-
return new Date(computedYear,
|
|
47
|
+
return new Date(computedYear, +month, 0).getDate();
|
|
49
48
|
};
|
|
50
49
|
const validate = (locale, {
|
|
51
50
|
dd,
|
|
@@ -3,14 +3,13 @@ import { padding } from "styled-system";
|
|
|
3
3
|
import BaseTheme from "../../../style/themes/base";
|
|
4
4
|
const StyledPage = styled.div`
|
|
5
5
|
width: 100%;
|
|
6
|
-
|
|
6
|
+
position: absolute;
|
|
7
7
|
`;
|
|
8
8
|
const StyledPageContent = styled.div`
|
|
9
9
|
${padding}
|
|
10
10
|
box-sizing: border-box;
|
|
11
11
|
width: 100%;
|
|
12
12
|
height: 100%;
|
|
13
|
-
overflow-y: auto;
|
|
14
13
|
`;
|
|
15
14
|
StyledPage.defaultProps = {
|
|
16
15
|
theme: BaseTheme
|
|
@@ -23,23 +23,17 @@ const Pages = ({
|
|
|
23
23
|
return `carousel-transition-${transition}`;
|
|
24
24
|
};
|
|
25
25
|
const handleVisiblePage = () => {
|
|
26
|
-
|
|
27
|
-
const visiblePage = React.Children.toArray(children)[index];
|
|
26
|
+
const visiblePage = React.Children.toArray(children)[pageIndex];
|
|
28
27
|
|
|
29
28
|
/* istanbul ignore if */
|
|
30
29
|
if (! /*#__PURE__*/React.isValidElement(visiblePage)) return visiblePage;
|
|
31
|
-
index = visiblePage.props.id || index;
|
|
32
30
|
const additionalProps = {
|
|
33
31
|
transitionName,
|
|
34
32
|
timeout: TRANSITION_TIME,
|
|
35
33
|
"data-element": "visible-page",
|
|
36
|
-
key: `carbon-page-${visiblePage.props.id || pageIndex}`,
|
|
37
34
|
className: visiblePage.props.className
|
|
38
35
|
};
|
|
39
|
-
return /*#__PURE__*/React.cloneElement(visiblePage,
|
|
40
|
-
...visiblePage.props,
|
|
41
|
-
...additionalProps
|
|
42
|
-
});
|
|
36
|
+
return /*#__PURE__*/React.cloneElement(visiblePage, additionalProps);
|
|
43
37
|
};
|
|
44
38
|
const numOfPages = useCallback(() => {
|
|
45
39
|
return Array.isArray(children) ? children.length : 1;
|
|
@@ -5,7 +5,6 @@ const slideAnimation = css`
|
|
|
5
5
|
.slide-next-enter {
|
|
6
6
|
opacity: 0;
|
|
7
7
|
left: 100%;
|
|
8
|
-
position: absolute;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
.slide-next-enter.slide-next-enter-active {
|
|
@@ -17,7 +16,6 @@ const slideAnimation = css`
|
|
|
17
16
|
.slide-next-exit {
|
|
18
17
|
opacity: 1;
|
|
19
18
|
left: 0;
|
|
20
|
-
position: relative;
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
.slide-next-exit.slide-next-exit-active {
|
|
@@ -30,7 +28,6 @@ const slideAnimation = css`
|
|
|
30
28
|
.slide-previous-enter {
|
|
31
29
|
opacity: 0;
|
|
32
30
|
left: -100%;
|
|
33
|
-
position: absolute;
|
|
34
31
|
}
|
|
35
32
|
|
|
36
33
|
.slide-previous-enter.slide-previous-enter-active {
|
|
@@ -42,7 +39,6 @@ const slideAnimation = css`
|
|
|
42
39
|
.slide-previous-exit {
|
|
43
40
|
opacity: 1;
|
|
44
41
|
left: 0;
|
|
45
|
-
position: relative;
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
.slide-previous-exit.slide-previous-exit-active {
|
|
@@ -46,15 +46,14 @@ const validationMessages = (locale, month, daysInMonth) => ({
|
|
|
46
46
|
yyyy: locale.numeralDate.validation.year()
|
|
47
47
|
});
|
|
48
48
|
const getDaysInMonth = (month, year) => {
|
|
49
|
-
if (month
|
|
49
|
+
if (!month || +month > 12 || +month < 1) {
|
|
50
50
|
return 31;
|
|
51
51
|
}
|
|
52
52
|
const currentDate = new Date();
|
|
53
53
|
const computedYear = +(year || currentDate.getFullYear());
|
|
54
|
-
const computedMonth = +(month || currentDate.getMonth() + 1);
|
|
55
54
|
|
|
56
55
|
// passing 0 as the third argument ensures we handle for months being 0 indexed
|
|
57
|
-
return new Date(computedYear,
|
|
56
|
+
return new Date(computedYear, +month, 0).getDate();
|
|
58
57
|
};
|
|
59
58
|
const validate = (locale, {
|
|
60
59
|
dd,
|
|
@@ -10,14 +10,13 @@ var _base = _interopRequireDefault(require("../../../style/themes/base"));
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
const StyledPage = exports.StyledPage = _styledComponents.default.div`
|
|
12
12
|
width: 100%;
|
|
13
|
-
|
|
13
|
+
position: absolute;
|
|
14
14
|
`;
|
|
15
15
|
const StyledPageContent = exports.StyledPageContent = _styledComponents.default.div`
|
|
16
16
|
${_styledSystem.padding}
|
|
17
17
|
box-sizing: border-box;
|
|
18
18
|
width: 100%;
|
|
19
19
|
height: 100%;
|
|
20
|
-
overflow-y: auto;
|
|
21
20
|
`;
|
|
22
21
|
StyledPage.defaultProps = {
|
|
23
22
|
theme: _base.default
|
|
@@ -38,23 +38,17 @@ const Pages = ({
|
|
|
38
38
|
return `carousel-transition-${transition}`;
|
|
39
39
|
};
|
|
40
40
|
const handleVisiblePage = () => {
|
|
41
|
-
|
|
42
|
-
const visiblePage = _react.default.Children.toArray(children)[index];
|
|
41
|
+
const visiblePage = _react.default.Children.toArray(children)[pageIndex];
|
|
43
42
|
|
|
44
43
|
/* istanbul ignore if */
|
|
45
44
|
if (! /*#__PURE__*/_react.default.isValidElement(visiblePage)) return visiblePage;
|
|
46
|
-
index = visiblePage.props.id || index;
|
|
47
45
|
const additionalProps = {
|
|
48
46
|
transitionName,
|
|
49
47
|
timeout: TRANSITION_TIME,
|
|
50
48
|
"data-element": "visible-page",
|
|
51
|
-
key: `carbon-page-${visiblePage.props.id || pageIndex}`,
|
|
52
49
|
className: visiblePage.props.className
|
|
53
50
|
};
|
|
54
|
-
return /*#__PURE__*/_react.default.cloneElement(visiblePage,
|
|
55
|
-
...visiblePage.props,
|
|
56
|
-
...additionalProps
|
|
57
|
-
});
|
|
51
|
+
return /*#__PURE__*/_react.default.cloneElement(visiblePage, additionalProps);
|
|
58
52
|
};
|
|
59
53
|
const numOfPages = (0, _react.useCallback)(() => {
|
|
60
54
|
return Array.isArray(children) ? children.length : 1;
|
|
@@ -11,7 +11,6 @@ const slideAnimation = exports.slideAnimation = (0, _styledComponents.css)`
|
|
|
11
11
|
.slide-next-enter {
|
|
12
12
|
opacity: 0;
|
|
13
13
|
left: 100%;
|
|
14
|
-
position: absolute;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
.slide-next-enter.slide-next-enter-active {
|
|
@@ -23,7 +22,6 @@ const slideAnimation = exports.slideAnimation = (0, _styledComponents.css)`
|
|
|
23
22
|
.slide-next-exit {
|
|
24
23
|
opacity: 1;
|
|
25
24
|
left: 0;
|
|
26
|
-
position: relative;
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
.slide-next-exit.slide-next-exit-active {
|
|
@@ -36,7 +34,6 @@ const slideAnimation = exports.slideAnimation = (0, _styledComponents.css)`
|
|
|
36
34
|
.slide-previous-enter {
|
|
37
35
|
opacity: 0;
|
|
38
36
|
left: -100%;
|
|
39
|
-
position: absolute;
|
|
40
37
|
}
|
|
41
38
|
|
|
42
39
|
.slide-previous-enter.slide-previous-enter-active {
|
|
@@ -48,7 +45,6 @@ const slideAnimation = exports.slideAnimation = (0, _styledComponents.css)`
|
|
|
48
45
|
.slide-previous-exit {
|
|
49
46
|
opacity: 1;
|
|
50
47
|
left: 0;
|
|
51
|
-
position: relative;
|
|
52
48
|
}
|
|
53
49
|
|
|
54
50
|
.slide-previous-exit.slide-previous-exit-active {
|
|
@@ -23,7 +23,6 @@ const PagesContent = exports.PagesContent = _styledComponents.default.div`
|
|
|
23
23
|
`;
|
|
24
24
|
const PagesWrapperStyle = exports.PagesWrapperStyle = _styledComponents.default.div`
|
|
25
25
|
.carbon-carousel__content {
|
|
26
|
-
overflow: hidden;
|
|
27
26
|
position: relative;
|
|
28
27
|
}
|
|
29
28
|
${_pages.slideAnimation}
|