@deque/cauldron-react 4.4.0 → 4.5.0-canary.0c764a21
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.
- package/lib/components/Loader/index.d.ts +1 -8
- package/lib/components/Panel/index.d.ts +4 -13
- package/lib/index.js +22 -12
- package/package.json +2 -2
|
@@ -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
|
|
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;
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import { HTMLAttributes,
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { HTMLAttributes, ReactNode } from 'react';
|
|
3
2
|
interface PanelProps extends HTMLAttributes<HTMLElement> {
|
|
4
3
|
children: ReactNode;
|
|
5
|
-
heading?:
|
|
4
|
+
heading?: ReactNode | {
|
|
6
5
|
id?: string;
|
|
7
|
-
text:
|
|
6
|
+
text: ReactNode;
|
|
8
7
|
level: number | undefined;
|
|
9
8
|
};
|
|
10
9
|
collapsed?: boolean;
|
|
11
10
|
className?: string;
|
|
12
11
|
}
|
|
13
|
-
declare const Panel:
|
|
14
|
-
({ children, collapsed, className, heading, ...other }: PanelProps): JSX.Element;
|
|
15
|
-
displayName: string;
|
|
16
|
-
propTypes: {
|
|
17
|
-
children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
18
|
-
heading: PropTypes.Requireable<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
19
|
-
className: PropTypes.Requireable<string>;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
12
|
+
declare const Panel: React.ForwardRefExoticComponent<PanelProps & React.RefAttributes<HTMLElement>>;
|
|
22
13
|
export default Panel;
|
package/lib/index.js
CHANGED
|
@@ -2223,7 +2223,7 @@ Link.propTypes = {
|
|
|
2223
2223
|
};
|
|
2224
2224
|
Link.displayName = 'Link';
|
|
2225
2225
|
|
|
2226
|
-
|
|
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
|
-
|
|
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 () {
|
|
@@ -8391,7 +8398,7 @@ Stepper.propTypes = {
|
|
|
8391
8398
|
className: PropTypes.string
|
|
8392
8399
|
};
|
|
8393
8400
|
|
|
8394
|
-
var Panel = function (_a) {
|
|
8401
|
+
var Panel = React.forwardRef(function (_a, ref) {
|
|
8395
8402
|
var _b;
|
|
8396
8403
|
var children = _a.children, collapsed = _a.collapsed, className = _a.className, heading = _a.heading, other = tslib.__rest(_a, ["children", "collapsed", "className", "heading"]);
|
|
8397
8404
|
var headingId = !heading
|
|
@@ -8403,19 +8410,22 @@ var Panel = function (_a) {
|
|
|
8403
8410
|
if (!headingId) {
|
|
8404
8411
|
return null;
|
|
8405
8412
|
}
|
|
8406
|
-
var HeadingComponent = "h" + (
|
|
8413
|
+
var HeadingComponent = "h" + (heading &&
|
|
8414
|
+
typeof heading === 'object' &&
|
|
8415
|
+
'level' in heading &&
|
|
8416
|
+
!!heading.level
|
|
8407
8417
|
? heading.level
|
|
8408
8418
|
: 2);
|
|
8409
|
-
return (React__default.createElement(HeadingComponent, { id: headingId, className: "Panel__Heading" }, typeof heading === 'object' && 'text' in heading
|
|
8419
|
+
return (React__default.createElement(HeadingComponent, { id: headingId, className: "Panel__Heading" }, heading && typeof heading === 'object' && 'text' in heading
|
|
8410
8420
|
? heading.text
|
|
8411
8421
|
: heading));
|
|
8412
8422
|
};
|
|
8413
8423
|
return (React__default.createElement("section", tslib.__assign({ "aria-labelledby": headingId, className: classNames('Panel', className, (_b = {},
|
|
8414
8424
|
_b['Panel--collapsed'] = collapsed,
|
|
8415
|
-
_b)) }, other),
|
|
8425
|
+
_b)), ref: ref }, other),
|
|
8416
8426
|
React__default.createElement(Heading, null),
|
|
8417
8427
|
children));
|
|
8418
|
-
};
|
|
8428
|
+
});
|
|
8419
8429
|
Panel.displayName = 'Panel';
|
|
8420
8430
|
Panel.propTypes = {
|
|
8421
8431
|
children: PropTypes.node.isRequired,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deque/cauldron-react",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0-canary.0c764a21",
|
|
4
4
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -124,4 +124,4 @@
|
|
|
124
124
|
"\\.svg$": "<rootDir>/__tests__/svgMock.js"
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
}
|
|
127
|
+
}
|