@7shifts/sous-chef 3.44.2-beta.1 → 3.44.3

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,5 +1,7 @@
1
1
  import Toggle from './Toggle';
2
2
  import Button from './Button';
3
+ import { ButtonTheme } from './Button/types';
3
4
  import PaginationControls from './PaginationControls';
4
5
  import Link from './Link';
5
6
  export { Toggle, Button, PaginationControls, Link };
7
+ export type { ButtonTheme };
package/dist/index.css CHANGED
@@ -2570,7 +2570,7 @@ input:disabled + ._2W10t::after {
2570
2570
  ._11ygA {
2571
2571
  display: flex;
2572
2572
  justify-content: space-between;
2573
- width: 424px;
2573
+ max-width: 424px;
2574
2574
  gap: 20px;
2575
2575
  flex-direction: column;
2576
2576
  align-items: center;
package/dist/index.js CHANGED
@@ -6362,6 +6362,16 @@ var PaneOverlay = function PaneOverlay(_ref) {
6362
6362
  var _useState = React.useState({}),
6363
6363
  position = _useState[0],
6364
6364
  setPosition = _useState[1];
6365
+ React.useEffect(function () {
6366
+ var handleScroll = function handleScroll() {
6367
+ console.log('Scrolling');
6368
+ onToggleDropdown();
6369
+ };
6370
+ document.addEventListener('scroll', handleScroll);
6371
+ return function () {
6372
+ document.removeEventListener('scroll', handleScroll);
6373
+ };
6374
+ }, [onToggleDropdown]);
6365
6375
  useOnClickOutsideRole('dialog', onToggleDropdown);
6366
6376
  React.useLayoutEffect(function () {
6367
6377
  if (!triggerRef || !('current' in triggerRef) || !(triggerRef !== null && triggerRef !== void 0 && triggerRef.current) || !(paneRef !== null && paneRef !== void 0 && paneRef.current)) {
@@ -6398,6 +6408,11 @@ var isGoingTowardsPane = function isGoingTowardsPane(panePosition, mouseYAxisPos
6398
6408
  }
6399
6409
  return isGoingTowardsPane;
6400
6410
  };
6411
+ var getKeyboardFocusableElements = function getKeyboardFocusableElements(element) {
6412
+ return Array.prototype.slice.call(element.querySelectorAll('a[href], button, input, textarea, select, details,[tabindex]:not([tabindex="-1"])')).filter(function (el) {
6413
+ return !el.hasAttribute('disabled') && !el.getAttribute('aria-hidden') && !(el.getAttribute('tabindex') === '-1');
6414
+ });
6415
+ };
6401
6416
 
6402
6417
  var styles$g = {"dropdown__trigger":"_3INRK"};
6403
6418
 
@@ -6887,6 +6902,24 @@ var Dropdown = function Dropdown(_ref) {
6887
6902
  setIsOpen(false);
6888
6903
  }
6889
6904
  };
6905
+ var handleOnBlur = function handleOnBlur(e) {
6906
+ trigger.props.onBlur && trigger.props.onBlur(e);
6907
+ if (!paneRef || !(paneRef !== null && paneRef !== void 0 && paneRef.current)) {
6908
+ return;
6909
+ }
6910
+ var focusableElements = getKeyboardFocusableElements(paneRef.current);
6911
+ if (focusableElements.length > 0) {
6912
+ window.setTimeout(function () {
6913
+ var _paneRef$current;
6914
+ var focusedElement = document.activeElement;
6915
+ if (!((_paneRef$current = paneRef.current) !== null && _paneRef$current !== void 0 && _paneRef$current.contains(focusedElement))) {
6916
+ focusableElements[0].focus();
6917
+ }
6918
+ }, 0);
6919
+ } else {
6920
+ setIsOpen(false);
6921
+ }
6922
+ };
6890
6923
  var getRef = function getRef() {
6891
6924
  if ((trigger.type === Button || trigger.type === TimeFieldDropdownTrigger) && trigger.ref) {
6892
6925
  return trigger.ref;
@@ -6898,6 +6931,7 @@ var Dropdown = function Dropdown(_ref) {
6898
6931
  onClick: handleMouseClick,
6899
6932
  onMouseEnter: handleMouseEnter,
6900
6933
  onMouseLeave: handleMouseLeave,
6934
+ onBlur: handleOnBlur,
6901
6935
  ref: updatedRef,
6902
6936
  style: {
6903
6937
  width: triggerWidth === 'full' ? '100%' : 'fit-content'