@algolia/satellite 1.4.1 → 1.5.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.
@@ -280,11 +280,9 @@ var AutoComplete = exports.AutoComplete = /*#__PURE__*/(0, _react.forwardRef)(fu
280
280
  },
281
281
  // We need to make sure to define event handlers here so that they can be composed properly
282
282
  onFocus: function onFocus(evt) {
283
- var _menuPopper$update2;
284
283
  _onFocus === null || _onFocus === void 0 || _onFocus(evt);
285
284
  if (evt.defaultPrevented) return;
286
285
  setInputFocused(true);
287
- (_menuPopper$update2 = menuPopper.update) === null || _menuPopper$update2 === void 0 || _menuPopper$update2.call(menuPopper);
288
286
  },
289
287
  onBlur: function onBlur(evt) {
290
288
  _onBlur === null || _onBlur === void 0 || _onBlur(evt);
@@ -326,6 +324,12 @@ var AutoComplete = exports.AutoComplete = /*#__PURE__*/(0, _react.forwardRef)(fu
326
324
  inputValue: inputValue
327
325
  });
328
326
  }, [inputRef, internalsRef, inputValue]);
327
+ var oldHideMenu = (0, _react.useRef)(hideMenu);
328
+ if (oldHideMenu.current !== hideMenu) {
329
+ var _menuPopper$update2;
330
+ oldHideMenu.current = hideMenu;
331
+ (_menuPopper$update2 = menuPopper.update) === null || _menuPopper$update2 === void 0 || _menuPopper$update2.call(menuPopper);
332
+ }
329
333
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AutoCompleteContext.AutoCompleteProvider, {
330
334
  locale: locale,
331
335
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
@@ -3,18 +3,22 @@ import type { FieldState } from "./FieldContext";
3
3
  export interface FieldProps {
4
4
  /** @ignore */
5
5
  className?: string;
6
- /** Label to display above the nested input */
6
+ /** Define a label to display above the nested input. */
7
7
  label?: ReactChild;
8
+ /** Define the `id` of the label. */
8
9
  labelId?: string;
10
+ /** Define the `id` of the input used by the label. */
9
11
  labelFor?: string;
10
- /** Helpful description to show below the `Field` */
12
+ /** Define an helpful description to show below the `Field`. */
11
13
  description?: ReactNode;
12
- /**
13
- * An object to handle state
14
- */
14
+ /** Define the state of the `Field`. */
15
15
  state?: FieldState;
16
+ /** Define if the `Field` should be displayed inline. */
16
17
  inline?: boolean;
18
+ /** Define if the `Field` is required. */
17
19
  required?: boolean;
20
+ /** Define the visibility of the required indicator. */
21
+ hideRequiredIndicator?: boolean;
18
22
  children: ReactNode;
19
23
  }
20
24
  /**
@@ -33,6 +33,8 @@ var Field = exports.Field = function Field(_ref) {
33
33
  _ref$inline = _ref.inline,
34
34
  inline = _ref$inline === void 0 ? false : _ref$inline,
35
35
  requiredProp = _ref.required,
36
+ _ref$hideRequiredIndi = _ref.hideRequiredIndicator,
37
+ hideRequiredIndicator = _ref$hideRequiredIndi === void 0 ? false : _ref$hideRequiredIndi,
36
38
  children = _ref.children;
37
39
  var hasLabel = !!label;
38
40
  var labelId = (0, _react.useMemo)(
@@ -93,7 +95,7 @@ var Field = exports.Field = function Field(_ref) {
93
95
  children: [hasLabel && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
94
96
  id: labelId,
95
97
  className: (0, _satellitePrefixer["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["truncate ", ""])), inline ? "mr-2" : "mb-1"),
96
- children: [label, (requiredProp || requiredContext) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
98
+ children: [label, !hideRequiredIndicator && (requiredProp || requiredContext) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
97
99
  className: (0, _satellitePrefixer["default"])(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["text-red-700 ml-0.5"]))),
98
100
  "aria-hidden": true,
99
101
  children: "*"