@povio/ui 2.2.9-rc.40 → 2.2.9-rc.41

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.
@@ -105,10 +105,7 @@ function Autocomplete({ renderStaticInput, ...props }) {
105
105
  value: inputValue,
106
106
  placeholder: isMultiple && shouldRenderPlaceholderAfterValue ? props.placeholder : placeholder ?? void 0,
107
107
  className: clsx("w-full flex-1 bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled", props.inputClassName),
108
- onChange: (event) => {
109
- props?.onMouseEnter?.({});
110
- replayStaticInputChange(event.target.value);
111
- },
108
+ onChange: (event) => replayStaticInputChange(event.target.value),
112
109
  ...dataAttributeProps,
113
110
  "data-rac": true
114
111
  })] })
@@ -22,11 +22,15 @@ var QueryAutocomplete = ({ query, queryParams, queryOptions, queryMap, leadingCo
22
22
  props.onBlur?.({ target: { value: null } });
23
23
  };
24
24
  const { isInitialQueryDisabled: _, ...autocompleteProps } = restProps;
25
+ const onSearchChange = (value) => {
26
+ setSearch(value);
27
+ handleEnableQuery();
28
+ };
25
29
  return /* @__PURE__ */ jsx(Autocomplete, {
26
30
  ...autocompleteProps,
27
31
  items,
28
32
  totalItems,
29
- onSearchChange: setSearch,
33
+ onSearchChange,
30
34
  isClientSearchDisabled: true,
31
35
  isLoading,
32
36
  onChange: handleChange,
@@ -3,17 +3,26 @@ import { Select } from "./Select.js";
3
3
  import { getQueryItems } from "../shared/querySelect.utils.js";
4
4
  import { useQueryAutocomplete } from "../../../../hooks/useQueryAutocomplete.js";
5
5
  import { jsx } from "react/jsx-runtime";
6
+ import { useState } from "react";
6
7
  //#region src/components/inputs/Selection/Select/QuerySelect.tsx
7
8
  var QuerySelect = ({ query, queryParams, queryOptions, queryMap, ...props }) => {
8
9
  const ui = UIConfig.useConfig();
10
+ const [search, setSearch] = useState("");
11
+ const isSearchable = props.isSearchable ?? ui.select.isSearchable;
9
12
  const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete({
10
13
  query,
11
14
  queryParams,
12
15
  queryOptions,
13
16
  mapItems: (data) => getQueryItems(data, queryMap),
17
+ search: isSearchable ? search : void 0,
14
18
  initialQueryState: props.isInitialQueryDisabled ?? ui.querySelect?.isInitialQueryDisabled
15
19
  });
16
- const { isInitialQueryDisabled: _, ...selectProps } = props;
20
+ const { isInitialQueryDisabled: _, onSearchChange, ...selectProps } = props;
21
+ const handleSearchChange = (value) => {
22
+ setSearch(value);
23
+ handleEnableQuery();
24
+ onSearchChange?.(value);
25
+ };
17
26
  return /* @__PURE__ */ jsx(Select, {
18
27
  ...selectProps,
19
28
  items,
@@ -22,7 +31,11 @@ var QuerySelect = ({ query, queryParams, queryOptions, queryMap, ...props }) =>
22
31
  hasLoadMore: hasNextPage,
23
32
  onLoadMore: fetchNextPage,
24
33
  onMouseEnter: handleEnableQuery,
25
- onFocusCapture: handleEnableQuery
34
+ onFocusCapture: handleEnableQuery,
35
+ ...isSearchable && {
36
+ isClientSearchDisabled: true,
37
+ onSearchChange: handleSearchChange
38
+ }
26
39
  });
27
40
  };
28
41
  //#endregion
@@ -107,10 +107,7 @@ function Select({ renderStaticInput, ...props }) {
107
107
  value: inputValue,
108
108
  placeholder: shouldRenderPlaceholderAfterValue ? props.placeholder : placeholder ?? void 0,
109
109
  className: clsx("w-full flex-1 bg-transparent outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled", props.inputClassName),
110
- onChange: (event) => {
111
- props?.onMouseEnter?.({});
112
- replayStaticInputChange(event.target.value);
113
- },
110
+ onChange: (event) => replayStaticInputChange(event.target.value),
114
111
  ...dataAttributeProps,
115
112
  "data-rac": true
116
113
  }) : /* @__PURE__ */ jsx("button", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.2.9-rc.40",
3
+ "version": "2.2.9-rc.41",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",