@commercetools-uikit/creatable-select-input 15.15.0 → 15.15.1
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/dist/commercetools-uikit-creatable-select-input.cjs.d.ts +1 -0
- package/dist/commercetools-uikit-creatable-select-input.cjs.d.ts.map +1 -0
- package/dist/commercetools-uikit-creatable-select-input.cjs.dev.js +28 -34
- package/dist/commercetools-uikit-creatable-select-input.cjs.prod.js +28 -34
- package/dist/commercetools-uikit-creatable-select-input.esm.js +30 -36
- package/package.json +9 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commercetools-uikit-creatable-select-input.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
|
|
@@ -40,12 +40,12 @@ var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
|
40
40
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
41
|
|
|
42
42
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
43
|
-
|
|
43
|
+
const customizedComponents = {
|
|
44
44
|
DropdownIndicator: selectUtils.DropdownIndicator,
|
|
45
45
|
ClearIndicator: selectUtils.ClearIndicator,
|
|
46
46
|
MultiValueRemove: selectUtils.TagRemove
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
const defaultProps = {
|
|
49
49
|
// Using "null" will ensure that the currently selected value disappears in
|
|
50
50
|
// case "undefined" gets passed as the next value
|
|
51
51
|
value: null,
|
|
@@ -59,17 +59,17 @@ var defaultProps = {
|
|
|
59
59
|
menuPortalZIndex: 1
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
const CreatableSelectInput = props => {
|
|
63
|
+
const intl = reactIntl.useIntl();
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
const _useTheme = designSystem.useTheme(),
|
|
66
|
+
isNewTheme = _useTheme.isNewTheme;
|
|
67
67
|
|
|
68
68
|
if (!props.isReadOnly) {
|
|
69
69
|
process.env.NODE_ENV !== "production" ? utils.warning(typeof props.onChange === 'function', 'CreatableSelectInput: `onChange` is required when input is not read only.') : void 0;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
const placeholder = props.placeholder || intl.formatMessage(selectUtils.messages.placeholder);
|
|
73
73
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
74
74
|
max: props.horizontalConstraint,
|
|
75
75
|
children: jsxRuntime.jsx("div", _objectSpread(_objectSpread({}, utils.filterDataAttributes(props)), {}, {
|
|
@@ -81,11 +81,9 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
81
81
|
autoFocus: props.isAutofocussed,
|
|
82
82
|
backspaceRemovesValue: props.isReadOnly ? false : props.backspaceRemovesValue,
|
|
83
83
|
components: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, customizedComponents), props.components), props.iconLeft && !props.isMulti ? selectUtils.customComponentsWithIcons : {}), props.isReadOnly ? {
|
|
84
|
-
Input:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}));
|
|
88
|
-
}
|
|
84
|
+
Input: ownProps => jsxRuntime.jsx(reactSelect.components.Input, _objectSpread(_objectSpread({}, ownProps), {}, {
|
|
85
|
+
readOnly: true
|
|
86
|
+
}))
|
|
89
87
|
} : {}), props.components),
|
|
90
88
|
menuIsOpen: props.isReadOnly ? false : undefined,
|
|
91
89
|
styles: selectUtils.createSelectStyles({
|
|
@@ -98,7 +96,7 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
98
96
|
iconLeft: props.iconLeft,
|
|
99
97
|
isMulti: props.isMulti,
|
|
100
98
|
hasValue: !isEmpty__default["default"](props.value),
|
|
101
|
-
isNewTheme
|
|
99
|
+
isNewTheme
|
|
102
100
|
}),
|
|
103
101
|
filterOption: props.filterOption // react-select uses "id" (for the container) and "inputId" (for the input),
|
|
104
102
|
// but we use "id" (for the input) and "containerId" (for the container)
|
|
@@ -118,35 +116,35 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
118
116
|
menuShouldBlockScroll: props.menuShouldBlockScroll,
|
|
119
117
|
closeMenuOnSelect: props.closeMenuOnSelect,
|
|
120
118
|
name: props.name,
|
|
121
|
-
noOptionsMessage: props.noOptionsMessage ||
|
|
122
|
-
|
|
119
|
+
noOptionsMessage: props.noOptionsMessage || (_ref => {
|
|
120
|
+
let inputValue = _ref.inputValue;
|
|
123
121
|
return inputValue === '' ? intl.formatMessage(selectUtils.messages.noOptionsMessageWithoutInputValue) : intl.formatMessage(selectUtils.messages.noOptionsMessageWithInputValue, {
|
|
124
|
-
inputValue
|
|
122
|
+
inputValue
|
|
125
123
|
});
|
|
126
|
-
},
|
|
127
|
-
onBlur: typeof props.onBlur === 'function' ?
|
|
128
|
-
|
|
124
|
+
}),
|
|
125
|
+
onBlur: typeof props.onBlur === 'function' ? () => {
|
|
126
|
+
const event = {
|
|
129
127
|
target: {
|
|
130
128
|
id: props.id,
|
|
131
|
-
name:
|
|
129
|
+
name: (() => {
|
|
132
130
|
if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
|
|
133
131
|
// state as an array instead of a boolean only.
|
|
134
132
|
// Otherwise the shapes would clash on submission, as
|
|
135
133
|
// Formik will create an array on submission anyways.
|
|
136
134
|
|
|
137
135
|
return props.name ? "".concat(props.name, ".0") : undefined;
|
|
138
|
-
}()
|
|
136
|
+
})()
|
|
139
137
|
},
|
|
140
|
-
persist:
|
|
138
|
+
persist: () => {}
|
|
141
139
|
};
|
|
142
140
|
props.onBlur && props.onBlur(event);
|
|
143
141
|
} : undefined,
|
|
144
|
-
onChange:
|
|
142
|
+
onChange: (value, info) => {
|
|
145
143
|
var _props$onChange;
|
|
146
144
|
|
|
147
145
|
// selectedOptions is either an array, or a single option, or null
|
|
148
146
|
// depending on whether we're in multi-mode or not (isMulti)
|
|
149
|
-
|
|
147
|
+
let newValue = value;
|
|
150
148
|
|
|
151
149
|
if (props.isMulti && !newValue) {
|
|
152
150
|
newValue = [];
|
|
@@ -158,7 +156,7 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
158
156
|
name: props.name,
|
|
159
157
|
value: newValue
|
|
160
158
|
},
|
|
161
|
-
persist:
|
|
159
|
+
persist: () => {}
|
|
162
160
|
}, info);
|
|
163
161
|
},
|
|
164
162
|
onFocus: props.onFocus,
|
|
@@ -170,11 +168,9 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
170
168
|
value: props.value // Creatable props
|
|
171
169
|
,
|
|
172
170
|
allowCreateWhileLoading: props.allowCreateWhileLoading,
|
|
173
|
-
formatCreateLabel: props.formatCreateLabel ||
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
});
|
|
177
|
-
},
|
|
171
|
+
formatCreateLabel: props.formatCreateLabel || (inputValue => intl.formatMessage(selectUtils.messages.createLabel, {
|
|
172
|
+
inputValue
|
|
173
|
+
})),
|
|
178
174
|
isValidNewOption: props.isValidNewOption,
|
|
179
175
|
getNewOptionData: props.getNewOptionData,
|
|
180
176
|
onCreateOption: props.onCreateOption,
|
|
@@ -215,9 +211,7 @@ CreatableSelectInput.defaultProps = defaultProps;
|
|
|
215
211
|
// Both "true" and an empty array [] represent a touched state. The Boolean
|
|
216
212
|
// conveniently handles both cases
|
|
217
213
|
|
|
218
|
-
CreatableSelectInput.isTouched =
|
|
219
|
-
return Boolean(touched);
|
|
220
|
-
};
|
|
214
|
+
CreatableSelectInput.isTouched = touched => Boolean(touched);
|
|
221
215
|
/**
|
|
222
216
|
* Expose react-select components for customization purposes.
|
|
223
217
|
*/
|
|
@@ -254,7 +248,7 @@ CreatableSelectInput.ValueContainer = reactSelect.components.ValueContainer;
|
|
|
254
248
|
var CreatableSelectInput$1 = CreatableSelectInput;
|
|
255
249
|
|
|
256
250
|
// NOTE: This string will be replaced on build time with the package version.
|
|
257
|
-
var version = "15.15.
|
|
251
|
+
var version = "15.15.1";
|
|
258
252
|
|
|
259
253
|
exports["default"] = CreatableSelectInput$1;
|
|
260
254
|
exports.version = version;
|
|
@@ -39,12 +39,12 @@ var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
|
39
39
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
40
40
|
|
|
41
41
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
42
|
-
|
|
42
|
+
const customizedComponents = {
|
|
43
43
|
DropdownIndicator: selectUtils.DropdownIndicator,
|
|
44
44
|
ClearIndicator: selectUtils.ClearIndicator,
|
|
45
45
|
MultiValueRemove: selectUtils.TagRemove
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
const defaultProps = {
|
|
48
48
|
// Using "null" will ensure that the currently selected value disappears in
|
|
49
49
|
// case "undefined" gets passed as the next value
|
|
50
50
|
value: null,
|
|
@@ -58,15 +58,15 @@ var defaultProps = {
|
|
|
58
58
|
menuPortalZIndex: 1
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const CreatableSelectInput = props => {
|
|
62
|
+
const intl = reactIntl.useIntl();
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
const _useTheme = designSystem.useTheme(),
|
|
65
|
+
isNewTheme = _useTheme.isNewTheme;
|
|
66
66
|
|
|
67
67
|
if (!props.isReadOnly) ;
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
const placeholder = props.placeholder || intl.formatMessage(selectUtils.messages.placeholder);
|
|
70
70
|
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
71
71
|
max: props.horizontalConstraint,
|
|
72
72
|
children: jsxRuntime.jsx("div", _objectSpread(_objectSpread({}, utils.filterDataAttributes(props)), {}, {
|
|
@@ -78,11 +78,9 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
78
78
|
autoFocus: props.isAutofocussed,
|
|
79
79
|
backspaceRemovesValue: props.isReadOnly ? false : props.backspaceRemovesValue,
|
|
80
80
|
components: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, customizedComponents), props.components), props.iconLeft && !props.isMulti ? selectUtils.customComponentsWithIcons : {}), props.isReadOnly ? {
|
|
81
|
-
Input:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
81
|
+
Input: ownProps => jsxRuntime.jsx(reactSelect.components.Input, _objectSpread(_objectSpread({}, ownProps), {}, {
|
|
82
|
+
readOnly: true
|
|
83
|
+
}))
|
|
86
84
|
} : {}), props.components),
|
|
87
85
|
menuIsOpen: props.isReadOnly ? false : undefined,
|
|
88
86
|
styles: selectUtils.createSelectStyles({
|
|
@@ -95,7 +93,7 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
95
93
|
iconLeft: props.iconLeft,
|
|
96
94
|
isMulti: props.isMulti,
|
|
97
95
|
hasValue: !isEmpty__default["default"](props.value),
|
|
98
|
-
isNewTheme
|
|
96
|
+
isNewTheme
|
|
99
97
|
}),
|
|
100
98
|
filterOption: props.filterOption // react-select uses "id" (for the container) and "inputId" (for the input),
|
|
101
99
|
// but we use "id" (for the input) and "containerId" (for the container)
|
|
@@ -115,35 +113,35 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
115
113
|
menuShouldBlockScroll: props.menuShouldBlockScroll,
|
|
116
114
|
closeMenuOnSelect: props.closeMenuOnSelect,
|
|
117
115
|
name: props.name,
|
|
118
|
-
noOptionsMessage: props.noOptionsMessage ||
|
|
119
|
-
|
|
116
|
+
noOptionsMessage: props.noOptionsMessage || (_ref => {
|
|
117
|
+
let inputValue = _ref.inputValue;
|
|
120
118
|
return inputValue === '' ? intl.formatMessage(selectUtils.messages.noOptionsMessageWithoutInputValue) : intl.formatMessage(selectUtils.messages.noOptionsMessageWithInputValue, {
|
|
121
|
-
inputValue
|
|
119
|
+
inputValue
|
|
122
120
|
});
|
|
123
|
-
},
|
|
124
|
-
onBlur: typeof props.onBlur === 'function' ?
|
|
125
|
-
|
|
121
|
+
}),
|
|
122
|
+
onBlur: typeof props.onBlur === 'function' ? () => {
|
|
123
|
+
const event = {
|
|
126
124
|
target: {
|
|
127
125
|
id: props.id,
|
|
128
|
-
name:
|
|
126
|
+
name: (() => {
|
|
129
127
|
if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
|
|
130
128
|
// state as an array instead of a boolean only.
|
|
131
129
|
// Otherwise the shapes would clash on submission, as
|
|
132
130
|
// Formik will create an array on submission anyways.
|
|
133
131
|
|
|
134
132
|
return props.name ? "".concat(props.name, ".0") : undefined;
|
|
135
|
-
}()
|
|
133
|
+
})()
|
|
136
134
|
},
|
|
137
|
-
persist:
|
|
135
|
+
persist: () => {}
|
|
138
136
|
};
|
|
139
137
|
props.onBlur && props.onBlur(event);
|
|
140
138
|
} : undefined,
|
|
141
|
-
onChange:
|
|
139
|
+
onChange: (value, info) => {
|
|
142
140
|
var _props$onChange;
|
|
143
141
|
|
|
144
142
|
// selectedOptions is either an array, or a single option, or null
|
|
145
143
|
// depending on whether we're in multi-mode or not (isMulti)
|
|
146
|
-
|
|
144
|
+
let newValue = value;
|
|
147
145
|
|
|
148
146
|
if (props.isMulti && !newValue) {
|
|
149
147
|
newValue = [];
|
|
@@ -155,7 +153,7 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
155
153
|
name: props.name,
|
|
156
154
|
value: newValue
|
|
157
155
|
},
|
|
158
|
-
persist:
|
|
156
|
+
persist: () => {}
|
|
159
157
|
}, info);
|
|
160
158
|
},
|
|
161
159
|
onFocus: props.onFocus,
|
|
@@ -167,11 +165,9 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
167
165
|
value: props.value // Creatable props
|
|
168
166
|
,
|
|
169
167
|
allowCreateWhileLoading: props.allowCreateWhileLoading,
|
|
170
|
-
formatCreateLabel: props.formatCreateLabel ||
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
});
|
|
174
|
-
},
|
|
168
|
+
formatCreateLabel: props.formatCreateLabel || (inputValue => intl.formatMessage(selectUtils.messages.createLabel, {
|
|
169
|
+
inputValue
|
|
170
|
+
})),
|
|
175
171
|
isValidNewOption: props.isValidNewOption,
|
|
176
172
|
getNewOptionData: props.getNewOptionData,
|
|
177
173
|
onCreateOption: props.onCreateOption,
|
|
@@ -192,9 +188,7 @@ CreatableSelectInput.defaultProps = defaultProps;
|
|
|
192
188
|
// Both "true" and an empty array [] represent a touched state. The Boolean
|
|
193
189
|
// conveniently handles both cases
|
|
194
190
|
|
|
195
|
-
CreatableSelectInput.isTouched =
|
|
196
|
-
return Boolean(touched);
|
|
197
|
-
};
|
|
191
|
+
CreatableSelectInput.isTouched = touched => Boolean(touched);
|
|
198
192
|
/**
|
|
199
193
|
* Expose react-select components for customization purposes.
|
|
200
194
|
*/
|
|
@@ -231,7 +225,7 @@ CreatableSelectInput.ValueContainer = reactSelect.components.ValueContainer;
|
|
|
231
225
|
var CreatableSelectInput$1 = CreatableSelectInput;
|
|
232
226
|
|
|
233
227
|
// NOTE: This string will be replaced on build time with the package version.
|
|
234
|
-
var version = "15.15.
|
|
228
|
+
var version = "15.15.1";
|
|
235
229
|
|
|
236
230
|
exports["default"] = CreatableSelectInput$1;
|
|
237
231
|
exports.version = version;
|
|
@@ -21,12 +21,12 @@ import { jsx } from '@emotion/react/jsx-runtime';
|
|
|
21
21
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
22
|
|
|
23
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
24
|
-
|
|
25
|
-
DropdownIndicator
|
|
26
|
-
ClearIndicator
|
|
24
|
+
const customizedComponents = {
|
|
25
|
+
DropdownIndicator,
|
|
26
|
+
ClearIndicator,
|
|
27
27
|
MultiValueRemove: TagRemove
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
const defaultProps = {
|
|
30
30
|
// Using "null" will ensure that the currently selected value disappears in
|
|
31
31
|
// case "undefined" gets passed as the next value
|
|
32
32
|
value: null,
|
|
@@ -40,17 +40,17 @@ var defaultProps = {
|
|
|
40
40
|
menuPortalZIndex: 1
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const CreatableSelectInput = props => {
|
|
44
|
+
const intl = useIntl();
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const _useTheme = useTheme(),
|
|
47
|
+
isNewTheme = _useTheme.isNewTheme;
|
|
48
48
|
|
|
49
49
|
if (!props.isReadOnly) {
|
|
50
50
|
process.env.NODE_ENV !== "production" ? warning(typeof props.onChange === 'function', 'CreatableSelectInput: `onChange` is required when input is not read only.') : void 0;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
const placeholder = props.placeholder || intl.formatMessage(messages.placeholder);
|
|
54
54
|
return jsx(Constraints.Horizontal, {
|
|
55
55
|
max: props.horizontalConstraint,
|
|
56
56
|
children: jsx("div", _objectSpread(_objectSpread({}, filterDataAttributes(props)), {}, {
|
|
@@ -62,11 +62,9 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
62
62
|
autoFocus: props.isAutofocussed,
|
|
63
63
|
backspaceRemovesValue: props.isReadOnly ? false : props.backspaceRemovesValue,
|
|
64
64
|
components: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, customizedComponents), props.components), props.iconLeft && !props.isMulti ? customComponentsWithIcons : {}), props.isReadOnly ? {
|
|
65
|
-
Input:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
65
|
+
Input: ownProps => jsx(components.Input, _objectSpread(_objectSpread({}, ownProps), {}, {
|
|
66
|
+
readOnly: true
|
|
67
|
+
}))
|
|
70
68
|
} : {}), props.components),
|
|
71
69
|
menuIsOpen: props.isReadOnly ? false : undefined,
|
|
72
70
|
styles: createSelectStyles({
|
|
@@ -79,7 +77,7 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
79
77
|
iconLeft: props.iconLeft,
|
|
80
78
|
isMulti: props.isMulti,
|
|
81
79
|
hasValue: !isEmpty(props.value),
|
|
82
|
-
isNewTheme
|
|
80
|
+
isNewTheme
|
|
83
81
|
}),
|
|
84
82
|
filterOption: props.filterOption // react-select uses "id" (for the container) and "inputId" (for the input),
|
|
85
83
|
// but we use "id" (for the input) and "containerId" (for the container)
|
|
@@ -99,35 +97,35 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
99
97
|
menuShouldBlockScroll: props.menuShouldBlockScroll,
|
|
100
98
|
closeMenuOnSelect: props.closeMenuOnSelect,
|
|
101
99
|
name: props.name,
|
|
102
|
-
noOptionsMessage: props.noOptionsMessage ||
|
|
103
|
-
|
|
100
|
+
noOptionsMessage: props.noOptionsMessage || (_ref => {
|
|
101
|
+
let inputValue = _ref.inputValue;
|
|
104
102
|
return inputValue === '' ? intl.formatMessage(messages.noOptionsMessageWithoutInputValue) : intl.formatMessage(messages.noOptionsMessageWithInputValue, {
|
|
105
|
-
inputValue
|
|
103
|
+
inputValue
|
|
106
104
|
});
|
|
107
|
-
},
|
|
108
|
-
onBlur: typeof props.onBlur === 'function' ?
|
|
109
|
-
|
|
105
|
+
}),
|
|
106
|
+
onBlur: typeof props.onBlur === 'function' ? () => {
|
|
107
|
+
const event = {
|
|
110
108
|
target: {
|
|
111
109
|
id: props.id,
|
|
112
|
-
name:
|
|
110
|
+
name: (() => {
|
|
113
111
|
if (!props.isMulti) return props.name; // We append the ".0" to make Formik set the touched
|
|
114
112
|
// state as an array instead of a boolean only.
|
|
115
113
|
// Otherwise the shapes would clash on submission, as
|
|
116
114
|
// Formik will create an array on submission anyways.
|
|
117
115
|
|
|
118
116
|
return props.name ? "".concat(props.name, ".0") : undefined;
|
|
119
|
-
}()
|
|
117
|
+
})()
|
|
120
118
|
},
|
|
121
|
-
persist:
|
|
119
|
+
persist: () => {}
|
|
122
120
|
};
|
|
123
121
|
props.onBlur && props.onBlur(event);
|
|
124
122
|
} : undefined,
|
|
125
|
-
onChange:
|
|
123
|
+
onChange: (value, info) => {
|
|
126
124
|
var _props$onChange;
|
|
127
125
|
|
|
128
126
|
// selectedOptions is either an array, or a single option, or null
|
|
129
127
|
// depending on whether we're in multi-mode or not (isMulti)
|
|
130
|
-
|
|
128
|
+
let newValue = value;
|
|
131
129
|
|
|
132
130
|
if (props.isMulti && !newValue) {
|
|
133
131
|
newValue = [];
|
|
@@ -139,7 +137,7 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
139
137
|
name: props.name,
|
|
140
138
|
value: newValue
|
|
141
139
|
},
|
|
142
|
-
persist:
|
|
140
|
+
persist: () => {}
|
|
143
141
|
}, info);
|
|
144
142
|
},
|
|
145
143
|
onFocus: props.onFocus,
|
|
@@ -151,11 +149,9 @@ var CreatableSelectInput = function CreatableSelectInput(props) {
|
|
|
151
149
|
value: props.value // Creatable props
|
|
152
150
|
,
|
|
153
151
|
allowCreateWhileLoading: props.allowCreateWhileLoading,
|
|
154
|
-
formatCreateLabel: props.formatCreateLabel ||
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
});
|
|
158
|
-
},
|
|
152
|
+
formatCreateLabel: props.formatCreateLabel || (inputValue => intl.formatMessage(messages.createLabel, {
|
|
153
|
+
inputValue
|
|
154
|
+
})),
|
|
159
155
|
isValidNewOption: props.isValidNewOption,
|
|
160
156
|
getNewOptionData: props.getNewOptionData,
|
|
161
157
|
onCreateOption: props.onCreateOption,
|
|
@@ -196,9 +192,7 @@ CreatableSelectInput.defaultProps = defaultProps;
|
|
|
196
192
|
// Both "true" and an empty array [] represent a touched state. The Boolean
|
|
197
193
|
// conveniently handles both cases
|
|
198
194
|
|
|
199
|
-
CreatableSelectInput.isTouched =
|
|
200
|
-
return Boolean(touched);
|
|
201
|
-
};
|
|
195
|
+
CreatableSelectInput.isTouched = touched => Boolean(touched);
|
|
202
196
|
/**
|
|
203
197
|
* Expose react-select components for customization purposes.
|
|
204
198
|
*/
|
|
@@ -235,6 +229,6 @@ CreatableSelectInput.ValueContainer = components.ValueContainer;
|
|
|
235
229
|
var CreatableSelectInput$1 = CreatableSelectInput;
|
|
236
230
|
|
|
237
231
|
// NOTE: This string will be replaced on build time with the package version.
|
|
238
|
-
var version = "15.15.
|
|
232
|
+
var version = "15.15.1";
|
|
239
233
|
|
|
240
234
|
export { CreatableSelectInput$1 as default, version };
|
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": "15.15.
|
|
4
|
+
"version": "15.15.1",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.20.13",
|
|
23
23
|
"@babel/runtime-corejs3": "^7.20.13",
|
|
24
|
-
"@commercetools-uikit/constraints": "15.15.
|
|
25
|
-
"@commercetools-uikit/design-system": "15.15.
|
|
26
|
-
"@commercetools-uikit/icons": "15.15.
|
|
27
|
-
"@commercetools-uikit/select-utils": "15.15.
|
|
28
|
-
"@commercetools-uikit/spacings": "15.15.
|
|
29
|
-
"@commercetools-uikit/text": "15.15.
|
|
30
|
-
"@commercetools-uikit/utils": "15.15.
|
|
24
|
+
"@commercetools-uikit/constraints": "15.15.1",
|
|
25
|
+
"@commercetools-uikit/design-system": "15.15.1",
|
|
26
|
+
"@commercetools-uikit/icons": "15.15.1",
|
|
27
|
+
"@commercetools-uikit/select-utils": "15.15.1",
|
|
28
|
+
"@commercetools-uikit/spacings": "15.15.1",
|
|
29
|
+
"@commercetools-uikit/text": "15.15.1",
|
|
30
|
+
"@commercetools-uikit/utils": "15.15.1",
|
|
31
31
|
"@emotion/react": "^11.10.5",
|
|
32
32
|
"@emotion/styled": "^11.10.5",
|
|
33
33
|
"lodash": "4.17.21",
|
|
34
34
|
"prop-types": "15.8.1",
|
|
35
|
-
"react-select": "5.7.
|
|
35
|
+
"react-select": "5.7.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"react": "17.0.2",
|