@carbon/react 1.2.0-rc.0 → 1.2.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.
|
@@ -64,15 +64,12 @@ function TreeNode(_ref) {
|
|
|
64
64
|
var toggleClasses = cx("".concat(prefix, "--tree-parent-node__toggle-icon"), _defineProperty({}, "".concat(prefix, "--tree-parent-node__toggle-icon--expanded"), expanded));
|
|
65
65
|
|
|
66
66
|
function handleToggleClick(event) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
67
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle(event, {
|
|
68
|
+
id: id,
|
|
69
|
+
isExpanded: !expanded,
|
|
70
|
+
label: label,
|
|
71
|
+
value: value
|
|
72
|
+
});
|
|
76
73
|
setExpanded(!expanded);
|
|
77
74
|
}
|
|
78
75
|
|
|
@@ -80,29 +77,25 @@ function TreeNode(_ref) {
|
|
|
80
77
|
event.stopPropagation();
|
|
81
78
|
|
|
82
79
|
if (!disabled) {
|
|
83
|
-
|
|
84
|
-
onTreeSelect(event, {
|
|
85
|
-
id: id,
|
|
86
|
-
label: label,
|
|
87
|
-
value: value
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (onNodeSelect) {
|
|
92
|
-
onNodeSelect(event, {
|
|
93
|
-
id: id,
|
|
94
|
-
label: label,
|
|
95
|
-
value: value
|
|
96
|
-
});
|
|
97
|
-
}
|
|
80
|
+
var _rest$onClick;
|
|
98
81
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
82
|
+
onTreeSelect === null || onTreeSelect === void 0 ? void 0 : onTreeSelect(event, {
|
|
83
|
+
id: id,
|
|
84
|
+
label: label,
|
|
85
|
+
value: value
|
|
86
|
+
});
|
|
87
|
+
onNodeSelect === null || onNodeSelect === void 0 ? void 0 : onNodeSelect(event, {
|
|
88
|
+
id: id,
|
|
89
|
+
label: label,
|
|
90
|
+
value: value
|
|
91
|
+
});
|
|
92
|
+
rest === null || rest === void 0 ? void 0 : (_rest$onClick = rest.onClick) === null || _rest$onClick === void 0 ? void 0 : _rest$onClick.call(rest, event);
|
|
102
93
|
}
|
|
103
94
|
}
|
|
104
95
|
|
|
105
96
|
function handleKeyDown(event) {
|
|
97
|
+
var _rest$onKeyDown;
|
|
98
|
+
|
|
106
99
|
if (matches(event, [ArrowLeft, ArrowRight, Enter])) {
|
|
107
100
|
event.stopPropagation();
|
|
108
101
|
}
|
|
@@ -121,7 +114,7 @@ function TreeNode(_ref) {
|
|
|
121
114
|
};
|
|
122
115
|
|
|
123
116
|
if (children && expanded) {
|
|
124
|
-
onToggle(event, {
|
|
117
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle(event, {
|
|
125
118
|
id: id,
|
|
126
119
|
isExpanded: false,
|
|
127
120
|
label: label,
|
|
@@ -147,7 +140,7 @@ function TreeNode(_ref) {
|
|
|
147
140
|
*/
|
|
148
141
|
currentNode.current.lastChild.firstChild.focus();
|
|
149
142
|
} else {
|
|
150
|
-
onToggle(event, {
|
|
143
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle(event, {
|
|
151
144
|
id: id,
|
|
152
145
|
isExpanded: true,
|
|
153
146
|
label: label,
|
|
@@ -162,21 +155,23 @@ function TreeNode(_ref) {
|
|
|
162
155
|
handleClick(event);
|
|
163
156
|
}
|
|
164
157
|
|
|
165
|
-
|
|
166
|
-
rest.onKeyDown(event);
|
|
167
|
-
}
|
|
158
|
+
rest === null || rest === void 0 ? void 0 : (_rest$onKeyDown = rest.onKeyDown) === null || _rest$onKeyDown === void 0 ? void 0 : _rest$onKeyDown.call(rest, event);
|
|
168
159
|
}
|
|
169
160
|
|
|
170
161
|
function handleFocusEvent(event) {
|
|
171
|
-
if (event.type === 'blur'
|
|
172
|
-
|
|
162
|
+
if (event.type === 'blur') {
|
|
163
|
+
var _rest$onBlur;
|
|
164
|
+
|
|
165
|
+
rest === null || rest === void 0 ? void 0 : (_rest$onBlur = rest.onBlur) === null || _rest$onBlur === void 0 ? void 0 : _rest$onBlur.call(rest, event);
|
|
173
166
|
}
|
|
174
167
|
|
|
175
|
-
if (event.type === 'focus'
|
|
176
|
-
|
|
168
|
+
if (event.type === 'focus') {
|
|
169
|
+
var _rest$onFocus;
|
|
170
|
+
|
|
171
|
+
rest === null || rest === void 0 ? void 0 : (_rest$onFocus = rest.onFocus) === null || _rest$onFocus === void 0 ? void 0 : _rest$onFocus.call(rest, event);
|
|
177
172
|
}
|
|
178
173
|
|
|
179
|
-
onNodeFocusEvent
|
|
174
|
+
onNodeFocusEvent === null || onNodeFocusEvent === void 0 ? void 0 : onNodeFocusEvent(event);
|
|
180
175
|
}
|
|
181
176
|
|
|
182
177
|
useEffect(function () {
|
|
@@ -74,9 +74,7 @@ function TreeView(_ref) {
|
|
|
74
74
|
setActive(nodeId);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
onSelect(event, node);
|
|
79
|
-
}
|
|
77
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(event, node);
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
function handleFocusEvent(event) {
|
|
@@ -128,6 +126,8 @@ function TreeView(_ref) {
|
|
|
128
126
|
});
|
|
129
127
|
|
|
130
128
|
function handleKeyDown(event) {
|
|
129
|
+
var _rest$onKeyDown;
|
|
130
|
+
|
|
131
131
|
event.stopPropagation();
|
|
132
132
|
|
|
133
133
|
if (matches(event, [ArrowUp, ArrowDown])) {
|
|
@@ -151,9 +151,7 @@ function TreeView(_ref) {
|
|
|
151
151
|
nextFocusNode.focus();
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
rest.onKeyDown(event);
|
|
156
|
-
}
|
|
154
|
+
rest === null || rest === void 0 ? void 0 : (_rest$onKeyDown = rest.onKeyDown) === null || _rest$onKeyDown === void 0 ? void 0 : _rest$onKeyDown.call(rest, event);
|
|
157
155
|
}
|
|
158
156
|
|
|
159
157
|
useEffect(function () {
|
|
@@ -74,15 +74,12 @@ function TreeNode(_ref) {
|
|
|
74
74
|
var toggleClasses = cx__default["default"]("".concat(prefix, "--tree-parent-node__toggle-icon"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(prefix, "--tree-parent-node__toggle-icon--expanded"), expanded));
|
|
75
75
|
|
|
76
76
|
function handleToggleClick(event) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
77
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle(event, {
|
|
78
|
+
id: id,
|
|
79
|
+
isExpanded: !expanded,
|
|
80
|
+
label: label,
|
|
81
|
+
value: value
|
|
82
|
+
});
|
|
86
83
|
setExpanded(!expanded);
|
|
87
84
|
}
|
|
88
85
|
|
|
@@ -90,29 +87,25 @@ function TreeNode(_ref) {
|
|
|
90
87
|
event.stopPropagation();
|
|
91
88
|
|
|
92
89
|
if (!disabled) {
|
|
93
|
-
|
|
94
|
-
onTreeSelect(event, {
|
|
95
|
-
id: id,
|
|
96
|
-
label: label,
|
|
97
|
-
value: value
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (onNodeSelect) {
|
|
102
|
-
onNodeSelect(event, {
|
|
103
|
-
id: id,
|
|
104
|
-
label: label,
|
|
105
|
-
value: value
|
|
106
|
-
});
|
|
107
|
-
}
|
|
90
|
+
var _rest$onClick;
|
|
108
91
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
92
|
+
onTreeSelect === null || onTreeSelect === void 0 ? void 0 : onTreeSelect(event, {
|
|
93
|
+
id: id,
|
|
94
|
+
label: label,
|
|
95
|
+
value: value
|
|
96
|
+
});
|
|
97
|
+
onNodeSelect === null || onNodeSelect === void 0 ? void 0 : onNodeSelect(event, {
|
|
98
|
+
id: id,
|
|
99
|
+
label: label,
|
|
100
|
+
value: value
|
|
101
|
+
});
|
|
102
|
+
rest === null || rest === void 0 ? void 0 : (_rest$onClick = rest.onClick) === null || _rest$onClick === void 0 ? void 0 : _rest$onClick.call(rest, event);
|
|
112
103
|
}
|
|
113
104
|
}
|
|
114
105
|
|
|
115
106
|
function handleKeyDown(event) {
|
|
107
|
+
var _rest$onKeyDown;
|
|
108
|
+
|
|
116
109
|
if (match.matches(event, [keys.ArrowLeft, keys.ArrowRight, keys.Enter])) {
|
|
117
110
|
event.stopPropagation();
|
|
118
111
|
}
|
|
@@ -131,7 +124,7 @@ function TreeNode(_ref) {
|
|
|
131
124
|
};
|
|
132
125
|
|
|
133
126
|
if (children && expanded) {
|
|
134
|
-
onToggle(event, {
|
|
127
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle(event, {
|
|
135
128
|
id: id,
|
|
136
129
|
isExpanded: false,
|
|
137
130
|
label: label,
|
|
@@ -157,7 +150,7 @@ function TreeNode(_ref) {
|
|
|
157
150
|
*/
|
|
158
151
|
currentNode.current.lastChild.firstChild.focus();
|
|
159
152
|
} else {
|
|
160
|
-
onToggle(event, {
|
|
153
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle(event, {
|
|
161
154
|
id: id,
|
|
162
155
|
isExpanded: true,
|
|
163
156
|
label: label,
|
|
@@ -172,21 +165,23 @@ function TreeNode(_ref) {
|
|
|
172
165
|
handleClick(event);
|
|
173
166
|
}
|
|
174
167
|
|
|
175
|
-
|
|
176
|
-
rest.onKeyDown(event);
|
|
177
|
-
}
|
|
168
|
+
rest === null || rest === void 0 ? void 0 : (_rest$onKeyDown = rest.onKeyDown) === null || _rest$onKeyDown === void 0 ? void 0 : _rest$onKeyDown.call(rest, event);
|
|
178
169
|
}
|
|
179
170
|
|
|
180
171
|
function handleFocusEvent(event) {
|
|
181
|
-
if (event.type === 'blur'
|
|
182
|
-
|
|
172
|
+
if (event.type === 'blur') {
|
|
173
|
+
var _rest$onBlur;
|
|
174
|
+
|
|
175
|
+
rest === null || rest === void 0 ? void 0 : (_rest$onBlur = rest.onBlur) === null || _rest$onBlur === void 0 ? void 0 : _rest$onBlur.call(rest, event);
|
|
183
176
|
}
|
|
184
177
|
|
|
185
|
-
if (event.type === 'focus'
|
|
186
|
-
|
|
178
|
+
if (event.type === 'focus') {
|
|
179
|
+
var _rest$onFocus;
|
|
180
|
+
|
|
181
|
+
rest === null || rest === void 0 ? void 0 : (_rest$onFocus = rest.onFocus) === null || _rest$onFocus === void 0 ? void 0 : _rest$onFocus.call(rest, event);
|
|
187
182
|
}
|
|
188
183
|
|
|
189
|
-
onNodeFocusEvent
|
|
184
|
+
onNodeFocusEvent === null || onNodeFocusEvent === void 0 ? void 0 : onNodeFocusEvent(event);
|
|
190
185
|
}
|
|
191
186
|
|
|
192
187
|
React.useEffect(function () {
|
|
@@ -103,9 +103,7 @@ function TreeView(_ref) {
|
|
|
103
103
|
setActive(nodeId);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
onSelect(event, node);
|
|
108
|
-
}
|
|
106
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(event, node);
|
|
109
107
|
}
|
|
110
108
|
|
|
111
109
|
function handleFocusEvent(event) {
|
|
@@ -157,6 +155,8 @@ function TreeView(_ref) {
|
|
|
157
155
|
});
|
|
158
156
|
|
|
159
157
|
function handleKeyDown(event) {
|
|
158
|
+
var _rest$onKeyDown;
|
|
159
|
+
|
|
160
160
|
event.stopPropagation();
|
|
161
161
|
|
|
162
162
|
if (match.matches(event, [keys.ArrowUp, keys.ArrowDown])) {
|
|
@@ -180,9 +180,7 @@ function TreeView(_ref) {
|
|
|
180
180
|
nextFocusNode.focus();
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
rest.onKeyDown(event);
|
|
185
|
-
}
|
|
183
|
+
rest === null || rest === void 0 ? void 0 : (_rest$onKeyDown = rest.onKeyDown) === null || _rest$onKeyDown === void 0 ? void 0 : _rest$onKeyDown.call(rest, event);
|
|
186
184
|
}
|
|
187
185
|
|
|
188
186
|
React.useEffect(function () {
|
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.2.0
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/runtime": "^7.16.7",
|
|
47
47
|
"@carbon/feature-flags": "^0.7.0",
|
|
48
|
-
"@carbon/icons-react": "^11.
|
|
48
|
+
"@carbon/icons-react": "^11.2.0",
|
|
49
49
|
"@carbon/layout": "^11.1.0",
|
|
50
|
-
"@carbon/styles": "^1.2.0
|
|
50
|
+
"@carbon/styles": "^1.2.0",
|
|
51
51
|
"@carbon/telemetry": "0.1.0",
|
|
52
52
|
"classnames": "2.3.1",
|
|
53
53
|
"copy-to-clipboard": "^3.3.1",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@babel/preset-env": "^7.16.7",
|
|
75
75
|
"@babel/preset-react": "^7.16.7",
|
|
76
76
|
"@carbon/test-utils": "^10.23.0",
|
|
77
|
-
"@carbon/themes": "^11.2.0
|
|
77
|
+
"@carbon/themes": "^11.2.0",
|
|
78
78
|
"@cypress/react": "^5.11.0",
|
|
79
79
|
"@cypress/webpack-dev-server": "1.8.4",
|
|
80
80
|
"@percy/cypress": "^3.1.1",
|
|
@@ -136,5 +136,5 @@
|
|
|
136
136
|
"**/*.scss",
|
|
137
137
|
"**/*.css"
|
|
138
138
|
],
|
|
139
|
-
"gitHead": "
|
|
139
|
+
"gitHead": "28cf6f75d268e3103a23a3ce1d50127189703964"
|
|
140
140
|
}
|
package/scss/_type.scss
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// Code generated by @carbon/react. DO NOT EDIT.
|
|
2
|
-
//
|
|
3
|
-
// Copyright IBM Corp. 2018, 2018
|
|
4
|
-
//
|
|
5
|
-
// This source code is licensed under the Apache-2.0 license found in the
|
|
6
|
-
// LICENSE file in the root directory of this source tree.
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
@forward '@carbon/styles/scss/type';
|