@povio/ui 2.2.9-rc.35 → 2.2.9-rc.37

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.
@@ -166,7 +166,7 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
166
166
  onStaticInteract: renderRealInput,
167
167
  inputClassName: props.inputClassName,
168
168
  children: (dataAttributeProps) => /* @__PURE__ */ jsx("input", {
169
- type: "number",
169
+ type: "text",
170
170
  ref: inputRef,
171
171
  disabled: isDisabled,
172
172
  tabIndex: -1,
@@ -21,16 +21,12 @@ var QueryAutocomplete = ({ query, queryParams, queryOptions, queryMap, leadingCo
21
21
  onChange?.(value);
22
22
  props.onBlur?.({ target: { value: null } });
23
23
  };
24
- const handleSearchChange = (value) => {
25
- setSearch(value);
26
- handleEnableQuery();
27
- };
28
24
  const { isInitialQueryDisabled: _, ...autocompleteProps } = restProps;
29
25
  return /* @__PURE__ */ jsx(Autocomplete, {
30
26
  ...autocompleteProps,
31
27
  items,
32
28
  totalItems,
33
- onSearchChange: handleSearchChange,
29
+ onSearchChange: setSearch,
34
30
  isClientSearchDisabled: true,
35
31
  isLoading,
36
32
  onChange: handleChange,
@@ -1,4 +1,4 @@
1
- import { FC, ReactElement, ReactNode, Ref, SVGProps } from 'react';
1
+ import { FC, FocusEventHandler, MouseEventHandler, ReactElement, ReactNode, Ref, SVGProps } from 'react';
2
2
  import { InlineIconButtonProps } from '../../buttons/InlineIconButton/InlineIconButton';
3
3
  import { FormFieldProps } from '../FormField/FormField';
4
4
  import { FormFieldHeaderProps } from '../FormField/FormFieldHeader';
@@ -43,6 +43,8 @@ export interface InputFrameProps extends InputVariantProps, Partial<FormFieldPro
43
43
  ref?: Ref<HTMLDivElement>;
44
44
  children: InputFrameChildren;
45
45
  formFieldRef?: Ref<HTMLDivElement>;
46
+ onMouseEnter?: MouseEventHandler<HTMLDivElement>;
47
+ onFocusCapture?: FocusEventHandler<HTMLDivElement>;
46
48
  labelProps?: FormFieldHeaderProps["labelProps"];
47
49
  headerProps?: FormFieldHeaderProps;
48
50
  leadingContent?: ReactNode;
@@ -19,7 +19,7 @@ var InputFrame = (props) => {
19
19
  const inputContentWrapperCva = UIStyle.useCva("input.contentWrapperCva", inputContentWrapper);
20
20
  const typographyCva = UIStyle.useCva("typography.cva", typography);
21
21
  const generatedInputId = useId();
22
- const { ref, children, formFieldRef, labelProps: labelPropsProp, headerProps, error, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isHeaderHidden, hideLabel: hideLabelProp, headerClassName, errorClassName, className, leadingContent, leadingIcon, actionContent, actionContentPlacement = "content-wrapper", trailingContent, trailingIcon, trailingAction, unit, isLoading, action, isClearable: isClearableProp, showClear, renderStatic, onStaticInteract, clearClassName, onClear, dataAttributes, typographySize, id: idProp, inputClassName, contentClassName, contentWrapperClassName, labelPlacement = "content-wrapper", trailingClassName, variant: variantProp, as: asProp, size: sizeProp } = props;
22
+ const { ref, children, formFieldRef, labelProps: labelPropsProp, headerProps, error, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isHeaderHidden, hideLabel: hideLabelProp, headerClassName, errorClassName, className, leadingContent, leadingIcon, actionContent, actionContentPlacement = "content-wrapper", trailingContent, trailingIcon, trailingAction, unit, isLoading, action, isClearable: isClearableProp, showClear, renderStatic, onStaticInteract, clearClassName, onClear, dataAttributes, typographySize, id: idProp, inputClassName, contentClassName, contentWrapperClassName, labelPlacement = "content-wrapper", trailingClassName, onMouseEnter, onFocusCapture, variant: variantProp, as: asProp, size: sizeProp } = props;
23
23
  const as = asProp ?? ui.input.as;
24
24
  const size = sizeProp ?? ui.input.size;
25
25
  const variant = variantProp ?? ui.input.variant;
@@ -81,10 +81,12 @@ var InputFrame = (props) => {
81
81
  as,
82
82
  labelProps,
83
83
  tabIndex: as === "inline" ? -1 : void 0,
84
- onMouseEnter: () => {
84
+ onMouseEnter: (event) => {
85
+ onMouseEnter?.(event);
85
86
  if (renderStatic) onStaticInteract?.(false);
86
87
  },
87
- onFocusCapture: () => {
88
+ onFocusCapture: (event) => {
89
+ onFocusCapture?.(event);
88
90
  if (renderStatic) onStaticInteract?.(true);
89
91
  },
90
92
  children: /* @__PURE__ */ jsxs("div", {
@@ -10,10 +10,10 @@ var useQueryAutocomplete = ({ query, queryParams, queryOptions, mapItems, initia
10
10
  ...queryParams,
11
11
  limit: queryParams?.limit ?? ApiQueryUtils.DEFAULT_LIMIT,
12
12
  search,
13
- ...isFilterSearchParams(queryParams) ? { filter: {
14
- ...queryParams.filter,
13
+ filter: {
14
+ ...isFilterSearchParams(queryParams) ? queryParams.filter : {},
15
15
  search
16
- } } : {}
16
+ }
17
17
  }, {
18
18
  ...queryOptions,
19
19
  enabled: isQueryEnabled && (queryOptions?.enabled ?? true)
@@ -27,14 +27,19 @@ var useQueryAutocomplete = ({ query, queryParams, queryOptions, mapItems, initia
27
27
  setIsQueryEnabled(true);
28
28
  };
29
29
  const infiniteQueryResult = isInfiniteQueryResult(queryResult) ? queryResult : void 0;
30
+ const isInfiniteQuery = infiniteQueryResult !== void 0;
30
31
  const hasNextPage = infiniteQueryResult?.hasNextPage ?? false;
31
32
  const fetchNextPage = infiniteQueryResult?.fetchNextPage;
32
33
  const isFetchingNextPage = infiniteQueryResult?.isFetchingNextPage ?? false;
33
34
  const totalItems = infiniteQueryResult?.data?.pages?.[0]?.totalItems;
34
35
  const items = useMemo(() => {
35
36
  if (!data) return [];
36
- return mapItems(data);
37
- }, [data, mapItems]);
37
+ return mapItems(isInfiniteQuery ? data.pages?.flatMap((page) => page?.items ?? []) : data);
38
+ }, [
39
+ data,
40
+ isInfiniteQuery,
41
+ mapItems
42
+ ]);
38
43
  return {
39
44
  data,
40
45
  isLoading: isLoading || isFetchingNextPage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/ui",
3
- "version": "2.2.9-rc.35",
3
+ "version": "2.2.9-rc.37",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",