@carbon/utilities 0.22.0 → 0.23.0-rc.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/es/carousel/index.js +1 -1
- package/es/{chunk-B_oT5GVP.d.ts → chunk-BM9VKOZL.d.ts} +18 -4
- package/es/{chunk-8mMgI_GR.js → chunk-CiIbGkCJ.js} +5 -2
- package/es/{chunk-WCnoMKEo.js → chunk-FIO0zxct.js} +18 -5
- package/es/dateTimeFormat/index.d.ts +1 -1
- package/es/dateTimeFormat/index.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +2 -2
- package/lib/carousel/index.js +1 -1
- package/lib/{chunk-BE34e-3u.js → chunk-CiWS_vRH.js} +5 -2
- package/lib/{chunk-Cd3Qp242.js → chunk-p1LIk_vZ.js} +18 -5
- package/lib/dateTimeFormat/index.js +1 -1
- package/lib/index.js +2 -2
- package/package.json +2 -2
package/es/carousel/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as initCarousel } from "../chunk-
|
|
1
|
+
import { t as initCarousel } from "../chunk-CiIbGkCJ.js";
|
|
2
2
|
export { initCarousel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare namespace relative_d_exports {
|
|
2
|
-
export { format$
|
|
2
|
+
export { format$2 as format };
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
5
5
|
* Copyright IBM Corp. 2024
|
|
@@ -7,12 +7,12 @@ declare namespace relative_d_exports {
|
|
|
7
7
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
declare function format$
|
|
10
|
+
declare function format$2(date: Date | number, options?: Partial<{
|
|
11
11
|
locale: string;
|
|
12
12
|
style: Intl.RelativeTimeFormatStyle;
|
|
13
13
|
}>): string;
|
|
14
14
|
declare namespace absolute_d_exports {
|
|
15
|
-
export { format, formatDate, formatRange, formatTime };
|
|
15
|
+
export { format$1 as format, formatDate, formatRange, formatTime };
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Copyright IBM Corp. 2024, 2025
|
|
@@ -30,7 +30,7 @@ declare function formatDate(date: Date | number, options?: Partial<{
|
|
|
30
30
|
style: Intl.DateTimeFormatOptions['dateStyle'];
|
|
31
31
|
timeZone: Intl.DateTimeFormatOptions['timeZone'];
|
|
32
32
|
}>): string;
|
|
33
|
-
declare function format(date: Date | number, options?: Partial<{
|
|
33
|
+
declare function format$1(date: Date | number, options?: Partial<{
|
|
34
34
|
locale: string;
|
|
35
35
|
style: Intl.DateTimeFormatOptions['timeStyle'] | 'tooltip';
|
|
36
36
|
timeStyle: Intl.DateTimeFormatOptions['timeStyle'];
|
|
@@ -44,11 +44,25 @@ declare function formatRange(startDate: Date | number, endDate: Date | number, o
|
|
|
44
44
|
dateStyle: Intl.DateTimeFormatOptions['dateStyle'] | null;
|
|
45
45
|
timeZone: Intl.DateTimeFormatOptions['timeZone'];
|
|
46
46
|
}>): string;
|
|
47
|
+
declare namespace duration_d_exports {
|
|
48
|
+
export { format };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Copyright IBM Corp. 2026
|
|
52
|
+
*
|
|
53
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
54
|
+
* LICENSE file in the root directory of this source tree.
|
|
55
|
+
*/
|
|
56
|
+
declare function format(duration: Partial<Record<Intl.DurationFormatUnit, number>>, options?: Partial<{
|
|
57
|
+
locale: string;
|
|
58
|
+
style: Intl.DurationFormatOptions['style'];
|
|
59
|
+
}>): string;
|
|
47
60
|
//#endregion
|
|
48
61
|
//#region src/dateTimeFormat/index.d.ts
|
|
49
62
|
declare const dateTimeFormat: {
|
|
50
63
|
relative: typeof relative_d_exports;
|
|
51
64
|
absolute: typeof absolute_d_exports;
|
|
65
|
+
duration: typeof duration_d_exports;
|
|
52
66
|
};
|
|
53
67
|
//#endregion
|
|
54
68
|
export { dateTimeFormat as t };
|
|
@@ -300,7 +300,9 @@ const initCarousel = (carouselContainer, config) => {
|
|
|
300
300
|
const stackIndexInstanceCount = previousViewIndexStack.filter((viIdx) => viIdx === index).length;
|
|
301
301
|
const isBeingRecycledOut = previousViewIndexStack.length > viewIndexStack.length && previousViewIndexStack[0] === index && stackIndexInstanceCount > 0;
|
|
302
302
|
const isBeingRecycledIn = previousViewIndexStack.length < viewIndexStack.length && previousViewIndexStack[0] === index && stackIndexInstanceCount > 0;
|
|
303
|
-
|
|
303
|
+
const isInViewStack = stackIndex > -1;
|
|
304
|
+
const isActive = index === viewIndexStack[0];
|
|
305
|
+
attachClassNames(viewItem, isInViewStack, isActive, isBeingRecycledOut, isBeingRecycledIn);
|
|
304
306
|
if (isInitial) {
|
|
305
307
|
registerRef(index, viewItem);
|
|
306
308
|
setTimeout(() => {
|
|
@@ -335,7 +337,8 @@ const initCarousel = (carouselContainer, config) => {
|
|
|
335
337
|
* @returns {void} - This function does not return any value.
|
|
336
338
|
*/
|
|
337
339
|
const navigateNext = () => {
|
|
338
|
-
|
|
340
|
+
const targetViewIndex = viewIndexStack[0] + 1;
|
|
341
|
+
transitionToViewIndex(targetViewIndex);
|
|
339
342
|
};
|
|
340
343
|
/**
|
|
341
344
|
* Navigates to the previous view in the view stack.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-D7D4PA-g.js";
|
|
2
2
|
//#region src/dateTimeFormat/relative.ts
|
|
3
|
-
var relative_exports = /* @__PURE__ */ __exportAll({ format: () => format$
|
|
3
|
+
var relative_exports = /* @__PURE__ */ __exportAll({ format: () => format$2 });
|
|
4
4
|
/**
|
|
5
5
|
* Copyright IBM Corp. 2024
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
|
-
function format$
|
|
10
|
+
function format$2(date, options) {
|
|
11
11
|
const rtf = new Intl.RelativeTimeFormat(options?.locale, { style: options?.style ?? "long" });
|
|
12
12
|
const d = typeof date === "number" ? new Date(date) : date;
|
|
13
13
|
const seconds = Math.floor((Date.now() - d.getTime()) / 1e3);
|
|
@@ -31,7 +31,7 @@ function format$1(date, options) {
|
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region src/dateTimeFormat/absolute.ts
|
|
33
33
|
var absolute_exports = /* @__PURE__ */ __exportAll({
|
|
34
|
-
format: () => format,
|
|
34
|
+
format: () => format$1,
|
|
35
35
|
formatDate: () => formatDate,
|
|
36
36
|
formatRange: () => formatRange,
|
|
37
37
|
formatTime: () => formatTime
|
|
@@ -54,7 +54,7 @@ function formatDate(date, options) {
|
|
|
54
54
|
timeZone: options?.timeZone
|
|
55
55
|
}).format(date);
|
|
56
56
|
}
|
|
57
|
-
function format(date, options) {
|
|
57
|
+
function format$1(date, options) {
|
|
58
58
|
const timeStyle = options?.timeStyle ?? (options?.style === "tooltip" ? "long" : options?.style) ?? "short";
|
|
59
59
|
const dateStyle = options?.dateStyle ?? (options?.style === "tooltip" ? "full" : options?.style) ?? "medium";
|
|
60
60
|
return new Intl.DateTimeFormat(options?.locale, {
|
|
@@ -73,6 +73,18 @@ function formatRange(startDate, endDate, options) {
|
|
|
73
73
|
}).formatRange(startDate, endDate);
|
|
74
74
|
}
|
|
75
75
|
//#endregion
|
|
76
|
+
//#region src/dateTimeFormat/duration.ts
|
|
77
|
+
var duration_exports = /* @__PURE__ */ __exportAll({ format: () => format });
|
|
78
|
+
/**
|
|
79
|
+
* Copyright IBM Corp. 2026
|
|
80
|
+
*
|
|
81
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
82
|
+
* LICENSE file in the root directory of this source tree.
|
|
83
|
+
*/
|
|
84
|
+
function format(duration, options) {
|
|
85
|
+
return new Intl.DurationFormat(options?.locale, { style: options?.style ?? "narrow" }).format(duration);
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
76
88
|
//#region src/dateTimeFormat/index.ts
|
|
77
89
|
/**
|
|
78
90
|
* Copyright IBM Corp. 2024
|
|
@@ -82,7 +94,8 @@ function formatRange(startDate, endDate, options) {
|
|
|
82
94
|
*/
|
|
83
95
|
const dateTimeFormat = {
|
|
84
96
|
relative: relative_exports,
|
|
85
|
-
absolute: absolute_exports
|
|
97
|
+
absolute: absolute_exports,
|
|
98
|
+
duration: duration_exports
|
|
86
99
|
};
|
|
87
100
|
//#endregion
|
|
88
101
|
export { dateTimeFormat as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as dateTimeFormat } from "../chunk-
|
|
1
|
+
import { t as dateTimeFormat } from "../chunk-BM9VKOZL.js";
|
|
2
2
|
export { dateTimeFormat };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as dateTimeFormat } from "../chunk-
|
|
1
|
+
import { t as dateTimeFormat } from "../chunk-FIO0zxct.js";
|
|
2
2
|
export { dateTimeFormat };
|
package/es/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as InitCarousel, i as Config, n as CarouselResponse, o as TranslationKey, r as CarouselStackHistory, t as initCarousel } from "./chunk-DHHCmWMn.js";
|
|
2
2
|
import { datePartsOrder } from "./datePartsOrder/index.js";
|
|
3
|
-
import { t as dateTimeFormat } from "./chunk-
|
|
3
|
+
import { t as dateTimeFormat } from "./chunk-BM9VKOZL.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,6 +1,6 @@
|
|
|
1
|
-
import { t as initCarousel } from "./chunk-
|
|
1
|
+
import { t as initCarousel } from "./chunk-CiIbGkCJ.js";
|
|
2
2
|
import { datePartsOrder } from "./datePartsOrder/index.js";
|
|
3
|
-
import { t as dateTimeFormat } from "./chunk-
|
|
3
|
+
import { t as dateTimeFormat } from "./chunk-FIO0zxct.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";
|
package/lib/carousel/index.js
CHANGED
|
@@ -300,7 +300,9 @@ const initCarousel = (carouselContainer, config) => {
|
|
|
300
300
|
const stackIndexInstanceCount = previousViewIndexStack.filter((viIdx) => viIdx === index).length;
|
|
301
301
|
const isBeingRecycledOut = previousViewIndexStack.length > viewIndexStack.length && previousViewIndexStack[0] === index && stackIndexInstanceCount > 0;
|
|
302
302
|
const isBeingRecycledIn = previousViewIndexStack.length < viewIndexStack.length && previousViewIndexStack[0] === index && stackIndexInstanceCount > 0;
|
|
303
|
-
|
|
303
|
+
const isInViewStack = stackIndex > -1;
|
|
304
|
+
const isActive = index === viewIndexStack[0];
|
|
305
|
+
attachClassNames(viewItem, isInViewStack, isActive, isBeingRecycledOut, isBeingRecycledIn);
|
|
304
306
|
if (isInitial) {
|
|
305
307
|
registerRef(index, viewItem);
|
|
306
308
|
setTimeout(() => {
|
|
@@ -335,7 +337,8 @@ const initCarousel = (carouselContainer, config) => {
|
|
|
335
337
|
* @returns {void} - This function does not return any value.
|
|
336
338
|
*/
|
|
337
339
|
const navigateNext = () => {
|
|
338
|
-
|
|
340
|
+
const targetViewIndex = viewIndexStack[0] + 1;
|
|
341
|
+
transitionToViewIndex(targetViewIndex);
|
|
339
342
|
};
|
|
340
343
|
/**
|
|
341
344
|
* Navigates to the previous view in the view stack.
|
|
@@ -11,14 +11,14 @@ var __exportAll = (all, no_symbols) => {
|
|
|
11
11
|
};
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/dateTimeFormat/relative.ts
|
|
14
|
-
var relative_exports = /* @__PURE__ */ __exportAll({ format: () => format$
|
|
14
|
+
var relative_exports = /* @__PURE__ */ __exportAll({ format: () => format$2 });
|
|
15
15
|
/**
|
|
16
16
|
* Copyright IBM Corp. 2024
|
|
17
17
|
*
|
|
18
18
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
19
19
|
* LICENSE file in the root directory of this source tree.
|
|
20
20
|
*/
|
|
21
|
-
function format$
|
|
21
|
+
function format$2(date, options) {
|
|
22
22
|
const rtf = new Intl.RelativeTimeFormat(options?.locale, { style: options?.style ?? "long" });
|
|
23
23
|
const d = typeof date === "number" ? new Date(date) : date;
|
|
24
24
|
const seconds = Math.floor((Date.now() - d.getTime()) / 1e3);
|
|
@@ -42,7 +42,7 @@ function format$1(date, options) {
|
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/dateTimeFormat/absolute.ts
|
|
44
44
|
var absolute_exports = /* @__PURE__ */ __exportAll({
|
|
45
|
-
format: () => format,
|
|
45
|
+
format: () => format$1,
|
|
46
46
|
formatDate: () => formatDate,
|
|
47
47
|
formatRange: () => formatRange,
|
|
48
48
|
formatTime: () => formatTime
|
|
@@ -65,7 +65,7 @@ function formatDate(date, options) {
|
|
|
65
65
|
timeZone: options?.timeZone
|
|
66
66
|
}).format(date);
|
|
67
67
|
}
|
|
68
|
-
function format(date, options) {
|
|
68
|
+
function format$1(date, options) {
|
|
69
69
|
const timeStyle = options?.timeStyle ?? (options?.style === "tooltip" ? "long" : options?.style) ?? "short";
|
|
70
70
|
const dateStyle = options?.dateStyle ?? (options?.style === "tooltip" ? "full" : options?.style) ?? "medium";
|
|
71
71
|
return new Intl.DateTimeFormat(options?.locale, {
|
|
@@ -84,6 +84,18 @@ function formatRange(startDate, endDate, options) {
|
|
|
84
84
|
}).formatRange(startDate, endDate);
|
|
85
85
|
}
|
|
86
86
|
//#endregion
|
|
87
|
+
//#region src/dateTimeFormat/duration.ts
|
|
88
|
+
var duration_exports = /* @__PURE__ */ __exportAll({ format: () => format });
|
|
89
|
+
/**
|
|
90
|
+
* Copyright IBM Corp. 2026
|
|
91
|
+
*
|
|
92
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
93
|
+
* LICENSE file in the root directory of this source tree.
|
|
94
|
+
*/
|
|
95
|
+
function format(duration, options) {
|
|
96
|
+
return new Intl.DurationFormat(options?.locale, { style: options?.style ?? "narrow" }).format(duration);
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
87
99
|
//#region src/dateTimeFormat/index.ts
|
|
88
100
|
/**
|
|
89
101
|
* Copyright IBM Corp. 2024
|
|
@@ -93,7 +105,8 @@ function formatRange(startDate, endDate, options) {
|
|
|
93
105
|
*/
|
|
94
106
|
const dateTimeFormat = {
|
|
95
107
|
relative: relative_exports,
|
|
96
|
-
absolute: absolute_exports
|
|
108
|
+
absolute: absolute_exports,
|
|
109
|
+
duration: duration_exports
|
|
97
110
|
};
|
|
98
111
|
//#endregion
|
|
99
112
|
Object.defineProperty(exports, "dateTimeFormat", {
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_dateTimeFormat = require("./chunk-
|
|
3
|
-
const require_carousel = require("./chunk-
|
|
2
|
+
const require_dateTimeFormat = require("./chunk-p1LIk_vZ.js");
|
|
3
|
+
const require_carousel = require("./chunk-CiWS_vRH.js");
|
|
4
4
|
const require_datePartsOrder_index = require("./datePartsOrder/index.js");
|
|
5
5
|
const require_documentLang_index = require("./documentLang/index.js");
|
|
6
6
|
const require_makeDraggable_index = require("./makeDraggable/index.js");
|
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.
|
|
4
|
+
"version": "0.23.0-rc.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"@ibm/telemetry-js": "^1.6.1",
|
|
67
67
|
"@internationalized/number": "^3.6.1"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "a1848fc28d503f5f1cea72516f946d9140cd6399"
|
|
70
70
|
}
|