@limetech/lime-elements 36.0.0-next.4 → 36.0.0-next.7

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.
Files changed (48) hide show
  1. package/dist/cjs/lime-elements.cjs.js +1 -1
  2. package/dist/cjs/limel-button.cjs.entry.js +2 -2
  3. package/dist/cjs/{limel-color-picker-palette_2.cjs.entry.js → limel-color-picker-palette.cjs.entry.js} +0 -112
  4. package/dist/cjs/limel-dock-button.cjs.entry.js +79 -0
  5. package/dist/cjs/limel-dock.cjs.entry.js +105 -0
  6. package/dist/cjs/{limel-list_3.cjs.entry.js → limel-list_2.cjs.entry.js} +0 -2018
  7. package/dist/cjs/limel-popover_4.cjs.entry.js +239 -0
  8. package/dist/cjs/limel-portal.cjs.entry.js +2024 -0
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/collection/collection-manifest.json +2 -0
  11. package/dist/collection/components/button/button.css +3 -0
  12. package/dist/collection/components/button/button.js +1 -2
  13. package/dist/collection/components/dock/dock-button/dock-button.css +71 -0
  14. package/dist/collection/components/dock/dock-button/dock-button.js +187 -0
  15. package/dist/collection/components/dock/dock.css +107 -0
  16. package/dist/collection/components/dock/dock.js +254 -0
  17. package/dist/collection/components/dock/dock.types.js +1 -0
  18. package/dist/esm/lime-elements.js +1 -1
  19. package/dist/esm/limel-button.entry.js +2 -2
  20. package/dist/esm/{limel-color-picker-palette_2.entry.js → limel-color-picker-palette.entry.js} +2 -113
  21. package/dist/esm/limel-dock-button.entry.js +75 -0
  22. package/dist/esm/limel-dock.entry.js +101 -0
  23. package/dist/esm/{limel-list_3.entry.js → limel-list_2.entry.js} +1 -2018
  24. package/dist/esm/limel-popover_4.entry.js +232 -0
  25. package/dist/esm/limel-portal.entry.js +2020 -0
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/lime-elements/lime-elements.esm.js +1 -1
  28. package/dist/lime-elements/p-009de50e.entry.js +1 -0
  29. package/dist/lime-elements/{p-08251941.entry.js → p-19f72dab.entry.js} +1 -1
  30. package/dist/lime-elements/p-1dfccbc5.entry.js +1 -0
  31. package/dist/lime-elements/p-93cd2268.entry.js +1 -0
  32. package/dist/lime-elements/p-b9af1b40.entry.js +1 -0
  33. package/dist/lime-elements/p-bd098a11.entry.js +1 -0
  34. package/dist/lime-elements/p-fabea4b5.entry.js +1 -0
  35. package/dist/types/components/dock/dock-button/dock-button.d.ts +36 -0
  36. package/dist/types/components/dock/dock.d.ts +71 -0
  37. package/dist/types/components/dock/dock.types.d.ts +53 -0
  38. package/dist/types/components.d.ts +108 -0
  39. package/dist/types/interface.d.ts +1 -0
  40. package/package.json +1 -1
  41. package/dist/cjs/limel-popover-surface.cjs.entry.js +0 -32
  42. package/dist/cjs/limel-tooltip_2.cjs.entry.js +0 -102
  43. package/dist/esm/limel-popover-surface.entry.js +0 -28
  44. package/dist/esm/limel-tooltip_2.entry.js +0 -97
  45. package/dist/lime-elements/p-22569fb6.entry.js +0 -1
  46. package/dist/lime-elements/p-2fbfc1ea.entry.js +0 -1
  47. package/dist/lime-elements/p-705334c1.entry.js +0 -1
  48. package/dist/lime-elements/p-87453b45.entry.js +0 -1
@@ -502,2023 +502,5 @@ const MenuSurface = class {
502
502
  };
503
503
  MenuSurface.style = menuSurfaceCss;
504
504
 
