react-bootstrap 2.2.2 → 2.3.1

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.
@@ -7,7 +7,7 @@
7
7
  exports["ReactBootstrap"] = factory(require("react"), require("react-dom"));
8
8
  else
9
9
  root["ReactBootstrap"] = factory(root["React"], root["ReactDOM"]);
10
- })(self, function(__WEBPACK_EXTERNAL_MODULE__787__, __WEBPACK_EXTERNAL_MODULE__156__) {
10
+ })(self, (__WEBPACK_EXTERNAL_MODULE__787__, __WEBPACK_EXTERNAL_MODULE__156__) => {
11
11
  return /******/ (() => { // webpackBootstrap
12
12
  /******/ var __webpack_modules__ = ({
13
13
 
@@ -3424,6 +3424,7 @@ function useMounted() {
3424
3424
  return mounted.current;
3425
3425
  });
3426
3426
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
3427
+ mounted.current = true;
3427
3428
  return function () {
3428
3429
  mounted.current = false;
3429
3430
  };
@@ -12650,6 +12651,205 @@ NavbarToggle.displayName = 'NavbarToggle';
12650
12651
  NavbarToggle.propTypes = NavbarToggle_propTypes;
12651
12652
  NavbarToggle.defaultProps = NavbarToggle_defaultProps;
12652
12653
  /* harmony default export */ const src_NavbarToggle = (NavbarToggle);
12654
+ ;// CONCATENATED MODULE: ./node_modules/@restart/hooks/esm/useMediaQuery.js
12655
+
12656
+
12657
+ var matchersByWindow = new WeakMap();
12658
+
12659
+ var getMatcher = function getMatcher(query, targetWindow) {
12660
+ if (!query || !targetWindow) return undefined;
12661
+ var matchers = matchersByWindow.get(targetWindow) || new Map();
12662
+ matchersByWindow.set(targetWindow, matchers);
12663
+ var mql = matchers.get(query);
12664
+
12665
+ if (!mql) {
12666
+ mql = targetWindow.matchMedia(query);
12667
+ mql.refCount = 0;
12668
+ matchers.set(mql.media, mql);
12669
+ }
12670
+
12671
+ return mql;
12672
+ };
12673
+ /**
12674
+ * Match a media query and get updates as the match changes. The media string is
12675
+ * passed directly to `window.matchMedia` and run as a Layout Effect, so initial
12676
+ * matches are returned before the browser has a chance to paint.
12677
+ *
12678
+ * ```tsx
12679
+ * function Page() {
12680
+ * const isWide = useMediaQuery('min-width: 1000px')
12681
+ *
12682
+ * return isWide ? "very wide" : 'not so wide'
12683
+ * }
12684
+ * ```
12685
+ *
12686
+ * Media query lists are also reused globally, hook calls for the same query
12687
+ * will only create a matcher once under the hood.
12688
+ *
12689
+ * @param query A media query
12690
+ * @param targetWindow The window to match against, uses the globally available one as a default.
12691
+ */
12692
+
12693
+
12694
+ function useMediaQuery(query, targetWindow) {
12695
+ if (targetWindow === void 0) {
12696
+ targetWindow = typeof window === 'undefined' ? undefined : window;
12697
+ }
12698
+
12699
+ var mql = getMatcher(query, targetWindow);
12700
+
12701
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(function () {
12702
+ return mql ? mql.matches : false;
12703
+ }),
12704
+ matches = _useState[0],
12705
+ setMatches = _useState[1];
12706
+
12707
+ useIsomorphicEffect(function () {
12708
+ var mql = getMatcher(query, targetWindow);
12709
+
12710
+ if (!mql) {
12711
+ return setMatches(false);
12712
+ }
12713
+
12714
+ var matchers = matchersByWindow.get(targetWindow);
12715
+
12716
+ var handleChange = function handleChange() {
12717
+ setMatches(mql.matches);
12718
+ };
12719
+
12720
+ mql.refCount++;
12721
+ mql.addListener(handleChange);
12722
+ handleChange();
12723
+ return function () {
12724
+ mql.removeListener(handleChange);
12725
+ mql.refCount--;
12726
+
12727
+ if (mql.refCount <= 0) {
12728
+ matchers == null ? void 0 : matchers.delete(mql.media);
12729
+ }
12730
+
12731
+ mql = undefined;
12732
+ };
12733
+ }, [query]);
12734
+ return matches;
12735
+ }
12736
+ ;// CONCATENATED MODULE: ./node_modules/@restart/hooks/esm/useBreakpoint.js
12737
+
12738
+
12739
+ /**
12740
+ * Create a responsive hook we a set of breakpoint names and widths.
12741
+ * You can use any valid css units as well as a numbers (for pixels).
12742
+ *
12743
+ * **NOTE:** The object key order is important! it's assumed to be in order from smallest to largest
12744
+ *
12745
+ * ```ts
12746
+ * const useBreakpoint = createBreakpointHook({
12747
+ * xs: 0,
12748
+ * sm: 576,
12749
+ * md: 768,
12750
+ * lg: 992,
12751
+ * xl: 1200,
12752
+ * })
12753
+ * ```
12754
+ *
12755
+ * **Watch out!** using string values will sometimes construct media queries using css `calc()` which
12756
+ * is NOT supported in media queries by all browsers at the moment. use numbers for
12757
+ * the widest range of browser support.
12758
+ *
12759
+ * @param breakpointValues A object hash of names to breakpoint dimensions
12760
+ */
12761
+
12762
+ function createBreakpointHook(breakpointValues) {
12763
+ var names = Object.keys(breakpointValues);
12764
+
12765
+ function and(query, next) {
12766
+ if (query === next) {
12767
+ return next;
12768
+ }
12769
+
12770
+ return query ? query + " and " + next : next;
12771
+ }
12772
+
12773
+ function getNext(breakpoint) {
12774
+ return names[Math.min(names.indexOf(breakpoint) + 1, names.length - 1)];
12775
+ }
12776
+
12777
+ function getMaxQuery(breakpoint) {
12778
+ var next = getNext(breakpoint);
12779
+ var value = breakpointValues[next];
12780
+ if (typeof value === 'number') value = value - 0.2 + "px";else value = "calc(" + value + " - 0.2px)";
12781
+ return "(max-width: " + value + ")";
12782
+ }
12783
+
12784
+ function getMinQuery(breakpoint) {
12785
+ var value = breakpointValues[breakpoint];
12786
+
12787
+ if (typeof value === 'number') {
12788
+ value = value + "px";
12789
+ }
12790
+
12791
+ return "(min-width: " + value + ")";
12792
+ }
12793
+ /**
12794
+ * Match a set of breakpoints
12795
+ *
12796
+ * ```tsx
12797
+ * const MidSizeOnly = () => {
12798
+ * const isMid = useBreakpoint({ lg: 'down', sm: 'up' });
12799
+ *
12800
+ * if (isMid) return <div>On a Reasonable sized Screen!</div>
12801
+ * return null;
12802
+ * }
12803
+ * ```
12804
+ * @param breakpointMap An object map of breakpoints and directions, queries are constructed using "and" to join
12805
+ * breakpoints together
12806
+ * @param window Optionally specify the target window to match against (useful when rendering into iframes)
12807
+ */
12808
+
12809
+
12810
+ function useBreakpoint(breakpointOrMap, direction, window) {
12811
+ var breakpointMap;
12812
+
12813
+ if (typeof breakpointOrMap === 'object') {
12814
+ breakpointMap = breakpointOrMap;
12815
+ window = direction;
12816
+ direction = true;
12817
+ } else {
12818
+ var _breakpointMap;
12819
+
12820
+ direction = direction || true;
12821
+ breakpointMap = (_breakpointMap = {}, _breakpointMap[breakpointOrMap] = direction, _breakpointMap);
12822
+ }
12823
+
12824
+ var query = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
12825
+ return Object.entries(breakpointMap).reduce(function (query, _ref) {
12826
+ var key = _ref[0],
12827
+ direction = _ref[1];
12828
+
12829
+ if (direction === 'up' || direction === true) {
12830
+ query = and(query, getMinQuery(key));
12831
+ }
12832
+
12833
+ if (direction === 'down' || direction === true) {
12834
+ query = and(query, getMaxQuery(key));
12835
+ }
12836
+
12837
+ return query;
12838
+ }, '');
12839
+ }, [JSON.stringify(breakpointMap)]);
12840
+ return useMediaQuery(query, window);
12841
+ }
12842
+
12843
+ return useBreakpoint;
12844
+ }
12845
+ var useBreakpoint = createBreakpointHook({
12846
+ xs: 0,
12847
+ sm: 576,
12848
+ md: 768,
12849
+ lg: 992,
12850
+ xl: 1200
12851
+ });
12852
+ /* harmony default export */ const esm_useBreakpoint = (useBreakpoint);
12653
12853
  ;// CONCATENATED MODULE: ./src/OffcanvasBody.tsx
12654
12854
 
12655
12855
  /* harmony default export */ const OffcanvasBody = (createWithBsPrefix('offcanvas-body'));
@@ -13132,16 +13332,71 @@ var NavbarOffcanvas_jsxFileName = "/Users/kyletsang/Documents/Kyle/Code/react-bo
13132
13332
 
13133
13333
 
13134
13334
 
13135
- const NavbarOffcanvas = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef((props, ref) => {
13335
+
13336
+
13337
+
13338
+ const NavbarOffcanvas = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(({
13339
+ className,
13340
+ bsPrefix,
13341
+ backdrop,
13342
+ backdropClassName,
13343
+ keyboard,
13344
+ scroll,
13345
+ placement,
13346
+ autoFocus,
13347
+ enforceFocus,
13348
+ restoreFocus,
13349
+ restoreFocusOptions,
13350
+ onShow,
13351
+ onHide,
13352
+ onEscapeKeyDown,
13353
+ onEnter,
13354
+ onEntering,
13355
+ onEntered,
13356
+ onExit,
13357
+ onExiting,
13358
+ onExited,
13359
+ ...props
13360
+ }, ref) => {
13136
13361
  const context = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(NavbarContext);
13137
- return /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(src_Offcanvas, {
13362
+ bsPrefix = useBootstrapPrefix(bsPrefix, 'offcanvas');
13363
+ const hasExpandProp = typeof (context == null ? void 0 : context.expand) === 'string';
13364
+ const shouldExpand = esm_useBreakpoint(hasExpandProp ? context.expand : 'xs', 'up');
13365
+ return hasExpandProp && shouldExpand ? /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)("div", {
13366
+ ref: ref,
13367
+ ...props,
13368
+ className: classnames_default()(className, bsPrefix, `${bsPrefix}-${placement}`)
13369
+ }, void 0, false, {
13370
+ fileName: NavbarOffcanvas_jsxFileName,
13371
+ lineNumber: 47,
13372
+ columnNumber: 7
13373
+ }, undefined) : /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(src_Offcanvas, {
13138
13374
  ref: ref,
13139
13375
  show: !!(context != null && context.expanded),
13376
+ bsPrefix: bsPrefix,
13377
+ backdrop: backdrop,
13378
+ backdropClassName: backdropClassName,
13379
+ keyboard: keyboard,
13380
+ scroll: scroll,
13381
+ placement: placement,
13382
+ autoFocus: autoFocus,
13383
+ enforceFocus: enforceFocus,
13384
+ restoreFocus: restoreFocus,
13385
+ restoreFocusOptions: restoreFocusOptions,
13386
+ onShow: onShow,
13387
+ onHide: onHide,
13388
+ onEscapeKeyDown: onEscapeKeyDown,
13389
+ onEnter: onEnter,
13390
+ onEntering: onEntering,
13391
+ onEntered: onEntered,
13392
+ onExit: onExit,
13393
+ onExiting: onExiting,
13394
+ onExited: onExited,
13140
13395
  ...props
13141
13396
  }, void 0, false, {
13142
13397
  fileName: NavbarOffcanvas_jsxFileName,
13143
- lineNumber: 10,
13144
- columnNumber: 12
13398
+ lineNumber: 53,
13399
+ columnNumber: 7
13145
13400
  }, undefined);
13146
13401
  });
13147
13402
  NavbarOffcanvas.displayName = 'NavbarOffcanvas';
@@ -13312,8 +13567,9 @@ const Navbar = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_a
13312
13567
  const navbarContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => ({
13313
13568
  onToggle: () => onToggle == null ? void 0 : onToggle(!expanded),
13314
13569
  bsPrefix,
13315
- expanded: !!expanded
13316
- }), [bsPrefix, expanded, onToggle]);
13570
+ expanded: !!expanded,
13571
+ expand
13572
+ }), [bsPrefix, expanded, expand, onToggle]);
13317
13573
  return /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(NavbarContext.Provider, {
13318
13574
  value: navbarContext,
13319
13575
  children: /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(esm_SelectableContext.Provider, {
@@ -13324,17 +13580,17 @@ const Navbar = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_a
13324
13580
  className: classnames_default()(className, bsPrefix, expand && expandClass, variant && `${bsPrefix}-${variant}`, bg && `bg-${bg}`, sticky && `sticky-${sticky}`, fixed && `fixed-${fixed}`)
13325
13581
  }, void 0, false, {
13326
13582
  fileName: Navbar_jsxFileName,
13327
- lineNumber: 200,
13583
+ lineNumber: 201,
13328
13584
  columnNumber: 11
13329
13585
  }, undefined)
13330
13586
  }, void 0, false, {
13331
13587
  fileName: Navbar_jsxFileName,
13332
- lineNumber: 199,
13588
+ lineNumber: 200,
13333
13589
  columnNumber: 9
13334
13590
  }, undefined)
13335
13591
  }, void 0, false, {
13336
13592
  fileName: Navbar_jsxFileName,
13337
- lineNumber: 198,
13593
+ lineNumber: 199,
13338
13594
  columnNumber: 7
13339
13595
  }, undefined);
