carbon-react 133.2.0 → 134.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ export { default as format } from "date-fns/fp/format";
2
+ export { default as formatISO } from "date-fns/fp/formatISO";
3
+ export { default as isMatch } from "date-fns/fp/isMatch";
4
+ export { default as parse } from "date-fns/fp/parse";
5
+ export { default as parseISO } from "date-fns/fp/parseISO";
@@ -0,0 +1,7 @@
1
+ // Separate index.ts to export only required sub-modules from date-fns/fp
2
+ // import { format, formatISO, isMatch, parse, parseISO } from "date-fns/fp" adds extra 300kb to bundle size.
3
+ export { default as format } from "date-fns/fp/format";
4
+ export { default as formatISO } from "date-fns/fp/formatISO";
5
+ export { default as isMatch } from "date-fns/fp/isMatch";
6
+ export { default as parse } from "date-fns/fp/parse";
7
+ export { default as parseISO } from "date-fns/fp/parseISO";
@@ -1,4 +1,4 @@
1
- import { format, formatISO, isMatch, parse, parseISO } from "date-fns/fp";
1
+ import { format, formatISO, isMatch, parse, parseISO } from "./date-fns-fp";
2
2
  const DATE_STRING_LENGTH = 10;
3
3
  const THRESHOLD_FOR_ADDITIONAL_YEARS = 69;
