@moda/om 21.7.0 → 21.7.2

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/dist/index.cjs.js CHANGED
@@ -9896,6 +9896,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
9896
9896
  disabled: disabled,
9897
9897
  placeholder: placeholder,
9898
9898
  "aria-label": label || placeholder,
9899
+ "aria-invalid": error ? true : undefined,
9899
9900
  ref: ref,
9900
9901
  onChange: function onChange(event) {
9901
9902
  _onChange === null || _onChange === void 0 || _onChange(event.target.value);
@@ -11179,11 +11180,16 @@ var Field = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
11179
11180
  label = _ref.label,
11180
11181
  placeholder = _ref.placeholder,
11181
11182
  rest = _objectWithoutProperties(_ref, _excluded$h);
11183
+ var id = React.useId();
11184
+ var errorId = "".concat(id, "-error");
11182
11185
  var fieldContextValue = React.useMemo(function () {
11183
11186
  return {
11184
11187
  displaysError: Boolean(error)
11185
11188
  };
11186
11189
  }, [error]);
11190
+
11191
+ // Combine any existing aria-describedby with our error ID
11192
+ var ariaDescribedBy = [rest['aria-describedby'], error ? errorId : null].filter(Boolean).join(' ') || undefined;
11187
11193
  return /*#__PURE__*/React.createElement(FormControlContext.Provider, {
11188
11194
  value: fieldContextValue
11189
11195
  }, /*#__PURE__*/React.createElement("label", {
@@ -11197,18 +11203,22 @@ var Field = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
11197
11203
  error: error,
11198
11204
  placeholder: placeholder,
11199
11205
  label: label,
11200
- shiftIconLeftwards: error && children.type === Select
11206
+ shiftIconLeftwards: error && children.type === Select,
11207
+ 'aria-describedby': ariaDescribedBy
11201
11208
  }, rest), children.props)), error && /*#__PURE__*/React.createElement("span", {
11202
11209
  className: "Field__icon"
11203
11210
  }, /*#__PURE__*/React.createElement(Warning16, null))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextInput, _extends$1({
11204
11211
  ref: ref,
11205
11212
  placeholder: placeholder,
11206
11213
  label: label,
11207
- error: error
11214
+ error: error,
11215
+ "aria-describedby": ariaDescribedBy
11208
11216
  }, rest)), error && /*#__PURE__*/React.createElement("span", {
11209
11217
  className: "Field__icon"
11210
11218
  }, /*#__PURE__*/React.createElement(Warning16, null)))), error && /*#__PURE__*/React.createElement("span", {
11211
- className: "Field__error"
11219
+ id: errorId,
11220
+ className: "Field__error",
11221
+ role: "alert"
11212
11222
  }, error)));
11213
11223
  });
11214
11224
  Field.displayName = 'Field';
@@ -12607,6 +12617,7 @@ var SlidingPane = function SlidingPane(_ref) {
12607
12617
  _ref$autoFocus = _ref.autoFocus,
12608
12618
  autoFocus = _ref$autoFocus === void 0 ? true : _ref$autoFocus,
12609
12619
  rest = _objectWithoutProperties(_ref, _excluded$5);
12620
+ var titleId = React.useId();
12610
12621
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
12611
12622
  className: classNames('SlidingPane__overlay', {
12612
12623
  'SlidingPane__overlay--active': visible
@@ -12618,6 +12629,9 @@ var SlidingPane = function SlidingPane(_ref) {
12618
12629
  onClickOutside: onClose,
12619
12630
  onEscapeKey: onClose
12620
12631
  }, /*#__PURE__*/React.createElement("div", _extends$1({
12632
+ role: "dialog",
12633
+ "aria-modal": "true",
12634
+ "aria-labelledby": titleId,
12621
12635
  className: classNames('SlidingPane', className, {
12622
12636
  'SlidingPane--active': visible
12623
12637
  })
@@ -12627,6 +12641,7 @@ var SlidingPane = function SlidingPane(_ref) {
12627
12641
  direction: "horizontal",
12628
12642
  className: "SlidingPane__top"
12629
12643
  }, /*#__PURE__*/React.createElement(Text, {
12644
+ id: titleId,
12630
12645
  treatment: "h5",
12631
12646
  family: "serif"
12632
12647
  }, title), /*#__PURE__*/React.createElement(Clickable, {