carbon-react 149.0.2 → 150.0.0
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/date/__internal__/date-fns-fp/index.d.ts +7 -7
- package/esm/components/date/__internal__/date-fns-fp/index.js +7 -7
- package/esm/components/date/__internal__/date-formats/index.d.ts +1 -1
- package/esm/components/date/__internal__/date-formats/index.js +2 -3
- package/esm/components/date/__internal__/date-picker/date-picker.component.js +1 -10
- package/esm/components/date/__internal__/utils.d.ts +1 -1
- package/esm/locales/de-de.js +1 -1
- package/esm/locales/en-ca.js +1 -1
- package/esm/locales/en-gb.js +1 -1
- package/esm/locales/en-us.js +1 -1
- package/esm/locales/es-es.js +1 -1
- package/esm/locales/fr-ca.js +1 -1
- package/esm/locales/fr-fr.js +1 -1
- package/lib/components/date/__internal__/date-fns-fp/index.d.ts +7 -7
- package/lib/components/date/__internal__/date-fns-fp/index.js +14 -15
- package/lib/components/date/__internal__/date-formats/index.d.ts +1 -1
- package/lib/components/date/__internal__/date-formats/index.js +2 -3
- package/lib/components/date/__internal__/date-picker/date-picker.component.js +1 -10
- package/lib/components/date/__internal__/utils.d.ts +1 -1
- package/lib/locales/de-de.js +2 -3
- package/lib/locales/en-ca.js +2 -3
- package/lib/locales/en-gb.js +2 -3
- package/lib/locales/en-us.js +2 -3
- package/lib/locales/es-es.js +2 -3
- package/lib/locales/fr-ca.js +2 -3
- package/lib/locales/fr-fr.js +2 -3
- package/package.json +2 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
1
|
+
export { format } from "date-fns/fp/format";
|
|
2
|
+
export { formatISO } from "date-fns/fp/formatISO";
|
|
3
|
+
export { isMatch } from "date-fns/fp/isMatch";
|
|
4
|
+
export { isValid } from "date-fns/fp/isValid";
|
|
5
|
+
export { parse } from "date-fns/fp/parse";
|
|
6
|
+
export { parseWithOptions } from "date-fns/fp/parseWithOptions";
|
|
7
|
+
export { parseISO } from "date-fns/fp/parseISO";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Separate index.ts to export only required sub-modules from date-fns/fp
|
|
2
2
|
// import { format, formatISO, isMatch, parse, parseISO } from "date-fns/fp" adds extra 300kb to bundle size.
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
3
|
+
export { format } from "date-fns/fp/format";
|
|
4
|
+
export { formatISO } from "date-fns/fp/formatISO";
|
|
5
|
+
export { isMatch } from "date-fns/fp/isMatch";
|
|
6
|
+
export { isValid } from "date-fns/fp/isValid";
|
|
7
|
+
export { parse } from "date-fns/fp/parse";
|
|
8
|
+
export { parseWithOptions } from "date-fns/fp/parseWithOptions";
|
|
9
|
+
export { parseISO } from "date-fns/fp/parseISO";
|
|
@@ -3,5 +3,5 @@ interface LocaleFormats {
|
|
|
3
3
|
formats: string[];
|
|
4
4
|
format: string;
|
|
5
5
|
}
|
|
6
|
-
declare const getFormatData: (
|
|
6
|
+
declare const getFormatData: (locale?: Partial<Pick<DateFnsLocale, "code">>, dateFormatOverride?: string) => LocaleFormats;
|
|
7
7
|
export default getFormatData;
|
|
@@ -70,9 +70,8 @@ const getTrailingChar = format => {
|
|
|
70
70
|
const lastChar = format.split("").pop();
|
|
71
71
|
return ["y", "M", "d"].includes(lastChar) ? "" : lastChar;
|
|
72
72
|
};
|
|
73
|
-
const getFormatData = ({
|
|
74
|
-
code = "en-GB"
|
|
75
|
-
}, dateFormatOverride) => {
|
|
73
|
+
const getFormatData = (locale, dateFormatOverride) => {
|
|
74
|
+
const code = locale?.code || "en-GB";
|
|
76
75
|
if (dateFormatOverride) {
|
|
77
76
|
const {
|
|
78
77
|
format
|
|
@@ -40,12 +40,6 @@ export const DatePicker = ({
|
|
|
40
40
|
const {
|
|
41
41
|
weekStartsOn
|
|
42
42
|
} = options || /* istanbul ignore next */{};
|
|
43
|
-
const monthsLong = useMemo(() => Array.from({
|
|
44
|
-
length: 12
|
|
45
|
-
}).map((_, i) => {
|
|
46
|
-
const month = localize?.month(i);
|
|
47
|
-
return month[0].toUpperCase() + month.slice(1);
|
|
48
|
-
}), [localize]);
|
|
49
43
|
const weekdaysLong = useMemo(() => Array.from({
|
|
50
44
|
length: 7
|
|
51
45
|
}).map((_, i) => localize?.day(i)), [localize]);
|
|
@@ -156,10 +150,7 @@ export const DatePicker = ({
|
|
|
156
150
|
disabled: getDisabledDays(minDate, maxDate),
|
|
157
151
|
locale: {
|
|
158
152
|
localize: {
|
|
159
|
-
...defaultLocale.localize
|
|
160
|
-
months: monthsLong,
|
|
161
|
-
weekdaysLong,
|
|
162
|
-
weekdaysShort
|
|
153
|
+
...defaultLocale.localize
|
|
163
154
|
}
|
|
164
155
|
},
|
|
165
156
|
selected: selectedDays,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Matcher } from "react-day-picker";
|
|
1
|
+
import type { Locale, Matcher } from "react-day-picker";
|
|
2
2
|
export declare function isValidLocaleDate(date: string, locale: Locale): boolean;
|
|
3
3
|
export declare function parseDate(formatString?: string, valueString?: string): Date | undefined;
|
|
4
4
|
export declare function isDateValid(date?: Date): boolean | undefined;
|
package/esm/locales/de-de.js
CHANGED
package/esm/locales/en-ca.js
CHANGED
package/esm/locales/en-gb.js
CHANGED
package/esm/locales/en-us.js
CHANGED
package/esm/locales/es-es.js
CHANGED
package/esm/locales/fr-ca.js
CHANGED
package/esm/locales/fr-fr.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
1
|
+
export { format } from "date-fns/fp/format";
|
|
2
|
+
export { formatISO } from "date-fns/fp/formatISO";
|
|
3
|
+
export { isMatch } from "date-fns/fp/isMatch";
|
|
4
|
+
export { isValid } from "date-fns/fp/isValid";
|
|
5
|
+
export { parse } from "date-fns/fp/parse";
|
|
6
|
+
export { parseWithOptions } from "date-fns/fp/parseWithOptions";
|
|
7
|
+
export { parseISO } from "date-fns/fp/parseISO";
|
|
@@ -6,50 +6,49 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "format", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return _format.
|
|
9
|
+
return _format.format;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "formatISO", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return _formatISO.
|
|
15
|
+
return _formatISO.formatISO;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "isMatch", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
21
|
-
return _isMatch.
|
|
21
|
+
return _isMatch.isMatch;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "isValid", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function () {
|
|
27
|
-
return _isValid.
|
|
27
|
+
return _isValid.isValid;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "parse", {
|
|
31
31
|
enumerable: true,
|
|
32
32
|
get: function () {
|
|
33
|
-
return _parse.
|
|
33
|
+
return _parse.parse;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "parseISO", {
|
|
37
37
|
enumerable: true,
|
|
38
38
|
get: function () {
|
|
39
|
-
return _parseISO.
|
|
39
|
+
return _parseISO.parseISO;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "parseWithOptions", {
|
|
43
43
|
enumerable: true,
|
|
44
44
|
get: function () {
|
|
45
|
-
return _parseWithOptions.
|
|
45
|
+
return _parseWithOptions.parseWithOptions;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
var _format =
|
|
49
|
-
var _formatISO =
|
|
50
|
-
var _isMatch =
|
|
51
|
-
var _isValid =
|
|
52
|
-
var _parse =
|
|
53
|
-
var _parseWithOptions =
|
|
54
|
-
var _parseISO =
|
|
55
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
48
|
+
var _format = require("date-fns/fp/format");
|
|
49
|
+
var _formatISO = require("date-fns/fp/formatISO");
|
|
50
|
+
var _isMatch = require("date-fns/fp/isMatch");
|
|
51
|
+
var _isValid = require("date-fns/fp/isValid");
|
|
52
|
+
var _parse = require("date-fns/fp/parse");
|
|
53
|
+
var _parseWithOptions = require("date-fns/fp/parseWithOptions");
|
|
54
|
+
var _parseISO = require("date-fns/fp/parseISO");
|
|
@@ -3,5 +3,5 @@ interface LocaleFormats {
|
|
|
3
3
|
formats: string[];
|
|
4
4
|
format: string;
|
|
5
5
|
}
|
|
6
|
-
declare const getFormatData: (
|
|
6
|
+
declare const getFormatData: (locale?: Partial<Pick<DateFnsLocale, "code">>, dateFormatOverride?: string) => LocaleFormats;
|
|
7
7
|
export default getFormatData;
|
|
@@ -76,9 +76,8 @@ const getTrailingChar = format => {
|
|
|
76
76
|
const lastChar = format.split("").pop();
|
|
77
77
|
return ["y", "M", "d"].includes(lastChar) ? "" : lastChar;
|
|
78
78
|
};
|
|
79
|
-
const getFormatData = ({
|
|
80
|
-
code = "en-GB"
|
|
81
|
-
}, dateFormatOverride) => {
|
|
79
|
+
const getFormatData = (locale, dateFormatOverride) => {
|
|
80
|
+
const code = locale?.code || "en-GB";
|
|
82
81
|
if (dateFormatOverride) {
|
|
83
82
|
const {
|
|
84
83
|
format
|
|
@@ -49,12 +49,6 @@ const DatePicker = ({
|
|
|
49
49
|
const {
|
|
50
50
|
weekStartsOn
|
|
51
51
|
} = options || /* istanbul ignore next */{};
|
|
52
|
-
const monthsLong = (0, _react.useMemo)(() => Array.from({
|
|
53
|
-
length: 12
|
|
54
|
-
}).map((_, i) => {
|
|
55
|
-
const month = localize?.month(i);
|
|
56
|
-
return month[0].toUpperCase() + month.slice(1);
|
|
57
|
-
}), [localize]);
|
|
58
52
|
const weekdaysLong = (0, _react.useMemo)(() => Array.from({
|
|
59
53
|
length: 7
|
|
60
54
|
}).map((_, i) => localize?.day(i)), [localize]);
|
|
@@ -165,10 +159,7 @@ const DatePicker = ({
|
|
|
165
159
|
disabled: (0, _utils.getDisabledDays)(minDate, maxDate),
|
|
166
160
|
locale: {
|
|
167
161
|
localize: {
|
|
168
|
-
..._reactDayPicker.defaultLocale.localize
|
|
169
|
-
months: monthsLong,
|
|
170
|
-
weekdaysLong,
|
|
171
|
-
weekdaysShort
|
|
162
|
+
..._reactDayPicker.defaultLocale.localize
|
|
172
163
|
}
|
|
173
164
|
},
|
|
174
165
|
selected: selectedDays,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Matcher } from "react-day-picker";
|
|
1
|
+
import type { Locale, Matcher } from "react-day-picker";
|
|
2
2
|
export declare function isValidLocaleDate(date: string, locale: Locale): boolean;
|
|
3
3
|
export declare function parseDate(formatString?: string, valueString?: string): Date | undefined;
|
|
4
4
|
export declare function isDateValid(date?: Date): boolean | undefined;
|
package/lib/locales/de-de.js
CHANGED
|
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _de =
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
var _de = require("date-fns/locale/de");
|
|
9
8
|
const isSingular = count => (typeof count === "string" ? parseInt(count) : count) === 1;
|
|
10
9
|
const deDE = {
|
|
11
10
|
locale: () => "de-DE",
|
|
@@ -37,7 +36,7 @@ const deDE = {
|
|
|
37
36
|
visuallyHiddenHint: formattedCount => `Sie können bis zu ${formattedCount} Zeichen eingeben.`
|
|
38
37
|
},
|
|
39
38
|
date: {
|
|
40
|
-
dateFnsLocale: () => _de.
|
|
39
|
+
dateFnsLocale: () => _de.de,
|
|
41
40
|
ariaLabels: {
|
|
42
41
|
previousMonthButton: () => "Vorheriger Monat",
|
|
43
42
|
nextMonthButton: () => "Nächster Monat"
|
package/lib/locales/en-ca.js
CHANGED
|
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _enCA =
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
var _enCA = require("date-fns/locale/en-CA");
|
|
9
8
|
const enCA = {
|
|
10
9
|
locale: () => "en-CA",
|
|
11
10
|
date: {
|
|
12
|
-
dateFnsLocale: () => _enCA.
|
|
11
|
+
dateFnsLocale: () => _enCA.enCA,
|
|
13
12
|
ariaLabels: {
|
|
14
13
|
previousMonthButton: () => "Previous month",
|
|
15
14
|
nextMonthButton: () => "Next month"
|
package/lib/locales/en-gb.js
CHANGED
|
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _enGB =
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
var _enGB = require("date-fns/locale/en-GB");
|
|
9
8
|
const isSingular = count => (typeof count === "string" ? parseInt(count) : count) === 1;
|
|
10
9
|
const enGB = {
|
|
11
10
|
locale: () => "en-GB",
|
|
@@ -37,7 +36,7 @@ const enGB = {
|
|
|
37
36
|
visuallyHiddenHint: formattedCount => `You can enter up to ${formattedCount} characters`
|
|
38
37
|
},
|
|
39
38
|
date: {
|
|
40
|
-
dateFnsLocale: () => _enGB.
|
|
39
|
+
dateFnsLocale: () => _enGB.enGB,
|
|
41
40
|
ariaLabels: {
|
|
42
41
|
previousMonthButton: () => "Previous month",
|
|
43
42
|
nextMonthButton: () => "Next month"
|
package/lib/locales/en-us.js
CHANGED
|
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _enUS =
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
var _enUS = require("date-fns/locale/en-US");
|
|
9
8
|
const enUS = {
|
|
10
9
|
locale: () => "en-US",
|
|
11
10
|
date: {
|
|
12
|
-
dateFnsLocale: () => _enUS.
|
|
11
|
+
dateFnsLocale: () => _enUS.enUS,
|
|
13
12
|
ariaLabels: {
|
|
14
13
|
previousMonthButton: () => "Previous month",
|
|
15
14
|
nextMonthButton: () => "Next month"
|
package/lib/locales/es-es.js
CHANGED
|
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _es =
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
var _es = require("date-fns/locale/es");
|
|
9
8
|
const isSingular = count => (typeof count === "string" ? parseInt(count) : count) === 1;
|
|
10
9
|
const esES = {
|
|
11
10
|
locale: () => "es-ES",
|
|
@@ -37,7 +36,7 @@ const esES = {
|
|
|
37
36
|
visuallyHiddenHint: formattedCount => `Puedes introducir hasta ${formattedCount} caracteres.`
|
|
38
37
|
},
|
|
39
38
|
date: {
|
|
40
|
-
dateFnsLocale: () => _es.
|
|
39
|
+
dateFnsLocale: () => _es.es,
|
|
41
40
|
ariaLabels: {
|
|
42
41
|
previousMonthButton: () => "Mes anterior",
|
|
43
42
|
nextMonthButton: () => "Mes siguiente"
|
package/lib/locales/fr-ca.js
CHANGED
|
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _frCA =
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
var _frCA = require("date-fns/locale/fr-CA");
|
|
9
8
|
const isSingular = count => (typeof count === "string" ? parseInt(count) : count) === 1;
|
|
10
9
|
const frCA = {
|
|
11
10
|
locale: () => "fr-CA",
|
|
@@ -37,7 +36,7 @@ const frCA = {
|
|
|
37
36
|
visuallyHiddenHint: formattedCount => `vous pouvez saisir jusqu'à ${formattedCount} caractères.`
|
|
38
37
|
},
|
|
39
38
|
date: {
|
|
40
|
-
dateFnsLocale: () => _frCA.
|
|
39
|
+
dateFnsLocale: () => _frCA.frCA,
|
|
41
40
|
ariaLabels: {
|
|
42
41
|
previousMonthButton: () => "Mois précédent",
|
|
43
42
|
nextMonthButton: () => "Mois suivant"
|
package/lib/locales/fr-fr.js
CHANGED
|
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _fr =
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
var _fr = require("date-fns/locale/fr");
|
|
9
8
|
const isSingular = count => (typeof count === "string" ? parseInt(count) : count) === 1;
|
|
10
9
|
const frFR = {
|
|
11
10
|
locale: () => "fr-FR",
|
|
@@ -37,7 +36,7 @@ const frFR = {
|
|
|
37
36
|
visuallyHiddenHint: formattedCount => `vous pouvez saisir jusqu'à ${formattedCount} caractères.`
|
|
38
37
|
},
|
|
39
38
|
date: {
|
|
40
|
-
dateFnsLocale: () => _fr.
|
|
39
|
+
dateFnsLocale: () => _fr.fr,
|
|
41
40
|
ariaLabels: {
|
|
42
41
|
previousMonthButton: () => "Mois précédent",
|
|
43
42
|
nextMonthButton: () => "Mois suivant"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "150.0.0",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -116,7 +116,6 @@
|
|
|
116
116
|
"core-js": "^3.33.3",
|
|
117
117
|
"css-loader": "^6.8.1",
|
|
118
118
|
"cz-conventional-changelog": "^3.3.0",
|
|
119
|
-
"date-fns-tz": "^1.3.8",
|
|
120
119
|
"dayjs": "^1.11.10",
|
|
121
120
|
"eslint": "^8.55.0",
|
|
122
121
|
"eslint-config-airbnb": "^19.0.0",
|
|
@@ -179,7 +178,7 @@
|
|
|
179
178
|
"chalk": "^4.1.2",
|
|
180
179
|
"classnames": "~2.3.2",
|
|
181
180
|
"crypto-js": "^4.2.0",
|
|
182
|
-
"date-fns": "^
|
|
181
|
+
"date-fns": "^4.1.0",
|
|
183
182
|
"immutable": "~3.8.2",
|
|
184
183
|
"invariant": "^2.2.4",
|
|
185
184
|
"lexical": "^0.21.0",
|