@deque/cauldron-react 5.5.1 → 5.6.0

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,5 +1,4 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  export interface RadioItem extends React.InputHTMLAttributes<HTMLInputElement> {
4
3
  label: React.ReactNode;
5
4
  value?: string;
@@ -12,25 +11,8 @@ export interface RadioGroupProps {
12
11
  defaultValue?: string;
13
12
  value?: any;
14
13
  inline?: boolean;
15
- onChange: (radio: RadioItem, input: HTMLElement) => void;
14
+ onChange?: (radio: RadioItem, input: HTMLElement) => void;
15
+ hasLabel?: never;
16
16
  }
17
- declare const RadioGroup: {
18
- ({ name, radios, defaultValue, value, onChange, className, inline, ...other }: RadioGroupProps): JSX.Element;
19
- propTypes: {
20
- name: PropTypes.Requireable<string>;
21
- radios: PropTypes.Validator<(PropTypes.InferProps<{
22
- value: PropTypes.Validator<string>;
23
- id: PropTypes.Validator<string>;
24
- label: PropTypes.Validator<string>;
25
- labelDescription: PropTypes.Requireable<string>;
26
- }> | null | undefined)[]>;
27
- hasLabel: (props: {
28
- [key: string]: string;
29
- }, propName: string, componentName: string) => Error | undefined;
30
- className: PropTypes.Requireable<string>;
31
- defaultValue: PropTypes.Requireable<string>;
32
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
33
- };
34
- displayName: string;
35
- };
17
+ declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
36
18
  export default RadioGroup;
package/lib/index.js CHANGED
@@ -2617,7 +2617,7 @@ var Select = React__default.forwardRef(function (_a, ref) {
2617
2617
  });
2618
2618
  Select.displayName = 'Select';
2619
2619
 
2620
- var RadioGroup = function (_a) {
2620
+ var RadioGroup = React.forwardRef(function (_a, ref) {
2621
2621
  var name = _a.name, radios = _a.radios, defaultValue = _a.defaultValue, value = _a.value,
2622
2622
  // eslint-disable-next-line @typescript-eslint/no-empty-function
2623
2623
  _b = _a.onChange,
@@ -2675,8 +2675,8 @@ var RadioGroup = function (_a) {
2675
2675
  // refs get clobbered every re-render anyway and this supports "dynamic" radios
2676
2676
  // (changing the number of radio buttons for example)
2677
2677
  inputs.current = [];
2678
- return (React__default.createElement("div", tslib.__assign({ className: classNames(className, { 'Radio--inline': inline }), role: "radiogroup" }, other), radioButtons));
2679
- };
2678
+ return (React__default.createElement("div", tslib.__assign({ className: classNames(className, { 'Radio--inline': inline }), role: "radiogroup", ref: ref }, other), radioButtons));
2679
+ });
2680
2680
  RadioGroup.propTypes = {
2681
2681
  name: PropTypes.string,
2682
2682
  radios: PropTypes.arrayOf(PropTypes.shape({
@@ -2684,11 +2684,12 @@ RadioGroup.propTypes = {
2684
2684
  id: PropTypes.string.isRequired,
2685
2685
  label: PropTypes.string.isRequired,
2686
2686
  labelDescription: PropTypes.string
2687
- })).isRequired,
2688
- hasLabel: function (props, propName, componentName) {
2687
+ }).isRequired).isRequired,
2688
+ hasLabel: function (props, _propName, componentName) {
2689
2689
  if (!props['aria-label'] && !props['aria-labelledby']) {
2690
2690
  return new Error("".concat(componentName, " must have an \"aria-label\" or \"aria-labelledby\" prop"));
2691
2691
  }
2692
+ return null;
2692
2693
  },
2693
2694
  className: PropTypes.string,
2694
2695
  defaultValue: PropTypes.string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "5.5.1",
3
+ "version": "5.6.0",
4
4
  "description": "Fully accessible react components library for Deque Cauldron",
5
5
  "homepage": "https://cauldron.dequelabs.com/",
6
6
  "publishConfig": {