@carbon/utilities 0.18.0 → 0.19.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.
@@ -1,2 +1,2 @@
1
- import { a as InitCarousel, i as Config, n as CarouselResponse, o as TranslationKey, r as CarouselStackHistory, t as initCarousel } from "../chunk-DPUOAfLB.js";
1
+ import { a as InitCarousel, i as Config, n as CarouselResponse, o as TranslationKey, r as CarouselStackHistory, t as initCarousel } from "../chunk-BxtJV719.js";
2
2
  export { CarouselResponse, CarouselStackHistory, Config, InitCarousel, TranslationKey, initCarousel };
@@ -1,3 +1,2 @@
1
- import { t as initCarousel } from "../chunk-Ci2WlFE4.js";
2
-
3
- export { initCarousel };
1
+ import { t as initCarousel } from "../chunk-DMEZ3h3f.js";
2
+ export { initCarousel };
@@ -45,4 +45,10 @@ declare function formatRange(startDate: Date | number, endDate: Date | number, o
45
45
  timeZone: Intl.DateTimeFormatOptions['timeZone'];
46
46
  }>): string;
47
47
  //#endregion
48
- export { relative_d_exports as n, absolute_d_exports as t };
48
+ //#region src/dateTimeFormat/index.d.ts
49
+ declare const dateTimeFormat: {
50
+ relative: typeof relative_d_exports;
51
+ absolute: typeof absolute_d_exports;
52
+ };
53
+ //#endregion
54
+ export { dateTimeFormat as t };
@@ -1,5 +1,4 @@
1
- import { t as __exportAll } from "./chunk-BYypO7fO.js";
2
-
1
+ import { t as __exportAll } from "./chunk-pbuEa-1d.js";
3
2
  //#region src/dateTimeFormat/relative.ts
4
3
  var relative_exports = /* @__PURE__ */ __exportAll({ format: () => format$1 });
