onekijs-ui 0.19.19 → 0.19.20

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,6 +15,7 @@ export type DropdownProps = {
15
15
  onCollapsing?: (node: HTMLElement) => void;
16
16
  animationTimeout?: number;
17
17
  placement?: Placement;
18
+ fallbackPlacements?: Placement[];
18
19
  widthModifier?: DropdownWidthModifier;
19
20
  width?: string;
20
21
  zIndex?: number;
package/dist/index.js CHANGED
@@ -1094,7 +1094,7 @@ const sameWidthPopperModifier = refWidth('width');
1094
1094
  const minWidthPopperModifier = refWidth('minWidth');
1095
1095
  const maxWidthPopperModifier = refWidth('maxWidth');
1096
1096
 
1097
- const DropdownComponent = ({ animationTimeout = 0, attachToBody = false, className, refElement, open, children, skidding = 0, distance = 0, onUpdate, onDropDone, onDropStart, onCollapseDone, onCollapseStart, onDropping, onCollapsing, placement = 'auto', width, widthModifier = 'same', zIndex = 1, }) => {
1097
+ const DropdownComponent = ({ animationTimeout = 0, attachToBody = false, className, refElement, open, children, skidding = 0, distance = 0, onUpdate, onDropDone, onDropStart, onCollapseDone, onCollapseStart, onDropping, onCollapsing, placement = 'auto', fallbackPlacements, width, widthModifier = 'same', zIndex = 1, }) => {
1098
1098
  const [popperElement, setPopperElement] = React.useState(null);
1099
1099
  const popperWidthModifier = widthModifier === 'same'
1100
1100
  ? sameWidthPopperModifier
@@ -1113,7 +1113,8 @@ const DropdownComponent = ({ animationTimeout = 0, attachToBody = false, classNa
1113
1113
  },
1114
1114
  {
1115
1115
  name: 'flip',
1116
- enabled: placement === 'auto',
1116
+ enabled: placement === 'auto' || (fallbackPlacements !== undefined && fallbackPlacements.length > 0),
1117
+ options: fallbackPlacements && fallbackPlacements.length > 0 ? { fallbackPlacements } : undefined,
1117
1118
  },
1118
1119
  {
1119
1120
  name: 'eventListeners',