react-bootstrap 2.0.3 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1626,8 +1626,8 @@ function createBootstrapComponent(Component, opts) {
1626
1626
  bsPrefix: bsPrefix
1627
1627
  }, void 0, false, {
1628
1628
  fileName: ThemeProvider_jsxFileName,
1629
- lineNumber: 56,
1630
- columnNumber: 12
1629
+ lineNumber: 57,
1630
+ columnNumber: 14
1631
1631
  }, this);
1632
1632
  });
1633
1633
  Wrapped.displayName = `Bootstrap(${Component.displayName || Component.name})`;
@@ -2694,6 +2694,9 @@ Collapse.defaultProps = defaultProps;
2694
2694
  /* harmony default export */ const src_Collapse = (Collapse);
2695
2695
  ;// CONCATENATED MODULE: ./src/AccordionContext.ts
2696
2696
 
2697
+ function isAccordionItemSelected(activeEventKey, eventKey) {
2698
+ return Array.isArray(activeEventKey) ? activeEventKey.includes(eventKey) : activeEventKey === eventKey;
2699
+ }
2697
2700
  const context = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext({});
2698
2701
  context.displayName = 'AccordionContext';
2699
2702
  /* harmony default export */ const AccordionContext = (context);
@@ -2733,7 +2736,7 @@ const AccordionCollapse = /*#__PURE__*/external_root_React_commonjs2_react_commo
2733
2736
  bsPrefix = useBootstrapPrefix(bsPrefix, 'accordion-collapse');
