@indico-data/design-system 2.19.0 → 2.21.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.
Files changed (40) hide show
  1. package/lib/index.css +58 -3
  2. package/lib/index.d.ts +18 -1
  3. package/lib/index.esm.css +58 -3
  4. package/lib/index.esm.js +1567 -8
  5. package/lib/index.esm.js.map +1 -1
  6. package/lib/index.js +1567 -6
  7. package/lib/index.js.map +1 -1
  8. package/lib/src/components/index.d.ts +2 -0
  9. package/lib/src/components/menu/Menu.d.ts +5 -0
  10. package/lib/src/components/menu/Menu.stories.d.ts +6 -0
  11. package/lib/src/components/menu/Menu.test.d.ts +1 -0
  12. package/lib/src/components/menu/index.d.ts +1 -0
  13. package/lib/src/components/popper/Popper.d.ts +12 -0
  14. package/lib/src/components/popper/Popper.stories.d.ts +6 -0
  15. package/lib/src/components/popper/Popper.test.d.ts +1 -0
  16. package/lib/src/components/popper/index.d.ts +1 -0
  17. package/lib/src/hooks/useClickOutside.d.ts +2 -0
  18. package/lib/src/index.d.ts +2 -0
  19. package/package.json +2 -1
  20. package/src/components/index.ts +2 -0
  21. package/src/components/menu/Menu.mdx +15 -0
  22. package/src/components/menu/Menu.stories.tsx +56 -0
  23. package/src/components/menu/Menu.test.tsx +88 -0
  24. package/src/components/menu/Menu.tsx +20 -0
  25. package/src/components/menu/index.ts +1 -0
  26. package/src/components/menu/styles/Menu.scss +19 -0
  27. package/src/components/menu/styles/_variables.scss +15 -0
  28. package/src/components/popper/Popper.mdx +79 -0
  29. package/src/components/popper/Popper.stories.tsx +161 -0
  30. package/src/components/popper/Popper.test.tsx +68 -0
  31. package/src/components/popper/Popper.tsx +57 -0
  32. package/src/components/popper/index.ts +1 -0
  33. package/src/components/popper/styles/Popper.scss +11 -0
  34. package/src/components/popper/styles/_variables.scss +15 -0
  35. package/src/hooks/useClickOutside.tsx +22 -0
  36. package/src/index.ts +2 -0
  37. package/src/legacy/components/buttons/commonStyles.ts +0 -4
  38. package/src/styles/_typography.scss +1 -1
  39. package/src/styles/index.scss +2 -0
  40. package/src/styles/variables/_typography.scss +2 -4
package/lib/index.js CHANGED
@@ -129,7 +129,7 @@ const round10 = (value, exp) => {
129
129
  return decimalAdjust('round', value, exp);
130
130
  };
131
131
 
