@sebgroup/green-react 3.5.2 → 3.5.3

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.
Files changed (2) hide show
  1. package/index.esm.js +14 -5
  2. package/package.json +2 -2
package/index.esm.js CHANGED
@@ -4027,8 +4027,8 @@ const Input = _a => {
4027
4027
  const showSimpleInput = !label && !info && !expandableInfo;
4028
4028
  const describedBy = classNames(ariaDescribedBy, {
4029
4029
  [`${uuid}_group-message`]: !showSimpleInput && (validator === null || validator === void 0 ? void 0 : validator.message) !== undefined && validator.message.length > 0,
4030
- [`gds-expandable-info-${uuid}`]: !showSimpleInput && expandableInfo,
4031
- [`${uuid}_info`]: !showSimpleInput && info
4030
+ [`${uuid}_info`]: !showSimpleInput && info,
4031
+ [`gds-expandable-info-${uuid}`]: !showSimpleInput && expandableInfo
4032
4032
  });
4033
4033
  const inputClassName = classNames(className, {
4034
4034
  [validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator)]: validator
@@ -4178,6 +4178,7 @@ const RadioGroup = ({
4178
4178
  const [selected, setSelected] = useState(valueSelected !== null && valueSelected !== void 0 ? valueSelected : defaultSelected);
4179
4179
  const [prevValueSelected, setPrevValueSelected] = useState(valueSelected);
4180
4180
  const [name] = useState(propName);
4181
+ const [uniqueId] = useState(randomId());
4181
4182
  if (valueSelected !== prevValueSelected) {
4182
4183
  setSelected(valueSelected);
4183
4184
  setPrevValueSelected(valueSelected);
@@ -4218,12 +4219,20 @@ const RadioGroup = ({
4218
4219
  const radioGroupWrapperClassNames = classNames('gds-radio-group-wrapper', {
4219
4220
  'gds-radio-group-wrapper--horizontal': horizontal
4220
4221
  });
4222
+ const describedBy = classNames({
4223
+ [`${uniqueId}_message`]: (validator === null || validator === void 0 ? void 0 : validator.message) !== undefined && validator.message.length > 0,
4224
+ [`${uniqueId}_info`]: labelInformation,
4225
+ [`gds-expandable-info-${uniqueId}`]: expandableInfo
4226
+ });
4221
4227
  return jsx(FormItem, Object.assign({}, formItemProps, {
4228
+ inputId: uniqueId
4229
+ }, {
4222
4230
  children: jsx("div", Object.assign({
4223
4231
  className: radioGroupWrapperClassNames
4224
4232
  }, {
4225
4233
  children: React.Children.map(children, radioButton => {
4226
4234
  return /*#__PURE__*/React.isValidElement(radioButton) ? /*#__PURE__*/React.cloneElement(radioButton, {
4235
+ "aria-describedby": describedBy,
4227
4236
  validator: validator,
4228
4237
  onChange: handleOnChange,
4229
4238
  checked: selected === radioButton.props.value,
@@ -4653,9 +4662,9 @@ const Select = /*#__PURE__*/React.forwardRef((_a, ref) => {
4653
4662
  [`${validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator)}`]: validator
4654
4663
  });
4655
4664
  const describedBy = classNames(ariaDescribedBy, {
4656
- [`${uuid}_info`]: info,
4657
- [`gds-expandable-info-${uuid}`]: expandableInfo,
4658
- [`${uuid}_message`]: (validator === null || validator === void 0 ? void 0 : validator.message) !== undefined && validator.message.length > 0
4665
+ [`${uuid}_message`]: (validator === null || validator === void 0 ? void 0 : validator.message) !== undefined && validator.message.length > 0,
4666
+ [`${uuid}_info`]: info || props.labelInformation,
4667
+ [`gds-expandable-info-${uuid}`]: expandableInfo
4659
4668
  });
4660
4669
  return jsx(FormItem, Object.assign({
4661
4670
  label: label,
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@sebgroup/green-react",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "peerDependencies": {
5
5
  "react": "^17 || ^18",
6
6
  "react-dom": "^17 || ^18"
7
7
  },
8
8
  "dependencies": {
9
9
  "@sebgroup/green-core": "^1.11.0",
10
- "@sebgroup/chlorophyll": "^3.1.1",
10
+ "@sebgroup/chlorophyll": "^3.3.1",
11
11
  "@sebgroup/extract": "^3.0.1",
12
12
  "@lit/react": "^1.0.2",
13
13
  "classnames": "^2.3.2"