@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.esm.js CHANGED
@@ -9876,6 +9876,7 @@ var TextInput = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
9876
9876
  disabled: disabled,
9877
9877
  placeholder: placeholder,
9878
9878
  "aria-label": label || placeholder,
9879
+ "aria-invalid": error ? true : undefined,
9879
9880
  ref: ref,
9880
9881
  onChange: function onChange(event) {
9881
9882
  _onChange === null || _onChange === void 0 || _onChange(event.target.value);
@@ -11159,11 +11160,16 @@ var Field = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
11159
11160
  label = _ref.label,
11160
11161
  placeholder = _ref.placeholder,
11161
11162
  rest = _objectWithoutProperties(_ref, _excluded$h);
11163
+ var id = useId();
11164
+ var errorId = "".concat(id, "-error");
11162
11165
  var fieldContextValue = useMemo(function () {
11163
11166
  return {
11164
11167
  displaysError: Boolean(error)
11165
11168
  };
11166
11169
  }, [error]);
11170
+
11171
+ // Combine any existing aria-describedby with our error ID
11172
+ var ariaDescribedBy = [rest['aria-describedby'], error ? errorId : null].filter(Boolean).join(' ') || undefined;
11167
11173
  return /*#__PURE__*/React__default.createElement(FormControlContext.Provider, {
11168
11174
  value: fieldContextValue
11169
11175
  }, /*#__PURE__*/React__default.createElement("label", {
@@ -11177,18 +11183,22 @@ var Field = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
11177
11183
  error: error,
11178
11184
  placeholder: placeholder,
11179
11185
  label: label,
11180
- shiftIconLeftwards: error && children.type === Select
11186
+ shiftIconLeftwards: error && children.type === Select,
11187
+ 'aria-describedby': ariaDescribedBy
11181
11188
  }, rest), children.props)), error && /*#__PURE__*/React__default.createElement("span", {
11182
11189
  className: "Field__icon"
11183
11190
  }, /*#__PURE__*/React__default.createElement(Warning16, null))) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TextInput, _extends$1({
11184
11191
  ref: ref,
11185
11192
  placeholder: placeholder,
11186
11193
  label: label,
11187
- error: error
11194
+ error: error,
11195
+ "aria-describedby": ariaDescribedBy
11188
11196
  }, rest)), error && /*#__PURE__*/React__default.createElement("span", {
11189
11197
  className: "Field__icon"
11190
11198
  }, /*#__PURE__*/React__default.createElement(Warning16, null)))), error && /*#__PURE__*/React__default.createElement("span", {
11191
- className: "Field__error"
11199
+ id: errorId,
11200
+ className: "Field__error",
11201
+ role: "alert"
11192
11202
  }, error)));
11193
11203
  });
11194
11204
  Field.displayName = 'Field';
@@ -12587,6 +12597,7 @@ var SlidingPane = function SlidingPane(_ref) {
12587
12597
  _ref$autoFocus = _ref.autoFocus,
12588
12598
  autoFocus = _ref$autoFocus === void 0 ? true : _ref$autoFocus,
12589
12599
  rest = _objectWithoutProperties(_ref, _excluded$5);
12600
+ var titleId = useId();
12590
12601
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
12591
12602
  className: classNames('SlidingPane__overlay', {
12592
12603
  'SlidingPane__overlay--active': visible
@@ -12598,6 +12609,9 @@ var SlidingPane = function SlidingPane(_ref) {
12598
12609
  onClickOutside: onClose,
12599
12610
  onEscapeKey: onClose
12600
12611
  }, /*#__PURE__*/React__default.createElement("div", _extends$1({
12612
+ role: "dialog",
12613
+ "aria-modal": "true",
12614
+ "aria-labelledby": titleId,
12601
12615
  className: classNames('SlidingPane', className, {
12602
12616
  'SlidingPane--active': visible
12603
12617
  })
@@ -12607,6 +12621,7 @@ var SlidingPane = function SlidingPane(_ref) {
12607
12621
  direction: "horizontal",
12608
12622
  className: "SlidingPane__top"
12609
12623
  }, /*#__PURE__*/React__default.createElement(Text, {
12624
+ id: titleId,
12610
12625
  treatment: "h5",
12611
12626
  family: "serif"
12612
12627
  }, title), /*#__PURE__*/React__default.createElement(Clickable, {