carbon-react 114.18.2 → 115.0.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/esm/__internal__/checkable-input/checkable-input.component.d.ts +1 -1
- package/esm/__internal__/checkable-input/checkable-input.component.js +3 -4
- package/esm/__internal__/checkable-input/hidden-checkable-input.component.d.ts +2 -0
- package/esm/__internal__/checkable-input/hidden-checkable-input.component.js +5 -5
- package/esm/__internal__/input/input.component.js +2 -1
- package/esm/__internal__/input-behaviour/input-behaviour.component.js +2 -7
- package/esm/__internal__/input-behaviour/useInputBehaviour.d.ts +0 -1
- package/esm/components/checkbox/checkbox.component.d.ts +2 -0
- package/esm/components/checkbox/checkbox.component.js +2 -0
- package/esm/components/draggable/draggable-container.component.d.ts +17 -0
- package/esm/components/draggable/draggable-container.component.js +174 -61
- package/esm/components/draggable/draggable-item.component.d.ts +30 -0
- package/esm/components/draggable/draggable-item.component.js +180 -36
- package/esm/components/draggable/draggable-item.style.d.ts +9 -0
- package/esm/components/draggable/index.d.ts +4 -2
- package/esm/components/draggable/internal/drop-target.component.d.ts +8 -0
- package/esm/components/draggable/internal/drop-target.component.js +187 -0
- package/esm/components/grouped-character/grouped-character.component.js +0 -1
- package/esm/components/inline-inputs/index.d.ts +1 -1
- package/esm/components/inline-inputs/index.js +1 -1
- package/esm/components/inline-inputs/inline-inputs.component.d.ts +6 -5
- package/esm/components/inline-inputs/inline-inputs.component.js +8 -13
- package/esm/components/number/number.component.js +0 -1
- package/esm/components/select/filterable-select/filterable-select.component.js +11 -4
- package/esm/components/select/multi-select/multi-select.component.js +13 -4
- package/esm/components/select/select-textbox/select-textbox.component.js +2 -0
- package/esm/components/select/simple-select/simple-select.component.js +13 -4
- package/esm/components/settings-row/index.d.ts +2 -1
- package/esm/components/settings-row/settings-row.component.d.ts +22 -0
- package/esm/components/settings-row/settings-row.component.js +165 -23
- package/esm/components/settings-row/settings-row.style.d.ts +7 -0
- package/esm/components/textarea/textarea.component.d.ts +2 -0
- package/esm/components/textarea/textarea.component.js +2 -2
- package/esm/components/textbox/textbox.component.d.ts +7 -3
- package/esm/components/textbox/textbox.component.js +3 -5
- package/esm/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +0 -1
- package/esm/hooks/__internal__/useInputAccessibility/useInputAccessibility.js +1 -3
- package/lib/__internal__/checkable-input/checkable-input.component.d.ts +1 -1
- package/lib/__internal__/checkable-input/checkable-input.component.js +3 -4
- package/lib/__internal__/checkable-input/hidden-checkable-input.component.d.ts +2 -0
- package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +5 -5
- package/lib/__internal__/input/input.component.js +2 -1
- package/lib/__internal__/input-behaviour/input-behaviour.component.js +2 -12
- package/lib/__internal__/input-behaviour/useInputBehaviour.d.ts +0 -1
- package/lib/components/checkbox/checkbox.component.d.ts +2 -0
- package/lib/components/checkbox/checkbox.component.js +2 -0
- package/lib/components/draggable/draggable-container.component.d.ts +17 -0
- package/lib/components/draggable/draggable-container.component.js +174 -64
- package/lib/components/draggable/draggable-item.component.d.ts +30 -0
- package/lib/components/draggable/draggable-item.component.js +179 -37
- package/lib/components/draggable/draggable-item.style.d.ts +9 -0
- package/lib/components/draggable/index.d.ts +4 -2
- package/lib/components/draggable/internal/drop-target.component.d.ts +8 -0
- package/lib/components/draggable/internal/drop-target.component.js +200 -0
- package/lib/components/grouped-character/grouped-character.component.js +0 -1
- package/lib/components/inline-inputs/index.d.ts +1 -1
- package/lib/components/inline-inputs/index.js +2 -10
- package/lib/components/inline-inputs/inline-inputs.component.d.ts +6 -5
- package/lib/components/inline-inputs/inline-inputs.component.js +11 -20
- package/lib/components/number/number.component.js +0 -1
- package/lib/components/select/filterable-select/filterable-select.component.js +12 -4
- package/lib/components/select/multi-select/multi-select.component.js +14 -4
- package/lib/components/select/select-textbox/select-textbox.component.js +2 -0
- package/lib/components/select/simple-select/simple-select.component.js +14 -4
- package/lib/components/settings-row/index.d.ts +2 -1
- package/lib/components/settings-row/settings-row.component.d.ts +22 -0
- package/lib/components/settings-row/settings-row.component.js +166 -26
- package/lib/components/settings-row/settings-row.style.d.ts +7 -0
- package/lib/components/textarea/textarea.component.d.ts +2 -0
- package/lib/components/textarea/textarea.component.js +2 -2
- package/lib/components/textbox/textbox.component.d.ts +7 -3
- package/lib/components/textbox/textbox.component.js +3 -5
- package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +0 -1
- package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.js +1 -3
- package/package.json +1 -1
- package/esm/components/draggable/draggable-container.d.ts +0 -28
- package/esm/components/draggable/draggable-item.d.ts +0 -18
- package/esm/components/settings-row/settings-row.d.ts +0 -21
- package/lib/components/draggable/draggable-container.d.ts +0 -28
- package/lib/components/draggable/draggable-item.d.ts +0 -18
- package/lib/components/settings-row/settings-row.d.ts +0 -21
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { useDrop, useDrag } from "react-dnd";
|
|
5
4
|
import PropTypes from "prop-types";
|
|
6
|
-
import
|
|
5
|
+
import { useDrop, useDrag } from "react-dnd";
|
|
7
6
|
import { filterStyledSystemPaddingProps } from "../../style/utils";
|
|
8
|
-
import { StyledDraggableItem } from "./draggable-item.style";
|
|
9
|
-
const paddingPropTypes = filterStyledSystemPaddingProps(styledSystemPropTypes);
|
|
7
|
+
import { StyledDraggableItem, StyledIcon } from "./draggable-item.style";
|
|
10
8
|
|
|
11
9
|
const DraggableItem = ({
|
|
12
10
|
id,
|
|
@@ -16,7 +14,14 @@ const DraggableItem = ({
|
|
|
16
14
|
py = 1,
|
|
17
15
|
...rest
|
|
18
16
|
}) => {
|
|
19
|
-
|
|
17
|
+
let originalIndex; // istanbul ignore else
|
|
18
|
+
|
|
19
|
+
if (findItem) {
|
|
20
|
+
var _findItem;
|
|
21
|
+
|
|
22
|
+
originalIndex = (_findItem = findItem(id)) === null || _findItem === void 0 ? void 0 : _findItem.index;
|
|
23
|
+
}
|
|
24
|
+
|
|
20
25
|
const [{
|
|
21
26
|
isDragging
|
|
22
27
|
}, drag] = useDrag({
|
|
@@ -35,7 +40,7 @@ const DraggableItem = ({
|
|
|
35
40
|
} = monitor.getItem();
|
|
36
41
|
const didDrop = monitor.didDrop();
|
|
37
42
|
|
|
38
|
-
if (!didDrop) {
|
|
43
|
+
if (!didDrop && moveItem) {
|
|
39
44
|
moveItem(droppedId, oIndex);
|
|
40
45
|
}
|
|
41
46
|
}
|
|
@@ -44,14 +49,15 @@ const DraggableItem = ({
|
|
|
44
49
|
accept: "draggableItem",
|
|
45
50
|
canDrop: () => false,
|
|
46
51
|
|
|
47
|
-
hover({
|
|
48
|
-
|
|
49
|
-
}) {
|
|
50
|
-
if (draggedId !== id) {
|
|
52
|
+
hover(item) {
|
|
53
|
+
if ((item === null || item === void 0 ? void 0 : item.id) !== id && findItem) {
|
|
51
54
|
const {
|
|
52
55
|
index: overIndex
|
|
53
|
-
} = findItem(id);
|
|
54
|
-
|
|
56
|
+
} = findItem(id); // istanbul ignore else
|
|
57
|
+
|
|
58
|
+
if (moveItem) {
|
|
59
|
+
moveItem(item === null || item === void 0 ? void 0 : item.id, overIndex);
|
|
60
|
+
}
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
63
|
|
|
@@ -62,32 +68,170 @@ const DraggableItem = ({
|
|
|
62
68
|
isDragging: isDragging,
|
|
63
69
|
ref: node => drag(drop(node)),
|
|
64
70
|
py: py
|
|
65
|
-
}, paddingProps), children
|
|
71
|
+
}, paddingProps), children, /*#__PURE__*/React.createElement(StyledIcon, {
|
|
72
|
+
type: "drag"
|
|
73
|
+
}));
|
|
66
74
|
};
|
|
67
75
|
|
|
68
|
-
DraggableItem.propTypes = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
76
|
+
DraggableItem.propTypes = {
|
|
77
|
+
"children": PropTypes.node,
|
|
78
|
+
"findItem": PropTypes.func,
|
|
79
|
+
"id": PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
80
|
+
"moveItem": PropTypes.func,
|
|
81
|
+
"p": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
82
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
83
|
+
"description": PropTypes.string,
|
|
84
|
+
"toString": PropTypes.func.isRequired,
|
|
85
|
+
"valueOf": PropTypes.func.isRequired
|
|
86
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
87
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
88
|
+
"description": PropTypes.string,
|
|
89
|
+
"toString": PropTypes.func.isRequired,
|
|
90
|
+
"valueOf": PropTypes.func.isRequired
|
|
91
|
+
}), PropTypes.string]),
|
|
92
|
+
"padding": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
93
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
94
|
+
"description": PropTypes.string,
|
|
95
|
+
"toString": PropTypes.func.isRequired,
|
|
96
|
+
"valueOf": PropTypes.func.isRequired
|
|
97
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
98
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
99
|
+
"description": PropTypes.string,
|
|
100
|
+
"toString": PropTypes.func.isRequired,
|
|
101
|
+
"valueOf": PropTypes.func.isRequired
|
|
102
|
+
}), PropTypes.string]),
|
|
103
|
+
"paddingBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
104
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
105
|
+
"description": PropTypes.string,
|
|
106
|
+
"toString": PropTypes.func.isRequired,
|
|
107
|
+
"valueOf": PropTypes.func.isRequired
|
|
108
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
109
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
110
|
+
"description": PropTypes.string,
|
|
111
|
+
"toString": PropTypes.func.isRequired,
|
|
112
|
+
"valueOf": PropTypes.func.isRequired
|
|
113
|
+
}), PropTypes.string]),
|
|
114
|
+
"paddingLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
115
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
116
|
+
"description": PropTypes.string,
|
|
117
|
+
"toString": PropTypes.func.isRequired,
|
|
118
|
+
"valueOf": PropTypes.func.isRequired
|
|
119
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
120
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
121
|
+
"description": PropTypes.string,
|
|
122
|
+
"toString": PropTypes.func.isRequired,
|
|
123
|
+
"valueOf": PropTypes.func.isRequired
|
|
124
|
+
}), PropTypes.string]),
|
|
125
|
+
"paddingRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
126
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
127
|
+
"description": PropTypes.string,
|
|
128
|
+
"toString": PropTypes.func.isRequired,
|
|
129
|
+
"valueOf": PropTypes.func.isRequired
|
|
130
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
131
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
132
|
+
"description": PropTypes.string,
|
|
133
|
+
"toString": PropTypes.func.isRequired,
|
|
134
|
+
"valueOf": PropTypes.func.isRequired
|
|
135
|
+
}), PropTypes.string]),
|
|
136
|
+
"paddingTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
137
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
138
|
+
"description": PropTypes.string,
|
|
139
|
+
"toString": PropTypes.func.isRequired,
|
|
140
|
+
"valueOf": PropTypes.func.isRequired
|
|
141
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
142
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
143
|
+
"description": PropTypes.string,
|
|
144
|
+
"toString": PropTypes.func.isRequired,
|
|
145
|
+
"valueOf": PropTypes.func.isRequired
|
|
146
|
+
}), PropTypes.string]),
|
|
147
|
+
"paddingX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
148
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
149
|
+
"description": PropTypes.string,
|
|
150
|
+
"toString": PropTypes.func.isRequired,
|
|
151
|
+
"valueOf": PropTypes.func.isRequired
|
|
152
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
153
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
154
|
+
"description": PropTypes.string,
|
|
155
|
+
"toString": PropTypes.func.isRequired,
|
|
156
|
+
"valueOf": PropTypes.func.isRequired
|
|
157
|
+
}), PropTypes.string]),
|
|
158
|
+
"paddingY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
159
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
160
|
+
"description": PropTypes.string,
|
|
161
|
+
"toString": PropTypes.func.isRequired,
|
|
162
|
+
"valueOf": PropTypes.func.isRequired
|
|
163
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
164
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
165
|
+
"description": PropTypes.string,
|
|
166
|
+
"toString": PropTypes.func.isRequired,
|
|
167
|
+
"valueOf": PropTypes.func.isRequired
|
|
168
|
+
}), PropTypes.string]),
|
|
169
|
+
"pb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
170
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
171
|
+
"description": PropTypes.string,
|
|
172
|
+
"toString": PropTypes.func.isRequired,
|
|
173
|
+
"valueOf": PropTypes.func.isRequired
|
|
174
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
175
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
176
|
+
"description": PropTypes.string,
|
|
177
|
+
"toString": PropTypes.func.isRequired,
|
|
178
|
+
"valueOf": PropTypes.func.isRequired
|
|
179
|
+
}), PropTypes.string]),
|
|
180
|
+
"pl": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
181
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
182
|
+
"description": PropTypes.string,
|
|
183
|
+
"toString": PropTypes.func.isRequired,
|
|
184
|
+
"valueOf": PropTypes.func.isRequired
|
|
185
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
186
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
187
|
+
"description": PropTypes.string,
|
|
188
|
+
"toString": PropTypes.func.isRequired,
|
|
189
|
+
"valueOf": PropTypes.func.isRequired
|
|
190
|
+
}), PropTypes.string]),
|
|
191
|
+
"pr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
192
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
193
|
+
"description": PropTypes.string,
|
|
194
|
+
"toString": PropTypes.func.isRequired,
|
|
195
|
+
"valueOf": PropTypes.func.isRequired
|
|
196
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
197
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
198
|
+
"description": PropTypes.string,
|
|
199
|
+
"toString": PropTypes.func.isRequired,
|
|
200
|
+
"valueOf": PropTypes.func.isRequired
|
|
201
|
+
}), PropTypes.string]),
|
|
202
|
+
"pt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
203
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
204
|
+
"description": PropTypes.string,
|
|
205
|
+
"toString": PropTypes.func.isRequired,
|
|
206
|
+
"valueOf": PropTypes.func.isRequired
|
|
207
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
208
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
209
|
+
"description": PropTypes.string,
|
|
210
|
+
"toString": PropTypes.func.isRequired,
|
|
211
|
+
"valueOf": PropTypes.func.isRequired
|
|
212
|
+
}), PropTypes.string]),
|
|
213
|
+
"px": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
214
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
215
|
+
"description": PropTypes.string,
|
|
216
|
+
"toString": PropTypes.func.isRequired,
|
|
217
|
+
"valueOf": PropTypes.func.isRequired
|
|
218
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
219
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
220
|
+
"description": PropTypes.string,
|
|
221
|
+
"toString": PropTypes.func.isRequired,
|
|
222
|
+
"valueOf": PropTypes.func.isRequired
|
|
223
|
+
}), PropTypes.string]),
|
|
224
|
+
"py": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
225
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
226
|
+
"description": PropTypes.string,
|
|
227
|
+
"toString": PropTypes.func.isRequired,
|
|
228
|
+
"valueOf": PropTypes.func.isRequired
|
|
229
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
230
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
231
|
+
"description": PropTypes.string,
|
|
232
|
+
"toString": PropTypes.func.isRequired,
|
|
233
|
+
"valueOf": PropTypes.func.isRequired
|
|
234
|
+
}), PropTypes.string])
|
|
91
235
|
};
|
|
92
236
|
DraggableItem.displayName = "DraggableItem";
|
|
93
237
|
export default DraggableItem;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PaddingProps } from "styled-system";
|
|
3
|
+
declare const StyledDraggableContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
interface StyledDraggableItemProps extends PaddingProps {
|
|
5
|
+
isDragging?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const StyledDraggableItem: import("styled-components").StyledComponent<"div", any, StyledDraggableItemProps, never>;
|
|
8
|
+
declare const StyledIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
|
|
9
|
+
export { StyledDraggableContainer, StyledDraggableItem, StyledIcon };
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export { default as DraggableContainer } from "./draggable-container";
|
|
2
|
-
export {
|
|
1
|
+
export { default as DraggableContainer } from "./draggable-container.component";
|
|
2
|
+
export type { DraggableContainerProps } from "./draggable-container.component";
|
|
3
|
+
export { default as DraggableItem } from "./draggable-item.component";
|
|
4
|
+
export type { DraggableItemProps } from "./draggable-item.component";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DraggableContainerProps } from "../draggable-container.component";
|
|
3
|
+
interface DropTargetProps extends Omit<DraggableContainerProps, "getOrder"> {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
getOrder: (movedItemId?: string | number | undefined) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const DropTarget: ({ children, getOrder, ...rest }: DropTargetProps) => JSX.Element;
|
|
8
|
+
export default DropTarget;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
import { useDrop } from "react-dnd";
|
|
6
|
+
import { StyledDraggableContainer } from "../draggable-item.style";
|
|
7
|
+
|
|
8
|
+
const DropTarget = ({
|
|
9
|
+
children,
|
|
10
|
+
getOrder,
|
|
11
|
+
...rest
|
|
12
|
+
}) => {
|
|
13
|
+
const [, drop] = useDrop({
|
|
14
|
+
accept: "draggableItem",
|
|
15
|
+
|
|
16
|
+
drop(item) {
|
|
17
|
+
// istanbul ignore else
|
|
18
|
+
if (getOrder) {
|
|
19
|
+
getOrder(item === null || item === void 0 ? void 0 : item.id);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
});
|
|
24
|
+
return /*#__PURE__*/React.createElement(StyledDraggableContainer, _extends({
|
|
25
|
+
ref: drop
|
|
26
|
+
}, rest), children);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
DropTarget.propTypes = {
|
|
30
|
+
"children": PropTypes.node,
|
|
31
|
+
"getOrder": PropTypes.func.isRequired,
|
|
32
|
+
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
33
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
34
|
+
"description": PropTypes.string,
|
|
35
|
+
"toString": PropTypes.func.isRequired,
|
|
36
|
+
"valueOf": PropTypes.func.isRequired
|
|
37
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
38
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
39
|
+
"description": PropTypes.string,
|
|
40
|
+
"toString": PropTypes.func.isRequired,
|
|
41
|
+
"valueOf": PropTypes.func.isRequired
|
|
42
|
+
}), PropTypes.string]),
|
|
43
|
+
"margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
44
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
45
|
+
"description": PropTypes.string,
|
|
46
|
+
"toString": PropTypes.func.isRequired,
|
|
47
|
+
"valueOf": PropTypes.func.isRequired
|
|
48
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
49
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
50
|
+
"description": PropTypes.string,
|
|
51
|
+
"toString": PropTypes.func.isRequired,
|
|
52
|
+
"valueOf": PropTypes.func.isRequired
|
|
53
|
+
}), PropTypes.string]),
|
|
54
|
+
"marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
55
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
56
|
+
"description": PropTypes.string,
|
|
57
|
+
"toString": PropTypes.func.isRequired,
|
|
58
|
+
"valueOf": PropTypes.func.isRequired
|
|
59
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
60
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
61
|
+
"description": PropTypes.string,
|
|
62
|
+
"toString": PropTypes.func.isRequired,
|
|
63
|
+
"valueOf": PropTypes.func.isRequired
|
|
64
|
+
}), PropTypes.string]),
|
|
65
|
+
"marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
66
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
67
|
+
"description": PropTypes.string,
|
|
68
|
+
"toString": PropTypes.func.isRequired,
|
|
69
|
+
"valueOf": PropTypes.func.isRequired
|
|
70
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
71
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
72
|
+
"description": PropTypes.string,
|
|
73
|
+
"toString": PropTypes.func.isRequired,
|
|
74
|
+
"valueOf": PropTypes.func.isRequired
|
|
75
|
+
}), PropTypes.string]),
|
|
76
|
+
"marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
77
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
78
|
+
"description": PropTypes.string,
|
|
79
|
+
"toString": PropTypes.func.isRequired,
|
|
80
|
+
"valueOf": PropTypes.func.isRequired
|
|
81
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
82
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
83
|
+
"description": PropTypes.string,
|
|
84
|
+
"toString": PropTypes.func.isRequired,
|
|
85
|
+
"valueOf": PropTypes.func.isRequired
|
|
86
|
+
}), PropTypes.string]),
|
|
87
|
+
"marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
88
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
89
|
+
"description": PropTypes.string,
|
|
90
|
+
"toString": PropTypes.func.isRequired,
|
|
91
|
+
"valueOf": PropTypes.func.isRequired
|
|
92
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
93
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
94
|
+
"description": PropTypes.string,
|
|
95
|
+
"toString": PropTypes.func.isRequired,
|
|
96
|
+
"valueOf": PropTypes.func.isRequired
|
|
97
|
+
}), PropTypes.string]),
|
|
98
|
+
"marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
99
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
100
|
+
"description": PropTypes.string,
|
|
101
|
+
"toString": PropTypes.func.isRequired,
|
|
102
|
+
"valueOf": PropTypes.func.isRequired
|
|
103
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
104
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
105
|
+
"description": PropTypes.string,
|
|
106
|
+
"toString": PropTypes.func.isRequired,
|
|
107
|
+
"valueOf": PropTypes.func.isRequired
|
|
108
|
+
}), PropTypes.string]),
|
|
109
|
+
"marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
110
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
111
|
+
"description": PropTypes.string,
|
|
112
|
+
"toString": PropTypes.func.isRequired,
|
|
113
|
+
"valueOf": PropTypes.func.isRequired
|
|
114
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
115
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
116
|
+
"description": PropTypes.string,
|
|
117
|
+
"toString": PropTypes.func.isRequired,
|
|
118
|
+
"valueOf": PropTypes.func.isRequired
|
|
119
|
+
}), PropTypes.string]),
|
|
120
|
+
"mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
121
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
122
|
+
"description": PropTypes.string,
|
|
123
|
+
"toString": PropTypes.func.isRequired,
|
|
124
|
+
"valueOf": PropTypes.func.isRequired
|
|
125
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
126
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
127
|
+
"description": PropTypes.string,
|
|
128
|
+
"toString": PropTypes.func.isRequired,
|
|
129
|
+
"valueOf": PropTypes.func.isRequired
|
|
130
|
+
}), PropTypes.string]),
|
|
131
|
+
"ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
132
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
133
|
+
"description": PropTypes.string,
|
|
134
|
+
"toString": PropTypes.func.isRequired,
|
|
135
|
+
"valueOf": PropTypes.func.isRequired
|
|
136
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
137
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
138
|
+
"description": PropTypes.string,
|
|
139
|
+
"toString": PropTypes.func.isRequired,
|
|
140
|
+
"valueOf": PropTypes.func.isRequired
|
|
141
|
+
}), PropTypes.string]),
|
|
142
|
+
"mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
143
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
144
|
+
"description": PropTypes.string,
|
|
145
|
+
"toString": PropTypes.func.isRequired,
|
|
146
|
+
"valueOf": PropTypes.func.isRequired
|
|
147
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
148
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
149
|
+
"description": PropTypes.string,
|
|
150
|
+
"toString": PropTypes.func.isRequired,
|
|
151
|
+
"valueOf": PropTypes.func.isRequired
|
|
152
|
+
}), PropTypes.string]),
|
|
153
|
+
"mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
154
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
155
|
+
"description": PropTypes.string,
|
|
156
|
+
"toString": PropTypes.func.isRequired,
|
|
157
|
+
"valueOf": PropTypes.func.isRequired
|
|
158
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
159
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
160
|
+
"description": PropTypes.string,
|
|
161
|
+
"toString": PropTypes.func.isRequired,
|
|
162
|
+
"valueOf": PropTypes.func.isRequired
|
|
163
|
+
}), PropTypes.string]),
|
|
164
|
+
"mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
165
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
166
|
+
"description": PropTypes.string,
|
|
167
|
+
"toString": PropTypes.func.isRequired,
|
|
168
|
+
"valueOf": PropTypes.func.isRequired
|
|
169
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
170
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
171
|
+
"description": PropTypes.string,
|
|
172
|
+
"toString": PropTypes.func.isRequired,
|
|
173
|
+
"valueOf": PropTypes.func.isRequired
|
|
174
|
+
}), PropTypes.string]),
|
|
175
|
+
"my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
176
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
177
|
+
"description": PropTypes.string,
|
|
178
|
+
"toString": PropTypes.func.isRequired,
|
|
179
|
+
"valueOf": PropTypes.func.isRequired
|
|
180
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
181
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
182
|
+
"description": PropTypes.string,
|
|
183
|
+
"toString": PropTypes.func.isRequired,
|
|
184
|
+
"valueOf": PropTypes.func.isRequired
|
|
185
|
+
}), PropTypes.string])
|
|
186
|
+
};
|
|
187
|
+
export default DropTarget;
|
|
@@ -249,7 +249,6 @@ GroupedCharacter.propTypes = {
|
|
|
249
249
|
"label": PropTypes.string,
|
|
250
250
|
"labelAlign": PropTypes.oneOf(["left", "right"]),
|
|
251
251
|
"labelHelp": PropTypes.node,
|
|
252
|
-
"labelId": PropTypes.string,
|
|
253
252
|
"labelInline": PropTypes.bool,
|
|
254
253
|
"labelSpacing": PropTypes.oneOf([1, 2]),
|
|
255
254
|
"labelWidth": PropTypes.number,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./inline-inputs.component";
|
|
2
2
|
export type { InlineInputsProps } from "./inline-inputs.component";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from "./inline-inputs.component";
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
3
|
import { StyledContentContainerProps, StyledInlineInputsProps } from "./inline-inputs.style";
|
|
4
|
-
interface InlineInputsContextProps {
|
|
5
|
-
ariaLabelledBy?: string;
|
|
6
|
-
}
|
|
7
4
|
export interface InlineInputsProps extends MarginProps, StyledContentContainerProps, StyledInlineInputsProps {
|
|
8
5
|
/** Breakpoint for adaptive label (inline label change to top aligned). Enables the adaptive behaviour when set */
|
|
9
6
|
adaptiveLabelBreakpoint?: number;
|
|
@@ -15,12 +12,16 @@ export interface InlineInputsProps extends MarginProps, StyledContentContainerPr
|
|
|
15
12
|
htmlFor?: string;
|
|
16
13
|
/** Defines the label text for the heading. */
|
|
17
14
|
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Custom label id, could be used in combination with aria-labelledby prop of each input,
|
|
17
|
+
* to make them accesible for screen readers.
|
|
18
|
+
*/
|
|
19
|
+
labelId?: string;
|
|
18
20
|
/** Flag to configure component as mandatory. */
|
|
19
21
|
required?: boolean;
|
|
20
22
|
}
|
|
21
|
-
export declare const InlineInputsContext: React.Context<InlineInputsContextProps>;
|
|
22
23
|
declare const InlineInputs: {
|
|
23
|
-
({ adaptiveLabelBreakpoint, label, htmlFor, children, className, gutter, inputWidth, labelInline, labelWidth, required, ...rest }: InlineInputsProps): JSX.Element;
|
|
24
|
+
({ adaptiveLabelBreakpoint, label, labelId, htmlFor, children, className, gutter, inputWidth, labelInline, labelWidth, required, ...rest }: InlineInputsProps): JSX.Element;
|
|
24
25
|
displayName: string;
|
|
25
26
|
};
|
|
26
27
|
export default InlineInputs;
|
|
@@ -1,31 +1,26 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
|
-
import React
|
|
3
|
+
import React from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import Label from "../../__internal__/label";
|
|
6
6
|
import StyledInlineInputs, { StyledContentContainer, StyledInlineInput } from "./inline-inputs.style";
|
|
7
7
|
import FormSpacingProvider from "../../__internal__/form-spacing-provider";
|
|
8
|
-
import createGuid from "../../__internal__/utils/helpers/guid";
|
|
9
8
|
import useIsAboveBreakpoint from "../../hooks/__internal__/useIsAboveBreakpoint";
|
|
10
9
|
import useFormSpacing from "../../hooks/__internal__/useFormSpacing";
|
|
11
|
-
export const InlineInputsContext = /*#__PURE__*/React.createContext({});
|
|
12
10
|
|
|
13
|
-
const columnWrapper = (children, gutter
|
|
11
|
+
const columnWrapper = (children, gutter) => {
|
|
14
12
|
return React.Children.map(children, input => {
|
|
15
|
-
return /*#__PURE__*/React.createElement(
|
|
16
|
-
value: {
|
|
17
|
-
ariaLabelledBy: labelId
|
|
18
|
-
}
|
|
19
|
-
}, /*#__PURE__*/React.createElement(StyledInlineInput, {
|
|
13
|
+
return /*#__PURE__*/React.createElement(StyledInlineInput, {
|
|
20
14
|
gutter: gutter,
|
|
21
15
|
"data-element": "inline-input"
|
|
22
|
-
}, input)
|
|
16
|
+
}, input);
|
|
23
17
|
});
|
|
24
18
|
};
|
|
25
19
|
|
|
26
20
|
const InlineInputs = ({
|
|
27
21
|
adaptiveLabelBreakpoint,
|
|
28
22
|
label,
|
|
23
|
+
labelId,
|
|
29
24
|
htmlFor,
|
|
30
25
|
children = null,
|
|
31
26
|
className = "",
|
|
@@ -36,7 +31,6 @@ const InlineInputs = ({
|
|
|
36
31
|
required,
|
|
37
32
|
...rest
|
|
38
33
|
}) => {
|
|
39
|
-
const labelId = useRef(createGuid());
|
|
40
34
|
const largeScreen = useIsAboveBreakpoint(adaptiveLabelBreakpoint);
|
|
41
35
|
let inlineLabel = labelInline;
|
|
42
36
|
|
|
@@ -47,7 +41,7 @@ const InlineInputs = ({
|
|
|
47
41
|
function renderLabel() {
|
|
48
42
|
if (!label) return null;
|
|
49
43
|
return /*#__PURE__*/React.createElement(Label, {
|
|
50
|
-
labelId: labelId
|
|
44
|
+
labelId: labelId,
|
|
51
45
|
inline: inlineLabel,
|
|
52
46
|
htmlFor: htmlFor,
|
|
53
47
|
isRequired: required
|
|
@@ -67,7 +61,7 @@ const InlineInputs = ({
|
|
|
67
61
|
inputWidth: inputWidth
|
|
68
62
|
}, /*#__PURE__*/React.createElement(FormSpacingProvider, {
|
|
69
63
|
marginBottom: undefined
|
|
70
|
-
}, columnWrapper(children, gutter
|
|
64
|
+
}, columnWrapper(children, gutter))));
|
|
71
65
|
};
|
|
72
66
|
|
|
73
67
|
InlineInputs.propTypes = {
|
|
@@ -78,6 +72,7 @@ InlineInputs.propTypes = {
|
|
|
78
72
|
"htmlFor": PropTypes.string,
|
|
79
73
|
"inputWidth": PropTypes.number,
|
|
80
74
|
"label": PropTypes.string,
|
|
75
|
+
"labelId": PropTypes.string,
|
|
81
76
|
"labelInline": PropTypes.bool,
|
|
82
77
|
"labelWidth": PropTypes.number,
|
|
83
78
|
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
@@ -173,7 +173,6 @@ Number.propTypes = {
|
|
|
173
173
|
"label": PropTypes.string,
|
|
174
174
|
"labelAlign": PropTypes.oneOf(["left", "right"]),
|
|
175
175
|
"labelHelp": PropTypes.node,
|
|
176
|
-
"labelId": PropTypes.string,
|
|
177
176
|
"labelInline": PropTypes.bool,
|
|
178
177
|
"labelSpacing": PropTypes.oneOf([1, 2]),
|
|
179
178
|
"labelWidth": PropTypes.number,
|
|
@@ -14,6 +14,7 @@ import isNavigationKey from "../utils/is-navigation-key";
|
|
|
14
14
|
import Logger from "../../../__internal__/utils/logger";
|
|
15
15
|
import useStableCallback from "../../../hooks/__internal__/useStableCallback";
|
|
16
16
|
import useFormSpacing from "../../../hooks/__internal__/useFormSpacing";
|
|
17
|
+
import useInputAccessibility from "../../../hooks/__internal__/useInputAccessibility/useInputAccessibility";
|
|
17
18
|
let deprecateInputRefWarnTriggered = false;
|
|
18
19
|
const FilterableSelectList = withFilter(SelectList);
|
|
19
20
|
const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
@@ -55,7 +56,6 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
55
56
|
}, ref) => {
|
|
56
57
|
const [activeDescendantId, setActiveDescendantId] = useState();
|
|
57
58
|
const selectListId = useRef(guid());
|
|
58
|
-
const labelId = useRef(label ? guid() : undefined);
|
|
59
59
|
const containerRef = useRef();
|
|
60
60
|
const listboxRef = useRef();
|
|
61
61
|
const isControlled = useRef(value !== undefined);
|
|
@@ -68,6 +68,13 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
68
68
|
const [selectedValue, setSelectedValue] = useState(value || defaultValue || "");
|
|
69
69
|
const [highlightedValue, setHighlightedValue] = useState("");
|
|
70
70
|
const [filterText, setFilterText] = useState("");
|
|
71
|
+
const inputId = useRef(id || guid());
|
|
72
|
+
const {
|
|
73
|
+
labelId
|
|
74
|
+
} = useInputAccessibility({
|
|
75
|
+
id: inputId.current,
|
|
76
|
+
label
|
|
77
|
+
});
|
|
71
78
|
|
|
72
79
|
if (!deprecateInputRefWarnTriggered && inputRef) {
|
|
73
80
|
deprecateInputRefWarnTriggered = true;
|
|
@@ -389,7 +396,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
389
396
|
|
|
390
397
|
function getTextboxProps() {
|
|
391
398
|
return {
|
|
392
|
-
id,
|
|
399
|
+
id: inputId.current,
|
|
393
400
|
name,
|
|
394
401
|
label,
|
|
395
402
|
disabled,
|
|
@@ -414,7 +421,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
414
421
|
const selectList = /*#__PURE__*/React.createElement(FilterableSelectList, {
|
|
415
422
|
ref: listboxRef,
|
|
416
423
|
id: selectListId.current,
|
|
417
|
-
labelId:
|
|
424
|
+
labelId: labelId,
|
|
418
425
|
anchorElement: textboxRef && textboxRef.parentElement,
|
|
419
426
|
onSelect: onSelectOption,
|
|
420
427
|
onSelectListClose: onSelectListClose,
|
|
@@ -451,7 +458,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
|
|
|
451
458
|
ref: containerRef
|
|
452
459
|
}, /*#__PURE__*/React.createElement(SelectTextbox, _extends({
|
|
453
460
|
activeDescendantId: activeDescendantId,
|
|
454
|
-
labelId:
|
|
461
|
+
labelId: labelId,
|
|
455
462
|
"aria-controls": selectListId.current,
|
|
456
463
|
isOpen: isOpen,
|
|
457
464
|
hasTextCursor: true,
|