@carbon/react 1.97.0-rc.0 → 1.98.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/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1010 -975
- package/es/components/ButtonSet/ButtonSet.d.ts +5 -0
- package/es/components/ButtonSet/ButtonSet.js +68 -4
- package/es/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/es/components/ComposedModal/ComposedModal.js +3 -2
- package/es/components/Copy/Copy.d.ts +1 -1
- package/es/components/CopyButton/CopyButton.d.ts +1 -1
- package/es/components/DataTable/DataTable.d.ts +2 -1
- package/es/components/DataTable/TableContainer.d.ts +10 -2
- package/es/components/DataTable/TableContainer.js +15 -3
- package/es/components/DataTable/state/sorting.d.ts +2 -4
- package/es/components/DataTableSkeleton/DataTableSkeleton.d.ts +1 -1
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +1 -1
- package/es/components/DatePicker/DatePicker.d.ts +3 -2
- package/es/components/DatePicker/DatePicker.js +18 -135
- package/es/components/DatePicker/DatePickerLocales.d.ts +12 -0
- package/es/components/DatePicker/DatePickerLocales.js +135 -0
- package/es/components/DatePickerInput/DatePickerInput.js +50 -28
- package/es/components/Dropdown/Dropdown.js +9 -1
- package/es/components/FileUploader/FileUploader.d.ts +23 -8
- package/es/components/FileUploader/FileUploader.js +53 -33
- package/es/components/FileUploader/FileUploaderButton.js +2 -2
- package/es/components/FileUploader/FileUploaderDropContainer.d.ts +13 -2
- package/es/components/FileUploader/FileUploaderDropContainer.js +15 -6
- package/es/components/FileUploader/FileUploaderItem.js +9 -6
- package/es/components/Menu/index.d.ts +4 -3
- package/es/components/Modal/Modal.js +3 -2
- package/es/components/Notification/Notification.js +3 -2
- package/es/components/Pagination/Pagination.js +5 -5
- package/es/components/Popover/index.js +2 -2
- package/es/components/Select/Select.js +27 -33
- package/es/components/Toggletip/index.d.ts +1 -0
- package/es/components/Toggletip/index.js +1 -1
- package/es/components/Tooltip/index.d.ts +3 -2
- package/es/internal/FloatingMenu.js +8 -6
- package/es/internal/OptimizedResize.js +4 -5
- package/es/internal/wrapFocus.d.ts +4 -2
- package/es/internal/wrapFocus.js +5 -4
- package/es/tools/events.d.ts +1 -1
- package/lib/components/ButtonSet/ButtonSet.d.ts +5 -0
- package/lib/components/ButtonSet/ButtonSet.js +67 -3
- package/lib/components/CodeSnippet/CodeSnippet.d.ts +1 -1
- package/lib/components/ComposedModal/ComposedModal.js +3 -2
- package/lib/components/Copy/Copy.d.ts +1 -1
- package/lib/components/CopyButton/CopyButton.d.ts +1 -1
- package/lib/components/DataTable/DataTable.d.ts +2 -1
- package/lib/components/DataTable/TableContainer.d.ts +10 -2
- package/lib/components/DataTable/TableContainer.js +15 -3
- package/lib/components/DataTable/state/sorting.d.ts +2 -4
- package/lib/components/DataTableSkeleton/DataTableSkeleton.d.ts +1 -1
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +1 -1
- package/lib/components/DatePicker/DatePicker.d.ts +3 -2
- package/lib/components/DatePicker/DatePicker.js +18 -135
- package/lib/components/DatePicker/DatePickerLocales.d.ts +12 -0
- package/lib/components/DatePicker/DatePickerLocales.js +137 -0
- package/lib/components/DatePickerInput/DatePickerInput.js +49 -27
- package/lib/components/Dropdown/Dropdown.js +9 -1
- package/lib/components/FileUploader/FileUploader.d.ts +23 -8
- package/lib/components/FileUploader/FileUploader.js +53 -33
- package/lib/components/FileUploader/FileUploaderButton.js +2 -2
- package/lib/components/FileUploader/FileUploaderDropContainer.d.ts +13 -2
- package/lib/components/FileUploader/FileUploaderDropContainer.js +15 -6
- package/lib/components/FileUploader/FileUploaderItem.js +9 -6
- package/lib/components/Menu/index.d.ts +4 -3
- package/lib/components/Modal/Modal.js +3 -2
- package/lib/components/Notification/Notification.js +3 -2
- package/lib/components/Pagination/Pagination.js +5 -5
- package/lib/components/Popover/index.js +2 -2
- package/lib/components/Select/Select.js +27 -33
- package/lib/components/Toggletip/index.d.ts +1 -0
- package/lib/components/Toggletip/index.js +3 -0
- package/lib/components/Tooltip/index.d.ts +3 -2
- package/lib/internal/FloatingMenu.js +8 -6
- package/lib/internal/OptimizedResize.js +4 -5
- package/lib/internal/wrapFocus.d.ts +4 -2
- package/lib/internal/wrapFocus.js +5 -4
- package/lib/tools/events.d.ts +1 -1
- package/package.json +20 -27
- package/telemetry.yml +2 -0
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
var React = require('react');
|
|
11
11
|
var FeatureFlags = require('@carbon/feature-flags');
|
|
12
12
|
var ReactDOM = require('react-dom');
|
|
13
|
-
var window = require('window-or-global');
|
|
14
13
|
var keys = require('./keyboard/keys.js');
|
|
15
14
|
var match = require('./keyboard/match.js');
|
|
16
15
|
var navigation = require('./keyboard/navigation.js');
|
|
@@ -130,14 +129,16 @@ const FloatingMenu = ({
|
|
|
130
129
|
const menuSize = menuBody.getBoundingClientRect();
|
|
131
130
|
const refPosition = triggerEl ? triggerEl.getBoundingClientRect() : undefined;
|
|
132
131
|
const offsetValue = typeof menuOffset === 'function' ? menuOffset(menuBody, menuDirection, triggerEl, flipped) : menuOffset;
|
|
132
|
+
const scrollX = globalThis.scrollX ?? 0;
|
|
133
|
+
const scrollY = globalThis.scrollY ?? 0;
|
|
133
134
|
if (updateOrientation) {
|
|
134
135
|
updateOrientation({
|
|
135
136
|
menuSize,
|
|
136
137
|
refPosition,
|
|
137
138
|
direction: menuDirection,
|
|
138
139
|
offset: offsetValue,
|
|
139
|
-
scrollX
|
|
140
|
-
scrollY
|
|
140
|
+
scrollX,
|
|
141
|
+
scrollY,
|
|
141
142
|
container: {
|
|
142
143
|
rect: target().getBoundingClientRect(),
|
|
143
144
|
position: getComputedStyle(target()).position
|
|
@@ -157,8 +158,8 @@ const FloatingMenu = ({
|
|
|
157
158
|
},
|
|
158
159
|
offset: offsetValue,
|
|
159
160
|
direction: menuDirection,
|
|
160
|
-
scrollX
|
|
161
|
-
scrollY
|
|
161
|
+
scrollX,
|
|
162
|
+
scrollY,
|
|
162
163
|
container: {
|
|
163
164
|
rect: target().getBoundingClientRect(),
|
|
164
165
|
position: getComputedStyle(target()).position
|
|
@@ -278,7 +279,8 @@ const FloatingMenu = ({
|
|
|
278
279
|
startTrapNode: startSentinelRef.current,
|
|
279
280
|
endTrapNode: endSentinelRef.current,
|
|
280
281
|
currentActiveNode: relatedTarget,
|
|
281
|
-
oldActiveNode: target
|
|
282
|
+
oldActiveNode: target,
|
|
283
|
+
prefix
|
|
282
284
|
});
|
|
283
285
|
}
|
|
284
286
|
};
|
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// mdn resize function
|
|
10
|
+
// Use `globalThis` for universal access to global object (browser, workers, Node).
|
|
11
|
+
const win = globalThis;
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* A callback function to be executed on `resize`.
|
|
@@ -27,7 +26,7 @@ const OptimizedResize = (() => {
|
|
|
27
26
|
const handleResize = () => {
|
|
28
27
|
if (!running) {
|
|
29
28
|
running = true;
|
|
30
|
-
|
|
29
|
+
win.requestAnimationFrame(runCallbacks);
|
|
31
30
|
}
|
|
32
31
|
};
|
|
33
32
|
const addCallback = callback => {
|
|
@@ -40,7 +39,7 @@ const OptimizedResize = (() => {
|
|
|
40
39
|
/** Adds a callback function to be executed on window `resize`. */
|
|
41
40
|
add: callback => {
|
|
42
41
|
if (!callbacks.length) {
|
|
43
|
-
|
|
42
|
+
win.addEventListener('resize', handleResize);
|
|
44
43
|
}
|
|
45
44
|
addCallback(callback);
|
|
46
45
|
return {
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
* @returns {boolean} Whether the node or one of its ancestors is in a floating
|
|
15
15
|
* menu.
|
|
16
16
|
*/
|
|
17
|
-
export declare const elementOrParentIsFloatingMenu: (node: Node, selectorsFloatingMenus?: string[]) => boolean;
|
|
17
|
+
export declare const elementOrParentIsFloatingMenu: (node: Node, selectorsFloatingMenus?: string[], prefix?: string) => boolean;
|
|
18
18
|
/**
|
|
19
19
|
* Ensures the focus is kept within the given container by implementing
|
|
20
20
|
* "focus-wrap" behavior.
|
|
21
21
|
*/
|
|
22
|
-
export declare const wrapFocus: ({ bodyNode, startTrapNode, endTrapNode, currentActiveNode, oldActiveNode, selectorsFloatingMenus, }: {
|
|
22
|
+
export declare const wrapFocus: ({ bodyNode, startTrapNode, endTrapNode, currentActiveNode, oldActiveNode, selectorsFloatingMenus, prefix, }: {
|
|
23
23
|
/** The DOM node of the container. */
|
|
24
24
|
bodyNode: HTMLElement | null;
|
|
25
25
|
/** The start sentinel node for focus trapping. */
|
|
@@ -32,6 +32,8 @@ export declare const wrapFocus: ({ bodyNode, startTrapNode, endTrapNode, current
|
|
|
32
32
|
oldActiveNode: HTMLElement;
|
|
33
33
|
/** CSS selectors for floating menus. */
|
|
34
34
|
selectorsFloatingMenus?: string[];
|
|
35
|
+
/** Classname prefix for Carbon selectors. */
|
|
36
|
+
prefix?: string;
|
|
35
37
|
}) => void;
|
|
36
38
|
/**
|
|
37
39
|
* Ensures the focus is kept in the given container, implementing "focus-wrap"
|
|
@@ -32,9 +32,9 @@ const DOCUMENT_POSITION_BROAD_FOLLOWING = typeof Node !== 'undefined' ? Node.DOC
|
|
|
32
32
|
* @returns {boolean} Whether the node or one of its ancestors is in a floating
|
|
33
33
|
* menu.
|
|
34
34
|
*/
|
|
35
|
-
const elementOrParentIsFloatingMenu = (node, selectorsFloatingMenus = []) => {
|
|
35
|
+
const elementOrParentIsFloatingMenu = (node, selectorsFloatingMenus = [], prefix = 'cds') => {
|
|
36
36
|
if (node instanceof Element && typeof node.closest === 'function') {
|
|
37
|
-
const allSelectorsFloatingMenus = [
|
|
37
|
+
const allSelectorsFloatingMenus = [`.${prefix}--overflow-menu-options`, `.${prefix}--tooltip`, '.flatpickr-calendar', ...selectorsFloatingMenus];
|
|
38
38
|
return allSelectorsFloatingMenus.some(selector => !!node.closest(selector));
|
|
39
39
|
}
|
|
40
40
|
return false;
|
|
@@ -50,9 +50,10 @@ const wrapFocus = ({
|
|
|
50
50
|
endTrapNode,
|
|
51
51
|
currentActiveNode,
|
|
52
52
|
oldActiveNode,
|
|
53
|
-
selectorsFloatingMenus
|
|
53
|
+
selectorsFloatingMenus,
|
|
54
|
+
prefix = 'cds'
|
|
54
55
|
}) => {
|
|
55
|
-
if (bodyNode && currentActiveNode && oldActiveNode && !bodyNode.contains(currentActiveNode) && !elementOrParentIsFloatingMenu(currentActiveNode, selectorsFloatingMenus)) {
|
|
56
|
+
if (bodyNode && currentActiveNode && oldActiveNode && !bodyNode.contains(currentActiveNode) && !elementOrParentIsFloatingMenu(currentActiveNode, selectorsFloatingMenus, prefix)) {
|
|
56
57
|
const comparisonResult = oldActiveNode.compareDocumentPosition(currentActiveNode);
|
|
57
58
|
if (currentActiveNode === startTrapNode || comparisonResult & DOCUMENT_POSITION_BROAD_PRECEDING) {
|
|
58
59
|
const tabbableElement = Array.from(bodyNode.querySelectorAll(navigation.selectorTabbable)).reverse().find(({
|
package/lib/tools/events.d.ts
CHANGED
|
@@ -14,4 +14,4 @@ import type { SyntheticEvent } from 'react';
|
|
|
14
14
|
* @param handlers - An array of event handler functions.
|
|
15
15
|
* @returns A composite event handler.
|
|
16
16
|
*/
|
|
17
|
-
export declare const composeEventHandlers: <E extends SyntheticEvent = SyntheticEvent
|
|
17
|
+
export declare const composeEventHandlers: <E extends SyntheticEvent = SyntheticEvent<Element, Event>>(handlers: (((event: E, ...args: any[]) => void) | undefined)[]) => (event: E, ...args: any[]) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/react",
|
|
3
3
|
"description": "React components for the Carbon Design System",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.98.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@babel/runtime": "^7.27.3",
|
|
55
|
-
"@carbon/feature-flags": "0.32.0",
|
|
56
|
-
"@carbon/icons-react": "^11.
|
|
57
|
-
"@carbon/layout": "^11.
|
|
58
|
-
"@carbon/styles": "^1.
|
|
59
|
-
"@carbon/utilities": "^0.
|
|
55
|
+
"@carbon/feature-flags": ">=0.32.0",
|
|
56
|
+
"@carbon/icons-react": "^11.72.0",
|
|
57
|
+
"@carbon/layout": "^11.45.0",
|
|
58
|
+
"@carbon/styles": "^1.97.0",
|
|
59
|
+
"@carbon/utilities": "^0.14.0",
|
|
60
60
|
"@floating-ui/react": "^0.27.4",
|
|
61
61
|
"@ibm/telemetry-js": "^1.5.0",
|
|
62
62
|
"classnames": "2.5.1",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"invariant": "^2.2.3",
|
|
68
68
|
"prop-types": "^15.8.1",
|
|
69
69
|
"react-fast-compare": "^3.2.2",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
70
|
+
"storybook-addon-accessibility-checker": "^9.2.0-rc.3",
|
|
71
|
+
"tabbable": "^6.2.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@babel/core": "^7.27.3",
|
|
@@ -80,34 +80,29 @@
|
|
|
80
80
|
"@babel/preset-react": "^7.27.1",
|
|
81
81
|
"@babel/preset-typescript": "^7.27.1",
|
|
82
82
|
"@carbon/test-utils": "^10.38.0",
|
|
83
|
-
"@carbon/themes": "^11.
|
|
83
|
+
"@carbon/themes": "^11.65.0",
|
|
84
84
|
"@figma/code-connect": "^1.3.5",
|
|
85
85
|
"@rollup/plugin-babel": "^6.0.0",
|
|
86
86
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
87
87
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
88
88
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
89
89
|
"@stackblitz/sdk": "^1.11.0",
|
|
90
|
-
"@storybook/addon-
|
|
91
|
-
"@storybook/addon-
|
|
92
|
-
"@storybook/addon-
|
|
93
|
-
"@storybook/
|
|
90
|
+
"@storybook/addon-a11y": "^9.1.8",
|
|
91
|
+
"@storybook/addon-docs": "^9.1.8",
|
|
92
|
+
"@storybook/addon-links": "^9.1.8",
|
|
93
|
+
"@storybook/builder-vite": "^9.1.8",
|
|
94
|
+
"@storybook/react-vite": "^9.1.8",
|
|
94
95
|
"@types/react-is": "^19.0.0",
|
|
95
96
|
"@types/use-sync-external-store": "^1",
|
|
96
|
-
"
|
|
97
|
-
"babel-loader": "^10.0.0",
|
|
97
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
98
98
|
"babel-plugin-dev-expression": "^0.2.3",
|
|
99
99
|
"babel-preset-carbon": "^0.8.0",
|
|
100
100
|
"browserify-zlib": "^0.2.0",
|
|
101
101
|
"browserslist-config-carbon": "^11.2.0",
|
|
102
102
|
"clipboardy": "^4.0.0",
|
|
103
|
-
"css-loader": "^7.0.0",
|
|
104
103
|
"enquirer": "^2.3.6",
|
|
105
104
|
"fast-glob": "^3.3.3",
|
|
106
105
|
"fs-extra": "^11.0.0",
|
|
107
|
-
"html-webpack-plugin": "^5.5.0",
|
|
108
|
-
"mini-css-extract-plugin": "^2.4.5",
|
|
109
|
-
"postcss": "^8.5.6",
|
|
110
|
-
"postcss-loader": "^8.1.1",
|
|
111
106
|
"process": "^0.11.10",
|
|
112
107
|
"prop-types": "^15.8.1",
|
|
113
108
|
"react": "^19.0.0",
|
|
@@ -119,14 +114,12 @@
|
|
|
119
114
|
"rollup-plugin-preserve-directives": "^0.4.0",
|
|
120
115
|
"rollup-plugin-strip-banner": "^3.0.0",
|
|
121
116
|
"sass": "^1.93.2",
|
|
122
|
-
"
|
|
123
|
-
"storybook": "
|
|
117
|
+
"storybook": "^9.1.8",
|
|
118
|
+
"storybook-addon-accessibility-checker": ">=9.2.0-rc.3",
|
|
124
119
|
"stream-browserify": "^3.0.0",
|
|
125
|
-
"
|
|
126
|
-
"typescript-config-carbon": "^0.8.0",
|
|
120
|
+
"typescript-config-carbon": "^0.9.0",
|
|
127
121
|
"use-sync-external-store": "^1.5.0",
|
|
128
|
-
"
|
|
129
|
-
"webpack-dev-server": "^5.0.0"
|
|
122
|
+
"vite": "^7.1.2"
|
|
130
123
|
},
|
|
131
124
|
"sideEffects": [
|
|
132
125
|
"es/index.js",
|
|
@@ -139,5 +132,5 @@
|
|
|
139
132
|
"**/*.scss",
|
|
140
133
|
"**/*.css"
|
|
141
134
|
],
|
|
142
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "57fdbc7bfad9349b5c4359c7d621e709cd4daa25"
|
|
143
136
|
}
|
package/telemetry.yml
CHANGED
|
@@ -138,6 +138,7 @@ collect:
|
|
|
138
138
|
- lowContrast
|
|
139
139
|
- max
|
|
140
140
|
- maxCount
|
|
141
|
+
- maxFileSize
|
|
141
142
|
- menuAlignment
|
|
142
143
|
- menuOffset
|
|
143
144
|
- menuOffsetFlip
|
|
@@ -271,6 +272,7 @@ collect:
|
|
|
271
272
|
# AspectRatio
|
|
272
273
|
- ratio
|
|
273
274
|
# ButtonSet
|
|
275
|
+
- fluid
|
|
274
276
|
- stacked
|
|
275
277
|
# ChatButton
|
|
276
278
|
- isQuickAction
|