@deque/cauldron-react 6.2.1-canary.0eecc62d → 6.2.1-canary.0efb2078

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.
@@ -7,6 +7,7 @@ interface SearchFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, '
7
7
  onChange?: (value: string, e: ChangeEvent<HTMLInputElement>) => void;
8
8
  hideLabel?: boolean;
9
9
  isForm?: boolean;
10
+ trailingChildren?: React.ReactNode;
10
11
  }
11
12
  declare const SearchField: React.ForwardRefExoticComponent<SearchFieldProps & React.RefAttributes<HTMLInputElement>>;
12
13
  export default SearchField;
package/lib/index.js CHANGED
@@ -2433,7 +2433,7 @@ var TextFieldWrapper = React.forwardRef(function (_a, ref) {
2433
2433
  TextFieldWrapper.displayName = 'TextFieldWrapper';
2434
2434
 
2435
2435
  var SearchField = React.forwardRef(function (_a, ref) {
2436
- var label = _a.label, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, onChange = _a.onChange, _c = _a.hideLabel, hideLabel = _c === void 0 ? false : _c, _d = _a.placeholder, placeholder = _d === void 0 ? 'Search...' : _d, _e = _a.isForm, isForm = _e === void 0 ? true : _e, propId = _a.id, propValue = _a.value, otherProps = tslib.__rest(_a, ["label", "defaultValue", "onChange", "hideLabel", "placeholder", "isForm", "id", "value"]);
2436
+ var label = _a.label, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, onChange = _a.onChange, _c = _a.hideLabel, hideLabel = _c === void 0 ? false : _c, _d = _a.placeholder, placeholder = _d === void 0 ? 'Search...' : _d, _e = _a.isForm, isForm = _e === void 0 ? true : _e, propId = _a.id, propValue = _a.value, trailingChildren = _a.trailingChildren, otherProps = tslib.__rest(_a, ["label", "defaultValue", "onChange", "hideLabel", "placeholder", "isForm", "id", "value", "trailingChildren"]);
2437
2437
  var isControlled = typeof propValue !== 'undefined';
2438
2438
  var _f = tslib.__read(React.useState(isControlled ? propValue : defaultValue), 2), value = _f[0], setValue = _f[1];
2439
2439
  var _g = tslib.__read(propId ? [propId] : nextId.useId(1, 'search-field'), 1), id = _g[0];
@@ -2449,6 +2449,9 @@ var SearchField = React.forwardRef(function (_a, ref) {
2449
2449
  setValue(newValue);
2450
2450
  };
2451
2451
  var Field = isForm ? 'form' : 'div';
2452
+ if (typeof trailingChildren === 'string') {
2453
+ trailingChildren = React__default["default"].createElement("span", null, trailingChildren);
2454
+ }
2452
2455
  return (React__default["default"].createElement(Field, { role: isForm ? 'search' : undefined, className: "SearchField", "aria-labelledby": isForm ? "".concat(inputId, "-label") : undefined },
2453
2456
  hideLabel ? (React__default["default"].createElement(Offscreen, null,
2454
2457
  React__default["default"].createElement("label", { htmlFor: inputId, id: "".concat(inputId, "-label") }, label))) : (React__default["default"].createElement("label", { className: "Field__label", htmlFor: inputId, id: "".concat(inputId, "-label") }, label)),
@@ -2456,7 +2459,8 @@ var SearchField = React.forwardRef(function (_a, ref) {
2456
2459
  'TextFieldWrapper--disabled': otherProps.disabled
2457
2460
  }) },
2458
2461
  React__default["default"].createElement(Icon, { type: "magnifying-glass", className: "SearchField__search-icon" }),
2459
- React__default["default"].createElement("input", tslib.__assign({ id: inputId, value: value, onChange: handleChange, placeholder: placeholder, ref: ref }, otherProps, { className: classNames__default["default"](otherProps.className, 'Field__text-input'), type: "search" })))));
2462
+ React__default["default"].createElement("input", tslib.__assign({ id: inputId, value: value, onChange: handleChange, placeholder: placeholder, ref: ref }, otherProps, { className: classNames__default["default"](otherProps.className, 'Field__text-input'), type: "search" })),
2463
+ trailingChildren)));
2460
2464
  });
2461
2465
  SearchField.displayName = 'SearchField';
2462
2466
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "6.2.1-canary.0eecc62d",
3
+ "version": "6.2.1-canary.0efb2078",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Fully accessible react components library for Deque Cauldron",
6
6
  "homepage": "https://cauldron.dequelabs.com/",