505
- var top = 'top';
506
- var bottom = 'bottom';
507
- var right = 'right';
508
- var left = 'left';
509
- var auto = 'auto';
510
- var basePlacements = [top, bottom, right, left];
511
- var start = 'start';
512
- var end = 'end';
513
- var clippingParents = 'clippingParents';
514
- var viewport = 'viewport';
515
- var popper = 'popper';
516
- var reference = 'reference';
517
- var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
518
- return acc.concat([placement + "-" + start, placement + "-" + end]);
519
- }, []);
520
- var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
521
- return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
522
- }, []); // modifiers that need to read the DOM
523
-
524
- var beforeRead = 'beforeRead';
525
- var read = 'read';
526
- var afterRead = 'afterRead'; // pure-logic modifiers
527
-
528
- var beforeMain = 'beforeMain';
529
- var main = 'main';
530
- var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
531
-
532
- var beforeWrite = 'beforeWrite';
533
- var write = 'write';
534
- var afterWrite = 'afterWrite';
535
- var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
536
-
537
- function getNodeName(element) {
538
- return element ? (element.nodeName || '').toLowerCase() : null;
539
- }
540
-
541
- function getWindow(node) {
542
- if (node == null) {
543
- return window;
544
- }
545
-
546
- if (node.toString() !== '[object Window]') {
547
- var ownerDocument = node.ownerDocument;
548
- return ownerDocument ? ownerDocument.defaultView || window : window;
549
- }
550
-
551
- return node;
552
- }
553
-
554
- function isElement(node) {
555
- var OwnElement = getWindow(node).Element;
556
- return node instanceof OwnElement || node instanceof Element;
557
- }
558
-
559
- function isHTMLElement(node) {
560
- var OwnElement = getWindow(node).HTMLElement;
561
- return node instanceof OwnElement || node instanceof HTMLElement;
562
- }
563
-
564
- function isShadowRoot(node) {
565
- // IE 11 has no ShadowRoot
566
- if (typeof ShadowRoot === 'undefined') {
567
- return false;
568
- }
569
-
570
- var OwnElement = getWindow(node).ShadowRoot;
571
- return node instanceof OwnElement || node instanceof ShadowRoot;
572
- }
573
-
574
- // and applies them to the HTMLElements such as popper and arrow
575
-
576
- function applyStyles(_ref) {
577
- var state = _ref.state;
578
- Object.keys(state.elements).forEach(function (name) {
579
- var style = state.styles[name] || {};
580
- var attributes = state.attributes[name] || {};
581
- var element = state.elements[name]; // arrow is optional + virtual elements
582
-
583
- if (!isHTMLElement(element) || !getNodeName(element)) {
584
- return;
585
- } // Flow doesn't support to extend this property, but it's the most
586
- // effective way to apply styles to an HTMLElement
587
- // $FlowFixMe[cannot-write]
588
-
589
-
590
- Object.assign(element.style, style);
591
- Object.keys(attributes).forEach(function (name) {
592
- var value = attributes[name];
593
-
594
- if (value === false) {
595
- element.removeAttribute(name);
596
- } else {
597
- element.setAttribute(name, value === true ? '' : value);
598
- }
599
- });
600
- });
601
- }
602
-
603
- function effect$2(_ref2) {
604
- var state = _ref2.state;
605
- var initialStyles = {
606
- popper: {
607
- position: state.options.strategy,
608
- left: '0',
609
- top: '0',
610
- margin: '0'
611
- },
612
- arrow: {
613
- position: 'absolute'
614
- },
615
- reference: {}
616
- };
617
- Object.assign(state.elements.popper.style, initialStyles.popper);
618
- state.styles = initialStyles;
619
-
620
- if (state.elements.arrow) {
621
- Object.assign(state.elements.arrow.style, initialStyles.arrow);
622
- }
623
-
624
- return function () {
625
- Object.keys(state.elements).forEach(function (name) {
626
- var element = state.elements[name];
627
- var attributes = state.attributes[name] || {};
628
- var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
629
-
630
- var style = styleProperties.reduce(function (style, property) {
631
- style[property] = '';
632
- return style;
633
- }, {}); // arrow is optional + virtual elements
634
-
635
- if (!isHTMLElement(element) || !getNodeName(element)) {
636
- return;
637
- }
638
-
639
- Object.assign(element.style, style);
640
- Object.keys(attributes).forEach(function (attribute) {
641
- element.removeAttribute(attribute);
642
- });
643
- });
644
- };
645
- } // eslint-disable-next-line import/no-unused-modules
646
-
647
-
648
- const applyStyles$1 = {
649
- name: 'applyStyles',
650
- enabled: true,
651
- phase: 'write',
652
- fn: applyStyles,
653
- effect: effect$2,
654
- requires: ['computeStyles']
655
- };
656
-
657
- function getBasePlacement(placement) {
658
- return placement.split('-')[0];
659
- }
660
-
661
- var max = Math.max;
662
- var min = Math.min;
663
- var round = Math.round;
664
-
665
- function getBoundingClientRect(element, includeScale) {
666
- if (includeScale === void 0) {
667
- includeScale = false;
668
- }
669
-
670
- var rect = element.getBoundingClientRect();
671
- var scaleX = 1;
672
- var scaleY = 1;
673
-
674
- if (isHTMLElement(element) && includeScale) {
675
- var offsetHeight = element.offsetHeight;
676
- var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
677
- // Fallback to 1 in case both values are `0`
678
-
679
- if (offsetWidth > 0) {
680
- scaleX = round(rect.width) / offsetWidth || 1;
681
- }
682
-
683
- if (offsetHeight > 0) {
684
- scaleY = round(rect.height) / offsetHeight || 1;
685
- }
686
- }
687
-
688
- return {
689
- width: rect.width / scaleX,
690
- height: rect.height / scaleY,
691
- top: rect.top / scaleY,
692
- right: rect.right / scaleX,
693
- bottom: rect.bottom / scaleY,
694
- left: rect.left / scaleX,
695
- x: rect.left / scaleX,
696
- y: rect.top / scaleY
697
- };
698
- }
699
-
700
- // means it doesn't take into account transforms.
701
-
702
- function getLayoutRect(element) {
703
- var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
704
- // Fixes https://github.com/popperjs/popper-core/issues/1223
705
-
706
- var width = element.offsetWidth;
707
- var height = element.offsetHeight;
708
-
709
- if (Math.abs(clientRect.width - width) <= 1) {
710
- width = clientRect.width;
711
- }
712
-
713
- if (Math.abs(clientRect.height - height) <= 1) {
714
- height = clientRect.height;
715
- }
716
-
717
- return {
718
- x: element.offsetLeft,
719
- y: element.offsetTop,
720
- width: width,
721
- height: height
722
- };
723
- }
724
-
725
- function contains(parent, child) {
726
- var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
727
-
728
- if (parent.contains(child)) {
729
- return true;
730
- } // then fallback to custom implementation with Shadow DOM support
731
- else if (rootNode && isShadowRoot(rootNode)) {
732
- var next = child;
733
-
734
- do {
735
- if (next && parent.isSameNode(next)) {
736
- return true;
737
- } // $FlowFixMe[prop-missing]: need a better way to handle this...
738
-
739
-
740
- next = next.parentNode || next.host;
741
- } while (next);
742
- } // Give up, the result is false
743
-
744
-
745
- return false;
746
- }
747
-
748
- function getComputedStyle(element) {
749
- return getWindow(element).getComputedStyle(element);
750
- }
751
-
752
- function isTableElement(element) {
753
- return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
754
- }
755
-
756
- function getDocumentElement(element) {
757
- // $FlowFixMe[incompatible-return]: assume body is always available
758
- return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
759
- element.document) || window.document).documentElement;
760
- }
761
-
762
- function getParentNode(element) {
763
- if (getNodeName(element) === 'html') {
764
- return element;
765
- }
766
-
767
- return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
768
- // $FlowFixMe[incompatible-return]
769
- // $FlowFixMe[prop-missing]
770
- element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
771
- element.parentNode || ( // DOM Element detected
772
- isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
773
- // $FlowFixMe[incompatible-call]: HTMLElement is a Node
774
- getDocumentElement(element) // fallback
775
-
776
- );
777
- }
778
-
779
- function getTrueOffsetParent(element) {
780
- if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
781
- getComputedStyle(element).position === 'fixed') {
782
- return null;
783
- }
784
-
785
- return element.offsetParent;
786
- } // `.offsetParent` reports `null` for fixed elements, while absolute elements
787
- // return the containing block
788
-
789
-
790
- function getContainingBlock(element) {
791
- var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
792
- var isIE = navigator.userAgent.indexOf('Trident') !== -1;
793
-
794
- if (isIE && isHTMLElement(element)) {
795
- // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
796
- var elementCss = getComputedStyle(element);
797
-
798
- if (elementCss.position === 'fixed') {
799
- return null;
800
- }
801
- }
802
-
803
- var currentNode = getParentNode(element);
804
-
805
- if (isShadowRoot(currentNode)) {
806
- currentNode = currentNode.host;
807
- }
808
-
809
- while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
810
- var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
811
- // create a containing block.
812
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
813
-
814
- if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
815
- return currentNode;
816
- } else {
817
- currentNode = currentNode.parentNode;
818
- }
819
- }
820
-
821
- return null;
822
- } // Gets the closest ancestor positioned element. Handles some edge cases,
823
- // such as table ancestors and cross browser bugs.
824
-
825
-
826
- function getOffsetParent(element) {
827
- var window = getWindow(element);
828
- var offsetParent = getTrueOffsetParent(element);
829
-
830
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
831
- offsetParent = getTrueOffsetParent(offsetParent);
832
- }
833
-
834
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
835
- return window;
836
- }
837
-
838
- return offsetParent || getContainingBlock(element) || window;
839
- }
840
-
841
- function getMainAxisFromPlacement(placement) {
842
- return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
843
- }
844
-
845
- function within(min$1, value, max$1) {
846
- return max(min$1, min(value, max$1));
847
- }
848
- function withinMaxClamp(min, value, max) {
849
- var v = within(min, value, max);
850
- return v > max ? max : v;
851
- }
852
-
853
- function getFreshSideObject() {
854
- return {
855
- top: 0,
856
- right: 0,
857
- bottom: 0,
858
- left: 0
859
- };
860
- }
861
-
862
- function mergePaddingObject(paddingObject) {
863
- return Object.assign({}, getFreshSideObject(), paddingObject);
864
- }
865
-
866
- function expandToHashMap(value, keys) {
867
- return keys.reduce(function (hashMap, key) {
868
- hashMap[key] = value;
869
- return hashMap;
870
- }, {});
871
- }
872
-
873
- var toPaddingObject = function toPaddingObject(padding, state) {
874
- padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
875
- placement: state.placement
876
- })) : padding;
877
- return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
878
- };
879
-
880
- function arrow(_ref) {
881
- var _state$modifiersData$;
882
-
883
- var state = _ref.state,
884
- name = _ref.name,
885
- options = _ref.options;
886
- var arrowElement = state.elements.arrow;
887
- var popperOffsets = state.modifiersData.popperOffsets;
888
- var basePlacement = getBasePlacement(state.placement);
889
- var axis = getMainAxisFromPlacement(basePlacement);
890
- var isVertical = [left, right].indexOf(basePlacement) >= 0;
891
- var len = isVertical ? 'height' : 'width';
892
-
893
- if (!arrowElement || !popperOffsets) {
894
- return;
895
- }
896
-
897
- var paddingObject = toPaddingObject(options.padding, state);
898
- var arrowRect = getLayoutRect(arrowElement);
899
- var minProp = axis === 'y' ? top : left;
900
- var maxProp = axis === 'y' ? bottom : right;
901
- var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
902
- var startDiff = popperOffsets[axis] - state.rects.reference[axis];
903
- var arrowOffsetParent = getOffsetParent(arrowElement);
904
- var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
905
- var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
906
- // outside of the popper bounds
907
-
908
- var min = paddingObject[minProp];
909
- var max = clientSize - arrowRect[len] - paddingObject[maxProp];
910
- var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
911
- var offset = within(min, center, max); // Prevents breaking syntax highlighting...
912
-
913
- var axisProp = axis;
914
- state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
915
- }
916
-
917
- function effect$1(_ref2) {
918
- var state = _ref2.state,
919
- options = _ref2.options;
920
- var _options$element = options.element,
921
- arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
922
-
923
- if (arrowElement == null) {
924
- return;
925
- } // CSS selector
926
-
927
-
928
- if (typeof arrowElement === 'string') {
929
- arrowElement = state.elements.popper.querySelector(arrowElement);
930
-
931
- if (!arrowElement) {
932
- return;
933
- }
934
- }
935
-
936
- if (!contains(state.elements.popper, arrowElement)) {
937
-
938
- return;
939
- }
940
-
941
- state.elements.arrow = arrowElement;
942
- } // eslint-disable-next-line import/no-unused-modules
943
-
944
-
945
- const arrow$1 = {
946
- name: 'arrow',
947
- enabled: true,
948
- phase: 'main',
949
- fn: arrow,
950
- effect: effect$1,
951
- requires: ['popperOffsets'],
952
- requiresIfExists: ['preventOverflow']
953
- };
954
-
955
- function getVariation(placement) {
956
- return placement.split('-')[1];
957
- }
958
-
959
- var unsetSides = {
960
- top: 'auto',
961
- right: 'auto',
962
- bottom: 'auto',
963
- left: 'auto'
964
- }; // Round the offsets to the nearest suitable subpixel based on the DPR.
965
- // Zooming can change the DPR, but it seems to report a value that will
966
- // cleanly divide the values into the appropriate subpixels.
967
-
968
- function roundOffsetsByDPR(_ref) {
969
- var x = _ref.x,
970
- y = _ref.y;
971
- var win = window;
972
- var dpr = win.devicePixelRatio || 1;
973
- return {
974
- x: round(x * dpr) / dpr || 0,
975
- y: round(y * dpr) / dpr || 0
976
- };
977
- }
978
-
979
- function mapToStyles(_ref2) {
980
- var _Object$assign2;
981
-
982
- var popper = _ref2.popper,
983
- popperRect = _ref2.popperRect,
984
- placement = _ref2.placement,
985
- variation = _ref2.variation,
986
- offsets = _ref2.offsets,
987
- position = _ref2.position,
988
- gpuAcceleration = _ref2.gpuAcceleration,
989
- adaptive = _ref2.adaptive,
990
- roundOffsets = _ref2.roundOffsets,
991
- isFixed = _ref2.isFixed;
992
- var _offsets$x = offsets.x,
993
- x = _offsets$x === void 0 ? 0 : _offsets$x,
994
- _offsets$y = offsets.y,
995
- y = _offsets$y === void 0 ? 0 : _offsets$y;
996
-
997
- var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
998
- x: x,
999
- y: y
1000
- }) : {
1001
- x: x,
1002
- y: y
1003
- };
1004
-
1005
- x = _ref3.x;
1006
- y = _ref3.y;
1007
- var hasX = offsets.hasOwnProperty('x');
1008
- var hasY = offsets.hasOwnProperty('y');
1009
- var sideX = left;
1010
- var sideY = top;
1011
- var win = window;
1012
-
1013
- if (adaptive) {
1014
- var offsetParent = getOffsetParent(popper);
1015
- var heightProp = 'clientHeight';
1016
- var widthProp = 'clientWidth';
1017
-
1018
- if (offsetParent === getWindow(popper)) {
1019
- offsetParent = getDocumentElement(popper);
1020
-
1021
- if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
1022
- heightProp = 'scrollHeight';
1023
- widthProp = 'scrollWidth';
1024
- }
1025
- } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
1026
-
1027
-
1028
- offsetParent = offsetParent;
1029
-
1030
- if (placement === top || (placement === left || placement === right) && variation === end) {
1031
- sideY = bottom;
1032
- var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
1033
- offsetParent[heightProp];
1034
- y -= offsetY - popperRect.height;
1035
- y *= gpuAcceleration ? 1 : -1;
1036
- }
1037
-
1038
- if (placement === left || (placement === top || placement === bottom) && variation === end) {
1039
- sideX = right;
1040
- var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
1041
- offsetParent[widthProp];
1042
- x -= offsetX - popperRect.width;
1043
- x *= gpuAcceleration ? 1 : -1;
1044
- }
1045
- }
1046
-
1047
- var commonStyles = Object.assign({
1048
- position: position
1049
- }, adaptive && unsetSides);
1050
-
1051
- var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
1052
- x: x,
1053
- y: y
1054
- }) : {
1055
- x: x,
1056
- y: y
1057
- };
1058
-
1059
- x = _ref4.x;
1060
- y = _ref4.y;
1061
-
1062
- if (gpuAcceleration) {
1063
- var _Object$assign;
1064
-
1065
- return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
1066
- }
1067
-
1068
- return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
1069
- }
1070
-
1071
- function computeStyles(_ref5) {
1072
- var state = _ref5.state,
1073
- options = _ref5.options;
1074
- var _options$gpuAccelerat = options.gpuAcceleration,
1075
- gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
1076
- _options$adaptive = options.adaptive,
1077
- adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
1078
- _options$roundOffsets = options.roundOffsets,
1079
- roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
1080
-
1081
- var commonStyles = {
1082
- placement: getBasePlacement(state.placement),
1083
- variation: getVariation(state.placement),
1084
- popper: state.elements.popper,
1085
- popperRect: state.rects.popper,
1086
- gpuAcceleration: gpuAcceleration,
1087
- isFixed: state.options.strategy === 'fixed'
1088
- };
1089
-
1090
- if (state.modifiersData.popperOffsets != null) {
1091
- state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
1092
- offsets: state.modifiersData.popperOffsets,
1093
- position: state.options.strategy,
1094
- adaptive: adaptive,
1095
- roundOffsets: roundOffsets
1096
- })));
1097
- }
1098
-
1099
- if (state.modifiersData.arrow != null) {
1100
- state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
1101
- offsets: state.modifiersData.arrow,
1102
- position: 'absolute',
1103
- adaptive: false,
1104
- roundOffsets: roundOffsets
1105
- })));
1106
- }
1107
-
1108
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
1109
- 'data-popper-placement': state.placement
1110
- });
1111
- } // eslint-disable-next-line import/no-unused-modules
1112
-
1113
-
1114
- const computeStyles$1 = {
1115
- name: 'computeStyles',
1116
- enabled: true,
1117
- phase: 'beforeWrite',
1118
- fn: computeStyles,
1119
- data: {}
1120
- };
1121
-
1122
- var passive = {
1123
- passive: true
1124
- };
1125
-
1126
- function effect(_ref) {
1127
- var state = _ref.state,
1128
- instance = _ref.instance,
1129
- options = _ref.options;
1130
- var _options$scroll = options.scroll,
1131
- scroll = _options$scroll === void 0 ? true : _options$scroll,
1132
- _options$resize = options.resize,
1133
- resize = _options$resize === void 0 ? true : _options$resize;
1134
- var window = getWindow(state.elements.popper);
1135
- var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
1136
-
1137
- if (scroll) {
1138
- scrollParents.forEach(function (scrollParent) {
1139
- scrollParent.addEventListener('scroll', instance.update, passive);
1140
- });
1141
- }
1142
-
1143
- if (resize) {
1144
- window.addEventListener('resize', instance.update, passive);
1145
- }
1146
-
1147
- return function () {
1148
- if (scroll) {
1149
- scrollParents.forEach(function (scrollParent) {
1150
- scrollParent.removeEventListener('scroll', instance.update, passive);
1151
- });
1152
- }
1153
-
1154
- if (resize) {
1155
- window.removeEventListener('resize', instance.update, passive);
1156
- }
1157
- };
1158
- } // eslint-disable-next-line import/no-unused-modules
1159
-
1160
-
1161
- const eventListeners = {
1162
- name: 'eventListeners',
1163
- enabled: true,
1164
- phase: 'write',
1165
- fn: function fn() {},
1166
- effect: effect,
1167
- data: {}
1168
- };
1169
-
1170
- var hash$1 = {
1171
- left: 'right',
1172
- right: 'left',
1173
- bottom: 'top',
1174
- top: 'bottom'
1175
- };
1176
- function getOppositePlacement(placement) {
1177
- return placement.replace(/left|right|bottom|top/g, function (matched) {
1178
- return hash$1[matched];
1179
- });
1180
- }
1181
-
1182
- var hash = {
1183
- start: 'end',
1184
- end: 'start'
1185
- };
1186
- function getOppositeVariationPlacement(placement) {
1187
- return placement.replace(/start|end/g, function (matched) {
1188
- return hash[matched];
1189
- });
1190
- }
1191
-
1192
- function getWindowScroll(node) {
1193
- var win = getWindow(node);
1194
- var scrollLeft = win.pageXOffset;
1195
- var scrollTop = win.pageYOffset;
1196
- return {
1197
- scrollLeft: scrollLeft,
1198
- scrollTop: scrollTop
1199
- };
1200
- }
1201
-
1202
- function getWindowScrollBarX(element) {
1203
- // If <html> has a CSS width greater than the viewport, then this will be
1204
- // incorrect for RTL.
1205
- // Popper 1 is broken in this case and never had a bug report so let's assume
1206
- // it's not an issue. I don't think anyone ever specifies width on <html>
1207
- // anyway.
1208
- // Browsers where the left scrollbar doesn't cause an issue report `0` for
1209
- // this (e.g. Edge 2019, IE11, Safari)
1210
- return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
1211
- }
1212
-
1213
- function getViewportRect(element) {
1214
- var win = getWindow(element);
1215
- var html = getDocumentElement(element);
1216
- var visualViewport = win.visualViewport;
1217
- var width = html.clientWidth;
1218
- var height = html.clientHeight;
1219
- var x = 0;
1220
- var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
1221
- // can be obscured underneath it.
1222
- // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
1223
- // if it isn't open, so if this isn't available, the popper will be detected
1224
- // to overflow the bottom of the screen too early.
1225
-
1226
- if (visualViewport) {
1227
- width = visualViewport.width;
1228
- height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
1229
- // In Chrome, it returns a value very close to 0 (+/-) but contains rounding
1230
- // errors due to floating point numbers, so we need to check precision.
1231
- // Safari returns a number <= 0, usually < -1 when pinch-zoomed
1232
- // Feature detection fails in mobile emulation mode in Chrome.
1233
- // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
1234
- // 0.001
1235
- // Fallback here: "Not Safari" userAgent
1236
-
1237
- if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
1238
- x = visualViewport.offsetLeft;
1239
- y = visualViewport.offsetTop;
1240
- }
1241
- }
1242
-
1243
- return {
1244
- width: width,
1245
- height: height,
1246
- x: x + getWindowScrollBarX(element),
1247
- y: y
1248
- };
1249
- }
1250
-
1251
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable
1252
-
1253
- function getDocumentRect(element) {
1254
- var _element$ownerDocumen;
1255
-
1256
- var html = getDocumentElement(element);
1257
- var winScroll = getWindowScroll(element);
1258
- var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
1259
- var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
1260
- var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
1261
- var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
1262
- var y = -winScroll.scrollTop;
1263
-
1264
- if (getComputedStyle(body || html).direction === 'rtl') {
1265
- x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
1266
- }
1267
-
1268
- return {
1269
- width: width,
1270
- height: height,
1271
- x: x,
1272
- y: y
1273
- };
1274
- }
1275
-
1276
- function isScrollParent(element) {
1277
- // Firefox wants us to check `-x` and `-y` variations as well
1278
- var _getComputedStyle = getComputedStyle(element),
1279
- overflow = _getComputedStyle.overflow,
1280
- overflowX = _getComputedStyle.overflowX,
1281
- overflowY = _getComputedStyle.overflowY;
1282
-
1283
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
1284
- }
1285
-
1286
- function getScrollParent(node) {
1287
- if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
1288
- // $FlowFixMe[incompatible-return]: assume body is always available
1289
- return node.ownerDocument.body;
1290
- }
1291
-
1292
- if (isHTMLElement(node) && isScrollParent(node)) {
1293
- return node;
1294
- }
1295
-
1296
- return getScrollParent(getParentNode(node));
1297
- }
1298
-
1299
- /*
1300
- given a DOM element, return the list of all scroll parents, up the list of ancesors
1301
- until we get to the top window object. This list is what we attach scroll listeners
1302
- to, because if any of these parent elements scroll, we'll need to re-calculate the
1303
- reference element's position.
1304
- */
1305
-
1306
- function listScrollParents(element, list) {
1307
- var _element$ownerDocumen;
1308
-
1309
- if (list === void 0) {
1310
- list = [];
1311
- }
1312
-
1313
- var scrollParent = getScrollParent(element);
1314
- var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
1315
- var win = getWindow(scrollParent);
1316
- var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
1317
- var updatedList = list.concat(target);
1318
- return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
1319
- updatedList.concat(listScrollParents(getParentNode(target)));
1320
- }
1321
-
1322
- function rectToClientRect(rect) {
1323
- return Object.assign({}, rect, {
1324
- left: rect.x,
1325
- top: rect.y,
1326
- right: rect.x + rect.width,
1327
- bottom: rect.y + rect.height
1328
- });
1329
- }
1330
-
1331
- function getInnerBoundingClientRect(element) {
1332
- var rect = getBoundingClientRect(element);
1333
- rect.top = rect.top + element.clientTop;
1334
- rect.left = rect.left + element.clientLeft;
1335
- rect.bottom = rect.top + element.clientHeight;
1336
- rect.right = rect.left + element.clientWidth;
1337
- rect.width = element.clientWidth;
1338
- rect.height = element.clientHeight;
1339
- rect.x = rect.left;
1340
- rect.y = rect.top;
1341
- return rect;
1342
- }
1343
-
1344
- function getClientRectFromMixedType(element, clippingParent) {
1345
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
1346
- } // A "clipping parent" is an overflowable container with the characteristic of
1347
- // clipping (or hiding) overflowing elements with a position different from
1348
- // `initial`
1349
-
1350
-
1351
- function getClippingParents(element) {
1352
- var clippingParents = listScrollParents(getParentNode(element));
1353
- var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
1354
- var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
1355
-
1356
- if (!isElement(clipperElement)) {
1357
- return [];
1358
- } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
1359
-
1360
-
1361
- return clippingParents.filter(function (clippingParent) {
1362
- return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
1363
- });
1364
- } // Gets the maximum area that the element is visible in due to any number of
1365
- // clipping parents
1366
-
1367
-
1368
- function getClippingRect(element, boundary, rootBoundary) {
1369
- var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
1370
- var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
1371
- var firstClippingParent = clippingParents[0];
1372
- var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
1373
- var rect = getClientRectFromMixedType(element, clippingParent);
1374
- accRect.top = max(rect.top, accRect.top);
1375
- accRect.right = min(rect.right, accRect.right);
1376
- accRect.bottom = min(rect.bottom, accRect.bottom);
1377
- accRect.left = max(rect.left, accRect.left);
1378
- return accRect;
1379
- }, getClientRectFromMixedType(element, firstClippingParent));
1380
- clippingRect.width = clippingRect.right - clippingRect.left;
1381
- clippingRect.height = clippingRect.bottom - clippingRect.top;
1382
- clippingRect.x = clippingRect.left;
1383
- clippingRect.y = clippingRect.top;
1384
- return clippingRect;
1385
- }
1386
-
1387
- function computeOffsets(_ref) {
1388
- var reference = _ref.reference,
1389
- element = _ref.element,
1390
- placement = _ref.placement;
1391
- var basePlacement = placement ? getBasePlacement(placement) : null;
1392
- var variation = placement ? getVariation(placement) : null;
1393
- var commonX = reference.x + reference.width / 2 - element.width / 2;
1394
- var commonY = reference.y + reference.height / 2 - element.height / 2;
1395
- var offsets;
1396
-
1397
- switch (basePlacement) {
1398
- case top:
1399
- offsets = {
1400
- x: commonX,
1401
- y: reference.y - element.height
1402
- };
1403
- break;
1404
-
1405
- case bottom:
1406
- offsets = {
1407
- x: commonX,
1408
- y: reference.y + reference.height
1409
- };
1410
- break;
1411
-
1412
- case right:
1413
- offsets = {
1414
- x: reference.x + reference.width,
1415
- y: commonY
1416
- };
1417
- break;
1418
-
1419
- case left:
1420
- offsets = {
1421
- x: reference.x - element.width,
1422
- y: commonY
1423
- };
1424
- break;
1425
-
1426
- default:
1427
- offsets = {
1428
- x: reference.x,
1429
- y: reference.y
1430
- };
1431
- }
1432
-
1433
- var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
1434
-
1435
- if (mainAxis != null) {
1436
- var len = mainAxis === 'y' ? 'height' : 'width';
1437
-
1438
- switch (variation) {
1439
- case start:
1440
- offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
1441
- break;
1442
-
1443
- case end:
1444
- offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
1445
- break;
1446
- }
1447
- }
1448
-
1449
- return offsets;
1450
- }
1451
-
1452
- function detectOverflow(state, options) {
1453
- if (options === void 0) {
1454
- options = {};
1455
- }
1456
-
1457
- var _options = options,
1458
- _options$placement = _options.placement,
1459
- placement = _options$placement === void 0 ? state.placement : _options$placement,
1460
- _options$boundary = _options.boundary,
1461
- boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
1462
- _options$rootBoundary = _options.rootBoundary,
1463
- rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
1464
- _options$elementConte = _options.elementContext,
1465
- elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
1466
- _options$altBoundary = _options.altBoundary,
1467
- altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
1468
- _options$padding = _options.padding,
1469
- padding = _options$padding === void 0 ? 0 : _options$padding;
1470
- var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
1471
- var altContext = elementContext === popper ? reference : popper;
1472
- var popperRect = state.rects.popper;
1473
- var element = state.elements[altBoundary ? altContext : elementContext];
1474
- var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
1475
- var referenceClientRect = getBoundingClientRect(state.elements.reference);
1476
- var popperOffsets = computeOffsets({
1477
- reference: referenceClientRect,
1478
- element: popperRect,
1479
- strategy: 'absolute',
1480
- placement: placement
1481
- });
1482
- var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
1483
- var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
1484
- // 0 or negative = within the clipping rect
1485
-
1486
- var overflowOffsets = {
1487
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
1488
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
1489
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
1490
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
1491
- };
1492
- var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
1493
-
1494
- if (elementContext === popper && offsetData) {
1495
- var offset = offsetData[placement];
1496
- Object.keys(overflowOffsets).forEach(function (key) {
1497
- var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
1498
- var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
1499
- overflowOffsets[key] += offset[axis] * multiply;
1500
- });
1501
- }
1502
-
1503
- return overflowOffsets;
1504
- }
1505
-
1506
- function computeAutoPlacement(state, options) {
1507
- if (options === void 0) {
1508
- options = {};
1509
- }
1510
-
1511
- var _options = options,
1512
- placement = _options.placement,
1513
- boundary = _options.boundary,
1514
- rootBoundary = _options.rootBoundary,
1515
- padding = _options.padding,
1516
- flipVariations = _options.flipVariations,
1517
- _options$allowedAutoP = _options.allowedAutoPlacements,
1518
- allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
1519
- var variation = getVariation(placement);
1520
- var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
1521
- return getVariation(placement) === variation;
1522
- }) : basePlacements;
1523
- var allowedPlacements = placements$1.filter(function (placement) {
1524
- return allowedAutoPlacements.indexOf(placement) >= 0;
1525
- });
1526
-
1527
- if (allowedPlacements.length === 0) {
1528
- allowedPlacements = placements$1;
1529
- } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
1530
-
1531
-
1532
- var overflows = allowedPlacements.reduce(function (acc, placement) {
1533
- acc[placement] = detectOverflow(state, {
1534
- placement: placement,
1535
- boundary: boundary,
1536
- rootBoundary: rootBoundary,
1537
- padding: padding
1538
- })[getBasePlacement(placement)];
1539
- return acc;
1540
- }, {});
1541
- return Object.keys(overflows).sort(function (a, b) {
1542
- return overflows[a] - overflows[b];
1543
- });
1544
- }
1545
-
1546
- function getExpandedFallbackPlacements(placement) {
1547
- if (getBasePlacement(placement) === auto) {
1548
- return [];
1549
- }
1550
-
1551
- var oppositePlacement = getOppositePlacement(placement);
1552
- return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
1553
- }
1554
-
1555
- function flip(_ref) {
1556
- var state = _ref.state,
1557
- options = _ref.options,
1558
- name = _ref.name;
1559
-
1560
- if (state.modifiersData[name]._skip) {
1561
- return;
1562
- }
1563
-
1564
- var _options$mainAxis = options.mainAxis,
1565
- checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1566
- _options$altAxis = options.altAxis,
1567
- checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
1568
- specifiedFallbackPlacements = options.fallbackPlacements,
1569
- padding = options.padding,
1570
- boundary = options.boundary,
1571
- rootBoundary = options.rootBoundary,
1572
- altBoundary = options.altBoundary,
1573
- _options$flipVariatio = options.flipVariations,
1574
- flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
1575
- allowedAutoPlacements = options.allowedAutoPlacements;
1576
- var preferredPlacement = state.options.placement;
1577
- var basePlacement = getBasePlacement(preferredPlacement);
1578
- var isBasePlacement = basePlacement === preferredPlacement;
1579
- var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
1580
- var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
1581
- return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
1582
- placement: placement,
1583
- boundary: boundary,
1584
- rootBoundary: rootBoundary,
1585
- padding: padding,
1586
- flipVariations: flipVariations,
1587
- allowedAutoPlacements: allowedAutoPlacements
1588
- }) : placement);
1589
- }, []);
1590
- var referenceRect = state.rects.reference;
1591
- var popperRect = state.rects.popper;
1592
- var checksMap = new Map();
1593
- var makeFallbackChecks = true;
1594
- var firstFittingPlacement = placements[0];
1595
-
1596
- for (var i = 0; i < placements.length; i++) {
1597
- var placement = placements[i];
1598
-
1599
- var _basePlacement = getBasePlacement(placement);
1600
-
1601
- var isStartVariation = getVariation(placement) === start;
1602
- var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
1603
- var len = isVertical ? 'width' : 'height';
1604
- var overflow = detectOverflow(state, {
1605
- placement: placement,
1606
- boundary: boundary,
1607
- rootBoundary: rootBoundary,
1608
- altBoundary: altBoundary,
1609
- padding: padding
1610
- });
1611
- var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
1612
-
1613
- if (referenceRect[len] > popperRect[len]) {
1614
- mainVariationSide = getOppositePlacement(mainVariationSide);
1615
- }
1616
-
1617
- var altVariationSide = getOppositePlacement(mainVariationSide);
1618
- var checks = [];
1619
-
1620
- if (checkMainAxis) {
1621
- checks.push(overflow[_basePlacement] <= 0);
1622
- }
1623
-
1624
- if (checkAltAxis) {
1625
- checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
1626
- }
1627
-
1628
- if (checks.every(function (check) {
1629
- return check;
1630
- })) {
1631
- firstFittingPlacement = placement;
1632
- makeFallbackChecks = false;
1633
- break;
1634
- }
1635
-
1636
- checksMap.set(placement, checks);
1637
- }
1638
-
1639
- if (makeFallbackChecks) {
1640
- // `2` may be desired in some cases – research later
1641
- var numberOfChecks = flipVariations ? 3 : 1;
1642
-
1643
- var _loop = function _loop(_i) {
1644
- var fittingPlacement = placements.find(function (placement) {
1645
- var checks = checksMap.get(placement);
1646
-
1647
- if (checks) {
1648
- return checks.slice(0, _i).every(function (check) {
1649
- return check;
1650
- });
1651
- }
1652
- });
1653
-
1654
- if (fittingPlacement) {
1655
- firstFittingPlacement = fittingPlacement;
1656
- return "break";
1657
- }
1658
- };
1659
-
1660
- for (var _i = numberOfChecks; _i > 0; _i--) {
1661
- var _ret = _loop(_i);
1662
-
1663
- if (_ret === "break") break;
1664
- }
1665
- }
1666
-
1667
- if (state.placement !== firstFittingPlacement) {
1668
- state.modifiersData[name]._skip = true;
1669
- state.placement = firstFittingPlacement;
1670
- state.reset = true;
1671
- }
1672
- } // eslint-disable-next-line import/no-unused-modules
1673
-
1674
-
1675
- const flip$1 = {
1676
- name: 'flip',
1677
- enabled: true,
1678
- phase: 'main',
1679
- fn: flip,
1680
- requiresIfExists: ['offset'],
1681
- data: {
1682
- _skip: false
1683
- }
1684
- };
1685
-
1686
- function getSideOffsets(overflow, rect, preventedOffsets) {
1687
- if (preventedOffsets === void 0) {
1688
- preventedOffsets = {
1689
- x: 0,
1690
- y: 0
1691
- };
1692
- }
1693
-
1694
- return {
1695
- top: overflow.top - rect.height - preventedOffsets.y,
1696
- right: overflow.right - rect.width + preventedOffsets.x,
1697
- bottom: overflow.bottom - rect.height + preventedOffsets.y,
1698
- left: overflow.left - rect.width - preventedOffsets.x
1699
- };
1700
- }
1701
-
1702
- function isAnySideFullyClipped(overflow) {
1703
- return [top, right, bottom, left].some(function (side) {
1704
- return overflow[side] >= 0;
1705
- });
1706
- }
1707
-
1708
- function hide(_ref) {
1709
- var state = _ref.state,
1710
- name = _ref.name;
1711
- var referenceRect = state.rects.reference;
1712
- var popperRect = state.rects.popper;
1713
- var preventedOffsets = state.modifiersData.preventOverflow;
1714
- var referenceOverflow = detectOverflow(state, {
1715
- elementContext: 'reference'
1716
- });
1717
- var popperAltOverflow = detectOverflow(state, {
1718
- altBoundary: true
1719
- });
1720
- var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
1721
- var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
1722
- var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
1723
- var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
1724
- state.modifiersData[name] = {
1725
- referenceClippingOffsets: referenceClippingOffsets,
1726
- popperEscapeOffsets: popperEscapeOffsets,
1727
- isReferenceHidden: isReferenceHidden,
1728
- hasPopperEscaped: hasPopperEscaped
1729
- };
1730
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
1731
- 'data-popper-reference-hidden': isReferenceHidden,
1732
- 'data-popper-escaped': hasPopperEscaped
1733
- });
1734
- } // eslint-disable-next-line import/no-unused-modules
1735
-
1736
-
1737
- const hide$1 = {
1738
- name: 'hide',
1739
- enabled: true,
1740
- phase: 'main',
1741
- requiresIfExists: ['preventOverflow'],
1742
- fn: hide
1743
- };
1744
-
1745
- function distanceAndSkiddingToXY(placement, rects, offset) {
1746
- var basePlacement = getBasePlacement(placement);
1747
- var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
1748
-
1749
- var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
1750
- placement: placement
1751
- })) : offset,
1752
- skidding = _ref[0],
1753
- distance = _ref[1];
1754
-
1755
- skidding = skidding || 0;
1756
- distance = (distance || 0) * invertDistance;
1757
- return [left, right].indexOf(basePlacement) >= 0 ? {
1758
- x: distance,
1759
- y: skidding
1760
- } : {
1761
- x: skidding,
1762
- y: distance
1763
- };
1764
- }
1765
-
1766
- function offset(_ref2) {
1767
- var state = _ref2.state,
1768
- options = _ref2.options,
1769
- name = _ref2.name;
1770
- var _options$offset = options.offset,
1771
- offset = _options$offset === void 0 ? [0, 0] : _options$offset;
1772
- var data = placements.reduce(function (acc, placement) {
1773
- acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
1774
- return acc;
1775
- }, {});
1776
- var _data$state$placement = data[state.placement],
1777
- x = _data$state$placement.x,
1778
- y = _data$state$placement.y;
1779
-
1780
- if (state.modifiersData.popperOffsets != null) {
1781
- state.modifiersData.popperOffsets.x += x;
1782
- state.modifiersData.popperOffsets.y += y;
1783
- }
1784
-
1785
- state.modifiersData[name] = data;
1786
- } // eslint-disable-next-line import/no-unused-modules
1787
-
1788
-
1789
- const offset$1 = {
1790
- name: 'offset',
1791
- enabled: true,
1792
- phase: 'main',
1793
- requires: ['popperOffsets'],
1794
- fn: offset
1795
- };
1796
-
1797
- function popperOffsets(_ref) {
1798
- var state = _ref.state,
1799
- name = _ref.name;
1800
- // Offsets are the actual position the popper needs to have to be
1801
- // properly positioned near its reference element
1802
- // This is the most basic placement, and will be adjusted by
1803
- // the modifiers in the next step
1804
- state.modifiersData[name] = computeOffsets({
1805
- reference: state.rects.reference,
1806
- element: state.rects.popper,
1807
- strategy: 'absolute',
1808
- placement: state.placement
1809
- });
1810
- } // eslint-disable-next-line import/no-unused-modules
1811
-
1812
-
1813
- const popperOffsets$1 = {
1814
- name: 'popperOffsets',
1815
- enabled: true,
1816
- phase: 'read',
1817
- fn: popperOffsets,
1818
- data: {}
1819
- };
1820
-
1821
- function getAltAxis(axis) {
1822
- return axis === 'x' ? 'y' : 'x';
1823
- }
1824
-
1825
- function preventOverflow(_ref) {
1826
- var state = _ref.state,
1827
- options = _ref.options,
1828
- name = _ref.name;
1829
- var _options$mainAxis = options.mainAxis,
1830
- checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
1831
- _options$altAxis = options.altAxis,
1832
- checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
1833
- boundary = options.boundary,
1834
- rootBoundary = options.rootBoundary,
1835
- altBoundary = options.altBoundary,
1836
- padding = options.padding,
1837
- _options$tether = options.tether,
1838
- tether = _options$tether === void 0 ? true : _options$tether,
1839
- _options$tetherOffset = options.tetherOffset,
1840
- tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
1841
- var overflow = detectOverflow(state, {
1842
- boundary: boundary,
1843
- rootBoundary: rootBoundary,
1844
- padding: padding,
1845
- altBoundary: altBoundary
1846
- });
1847
- var basePlacement = getBasePlacement(state.placement);
1848
- var variation = getVariation(state.placement);
1849
- var isBasePlacement = !variation;
1850
- var mainAxis = getMainAxisFromPlacement(basePlacement);
1851
- var altAxis = getAltAxis(mainAxis);
1852
- var popperOffsets = state.modifiersData.popperOffsets;
1853
- var referenceRect = state.rects.reference;
1854
- var popperRect = state.rects.popper;
1855
- var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1856
- placement: state.placement
1857
- })) : tetherOffset;
1858
- var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1859
- mainAxis: tetherOffsetValue,
1860
- altAxis: tetherOffsetValue
1861
- } : Object.assign({
1862
- mainAxis: 0,
1863
- altAxis: 0
1864
- }, tetherOffsetValue);
1865
- var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1866
- var data = {
1867
- x: 0,
1868
- y: 0
1869
- };
1870
-
1871
- if (!popperOffsets) {
1872
- return;
1873
- }
1874
-
1875
- if (checkMainAxis) {
1876
- var _offsetModifierState$;
1877
-
1878
- var mainSide = mainAxis === 'y' ? top : left;
1879
- var altSide = mainAxis === 'y' ? bottom : right;
1880
- var len = mainAxis === 'y' ? 'height' : 'width';
1881
- var offset = popperOffsets[mainAxis];
1882
- var min$1 = offset + overflow[mainSide];
1883
- var max$1 = offset - overflow[altSide];
1884
- var additive = tether ? -popperRect[len] / 2 : 0;
1885
- var minLen = variation === start ? referenceRect[len] : popperRect[len];
1886
- var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
1887
- // outside the reference bounds
1888
-
1889
- var arrowElement = state.elements.arrow;
1890
- var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
1891
- width: 0,
1892
- height: 0
1893
- };
1894
- var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
1895
- var arrowPaddingMin = arrowPaddingObject[mainSide];
1896
- var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
1897
- // to include its full size in the calculation. If the reference is small
1898
- // and near the edge of a boundary, the popper can overflow even if the
1899
- // reference is not overflowing as well (e.g. virtual elements with no
1900
- // width or height)
1901
-
1902
- var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1903
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1904
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1905
- var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1906
- var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1907
- var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1908
- var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1909
- var tetherMax = offset + maxOffset - offsetModifierValue;
1910
- var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1911
- popperOffsets[mainAxis] = preventedOffset;
1912
- data[mainAxis] = preventedOffset - offset;
1913
- }
1914
-
1915
- if (checkAltAxis) {
1916
- var _offsetModifierState$2;
1917
-
1918
- var _mainSide = mainAxis === 'x' ? top : left;
1919
-
1920
- var _altSide = mainAxis === 'x' ? bottom : right;
1921
-
1922
- var _offset = popperOffsets[altAxis];
1923
-
1924
- var _len = altAxis === 'y' ? 'height' : 'width';
1925
-
1926
- var _min = _offset + overflow[_mainSide];
1927
-
1928
- var _max = _offset - overflow[_altSide];
1929
-
1930
- var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1931
-
1932
- var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1933
-
1934
- var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1935
-
1936
- var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1937
-
1938
- var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1939
-
1940
- popperOffsets[altAxis] = _preventedOffset;
1941
- data[altAxis] = _preventedOffset - _offset;
1942
- }
1943
-
1944
- state.modifiersData[name] = data;
1945
- } // eslint-disable-next-line import/no-unused-modules
1946
-
1947
-
1948
- const preventOverflow$1 = {
1949
- name: 'preventOverflow',
1950
- enabled: true,
1951
- phase: 'main',
1952
- fn: preventOverflow,
1953
- requiresIfExists: ['offset']
1954
- };
1955
-
1956
- function getHTMLElementScroll(element) {
1957
- return {
1958
- scrollLeft: element.scrollLeft,
1959
- scrollTop: element.scrollTop
1960
- };
1961
- }
1962
-
1963
- function getNodeScroll(node) {
1964
- if (node === getWindow(node) || !isHTMLElement(node)) {
1965
- return getWindowScroll(node);
1966
- } else {
1967
- return getHTMLElementScroll(node);
1968
- }
1969
- }
1970
-
1971
- function isElementScaled(element) {
1972
- var rect = element.getBoundingClientRect();
1973
- var scaleX = round(rect.width) / element.offsetWidth || 1;
1974
- var scaleY = round(rect.height) / element.offsetHeight || 1;
1975
- return scaleX !== 1 || scaleY !== 1;
1976
- } // Returns the composite rect of an element relative to its offsetParent.
1977
- // Composite means it takes into account transforms as well as layout.
1978
-
1979
-
1980
- function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1981
- if (isFixed === void 0) {
1982
- isFixed = false;
1983
- }
1984
-
1985
- var isOffsetParentAnElement = isHTMLElement(offsetParent);
1986
- var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1987
- var documentElement = getDocumentElement(offsetParent);
1988
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1989
- var scroll = {
1990
- scrollLeft: 0,
1991
- scrollTop: 0
1992
- };
1993
- var offsets = {
1994
- x: 0,
1995
- y: 0
1996
- };
1997
-
1998
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1999
- if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
2000
- isScrollParent(documentElement)) {
2001
- scroll = getNodeScroll(offsetParent);
2002
- }
2003
-
2004
- if (isHTMLElement(offsetParent)) {
2005
- offsets = getBoundingClientRect(offsetParent, true);
2006
- offsets.x += offsetParent.clientLeft;
2007
- offsets.y += offsetParent.clientTop;
2008
- } else if (documentElement) {
2009
- offsets.x = getWindowScrollBarX(documentElement);
2010
- }
2011
- }
2012
-
2013
- return {
2014
- x: rect.left + scroll.scrollLeft - offsets.x,
2015
- y: rect.top + scroll.scrollTop - offsets.y,
2016
- width: rect.width,
2017
- height: rect.height
2018
- };
2019
- }
2020
-
2021
- function order(modifiers) {
2022
- var map = new Map();
2023
- var visited = new Set();
2024
- var result = [];
2025
- modifiers.forEach(function (modifier) {
2026
- map.set(modifier.name, modifier);
2027
- }); // On visiting object, check for its dependencies and visit them recursively
2028
-
2029
- function sort(modifier) {
2030
- visited.add(modifier.name);
2031
- var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
2032
- requires.forEach(function (dep) {
2033
- if (!visited.has(dep)) {
2034
- var depModifier = map.get(dep);
2035
-
2036
- if (depModifier) {
2037
- sort(depModifier);
2038
- }
2039
- }
2040
- });
2041
- result.push(modifier);
2042
- }
2043
-
2044
- modifiers.forEach(function (modifier) {
2045
- if (!visited.has(modifier.name)) {
2046
- // check for visited object
2047
- sort(modifier);
2048
- }
2049
- });
2050
- return result;
2051
- }
2052
-
2053
- function orderModifiers(modifiers) {
2054
- // order based on dependencies
2055
- var orderedModifiers = order(modifiers); // order based on phase
2056
-
2057
- return modifierPhases.reduce(function (acc, phase) {
2058
- return acc.concat(orderedModifiers.filter(function (modifier) {
2059
- return modifier.phase === phase;
2060
- }));
2061
- }, []);
2062
- }
2063
-
2064
- function debounce(fn) {
2065
- var pending;
2066
- return function () {
2067
- if (!pending) {
2068
- pending = new Promise(function (resolve) {
2069
- Promise.resolve().then(function () {
2070
- pending = undefined;
2071
- resolve(fn());
2072
- });
2073
- });
2074
- }
2075
-
2076
- return pending;
2077
- };
2078
- }
2079
-
2080
- function mergeByName(modifiers) {
2081
- var merged = modifiers.reduce(function (merged, current) {
2082
- var existing = merged[current.name];
2083
- merged[current.name] = existing ? Object.assign({}, existing, current, {
2084
- options: Object.assign({}, existing.options, current.options),
2085
- data: Object.assign({}, existing.data, current.data)
2086
- }) : current;
2087
- return merged;
2088
- }, {}); // IE11 does not support Object.values
2089
-
2090
- return Object.keys(merged).map(function (key) {
2091
- return merged[key];
2092
- });
2093
- }
2094
-
2095
- var DEFAULT_OPTIONS = {
2096
- placement: 'bottom',
2097
- modifiers: [],
2098
- strategy: 'absolute'
2099
- };
2100
-
2101
- function areValidElements() {
2102
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2103
- args[_key] = arguments[_key];
2104
- }
2105
-
2106
- return !args.some(function (element) {
2107
- return !(element && typeof element.getBoundingClientRect === 'function');
2108
- });
2109
- }
2110
-
2111
- function popperGenerator(generatorOptions) {
2112
- if (generatorOptions === void 0) {
2113
- generatorOptions = {};
2114
- }
2115
-
2116
- var _generatorOptions = generatorOptions,
2117
- _generatorOptions$def = _generatorOptions.defaultModifiers,
2118
- defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
2119
- _generatorOptions$def2 = _generatorOptions.defaultOptions,
2120
- defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
2121
- return function createPopper(reference, popper, options) {
2122
- if (options === void 0) {
2123
- options = defaultOptions;
2124
- }
2125
-
2126
- var state = {
2127
- placement: 'bottom',
2128
- orderedModifiers: [],
2129
- options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
2130
- modifiersData: {},
2131
- elements: {
2132
- reference: reference,
2133
- popper: popper
2134
- },
2135
- attributes: {},
2136
- styles: {}
2137
- };
2138
- var effectCleanupFns = [];
2139
- var isDestroyed = false;
2140
- var instance = {
2141
- state: state,
2142
- setOptions: function setOptions(setOptionsAction) {
2143
- var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
2144
- cleanupModifierEffects();
2145
- state.options = Object.assign({}, defaultOptions, state.options, options);
2146
- state.scrollParents = {
2147
- reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
2148
- popper: listScrollParents(popper)
2149
- }; // Orders the modifiers based on their dependencies and `phase`
2150
- // properties
2151
-
2152
- var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
2153
-
2154
- state.orderedModifiers = orderedModifiers.filter(function (m) {
2155
- return m.enabled;
2156
- }); // Validate the provided modifiers so that the consumer will get warned
2157
-
2158
- runModifierEffects();
2159
- return instance.update();
2160
- },
2161
- // Sync update – it will always be executed, even if not necessary. This
2162
- // is useful for low frequency updates where sync behavior simplifies the
2163
- // logic.
2164
- // For high frequency updates (e.g. `resize` and `scroll` events), always
2165
- // prefer the async Popper#update method
2166
- forceUpdate: function forceUpdate() {
2167
- if (isDestroyed) {
2168
- return;
2169
- }
2170
-
2171
- var _state$elements = state.elements,
2172
- reference = _state$elements.reference,
2173
- popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
2174
- // anymore
2175
-
2176
- if (!areValidElements(reference, popper)) {
2177
-
2178
- return;
2179
- } // Store the reference and popper rects to be read by modifiers
2180
-
2181
-
2182
- state.rects = {
2183
- reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
2184
- popper: getLayoutRect(popper)
2185
- }; // Modifiers have the ability to reset the current update cycle. The
2186
- // most common use case for this is the `flip` modifier changing the
2187
- // placement, which then needs to re-run all the modifiers, because the
2188
- // logic was previously ran for the previous placement and is therefore
2189
- // stale/incorrect
2190
-
2191
- state.reset = false;
2192
- state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
2193
- // is filled with the initial data specified by the modifier. This means
2194
- // it doesn't persist and is fresh on each update.
2195
- // To ensure persistent data, use `${name}#persistent`
2196
-
2197
- state.orderedModifiers.forEach(function (modifier) {
2198
- return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
2199
- });
2200
-
2201
- for (var index = 0; index < state.orderedModifiers.length; index++) {
2202
-
2203
- if (state.reset === true) {
2204
- state.reset = false;
2205
- index = -1;
2206
- continue;
2207
- }
2208
-
2209
- var _state$orderedModifie = state.orderedModifiers[index],
2210
- fn = _state$orderedModifie.fn,
2211
- _state$orderedModifie2 = _state$orderedModifie.options,
2212
- _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
2213
- name = _state$orderedModifie.name;
2214
-
2215
- if (typeof fn === 'function') {
2216
- state = fn({
2217
- state: state,
2218
- options: _options,
2219
- name: name,
2220
- instance: instance
2221
- }) || state;
2222
- }
2223
- }
2224
- },
2225
- // Async and optimistically optimized update – it will not be executed if
2226
- // not necessary (debounced to run at most once-per-tick)
2227
- update: debounce(function () {
2228
- return new Promise(function (resolve) {
2229
- instance.forceUpdate();
2230
- resolve(state);
2231
- });
2232
- }),
2233
- destroy: function destroy() {
2234
- cleanupModifierEffects();
2235
- isDestroyed = true;
2236
- }
2237
- };
2238
-
2239
- if (!areValidElements(reference, popper)) {
2240
-
2241
- return instance;
2242
- }
2243
-
2244
- instance.setOptions(options).then(function (state) {
2245
- if (!isDestroyed && options.onFirstUpdate) {
2246
- options.onFirstUpdate(state);
2247
- }
2248
- }); // Modifiers have the ability to execute arbitrary code before the first
2249
- // update cycle runs. They will be executed in the same order as the update
2250
- // cycle. This is useful when a modifier adds some persistent data that
2251
- // other modifiers need to use, but the modifier is run after the dependent
2252
- // one.
2253
-
2254
- function runModifierEffects() {
2255
- state.orderedModifiers.forEach(function (_ref3) {
2256
- var name = _ref3.name,
2257
- _ref3$options = _ref3.options,
2258
- options = _ref3$options === void 0 ? {} : _ref3$options,
2259
- effect = _ref3.effect;
2260
-
2261
- if (typeof effect === 'function') {
2262
- var cleanupFn = effect({
2263
- state: state,
2264
- name: name,
2265
- instance: instance,
2266
- options: options
2267
- });
2268
-
2269
- var noopFn = function noopFn() {};
2270
-
2271
- effectCleanupFns.push(cleanupFn || noopFn);
2272
- }
2273
- });
2274
- }
2275
-
2276
- function cleanupModifierEffects() {
2277
- effectCleanupFns.forEach(function (fn) {
2278
- return fn();
2279
- });
2280
- effectCleanupFns = [];
2281
- }
2282
-
2283
- return instance;
2284
- };
2285
- }
2286
-
2287
- var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
2288
- var createPopper = /*#__PURE__*/popperGenerator({
2289
- defaultModifiers: defaultModifiers
2290
- }); // eslint-disable-next-line import/no-unused-modules
2291
-
2292
- const portalCss = ":host(limel-portal){display:block;position:absolute;top:0;bottom:0;width:100%;pointer-events:none}:host([hidden]){display:none}";
2293
-
2294
- const Portal = class {
2295
- constructor(hostRef) {
2296
- index.registerInstance(this, hostRef);
2297
- /**
2298
- * Decides which direction the portal content should open.
2299
- */
2300
- this.openDirection = 'bottom';
2301
- /**
2302
- * Position of the content.
2303
- */
2304
- this.position = 'absolute';
2305
- /**
2306
- * Dynamic styling that can be applied to the container holding the content.
2307
- */
2308
- this.containerStyle = {};
2309
- /**
2310
- * Parent element to move the content to.
2311
- */
2312
- this.parent = document.body;
2313
- /**
2314
- * Used to make a dropdown have the same width as the trigger, for example
2315
- * in `limel-picker`.
2316
- */
2317
- this.inheritParentWidth = false;
2318
- /**
2319
- * True if the content within the portal should be visible.
2320
- *
2321
- * If the content is from within a dialog for instance, this can be set to
2322
- * true from false when the dialog opens to position the content properly.
2323
- */
2324
- this.visible = false;
2325
- this.loaded = false;
2326
- this.parents = new WeakMap();
2327
- }
2328
- onVisible() {
2329
- if (!this.visible) {
2330
- this.hideContainer();
2331
- this.styleContainer();
2332
- this.destroyPopper();
2333
- return;
2334
- }
2335
- this.styleContainer();
2336
- this.createPopper();
2337
- requestAnimationFrame(() => {
2338
- this.showContainer();
2339
- });
2340
- }
2341
- disconnectedCallback() {
2342
- this.removeContainer();
2343
- this.destroyPopper();
2344
- if (this.observer) {
2345
- this.observer.unobserve(this.container);
2346
- }
2347
- }
2348
- connectedCallback() {
2349
- if (!this.loaded) {
2350
- return;
2351
- }
2352
- this.createContainer();
2353
- this.hideContainer();
2354
- this.attachContainer();
2355
- this.styleContainer();
2356
- if (this.visible) {
2357
- this.createPopper();
2358
- this.showContainer();
2359
- }
2360
- if ('ResizeObserver' in window) {
2361
- const observer = new ResizeObserver(() => {
2362
- if (this.popperInstance) {
2363
- this.styleContainer();
2364
- this.popperInstance.update();
2365
- }
2366
- });
2367
- observer.observe(this.container);
2368
- }
2369
- }
2370
- componentDidLoad() {
2371
- this.loaded = true;
2372
- this.connectedCallback();
2373
- }
2374
- render() {
2375
- return index.h("slot", null);
2376
- }
2377
- createContainer() {
2378
- const slot = this.host.shadowRoot.querySelector('slot');
2379
- const content = (slot.assignedElements && slot.assignedElements()) || [];
2380
- this.container = document.createElement('div');
2381
- this.container.setAttribute('id', this.containerId);
2382
- this.container.setAttribute('class', 'limel-portal--container');
2383
- Object.assign(this.container, {
2384
- portalSource: this.host,
2385
- });
2386
- content.forEach((element) => {
2387
- this.parents.set(element, element.parentElement);
2388
- this.container.appendChild(element);
2389
- });
2390
- }
2391
- attachContainer() {
2392
- this.parent.appendChild(this.container);
2393
- }
2394
- removeContainer() {
2395
- if (!this.container) {
2396
- return;
2397
- }
2398
- Array.from(this.container.children).forEach((element) => {
2399
- const parent = this.parents.get(element);
2400
- if (!parent) {
2401
- return;
2402
- }
2403
- parent.appendChild(element);
2404
- });
2405
- this.hideContainer();
2406
- this.container.parentElement.removeChild(this.container);
2407
- }
2408
- hideContainer() {
2409
- this.container.style.opacity = '0';
2410
- }
2411
- showContainer() {
2412
- this.container.style.opacity = '1';
2413
- }
2414
- styleContainer() {
2415
- const hostWidth = this.host.getBoundingClientRect().width;
2416
- if (this.visible) {
2417
- this.container.style.display = 'block';
2418
- }
2419
- else {
2420
- this.container.style.display = 'none';
2421
- }
2422
- if (this.inheritParentWidth) {
2423
- const containerWidth = this.getContentWidth(this.container);
2424
- let width = containerWidth;
2425
- if (hostWidth > 0) {
2426
- width = hostWidth;
2427
- }
2428
- this.container.style.width = `${width}px`;
2429
- }
2430
- this.ensureContainerFitsInViewPort();
2431
- Object.keys(this.containerStyle).forEach((property) => {
2432
- this.container.style[property] = this.containerStyle[property];
2433
- });
2434
- }
2435
- getContentWidth(element) {
2436
- if (!element) {
2437
- return null;
2438
- }
2439
- const width = element.getBoundingClientRect().width;
2440
- if (width !== 0) {
2441
- return width;
2442
- }
2443
- const elementContent = element.querySelector('*');
2444
- return this.getContentWidth(elementContent);
2445
- }
2446
- createPopper() {
2447
- const config = this.createPopperConfig();
2448
- this.popperInstance = createPopper(this.host, this.container, config);
2449
- }
2450
- destroyPopper() {
2451
- var _a;
2452
- (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.destroy();
2453
- this.popperInstance = null;
2454
- }
2455
- createPopperConfig() {
2456
- const placement = this.getPlacement(this.openDirection);
2457
- const flipPlacement = this.getFlipPlacement(this.openDirection);
2458
- return {
2459
- strategy: this.position,
2460
- placement: placement,
2461
- modifiers: [
2462
- {
2463
- name: 'flip',
2464
- options: {
2465
- fallbackPlacements: [flipPlacement],
2466
- },
2467
- },
2468
- ],
2469
- };
2470
- }
2471
- getPlacement(direction) {
2472
- const placements = {
2473
- 'left-start': 'left-start',
2474
- left: 'left',
2475
- 'left-end': 'left-end',
2476
- 'right-start': 'right-start',
2477
- right: 'right',
2478
- 'right-end': 'right-end',
2479
- 'top-start': 'top-start',
2480
- top: 'top',
2481
- 'top-end': 'top-end',
2482
- 'bottom-start': 'bottom-start',
2483
- bottom: 'bottom',
2484
- 'bottom-end': 'bottom-end',
2485
- };
2486
- return placements[direction];
2487
- }
2488
- getFlipPlacement(direction) {
2489
- const flipPlacements = {
2490
- 'left-start': 'right-start',
2491
- left: 'right',
2492
- 'left-end': 'right-end',
2493
- 'right-start': 'left-start',
2494
- right: 'left',
2495
- 'right-end': 'left-end',
2496
- 'top-start': 'bottom-start',
2497
- top: 'bottom',
2498
- 'top-end': 'bottom-end',
2499
- 'bottom-start': 'top-start',
2500
- bottom: 'top',
2501
- 'bottom-end': 'top-end',
2502
- };
2503
- return flipPlacements[direction];
2504
- }
2505
- ensureContainerFitsInViewPort() {
2506
- const viewHeight = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
2507
- const { top, bottom } = this.host.getBoundingClientRect();
2508
- const spaceAboveTopOfSurface = Math.max(top, 0);
2509
- const spaceBelowTopOfSurface = Math.max(viewHeight - bottom, 0);
2510
- const extraCosmeticSpace = 16;
2511
- const maxHeight = Math.max(spaceAboveTopOfSurface, spaceBelowTopOfSurface) -
2512
- extraCosmeticSpace;
2513
- this.container.style.maxHeight = `${maxHeight}px`;
2514
- }
2515
- get host() { return index.getElement(this); }
2516
- static get watchers() { return {
2517
- "visible": ["onVisible"]
2518
- }; }
2519
- };
2520
- Portal.style = portalCss;
2521
-
2522
505
  exports.limel_list = List;
2523
506
  exports.limel_menu_surface = MenuSurface;
2524
- exports.limel_portal = Portal;