13340
13596
  });
@@ -14249,33 +14505,31 @@ PageItem.displayName = 'PageItem';
14249
14505
  /* harmony default export */ const src_PageItem = (PageItem);
14250
14506
 
14251
14507
  function createButton(name, defaultValue, label = name) {
14252
- function Button({
14508
+ const Button = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef(({
14253
14509
  children,
14254
14510
  ...props
14255
- }) {
14256
- return /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(PageItem, { ...props,
14257
- children: [/*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)("span", {
14258
- "aria-hidden": "true",
14259
- children: children || defaultValue
14260
- }, void 0, false, {
14261
- fileName: PageItem_jsxFileName,
14262
- lineNumber: 80,
14263
- columnNumber: 9
14264
- }, this), /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)("span", {
14265
- className: "visually-hidden",
14266
- children: label
14267
- }, void 0, false, {
14268
- fileName: PageItem_jsxFileName,
14269
- lineNumber: 81,
14270
- columnNumber: 9
14271
- }, this)]
14272
- }, void 0, true, {
14511
+ }, ref) => /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)(PageItem, { ...props,
14512
+ ref: ref,
14513
+ children: [/*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)("span", {
14514
+ "aria-hidden": "true",
14515
+ children: children || defaultValue
14516
+ }, void 0, false, {
14273
14517
  fileName: PageItem_jsxFileName,
14274
- lineNumber: 79,
14275
- columnNumber: 7
14276
- }, this);
14277
- }
14278
-
14518
+ lineNumber: 80,
14519
+ columnNumber: 9
14520
+ }, this), /*#__PURE__*/(0,jsx_dev_runtime.jsxDEV)("span", {
14521
+ className: "visually-hidden",
14522
+ children: label
14523
+ }, void 0, false, {
14524
+ fileName: PageItem_jsxFileName,
14525
+ lineNumber: 81,
14526
+ columnNumber: 9
14527
+ }, this)]
14528
+ }, void 0, true, {
14529
+ fileName: PageItem_jsxFileName,
14530
+ lineNumber: 79,
14531
+ columnNumber: 7
14532
+ }, this));
14279
14533
  Button.displayName = name;
14280
14534
  return Button;
14281
14535
  }
@@ -15371,9 +15625,10 @@ Tabs.Panel = esm_TabPanel;
15371
15625
  /* harmony default export */ const esm_Tabs = (Tabs);
15372
15626
  ;// CONCATENATED MODULE: ./src/getTabTransitionComponent.ts
15373
15627
 
15628
+
15374
15629
  function getTabTransitionComponent(transition) {
15375
15630
  if (typeof transition === 'boolean') {
15376
- return transition ? src_Fade : undefined;
15631
+ return transition ? src_Fade : esm_NoopTransition;
15377
15632
  }
15378
15633
 
15379
15634
  return transition;