2734
2737
  return /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(src_Collapse, {
2735
2738
  ref: ref,
2736
- in: activeEventKey === eventKey,
2739
+ in: isAccordionItemSelected(activeEventKey, eventKey),
2737
2740
  ...props,
2738
2741
  className: classnames_default()(className, bsPrefix),
2739
2742
  children: /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(Component, {
@@ -2830,16 +2833,31 @@ const AccordionButton_propTypes = {
2830
2833
  function useAccordionButton(eventKey, onClick) {
2831
2834
  const {
2832
2835
  activeEventKey,
2833
- onSelect
2836
+ onSelect,
2837
+ alwaysOpen
2834
2838
  } = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(AccordionContext);
2835
2839
  return e => {
2836
2840
  /*
2837
2841
  Compare the event key in context with the given event key.
2838
2842
  If they are the same, then collapse the component.
2839
2843
  */
2840
- const eventKeyPassed = eventKey === activeEventKey ? null : eventKey;
2841
- if (onSelect) onSelect(eventKeyPassed, e);
2842
- if (onClick) onClick(e);
2844
+ let eventKeyPassed = eventKey === activeEventKey ? null : eventKey;
2845
+
2846
+ if (alwaysOpen) {
2847
+ if (Array.isArray(activeEventKey)) {
2848
+ if (activeEventKey.includes(eventKey)) {
2849
+ eventKeyPassed = activeEventKey.filter(k => k !== eventKey);
2850
+ } else {
2851
+ eventKeyPassed = [...activeEventKey, eventKey];
2852
+ }
2853
+ } else {
2854
+ // activeEventKey is undefined.
2855
+ eventKeyPassed = [eventKey];
2856
+ }
2857
+ }
2858
+
2859
+ onSelect == null ? void 0 : onSelect(eventKeyPassed, e);
2860
+ onClick == null ? void 0 : onClick(e);
2843
2861
  };
2844
2862
  }
2845
2863
  const AccordionButton = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(({
@@ -2868,10 +2886,10 @@ const AccordionButton = /*#__PURE__*/external_root_React_commonjs2_react_commonj
2868
2886
  onClick: accordionOnClick,
2869
2887
  ...props,
2870
2888
  "aria-expanded": eventKey === activeEventKey,
2871
- className: classnames_default()(className, bsPrefix, eventKey !== activeEventKey && 'collapsed')
2889
+ className: classnames_default()(className, bsPrefix, !isAccordionItemSelected(activeEventKey, eventKey) && 'collapsed')
2872
2890
  }, void 0, false, {
2873
2891
  fileName: AccordionButton_jsxFileName,
2874
- lineNumber: 70,
2892
+ lineNumber: 86,
2875
2893
  columnNumber: 7
2876
2894
  }, undefined);
2877
2895
  });
@@ -3004,13 +3022,16 @@ const Accordion_propTypes = {
3004
3022
  bsPrefix: (prop_types_default()).string,
3005
3023
 
3006
3024
  /** The current active key that corresponds to the currently expanded card */
3007
- activeKey: (prop_types_default()).string,
3025
+ activeKey: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).array]),
3008
3026
 
3009
3027
  /** The default active key that is expanded on start */
3010
- defaultActiveKey: (prop_types_default()).string,
3028
+ defaultActiveKey: prop_types_default().oneOfType([(prop_types_default()).string, (prop_types_default()).array]),
3011
3029
 
3012
3030
  /** Renders accordion edge-to-edge with its parent container */
3013
- flush: (prop_types_default()).bool
3031
+ flush: (prop_types_default()).bool,
3032
+
3033
+ /** Allow accordion items to stay open when another item is opened */
3034
+ alwaysOpen: (prop_types_default()).bool
3014
3035
  };
3015
3036
  const Accordion = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
3016
3037
  const {
@@ -3021,6 +3042,7 @@ const Accordion = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_reac
3021
3042
  className,
3022
3043
  onSelect,
3023
3044
  flush,
3045
+ alwaysOpen,
3024
3046
  ...controlledProps
3025
3047
  } = useUncontrolled(props, {
3026
3048
  activeKey: 'onSelect'
@@ -3028,8 +3050,9 @@ const Accordion = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_reac
3028
3050
  const prefix = useBootstrapPrefix(bsPrefix, 'accordion');
3029
3051
  const contextValue = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => ({
3030
3052
  activeEventKey: activeKey,
3031
- onSelect
3032
- }), [activeKey, onSelect]);
3053
+ onSelect,
3054
+ alwaysOpen
3055
+ }), [activeKey, onSelect, alwaysOpen]);
3033
3056
  return /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(AccordionContext.Provider, {
3034
3057
  value: contextValue,
3035
3058
  children: /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(Component, {
@@ -3038,12 +3061,12 @@ const Accordion = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_reac
3038
3061
  className: classnames_default()(className, prefix, flush && `${prefix}-flush`)
3039
3062
  }, void 0, false, {
3040
3063
  fileName: Accordion_jsxFileName,
3041
- lineNumber: 68,
3064
+ lineNumber: 76,
3042
3065
  columnNumber: 9
3043
3066
  }, undefined)
3044
3067
  }, void 0, false, {
3045
3068
  fileName: Accordion_jsxFileName,
3046
- lineNumber: 67,
3069
+ lineNumber: 75,
3047
3070
  columnNumber: 7
3048
3071
  }, undefined);
3049
3072
  });
@@ -3063,7 +3086,7 @@ var lib = __webpack_require__(517);
3063
3086
  /**
3064
3087
  * Creates a `Ref` whose value is updated in an effect, ensuring the most recent
3065
3088
  * value is the one rendered with. Generally only required for Concurrent mode usage
3066
- * where previous work in `render()` may be discarded befor being used.
3089
+ * where previous work in `render()` may be discarded before being used.
3067
3090
  *
3068
3091
  * This is safe to access in an event handler.
3069
3092
  *
@@ -3161,7 +3184,7 @@ function useEventCallback_useEventCallback(fn) {
3161
3184
  * @param capture Whether or not to listen during the capture event phase
3162
3185
  */
3163
3186
 