5
4
  /**
@@ -11,8 +10,7 @@ var relative_exports = /* @__PURE__ */ __exportAll({ format: () => format$1 });
11
10
  function format$1(date, options) {
12
11
  const rtf = new Intl.RelativeTimeFormat(options?.locale, { style: options?.style ?? "long" });
13
12
  const d = typeof date === "number" ? new Date(date) : date;
14
- const now = Date.now();
15
- const seconds = Math.floor((now - d.getTime()) / 1e3);
13
+ const seconds = Math.floor((Date.now() - d.getTime()) / 1e3);
16
14
  const minutes = Math.floor(seconds / 60);
17
15
  const hours = Math.floor(minutes / 60);
18
16
  const days = Math.floor(hours / 24);
@@ -30,7 +28,6 @@ function format$1(date, options) {
30
28
  if (Math.abs(days) < 365) return rtf.format(months * -1, "months");
31
29
  return rtf.format(years * -1, "years");
32
30
  }
33
-
34
31
  //#endregion
35
32
  //#region src/dateTimeFormat/absolute.ts
36
33
  var absolute_exports = /* @__PURE__ */ __exportAll({
@@ -75,6 +72,17 @@ function formatRange(startDate, endDate, options) {
75
72
  timeZone: options?.timeZone
76
73
  }).formatRange(startDate, endDate);
77
74
  }
78
-
79
75
  //#endregion
80
- export { relative_exports as n, absolute_exports as t };
76
+ //#region src/dateTimeFormat/index.ts
77
+ /**
78
+ * Copyright IBM Corp. 2024
79
+ *
80
+ * This source code is licensed under the Apache-2.0 license found in the
81
+ * LICENSE file in the root directory of this source tree.
82
+ */
83
+ const dateTimeFormat = {
84
+ relative: relative_exports,
85
+ absolute: absolute_exports
86
+ };
87
+ //#endregion
88
+ export { dateTimeFormat as t };
@@ -9,7 +9,6 @@ const translationIds = {
9
9
  "carbon.carousel.item": "carbon.carousel.item",
10
10
  "carbon.carousel.of": "carbon.carousel.of"
11
11
  };
12
-
13
12
  //#endregion
14
13
  //#region src/carousel/swipeEvents.ts
15
14
  /**
@@ -89,7 +88,6 @@ const registerSwipeEvents = (carousel, next, prev, destroy) => {
89
88
  carousel.addEventListener("mouseup", mouseUpHandler);
90
89
  carousel.addEventListener("wheel", wheelHandler);
91
90
  };
92
-
93
91
  //#endregion
94
92
  //#region src/carousel/carousel.ts
95
93
  const defaultTranslations = {
@@ -432,6 +430,5 @@ const initCarousel = (carouselContainer, config) => {
432
430
  allViews: refs
433
431
  };
434
432
  };
435
-
436
433
  //#endregion
437
- export { initCarousel as t };
434
+ export { initCarousel as t };
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };
@@ -16,6 +16,5 @@ const datePartsOrder = {
16
16
  getMonthYearOrder,
17
17
  isMonthFirst
18
18
  };
19
-
20
19
  //#endregion
21
- export { datePartsOrder };
20
+ export { datePartsOrder };
@@ -1,9 +1,2 @@
1
- import { n as relative_d_exports, t as absolute_d_exports } from "../chunk-Bzxox1sl.js";
2
-
3
- //#region src/dateTimeFormat/index.d.ts
4
- declare const dateTimeFormat: {
5
- relative: typeof relative_d_exports;
6
- absolute: typeof absolute_d_exports;
7
- };
8
- //#endregion
1
+ import { t as dateTimeFormat } from "../chunk-BIOsKtwb.js";
9
2
  export { dateTimeFormat };
@@ -1,16 +1,2 @@
1
- import { n as relative_exports, t as absolute_exports } from "../chunk-CYAX4TFi.js";
2
-
3
- //#region src/dateTimeFormat/index.ts
4
- /**
5
- * Copyright IBM Corp. 2024
6
- *
7
- * This source code is licensed under the Apache-2.0 license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
- const dateTimeFormat = {
11
- relative: relative_exports,
12
- absolute: absolute_exports
13
- };
14
-
15
- //#endregion
16
- export { dateTimeFormat };
1
+ import { t as dateTimeFormat } from "../chunk-D7jICOmO.js";
2
+ export { dateTimeFormat };
@@ -64,6 +64,5 @@ function subscribeDocumentLangChange(callback) {
64
64
  if (subscribers.length === 0) observerInitialized = false;
65
65
  };
66
66
  }
67
-
68
67
  //#endregion
69
- export { getDocumentLang, subscribeDocumentLangChange };
68
+ export { getDocumentLang, subscribeDocumentLangChange };
package/es/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as InitCarousel, i as Config, n as CarouselResponse, o as TranslationKey, r as CarouselStackHistory, t as initCarousel } from "./chunk-DPUOAfLB.js";
1
+ import { a as InitCarousel, i as Config, n as CarouselResponse, o as TranslationKey, r as CarouselStackHistory, t as initCarousel } from "./chunk-BxtJV719.js";
2
2
  import { datePartsOrder } from "./datePartsOrder/index.js";
3
- import { dateTimeFormat } from "./dateTimeFormat/index.js";
3
+ import { t as dateTimeFormat } from "./chunk-BIOsKtwb.js";
4
4
  import { getDocumentLang, subscribeDocumentLangChange } from "./documentLang/index.js";
5
5
  import { makeDraggable } from "./makeDraggable/index.js";
6
6
  import { OverflowHandler, OverflowHandlerOptions, UpdateOverflowHandlerOptions, createOverflowHandler, getSize, updateOverflowHandler } from "./overflowHandler/index.js";
package/es/index.js CHANGED
@@ -1,10 +1,8 @@
1
- import { t as initCarousel } from "./chunk-Ci2WlFE4.js";
1
+ import { t as initCarousel } from "./chunk-DMEZ3h3f.js";
2
2
  import { datePartsOrder } from "./datePartsOrder/index.js";
3
- import { dateTimeFormat } from "./dateTimeFormat/index.js";
3
+ import { t as dateTimeFormat } from "./chunk-D7jICOmO.js";
4
4
  import { getDocumentLang, subscribeDocumentLangChange } from "./documentLang/index.js";
5
5
  import { makeDraggable } from "./makeDraggable/index.js";
6
6
  import { createOverflowHandler, getSize, updateOverflowHandler } from "./overflowHandler/index.js";
7
-
8
- export * from "@internationalized/number"
9
-
10
- export { createOverflowHandler, datePartsOrder, dateTimeFormat, getDocumentLang, getSize, initCarousel, makeDraggable, subscribeDocumentLangChange, updateOverflowHandler };
7
+ export * from "@internationalized/number";
8
+ export { createOverflowHandler, datePartsOrder, dateTimeFormat, getDocumentLang, getSize, initCarousel, makeDraggable, subscribeDocumentLangChange, updateOverflowHandler };
@@ -143,6 +143,5 @@ const makeDraggable = ({ el, dragHandle, focusableDragHandle, dragStep, shiftDra
143
143
  init
144
144
  };
145
145
  };
146
-
147
146
  //#endregion
148
- export { makeDraggable };
147
+ export { makeDraggable };
@@ -90,6 +90,5 @@ function createOverflowHandler({ container, maxVisibleItems, onChange, dimension
90
90
  resizeObserver.disconnect();
91
91
  } };
92
92
  }
93
-
94
93
  //#endregion
95
- export { createOverflowHandler, getSize, updateOverflowHandler };
94
+ export { createOverflowHandler, getSize, updateOverflowHandler };
@@ -1,4 +1,3 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_carousel = require('../chunk-C5VBwGBG.js');
3
-
4
- exports.initCarousel = require_carousel.initCarousel;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_carousel = require("../chunk-DVu1wdA8.js");
3
+ exports.initCarousel = require_carousel.initCarousel;
@@ -2,20 +2,14 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __exportAll = (all, no_symbols) => {
4
4
  let target = {};
5
- for (var name in all) {
6
- __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
10
- }
11
- if (!no_symbols) {
12
- __defProp(target, Symbol.toStringTag, { value: "Module" });
13
- }
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
14
10
  return target;
15
11
  };
16
-
17
12
  //#endregion
18
-
19
13
  //#region src/dateTimeFormat/relative.ts
20
14
  var relative_exports = /* @__PURE__ */ __exportAll({ format: () => format$1 });
21
15
  /**
@@ -27,8 +21,7 @@ var relative_exports = /* @__PURE__ */ __exportAll({ format: () => format$1 });
27
21
  function format$1(date, options) {
28
22
  const rtf = new Intl.RelativeTimeFormat(options?.locale, { style: options?.style ?? "long" });
29
23
  const d = typeof date === "number" ? new Date(date) : date;
30
- const now = Date.now();
31
- const seconds = Math.floor((now - d.getTime()) / 1e3);
24
+ const seconds = Math.floor((Date.now() - d.getTime()) / 1e3);
32
25
  const minutes = Math.floor(seconds / 60);
33
26
  const hours = Math.floor(minutes / 60);
34
27
  const days = Math.floor(hours / 24);
@@ -46,7 +39,6 @@ function format$1(date, options) {
46
39
  if (Math.abs(days) < 365) return rtf.format(months * -1, "months");
47
40
  return rtf.format(years * -1, "years");
48
41
  }
49
-
50
42
  //#endregion
51
43
  //#region src/dateTimeFormat/absolute.ts
52
44
  var absolute_exports = /* @__PURE__ */ __exportAll({
@@ -91,17 +83,22 @@ function formatRange(startDate, endDate, options) {
91
83
  timeZone: options?.timeZone
92
84
  }).formatRange(startDate, endDate);
93
85
  }
94
-
95
86
  //#endregion
96
- Object.defineProperty(exports, 'absolute_exports', {
97
- enumerable: true,
98
- get: function () {
99
- return absolute_exports;
100
- }
87
+ //#region src/dateTimeFormat/index.ts
88
+ /**
89
+ * Copyright IBM Corp. 2024
90
+ *
91
+ * This source code is licensed under the Apache-2.0 license found in the
92
+ * LICENSE file in the root directory of this source tree.
93
+ */
94
+ const dateTimeFormat = {
95
+ relative: relative_exports,
96
+ absolute: absolute_exports
97
+ };
98
+ //#endregion
99
+ Object.defineProperty(exports, "dateTimeFormat", {
100
+ enumerable: true,
101
+ get: function() {
102
+ return dateTimeFormat;
103
+ }
101
104
  });
102
- Object.defineProperty(exports, 'relative_exports', {
103
- enumerable: true,
104
- get: function () {
105
- return relative_exports;
106
- }
107
- });
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/carousel/defs.ts
3
2
  /**
4
3
  * Copyright IBM Corp. 2026
@@ -10,7 +9,6 @@ const translationIds = {
10
9
  "carbon.carousel.item": "carbon.carousel.item",
11
10
  "carbon.carousel.of": "carbon.carousel.of"
12
11
  };
13
-
14
12
  //#endregion
15
13
  //#region src/carousel/swipeEvents.ts
16
14
  /**
@@ -90,7 +88,6 @@ const registerSwipeEvents = (carousel, next, prev, destroy) => {
90
88
  carousel.addEventListener("mouseup", mouseUpHandler);
91
89
  carousel.addEventListener("wheel", wheelHandler);
92
90
  };
93
-
94
91
  //#endregion
95
92
  //#region src/carousel/carousel.ts
96
93
  const defaultTranslations = {
@@ -433,11 +430,10 @@ const initCarousel = (carouselContainer, config) => {
433
430
  allViews: refs
434
431
  };
435
432
  };
436
-
437
433
  //#endregion
438
- Object.defineProperty(exports, 'initCarousel', {
439
- enumerable: true,
440
- get: function () {
441
- return initCarousel;
442
- }
443
- });
434
+ Object.defineProperty(exports, "initCarousel", {
435
+ enumerable: true,
436
+ get: function() {
437
+ return initCarousel;
438
+ }
439
+ });
@@ -1,5 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
2
  //#region src/datePartsOrder/datePartsOrder.ts
4
3
  const _orderCache = /* @__PURE__ */ new Map();
5
4
  function getMonthYearOrder(locale) {
@@ -18,6 +17,5 @@ const datePartsOrder = {
18
17
  getMonthYearOrder,
19
18
  isMonthFirst
20
19
  };
21
-
22
20
  //#endregion
23
- exports.datePartsOrder = datePartsOrder;
21
+ exports.datePartsOrder = datePartsOrder;
@@ -1,17 +1,3 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_absolute = require('../chunk-Dc0mzKQx.js');
3
-
4
- //#region src/dateTimeFormat/index.ts
5
- /**
6
- * Copyright IBM Corp. 2024
7
- *
8
- * This source code is licensed under the Apache-2.0 license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */
11
- const dateTimeFormat = {
12
- relative: require_absolute.relative_exports,
13
- absolute: require_absolute.absolute_exports
14
- };
15
-
16
- //#endregion
17
- exports.dateTimeFormat = dateTimeFormat;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_dateTimeFormat = require("../chunk-D5n0j0X6.js");
3
+ exports.dateTimeFormat = require_dateTimeFormat.dateTimeFormat;
@@ -1,5 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
2
  //#region src/documentLang/documentLang.ts
4
3
  /**
5
4
  * Copyright IBM Corp. 2025
@@ -66,7 +65,6 @@ function subscribeDocumentLangChange(callback) {
66
65
  if (subscribers.length === 0) observerInitialized = false;
67
66
  };
68
67
  }
69
-
70
68
  //#endregion
71
69
  exports.getDocumentLang = getDocumentLang;
72
- exports.subscribeDocumentLangChange = subscribeDocumentLangChange;
70
+ exports.subscribeDocumentLangChange = subscribeDocumentLangChange;
package/lib/index.js CHANGED
@@ -1,14 +1,13 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_carousel = require('./chunk-C5VBwGBG.js');
3
- const require_datePartsOrder_index = require('./datePartsOrder/index.js');
4
- const require_dateTimeFormat_index = require('./dateTimeFormat/index.js');
5
- const require_documentLang_index = require('./documentLang/index.js');
6
- const require_makeDraggable_index = require('./makeDraggable/index.js');
7
- const require_overflowHandler_index = require('./overflowHandler/index.js');
8
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_dateTimeFormat = require("./chunk-D5n0j0X6.js");
3
+ const require_carousel = require("./chunk-DVu1wdA8.js");
4
+ const require_datePartsOrder_index = require("./datePartsOrder/index.js");
5
+ const require_documentLang_index = require("./documentLang/index.js");
6
+ const require_makeDraggable_index = require("./makeDraggable/index.js");
7
+ const require_overflowHandler_index = require("./overflowHandler/index.js");
9
8
  exports.createOverflowHandler = require_overflowHandler_index.createOverflowHandler;
10
9
  exports.datePartsOrder = require_datePartsOrder_index.datePartsOrder;
11
- exports.dateTimeFormat = require_dateTimeFormat_index.dateTimeFormat;
10
+ exports.dateTimeFormat = require_dateTimeFormat.dateTimeFormat;
12
11
  exports.getDocumentLang = require_documentLang_index.getDocumentLang;
13
12
  exports.getSize = require_overflowHandler_index.getSize;
14
13
  exports.initCarousel = require_carousel.initCarousel;
@@ -16,9 +15,11 @@ exports.makeDraggable = require_makeDraggable_index.makeDraggable;
16
15
  exports.subscribeDocumentLangChange = require_documentLang_index.subscribeDocumentLangChange;
17
16
  exports.updateOverflowHandler = require_overflowHandler_index.updateOverflowHandler;
18
17
  var _internationalized_number = require("@internationalized/number");
19
- Object.keys(_internationalized_number).forEach(function (k) {
20
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
21
- enumerable: true,
22
- get: function () { return _internationalized_number[k]; }
23
- });
18
+ Object.keys(_internationalized_number).forEach(function(k) {
19
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
20
+ enumerable: true,
21
+ get: function() {
22
+ return _internationalized_number[k];
23
+ }
24
+ });
24
25
  });
@@ -1,5 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
2
  //#region src/makeDraggable/makeDraggable.ts
4
3
  /**
5
4
  * Makes a given element draggable using a handle element.
@@ -145,6 +144,5 @@ const makeDraggable = ({ el, dragHandle, focusableDragHandle, dragStep, shiftDra
145
144
  init
146
145
  };
147
146
  };
148
-
149
147
  //#endregion
150
- exports.makeDraggable = makeDraggable;
148
+ exports.makeDraggable = makeDraggable;
@@ -1,5 +1,4 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
2
  //#region src/overflowHandler/overflowHandler.ts
4
3
  /**
5
4
  * Copyright IBM Corp. 2025, 2026
@@ -92,8 +91,7 @@ function createOverflowHandler({ container, maxVisibleItems, onChange, dimension
92
91
  resizeObserver.disconnect();
93
92
  } };
94
93
  }
95
-
96
94
  //#endregion
97
95
  exports.createOverflowHandler = createOverflowHandler;
98
96
  exports.getSize = getSize;
99
- exports.updateOverflowHandler = updateOverflowHandler;
97
+ exports.updateOverflowHandler = updateOverflowHandler;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/utilities",
3
3
  "description": "Utilities and helpers to drive consistency across software products using the Carbon Design System",
4
- "version": "0.18.0",
4
+ "version": "0.19.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -59,12 +59,12 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "rimraf": "^6.0.1",
62
- "tsdown": "^0.20.3",
62
+ "tsdown": "^0.21.0",
63
63
  "typescript-config-carbon": "^0.9.0"
64
64
  },
65
65
  "dependencies": {
66
66
  "@ibm/telemetry-js": "^1.6.1",
67
67
  "@internationalized/number": "^3.6.1"
68
68
  },
69
- "gitHead": "aeaaa31889990fc76c7e0e8a29ec0bf96ce33f82"
69
+ "gitHead": "5e89339998bd16c8ddd42e1cc6a2d0c15b3b0af5"
70
70
  }
@@ -1,18 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __defProp = Object.defineProperty;
3
- var __exportAll = (all, no_symbols) => {
4
- let target = {};
5
- for (var name in all) {
6
- __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
10
- }
11
- if (!no_symbols) {
12
- __defProp(target, Symbol.toStringTag, { value: "Module" });
13
- }
14
- return target;
15
- };
16
-
17
- //#endregion
18
- export { __exportAll as t };
File without changes