132
- const clamp$1 = (value, min, max) => {
132
+ const clamp$2 = (value, min, max) => {
133
133
  value = value < min ? min : value;
134
134
  value = value > max ? max : value;
135
135
  return value;
@@ -142,7 +142,7 @@ const numberWithCommas$1 = (x) => {
142
142
  const MATH = {
143
143
  decimalAdjust,
144
144
  round10,
145
- clamp: clamp$1,
145
+ clamp: clamp$2,
146
146
  numberWithCommas: numberWithCommas$1,
147
147
  };
148
148
 
@@ -18732,6 +18732,1569 @@ const Card = (_a) => {
18732
18732
  return (jsxRuntime.jsxs("div", Object.assign({ className: cardClasses }, rest, { children: [(title || subtitle) && (jsxRuntime.jsxs("div", { className: "card__header", children: [title && jsxRuntime.jsx("h2", { children: title }), subtitle && jsxRuntime.jsx("p", { children: subtitle })] })), jsxRuntime.jsx("div", { className: "card__content", children: children })] })));
18733
18733
  };
18734
18734
 
18735
+ /**
18736
+ * Custom positioning reference element.
18737
+ * @see https://floating-ui.com/docs/virtual-elements
18738
+ */
18739
+
18740
+ const min$3 = Math.min;
18741
+ const max$3 = Math.max;
18742
+ const round$2 = Math.round;
18743
+ const createCoords$1 = v => ({
18744
+ x: v,
18745
+ y: v
18746
+ });
18747
+ const oppositeSideMap$1 = {
18748
+ left: 'right',
18749
+ right: 'left',
18750
+ bottom: 'top',
18751
+ top: 'bottom'
18752
+ };
18753
+ const oppositeAlignmentMap$1 = {
18754
+ start: 'end',
18755
+ end: 'start'
18756
+ };
18757
+ function clamp$1(start, value, end) {
18758
+ return max$3(start, min$3(value, end));
18759
+ }
18760
+ function evaluate$1(value, param) {
18761
+ return typeof value === 'function' ? value(param) : value;
18762
+ }
18763
+ function getSide$1(placement) {
18764
+ return placement.split('-')[0];
18765
+ }
18766
+ function getAlignment$1(placement) {
18767
+ return placement.split('-')[1];
18768
+ }
18769
+ function getOppositeAxis$1(axis) {
18770
+ return axis === 'x' ? 'y' : 'x';
18771
+ }
18772
+ function getAxisLength$1(axis) {
18773
+ return axis === 'y' ? 'height' : 'width';
18774
+ }
18775
+ function getSideAxis$1(placement) {
18776
+ return ['top', 'bottom'].includes(getSide$1(placement)) ? 'y' : 'x';
18777
+ }
18778
+ function getAlignmentAxis$1(placement) {
18779
+ return getOppositeAxis$1(getSideAxis$1(placement));
18780
+ }
18781
+ function getAlignmentSides$1(placement, rects, rtl) {
18782
+ if (rtl === void 0) {
18783
+ rtl = false;
18784
+ }
18785
+ const alignment = getAlignment$1(placement);
18786
+ const alignmentAxis = getAlignmentAxis$1(placement);
18787
+ const length = getAxisLength$1(alignmentAxis);
18788
+ let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
18789
+ if (rects.reference[length] > rects.floating[length]) {
18790
+ mainAlignmentSide = getOppositePlacement$2(mainAlignmentSide);
18791
+ }
18792
+ return [mainAlignmentSide, getOppositePlacement$2(mainAlignmentSide)];
18793
+ }
18794
+ function getExpandedPlacements$1(placement) {
18795
+ const oppositePlacement = getOppositePlacement$2(placement);
18796
+ return [getOppositeAlignmentPlacement$1(placement), oppositePlacement, getOppositeAlignmentPlacement$1(oppositePlacement)];
18797
+ }
18798
+ function getOppositeAlignmentPlacement$1(placement) {
18799
+ return placement.replace(/start|end/g, alignment => oppositeAlignmentMap$1[alignment]);
18800
+ }
18801
+ function getSideList$1(side, isStart, rtl) {
18802
+ const lr = ['left', 'right'];
18803
+ const rl = ['right', 'left'];
18804
+ const tb = ['top', 'bottom'];
18805
+ const bt = ['bottom', 'top'];
18806
+ switch (side) {
18807
+ case 'top':
18808
+ case 'bottom':
18809
+ if (rtl) return isStart ? rl : lr;
18810
+ return isStart ? lr : rl;
18811
+ case 'left':
18812
+ case 'right':
18813
+ return isStart ? tb : bt;
18814
+ default:
18815
+ return [];
18816
+ }
18817
+ }
18818
+ function getOppositeAxisPlacements$1(placement, flipAlignment, direction, rtl) {
18819
+ const alignment = getAlignment$1(placement);
18820
+ let list = getSideList$1(getSide$1(placement), direction === 'start', rtl);
18821
+ if (alignment) {
18822
+ list = list.map(side => side + "-" + alignment);
18823
+ if (flipAlignment) {
18824
+ list = list.concat(list.map(getOppositeAlignmentPlacement$1));
18825
+ }
18826
+ }
18827
+ return list;
18828
+ }
18829
+ function getOppositePlacement$2(placement) {
18830
+ return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap$1[side]);
18831
+ }
18832
+ function expandPaddingObject$1(padding) {
18833
+ return {
18834
+ top: 0,
18835
+ right: 0,
18836
+ bottom: 0,
18837
+ left: 0,
18838
+ ...padding
18839
+ };
18840
+ }
18841
+ function getPaddingObject$1(padding) {
18842
+ return typeof padding !== 'number' ? expandPaddingObject$1(padding) : {
18843
+ top: padding,
18844
+ right: padding,
18845
+ bottom: padding,
18846
+ left: padding
18847
+ };
18848
+ }
18849
+ function rectToClientRect$2(rect) {
18850
+ const {
18851
+ x,
18852
+ y,
18853
+ width,
18854
+ height
18855
+ } = rect;
18856
+ return {
18857
+ width,
18858
+ height,
18859
+ top: y,
18860
+ left: x,
18861
+ right: x + width,
18862
+ bottom: y + height,
18863
+ x,
18864
+ y
18865
+ };
18866
+ }
18867
+
18868
+ function computeCoordsFromPlacement$1(_ref, placement, rtl) {
18869
+ let {
18870
+ reference,
18871
+ floating
18872
+ } = _ref;
18873
+ const sideAxis = getSideAxis$1(placement);
18874
+ const alignmentAxis = getAlignmentAxis$1(placement);
18875
+ const alignLength = getAxisLength$1(alignmentAxis);
18876
+ const side = getSide$1(placement);
18877
+ const isVertical = sideAxis === 'y';
18878
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
18879
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
18880
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
18881
+ let coords;
18882
+ switch (side) {
18883
+ case 'top':
18884
+ coords = {
18885
+ x: commonX,
18886
+ y: reference.y - floating.height
18887
+ };
18888
+ break;
18889
+ case 'bottom':
18890
+ coords = {
18891
+ x: commonX,
18892
+ y: reference.y + reference.height
18893
+ };
18894
+ break;
18895
+ case 'right':
18896
+ coords = {
18897
+ x: reference.x + reference.width,
18898
+ y: commonY
18899
+ };
18900
+ break;
18901
+ case 'left':
18902
+ coords = {
18903
+ x: reference.x - floating.width,
18904
+ y: commonY
18905
+ };
18906
+ break;
18907
+ default:
18908
+ coords = {
18909
+ x: reference.x,
18910
+ y: reference.y
18911
+ };
18912
+ }
18913
+ switch (getAlignment$1(placement)) {
18914
+ case 'start':
18915
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
18916
+ break;
18917
+ case 'end':
18918
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
18919
+ break;
18920
+ }
18921
+ return coords;
18922
+ }
18923
+
18924
+ /**
18925
+ * Computes the `x` and `y` coordinates that will place the floating element
18926
+ * next to a given reference element.
18927
+ *
18928
+ * This export does not have any `platform` interface logic. You will need to
18929
+ * write one for the platform you are using Floating UI with.
18930
+ */
18931
+ const computePosition$3 = async (reference, floating, config) => {
18932
+ const {
18933
+ placement = 'bottom',
18934
+ strategy = 'absolute',
18935
+ middleware = [],
18936
+ platform
18937
+ } = config;
18938
+ const validMiddleware = middleware.filter(Boolean);
18939
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
18940
+ let rects = await platform.getElementRects({
18941
+ reference,
18942
+ floating,
18943
+ strategy
18944
+ });
18945
+ let {
18946
+ x,
18947
+ y
18948
+ } = computeCoordsFromPlacement$1(rects, placement, rtl);
18949
+ let statefulPlacement = placement;
18950
+ let middlewareData = {};
18951
+ let resetCount = 0;
18952
+ for (let i = 0; i < validMiddleware.length; i++) {
18953
+ const {
18954
+ name,
18955
+ fn
18956
+ } = validMiddleware[i];
18957
+ const {
18958
+ x: nextX,
18959
+ y: nextY,
18960
+ data,
18961
+ reset
18962
+ } = await fn({
18963
+ x,
18964
+ y,
18965
+ initialPlacement: placement,
18966
+ placement: statefulPlacement,
18967
+ strategy,
18968
+ middlewareData,
18969
+ rects,
18970
+ platform,
18971
+ elements: {
18972
+ reference,
18973
+ floating
18974
+ }
18975
+ });
18976
+ x = nextX != null ? nextX : x;
18977
+ y = nextY != null ? nextY : y;
18978
+ middlewareData = {
18979
+ ...middlewareData,
18980
+ [name]: {
18981
+ ...middlewareData[name],
18982
+ ...data
18983
+ }
18984
+ };
18985
+ if (reset && resetCount <= 50) {
18986
+ resetCount++;
18987
+ if (typeof reset === 'object') {
18988
+ if (reset.placement) {
18989
+ statefulPlacement = reset.placement;
18990
+ }
18991
+ if (reset.rects) {
18992
+ rects = reset.rects === true ? await platform.getElementRects({
18993
+ reference,
18994
+ floating,
18995
+ strategy
18996
+ }) : reset.rects;
18997
+ }
18998
+ ({
18999
+ x,
19000
+ y
19001
+ } = computeCoordsFromPlacement$1(rects, statefulPlacement, rtl));
19002
+ }
19003
+ i = -1;
19004
+ }
19005
+ }
19006
+ return {
19007
+ x,
19008
+ y,
19009
+ placement: statefulPlacement,
19010
+ strategy,
19011
+ middlewareData
19012
+ };
19013
+ };
19014
+
19015
+ /**
19016
+ * Resolves with an object of overflow side offsets that determine how much the
19017
+ * element is overflowing a given clipping boundary on each side.
19018
+ * - positive = overflowing the boundary by that number of pixels
19019
+ * - negative = how many pixels left before it will overflow
19020
+ * - 0 = lies flush with the boundary
19021
+ * @see https://floating-ui.com/docs/detectOverflow
19022
+ */
19023
+ async function detectOverflow$2(state, options) {
19024
+ var _await$platform$isEle;
19025
+ if (options === void 0) {
19026
+ options = {};
19027
+ }
19028
+ const {
19029
+ x,
19030
+ y,
19031
+ platform,
19032
+ rects,
19033
+ elements,
19034
+ strategy
19035
+ } = state;
19036
+ const {
19037
+ boundary = 'clippingAncestors',
19038
+ rootBoundary = 'viewport',
19039
+ elementContext = 'floating',
19040
+ altBoundary = false,
19041
+ padding = 0
19042
+ } = evaluate$1(options, state);
19043
+ const paddingObject = getPaddingObject$1(padding);
19044
+ const altContext = elementContext === 'floating' ? 'reference' : 'floating';
19045
+ const element = elements[altBoundary ? altContext : elementContext];
19046
+ const clippingClientRect = rectToClientRect$2(await platform.getClippingRect({
19047
+ element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
19048
+ boundary,
19049
+ rootBoundary,
19050
+ strategy
19051
+ }));
19052
+ const rect = elementContext === 'floating' ? {
19053
+ x,
19054
+ y,
19055
+ width: rects.floating.width,
19056
+ height: rects.floating.height
19057
+ } : rects.reference;
19058
+ const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
19059
+ const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
19060
+ x: 1,
19061
+ y: 1
19062
+ } : {
19063
+ x: 1,
19064
+ y: 1
19065
+ };
19066
+ const elementClientRect = rectToClientRect$2(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
19067
+ elements,
19068
+ rect,
19069
+ offsetParent,
19070
+ strategy
19071
+ }) : rect);
19072
+ return {
19073
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
19074
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
19075
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
19076
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
19077
+ };
19078
+ }
19079
+
19080
+ /**
19081
+ * Optimizes the visibility of the floating element by flipping the `placement`
19082
+ * in order to keep it in view when the preferred placement(s) will overflow the
19083
+ * clipping boundary. Alternative to `autoPlacement`.
19084
+ * @see https://floating-ui.com/docs/flip
19085
+ */
19086
+ const flip$6 = function (options) {
19087
+ if (options === void 0) {
19088
+ options = {};
19089
+ }
19090
+ return {
19091
+ name: 'flip',
19092
+ options,
19093
+ async fn(state) {
19094
+ var _middlewareData$arrow, _middlewareData$flip;
19095
+ const {
19096
+ placement,
19097
+ middlewareData,
19098
+ rects,
19099
+ initialPlacement,
19100
+ platform,
19101
+ elements
19102
+ } = state;
19103
+ const {
19104
+ mainAxis: checkMainAxis = true,
19105
+ crossAxis: checkCrossAxis = true,
19106
+ fallbackPlacements: specifiedFallbackPlacements,
19107
+ fallbackStrategy = 'bestFit',
19108
+ fallbackAxisSideDirection = 'none',
19109
+ flipAlignment = true,
19110
+ ...detectOverflowOptions
19111
+ } = evaluate$1(options, state);
19112
+
19113
+ // If a reset by the arrow was caused due to an alignment offset being
19114
+ // added, we should skip any logic now since `flip()` has already done its
19115
+ // work.
19116
+ // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
19117
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
19118
+ return {};
19119
+ }
19120
+ const side = getSide$1(placement);
19121
+ const initialSideAxis = getSideAxis$1(initialPlacement);
19122
+ const isBasePlacement = getSide$1(initialPlacement) === initialPlacement;
19123
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
19124
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement$2(initialPlacement)] : getExpandedPlacements$1(initialPlacement));
19125
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
19126
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
19127
+ fallbackPlacements.push(...getOppositeAxisPlacements$1(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
19128
+ }
19129
+ const placements = [initialPlacement, ...fallbackPlacements];
19130
+ const overflow = await detectOverflow$2(state, detectOverflowOptions);
19131
+ const overflows = [];
19132
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
19133
+ if (checkMainAxis) {
19134
+ overflows.push(overflow[side]);
19135
+ }
19136
+ if (checkCrossAxis) {
19137
+ const sides = getAlignmentSides$1(placement, rects, rtl);
19138
+ overflows.push(overflow[sides[0]], overflow[sides[1]]);
19139
+ }
19140
+ overflowsData = [...overflowsData, {
19141
+ placement,
19142
+ overflows
19143
+ }];
19144
+
19145
+ // One or more sides is overflowing.
19146
+ if (!overflows.every(side => side <= 0)) {
19147
+ var _middlewareData$flip2, _overflowsData$filter;
19148
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
19149
+ const nextPlacement = placements[nextIndex];
19150
+ if (nextPlacement) {
19151
+ // Try next placement and re-run the lifecycle.
19152
+ return {
19153
+ data: {
19154
+ index: nextIndex,
19155
+ overflows: overflowsData
19156
+ },
19157
+ reset: {
19158
+ placement: nextPlacement
19159
+ }
19160
+ };
19161
+ }
19162
+
19163
+ // First, find the candidates that fit on the mainAxis side of overflow,
19164
+ // then find the placement that fits the best on the main crossAxis side.
19165
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
19166
+
19167
+ // Otherwise fallback.
19168
+ if (!resetPlacement) {
19169
+ switch (fallbackStrategy) {
19170
+ case 'bestFit':
19171
+ {
19172
+ var _overflowsData$filter2;
19173
+ const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
19174
+ if (hasFallbackAxisSideDirection) {
19175
+ const currentSideAxis = getSideAxis$1(d.placement);
19176
+ return currentSideAxis === initialSideAxis ||
19177
+ // Create a bias to the `y` side axis due to horizontal
19178
+ // reading directions favoring greater width.
19179
+ currentSideAxis === 'y';
19180
+ }
19181
+ return true;
19182
+ }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
19183
+ if (placement) {
19184
+ resetPlacement = placement;
19185
+ }
19186
+ break;
19187
+ }
19188
+ case 'initialPlacement':
19189
+ resetPlacement = initialPlacement;
19190
+ break;
19191
+ }
19192
+ }
19193
+ if (placement !== resetPlacement) {
19194
+ return {
19195
+ reset: {
19196
+ placement: resetPlacement
19197
+ }
19198
+ };
19199
+ }
19200
+ }
19201
+ return {};
19202
+ }
19203
+ };
19204
+ };
19205
+
19206
+ // For type backwards-compatibility, the `OffsetOptions` type was also
19207
+ // Derivable.
19208
+
19209
+ async function convertValueToCoords$1(state, options) {
19210
+ const {
19211
+ placement,
19212
+ platform,
19213
+ elements
19214
+ } = state;
19215
+ const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
19216
+ const side = getSide$1(placement);
19217
+ const alignment = getAlignment$1(placement);
19218
+ const isVertical = getSideAxis$1(placement) === 'y';
19219
+ const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
19220
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
19221
+ const rawValue = evaluate$1(options, state);
19222
+
19223
+ // eslint-disable-next-line prefer-const
19224
+ let {
19225
+ mainAxis,
19226
+ crossAxis,
19227
+ alignmentAxis
19228
+ } = typeof rawValue === 'number' ? {
19229
+ mainAxis: rawValue,
19230
+ crossAxis: 0,
19231
+ alignmentAxis: null
19232
+ } : {
19233
+ mainAxis: 0,
19234
+ crossAxis: 0,
19235
+ alignmentAxis: null,
19236
+ ...rawValue
19237
+ };
19238
+ if (alignment && typeof alignmentAxis === 'number') {
19239
+ crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
19240
+ }
19241
+ return isVertical ? {
19242
+ x: crossAxis * crossAxisMulti,
19243
+ y: mainAxis * mainAxisMulti
19244
+ } : {
19245
+ x: mainAxis * mainAxisMulti,
19246
+ y: crossAxis * crossAxisMulti
19247
+ };
19248
+ }
19249
+
19250
+ /**
19251
+ * Modifies the placement by translating the floating element along the
19252
+ * specified axes.
19253
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
19254
+ * object may be passed.
19255
+ * @see https://floating-ui.com/docs/offset
19256
+ */
19257
+ const offset$6 = function (options) {
19258
+ if (options === void 0) {
19259
+ options = 0;
19260
+ }
19261
+ return {
19262
+ name: 'offset',
19263
+ options,
19264
+ async fn(state) {
19265
+ var _middlewareData$offse, _middlewareData$arrow;
19266
+ const {
19267
+ x,
19268
+ y,
19269
+ placement,
19270
+ middlewareData
19271
+ } = state;
19272
+ const diffCoords = await convertValueToCoords$1(state, options);
19273
+
19274
+ // If the placement is the same and the arrow caused an alignment offset
19275
+ // then we don't need to change the positioning coordinates.
19276
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
19277
+ return {};
19278
+ }
19279
+ return {
19280
+ x: x + diffCoords.x,
19281
+ y: y + diffCoords.y,
19282
+ data: {
19283
+ ...diffCoords,
19284
+ placement
19285
+ }
19286
+ };
19287
+ }
19288
+ };
19289
+ };
19290
+
19291
+ /**
19292
+ * Optimizes the visibility of the floating element by shifting it in order to
19293
+ * keep it in view when it will overflow the clipping boundary.
19294
+ * @see https://floating-ui.com/docs/shift
19295
+ */
19296
+ const shift$4 = function (options) {
19297
+ if (options === void 0) {
19298
+ options = {};
19299
+ }
19300
+ return {
19301
+ name: 'shift',
19302
+ options,
19303
+ async fn(state) {
19304
+ const {
19305
+ x,
19306
+ y,
19307
+ placement
19308
+ } = state;
19309
+ const {
19310
+ mainAxis: checkMainAxis = true,
19311
+ crossAxis: checkCrossAxis = false,
19312
+ limiter = {
19313
+ fn: _ref => {
19314
+ let {
19315
+ x,
19316
+ y
19317
+ } = _ref;
19318
+ return {
19319
+ x,
19320
+ y
19321
+ };
19322
+ }
19323
+ },
19324
+ ...detectOverflowOptions
19325
+ } = evaluate$1(options, state);
19326
+ const coords = {
19327
+ x,
19328
+ y
19329
+ };
19330
+ const overflow = await detectOverflow$2(state, detectOverflowOptions);
19331
+ const crossAxis = getSideAxis$1(getSide$1(placement));
19332
+ const mainAxis = getOppositeAxis$1(crossAxis);
19333
+ let mainAxisCoord = coords[mainAxis];
19334
+ let crossAxisCoord = coords[crossAxis];
19335
+ if (checkMainAxis) {
19336
+ const minSide = mainAxis === 'y' ? 'top' : 'left';
19337
+ const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
19338
+ const min = mainAxisCoord + overflow[minSide];
19339
+ const max = mainAxisCoord - overflow[maxSide];
19340
+ mainAxisCoord = clamp$1(min, mainAxisCoord, max);
19341
+ }
19342
+ if (checkCrossAxis) {
19343
+ const minSide = crossAxis === 'y' ? 'top' : 'left';
19344
+ const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
19345
+ const min = crossAxisCoord + overflow[minSide];
19346
+ const max = crossAxisCoord - overflow[maxSide];
19347
+ crossAxisCoord = clamp$1(min, crossAxisCoord, max);
19348
+ }
19349
+ const limitedCoords = limiter.fn({
19350
+ ...state,
19351
+ [mainAxis]: mainAxisCoord,
19352
+ [crossAxis]: crossAxisCoord
19353
+ });
19354
+ return {
19355
+ ...limitedCoords,
19356
+ data: {
19357
+ x: limitedCoords.x - x,
19358
+ y: limitedCoords.y - y
19359
+ }
19360
+ };
19361
+ }
19362
+ };
19363
+ };
19364
+
19365
+ function getNodeName$2(node) {
19366
+ if (isNode$1(node)) {
19367
+ return (node.nodeName || '').toLowerCase();
19368
+ }
19369
+ // Mocked nodes in testing environments may not be instances of Node. By
19370
+ // returning `#document` an infinite loop won't occur.
19371
+ // https://github.com/floating-ui/floating-ui/issues/2317
19372
+ return '#document';
19373
+ }
19374
+ function getWindow$2(node) {
19375
+ var _node$ownerDocument;
19376
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
19377
+ }
19378
+ function getDocumentElement$2(node) {
19379
+ var _ref;
19380
+ return (_ref = (isNode$1(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
19381
+ }
19382
+ function isNode$1(value) {
19383
+ return value instanceof Node || value instanceof getWindow$2(value).Node;
19384
+ }
19385
+ function isElement$2(value) {
19386
+ return value instanceof Element || value instanceof getWindow$2(value).Element;
19387
+ }
19388
+ function isHTMLElement$2(value) {
19389
+ return value instanceof HTMLElement || value instanceof getWindow$2(value).HTMLElement;
19390
+ }
19391
+ function isShadowRoot$2(value) {
19392
+ // Browsers without `ShadowRoot` support.
19393
+ if (typeof ShadowRoot === 'undefined') {
19394
+ return false;
19395
+ }
19396
+ return value instanceof ShadowRoot || value instanceof getWindow$2(value).ShadowRoot;
19397
+ }
19398
+ function isOverflowElement$1(element) {
19399
+ const {
19400
+ overflow,
19401
+ overflowX,
19402
+ overflowY,
19403
+ display
19404
+ } = getComputedStyle$3(element);
19405
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
19406
+ }
19407
+ function isTableElement$2(element) {
19408
+ return ['table', 'td', 'th'].includes(getNodeName$2(element));
19409
+ }
19410
+ function isTopLayer$1(element) {
19411
+ return [':popover-open', ':modal'].some(selector => {
19412
+ try {
19413
+ return element.matches(selector);
19414
+ } catch (e) {
19415
+ return false;
19416
+ }
19417
+ });
19418
+ }
19419
+ function isContainingBlock$1(elementOrCss) {
19420
+ const webkit = isWebKit$1();
19421
+ const css = isElement$2(elementOrCss) ? getComputedStyle$3(elementOrCss) : elementOrCss;
19422
+
19423
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
19424
+ return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
19425
+ }
19426
+ function getContainingBlock$2(element) {
19427
+ let currentNode = getParentNode$2(element);
19428
+ while (isHTMLElement$2(currentNode) && !isLastTraversableNode$1(currentNode)) {
19429
+ if (isContainingBlock$1(currentNode)) {
19430
+ return currentNode;
19431
+ } else if (isTopLayer$1(currentNode)) {
19432
+ return null;
19433
+ }
19434
+ currentNode = getParentNode$2(currentNode);
19435
+ }
19436
+ return null;
19437
+ }
19438
+ function isWebKit$1() {
19439
+ if (typeof CSS === 'undefined' || !CSS.supports) return false;
19440
+ return CSS.supports('-webkit-backdrop-filter', 'none');
19441
+ }
19442
+ function isLastTraversableNode$1(node) {
19443
+ return ['html', 'body', '#document'].includes(getNodeName$2(node));
19444
+ }
19445
+ function getComputedStyle$3(element) {
19446
+ return getWindow$2(element).getComputedStyle(element);
19447
+ }
19448
+ function getNodeScroll$2(element) {
19449
+ if (isElement$2(element)) {
19450
+ return {
19451
+ scrollLeft: element.scrollLeft,
19452
+ scrollTop: element.scrollTop
19453
+ };
19454
+ }
19455
+ return {
19456
+ scrollLeft: element.scrollX,
19457
+ scrollTop: element.scrollY
19458
+ };
19459
+ }
19460
+ function getParentNode$2(node) {
19461
+ if (getNodeName$2(node) === 'html') {
19462
+ return node;
19463
+ }
19464
+ const result =
19465
+ // Step into the shadow DOM of the parent of a slotted node.
19466
+ node.assignedSlot ||
19467
+ // DOM Element detected.
19468
+ node.parentNode ||
19469
+ // ShadowRoot detected.
19470
+ isShadowRoot$2(node) && node.host ||
19471
+ // Fallback.
19472
+ getDocumentElement$2(node);
19473
+ return isShadowRoot$2(result) ? result.host : result;
19474
+ }
19475
+ function getNearestOverflowAncestor$1(node) {
19476
+ const parentNode = getParentNode$2(node);
19477
+ if (isLastTraversableNode$1(parentNode)) {
19478
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
19479
+ }
19480
+ if (isHTMLElement$2(parentNode) && isOverflowElement$1(parentNode)) {
19481
+ return parentNode;
19482
+ }
19483
+ return getNearestOverflowAncestor$1(parentNode);
19484
+ }
19485
+ function getOverflowAncestors$1(node, list, traverseIframes) {
19486
+ var _node$ownerDocument2;
19487
+ if (list === void 0) {
19488
+ list = [];
19489
+ }
19490
+ if (traverseIframes === void 0) {
19491
+ traverseIframes = true;
19492
+ }
19493
+ const scrollableAncestor = getNearestOverflowAncestor$1(node);
19494
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
19495
+ const win = getWindow$2(scrollableAncestor);
19496
+ if (isBody) {
19497
+ const frameElement = getFrameElement(win);
19498
+ return list.concat(win, win.visualViewport || [], isOverflowElement$1(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors$1(frameElement) : []);
19499
+ }
19500
+ return list.concat(scrollableAncestor, getOverflowAncestors$1(scrollableAncestor, [], traverseIframes));
19501
+ }
19502
+ function getFrameElement(win) {
19503
+ return Object.getPrototypeOf(win.parent) ? win.frameElement : null;
19504
+ }
19505
+
19506
+ function getCssDimensions$1(element) {
19507
+ const css = getComputedStyle$3(element);
19508
+ // In testing environments, the `width` and `height` properties are empty
19509
+ // strings for SVG elements, returning NaN. Fallback to `0` in this case.
19510
+ let width = parseFloat(css.width) || 0;
19511
+ let height = parseFloat(css.height) || 0;
19512
+ const hasOffset = isHTMLElement$2(element);
19513
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
19514
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
19515
+ const shouldFallback = round$2(width) !== offsetWidth || round$2(height) !== offsetHeight;
19516
+ if (shouldFallback) {
19517
+ width = offsetWidth;
19518
+ height = offsetHeight;
19519
+ }
19520
+ return {
19521
+ width,
19522
+ height,
19523
+ $: shouldFallback
19524
+ };
19525
+ }
19526
+
19527
+ function unwrapElement$1(element) {
19528
+ return !isElement$2(element) ? element.contextElement : element;
19529
+ }
19530
+
19531
+ function getScale$1(element) {
19532
+ const domElement = unwrapElement$1(element);
19533
+ if (!isHTMLElement$2(domElement)) {
19534
+ return createCoords$1(1);
19535
+ }
19536
+ const rect = domElement.getBoundingClientRect();
19537
+ const {
19538
+ width,
19539
+ height,
19540
+ $
19541
+ } = getCssDimensions$1(domElement);
19542
+ let x = ($ ? round$2(rect.width) : rect.width) / width;
19543
+ let y = ($ ? round$2(rect.height) : rect.height) / height;
19544
+
19545
+ // 0, NaN, or Infinity should always fallback to 1.
19546
+
19547
+ if (!x || !Number.isFinite(x)) {
19548
+ x = 1;
19549
+ }
19550
+ if (!y || !Number.isFinite(y)) {
19551
+ y = 1;
19552
+ }
19553
+ return {
19554
+ x,
19555
+ y
19556
+ };
19557
+ }
19558
+
19559
+ const noOffsets$1 = /*#__PURE__*/createCoords$1(0);
19560
+ function getVisualOffsets$1(element) {
19561
+ const win = getWindow$2(element);
19562
+ if (!isWebKit$1() || !win.visualViewport) {
19563
+ return noOffsets$1;
19564
+ }
19565
+ return {
19566
+ x: win.visualViewport.offsetLeft,
19567
+ y: win.visualViewport.offsetTop
19568
+ };
19569
+ }
19570
+ function shouldAddVisualOffsets$1(element, isFixed, floatingOffsetParent) {
19571
+ if (isFixed === void 0) {
19572
+ isFixed = false;
19573
+ }
19574
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow$2(element)) {
19575
+ return false;
19576
+ }
19577
+ return isFixed;
19578
+ }
19579
+
19580
+ function getBoundingClientRect$2(element, includeScale, isFixedStrategy, offsetParent) {
19581
+ if (includeScale === void 0) {
19582
+ includeScale = false;
19583
+ }
19584
+ if (isFixedStrategy === void 0) {
19585
+ isFixedStrategy = false;
19586
+ }
19587
+ const clientRect = element.getBoundingClientRect();
19588
+ const domElement = unwrapElement$1(element);
19589
+ let scale = createCoords$1(1);
19590
+ if (includeScale) {
19591
+ if (offsetParent) {
19592
+ if (isElement$2(offsetParent)) {
19593
+ scale = getScale$1(offsetParent);
19594
+ }
19595
+ } else {
19596
+ scale = getScale$1(element);
19597
+ }
19598
+ }
19599
+ const visualOffsets = shouldAddVisualOffsets$1(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets$1(domElement) : createCoords$1(0);
19600
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
19601
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
19602
+ let width = clientRect.width / scale.x;
19603
+ let height = clientRect.height / scale.y;
19604
+ if (domElement) {
19605
+ const win = getWindow$2(domElement);
19606
+ const offsetWin = offsetParent && isElement$2(offsetParent) ? getWindow$2(offsetParent) : offsetParent;
19607
+ let currentWin = win;
19608
+ let currentIFrame = getFrameElement(currentWin);
19609
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
19610
+ const iframeScale = getScale$1(currentIFrame);
19611
+ const iframeRect = currentIFrame.getBoundingClientRect();
19612
+ const css = getComputedStyle$3(currentIFrame);
19613
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
19614
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
19615
+ x *= iframeScale.x;
19616
+ y *= iframeScale.y;
19617
+ width *= iframeScale.x;
19618
+ height *= iframeScale.y;
19619
+ x += left;
19620
+ y += top;
19621
+ currentWin = getWindow$2(currentIFrame);
19622
+ currentIFrame = getFrameElement(currentWin);
19623
+ }
19624
+ }
19625
+ return rectToClientRect$2({
19626
+ width,
19627
+ height,
19628
+ x,
19629
+ y
19630
+ });
19631
+ }
19632
+
19633
+ function convertOffsetParentRelativeRectToViewportRelativeRect$1(_ref) {
19634
+ let {
19635
+ elements,
19636
+ rect,
19637
+ offsetParent,
19638
+ strategy
19639
+ } = _ref;
19640
+ const isFixed = strategy === 'fixed';
19641
+ const documentElement = getDocumentElement$2(offsetParent);
19642
+ const topLayer = elements ? isTopLayer$1(elements.floating) : false;
19643
+ if (offsetParent === documentElement || topLayer && isFixed) {
19644
+ return rect;
19645
+ }
19646
+ let scroll = {
19647
+ scrollLeft: 0,
19648
+ scrollTop: 0
19649
+ };
19650
+ let scale = createCoords$1(1);
19651
+ const offsets = createCoords$1(0);
19652
+ const isOffsetParentAnElement = isHTMLElement$2(offsetParent);
19653
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
19654
+ if (getNodeName$2(offsetParent) !== 'body' || isOverflowElement$1(documentElement)) {
19655
+ scroll = getNodeScroll$2(offsetParent);
19656
+ }
19657
+ if (isHTMLElement$2(offsetParent)) {
19658
+ const offsetRect = getBoundingClientRect$2(offsetParent);
19659
+ scale = getScale$1(offsetParent);
19660
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
19661
+ offsets.y = offsetRect.y + offsetParent.clientTop;
19662
+ }
19663
+ }
19664
+ return {
19665
+ width: rect.width * scale.x,
19666
+ height: rect.height * scale.y,
19667
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
19668
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
19669
+ };
19670
+ }
19671
+
19672
+ function getClientRects$1(element) {
19673
+ return Array.from(element.getClientRects());
19674
+ }
19675
+
19676
+ function getWindowScrollBarX$2(element) {
19677
+ // If <html> has a CSS width greater than the viewport, then this will be
19678
+ // incorrect for RTL.
19679
+ return getBoundingClientRect$2(getDocumentElement$2(element)).left + getNodeScroll$2(element).scrollLeft;
19680
+ }
19681
+
19682
+ // Gets the entire size of the scrollable document area, even extending outside
19683
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
19684
+ function getDocumentRect$2(element) {
19685
+ const html = getDocumentElement$2(element);
19686
+ const scroll = getNodeScroll$2(element);
19687
+ const body = element.ownerDocument.body;
19688
+ const width = max$3(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
19689
+ const height = max$3(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
19690
+ let x = -scroll.scrollLeft + getWindowScrollBarX$2(element);
19691
+ const y = -scroll.scrollTop;
19692
+ if (getComputedStyle$3(body).direction === 'rtl') {
19693
+ x += max$3(html.clientWidth, body.clientWidth) - width;
19694
+ }
19695
+ return {
19696
+ width,
19697
+ height,
19698
+ x,
19699
+ y
19700
+ };
19701
+ }
19702
+
19703
+ function getViewportRect$2(element, strategy) {
19704
+ const win = getWindow$2(element);
19705
+ const html = getDocumentElement$2(element);
19706
+ const visualViewport = win.visualViewport;
19707
+ let width = html.clientWidth;
19708
+ let height = html.clientHeight;
19709
+ let x = 0;
19710
+ let y = 0;
19711
+ if (visualViewport) {
19712
+ width = visualViewport.width;
19713
+ height = visualViewport.height;
19714
+ const visualViewportBased = isWebKit$1();
19715
+ if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
19716
+ x = visualViewport.offsetLeft;
19717
+ y = visualViewport.offsetTop;
19718
+ }
19719
+ }
19720
+ return {
19721
+ width,
19722
+ height,
19723
+ x,
19724
+ y
19725
+ };
19726
+ }
19727
+
19728
+ // Returns the inner client rect, subtracting scrollbars if present.
19729
+ function getInnerBoundingClientRect$2(element, strategy) {
19730
+ const clientRect = getBoundingClientRect$2(element, true, strategy === 'fixed');
19731
+ const top = clientRect.top + element.clientTop;
19732
+ const left = clientRect.left + element.clientLeft;
19733
+ const scale = isHTMLElement$2(element) ? getScale$1(element) : createCoords$1(1);
19734
+ const width = element.clientWidth * scale.x;
19735
+ const height = element.clientHeight * scale.y;
19736
+ const x = left * scale.x;
19737
+ const y = top * scale.y;
19738
+ return {
19739
+ width,
19740
+ height,
19741
+ x,
19742
+ y
19743
+ };
19744
+ }
19745
+ function getClientRectFromClippingAncestor$1(element, clippingAncestor, strategy) {
19746
+ let rect;
19747
+ if (clippingAncestor === 'viewport') {
19748
+ rect = getViewportRect$2(element, strategy);
19749
+ } else if (clippingAncestor === 'document') {
19750
+ rect = getDocumentRect$2(getDocumentElement$2(element));
19751
+ } else if (isElement$2(clippingAncestor)) {
19752
+ rect = getInnerBoundingClientRect$2(clippingAncestor, strategy);
19753
+ } else {
19754
+ const visualOffsets = getVisualOffsets$1(element);
19755
+ rect = {
19756
+ ...clippingAncestor,
19757
+ x: clippingAncestor.x - visualOffsets.x,
19758
+ y: clippingAncestor.y - visualOffsets.y
19759
+ };
19760
+ }
19761
+ return rectToClientRect$2(rect);
19762
+ }
19763
+ function hasFixedPositionAncestor$1(element, stopNode) {
19764
+ const parentNode = getParentNode$2(element);
19765
+ if (parentNode === stopNode || !isElement$2(parentNode) || isLastTraversableNode$1(parentNode)) {
19766
+ return false;
19767
+ }
19768
+ return getComputedStyle$3(parentNode).position === 'fixed' || hasFixedPositionAncestor$1(parentNode, stopNode);
19769
+ }
19770
+
19771
+ // A "clipping ancestor" is an `overflow` element with the characteristic of
19772
+ // clipping (or hiding) child elements. This returns all clipping ancestors
19773
+ // of the given element up the tree.
19774
+ function getClippingElementAncestors$1(element, cache) {
19775
+ const cachedResult = cache.get(element);
19776
+ if (cachedResult) {
19777
+ return cachedResult;
19778
+ }
19779
+ let result = getOverflowAncestors$1(element, [], false).filter(el => isElement$2(el) && getNodeName$2(el) !== 'body');
19780
+ let currentContainingBlockComputedStyle = null;
19781
+ const elementIsFixed = getComputedStyle$3(element).position === 'fixed';
19782
+ let currentNode = elementIsFixed ? getParentNode$2(element) : element;
19783
+
19784
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
19785
+ while (isElement$2(currentNode) && !isLastTraversableNode$1(currentNode)) {
19786
+ const computedStyle = getComputedStyle$3(currentNode);
19787
+ const currentNodeIsContaining = isContainingBlock$1(currentNode);
19788
+ if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
19789
+ currentContainingBlockComputedStyle = null;
19790
+ }
19791
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement$1(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor$1(element, currentNode);
19792
+ if (shouldDropCurrentNode) {
19793
+ // Drop non-containing blocks.
19794
+ result = result.filter(ancestor => ancestor !== currentNode);
19795
+ } else {
19796
+ // Record last containing block for next iteration.
19797
+ currentContainingBlockComputedStyle = computedStyle;
19798
+ }
19799
+ currentNode = getParentNode$2(currentNode);
19800
+ }
19801
+ cache.set(element, result);
19802
+ return result;
19803
+ }
19804
+
19805
+ // Gets the maximum area that the element is visible in due to any number of
19806
+ // clipping ancestors.
19807
+ function getClippingRect$2(_ref) {
19808
+ let {
19809
+ element,
19810
+ boundary,
19811
+ rootBoundary,
19812
+ strategy
19813
+ } = _ref;
19814
+ const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer$1(element) ? [] : getClippingElementAncestors$1(element, this._c) : [].concat(boundary);
19815
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
19816
+ const firstClippingAncestor = clippingAncestors[0];
19817
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
19818
+ const rect = getClientRectFromClippingAncestor$1(element, clippingAncestor, strategy);
19819
+ accRect.top = max$3(rect.top, accRect.top);
19820
+ accRect.right = min$3(rect.right, accRect.right);
19821
+ accRect.bottom = min$3(rect.bottom, accRect.bottom);
19822
+ accRect.left = max$3(rect.left, accRect.left);
19823
+ return accRect;
19824
+ }, getClientRectFromClippingAncestor$1(element, firstClippingAncestor, strategy));
19825
+ return {
19826
+ width: clippingRect.right - clippingRect.left,
19827
+ height: clippingRect.bottom - clippingRect.top,
19828
+ x: clippingRect.left,
19829
+ y: clippingRect.top
19830
+ };
19831
+ }
19832
+
19833
+ function getDimensions$1(element) {
19834
+ const {
19835
+ width,
19836
+ height
19837
+ } = getCssDimensions$1(element);
19838
+ return {
19839
+ width,
19840
+ height
19841
+ };
19842
+ }
19843
+
19844
+ function getRectRelativeToOffsetParent$1(element, offsetParent, strategy) {
19845
+ const isOffsetParentAnElement = isHTMLElement$2(offsetParent);
19846
+ const documentElement = getDocumentElement$2(offsetParent);
19847
+ const isFixed = strategy === 'fixed';
19848
+ const rect = getBoundingClientRect$2(element, true, isFixed, offsetParent);
19849
+ let scroll = {
19850
+ scrollLeft: 0,
19851
+ scrollTop: 0
19852
+ };
19853
+ const offsets = createCoords$1(0);
19854
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
19855
+ if (getNodeName$2(offsetParent) !== 'body' || isOverflowElement$1(documentElement)) {
19856
+ scroll = getNodeScroll$2(offsetParent);
19857
+ }
19858
+ if (isOffsetParentAnElement) {
19859
+ const offsetRect = getBoundingClientRect$2(offsetParent, true, isFixed, offsetParent);
19860
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
19861
+ offsets.y = offsetRect.y + offsetParent.clientTop;
19862
+ } else if (documentElement) {
19863
+ offsets.x = getWindowScrollBarX$2(documentElement);
19864
+ }
19865
+ }
19866
+ const x = rect.left + scroll.scrollLeft - offsets.x;
19867
+ const y = rect.top + scroll.scrollTop - offsets.y;
19868
+ return {
19869
+ x,
19870
+ y,
19871
+ width: rect.width,
19872
+ height: rect.height
19873
+ };
19874
+ }
19875
+
19876
+ function isStaticPositioned$1(element) {
19877
+ return getComputedStyle$3(element).position === 'static';
19878
+ }
19879
+
19880
+ function getTrueOffsetParent$2(element, polyfill) {
19881
+ if (!isHTMLElement$2(element) || getComputedStyle$3(element).position === 'fixed') {
19882
+ return null;
19883
+ }
19884
+ if (polyfill) {
19885
+ return polyfill(element);
19886
+ }
19887
+ return element.offsetParent;
19888
+ }
19889
+
19890
+ // Gets the closest ancestor positioned element. Handles some edge cases,
19891
+ // such as table ancestors and cross browser bugs.
19892
+ function getOffsetParent$2(element, polyfill) {
19893
+ const win = getWindow$2(element);
19894
+ if (isTopLayer$1(element)) {
19895
+ return win;
19896
+ }
19897
+ if (!isHTMLElement$2(element)) {
19898
+ let svgOffsetParent = getParentNode$2(element);
19899
+ while (svgOffsetParent && !isLastTraversableNode$1(svgOffsetParent)) {
19900
+ if (isElement$2(svgOffsetParent) && !isStaticPositioned$1(svgOffsetParent)) {
19901
+ return svgOffsetParent;
19902
+ }
19903
+ svgOffsetParent = getParentNode$2(svgOffsetParent);
19904
+ }
19905
+ return win;
19906
+ }
19907
+ let offsetParent = getTrueOffsetParent$2(element, polyfill);
19908
+ while (offsetParent && isTableElement$2(offsetParent) && isStaticPositioned$1(offsetParent)) {
19909
+ offsetParent = getTrueOffsetParent$2(offsetParent, polyfill);
19910
+ }
19911
+ if (offsetParent && isLastTraversableNode$1(offsetParent) && isStaticPositioned$1(offsetParent) && !isContainingBlock$1(offsetParent)) {
19912
+ return win;
19913
+ }
19914
+ return offsetParent || getContainingBlock$2(element) || win;
19915
+ }
19916
+
19917
+ const getElementRects$1 = async function (data) {
19918
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent$2;
19919
+ const getDimensionsFn = this.getDimensions;
19920
+ const floatingDimensions = await getDimensionsFn(data.floating);
19921
+ return {
19922
+ reference: getRectRelativeToOffsetParent$1(data.reference, await getOffsetParentFn(data.floating), data.strategy),
19923
+ floating: {
19924
+ x: 0,
19925
+ y: 0,
19926
+ width: floatingDimensions.width,
19927
+ height: floatingDimensions.height
19928
+ }
19929
+ };
19930
+ };
19931
+
19932
+ function isRTL$1(element) {
19933
+ return getComputedStyle$3(element).direction === 'rtl';
19934
+ }
19935
+
19936
+ const platform$1 = {
19937
+ convertOffsetParentRelativeRectToViewportRelativeRect: convertOffsetParentRelativeRectToViewportRelativeRect$1,
19938
+ getDocumentElement: getDocumentElement$2,
19939
+ getClippingRect: getClippingRect$2,
19940
+ getOffsetParent: getOffsetParent$2,
19941
+ getElementRects: getElementRects$1,
19942
+ getClientRects: getClientRects$1,
19943
+ getDimensions: getDimensions$1,
19944
+ getScale: getScale$1,
19945
+ isElement: isElement$2,
19946
+ isRTL: isRTL$1
19947
+ };
19948
+
19949
+ /**
19950
+ * Modifies the placement by translating the floating element along the
19951
+ * specified axes.
19952
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
19953
+ * object may be passed.
19954
+ * @see https://floating-ui.com/docs/offset
19955
+ */
19956
+ const offset$5 = offset$6;
19957
+
19958
+ /**
19959
+ * Optimizes the visibility of the floating element by shifting it in order to
19960
+ * keep it in view when it will overflow the clipping boundary.
19961
+ * @see https://floating-ui.com/docs/shift
19962
+ */
19963
+ const shift$3 = shift$4;
19964
+
19965
+ /**
19966
+ * Optimizes the visibility of the floating element by flipping the `placement`
19967
+ * in order to keep it in view when the preferred placement(s) will overflow the
19968
+ * clipping boundary. Alternative to `autoPlacement`.
19969
+ * @see https://floating-ui.com/docs/flip
19970
+ */
19971
+ const flip$5 = flip$6;
19972
+
19973
+ /**
19974
+ * Computes the `x` and `y` coordinates that will place the floating element
19975
+ * next to a given reference element.
19976
+ */
19977
+ const computePosition$2 = (reference, floating, options) => {
19978
+ // This caches the expensive `getClippingElementAncestors` function so that
19979
+ // multiple lifecycle resets re-use the same result. It only lives for a
19980
+ // single call. If other functions become expensive, we can add them as well.
19981
+ const cache = new Map();
19982
+ const mergedOptions = {
19983
+ platform: platform$1,
19984
+ ...options
19985
+ };
19986
+ const platformWithCache = {
19987
+ ...mergedOptions.platform,
19988
+ _c: cache
19989
+ };
19990
+ return computePosition$3(reference, floating, {
19991
+ ...mergedOptions,
19992
+ platform: platformWithCache
19993
+ });
19994
+ };
19995
+
19996
+ var index = typeof document !== 'undefined' ? e.useLayoutEffect : e.useEffect;
19997
+
19998
+ // Fork of `fast-deep-equal` that only does the comparisons we need and compares
19999
+ // functions
20000
+ function deepEqual(a, b) {
20001
+ if (a === b) {
20002
+ return true;
20003
+ }
20004
+ if (typeof a !== typeof b) {
20005
+ return false;
20006
+ }
20007
+ if (typeof a === 'function' && a.toString() === b.toString()) {
20008
+ return true;
20009
+ }
20010
+ let length;
20011
+ let i;
20012
+ let keys;
20013
+ if (a && b && typeof a === 'object') {
20014
+ if (Array.isArray(a)) {
20015
+ length = a.length;
20016
+ if (length !== b.length) return false;
20017
+ for (i = length; i-- !== 0;) {
20018
+ if (!deepEqual(a[i], b[i])) {
20019
+ return false;
20020
+ }
20021
+ }
20022
+ return true;
20023
+ }
20024
+ keys = Object.keys(a);
20025
+ length = keys.length;
20026
+ if (length !== Object.keys(b).length) {
20027
+ return false;
20028
+ }
20029
+ for (i = length; i-- !== 0;) {
20030
+ if (!{}.hasOwnProperty.call(b, keys[i])) {
20031
+ return false;
20032
+ }
20033
+ }
20034
+ for (i = length; i-- !== 0;) {
20035
+ const key = keys[i];
20036
+ if (key === '_owner' && a.$$typeof) {
20037
+ continue;
20038
+ }
20039
+ if (!deepEqual(a[key], b[key])) {
20040
+ return false;
20041
+ }
20042
+ }
20043
+ return true;
20044
+ }
20045
+ return a !== a && b !== b;
20046
+ }
20047
+
20048
+ function getDPR(element) {
20049
+ if (typeof window === 'undefined') {
20050
+ return 1;
20051
+ }
20052
+ const win = element.ownerDocument.defaultView || window;
20053
+ return win.devicePixelRatio || 1;
20054
+ }
20055
+
20056
+ function roundByDPR(element, value) {
20057
+ const dpr = getDPR(element);
20058
+ return Math.round(value * dpr) / dpr;
20059
+ }
20060
+
20061
+ function useLatestRef(value) {
20062
+ const ref = e__namespace.useRef(value);
20063
+ index(() => {
20064
+ ref.current = value;
20065
+ });
20066
+ return ref;
20067
+ }
20068
+
20069
+ /**
20070
+ * Provides data to position a floating element.
20071
+ * @see https://floating-ui.com/docs/useFloating
20072
+ */
20073
+ function useFloating(options) {
20074
+ if (options === void 0) {
20075
+ options = {};
20076
+ }
20077
+ const {
20078
+ placement = 'bottom',
20079
+ strategy = 'absolute',
20080
+ middleware = [],
20081
+ platform,
20082
+ elements: {
20083
+ reference: externalReference,
20084
+ floating: externalFloating
20085
+ } = {},
20086
+ transform = true,
20087
+ whileElementsMounted,
20088
+ open
20089
+ } = options;
20090
+ const [data, setData] = e__namespace.useState({
20091
+ x: 0,
20092
+ y: 0,
20093
+ strategy,
20094
+ placement,
20095
+ middlewareData: {},
20096
+ isPositioned: false
20097
+ });
20098
+ const [latestMiddleware, setLatestMiddleware] = e__namespace.useState(middleware);
20099
+ if (!deepEqual(latestMiddleware, middleware)) {
20100
+ setLatestMiddleware(middleware);
20101
+ }
20102
+ const [_reference, _setReference] = e__namespace.useState(null);
20103
+ const [_floating, _setFloating] = e__namespace.useState(null);
20104
+ const setReference = e__namespace.useCallback(node => {
20105
+ if (node !== referenceRef.current) {
20106
+ referenceRef.current = node;
20107
+ _setReference(node);
20108
+ }
20109
+ }, []);
20110
+ const setFloating = e__namespace.useCallback(node => {
20111
+ if (node !== floatingRef.current) {
20112
+ floatingRef.current = node;
20113
+ _setFloating(node);
20114
+ }
20115
+ }, []);
20116
+ const referenceEl = externalReference || _reference;
20117
+ const floatingEl = externalFloating || _floating;
20118
+ const referenceRef = e__namespace.useRef(null);
20119
+ const floatingRef = e__namespace.useRef(null);
20120
+ const dataRef = e__namespace.useRef(data);
20121
+ const hasWhileElementsMounted = whileElementsMounted != null;
20122
+ const whileElementsMountedRef = useLatestRef(whileElementsMounted);
20123
+ const platformRef = useLatestRef(platform);
20124
+ const update = e__namespace.useCallback(() => {
20125
+ if (!referenceRef.current || !floatingRef.current) {
20126
+ return;
20127
+ }
20128
+ const config = {
20129
+ placement,
20130
+ strategy,
20131
+ middleware: latestMiddleware
20132
+ };
20133
+ if (platformRef.current) {
20134
+ config.platform = platformRef.current;
20135
+ }
20136
+ computePosition$2(referenceRef.current, floatingRef.current, config).then(data => {
20137
+ const fullData = {
20138
+ ...data,
20139
+ isPositioned: true
20140
+ };
20141
+ if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
20142
+ dataRef.current = fullData;
20143
+ ReactDOM__namespace.flushSync(() => {
20144
+ setData(fullData);
20145
+ });
20146
+ }
20147
+ });
20148
+ }, [latestMiddleware, placement, strategy, platformRef]);
20149
+ index(() => {
20150
+ if (open === false && dataRef.current.isPositioned) {
20151
+ dataRef.current.isPositioned = false;
20152
+ setData(data => ({
20153
+ ...data,
20154
+ isPositioned: false
20155
+ }));
20156
+ }
20157
+ }, [open]);
20158
+ const isMountedRef = e__namespace.useRef(false);
20159
+ index(() => {
20160
+ isMountedRef.current = true;
20161
+ return () => {
20162
+ isMountedRef.current = false;
20163
+ };
20164
+ }, []);
20165
+ index(() => {
20166
+ if (referenceEl) referenceRef.current = referenceEl;
20167
+ if (floatingEl) floatingRef.current = floatingEl;
20168
+ if (referenceEl && floatingEl) {
20169
+ if (whileElementsMountedRef.current) {
20170
+ return whileElementsMountedRef.current(referenceEl, floatingEl, update);
20171
+ }
20172
+ update();
20173
+ }
20174
+ }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
20175
+ const refs = e__namespace.useMemo(() => ({
20176
+ reference: referenceRef,
20177
+ floating: floatingRef,
20178
+ setReference,
20179
+ setFloating
20180
+ }), [setReference, setFloating]);
20181
+ const elements = e__namespace.useMemo(() => ({
20182
+ reference: referenceEl,
20183
+ floating: floatingEl
20184
+ }), [referenceEl, floatingEl]);
20185
+ const floatingStyles = e__namespace.useMemo(() => {
20186
+ const initialStyles = {
20187
+ position: strategy,
20188
+ left: 0,
20189
+ top: 0
20190
+ };
20191
+ if (!elements.floating) {
20192
+ return initialStyles;
20193
+ }
20194
+ const x = roundByDPR(elements.floating, data.x);
20195
+ const y = roundByDPR(elements.floating, data.y);
20196
+ if (transform) {
20197
+ return {
20198
+ ...initialStyles,
20199
+ transform: "translate(" + x + "px, " + y + "px)",
20200
+ ...(getDPR(elements.floating) >= 1.5 && {
20201
+ willChange: 'transform'
20202
+ })
20203
+ };
20204
+ }
20205
+ return {
20206
+ position: strategy,
20207
+ left: x,
20208
+ top: y
20209
+ };
20210
+ }, [strategy, transform, elements.floating, data.x, data.y]);
20211
+ return e__namespace.useMemo(() => ({
20212
+ ...data,
20213
+ update,
20214
+ refs,
20215
+ elements,
20216
+ floatingStyles
20217
+ }), [data, update, refs, elements, floatingStyles]);
20218
+ }
20219
+
20220
+ /**
20221
+ * Modifies the placement by translating the floating element along the
20222
+ * specified axes.
20223
+ * A number (shorthand for `mainAxis` or distance), or an axes configuration
20224
+ * object may be passed.
20225
+ * @see https://floating-ui.com/docs/offset
20226
+ */
20227
+ const offset$4 = (options, deps) => ({
20228
+ ...offset$5(options),
20229
+ options: [options, deps]
20230
+ });
20231
+
20232
+ /**
20233
+ * Optimizes the visibility of the floating element by shifting it in order to
20234
+ * keep it in view when it will overflow the clipping boundary.
20235
+ * @see https://floating-ui.com/docs/shift
20236
+ */
20237
+ const shift$2 = (options, deps) => ({
20238
+ ...shift$3(options),
20239
+ options: [options, deps]
20240
+ });
20241
+
20242
+ /**
20243
+ * Optimizes the visibility of the floating element by flipping the `placement`
20244
+ * in order to keep it in view when the preferred placement(s) will overflow the
20245
+ * clipping boundary. Alternative to `autoPlacement`.
20246
+ * @see https://floating-ui.com/docs/flip
20247
+ */
20248
+ const flip$4 = (options, deps) => ({
20249
+ ...flip$5(options),
20250
+ options: [options, deps]
20251
+ });
20252
+
20253
+ const useClickOutside = (ref, handler) => {
20254
+ e.useEffect(() => {
20255
+ const listener = (e) => {
20256
+ if (!ref.current || ref.current.contains(e.target)) {
20257
+ return;
20258
+ }
20259
+ handler(e);
20260
+ };
20261
+ document.addEventListener('mousedown', listener);
20262
+ document.addEventListener('touchstart', listener);
20263
+ return () => {
20264
+ document.removeEventListener('mousedown', listener);
20265
+ document.removeEventListener('touchstart', listener);
20266
+ };
20267
+ }, [ref, handler]);
20268
+ };
20269
+
20270
+ function Popper({ children, referenceElement, isOpen, onClose, ariaLabel, placement = 'bottom-start', offsetValue = 5, }) {
20271
+ const popperContentRef = e.useRef();
20272
+ const { x, y, strategy, refs } = useFloating({
20273
+ placement,
20274
+ middleware: [offset$4(offsetValue), flip$4(), shift$2()],
20275
+ elements: {
20276
+ reference: referenceElement,
20277
+ },
20278
+ });
20279
+ useClickOutside(popperContentRef, onClose);
20280
+ if (!isOpen) {
20281
+ return null;
20282
+ }
20283
+ return (jsxRuntime.jsx("div", { ref: refs.setFloating, style: {
20284
+ position: strategy,
20285
+ top: y !== null && y !== void 0 ? y : '',
20286
+ left: x !== null && x !== void 0 ? x : '',
20287
+ }, role: "dialog", "aria-label": ariaLabel, className: "popper-container", children: jsxRuntime.jsx("div", { ref: popperContentRef, className: "popper-content", children: children }) }));
20288
+ }
20289
+
20290
+ function Menu({ children }) {
20291
+ return (jsxRuntime.jsx("div", { className: "menu", children: e__namespace.default.Children.map(children, (child) => e__namespace.default.isValidElement(child)
20292
+ ? e__namespace.default.cloneElement(child, {
20293
+ className: y$1(child.props.className, 'menu-item'),
20294
+ })
20295
+ : child) }));
20296
+ }
20297
+
18735
20298
  const StyledAccordion = styled__default.default.details `
18736
20299
  summary {
18737
20300
  display: inherit;
@@ -22724,10 +24287,6 @@ const defaults = styled.css `
22724
24287
  font-family: ${typography.fontFamily.base};
22725
24288
 
22726
24289
  padding: 0 1em !important;
22727
-
22728
- & + button {
22729
- margin-left: 14px;
22730
- }
22731
24290
  `;
22732
24291
  const sizeLarge = styled.css `
22733
24292
  height: ${largeHeight};
@@ -41130,6 +42689,7 @@ exports.LoadingList = LoadingList;
41130
42689
  exports.MARGINS = margin;
41131
42690
  exports.MATH = MATH;
41132
42691
  exports.MEDIA_QUERIES = mediaQueries;
42692
+ exports.Menu = Menu;
41133
42693
  exports.ModalBase = ModalBase;
41134
42694
  exports.MultiCombobox = MultiCombobox;
41135
42695
  exports.NoInputDatePicker = NoInputDatePicker;
@@ -41138,6 +42698,7 @@ exports.PADDINGS = padding;
41138
42698
  exports.Pagination = Pagination;
41139
42699
  exports.PasswordInput = LabeledPasswordInput;
41140
42700
  exports.PercentageRing = PercentageRing;
42701
+ exports.Popper = Popper;
41141
42702
  exports.Radio = Radio;
41142
42703
  exports.RadioGroup = RadioGroup;
41143
42704
  exports.RadioInput = Radio$2;