3164
- function useEventListener(eventTarget, event, listener, capture) {
3187
+ function useEventListener_useEventListener(eventTarget, event, listener, capture) {
3165
3188
  if (capture === void 0) {
3166
3189
  capture = false;
3167
3190
  }
@@ -3198,7 +3221,7 @@ function useGlobalListener(event, handler, capture) {
3198
3221
  capture = false;
3199
3222
  }
3200
3223
 
3201
- var documentTarget = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function () {
3224
+ var documentTarget = useCallback(function () {
3202
3225
  return document;
3203
3226
  }, []);
3204
3227
  return useEventListener(documentTarget, event, handler, capture);
@@ -3668,13 +3691,22 @@ function useButtonProps({
3668
3691
  }
3669
3692
  };
3670
3693
 
3694
+ if (tagName === 'a') {
3695
+ // Ensure there's a href so Enter can trigger anchor button.
3696
+ href || (href = '#');
3697
+
3698
+ if (disabled) {
3699
+ href = undefined;
3700
+ }
3701
+ }
3702
+
3671
3703
  return [{
3672
3704
  role: 'button',
3673
3705
  // explicitly undefined so that it overrides the props disabled in a spread
3674
3706
  // e.g. <Tag {...props} {...hookProps} />
3675
3707
  disabled: undefined,
3676
3708
  tabIndex: disabled ? undefined : tabIndex,
3677
- href: tagName === 'a' && disabled ? undefined : href,
3709
+ href,
3678
3710
  target: tagName === 'a' ? target : undefined,
3679
3711
  'aria-disabled': !disabled ? undefined : disabled,
3680
3712
  rel: tagName === 'a' ? rel : undefined,
@@ -4423,8 +4455,8 @@ const Button_Button = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_
4423
4455
  ...props
4424
4456
  });
4425
4457
  const Component = tagName;
4426
- return /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(Component, { ...props,
4427
- ...buttonProps,
4458
+ return /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(Component, { ...buttonProps,
4459
+ ...props,
4428
4460
  ref: ref,
4429
4461
  className: classnames_default()(className, prefix, active && 'active', variant && `${prefix}-${variant}`, size && `${prefix}-${size}`, props.href && props.disabled && 'disabled')
4430
4462
  }, void 0, false, {
@@ -7848,16 +7880,15 @@ function contains_contains(context, node) {
7848
7880
  // EXTERNAL MODULE: ./node_modules/warning/warning.js
7849
7881
  var warning = __webpack_require__(459);
7850
7882
  var warning_default = /*#__PURE__*/__webpack_require__.n(warning);
7851
- ;// CONCATENATED MODULE: ./node_modules/@restart/ui/esm/useRootClose.js
7883
+ ;// CONCATENATED MODULE: ./node_modules/@restart/ui/esm/useClickOutside.js
7852
7884
 
7853
7885
 
7854
7886
 
7855
7887
 
7856
7888
 
7857
7889
 
7858
- const escapeKeyCode = 27;
7859
7890
 
7860
- const useRootClose_noop = () => {};
7891
+ const useClickOutside_noop = () => {};
7861
7892
 
7862
7893
  function isLeftClickEvent(event) {
7863
7894
  return event.button === 0;
@@ -7869,46 +7900,37 @@ function isModifiedEvent(event) {
7869
7900
 
7870
7901
  const getRefTarget = ref => ref && ('current' in ref ? ref.current : ref);
7871
7902
  /**
7872
- * The `useRootClose` hook registers your callback on the document
7873
- * when rendered. Powers the `<Overlay/>` component. This is used achieve modal
7874
- * style behavior where your callback is triggered when the user tries to
7875
- * interact with the rest of the document or hits the `esc` key.
7903
+ * The `useClickOutside` hook registers your callback on the document that fires
7904
+ * when a pointer event is registered outside of the provided ref or element.
7876
7905
  *
7877
7906
  * @param {Ref<HTMLElement>| HTMLElement} ref The element boundary
7878
- * @param {function} onRootClose
7907
+ * @param {function} onClickOutside
7879
7908
  * @param {object=} options
7880
7909
  * @param {boolean=} options.disabled
7881
7910
  * @param {string=} options.clickTrigger The DOM event name (click, mousedown, etc) to attach listeners on
7882
7911
  */
7883
7912
 
7884
-
7885
- function useRootClose(ref, onRootClose, {
7913
+ function useClickOutside(ref, onClickOutside = useClickOutside_noop, {
7886
7914
  disabled,
7887
7915
  clickTrigger = 'click'
7888
7916
  } = {}) {
7889
- const preventMouseRootCloseRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
7890
- const onClose = onRootClose || useRootClose_noop;
7917
+ const preventMouseClickOutsideRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
7891
7918
  const handleMouseCapture = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(e => {
7892
7919
  const currentTarget = getRefTarget(ref);
7893
- warning_default()(!!currentTarget, 'RootClose captured a close event but does not have a ref to compare it to. ' + 'useRootClose(), should be passed a ref that resolves to a DOM node');
7894
- preventMouseRootCloseRef.current = !currentTarget || isModifiedEvent(e) || !isLeftClickEvent(e) || !!contains_contains(currentTarget, e.target);
7920
+ warning_default()(!!currentTarget, 'ClickOutside captured a close event but does not have a ref to compare it to. ' + 'useClickOutside(), should be passed a ref that resolves to a DOM node');
7921
+ preventMouseClickOutsideRef.current = !currentTarget || isModifiedEvent(e) || !isLeftClickEvent(e) || !!contains_contains(currentTarget, e.target);
7895
7922
  }, [ref]);
7896
7923
  const handleMouse = useEventCallback_useEventCallback(e => {
7897
- if (!preventMouseRootCloseRef.current) {
7898
- onClose(e);
7899
- }
7900
- });
7901
- const handleKeyUp = useEventCallback_useEventCallback(e => {
7902
- if (e.keyCode === escapeKeyCode) {
7903
- onClose(e);
7924
+ if (!preventMouseClickOutsideRef.current) {
7925
+ onClickOutside(e);
7904
7926
  }
7905
7927
  });
7906
7928
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
7907
- if (disabled || ref == null) return undefined; // Store the current event to avoid triggering handlers immediately
7929
+ if (disabled || ref == null) return undefined;
7930
+ const doc = ownerDocument(getRefTarget(ref)); // Store the current event to avoid triggering handlers immediately
7908
7931
  // https://github.com/facebook/react/issues/20074
7909
7932
 
7910
- let currentEvent = window.event;
7911
- const doc = ownerDocument(getRefTarget(ref)); // Use capture for this listener so it fires before React's listener, to
7933
+ let currentEvent = (doc.defaultView || window).event; // Use capture for this listener so it fires before React's listener, to
7912
7934
  // avoid false positives in the contains() check below if the target DOM
7913
7935
  // element is removed in the React mouse callback.
7914
7936
 
@@ -7922,31 +7944,21 @@ function useRootClose(ref, onRootClose, {
7922
7944
 
7923
7945
  handleMouse(e);
7924
7946
  });
7925
- const removeKeyupListener = esm_listen(doc, 'keyup', e => {
7926
- // skip if this event is the same as the one running when we added the handlers
7927
- if (e === currentEvent) {
7928
- currentEvent = undefined;
7929
- return;
7930
- }
7931
-
7932
- handleKeyUp(e);
7933
- });
7934
7947
  let mobileSafariHackListeners = [];
7935
7948
 
7936
7949
  if ('ontouchstart' in doc.documentElement) {
7937
- mobileSafariHackListeners = [].slice.call(doc.body.children).map(el => esm_listen(el, 'mousemove', useRootClose_noop));
7950
+ mobileSafariHackListeners = [].slice.call(doc.body.children).map(el => esm_listen(el, 'mousemove', useClickOutside_noop));
7938
7951
  }
7939
7952
 
7940
7953
  return () => {
7941
7954
  removeMouseCaptureListener();
7942
7955
  removeMouseListener();
7943
- removeKeyupListener();
7944
7956
  mobileSafariHackListeners.forEach(remove => remove());
7945
7957
  };
7946
- }, [ref, disabled, clickTrigger, handleMouseCapture, handleMouse, handleKeyUp]);
7958
+ }, [ref, disabled, clickTrigger, handleMouseCapture, handleMouse]);
7947
7959
  }
7948
7960
 
7949
- /* harmony default export */ const esm_useRootClose = (useRootClose);
7961
+ /* harmony default export */ const esm_useClickOutside = (useClickOutside);
7950
7962
  ;// CONCATENATED MODULE: ./node_modules/@restart/ui/esm/mergeOptionsWithPopperConfig.js
7951
7963
  function toModifierMap(modifiers) {
7952
7964
  const result = {};
@@ -8111,7 +8123,7 @@ function useDropdownMenu(options = {}) {
8111
8123
  style: popper.styles.arrow
8112
8124
  }) : {}
8113
8125
  };
8114
- esm_useRootClose(menuElement, handleClose, {
8126
+ esm_useClickOutside(menuElement, handleClose, {
8115
8127
  clickTrigger: rootCloseEvent,
8116
8128
  disabled: !show
8117
8129
  });
@@ -8388,6 +8400,21 @@ const DropdownItem = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_r
8388
8400
  });
8389
8401
  DropdownItem.displayName = 'DropdownItem';
8390
8402
  /* harmony default export */ const esm_DropdownItem = (DropdownItem);
8403
+ ;// CONCATENATED MODULE: ./node_modules/@restart/ui/esm/useWindow.js
8404
+
8405
+
8406
+ const Context = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createContext)(canUseDOM ? window : undefined);
8407
+ const WindowProvider = Context.Provider;
8408
+ /**
8409
+ * The document "window" placed in React context. Helpful for determining
8410
+ * SSR context, or when rendering into an iframe.
8411
+ *
8412
+ * @returns the current window
8413
+ */
8414
+
8415
+ function useWindow() {
8416
+ return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(Context);
8417
+ }
8391
8418
  ;// CONCATENATED MODULE: ./node_modules/@restart/ui/esm/Dropdown.js
8392
8419
 
8393
8420
 
@@ -8406,6 +8433,7 @@ DropdownItem.displayName = 'DropdownItem';
8406
8433
 
8407
8434
 
8408
8435
 
8436
+
8409
8437
  function useRefWithUpdate() {
8410
8438
  const forceUpdate = useForceUpdate();
8411
8439
  const ref = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
@@ -8432,6 +8460,7 @@ function Dropdown({
8432
8460
  placement = 'bottom-start',
8433
8461
  children
8434
8462
  }) {
8463
+ const window = useWindow();
8435
8464
  const [show, onToggle] = useUncontrolledProp(rawShow, defaultShow, rawOnToggle); // We use normal refs instead of useCallbackRef in order to populate the
8436
8465
  // the value as quickly as possible, otherwise the effect to focus the element
8437
8466
  // may run before the state value is set
@@ -8469,7 +8498,7 @@ function Dropdown({
8469
8498
  }), [toggle, placement, show, menuElement, toggleElement, setMenu, setToggle]);
8470
8499
 
8471
8500
  if (menuElement && lastShow && !show) {
8472
- focusInDropdown.current = menuElement.contains(document.activeElement);
8501
+ focusInDropdown.current = menuElement.contains(menuElement.ownerDocument.activeElement);
8473
8502
  }
8474
8503
 
8475
8504
  const focusToggle = useEventCallback_useEventCallback(() => {
@@ -8510,7 +8539,7 @@ function Dropdown({
8510
8539
  return items[index];
8511
8540
  };
8512
8541
 
8513
- useGlobalListener('keydown', event => {
8542
+ useEventListener_useEventListener((0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(() => window.document, [window]), 'keydown', event => {
8514
8543
  var _menuRef$current, _toggleRef$current;
8515
8544
 
8516
8545
  const {
@@ -8523,7 +8552,7 @@ function Dropdown({
8523
8552
 
8524
8553
  const isInput = /input|textarea/i.test(target.tagName);
8525
8554
 
8526
- if (isInput && (key === ' ' || key !== 'Escape' && fromMenu)) {
8555
+ if (isInput && (key === ' ' || key !== 'Escape' && fromMenu || key === 'Escape' && target.type === 'search')) {
8527
8556
  return;
8528
8557
  }
8529
8558
 
@@ -8567,7 +8596,7 @@ function Dropdown({
8567
8596
  // to know if this event is relevant to this dropdown (e.g. in this menu).
8568
8597
  // On `keyup` the target is the element being tagged TO which we use to check
8569
8598
  // if focus has left the menu
8570
- esm_addEventListener(document, 'keyup', e => {
8599
+ esm_addEventListener(target.ownerDocument, 'keyup', e => {
8571
8600
  var _menuRef$current2;
8572
8601
 
8573
8602
  if (e.key === 'Tab' && !e.target || !((_menuRef$current2 = menuRef.current) != null && _menuRef$current2.contains(e.target))) {
@@ -11100,8 +11129,9 @@ function useWillUnmount_useWillUnmount(fn) {
11100
11129
  /**
11101
11130
  * Get the width of the vertical window scrollbar if it's visible
11102
11131
  */
11103
- function getBodyScrollbarWidth() {
11104
- return Math.abs(window.innerWidth - document.documentElement.clientWidth);
11132
+ function getBodyScrollbarWidth(ownerDocument = document) {
11133
+ const window = ownerDocument.defaultView;
11134
+ return Math.abs(window.innerWidth - ownerDocument.documentElement.clientWidth);
11105
11135
  }
11106
11136
  ;// CONCATENATED MODULE: ./node_modules/@restart/ui/esm/ModalManager.js
11107
11137
 
@@ -11115,20 +11145,22 @@ const OPEN_DATA_ATTRIBUTE = dataAttr('modal-open');
11115
11145
 
11116
11146
  class ModalManager {
11117
11147
  constructor({
11148
+ ownerDocument,
11118
11149
  handleContainerOverflow = true,
11119
11150
  isRTL = false
11120
11151
  } = {}) {
11121
11152
  this.handleContainerOverflow = handleContainerOverflow;
11122
11153
  this.isRTL = isRTL;
11123
11154
  this.modals = [];
11155
+ this.ownerDocument = ownerDocument;
11124
11156
  }
11125
11157
 
11126
11158
  getScrollbarWidth() {
11127
- return getBodyScrollbarWidth();
11159
+ return getBodyScrollbarWidth(this.ownerDocument);
11128
11160
  }
11129
11161
 
11130
11162
  getElement() {
11131
- return document.body;
11163
+ return (this.ownerDocument || document).body;
11132
11164
  }
11133
11165
 
11134
11166
  setModalAttributes(_modal) {// For overriding
@@ -11224,18 +11256,21 @@ class ModalManager {
11224
11256
  ;// CONCATENATED MODULE: ./node_modules/@restart/ui/esm/useWaitForDOMRef.js
11225
11257
 
11226
11258
 
11227
- const resolveContainerRef = ref => {
11259
+
11260
+
11261
+ const resolveContainerRef = (ref, document) => {
11228
11262
  var _ref;
11229
11263
 
11230
- if (typeof document === 'undefined') return null;
11231
- if (ref == null) return ownerDocument().body;
11264
+ if (!canUseDOM) return null;
11265
+ if (ref == null) return (document || ownerDocument()).body;
11232
11266
  if (typeof ref === 'function') ref = ref();
11233
11267
  if (ref && 'current' in ref) ref = ref.current;
11234
11268
  if ((_ref = ref) != null && _ref.nodeType) return ref || null;
11235
11269
  return null;
11236
11270
  };
11237
11271
  function useWaitForDOMRef(ref, onResolved) {
11238
- const [resolvedRef, setRef] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(() => resolveContainerRef(ref));
11272
+ const window = useWindow();
11273
+ const [resolvedRef, setRef] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(() => resolveContainerRef(ref, window == null ? void 0 : window.document));
11239
11274
 
11240
11275
  if (!resolvedRef) {
11241
11276
  const earlyRef = resolveContainerRef(ref);
@@ -11292,15 +11327,19 @@ function Modal_objectWithoutPropertiesLoose(source, excluded) {
11292
11327
 
11293
11328
 
11294
11329
 
11330
+
11295
11331
  let manager;
11296
11332
 
11297
- function getManager() {
11298
- if (!manager) manager = new esm_ModalManager();
11333
+ function getManager(window) {
11334
+ if (!manager) manager = new esm_ModalManager({
11335
+ ownerDocument: window == null ? void 0 : window.document
11336
+ });
11299
11337
  return manager;
11300
11338
  }
11301
11339
 
11302
11340
  function useModalManager(provided) {
11303
- const modalManager = provided || getManager();
11341
+ const window = useWindow();
11342
+ const modalManager = provided || getManager(window);
11304
11343
  const modal = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
11305
11344
  dialog: null,
11306
11345
  backdrop: null
@@ -13501,7 +13540,7 @@ const NavDropdown = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_re
13501
13540
  children: title
13502
13541
  }, void 0, false, {
13503
13542
  fileName: NavDropdown_jsxFileName,
13504
- lineNumber: 93,
13543
+ lineNumber: 92,
13505
13544
  columnNumber: 11
13506
13545
  }, undefined), /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(src_Dropdown.Menu, {
13507
13546
  role: menuRole,
@@ -13511,12 +13550,12 @@ const NavDropdown = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_re
13511
13550
  children: children
13512
13551
  }, void 0, false, {
13513
13552
  fileName: NavDropdown_jsxFileName,
13514
- lineNumber: 104,
13553
+ lineNumber: 103,
13515
13554
  columnNumber: 11
13516
13555
  }, undefined)]
13517
13556
  }, void 0, true, {
13518
13557
  fileName: NavDropdown_jsxFileName,
13519
- lineNumber: 88,
13558
+ lineNumber: 87,
13520
13559
  columnNumber: 9
13521
13560
  }, undefined);
13522
13561
  });
@@ -13528,6 +13567,65 @@ NavDropdown.propTypes = NavDropdown_propTypes;
13528
13567
  Divider: src_Dropdown.Divider,
13529
13568
  Header: src_Dropdown.Header
13530
13569
  }));
13570
+ ;// CONCATENATED MODULE: ./node_modules/@restart/ui/esm/useRootClose.js
13571
+
13572
+
13573
+
13574
+
13575
+
13576
+ const escapeKeyCode = 27;
13577
+
13578
+ const useRootClose_noop = () => {};
13579
+ /**
13580
+ * The `useRootClose` hook registers your callback on the document
13581
+ * when rendered. Powers the `<Overlay/>` component. This is used achieve modal
13582
+ * style behavior where your callback is triggered when the user tries to
13583
+ * interact with the rest of the document or hits the `esc` key.
13584
+ *
13585
+ * @param {Ref<HTMLElement>| HTMLElement} ref The element boundary
13586
+ * @param {function} onRootClose
13587
+ * @param {object=} options
13588
+ * @param {boolean=} options.disabled
13589
+ * @param {string=} options.clickTrigger The DOM event name (click, mousedown, etc) to attach listeners on
13590
+ */
13591
+
13592
+
13593
+ function useRootClose(ref, onRootClose, {
13594
+ disabled,
13595
+ clickTrigger
13596
+ } = {}) {
13597
+ const onClose = onRootClose || useRootClose_noop;
13598
+ esm_useClickOutside(ref, onClose, {
13599
+ disabled,
13600
+ clickTrigger
13601
+ });
13602
+ const handleKeyUp = useEventCallback_useEventCallback(e => {
13603
+ if (e.keyCode === escapeKeyCode) {
13604
+ onClose(e);
13605
+ }
13606
+ });
13607
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
13608
+ if (disabled || ref == null) return undefined;
13609
+ const doc = ownerDocument(getRefTarget(ref)); // Store the current event to avoid triggering handlers immediately
13610
+ // https://github.com/facebook/react/issues/20074
13611
+
13612
+ let currentEvent = (doc.defaultView || window).event;
13613
+ const removeKeyupListener = esm_listen(doc, 'keyup', e => {
13614
+ // skip if this event is the same as the one running when we added the handlers
13615
+ if (e === currentEvent) {
13616
+ currentEvent = undefined;
13617
+ return;
13618
+ }
13619
+
13620
+ handleKeyUp(e);
13621
+ });
13622
+ return () => {
13623
+ removeKeyupListener();
13624
+ };
13625
+ }, [ref, disabled, handleKeyUp]);
13626
+ }
13627
+
13628
+ /* harmony default export */ const esm_useRootClose = (useRootClose);
13531
13629
  ;// CONCATENATED MODULE: ./node_modules/@restart/ui/esm/Overlay.js
13532
13630
 
13533
13631
 
@@ -13916,21 +14014,22 @@ const Overlay_Overlay = /*#__PURE__*/external_root_React_commonjs2_react_commonj
13916
14014
  transition: actualTransition,
13917
14015
  children: (overlayProps, {
13918
14016
  arrowProps,
13919
- placement,
13920
14017
  popper: popperObj,
13921
14018
  show
13922
14019
  }) => {
13923
14020
  var _popperObj$state, _popperObj$state$modi;
13924
14021
 
13925
- wrapRefs(overlayProps, arrowProps);
14022
+ wrapRefs(overlayProps, arrowProps); // Need to get placement from popper object, handling case when overlay is flipped using 'flip' prop
14023
+
14024
+ const updatedPlacement = popperObj == null ? void 0 : popperObj.placement;
13926
14025
  const popper = Object.assign(popperRef.current, {
13927
14026
  state: popperObj == null ? void 0 : popperObj.state,
13928
14027
  scheduleUpdate: popperObj == null ? void 0 : popperObj.update,
13929
- placement,
14028
+ placement: updatedPlacement,
13930
14029
  outOfBoundaries: (popperObj == null ? void 0 : (_popperObj$state = popperObj.state) == null ? void 0 : (_popperObj$state$modi = _popperObj$state.modifiersData.hide) == null ? void 0 : _popperObj$state$modi.isReferenceHidden) || false
13931
14030
  });
13932
14031
  if (typeof overlay === 'function') return overlay({ ...overlayProps,
13933
- placement,
14032
+ placement: updatedPlacement,
13934
14033
  show,
13935
14034
  ...(!transition && show && {
13936
14035
  className: 'show'
@@ -13939,7 +14038,7 @@ const Overlay_Overlay = /*#__PURE__*/external_root_React_commonjs2_react_commonj
13939
14038
  arrowProps
13940
14039
  });
13941
14040
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement(overlay, { ...overlayProps,
13942
- placement,
14041
+ placement: updatedPlacement,
13943
14042
  arrowProps,
13944
14043
  popper,
13945
14044
  className: classnames_default()(overlay.props.className, !transition && show && 'show'),
@@ -15203,7 +15302,7 @@ function NoopTransition({
15203
15302
 
15204
15303
  /* harmony default export */ const esm_NoopTransition = (NoopTransition);
15205
15304
  ;// CONCATENATED MODULE: ./node_modules/@restart/ui/esm/TabPanel.js
15206
- const TabPanel_excluded = ["active", "eventKey", "mountOnEnter", "transition", "unmountOnExit"],
15305
+ const TabPanel_excluded = ["active", "eventKey", "mountOnEnter", "transition", "unmountOnExit", "role"],
15207
15306
  _excluded2 = ["activeKey", "getControlledId", "getControllerId"],
15208
15307
  _excluded3 = ["as"];
15209
15308
 
@@ -15234,12 +15333,15 @@ function useTabPanel(_ref) {
15234
15333
  eventKey,
15235
15334
  mountOnEnter,
15236
15335
  transition,
15237
- unmountOnExit
15336
+ unmountOnExit,
15337
+ role = 'tabpanel'
15238
15338
  } = _ref,
15239
15339
  props = TabPanel_objectWithoutPropertiesLoose(_ref, TabPanel_excluded);
15240
15340
 
15241
15341
  const context = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(esm_TabContext);
15242
- if (!context) return [props, {
15342
+ if (!context) return [Object.assign({}, props, {
15343
+ role
15344
+ }), {
15243
15345
  eventKey,
15244
15346
  isActive: active,
15245
15347
  mountOnEnter,
@@ -15256,6 +15358,7 @@ function useTabPanel(_ref) {
15256
15358
 
15257
15359
  const key = makeEventKey(eventKey);
15258
15360
  return [Object.assign({}, props, {
15361
+ role,
15259
15362
  id: getControlledId(eventKey),
15260
15363
  'aria-labelledby': getControllerId(eventKey)
15261
15364
  }), {
@@ -15303,7 +15406,6 @@ const TabPanel = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react
15303
15406
  unmountOnExit: unmountOnExit,
15304
15407
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(Component, Object.assign({}, tabPanelProps, {
15305
15408
  ref: ref,
15306
- role: "tabpanel",
15307
15409
  hidden: !isActive,
15308
15410
  "aria-hidden": !isActive
15309
15411
  }))
@@ -16305,6 +16407,7 @@ const ToggleButton = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_r
16305
16407
  ref: ref,
16306
16408
  className: classnames_default()(className, disabled && 'disabled'),
16307
16409
  type: undefined,
16410
+ role: undefined,
16308
16411
  as: "label",
16309
16412
  htmlFor: id
16310
16413
  }, void 0, false, {