4
4
  export function parseDate(formatString, valueString) {
@@ -137,7 +137,7 @@ const SimpleSelect = /*#__PURE__*/React.forwardRef(({
137
137
  if (readOnly) {
138
138
  return;
139
139
  }
140
- if (key === "Enter" || key === " " || isNavigationKey(key)) {
140
+ if (key === " " || isNavigationKey(key)) {
141
141
  event.preventDefault();
142
142
  setOpenState(isAlreadyOpen => {
143
143
  if (!isAlreadyOpen && onOpen) {
@@ -1,4 +1,4 @@
1
- import { es as esDateLocale } from "../date-fns-locales";
1
+ import esDateLocale from "date-fns/locale/es";
2
2
  const isSingular = count => (typeof count === "string" ? parseInt(count) : count) === 1;
3
3
  const esES = {
4
4
  locale: () => "es-ES",
@@ -1,4 +1,4 @@
1
- import { enGB as enGBDateLocale } from "./date-fns-locales";
1
+ import enGBDateLocale from "date-fns/locale/en-GB";
2
2
  const isSingular = count => (typeof count === "string" ? parseInt(count) : count) === 1;
3
3
  const enGB = {
4
4
  locale: () => "en-GB",
@@ -0,0 +1,5 @@
1
+ export { default as format } from "date-fns/fp/format";
2
+ export { default as formatISO } from "date-fns/fp/formatISO";
3
+ export { default as isMatch } from "date-fns/fp/isMatch";
4
+ export { default as parse } from "date-fns/fp/parse";
5
+ export { default as parseISO } from "date-fns/fp/parseISO";
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "format", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _format.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "formatISO", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _formatISO.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "isMatch", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _isMatch.default;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "parse", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _parse.default;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "parseISO", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _parseISO.default;
34
+ }
35
+ });
36
+ var _format = _interopRequireDefault(require("date-fns/fp/format"));
37
+ var _formatISO = _interopRequireDefault(require("date-fns/fp/formatISO"));
38
+ var _isMatch = _interopRequireDefault(require("date-fns/fp/isMatch"));
39
+ var _parse = _interopRequireDefault(require("date-fns/fp/parse"));
40
+ var _parseISO = _interopRequireDefault(require("date-fns/fp/parseISO"));
41
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "../../../../../esm/components/date/__internal__/date-fns-fp/index.js",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts"
6
+ }
@@ -13,12 +13,12 @@ exports.getSeparator = void 0;
13
13
  exports.isDateValid = isDateValid;
14
14
  exports.parseDate = parseDate;
15
15
  exports.parseISODate = parseISODate;
16
- var _fp = require("date-fns/fp");
16
+ var _dateFnsFp = require("./date-fns-fp");
17
17
  const DATE_STRING_LENGTH = 10;
18
18
  const THRESHOLD_FOR_ADDITIONAL_YEARS = 69;
19
19
  function parseDate(formatString, valueString) {
20
20
  if (!valueString || !formatString) return undefined;
21
- return (0, _fp.parse)(new Date(), formatString, valueString);
21
+ return (0, _dateFnsFp.parse)(new Date(), formatString, valueString);
22
22
  }
23
23
  function isDateValid(date) {
24
24
  return date && date.toString() !== "Invalid Date";
@@ -28,18 +28,18 @@ function formatToISO(formatString, valueString) {
28
28
  if (!dateValue || !isDateValid(dateValue)) {
29
29
  return null;
30
30
  }
31
- return (0, _fp.formatISO)(dateValue).split("T")[0];
31
+ return (0, _dateFnsFp.formatISO)(dateValue).split("T")[0];
32
32
  }
33
33
  function formattedValue(formatString, value) {
34
34
  if (!value) return "";
35
- return (0, _fp.format)(formatString, value);
35
+ return (0, _dateFnsFp.format)(formatString, value);
36
36
  }
37
37
  function hasMatchedFormat(formatString, valueString, fullFormat, fullValue) {
38
38
  if (formatString.includes("d")) {
39
- return formatString.length === valueString.length && (0, _fp.isMatch)(fullFormat.join("."), fullValue.join(".")) // need to check day value with month value
39
+ return formatString.length === valueString.length && (0, _dateFnsFp.isMatch)(fullFormat.join("."), fullValue.join(".")) // need to check day value with month value
40
40
  ;
41
41
  }
42
- return formatString.length === valueString.length && (0, _fp.isMatch)(formatString, valueString);
42
+ return formatString.length === valueString.length && (0, _dateFnsFp.isMatch)(formatString, valueString);
43
43
  }
44
44
  function additionalYears(formatString, value) {
45
45
  if (formatString.split("y").length - 1 !== 2) {
@@ -123,7 +123,7 @@ function findMatchedFormatAndValue(valueString, formats) {
123
123
  return matchedFormatAndValue;
124
124
  }
125
125
  function parseISODate(value) {
126
- return (0, _fp.parseISO)(value);
126
+ return (0, _dateFnsFp.parseISO)(value);
127
127
  }
128
128
  function isValidISODate(dateString) {
129
129
  return parseISODate(dateString).toString() !== "Invalid Date";
@@ -146,7 +146,7 @@ const SimpleSelect = exports.SimpleSelect = /*#__PURE__*/_react.default.forwardR
146
146
  if (readOnly) {
147
147
  return;
148
148
  }
149
- if (key === "Enter" || key === " " || (0, _isNavigationKey.default)(key)) {
149
+ if (key === " " || (0, _isNavigationKey.default)(key)) {
150
150
  event.preventDefault();
151
151
  setOpenState(isAlreadyOpen => {
152
152
  if (!isAlreadyOpen && onOpen) {
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _dateFnsLocales = require("../date-fns-locales");
7
+ var _es = _interopRequireDefault(require("date-fns/locale/es"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
9
  const isSingular = count => (typeof count === "string" ? parseInt(count) : count) === 1;
9
10
  const esES = {
10
11
  locale: () => "es-ES",
@@ -36,7 +37,7 @@ const esES = {
36
37
  visuallyHiddenHint: formattedCount => `Puede introducir hasta ${formattedCount} caracteres`
37
38
  },
38
39
  date: {
39
- dateFnsLocale: () => _dateFnsLocales.es,
40
+ dateFnsLocale: () => _es.default,
40
41
  ariaLabels: {
41
42
  previousMonthButton: () => "Mes anterior",
42
43
  nextMonthButton: () => "Próximo mes"
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _dateFnsLocales = require("./date-fns-locales");
7
+ var _enGB = _interopRequireDefault(require("date-fns/locale/en-GB"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
9
  const isSingular = count => (typeof count === "string" ? parseInt(count) : count) === 1;
9
10
  const enGB = {
10
11
  locale: () => "en-GB",
@@ -36,7 +37,7 @@ const enGB = {
36
37
  visuallyHiddenHint: formattedCount => `You can enter up to ${formattedCount} characters`
37
38
  },
38
39
  date: {
39
- dateFnsLocale: () => _dateFnsLocales.enGB,
40
+ dateFnsLocale: () => _enGB.default,
40
41
  ariaLabels: {
41
42
  previousMonthButton: () => "Previous month",
42
43
  nextMonthButton: () => "Next month"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "133.2.0",
3
+ "version": "134.0.1",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",
@@ -24,7 +24,6 @@
24
24
  "build-storybook": "cross-env STORYBOOK_BUILD=true storybook build -c .storybook",
25
25
  "start-storybook": "cross-env STORYBOOK_BUILD=true storybook dev -c .storybook",
26
26
  "start:static": "npx http-server -p 9001 ./storybook-static",
27
- "babel": "cross-env NODE_ENV=production babel ./src --config-file ./babel.config.js --out-dir ./lib --ignore '**/*.spec.js','**/*.spec.ts','**/*.spec.tsx','**/*.d.ts' --quiet --extensions '.js','.ts','.tsx'",
28
27
  "clean-lib": "rimraf ./lib && rimraf ./esm",
29
28
  "commit": "git-cz",
30
29
  "generate-metadata": "node ./scripts/generate_metadata/index.mjs",
@@ -134,13 +133,14 @@
134
133
  "eslint-config-prettier": "^9.1.0",
135
134
  "eslint-plugin-import": "^2.29.0",
136
135
  "eslint-plugin-jest": "^27.6.0",
137
- "eslint-plugin-jest-dom": "^5.1.0",
136
+ "eslint-plugin-jest-dom": "^5.2.0",
138
137
  "eslint-plugin-jsx-a11y": "^6.8.0",
139
138
  "eslint-plugin-mdx": "^3.0.0",
140
139
  "eslint-plugin-no-unsanitized": "^4.0.2",
141
140
  "eslint-plugin-playwright": "^1.6.0",
142
141
  "eslint-plugin-react": "^7.33.2",
143
142
  "eslint-plugin-react-hooks": "^4.6.0",
143
+ "eslint-plugin-testing-library": "^6.2.2",
144
144
  "events": "~1.1.1",
145
145
  "fast-glob": "^3.3.2",
146
146
  "file-loader": "^6.2.0",
@@ -1 +0,0 @@
1
- export * from "date-fns/locale";
@@ -1 +0,0 @@
1
- export * from "date-fns/locale";
@@ -1 +0,0 @@
1
- export * from "date-fns/locale";
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _locale = require("date-fns/locale");
7
- Object.keys(_locale).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _locale[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _locale[key];
14
- }
15
- });
16
- });
@@ -1,6 +0,0 @@
1
- {
2
- "sideEffects": false,
3
- "module": "../../../esm/locales/date-fns-locales/index.js",
4
- "main": "./index.js",
5
- "types": "./index.d.ts"
6
- }