@deque/cauldron-react 4.2.1-canary.cea36594 → 4.2.1-canary.d1539456

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/index.js CHANGED
@@ -1423,8 +1423,9 @@ var SkipLink = /** @class */ (function (_super) {
1423
1423
  return (React__default.createElement("nav", tslib.__assign({ className: classNames('SkipLink', currentClass) }, other),
1424
1424
  React__default.createElement("a", { href: target, className: "SkipLink__link", onClick: this.onClick, onFocus: this.onFocus, onBlur: this.onBlur },
1425
1425
  React__default.createElement("span", { className: "SkipLink__item--first" }, skipText),
1426
- "\u00A0",
1427
- React__default.createElement("span", { className: "SkipLink__item--second" }, targetText))));
1426
+ React__default.createElement("span", { className: "SkipLink__item--second" },
1427
+ React__default.createElement(Icon, { type: "triangle-right" }),
1428
+ targetText))));
1428
1429
  };
1429
1430
  SkipLink.prototype.onClick = function () {
1430
1431
  if (!isBrowser()) {
@@ -7999,9 +8000,31 @@ function AxeLoader() {
7999
8000
  React__default.createElement("path", { fill: "currentColor", d: "M379 549.9h-27.6v-16.7c-7.4 13.5-22.8 20.2-39 20.2-37.1 0-58.9-28.9-58.9-61.6 0-36.5 26.4-61.4 58.9-61.4 21.1 0 34 11.2 39 20.5V434H379v115.9zm-97.8-57.4c0 14.3 10.3 35.2 35.2 35.2 15.4 0 25.5-8 30.8-18.6 2.7-5.1 4-10.5 4.4-16.2.2-5.5-.8-11.2-3.2-16.2-4.9-11-15.6-20.5-32.3-20.5-22.4 0-35 18.1-35 36.1v.2zM436.2 488.9l-39-54.8h33.3l22.6 35.6 22.6-35.6h32.9l-38.8 54.8 43.2 61h-34L453.1 510l-26.2 39.9h-33.5l42.8-61z" })));
8000
8001
  }
8001
8002
 
8002
- var LoaderOverlay = React__default.forwardRef(function (_a, ref) {
8003
+ /**
8004
+ * When a component needs to track an internal ref on a component that has a
8005
+ * forwarded ref, useSharedRef will return a MutableRefObject<T> that will
8006
+ * correctly invoke the parent ref as well providing an internal ref.
8007
+ *
8008
+ * @example
8009
+ * React.forwardRef(function Component({ children }, ref) {
8010
+ * const internalRef = useSharedRef<HTMLElement>(ref)
8011
+ * if (internalRef.current) {
8012
+ * // do something with the internal ref...
8013
+ * }
8014
+ * return (<div ref={internalRef}>...</div>)
8015
+ * })
8016
+ */
8017
+ function useSharedRef(ref) {
8018
+ var internalRef = React.useRef();
8019
+ React.useEffect(function () {
8020
+ setRef(ref, internalRef.current);
8021
+ }, [ref]);
8022
+ return internalRef;
8023
+ }
8024
+
8025
+ var LoaderOverlay = React.forwardRef(function (_a, ref) {
8003
8026
  var className = _a.className, variant = _a.variant, label = _a.label, children = _a.children, focusOnInitialRender = _a.focusOnInitialRender, other = tslib.__rest(_a, ["className", "variant", "label", "children", "focusOnInitialRender"]);
8004
- var overlayRef = typeof ref === 'function' || !ref ? React.createRef() : ref;
8027
+ var overlayRef = useSharedRef(ref);
8005
8028
  React.useEffect(function () {
8006
8029
  if (!!focusOnInitialRender && overlayRef.current) {
8007
8030
  setTimeout(function () {
@@ -8011,11 +8034,6 @@ var LoaderOverlay = React__default.forwardRef(function (_a, ref) {
8011
8034
  }
8012
8035
  return;
8013
8036
  }, [overlayRef.current]);
8014
- React.useEffect(function () {
8015
- if (typeof ref === 'function') {
8016
- ref(overlayRef.current);
8017
- }
8018
- }, [ref]);
8019
8037
  return (React__default.createElement("div", tslib.__assign({ className: classNames('Loader__overlay', className, variant === 'large'
8020
8038
  ? 'Loader__overlay--large'
8021
8039
  : variant === 'small'
@@ -0,0 +1,16 @@
1
+ import { MutableRefObject, Ref } from 'react';
2
+ /**
3
+ * When a component needs to track an internal ref on a component that has a
4
+ * forwarded ref, useSharedRef will return a MutableRefObject<T> that will
5
+ * correctly invoke the parent ref as well providing an internal ref.
6
+ *
7
+ * @example
8
+ * React.forwardRef(function Component({ children }, ref) {
9
+ * const internalRef = useSharedRef<HTMLElement>(ref)
10
+ * if (internalRef.current) {
11
+ * // do something with the internal ref...
12
+ * }
13
+ * return (<div ref={internalRef}>...</div>)
14
+ * })
15
+ */
16
+ export default function useSharedRef<T>(ref: Ref<T>): MutableRefObject<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "4.2.1-canary.cea36594",
3
+ "version": "4.2.1-canary.d1539456",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "publishConfig": {
6
6
  "access": "public"