@deque/cauldron-react 4.1.0-canary.2e36990f → 4.1.0-canary.49b3b909

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.
@@ -2,7 +2,7 @@ import { HTMLAttributes, ReactElement, ReactNode } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  interface PanelProps extends HTMLAttributes<HTMLElement> {
4
4
  children: ReactNode;
5
- heading: ReactElement<any> | {
5
+ heading?: ReactElement<any> | {
6
6
  id?: string;
7
7
  text: ReactElement<any>;
8
8
  level: number | undefined;
@@ -15,7 +15,7 @@ declare const Panel: {
15
15
  displayName: string;
16
16
  propTypes: {
17
17
  children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
18
- heading: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
18
+ heading: PropTypes.Requireable<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
19
19
  className: PropTypes.Requireable<string>;
20
20
  };
21
21
  };
package/lib/index.js CHANGED
@@ -8313,22 +8313,32 @@ Stepper.propTypes = {
8313
8313
  var Panel = function (_a) {
8314
8314
  var _b;
8315
8315
  var children = _a.children, collapsed = _a.collapsed, className = _a.className, heading = _a.heading, other = tslib.__rest(_a, ["children", "collapsed", "className", "heading"]);
8316
- var Heading = "h" + (typeof heading === 'object' && 'level' in heading && !!heading.level
8317
- ? heading.level
8318
- : 2);
8319
- var headingId = typeof heading === 'object' && 'id' in heading ? heading.id : randomId();
8316
+ var headingId = !heading
8317
+ ? undefined
8318
+ : typeof heading === 'object' && 'id' in heading
8319
+ ? heading.id
8320
+ : randomId();
8321
+ var Heading = function () {
8322
+ if (!headingId) {
8323
+ return null;
8324
+ }
8325
+ var HeadingComponent = "h" + (typeof heading === 'object' && 'level' in heading && !!heading.level
8326
+ ? heading.level
8327
+ : 2);
8328
+ return (React__default.createElement(HeadingComponent, { id: headingId, className: "Panel__Heading" }, typeof heading === 'object' && 'text' in heading
8329
+ ? heading.text
8330
+ : heading));
8331
+ };
8320
8332
  return (React__default.createElement("section", tslib.__assign({ "aria-labelledby": headingId, className: classNames('Panel', className, (_b = {},
8321
8333
  _b['Panel--collapsed'] = collapsed,
8322
8334
  _b)) }, other),
8323
- React__default.createElement(Heading, { id: headingId, className: "Panel__Heading" }, typeof heading === 'object' && 'text' in heading
8324
- ? heading.text
8325
- : heading),
8335
+ React__default.createElement(Heading, null),
8326
8336
  children));
8327
8337
  };
8328
8338
  Panel.displayName = 'Panel';
8329
8339
  Panel.propTypes = {
8330
8340
  children: PropTypes.node.isRequired,
8331
- heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node]).isRequired,
8341
+ heading: PropTypes.oneOfType([PropTypes.object, PropTypes.node]),
8332
8342
  className: PropTypes.string
8333
8343
  };
8334
8344
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "4.1.0-canary.2e36990f",
3
+ "version": "4.1.0-canary.49b3b909",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "publishConfig": {
6
6
  "access": "public"