@commercetools-uikit/creatable-select-input 13.0.4 → 14.0.2
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/README.md +11 -12
- package/dist/commercetools-uikit-creatable-select-input.cjs.dev.js +50 -8
- package/dist/commercetools-uikit-creatable-select-input.cjs.prod.js +47 -7
- package/dist/commercetools-uikit-creatable-select-input.esm.js +51 -9
- package/dist/declarations/src/creatable-select-input.d.ts +62 -4
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ export default Example;
|
|
|
83
83
|
| `name` | `CreatableProps['name']` | | | Name of the HTML Input (optional - without this, no input will be rendered)
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
84
84
|
| `noOptionsMessage` | `CreatableProps['noOptionsMessage']` | | | Can be used to render a custom value when there are no options (either because of no search results, or all options have been used, or there were none in the first place). Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present.
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
85
85
|
| `onBlur` | `Function`<br/>[See signature.](#signature-onBlur) | | | Handle blur events on the control |
|
|
86
|
-
| `onChange` | `Function`<br/>[See signature.](#signature-onChange) |
|
|
86
|
+
| `onChange` | `Function`<br/>[See signature.](#signature-onChange) | | | Called with a fake event when value changes. The event's `target.name` will be the `name` supplied in props. The event's `target.value` will hold the value. The value will be the selected option, or an array of options in case `isMulti` is `true`. |
|
|
87
87
|
| `onFocus` | `CreatableProps['onFocus']` | | | Handle focus events on the control
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
88
88
|
| `onInputChange` | `CreatableProps['onInputChange']` | | | Handle change events on the input
<br>
[Props from React select was used](https://react-select.com/props#creatable-props) |
|
|
89
89
|
| `options` | `union`<br/>Possible values:<br/>`TValue[] , { options: TValue[] }[]` | | | Array of options that populate the select menu |
|
|
@@ -104,13 +104,13 @@ export default Example;
|
|
|
104
104
|
### Signature `onBlur`
|
|
105
105
|
|
|
106
106
|
```ts
|
|
107
|
-
(event:
|
|
107
|
+
(event: TCustomEvent) => void
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
### Signature `onChange`
|
|
111
111
|
|
|
112
112
|
```ts
|
|
113
|
-
(event:
|
|
113
|
+
(event: TCustomEvent, info: ActionMeta<unknown>) => void
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
This input is built on top of [`react-select`](https://github.com/JedWatson/react-select) v2.
|
|
@@ -126,36 +126,35 @@ The options support a `isDisabled` property which will render the option with a
|
|
|
126
126
|
|
|
127
127
|
### `isTouched(touched)`
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
Returns `true` when truthy.
|
|
129
|
+
Returns truthy value for the Formik `touched` value of this input field.
|
|
131
130
|
|
|
132
|
-
|
|
131
|
+
## Components
|
|
133
132
|
|
|
134
|
-
It is possible to customize `
|
|
135
|
-
`
|
|
133
|
+
It is possible to customize `CreatableSelectInput` by passing the `components` property.
|
|
134
|
+
`CreatableSelectInput` exports the default underlying components as static exports.
|
|
136
135
|
|
|
137
136
|
Components available as static exports are:
|
|
138
137
|
|
|
139
138
|
- `ClearIndicator`
|
|
140
139
|
- `Control`
|
|
141
|
-
- `DropdownIndicator`
|
|
142
|
-
- `DownChevron`
|
|
143
140
|
- `CrossIcon`
|
|
141
|
+
- `DownChevron`
|
|
142
|
+
- `DropdownIndicator`
|
|
144
143
|
- `Group`
|
|
145
144
|
- `GroupHeading`
|
|
146
145
|
- `IndicatorsContainer`
|
|
147
146
|
- `IndicatorSeparator`
|
|
148
147
|
- `Input`
|
|
149
148
|
- `LoadingIndicator`
|
|
149
|
+
- `LoadingMessage`
|
|
150
150
|
- `Menu`
|
|
151
151
|
- `MenuList`
|
|
152
152
|
- `MenuPortal`
|
|
153
|
-
- `LoadingMessage`
|
|
154
|
-
- `NoOptionsMessage`
|
|
155
153
|
- `MultiValue`
|
|
156
154
|
- `MultiValueContainer`
|
|
157
155
|
- `MultiValueLabel`
|
|
158
156
|
- `MultiValueRemove`
|
|
157
|
+
- `NoOptionsMessage`
|
|
159
158
|
- `Option`
|
|
160
159
|
- `Placeholder`
|
|
161
160
|
- `SelectContainer`
|
|
@@ -62,6 +62,11 @@ var defaultProps = {
|
|
|
62
62
|
var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
63
63
|
var intl = reactIntl.useIntl();
|
|
64
64
|
var theme = react.useTheme();
|
|
65
|
+
|
|
66
|
+
if (!props.isReadOnly) {
|
|
67
|
+
process.env.NODE_ENV !== "production" ? utils.warning(typeof props.onChange === 'function', 'CreatableSelectInput: `onChange` is required when input is not read only.') : void 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
65
70
|
var placeholder = props.placeholder || intl.formatMessage(selectUtils.messages.placeholder);
|
|
66
71
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
67
72
|
max: props.horizontalConstraint,
|
|
@@ -119,6 +124,7 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
119
124
|
onBlur: typeof props.onBlur === 'function' ? function () {
|
|
120
125
|
var event = {
|
|
121
126
|
target: {
|
|
127
|
+
id: props.id,
|
|
122
128
|
name: function () {
|
|
123
129
|
if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
|
|
124
130
|
// state as an array instead of a boolean only.
|
|
@@ -133,6 +139,8 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
133
139
|
props.onBlur && props.onBlur(event);
|
|
134
140
|
} : undefined,
|
|
135
141
|
onChange: function onChange(value, info) {
|
|
142
|
+
var _props$onChange;
|
|
143
|
+
|
|
136
144
|
// selectedOptions is either an array, or a single option, or null
|
|
137
145
|
// depending on whether we're in multi-mode or not (isMulti)
|
|
138
146
|
var newValue = value;
|
|
@@ -141,8 +149,9 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
141
149
|
newValue = [];
|
|
142
150
|
}
|
|
143
151
|
|
|
144
|
-
props.onChange({
|
|
152
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
|
145
153
|
target: {
|
|
154
|
+
id: props.id,
|
|
146
155
|
name: props.name,
|
|
147
156
|
value: newValue
|
|
148
157
|
},
|
|
@@ -183,7 +192,7 @@ CreatableSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
183
192
|
isAutofocussed: _pt__default["default"].bool,
|
|
184
193
|
menuPortalZIndex: _pt__default["default"].number.isRequired,
|
|
185
194
|
onBlur: _pt__default["default"].func,
|
|
186
|
-
onChange: _pt__default["default"].func
|
|
195
|
+
onChange: _pt__default["default"].func,
|
|
187
196
|
options: _pt__default["default"].oneOfType([_pt__default["default"].arrayOf(_pt__default["default"].shape({
|
|
188
197
|
value: _pt__default["default"].string.isRequired
|
|
189
198
|
})), _pt__default["default"].arrayOf(_pt__default["default"].shape({
|
|
@@ -193,21 +202,54 @@ CreatableSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
193
202
|
}))]),
|
|
194
203
|
showOptionGroupDivider: _pt__default["default"].bool
|
|
195
204
|
} : {};
|
|
196
|
-
CreatableSelectInput.displayName = 'CreatableSelectInput';
|
|
205
|
+
CreatableSelectInput.displayName = 'CreatableSelectInput';
|
|
206
|
+
CreatableSelectInput.defaultProps = defaultProps;
|
|
207
|
+
/**
|
|
208
|
+
* Expose static helper methods.
|
|
209
|
+
*/
|
|
210
|
+
// Both "true" and an empty array [] represent a touched state. The Boolean
|
|
197
211
|
// conveniently handles both cases
|
|
198
212
|
|
|
199
213
|
CreatableSelectInput.isTouched = function (touched) {
|
|
200
214
|
return Boolean(touched);
|
|
201
215
|
};
|
|
216
|
+
/**
|
|
217
|
+
* Expose react-select components for customization purposes.
|
|
218
|
+
*/
|
|
219
|
+
// custom
|
|
202
220
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
221
|
+
|
|
222
|
+
CreatableSelectInput.ClearIndicator = customizedComponents.ClearIndicator;
|
|
223
|
+
CreatableSelectInput.Control = reactSelect.components.Control;
|
|
224
|
+
CreatableSelectInput.CrossIcon = reactSelect.components.CrossIcon;
|
|
225
|
+
CreatableSelectInput.DownChevron = reactSelect.components.DownChevron; // custom
|
|
226
|
+
|
|
227
|
+
CreatableSelectInput.DropdownIndicator = customizedComponents.DropdownIndicator;
|
|
228
|
+
CreatableSelectInput.Group = reactSelect.components.Group;
|
|
229
|
+
CreatableSelectInput.GroupHeading = reactSelect.components.GroupHeading;
|
|
230
|
+
CreatableSelectInput.IndicatorSeparator = reactSelect.components.IndicatorSeparator;
|
|
231
|
+
CreatableSelectInput.IndicatorsContainer = reactSelect.components.IndicatorsContainer;
|
|
232
|
+
CreatableSelectInput.Input = reactSelect.components.Input;
|
|
233
|
+
CreatableSelectInput.LoadingIndicator = reactSelect.components.LoadingIndicator;
|
|
234
|
+
CreatableSelectInput.LoadingMessage = reactSelect.components.LoadingMessage;
|
|
235
|
+
CreatableSelectInput.Menu = reactSelect.components.Menu;
|
|
236
|
+
CreatableSelectInput.MenuList = reactSelect.components.MenuList;
|
|
237
|
+
CreatableSelectInput.MenuPortal = reactSelect.components.MenuPortal;
|
|
238
|
+
CreatableSelectInput.MultiValue = reactSelect.components.MultiValue;
|
|
239
|
+
CreatableSelectInput.MultiValueContainer = reactSelect.components.MultiValueContainer;
|
|
240
|
+
CreatableSelectInput.MultiValueLabel = reactSelect.components.MultiValueLabel; // custom
|
|
241
|
+
|
|
242
|
+
CreatableSelectInput.MultiValueRemove = customizedComponents.MultiValueRemove;
|
|
243
|
+
CreatableSelectInput.NoOptionsMessage = reactSelect.components.NoOptionsMessage;
|
|
244
|
+
CreatableSelectInput.Option = reactSelect.components.Option;
|
|
245
|
+
CreatableSelectInput.Placeholder = reactSelect.components.Placeholder;
|
|
246
|
+
CreatableSelectInput.SelectContainer = reactSelect.components.SelectContainer;
|
|
247
|
+
CreatableSelectInput.SingleValue = reactSelect.components.SingleValue;
|
|
248
|
+
CreatableSelectInput.ValueContainer = reactSelect.components.ValueContainer;
|
|
207
249
|
var CreatableSelectInput$1 = CreatableSelectInput;
|
|
208
250
|
|
|
209
251
|
// NOTE: This string will be replaced on build time with the package version.
|
|
210
|
-
var version = "
|
|
252
|
+
var version = "14.0.2";
|
|
211
253
|
|
|
212
254
|
exports["default"] = CreatableSelectInput$1;
|
|
213
255
|
exports.version = version;
|
|
@@ -61,6 +61,9 @@ var defaultProps = {
|
|
|
61
61
|
var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
62
62
|
var intl = reactIntl.useIntl();
|
|
63
63
|
var theme = react.useTheme();
|
|
64
|
+
|
|
65
|
+
if (!props.isReadOnly) ;
|
|
66
|
+
|
|
64
67
|
var placeholder = props.placeholder || intl.formatMessage(selectUtils.messages.placeholder);
|
|
65
68
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
66
69
|
max: props.horizontalConstraint,
|
|
@@ -118,6 +121,7 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
118
121
|
onBlur: typeof props.onBlur === 'function' ? function () {
|
|
119
122
|
var event = {
|
|
120
123
|
target: {
|
|
124
|
+
id: props.id,
|
|
121
125
|
name: function () {
|
|
122
126
|
if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
|
|
123
127
|
// state as an array instead of a boolean only.
|
|
@@ -132,6 +136,8 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
132
136
|
props.onBlur && props.onBlur(event);
|
|
133
137
|
} : undefined,
|
|
134
138
|
onChange: function onChange(value, info) {
|
|
139
|
+
var _props$onChange;
|
|
140
|
+
|
|
135
141
|
// selectedOptions is either an array, or a single option, or null
|
|
136
142
|
// depending on whether we're in multi-mode or not (isMulti)
|
|
137
143
|
var newValue = value;
|
|
@@ -140,8 +146,9 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
140
146
|
newValue = [];
|
|
141
147
|
}
|
|
142
148
|
|
|
143
|
-
props.onChange({
|
|
149
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
|
144
150
|
target: {
|
|
151
|
+
id: props.id,
|
|
145
152
|
name: props.name,
|
|
146
153
|
value: newValue
|
|
147
154
|
},
|
|
@@ -174,21 +181,54 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
174
181
|
};
|
|
175
182
|
|
|
176
183
|
CreatableSelectInput.propTypes = {};
|
|
177
|
-
CreatableSelectInput.displayName = 'CreatableSelectInput';
|
|
184
|
+
CreatableSelectInput.displayName = 'CreatableSelectInput';
|
|
185
|
+
CreatableSelectInput.defaultProps = defaultProps;
|
|
186
|
+
/**
|
|
187
|
+
* Expose static helper methods.
|
|
188
|
+
*/
|
|
189
|
+
// Both "true" and an empty array [] represent a touched state. The Boolean
|
|
178
190
|
// conveniently handles both cases
|
|
179
191
|
|
|
180
192
|
CreatableSelectInput.isTouched = function (touched) {
|
|
181
193
|
return Boolean(touched);
|
|
182
194
|
};
|
|
195
|
+
/**
|
|
196
|
+
* Expose react-select components for customization purposes.
|
|
197
|
+
*/
|
|
198
|
+
// custom
|
|
183
199
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
200
|
+
|
|
201
|
+
CreatableSelectInput.ClearIndicator = customizedComponents.ClearIndicator;
|
|
202
|
+
CreatableSelectInput.Control = reactSelect.components.Control;
|
|
203
|
+
CreatableSelectInput.CrossIcon = reactSelect.components.CrossIcon;
|
|
204
|
+
CreatableSelectInput.DownChevron = reactSelect.components.DownChevron; // custom
|
|
205
|
+
|
|
206
|
+
CreatableSelectInput.DropdownIndicator = customizedComponents.DropdownIndicator;
|
|
207
|
+
CreatableSelectInput.Group = reactSelect.components.Group;
|
|
208
|
+
CreatableSelectInput.GroupHeading = reactSelect.components.GroupHeading;
|
|
209
|
+
CreatableSelectInput.IndicatorSeparator = reactSelect.components.IndicatorSeparator;
|
|
210
|
+
CreatableSelectInput.IndicatorsContainer = reactSelect.components.IndicatorsContainer;
|
|
211
|
+
CreatableSelectInput.Input = reactSelect.components.Input;
|
|
212
|
+
CreatableSelectInput.LoadingIndicator = reactSelect.components.LoadingIndicator;
|
|
213
|
+
CreatableSelectInput.LoadingMessage = reactSelect.components.LoadingMessage;
|
|
214
|
+
CreatableSelectInput.Menu = reactSelect.components.Menu;
|
|
215
|
+
CreatableSelectInput.MenuList = reactSelect.components.MenuList;
|
|
216
|
+
CreatableSelectInput.MenuPortal = reactSelect.components.MenuPortal;
|
|
217
|
+
CreatableSelectInput.MultiValue = reactSelect.components.MultiValue;
|
|
218
|
+
CreatableSelectInput.MultiValueContainer = reactSelect.components.MultiValueContainer;
|
|
219
|
+
CreatableSelectInput.MultiValueLabel = reactSelect.components.MultiValueLabel; // custom
|
|
220
|
+
|
|
221
|
+
CreatableSelectInput.MultiValueRemove = customizedComponents.MultiValueRemove;
|
|
222
|
+
CreatableSelectInput.NoOptionsMessage = reactSelect.components.NoOptionsMessage;
|
|
223
|
+
CreatableSelectInput.Option = reactSelect.components.Option;
|
|
224
|
+
CreatableSelectInput.Placeholder = reactSelect.components.Placeholder;
|
|
225
|
+
CreatableSelectInput.SelectContainer = reactSelect.components.SelectContainer;
|
|
226
|
+
CreatableSelectInput.SingleValue = reactSelect.components.SingleValue;
|
|
227
|
+
CreatableSelectInput.ValueContainer = reactSelect.components.ValueContainer;
|
|
188
228
|
var CreatableSelectInput$1 = CreatableSelectInput;
|
|
189
229
|
|
|
190
230
|
// NOTE: This string will be replaced on build time with the package version.
|
|
191
|
-
var version = "
|
|
231
|
+
var version = "14.0.2";
|
|
192
232
|
|
|
193
233
|
exports["default"] = CreatableSelectInput$1;
|
|
194
234
|
exports.version = version;
|
|
@@ -14,7 +14,7 @@ import { useTheme } from '@emotion/react';
|
|
|
14
14
|
import { components } from 'react-select';
|
|
15
15
|
import CreatableSelect from 'react-select/creatable';
|
|
16
16
|
import Constraints from '@commercetools-uikit/constraints';
|
|
17
|
-
import {
|
|
17
|
+
import { warning, filterDataAttributes } from '@commercetools-uikit/utils';
|
|
18
18
|
import { messages, customComponentsWithIcons, createSelectStyles, DropdownIndicator, ClearIndicator, TagRemove } from '@commercetools-uikit/select-utils';
|
|
19
19
|
import { jsx } from '@emotion/react/jsx-runtime';
|
|
20
20
|
|
|
@@ -43,6 +43,11 @@ var defaultProps = {
|
|
|
43
43
|
var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
44
44
|
var intl = useIntl();
|
|
45
45
|
var theme = useTheme();
|
|
46
|
+
|
|
47
|
+
if (!props.isReadOnly) {
|
|
48
|
+
process.env.NODE_ENV !== "production" ? warning(typeof props.onChange === 'function', 'CreatableSelectInput: `onChange` is required when input is not read only.') : void 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
46
51
|
var placeholder = props.placeholder || intl.formatMessage(messages.placeholder);
|
|
47
52
|
return jsx(Constraints.Horizontal, {
|
|
48
53
|
max: props.horizontalConstraint,
|
|
@@ -100,6 +105,7 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
100
105
|
onBlur: typeof props.onBlur === 'function' ? function () {
|
|
101
106
|
var event = {
|
|
102
107
|
target: {
|
|
108
|
+
id: props.id,
|
|
103
109
|
name: function () {
|
|
104
110
|
if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
|
|
105
111
|
// state as an array instead of a boolean only.
|
|
@@ -114,6 +120,8 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
114
120
|
props.onBlur && props.onBlur(event);
|
|
115
121
|
} : undefined,
|
|
116
122
|
onChange: function onChange(value, info) {
|
|
123
|
+
var _props$onChange;
|
|
124
|
+
|
|
117
125
|
// selectedOptions is either an array, or a single option, or null
|
|
118
126
|
// depending on whether we're in multi-mode or not (isMulti)
|
|
119
127
|
var newValue = value;
|
|
@@ -122,8 +130,9 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
122
130
|
newValue = [];
|
|
123
131
|
}
|
|
124
132
|
|
|
125
|
-
props.onChange({
|
|
133
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
|
126
134
|
target: {
|
|
135
|
+
id: props.id,
|
|
127
136
|
name: props.name,
|
|
128
137
|
value: newValue
|
|
129
138
|
},
|
|
@@ -164,7 +173,7 @@ CreatableSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
164
173
|
isAutofocussed: _pt.bool,
|
|
165
174
|
menuPortalZIndex: _pt.number.isRequired,
|
|
166
175
|
onBlur: _pt.func,
|
|
167
|
-
onChange: _pt.func
|
|
176
|
+
onChange: _pt.func,
|
|
168
177
|
options: _pt.oneOfType([_pt.arrayOf(_pt.shape({
|
|
169
178
|
value: _pt.string.isRequired
|
|
170
179
|
})), _pt.arrayOf(_pt.shape({
|
|
@@ -174,20 +183,53 @@ CreatableSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
174
183
|
}))]),
|
|
175
184
|
showOptionGroupDivider: _pt.bool
|
|
176
185
|
} : {};
|
|
177
|
-
CreatableSelectInput.displayName = 'CreatableSelectInput';
|
|
186
|
+
CreatableSelectInput.displayName = 'CreatableSelectInput';
|
|
187
|
+
CreatableSelectInput.defaultProps = defaultProps;
|
|
188
|
+
/**
|
|
189
|
+
* Expose static helper methods.
|
|
190
|
+
*/
|
|
191
|
+
// Both "true" and an empty array [] represent a touched state. The Boolean
|
|
178
192
|
// conveniently handles both cases
|
|
179
193
|
|
|
180
194
|
CreatableSelectInput.isTouched = function (touched) {
|
|
181
195
|
return Boolean(touched);
|
|
182
196
|
};
|
|
197
|
+
/**
|
|
198
|
+
* Expose react-select components for customization purposes.
|
|
199
|
+
*/
|
|
200
|
+
// custom
|
|
183
201
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
202
|
+
|
|
203
|
+
CreatableSelectInput.ClearIndicator = customizedComponents.ClearIndicator;
|
|
204
|
+
CreatableSelectInput.Control = components.Control;
|
|
205
|
+
CreatableSelectInput.CrossIcon = components.CrossIcon;
|
|
206
|
+
CreatableSelectInput.DownChevron = components.DownChevron; // custom
|
|
207
|
+
|
|
208
|
+
CreatableSelectInput.DropdownIndicator = customizedComponents.DropdownIndicator;
|
|
209
|
+
CreatableSelectInput.Group = components.Group;
|
|
210
|
+
CreatableSelectInput.GroupHeading = components.GroupHeading;
|
|
211
|
+
CreatableSelectInput.IndicatorSeparator = components.IndicatorSeparator;
|
|
212
|
+
CreatableSelectInput.IndicatorsContainer = components.IndicatorsContainer;
|
|
213
|
+
CreatableSelectInput.Input = components.Input;
|
|
214
|
+
CreatableSelectInput.LoadingIndicator = components.LoadingIndicator;
|
|
215
|
+
CreatableSelectInput.LoadingMessage = components.LoadingMessage;
|
|
216
|
+
CreatableSelectInput.Menu = components.Menu;
|
|
217
|
+
CreatableSelectInput.MenuList = components.MenuList;
|
|
218
|
+
CreatableSelectInput.MenuPortal = components.MenuPortal;
|
|
219
|
+
CreatableSelectInput.MultiValue = components.MultiValue;
|
|
220
|
+
CreatableSelectInput.MultiValueContainer = components.MultiValueContainer;
|
|
221
|
+
CreatableSelectInput.MultiValueLabel = components.MultiValueLabel; // custom
|
|
222
|
+
|
|
223
|
+
CreatableSelectInput.MultiValueRemove = customizedComponents.MultiValueRemove;
|
|
224
|
+
CreatableSelectInput.NoOptionsMessage = components.NoOptionsMessage;
|
|
225
|
+
CreatableSelectInput.Option = components.Option;
|
|
226
|
+
CreatableSelectInput.Placeholder = components.Placeholder;
|
|
227
|
+
CreatableSelectInput.SelectContainer = components.SelectContainer;
|
|
228
|
+
CreatableSelectInput.SingleValue = components.SingleValue;
|
|
229
|
+
CreatableSelectInput.ValueContainer = components.ValueContainer;
|
|
188
230
|
var CreatableSelectInput$1 = CreatableSelectInput;
|
|
189
231
|
|
|
190
232
|
// NOTE: This string will be replaced on build time with the package version.
|
|
191
|
-
var version = "
|
|
233
|
+
var version = "14.0.2";
|
|
192
234
|
|
|
193
235
|
export { CreatableSelectInput$1 as default, version };
|
|
@@ -7,8 +7,9 @@ declare type TValue = {
|
|
|
7
7
|
declare type TOptions = TValue[] | {
|
|
8
8
|
options: TValue[];
|
|
9
9
|
}[];
|
|
10
|
-
declare type
|
|
10
|
+
declare type TCustomEvent = {
|
|
11
11
|
target: {
|
|
12
|
+
id?: string;
|
|
12
13
|
name?: string;
|
|
13
14
|
value?: unknown;
|
|
14
15
|
};
|
|
@@ -44,8 +45,8 @@ declare type TCreatableSelectInputProps = {
|
|
|
44
45
|
closeMenuOnSelect?: ReactSelectCreatableProps['closeMenuOnSelect'];
|
|
45
46
|
name?: ReactSelectCreatableProps['name'];
|
|
46
47
|
noOptionsMessage?: ReactSelectCreatableProps['noOptionsMessage'];
|
|
47
|
-
onBlur?: (event:
|
|
48
|
-
onChange
|
|
48
|
+
onBlur?: (event: TCustomEvent) => void;
|
|
49
|
+
onChange?: (event: TCustomEvent, info: ActionMeta<unknown>) => void;
|
|
49
50
|
onFocus?: ReactSelectCreatableProps['onFocus'];
|
|
50
51
|
onInputChange?: ReactSelectCreatableProps['onInputChange'];
|
|
51
52
|
options?: TOptions;
|
|
@@ -64,7 +65,64 @@ declare type TCreatableSelectInputProps = {
|
|
|
64
65
|
declare const CreatableSelectInput: {
|
|
65
66
|
(props: TCreatableSelectInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
66
67
|
displayName: string;
|
|
67
|
-
isTouched(touched: unknown): boolean;
|
|
68
68
|
defaultProps: Pick<TCreatableSelectInputProps, "value" | "isSearchable" | "menuPortalZIndex">;
|
|
69
|
+
isTouched(touched: unknown): boolean;
|
|
70
|
+
ClearIndicator: {
|
|
71
|
+
(props: {
|
|
72
|
+
innerProps: {
|
|
73
|
+
ref: import("react").LegacyRef<HTMLButtonElement>;
|
|
74
|
+
} & import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement>;
|
|
75
|
+
} & import("react-select").ClearIndicatorProps<unknown, boolean, GroupBase<unknown>>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
76
|
+
displayName: string;
|
|
77
|
+
};
|
|
78
|
+
Control: <Option_1, IsMulti_1 extends boolean, Group_1 extends GroupBase<Option_1>>(props: import("react-select").ControlProps<Option_1, IsMulti_1, Group_1>) => import("@emotion/react").jsx.JSX.Element;
|
|
79
|
+
CrossIcon: (props: import("react-select/dist/declarations/src/components/indicators").CrossIconProps) => import("@emotion/react").jsx.JSX.Element;
|
|
80
|
+
DownChevron: (props: import("react-select/dist/declarations/src/components/indicators").DownChevronProps) => import("@emotion/react").jsx.JSX.Element;
|
|
81
|
+
DropdownIndicator: {
|
|
82
|
+
(props: import("react-select").DropdownIndicatorProps<unknown, boolean, GroupBase<unknown>>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
83
|
+
displayName: string;
|
|
84
|
+
};
|
|
85
|
+
Group: <Option_3, IsMulti_3 extends boolean, Group_3 extends GroupBase<Option_3>>(props: import("react-select").GroupProps<Option_3, IsMulti_3, Group_3>) => import("@emotion/react").jsx.JSX.Element;
|
|
86
|
+
GroupHeading: <Option_4, IsMulti_4 extends boolean, Group_4 extends GroupBase<Option_4>>(props: import("react-select").GroupHeadingProps<Option_4, IsMulti_4, Group_4>) => import("@emotion/react").jsx.JSX.Element;
|
|
87
|
+
IndicatorSeparator: <Option_6, IsMulti_6 extends boolean, Group_6 extends GroupBase<Option_6>>(props: import("react-select").IndicatorSeparatorProps<Option_6, IsMulti_6, Group_6>) => import("@emotion/react").jsx.JSX.Element;
|
|
88
|
+
IndicatorsContainer: <Option_5, IsMulti_5 extends boolean, Group_5 extends GroupBase<Option_5>>(props: import("react-select").IndicatorsContainerProps<Option_5, IsMulti_5, Group_5>) => import("@emotion/react").jsx.JSX.Element;
|
|
89
|
+
Input: <Option_7, IsMulti_7 extends boolean, Group_7 extends GroupBase<Option_7>>(props: import("react-select").InputProps<Option_7, IsMulti_7, Group_7>) => import("@emotion/react").jsx.JSX.Element;
|
|
90
|
+
LoadingIndicator: {
|
|
91
|
+
<Option_8, IsMulti_8 extends boolean, Group_8 extends GroupBase<Option_8>>(props: import("react-select").LoadingIndicatorProps<Option_8, IsMulti_8, Group_8>): import("@emotion/react").jsx.JSX.Element;
|
|
92
|
+
defaultProps: {
|
|
93
|
+
size: number;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
LoadingMessage: {
|
|
97
|
+
<Option_11, IsMulti_11 extends boolean, Group_11 extends GroupBase<Option_11>>(props: import("react-select").NoticeProps<Option_11, IsMulti_11, Group_11>): import("@emotion/react").jsx.JSX.Element;
|
|
98
|
+
defaultProps: {
|
|
99
|
+
children: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
Menu: <Option_9, IsMulti_9 extends boolean, Group_9 extends GroupBase<Option_9>>(props: import("react-select").MenuProps<Option_9, IsMulti_9, Group_9>) => import("@emotion/react").jsx.JSX.Element;
|
|
103
|
+
MenuList: <Option_10, IsMulti_10 extends boolean, Group_10 extends GroupBase<Option_10>>(props: import("react-select").MenuListProps<Option_10, IsMulti_10, Group_10>) => import("@emotion/react").jsx.JSX.Element;
|
|
104
|
+
MenuPortal: typeof import("react-select/dist/declarations/src/components/Menu").MenuPortal;
|
|
105
|
+
MultiValue: <Option_13, IsMulti_13 extends boolean, Group_13 extends GroupBase<Option_13>>(props: import("react-select").MultiValueProps<Option_13, IsMulti_13, Group_13>) => import("@emotion/react").jsx.JSX.Element;
|
|
106
|
+
MultiValueContainer: <Option_14, IsMulti_14 extends boolean, Group_14 extends GroupBase<Option_14>>({ children, innerProps, }: import("react-select").MultiValueGenericProps<Option_14, IsMulti_14, Group_14>) => import("@emotion/react").jsx.JSX.Element;
|
|
107
|
+
MultiValueLabel: <Option_14_1, IsMulti_14_1 extends boolean, Group_14_1 extends GroupBase<Option_14_1>>({ children, innerProps, }: import("react-select").MultiValueGenericProps<Option_14_1, IsMulti_14_1, Group_14_1>) => import("@emotion/react").jsx.JSX.Element;
|
|
108
|
+
MultiValueRemove: {
|
|
109
|
+
(props: {
|
|
110
|
+
selectProps: {
|
|
111
|
+
isReadOnly: boolean;
|
|
112
|
+
} & import("react-select/dist/declarations/src/Select").Props<unknown, boolean, GroupBase<unknown>>;
|
|
113
|
+
} & import("react-select").MultiValueGenericProps<unknown, boolean, GroupBase<unknown>>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
114
|
+
displayName: string;
|
|
115
|
+
};
|
|
116
|
+
NoOptionsMessage: {
|
|
117
|
+
<Option_12, IsMulti_12 extends boolean, Group_12 extends GroupBase<Option_12>>(props: import("react-select").NoticeProps<Option_12, IsMulti_12, Group_12>): import("@emotion/react").jsx.JSX.Element;
|
|
118
|
+
defaultProps: {
|
|
119
|
+
children: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
Option: <Option_15, IsMulti_15 extends boolean, Group_15 extends GroupBase<Option_15>>(props: import("react-select").OptionProps<Option_15, IsMulti_15, Group_15>) => import("@emotion/react").jsx.JSX.Element;
|
|
123
|
+
Placeholder: <Option_16, IsMulti_16 extends boolean, Group_16 extends GroupBase<Option_16>>(props: import("react-select").PlaceholderProps<Option_16, IsMulti_16, Group_16>) => import("@emotion/react").jsx.JSX.Element;
|
|
124
|
+
SelectContainer: <Option_17, IsMulti_17 extends boolean, Group_17 extends GroupBase<Option_17>>(props: import("react-select").ContainerProps<Option_17, IsMulti_17, Group_17>) => import("@emotion/react").jsx.JSX.Element;
|
|
125
|
+
SingleValue: <Option_18, IsMulti_18 extends boolean, Group_18 extends GroupBase<Option_18>>(props: import("react-select").SingleValueProps<Option_18, IsMulti_18, Group_18>) => import("@emotion/react").jsx.JSX.Element;
|
|
126
|
+
ValueContainer: <Option_19, IsMulti_19 extends boolean, Group_19 extends GroupBase<Option_19>>(props: import("react-select").ValueContainerProps<Option_19, IsMulti_19, Group_19>) => import("@emotion/react").jsx.JSX.Element;
|
|
69
127
|
};
|
|
70
128
|
export default CreatableSelectInput;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/creatable-select-input",
|
|
3
3
|
"description": "An input component getting a selection from the user, and where options can also be created by the user.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "14.0.2",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"directory": "packages/components/inputs/creatable-select-input"
|
|
10
10
|
},
|
|
11
11
|
"homepage": "https://uikit.commercetools.com",
|
|
12
|
-
"keywords": ["javascript", "design
|
|
12
|
+
"keywords": ["javascript", "typescript", "design-system", "react", "uikit"],
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public"
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"module": "dist/commercetools-uikit-creatable-select-input.esm.js",
|
|
20
20
|
"files": ["dist"],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@babel/runtime": "7.17.2",
|
|
23
|
-
"@babel/runtime-corejs3": "7.17.2",
|
|
24
|
-
"@commercetools-uikit/constraints": "
|
|
25
|
-
"@commercetools-uikit/design-system": "
|
|
26
|
-
"@commercetools-uikit/icons": "
|
|
27
|
-
"@commercetools-uikit/select-utils": "
|
|
28
|
-
"@commercetools-uikit/spacings": "
|
|
29
|
-
"@commercetools-uikit/text": "
|
|
30
|
-
"@commercetools-uikit/utils": "
|
|
22
|
+
"@babel/runtime": "^7.17.2",
|
|
23
|
+
"@babel/runtime-corejs3": "^7.17.2",
|
|
24
|
+
"@commercetools-uikit/constraints": "14.0.1",
|
|
25
|
+
"@commercetools-uikit/design-system": "14.0.0",
|
|
26
|
+
"@commercetools-uikit/icons": "14.0.1",
|
|
27
|
+
"@commercetools-uikit/select-utils": "14.0.1",
|
|
28
|
+
"@commercetools-uikit/spacings": "14.0.1",
|
|
29
|
+
"@commercetools-uikit/text": "14.0.1",
|
|
30
|
+
"@commercetools-uikit/utils": "14.0.1",
|
|
31
31
|
"@emotion/react": "^11.4.0",
|
|
32
32
|
"@emotion/styled": "^11.3.0",
|
|
33
33
|
"lodash": "4.17.21",
|