@deque/cauldron-react 4.4.0-canary.2508e60c → 4.4.0-canary.2f777a43

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.
@@ -1,14 +1,7 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  export interface LoaderProps extends React.HTMLAttributes<HTMLDivElement> {
4
3
  label?: string;
5
4
  variant?: 'large' | 'small';
6
5
  }
7
- declare function Loader({ className, variant, label, ...props }: LoaderProps): JSX.Element;
8
- declare namespace Loader {
9
- var propTypes: {
10
- className: PropTypes.Requireable<string>;
11
- };
12
- var displayName: string;
13
- }
6
+ declare const Loader: React.ForwardRefExoticComponent<LoaderProps & React.RefAttributes<HTMLDivElement>>;
14
7
  export default Loader;
package/lib/index.js CHANGED
@@ -2223,7 +2223,7 @@ Link.propTypes = {
2223
2223
  };
2224
2224
  Link.displayName = 'Link';
2225
2225
 
2226
- function Loader(_a) {
2226
+ var Loader = React__default.forwardRef(function (_a, ref) {
2227
2227
  var className = _a.className, _b = _a.variant, variant = _b === void 0 ? 'small' : _b, label = _a.label, props = tslib.__rest(_a, ["className", "variant", "label"]);
2228
2228
  if (label === null || label === void 0 ? void 0 : label.length) {
2229
2229
  props['role'] = 'alert';
@@ -2232,12 +2232,8 @@ function Loader(_a) {
2232
2232
  else {
2233
2233
  props['aria-hidden'] = true;
2234
2234
  }
2235
- return (React__default.createElement("div", tslib.__assign({ className: classNames('Loader', className, variant === 'large'
2236
- ? 'Loader--large'
2237
- : variant === 'small'
2238
- ? 'Loader--small'
2239
- : '') }, props)));
2240
- }
2235
+ return (React__default.createElement("div", tslib.__assign({ ref: ref, className: classNames('Loader', className, variant === 'large' && 'Loader--large', variant === 'small' && 'Loader--small') }, props)));
2236
+ });
2241
2237
  Loader.propTypes = {
2242
2238
  className: PropTypes.string
2243
2239
  };
@@ -8023,6 +8019,17 @@ function useSharedRef(ref) {
8023
8019
  var LoaderOverlay = React.forwardRef(function (_a, ref) {
8024
8020
  var className = _a.className, variant = _a.variant, label = _a.label, children = _a.children, focusOnInitialRender = _a.focusOnInitialRender, _b = _a.focusTrap, focusTrap = _b === void 0 ? false : _b, other = tslib.__rest(_a, ["className", "variant", "label", "children", "focusOnInitialRender", "focusTrap"]);
8025
8021
  var overlayRef = useSharedRef(ref);
8022
+ React.useEffect(function () {
8023
+ var isolator = overlayRef.current
8024
+ ? new AriaIsolate(overlayRef.current)
8025
+ : null;
8026
+ if (isolator) {
8027
+ focusTrap ? isolator.activate() : isolator.deactivate();
8028
+ }
8029
+ return function () {
8030
+ isolator === null || isolator === void 0 ? void 0 : isolator.deactivate();
8031
+ };
8032
+ }, [focusTrap, overlayRef.current]);
8026
8033
  React.useEffect(function () {
8027
8034
  if (!!focusOnInitialRender && overlayRef.current) {
8028
8035
  setTimeout(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "4.4.0-canary.2508e60c",
3
+ "version": "4.4.0-canary.2f777a43",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "publishConfig": {
6
6
  "access": "public"