@7shifts/sous-chef 3.73.1 → 3.74.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Props } from '../../forms/SelectField/SelectField';
|
|
3
|
-
type ToolbarSelectProps<T> = Omit<Props<T>, 'asToolbarFilter' | 'caption' | 'error' | 'id' | 'isClearable' | 'label' | 'noOptionMessage' | 'CustomOption' | 'SelectedOptionPrefix' | '
|
|
3
|
+
type ToolbarSelectProps<T> = Omit<Props<T>, 'asToolbarFilter' | 'caption' | 'error' | 'id' | 'isClearable' | 'label' | 'noOptionMessage' | 'CustomOption' | 'SelectedOptionPrefix' | 'isSearchable'>;
|
|
4
4
|
/** Toolbar component to make a possible selection from predefined options. */
|
|
5
|
-
declare const ToolbarSelect: <T extends unknown>({ name, value, options, onChange, onBlur, placeholder, defaultValue, menuShouldScrollIntoView, disabled, prefix, testId }: ToolbarSelectProps<T>) => React.JSX.Element;
|
|
5
|
+
declare const ToolbarSelect: <T extends unknown>({ name, value, options, onChange, onBlur, placeholder, defaultValue, menuShouldScrollIntoView, disabled, prefix, testId, creatableButton, onCreate }: ToolbarSelectProps<T>) => React.JSX.Element;
|
|
6
6
|
export default ToolbarSelect;
|
package/dist/index.js
CHANGED
|
@@ -10231,11 +10231,20 @@ function CustomMenu(_ref) {
|
|
|
10231
10231
|
size: "medium"
|
|
10232
10232
|
}), button || __('createOption')));
|
|
10233
10233
|
}
|
|
10234
|
-
|
|
10235
|
-
|
|
10234
|
+
// Assuming the button will be the Button component
|
|
10235
|
+
var overrideProps = {};
|
|
10236
|
+
if (!button.props.onClick) {
|
|
10237
|
+
overrideProps.onClick = function () {
|
|
10236
10238
|
return setShowFooter(true);
|
|
10237
|
-
}
|
|
10238
|
-
}
|
|
10239
|
+
};
|
|
10240
|
+
}
|
|
10241
|
+
if (!button.props.size) {
|
|
10242
|
+
overrideProps.size = "full-width";
|
|
10243
|
+
}
|
|
10244
|
+
if (!button.props.theme) {
|
|
10245
|
+
overrideProps.theme = "link-primary";
|
|
10246
|
+
}
|
|
10247
|
+
return React__default["default"].cloneElement(button, overrideProps);
|
|
10239
10248
|
};
|
|
10240
10249
|
var onCreateButton = function onCreateButton() {
|
|
10241
10250
|
if (textFieldRef.current && textFieldRef.current.value.trim() !== '' && onCreate) {
|
|
@@ -10291,7 +10300,9 @@ function CustomMenu(_ref) {
|
|
|
10291
10300
|
autoFocus: true,
|
|
10292
10301
|
defaultValue: inputDefaultValue
|
|
10293
10302
|
}), React__default["default"].createElement(Button, {
|
|
10294
|
-
onClick:
|
|
10303
|
+
onClick: function onClick() {
|
|
10304
|
+
onCreateButton();
|
|
10305
|
+
},
|
|
10295
10306
|
onKeyDown: function onKeyDown(e) {
|
|
10296
10307
|
e.stopPropagation();
|
|
10297
10308
|
}
|
|
@@ -10433,7 +10444,9 @@ var ToolbarSelect = function ToolbarSelect(_ref) {
|
|
|
10433
10444
|
menuShouldScrollIntoView = _ref.menuShouldScrollIntoView,
|
|
10434
10445
|
disabled = _ref.disabled,
|
|
10435
10446
|
prefix = _ref.prefix,
|
|
10436
|
-
testId = _ref.testId
|
|
10447
|
+
testId = _ref.testId,
|
|
10448
|
+
creatableButton = _ref.creatableButton,
|
|
10449
|
+
onCreate = _ref.onCreate;
|
|
10437
10450
|
return React__default["default"].createElement(SelectField, {
|
|
10438
10451
|
name: name,
|
|
10439
10452
|
value: value,
|
|
@@ -10446,6 +10459,8 @@ var ToolbarSelect = function ToolbarSelect(_ref) {
|
|
|
10446
10459
|
disabled: disabled,
|
|
10447
10460
|
prefix: prefix,
|
|
10448
10461
|
testId: testId,
|
|
10462
|
+
creatableButton: creatableButton,
|
|
10463
|
+
onCreate: onCreate,
|
|
10449
10464
|
asToolbarFilter: true
|
|
10450
10465
|
});
|
|
10451
10466
|
};
|