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

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.
@@ -102,13 +102,14 @@ function Autocomplete({ renderStaticInput, ...props }) {
102
102
  children: (dataAttributeProps) => /* @__PURE__ */ jsxs(Fragment, { children: [isMultiple && !isEmpty && displayValue, /* @__PURE__ */ jsx("input", {
103
103
  disabled: isDisabled,
104
104
  tabIndex: -1,
105
+ role: "combobox",
106
+ "aria-autocomplete": "list",
107
+ "aria-controls": `${dataAttributeProps.id}-listbox`,
108
+ "aria-expanded": false,
105
109
  value: inputValue,
106
110
  placeholder: isMultiple && shouldRenderPlaceholderAfterValue ? props.placeholder : placeholder ?? void 0,
107
111
  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
- },
112
+ onChange: (event) => replayStaticInputChange(event.target.value),
112
113
  ...dataAttributeProps,
113
114
  "data-rac": true
114
115
  })] })
@@ -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
@@ -104,13 +104,14 @@ function Select({ renderStaticInput, ...props }) {
104
104
  children: (dataAttributeProps) => /* @__PURE__ */ jsxs(Fragment, { children: [isMultiple && !isEmpty && displayValue, isSearchable ? /* @__PURE__ */ jsx("input", {
105
105
  disabled: isDisabled,
106
106
  tabIndex: -1,
107
+ role: "combobox",
108
+ "aria-autocomplete": "list",
109
+ "aria-controls": `${dataAttributeProps.id}-listbox`,
110
+ "aria-expanded": false,
107
111
  value: inputValue,
108
112
  placeholder: shouldRenderPlaceholderAfterValue ? props.placeholder : placeholder ?? void 0,
109
113
  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
- },
114
+ onChange: (event) => replayStaticInputChange(event.target.value),
114
115
  ...dataAttributeProps,
115
116
  "data-rac": true
116
117
  }) : /* @__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.42",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",