@7shifts/sous-chef 2.1.1 → 2.1.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.
|
@@ -15,7 +15,9 @@ declare type Props<T> = {
|
|
|
15
15
|
placeholder?: string;
|
|
16
16
|
disabled?: boolean;
|
|
17
17
|
closeOnSelect?: boolean;
|
|
18
|
+
/** When the user opens the menu, if this prop is `true`, it will scroll the page into to the menu view (if its content falls under a scroll). It is recomended to disable this behaviour when using the `MultiSelectField` inside a modal. */
|
|
19
|
+
menuShouldScrollIntoView?: boolean;
|
|
18
20
|
};
|
|
19
21
|
/** Component to make possible choose from a predefined options. */
|
|
20
|
-
declare const MultiSelectField: <T extends unknown>({ name, id: inputId, value, options, onChange, onBlur, CustomOption: UserCustomOption, label, caption, error, placeholder, disabled, closeOnSelect }: Props<T>) => JSX.Element;
|
|
22
|
+
declare const MultiSelectField: <T extends unknown>({ name, id: inputId, value, options, onChange, onBlur, CustomOption: UserCustomOption, label, caption, error, placeholder, disabled, closeOnSelect, menuShouldScrollIntoView }: Props<T>) => JSX.Element;
|
|
21
23
|
export default MultiSelectField;
|
|
@@ -18,7 +18,9 @@ declare type Props<T> = {
|
|
|
18
18
|
/** Use a prefix for things like currency symbols (“$”, “¥”, “£”) or icons. */
|
|
19
19
|
prefix?: React.ReactNode;
|
|
20
20
|
asToolbarFilter?: boolean;
|
|
21
|
+
/** When the user opens the menu, if this prop is `true`, it will scroll the page into to the menu view (if its content falls under a scroll). It is recomended to disable this behaviour when using the `SelectField` inside a modal. */
|
|
22
|
+
menuShouldScrollIntoView?: boolean;
|
|
21
23
|
};
|
|
22
24
|
/** Component to make possible choose from a predefined options. */
|
|
23
|
-
declare const SelectField: <T extends unknown>({ name, id: inputId, value, options, onChange, onBlur, CustomOption: UserCustomOption, SelectedOptionPrefix, label, caption, error, placeholder, disabled, prefix, asToolbarFilter }: Props<T>) => JSX.Element;
|
|
25
|
+
declare const SelectField: <T extends unknown>({ name, id: inputId, value, options, onChange, onBlur, CustomOption: UserCustomOption, SelectedOptionPrefix, label, caption, error, placeholder, disabled, prefix, asToolbarFilter, menuShouldScrollIntoView }: Props<T>) => JSX.Element;
|
|
24
26
|
export default SelectField;
|
package/dist/index.js
CHANGED
|
@@ -239,8 +239,8 @@ var updateMisalignedOverlay = function updateMisalignedOverlay(overlayPosition,
|
|
|
239
239
|
if (overlayPosition.left > arrowPosition.left) {
|
|
240
240
|
left = arrowPosition.left - ARROW_MARGIN;
|
|
241
241
|
} else if (overlayPosition.left + tooltipRectPosition.width < arrowPosition.left + ARROW_WIDTH) {
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
left = arrowPosition.left - tooltipRectPosition.width + ARROW_WIDTH + ARROW_MARGIN;
|
|
243
|
+
}
|
|
244
244
|
|
|
245
245
|
return _extends({}, overlayPosition, {
|
|
246
246
|
left: left
|
|
@@ -1807,9 +1807,6 @@ var IconGrinBeam = function IconGrinBeam(props) {
|
|
|
1807
1807
|
"data-testid": "icon-grin-beam",
|
|
1808
1808
|
style: getIconStyles(props)
|
|
1809
1809
|
}, props), React__default.createElement("path", {
|
|
1810
|
-
fill: "#fff",
|
|
1811
|
-
d: "M0 0h20v20H0z"
|
|
1812
|
-
}), React__default.createElement("path", {
|
|
1813
1810
|
d: "M4.746 9.676a.335.335 0 0 0 .375-.145l.383-.664c.31-.535.774-.844 1.27-.844s.96.309 1.27.844l.383.664c.085.145.25.184.375.145a.314.314 0 0 0 .23-.324c-.133-1.645-1.298-2.79-2.258-2.79S4.65 7.707 4.516 9.352a.317.317 0 0 0 .23.324Zm6.452 0a.335.335 0 0 0 .375-.145l.383-.664c.31-.535.774-.844 1.27-.844s.96.309 1.27.844l.383.664c.085.145.25.184.375.145a.314.314 0 0 0 .23-.324c-.133-1.645-1.299-2.79-2.258-2.79-.96 0-2.125 1.145-2.258 2.79a.317.317 0 0 0 .23.324Zm3.766 2.855c-1.218.38-3.029.594-4.964.594-1.935 0-3.746-.215-4.964-.594a.662.662 0 0 0-.617.121.62.62 0 0 0-.213.579c.37 2.148 3.354 3.644 5.798 3.644s5.423-1.496 5.798-3.645a.624.624 0 0 0-.213-.578.66.66 0 0 0-.625-.12ZM10 15.625c-1.411 0-3.105-.637-3.972-1.574 2.319.422 5.63.422 7.948 0-.871.937-2.565 1.574-3.976 1.574ZM10 .312C4.476.313 0 4.649 0 10s4.476 9.688 10 9.688S20 15.351 20 10 15.524.312 10 .312Zm0 18.125c-4.802 0-8.71-3.785-8.71-8.437 0-4.652 3.908-8.438 8.71-8.438 4.802 0 8.71 3.786 8.71 8.438 0 4.652-3.908 8.438-8.71 8.438Z",
|
|
1814
1811
|
fill: "currentColor"
|
|
1815
1812
|
}));
|
|
@@ -4607,7 +4604,9 @@ var MultiSelectField = function MultiSelectField(_ref) {
|
|
|
4607
4604
|
placeholder = _ref.placeholder,
|
|
4608
4605
|
disabled = _ref.disabled,
|
|
4609
4606
|
_ref$closeOnSelect = _ref.closeOnSelect,
|
|
4610
|
-
closeOnSelect = _ref$closeOnSelect === void 0 ? false : _ref$closeOnSelect
|
|
4607
|
+
closeOnSelect = _ref$closeOnSelect === void 0 ? false : _ref$closeOnSelect,
|
|
4608
|
+
_ref$menuShouldScroll = _ref.menuShouldScrollIntoView,
|
|
4609
|
+
menuShouldScrollIntoView = _ref$menuShouldScroll === void 0 ? true : _ref$menuShouldScroll;
|
|
4611
4610
|
var controllers = useMultiSelectFieldControllers({
|
|
4612
4611
|
name: name,
|
|
4613
4612
|
id: inputId,
|
|
@@ -4645,6 +4644,18 @@ var MultiSelectField = function MultiSelectField(_ref) {
|
|
|
4645
4644
|
CustomComponent: UserCustomOption
|
|
4646
4645
|
}, props));
|
|
4647
4646
|
} : Select.components.Option
|
|
4647
|
+
},
|
|
4648
|
+
menuShouldScrollIntoView: menuShouldScrollIntoView,
|
|
4649
|
+
menuPlacement: menuShouldScrollIntoView ? 'bottom' : 'auto',
|
|
4650
|
+
menuPosition: menuShouldScrollIntoView ? 'absolute' : 'fixed',
|
|
4651
|
+
closeMenuOnScroll: function closeMenuOnScroll(e) {
|
|
4652
|
+
if (menuShouldScrollIntoView || !e.target) {
|
|
4653
|
+
return false;
|
|
4654
|
+
}
|
|
4655
|
+
|
|
4656
|
+
var target = e.target;
|
|
4657
|
+
var isScrollingTheMenu = typeof target.className === 'string' && target.className.includes('MenuList');
|
|
4658
|
+
return !isScrollingTheMenu;
|
|
4648
4659
|
}
|
|
4649
4660
|
}));
|
|
4650
4661
|
};
|
|
@@ -4753,7 +4764,9 @@ var SelectField = function SelectField(_ref) {
|
|
|
4753
4764
|
disabled = _ref.disabled,
|
|
4754
4765
|
prefix = _ref.prefix,
|
|
4755
4766
|
_ref$asToolbarFilter = _ref.asToolbarFilter,
|
|
4756
|
-
asToolbarFilter = _ref$asToolbarFilter === void 0 ? false : _ref$asToolbarFilter
|
|
4767
|
+
asToolbarFilter = _ref$asToolbarFilter === void 0 ? false : _ref$asToolbarFilter,
|
|
4768
|
+
_ref$menuShouldScroll = _ref.menuShouldScrollIntoView,
|
|
4769
|
+
menuShouldScrollIntoView = _ref$menuShouldScroll === void 0 ? true : _ref$menuShouldScroll;
|
|
4757
4770
|
var controllers = useSelectFieldControllers({
|
|
4758
4771
|
name: name,
|
|
4759
4772
|
id: inputId,
|
|
@@ -4796,6 +4809,18 @@ var SelectField = function SelectField(_ref) {
|
|
|
4796
4809
|
CustomPrefixComponent: SelectedOptionPrefix
|
|
4797
4810
|
}, props));
|
|
4798
4811
|
} : Select.components.Control
|
|
4812
|
+
},
|
|
4813
|
+
menuShouldScrollIntoView: menuShouldScrollIntoView,
|
|
4814
|
+
menuPlacement: menuShouldScrollIntoView ? 'bottom' : 'auto',
|
|
4815
|
+
menuPosition: menuShouldScrollIntoView ? 'absolute' : 'fixed',
|
|
4816
|
+
closeMenuOnScroll: function closeMenuOnScroll(e) {
|
|
4817
|
+
if (menuShouldScrollIntoView || !e.target) {
|
|
4818
|
+
return false;
|
|
4819
|
+
}
|
|
4820
|
+
|
|
4821
|
+
var target = e.target;
|
|
4822
|
+
var isScrollingTheMenu = typeof target.className === 'string' && target.className.includes('MenuList');
|
|
4823
|
+
return !isScrollingTheMenu;
|
|
4799
4824
|
}
|
|
4800
4825
|
})));
|
|
4801
4826
|
};
|