@carbon/react 1.35.0-rc.0 → 1.35.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.
|
@@ -15,6 +15,7 @@ import { usePrefix } from '../../internal/usePrefix.js';
|
|
|
15
15
|
import '../FluidForm/FluidForm.js';
|
|
16
16
|
import { FormContext } from '../FluidForm/FormContext.js';
|
|
17
17
|
import setupGetInstanceId from '../../tools/setupGetInstanceId.js';
|
|
18
|
+
import { composeEventHandlers } from '../../tools/events.js';
|
|
18
19
|
|
|
19
20
|
const getInstanceId = setupGetInstanceId();
|
|
20
21
|
const Select = /*#__PURE__*/React__default.forwardRef(function Select(_ref, ref) {
|
|
@@ -37,6 +38,7 @@ const Select = /*#__PURE__*/React__default.forwardRef(function Select(_ref, ref)
|
|
|
37
38
|
size,
|
|
38
39
|
warn = false,
|
|
39
40
|
warnText,
|
|
41
|
+
onChange,
|
|
40
42
|
...other
|
|
41
43
|
} = _ref;
|
|
42
44
|
const prefix = usePrefix();
|
|
@@ -44,6 +46,7 @@ const Select = /*#__PURE__*/React__default.forwardRef(function Select(_ref, ref)
|
|
|
44
46
|
isFluid
|
|
45
47
|
} = useContext(FormContext);
|
|
46
48
|
const [isFocused, setIsFocused] = useState(false);
|
|
49
|
+
const [title, setTitle] = useState('');
|
|
47
50
|
const {
|
|
48
51
|
current: selectInstanceId
|
|
49
52
|
} = useRef(getInstanceId());
|
|
@@ -96,6 +99,9 @@ const Select = /*#__PURE__*/React__default.forwardRef(function Select(_ref, ref)
|
|
|
96
99
|
const handleFocus = evt => {
|
|
97
100
|
setIsFocused(evt.type === 'focus' ? true : false);
|
|
98
101
|
};
|
|
102
|
+
const handleChange = evt => {
|
|
103
|
+
setTitle(evt?.target?.value);
|
|
104
|
+
};
|
|
99
105
|
const readOnlyEventHandlers = {
|
|
100
106
|
onMouseDown: evt => {
|
|
101
107
|
// NOTE: does not prevent click
|
|
@@ -119,7 +125,9 @@ const Select = /*#__PURE__*/React__default.forwardRef(function Select(_ref, ref)
|
|
|
119
125
|
className: inputClasses,
|
|
120
126
|
disabled: disabled || undefined,
|
|
121
127
|
"aria-invalid": invalid || undefined,
|
|
122
|
-
"aria-readonly": readOnly || undefined
|
|
128
|
+
"aria-readonly": readOnly || undefined,
|
|
129
|
+
title: title,
|
|
130
|
+
onChange: composeEventHandlers([onChange, handleChange])
|
|
123
131
|
}, readOnlyEventHandlers, {
|
|
124
132
|
ref: ref
|
|
125
133
|
}), children), /*#__PURE__*/React__default.createElement(ChevronDown, {
|
|
@@ -19,6 +19,7 @@ var usePrefix = require('../../internal/usePrefix.js');
|
|
|
19
19
|
require('../FluidForm/FluidForm.js');
|
|
20
20
|
var FormContext = require('../FluidForm/FormContext.js');
|
|
21
21
|
var setupGetInstanceId = require('../../tools/setupGetInstanceId.js');
|
|
22
|
+
var events = require('../../tools/events.js');
|
|
22
23
|
|
|
23
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
25
|
|
|
@@ -47,6 +48,7 @@ const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select
|
|
|
47
48
|
size,
|
|
48
49
|
warn = false,
|
|
49
50
|
warnText,
|
|
51
|
+
onChange,
|
|
50
52
|
...other
|
|
51
53
|
} = _ref;
|
|
52
54
|
const prefix = usePrefix.usePrefix();
|
|
@@ -54,6 +56,7 @@ const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select
|
|
|
54
56
|
isFluid
|
|
55
57
|
} = React.useContext(FormContext.FormContext);
|
|
56
58
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
59
|
+
const [title, setTitle] = React.useState('');
|
|
57
60
|
const {
|
|
58
61
|
current: selectInstanceId
|
|
59
62
|
} = React.useRef(getInstanceId());
|
|
@@ -106,6 +109,9 @@ const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select
|
|
|
106
109
|
const handleFocus = evt => {
|
|
107
110
|
setIsFocused(evt.type === 'focus' ? true : false);
|
|
108
111
|
};
|
|
112
|
+
const handleChange = evt => {
|
|
113
|
+
setTitle(evt?.target?.value);
|
|
114
|
+
};
|
|
109
115
|
const readOnlyEventHandlers = {
|
|
110
116
|
onMouseDown: evt => {
|
|
111
117
|
// NOTE: does not prevent click
|
|
@@ -129,7 +135,9 @@ const Select = /*#__PURE__*/React__default["default"].forwardRef(function Select
|
|
|
129
135
|
className: inputClasses,
|
|
130
136
|
disabled: disabled || undefined,
|
|
131
137
|
"aria-invalid": invalid || undefined,
|
|
132
|
-
"aria-readonly": readOnly || undefined
|
|
138
|
+
"aria-readonly": readOnly || undefined,
|
|
139
|
+
title: title,
|
|
140
|
+
onChange: events.composeEventHandlers([onChange, handleChange])
|
|
133
141
|
}, readOnlyEventHandlers, {
|
|
134
142
|
ref: ref
|
|
135
143
|
}), children), /*#__PURE__*/React__default["default"].createElement(iconsReact.ChevronDown, {
|
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.35.0
|
|
4
|
+
"version": "1.35.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@babel/runtime": "^7.18.3",
|
|
48
|
-
"@carbon/feature-flags": "^0.16.0
|
|
49
|
-
"@carbon/icons-react": "^11.24.0
|
|
50
|
-
"@carbon/layout": "^11.18.0
|
|
51
|
-
"@carbon/styles": "^1.35.0
|
|
48
|
+
"@carbon/feature-flags": "^0.16.0",
|
|
49
|
+
"@carbon/icons-react": "^11.24.0",
|
|
50
|
+
"@carbon/layout": "^11.18.0",
|
|
51
|
+
"@carbon/styles": "^1.35.0",
|
|
52
52
|
"@carbon/telemetry": "0.1.0",
|
|
53
53
|
"classnames": "2.3.2",
|
|
54
54
|
"copy-to-clipboard": "^3.3.1",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@babel/preset-react": "^7.22.3",
|
|
77
77
|
"@babel/preset-typescript": "^7.21.5",
|
|
78
78
|
"@carbon/test-utils": "^10.30.0",
|
|
79
|
-
"@carbon/themes": "^11.23.0
|
|
79
|
+
"@carbon/themes": "^11.23.0",
|
|
80
80
|
"@rollup/plugin-babel": "^6.0.0",
|
|
81
81
|
"@rollup/plugin-commonjs": "^25.0.0",
|
|
82
82
|
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
@@ -138,5 +138,5 @@
|
|
|
138
138
|
"**/*.scss",
|
|
139
139
|
"**/*.css"
|
|
140
140
|
],
|
|
141
|
-
"gitHead": "
|
|
141
|
+
"gitHead": "f9ac32a70a209100bb30ed41edc39c596eae7956"
|
|
142
142
|
}
|