@povio/ui 2.2.9-rc.2 → 2.2.9-rc.20

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.
Files changed (92) hide show
  1. package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -1
  2. package/dist/components/buttons/InlineIconButton/InlineIconButton.js +2 -2
  3. package/dist/components/inputs/Checkbox/Checkbox.js +6 -1
  4. package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
  5. package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
  6. package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +9 -4
  7. package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +96 -9
  8. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +9 -4
  9. package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +114 -7
  10. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +10 -4
  11. package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +91 -7
  12. package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +5 -3
  13. package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +80 -6
  14. package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
  15. package/dist/components/inputs/DateTime/shared/Calendar.js +23 -6
  16. package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
  17. package/dist/components/inputs/DateTime/shared/CalendarCell.js +3 -3
  18. package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
  19. package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +5 -2
  20. package/dist/components/inputs/DateTime/shared/DatePickerInput.js +21 -12
  21. package/dist/components/inputs/DateTime/shared/TimePickerInput.js +7 -3
  22. package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +3 -0
  23. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +7 -0
  24. package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +13 -0
  25. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +6 -0
  26. package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +20 -0
  27. package/dist/components/inputs/FormField/FormField.d.ts +3 -3
  28. package/dist/components/inputs/FormField/FormFieldHeader.js +3 -1
  29. package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +6 -0
  30. package/dist/components/inputs/FormField/formFieldHeader.cva.js +11 -0
  31. package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
  32. package/dist/components/inputs/Input/NumberInput/NumberInput.js +92 -8
  33. package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
  34. package/dist/components/inputs/Input/TextInput/TextInput.js +95 -8
  35. package/dist/components/inputs/Inputs/InputItem.d.ts +14 -18
  36. package/dist/components/inputs/RadioGroup/RadioGroup.js +17 -9
  37. package/dist/components/inputs/RadioGroup/radio.cva.d.ts +3 -0
  38. package/dist/components/inputs/RadioGroup/radio.cva.js +2 -1
  39. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
  40. package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +86 -6
  41. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +1 -1
  42. package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +15 -10
  43. package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +25 -19
  44. package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +1 -2
  45. package/dist/components/inputs/Selection/Select/QuerySelect.js +5 -3
  46. package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
  47. package/dist/components/inputs/Selection/Select/Select.js +84 -4
  48. package/dist/components/inputs/Selection/shared/SelectBase.d.ts +4 -1
  49. package/dist/components/inputs/Selection/shared/SelectBase.js +3 -2
  50. package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
  51. package/dist/components/inputs/Selection/shared/SelectDesktop.js +8 -4
  52. package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
  53. package/dist/components/inputs/Selection/shared/SelectInput.js +12 -2
  54. package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
  55. package/dist/components/inputs/Selection/shared/SelectListBox.js +3 -3
  56. package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
  57. package/dist/components/inputs/Selection/shared/SelectMobile.js +5 -3
  58. package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
  59. package/dist/components/inputs/Selection/shared/select.context.js +22 -4
  60. package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
  61. package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +3 -0
  62. package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
  63. package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
  64. package/dist/components/inputs/Selection/shared/staticSelect.utils.js +35 -0
  65. package/dist/components/inputs/Toggle/Toggle.js +6 -1
  66. package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
  67. package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
  68. package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
  69. package/dist/components/inputs/shared/CheckContent.js +3 -4
  70. package/dist/components/inputs/shared/StaticInput.d.ts +34 -0
  71. package/dist/components/inputs/shared/StaticInput.js +88 -0
  72. package/dist/components/inputs/shared/TooltipWrapper.js +5 -1
  73. package/dist/components/inputs/shared/input.cva.d.ts +5 -0
  74. package/dist/components/inputs/shared/input.cva.js +10 -1
  75. package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +4 -0
  76. package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
  77. package/dist/config/uiConfig.context.d.ts +8 -2
  78. package/dist/config/uiConfig.context.js +11 -1
  79. package/dist/config/uiStyle.context.d.ts +19 -3
  80. package/dist/helpers/dynamicInputs.d.ts +5 -5
  81. package/dist/helpers/dynamicInputs.js +3 -0
  82. package/dist/hooks/useIntersectionObserver.d.ts +1 -1
  83. package/dist/hooks/useIntersectionObserver.js +29 -10
  84. package/dist/hooks/useQueryAutocomplete.d.ts +5 -16
  85. package/dist/hooks/useQueryAutocomplete.js +13 -3
  86. package/dist/index.d.ts +5 -0
  87. package/dist/index.js +3 -2
  88. package/dist/utils/date-time.utils.d.ts +10 -0
  89. package/dist/utils/date-time.utils.js +87 -1
  90. package/dist/utils/query.utils.d.ts +4 -0
  91. package/dist/utils/query.utils.js +8 -0
  92. package/package.json +1 -1
@@ -1,11 +1,17 @@
1
+ import { ArrowDropDownIcon } from "../../../../assets/icons/ArrowDropDown.js";
2
+ import { UIConfig } from "../../../../config/uiConfig.context.js";
3
+ import { StaticInput } from "../../shared/StaticInput.js";
1
4
  import { SelectBase } from "../shared/SelectBase.js";
2
- import { jsx } from "react/jsx-runtime";
5
+ import { getStaticSelectValue } from "../shared/staticSelect.utils.js";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { clsx } from "clsx";
8
+ import { useEffect, useRef, useState } from "react";
3
9
  import { mergeRefs } from "@react-aria/utils";
4
- import { Controller } from "react-hook-form";
10
+ import { Controller, useWatch } from "react-hook-form";
5
11
  //#region src/components/inputs/Selection/Autocomplete/Autocomplete.tsx
6
- var Autocomplete = (props) => {
12
+ function _Autocomplete(props) {
7
13
  if ("formControl" in props && props.formControl) {
8
- const { formControl, ref, ...innerProps } = props;
14
+ const { ignoreInputValueFiltering = true, formControl, ref, ...innerProps } = props;
9
15
  return /* @__PURE__ */ jsx(Controller, {
10
16
  control: formControl.control,
11
17
  name: formControl.name,
@@ -18,7 +24,8 @@ var Autocomplete = (props) => {
18
24
  isDirty,
19
25
  isDisabled: field.disabled || props.isDisabled,
20
26
  error: props.error ?? error?.message,
21
- isSearchable: true
27
+ isSearchable: true,
28
+ ignoreInputValueFiltering
22
29
  })
23
30
  });
24
31
  }
@@ -26,6 +33,79 @@ var Autocomplete = (props) => {
26
33
  ...props,
27
34
  isSearchable: true
28
35
  });
29
- };
36
+ }
37
+ function Autocomplete({ renderStaticInput, ...props }) {
38
+ const ui = UIConfig.useConfig();
39
+ const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
40
+ const [shouldFocus, setShouldFocus] = useState(false);
41
+ const rootRef = useRef(null);
42
+ const currentValue = ("formControl" in props && props.formControl ? useWatch({
43
+ control: props.formControl.control,
44
+ name: props.formControl.name
45
+ }) : props.value) ?? props.value;
46
+ let isFormControlDisabled = false;
47
+ if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
48
+ if (!renderInput && !!props.customTrigger) setRenderInput(true);
49
+ useEffect(() => {
50
+ if (!renderInput || !shouldFocus) return;
51
+ requestAnimationFrame(() => {
52
+ (rootRef.current?.querySelector("input, [data-type='select-trigger'], button, [tabindex]"))?.focus();
53
+ });
54
+ setShouldFocus(false);
55
+ }, [renderInput, shouldFocus]);
56
+ if (!renderInput) {
57
+ const as = props.as ?? ui.input.as;
58
+ let isDisabled = !!props.isDisabled;
59
+ if (isFormControlDisabled) isDisabled = true;
60
+ const mode = props.selectionMode ?? ui.select.selectionMode;
61
+ const { displayValue, isEmpty } = getStaticSelectValue({
62
+ items: props.items,
63
+ value: currentValue,
64
+ selectionMode: mode,
65
+ initialSelection: props.initialSelection,
66
+ mapInitialToSelectItem: props.mapInitialToSelectItem,
67
+ showSelectionContent: props.showSelectionContent,
68
+ isDisabled,
69
+ collapseAfter: props.collapseAfter ?? ui.select.collapseAfter,
70
+ selectedTagsType: props.selectedTagsType ?? ui.select.selectedTagsType
71
+ });
72
+ const trailingContent = props.trailingContent || !props.hideDropdownIcon ? /* @__PURE__ */ jsxs(Fragment, { children: [props.trailingContent, !props.hideDropdownIcon ? /* @__PURE__ */ jsx(ArrowDropDownIcon, { className: "size-6 shrink-0 text-interactive-text-secondary-idle" }) : void 0] }) : void 0;
73
+ return /* @__PURE__ */ jsx(StaticInput, {
74
+ ...props,
75
+ onInteract: (focus) => {
76
+ setShouldFocus(focus);
77
+ setRenderInput(true);
78
+ },
79
+ as,
80
+ size: props.size ?? ui.input.size,
81
+ variant: props.variant ?? ui.input.variant,
82
+ isHeaderHidden: props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
83
+ hideLabel: props.hideLabel ?? ui.input.hideLabel,
84
+ isDisabled,
85
+ className: clsx("w-full", props.containerClassName),
86
+ inputClassName: clsx(props.className, props.inputClassName),
87
+ placeholder: as === "floating" || mode === "single" && !isEmpty ? "" : props.placeholder,
88
+ displayValue,
89
+ isEmpty,
90
+ dataAttributes: {
91
+ dataIsEmpty: isEmpty,
92
+ dataIsFilled: !isEmpty,
93
+ dataIsDirty: props.isDirty,
94
+ dataIsRequired: props.isRequired,
95
+ dataIsDisabled: isDisabled,
96
+ dataDisabled: isDisabled,
97
+ dataInvalid: !!props.error,
98
+ dataHasSelection: !isEmpty,
99
+ dataHasSearch: false
100
+ },
101
+ leadingContent: props.leadingContent,
102
+ trailingContent
103
+ });
104
+ }
105
+ return /* @__PURE__ */ jsx(_Autocomplete, {
106
+ ...props,
107
+ ref: mergeRefs(props.ref, rootRef)
108
+ });
109
+ }
30
110
  //#endregion
31
111
  export { Autocomplete };
@@ -1,4 +1,4 @@
1
1
  import { FieldValues } from 'react-hook-form';
2
2
  import { QueryAutocompleteProps, QueryFn } from './queryAutocomplete.types';
3
3
  import { SelectItem } from '../shared/select.types';
4
- export declare const QueryAutocomplete: <TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn<TSelectItem>>({ query, queryParams, queryOptions, queryMap, ...props }: QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const QueryAutocomplete: <TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn>({ query, queryParams, queryOptions, queryMap, leadingContent, ...props }: QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
@@ -1,35 +1,40 @@
1
1
  import { UIConfig } from "../../../../config/uiConfig.context.js";
2
2
  import { Autocomplete } from "./Autocomplete.js";
3
+ import { getQueryItems } from "../shared/querySelect.utils.js";
3
4
  import { useQueryAutocomplete } from "../../../../hooks/useQueryAutocomplete.js";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  import { useState } from "react";
6
7
  //#region src/components/inputs/Selection/Autocomplete/QueryAutocomplete.tsx
7
- var QueryAutocomplete = ({ query, queryParams, queryOptions, queryMap, ...props }) => {
8
+ var QueryAutocomplete = ({ query, queryParams, queryOptions, queryMap, leadingContent, ...props }) => {
8
9
  const ui = UIConfig.useConfig();
9
10
  const [search, setSearch] = useState("");
10
- const mapItems = (data) => {
11
- const extractedData = Array.isArray(data) ? data : data.pages.flatMap((page) => page.items ?? []);
12
- return queryMap?.(extractedData) ?? extractedData;
13
- };
14
- const { items, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete({
11
+ const { onChange, ...restProps } = props;
12
+ const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete({
15
13
  query,
16
14
  queryParams,
17
15
  queryOptions,
18
- mapItems: (data) => mapItems(data),
16
+ mapItems: (data) => getQueryItems(data, queryMap),
19
17
  search,
20
18
  initialQueryState: props.isInitialQueryDisabled ?? ui.queryAutocomplete?.isInitialQueryDisabled
21
19
  });
22
- const { isInitialQueryDisabled: _, ...restProps } = props;
20
+ const handleChange = (value) => {
21
+ onChange?.(value);
22
+ props.onBlur?.({ target: { value: null } });
23
+ };
24
+ const { isInitialQueryDisabled: _, ...autocompleteProps } = restProps;
23
25
  return /* @__PURE__ */ jsx(Autocomplete, {
24
- ...restProps,
26
+ ...autocompleteProps,
25
27
  items,
28
+ totalItems,
26
29
  onSearchChange: setSearch,
27
30
  isClientSearchDisabled: true,
28
31
  isLoading,
32
+ onChange: handleChange,
29
33
  onMouseEnter: handleEnableQuery,
30
34
  onFocusCapture: handleEnableQuery,
35
+ leadingContent,
31
36
  hasLoadMore: hasNextPage,
32
- onLoadMore: fetchNextPage ? () => void fetchNextPage() : void 0
37
+ onLoadMore: fetchNextPage
33
38
  });
34
39
  };
35
40
  //#endregion
@@ -1,30 +1,36 @@
1
- import { UseInfiniteQueryResult, UseQueryResult } from '@tanstack/react-query';
1
+ import { InfiniteData, UseInfiniteQueryResult, UseQueryResult } from '@tanstack/react-query';
2
2
  import { Key } from 'react-aria-components';
3
3
  import { FieldValues } from 'react-hook-form';
4
4
  import { AutocompleteProps } from './Autocomplete';
5
5
  import { GroupedSelectControlProps, GroupedSelectProps, SelectItem } from '../shared/select.types';
6
6
  import { OmitDiscriminatedUnion } from '../../../../types/common';
7
- export interface QueryAutocompleteInfinitePage<TSelectItem extends SelectItem = SelectItem> {
8
- items: Array<TSelectItem>;
7
+ export type InfiniteQueryPage<TKey extends Key> = {
8
+ items?: SelectItem<TKey>[];
9
9
  totalItems?: number;
10
- }
11
- export type QueryResult<TSelectItem extends SelectItem = SelectItem> = UseQueryResult<Array<TSelectItem>> | UseInfiniteQueryResult<QueryAutocompleteInfinitePage<TSelectItem>>;
12
- export type QueryFn<TSelectItem extends SelectItem = SelectItem> = (...args: any[]) => QueryResult<TSelectItem>;
13
- export type QueryAutocompleteExtractedData<TSelectItem extends SelectItem = SelectItem> = Array<TSelectItem>;
14
- export type QueryAutocompleteProps<TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn<TSelectItem>> = OmitDiscriminatedUnion<AutocompleteProps<TSelectItem["id"]>, "items" | "onSearchChange" | "isLoading" | keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TSelectItem["id"]> & {
15
- query: Parameters<TQueryFn>[0] extends {
16
- search?: string;
17
- } ? TQueryFn : never;
18
- queryParams?: Omit<Parameters<TQueryFn>[0], "search">;
19
- queryOptions?: Parameters<TQueryFn>[1];
20
- queryMap?: (data: QueryAutocompleteExtractedData<TSelectItem>) => SelectItem<TSelectItem["id"]>[];
10
+ };
11
+ export type QueryResult<TData> = UseQueryResult<TData> | UseInfiniteQueryResult<TData>;
12
+ export type QueryFn = (params: any, options?: any) => QueryResult<any>;
13
+ export type ExtractQueryParams<TQueryFn> = TQueryFn extends (params: infer TParams, ...args: any[]) => any ? TParams : never;
14
+ export type ExtractQueryOptions<TQueryFn> = TQueryFn extends (params: any, options?: infer TOptions) => any ? TOptions : never;
15
+ export type QueryDataType<TQueryFn extends QueryFn> = Exclude<ReturnType<TQueryFn>["data"], undefined>;
16
+ export type ExtractPageType<T> = T extends InfiniteData<infer TPage> ? TPage : T;
17
+ export type ExtractedDataType<TQueryFn extends QueryFn> = ExtractPageType<QueryDataType<TQueryFn>> | ExtractPageType<QueryDataType<TQueryFn>>[];
18
+ export type QueryAutocompleteProps<TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn> = OmitDiscriminatedUnion<AutocompleteProps<TSelectItem["id"]>, "items" | "onSearchChange" | "isLoading" | keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TSelectItem["id"]> & {
19
+ query: TQueryFn;
20
+ queryParams?: Omit<ExtractQueryParams<TQueryFn>, "search" | "limit"> & {
21
+ limit?: number;
22
+ };
23
+ queryOptions?: ExtractQueryOptions<TQueryFn>;
24
+ queryMap?: (data: ExtractedDataType<TQueryFn>) => SelectItem<TSelectItem["id"]>[];
21
25
  isInitialQueryDisabled?: boolean;
22
26
  };
23
- export interface UseQueryAutocompleteOptions<TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn<TSelectItem>, TKey extends Key = QueryAutocompleteExtractedData<TSelectItem>[number]["id"]> {
27
+ export interface UseQueryAutocompleteOptions<TQueryFn extends QueryFn, TKey extends Key = Key> {
24
28
  query: TQueryFn;
25
- queryParams?: Parameters<TQueryFn>[0];
26
- queryOptions?: Parameters<TQueryFn>[1];
27
- queryMap?: (data: QueryAutocompleteExtractedData<TSelectItem>) => SelectItem<TKey>[];
29
+ queryParams?: Omit<ExtractQueryParams<TQueryFn>, "search" | "limit"> & {
30
+ limit?: number;
31
+ };
32
+ queryOptions?: ExtractQueryOptions<TQueryFn>;
33
+ mapItems: (data: QueryDataType<TQueryFn>) => SelectItem<TKey>[];
28
34
  initialQueryState?: boolean;
29
- search: string;
35
+ search?: string;
30
36
  }
@@ -4,7 +4,7 @@ import { QueryDataType, QueryFn } from '../shared/querySelect.utils';
4
4
  import { OmitDiscriminatedUnion } from '../../../../types/common';
5
5
  import { Key } from 'react-aria-components';
6
6
  import { FieldValues } from 'react-hook-form';
7
- type QuerySelectProps<TFieldValues extends FieldValues, TQueryFn extends QueryFn, TKey extends Key = Key> = OmitDiscriminatedUnion<SelectBaseProps<TKey>, "items" | "isLoading" | keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey> & {
7
+ export type QuerySelectProps<TFieldValues extends FieldValues, TQueryFn extends QueryFn, TKey extends Key = Key> = OmitDiscriminatedUnion<SelectBaseProps<TKey>, "items" | "isLoading" | keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey> & {
8
8
  query: TQueryFn;
9
9
  queryParams?: Parameters<TQueryFn>[0];
10
10
  queryOptions?: Parameters<TQueryFn>[1];
@@ -12,4 +12,3 @@ type QuerySelectProps<TFieldValues extends FieldValues, TQueryFn extends QueryFn
12
12
  isInitialQueryDisabled?: boolean;
13
13
  };
14
14
  export declare const QuerySelect: <TFieldValues extends FieldValues, TQueryFn extends QueryFn, TKey extends Key = Key>({ query, queryParams, queryOptions, queryMap, ...props }: QuerySelectProps<TFieldValues, TQueryFn, TKey>) => import("react/jsx-runtime").JSX.Element;
15
- export {};
@@ -1,14 +1,14 @@
1
1
  import { UIConfig } from "../../../../config/uiConfig.context.js";
2
2
  import { SelectBase } from "../shared/SelectBase.js";
3
- import { useQueryAutocomplete } from "../../../../hooks/useQueryAutocomplete.js";
4
3
  import { getQueryItems } from "../shared/querySelect.utils.js";
4
+ import { useQueryAutocomplete } from "../../../../hooks/useQueryAutocomplete.js";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { mergeRefs } from "@react-aria/utils";
7
7
  import { Controller } from "react-hook-form";
8
8
  //#region src/components/inputs/Selection/Select/QuerySelect.tsx
9
9
  var QuerySelect = ({ query, queryParams, queryOptions, queryMap, ...props }) => {
10
10
  const ui = UIConfig.useConfig();
11
- const { items, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete({
11
+ const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete({
12
12
  query,
13
13
  queryParams,
14
14
  queryOptions,
@@ -25,8 +25,9 @@ var QuerySelect = ({ query, queryParams, queryOptions, queryMap, ...props }) =>
25
25
  ref: mergeRefs(ref, field.ref),
26
26
  items,
27
27
  isLoading,
28
+ totalItems,
28
29
  hasLoadMore: hasNextPage,
29
- onLoadMore: fetchNextPage ? () => void fetchNextPage() : void 0,
30
+ onLoadMore: fetchNextPage,
30
31
  value: field.value,
31
32
  onChange: (value) => {
32
33
  field.onChange(value);
@@ -46,6 +47,7 @@ var QuerySelect = ({ query, queryParams, queryOptions, queryMap, ...props }) =>
46
47
  ...restProps,
47
48
  items,
48
49
  isLoading,
50
+ totalItems,
49
51
  hasLoadMore: hasNextPage,
50
52
  onLoadMore: fetchNextPage ? () => void fetchNextPage() : void 0,
51
53
  onMouseEnter: handleEnableQuery,
@@ -1,8 +1,12 @@
1
+ import { ReactElement } from 'react';
1
2
  import { Key } from 'react-aria-components';
2
3
  import { FieldValues } from 'react-hook-form';
3
4
  import { SelectBaseProps } from '../shared/SelectBase';
4
5
  import { DefaultInitialSelectItem, GroupedSelectControlProps, GroupedSelectProps, SelectAsyncProps } from '../shared/select.types';
5
6
  import { OmitDiscriminatedUnion } from '../../../../types/common';
6
- export type SelectProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectBaseProps<TKey, TInitialSelectItem>, "initialSelection" | "mapInitialToSelectItem" | keyof SelectAsyncProps>;
7
- export type ControlledSelectProps<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = Omit<SelectProps<TKey, TInitialSelectItem>, keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey>;
8
- export declare const Select: <TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: ControlledSelectProps<TFieldValues, TKey, TInitialSelectItem>) => import("react/jsx-runtime").JSX.Element;
7
+ export type SelectProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectBaseProps<TKey, TInitialSelectItem>, keyof SelectAsyncProps> & {
8
+ renderStaticInput?: boolean;
9
+ };
10
+ export type ControlledSelectProps<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = Omit<SelectProps<TKey, TInitialSelectItem>, keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey, TInitialSelectItem>;
11
+ export declare function Select<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: SelectProps<TKey, TInitialSelectItem>): ReactElement;
12
+ export declare function Select<TFieldValues extends FieldValues, TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(props: ControlledSelectProps<TFieldValues, TKey, TInitialSelectItem>): ReactElement;
@@ -1,9 +1,15 @@
1
+ import { ArrowDropDownIcon } from "../../../../assets/icons/ArrowDropDown.js";
2
+ import { UIConfig } from "../../../../config/uiConfig.context.js";
3
+ import { StaticInput } from "../../shared/StaticInput.js";
1
4
  import { SelectBase } from "../shared/SelectBase.js";
2
- import { jsx } from "react/jsx-runtime";
5
+ import { getStaticSelectValue } from "../shared/staticSelect.utils.js";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { clsx } from "clsx";
8
+ import { useEffect, useRef, useState } from "react";
3
9
  import { mergeRefs } from "@react-aria/utils";
4
- import { Controller } from "react-hook-form";
10
+ import { Controller, useWatch } from "react-hook-form";
5
11
  //#region src/components/inputs/Selection/Select/Select.tsx
6
- var Select = (props) => {
12
+ function _Select(props) {
7
13
  if ("formControl" in props && props.formControl) {
8
14
  const { formControl, ref, ...innerProps } = props;
9
15
  return /* @__PURE__ */ jsx(Controller, {
@@ -22,6 +28,80 @@ var Select = (props) => {
22
28
  });
23
29
  }
24
30
  return /* @__PURE__ */ jsx(SelectBase, { ...props });
25
- };
31
+ }
32
+ function Select({ renderStaticInput, ...props }) {
33
+ const ui = UIConfig.useConfig();
34
+ const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
35
+ const [shouldFocus, setShouldFocus] = useState(false);
36
+ const rootRef = useRef(null);
37
+ const currentValue = ("formControl" in props && props.formControl ? useWatch({
38
+ control: props.formControl.control,
39
+ name: props.formControl.name
40
+ }) : props.value) ?? props.value;
41
+ let isFormControlDisabled = false;
42
+ if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
43
+ if (!renderInput && props.selectionMode !== "multiple" && !!props.showSelectionContent && currentValue != null) setRenderInput(true);
44
+ if (!renderInput && !!props.customTrigger) setRenderInput(true);
45
+ useEffect(() => {
46
+ if (!renderInput || !shouldFocus) return;
47
+ requestAnimationFrame(() => {
48
+ (rootRef.current?.querySelector("[data-type='select-trigger'], input, button, [tabindex]"))?.focus();
49
+ });
50
+ setShouldFocus(false);
51
+ }, [renderInput, shouldFocus]);
52
+ if (!renderInput) {
53
+ const as = props.as ?? ui.input.as;
54
+ let isDisabled = !!props.isDisabled;
55
+ if (isFormControlDisabled) isDisabled = true;
56
+ const mode = props.selectionMode ?? ui.select.selectionMode;
57
+ const { displayValue, isEmpty } = getStaticSelectValue({
58
+ items: props.items,
59
+ value: currentValue,
60
+ selectionMode: mode,
61
+ initialSelection: props.initialSelection,
62
+ mapInitialToSelectItem: props.mapInitialToSelectItem,
63
+ showSelectionContent: props.showSelectionContent,
64
+ isDisabled,
65
+ collapseAfter: props.collapseAfter ?? ui.select.collapseAfter,
66
+ selectedTagsType: props.selectedTagsType ?? ui.select.selectedTagsType
67
+ });
68
+ const trailingContent = props.trailingContent || !props.hideDropdownIcon ? /* @__PURE__ */ jsxs(Fragment, { children: [props.trailingContent, !props.hideDropdownIcon ? /* @__PURE__ */ jsx(ArrowDropDownIcon, { className: `size-6 shrink-0 ${isDisabled ? "text-interactive-text-secondary-disabled" : "text-interactive-text-secondary-idle"}` }) : void 0] }) : void 0;
69
+ return /* @__PURE__ */ jsx(StaticInput, {
70
+ ...props,
71
+ onInteract: (focus) => {
72
+ setShouldFocus(focus);
73
+ setRenderInput(true);
74
+ },
75
+ as,
76
+ size: props.size ?? ui.input.size,
77
+ variant: props.variant ?? ui.input.variant,
78
+ isHeaderHidden: props.isHeaderHidden || as === "inline" || as === "filter" || as === "floating",
79
+ hideLabel: props.hideLabel ?? ui.input.hideLabel,
80
+ isDisabled,
81
+ className: clsx("w-full", props.containerClassName),
82
+ inputClassName: clsx(props.className, props.inputClassName),
83
+ placeholder: as === "floating" || mode === "single" && !isEmpty ? "" : props.placeholder,
84
+ displayValue,
85
+ isEmpty,
86
+ dataAttributes: {
87
+ dataIsEmpty: isEmpty,
88
+ dataIsFilled: !isEmpty,
89
+ dataIsDirty: props.isDirty,
90
+ dataIsRequired: props.isRequired,
91
+ dataIsDisabled: isDisabled,
92
+ dataDisabled: isDisabled,
93
+ dataInvalid: !!props.error,
94
+ dataHasSelection: !isEmpty,
95
+ dataHasSearch: false
96
+ },
97
+ leadingContent: props.leadingContent,
98
+ trailingContent
99
+ });
100
+ }
101
+ return /* @__PURE__ */ jsx(_Select, {
102
+ ...props,
103
+ ref: mergeRefs(props.ref, rootRef)
104
+ });
105
+ }
26
106
  //#endregion
27
107
  export { Select };
@@ -1,4 +1,4 @@
1
- import { FocusEventHandler, MouseEventHandler, ReactElement, Ref } from 'react';
1
+ import { FocusEventHandler, MouseEventHandler, ReactElement, ReactNode, Ref } from 'react';
2
2
  import { AriaButtonProps } from 'react-aria';
3
3
  import { Key } from 'react-aria-components';
4
4
  import { FormFieldProps } from '../../FormField/FormField';
@@ -14,10 +14,13 @@ export type SelectBaseProps<TKey extends Key = Key, TInitialSelectItem = Default
14
14
  isSearchable?: boolean;
15
15
  isClearable?: boolean;
16
16
  isClientSearchDisabled?: boolean;
17
+ ignoreInputValueFiltering?: boolean;
17
18
  ignoreTriggerWidth?: boolean;
18
19
  items: SelectItem<TKey>[];
19
20
  inputClassName?: string;
20
21
  containerClassName?: string;
22
+ leadingContent?: ReactNode;
23
+ trailingContent?: ReactNode;
21
24
  customTrigger?: ReactElement;
22
25
  selectedTagsType?: "tags" | "list";
23
26
  collapseAfter?: number;
@@ -17,10 +17,11 @@ var SelectBase = (dProps) => {
17
17
  isClearable: dProps.isClearable ?? ui.input.isClearable,
18
18
  isSearchable: dProps.isSearchable ?? ui.select.isSearchable,
19
19
  selectedTagsType: dProps.selectedTagsType ?? ui.select.selectedTagsType,
20
- ignoreTriggerWidth: dProps.virtualizerOptions || dProps.items.length > 100 ? false : dProps.ignoreTriggerWidth ?? false,
20
+ ignoreTriggerWidth: dProps.virtualizerOptions || (dProps.totalItems ?? 0) > 100 || dProps.hasLoadMore ? false : dProps.ignoreTriggerWidth ?? false,
21
21
  collapseAfter: dProps.collapseAfter ?? ui.select.collapseAfter,
22
22
  hideSearchIcon: dProps.hideSearchIcon ?? ui.select.hideSearchIcon,
23
- fireBlurOnChange: dProps.fireBlurOnChange ?? ui.select.fireBlurOnChange
23
+ fireBlurOnChange: dProps.fireBlurOnChange ?? ui.select.fireBlurOnChange,
24
+ isClientSearchDisabled: dProps.ignoreInputValueFiltering ?? dProps.isClientSearchDisabled
24
25
  };
25
26
  const isDesktop = useBreakpoint("md");
26
27
  return /* @__PURE__ */ jsx(SelectContext.Provider, {
@@ -1,5 +1,5 @@
1
1
  import { Key } from 'react-aria-components';
2
2
  import { SelectBaseProps } from './SelectBase';
3
3
  type SelectDesktopProps<TKey extends Key = Key> = SelectBaseProps<TKey>;
4
- export declare const SelectDesktop: <TKey extends Key = Key>({ ref, error, ignoreTriggerWidth, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, onMouseEnter, onFocusCapture, ...props }: SelectDesktopProps<TKey>) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const SelectDesktop: <TKey extends Key = Key>({ ref, error, ignoreTriggerWidth, showSelectionContent, inputClassName, containerClassName, leadingContent, trailingContent, customTrigger, onBlur, onMouseEnter, onFocusCapture, ...props }: SelectDesktopProps<TKey>) => import("react/jsx-runtime").JSX.Element;
5
5
  export {};
@@ -6,6 +6,7 @@ import "./useSelectItems.js";
6
6
  import { SelectContext } from "./select.context.js";
7
7
  import { SelectInput } from "./SelectInput.js";
8
8
  import { SelectListBox } from "./SelectListBox.js";
9
+ import { selectPopoverCva } from "./selectDesktop.cva.js";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
10
11
  import { clsx } from "clsx";
11
12
  import { Fragment as Fragment$1, useLayoutEffect, useMemo, useRef, useState } from "react";
@@ -13,9 +14,10 @@ import { ComboBox, DialogTrigger, Popover } from "react-aria-components";
13
14
  import { useLabel, usePreventScroll } from "react-aria";
14
15
  import { mergeRefs } from "@react-aria/utils";
15
16
  //#region src/components/inputs/Selection/shared/SelectDesktop.tsx
16
- var SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, onMouseEnter, onFocusCapture, ...props }) => {
17
+ var SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inputClassName, containerClassName, leadingContent, trailingContent, customTrigger, onBlur, onMouseEnter, onFocusCapture, ...props }) => {
17
18
  const { label, tooltipText, helperText, isDirty, isRequired, rightContent, isHeaderHidden, headerClassName, errorClassName, placeholder, variant, isDisabled, className, hideLabel, hideDropdownIcon, isSearchable, isClearable, isLoading, as, size, collapseAfter, selectedTagsType } = props;
18
19
  const popoverCva = UIStyle.useCva("popover.cva", popover);
20
+ const selectPopoverCva$1 = UIStyle.useCva("select.popoverCva", selectPopoverCva);
19
21
  const formFieldProps = {
20
22
  error,
21
23
  label,
@@ -113,14 +115,14 @@ var SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inp
113
115
  className: clsx("w-full", containerClassName)
114
116
  },
115
117
  as,
118
+ onMouseEnter,
119
+ onFocusCapture,
116
120
  ref: wrapperRef,
117
121
  children: [customTrigger ? /* @__PURE__ */ jsx(DialogTrigger, {
118
122
  ...dialogTriggerProps,
119
123
  children: /* @__PURE__ */ jsx("div", {
120
124
  ...fieldProps,
121
125
  ref: mergeRefs(ref, triggerRef),
122
- onMouseEnter,
123
- onFocusCapture,
124
126
  children: customTrigger
125
127
  })
126
128
  }) : /* @__PURE__ */ jsx(SelectInput, {
@@ -137,6 +139,8 @@ var SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inp
137
139
  isClearable,
138
140
  showSelectionContent,
139
141
  inputClassName,
142
+ leadingContent,
143
+ trailingContent,
140
144
  collapseAfter,
141
145
  selectedTagsType,
142
146
  isRequired,
@@ -151,7 +155,7 @@ var SelectDesktop = ({ ref, error, ignoreTriggerWidth, showSelectionContent, inp
151
155
  triggerRef,
152
156
  isOpen,
153
157
  onOpenChange: setIsOpen,
154
- className: "my-4 outline-none",
158
+ className: selectPopoverCva$1({}),
155
159
  style: { width: !ignoreTriggerWidth ? popoverWidth : void 0 },
156
160
  offset: 0,
157
161
  children: /* @__PURE__ */ jsx(SelectListBox, {
@@ -4,12 +4,12 @@ import { FormFieldHeaderProps } from '../../FormField/FormFieldHeader';
4
4
  import { SelectBaseProps } from './SelectBase';
5
5
  import { SelectItem } from './select.types';
6
6
  import { InputVariantProps } from '../../shared/input.cva';
7
- interface SelectInputProps extends InputVariantProps, Pick<SelectBaseProps, "ref" | "placeholder" | "isDisabled" | "hideDropdownIcon" | "isSearchable" | "isClearable" | "onBlur" | "showSelectionContent" | "inputClassName" | "selectedTagsType" | "collapseAfter" | "isRequired" | "isDirty" | "fireBlurOnChange" | "onMouseEnter" | "onFocusCapture"> {
7
+ interface SelectInputProps extends InputVariantProps, Pick<SelectBaseProps, "ref" | "placeholder" | "isDisabled" | "hideDropdownIcon" | "isSearchable" | "isClearable" | "onBlur" | "showSelectionContent" | "inputClassName" | "selectedTagsType" | "collapseAfter" | "isRequired" | "isDirty" | "fireBlurOnChange" | "leadingContent" | "trailingContent" | "onMouseEnter" | "onFocusCapture"> {
8
8
  isInvalid?: boolean;
9
9
  className?: string;
10
10
  fieldProps?: AriaFieldProps;
11
11
  headerProps?: FormFieldHeaderProps;
12
12
  onCloseComboBox?: (state: ComboBoxState<SelectItem> | null) => void;
13
13
  }
14
- export declare const SelectInput: ({ ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onBlur, fireBlurOnChange, onMouseEnter, onFocusCapture, ...props }: SelectInputProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const SelectInput: ({ ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onBlur, fireBlurOnChange, leadingContent, trailingContent, onMouseEnter, onFocusCapture, ...props }: SelectInputProps) => import("react/jsx-runtime").JSX.Element;
15
15
  export {};
@@ -4,7 +4,7 @@ import { Typography } from "../../../text/Typography/Typography.js";
4
4
  import "../../../../config/i18n.js";
5
5
  import { FormFieldLabel } from "../../FormField/FormFieldLabel.js";
6
6
  import { InputClear } from "../../shared/InputClear.js";
7
- import { inputBase, inputSize } from "../../shared/input.cva.js";
7
+ import { inputBase, inputClearClass, inputSize } from "../../shared/input.cva.js";
8
8
  import { SelectInputTags } from "./SelectInputTags.js";
9
9
  import { SelectContext } from "./select.context.js";
10
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -14,9 +14,10 @@ import { Button, ComboBoxStateContext, Input } from "react-aria-components";
14
14
  import { useFocusVisible, useFocusWithin, useHover } from "react-aria";
15
15
  import { useTranslation } from "react-i18next";
16
16
  //#region src/components/inputs/Selection/shared/SelectInput.tsx
17
- var SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onBlur, fireBlurOnChange, onMouseEnter, onFocusCapture, ...props }) => {
17
+ var SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvalid, className, hideDropdownIcon, isSearchable, isClearable, showSelectionContent, inputClassName, fieldProps, headerProps, selectedTagsType, collapseAfter, isRequired, isDirty, onCloseComboBox, onBlur, fireBlurOnChange, leadingContent, trailingContent, onMouseEnter, onFocusCapture, ...props }) => {
18
18
  const inputSizeCva = UIStyle.useCva("input.sizeCva", inputSize);
19
19
  const inputBaseCva = UIStyle.useCva("input.baseCva", inputBase);
20
+ const inputClearClassCva = UIStyle.useCva("input.clearClassCva", inputClearClass);
20
21
  const { t } = useTranslation("ui");
21
22
  const state = use(ComboBoxStateContext);
22
23
  const { hoverProps, isHovered } = useHover({ isDisabled });
@@ -101,6 +102,10 @@ var SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvalid,
101
102
  ...headerProps,
102
103
  labelProps
103
104
  }),
105
+ leadingContent && /* @__PURE__ */ jsx("div", {
106
+ className: "ml-input-side-default flex shrink-0 items-center",
107
+ children: leadingContent
108
+ }),
104
109
  (showTags || isSearchable) && /* @__PURE__ */ jsxs("div", {
105
110
  className: clsx("flex flex-1 flex-wrap gap-input-gap-input-text-to-elements truncate", !isSearchable && "pointer-events-none z-1"),
106
111
  children: [showTags && /* @__PURE__ */ jsx(SelectInputTags, {
@@ -138,8 +143,13 @@ var SelectInput = ({ ref, placeholder, variant, as, size, isDisabled, isInvalid,
138
143
  onClear();
139
144
  if (fireBlurOnChange) onBlur?.({});
140
145
  },
146
+ className: inputClearClassCva({ as }),
141
147
  show: showClearButton
142
148
  }),
149
+ trailingContent && /* @__PURE__ */ jsx("div", {
150
+ className: "flex shrink-0 items-center",
151
+ children: trailingContent
152
+ }),
143
153
  !hideDropdownIcon && /* @__PURE__ */ jsx(Button, {
144
154
  excludeFromTabOrder: true,
145
155
  "aria-label": t(($) => isOpen ? $.ui.closeAlt : $.ui.openAlt),
@@ -1,9 +1,9 @@
1
1
  import { AriaListBoxProps } from 'react-aria';
2
2
  import { SelectBaseProps } from './SelectBase';
3
3
  import { SelectItem } from './select.types';
4
- export interface SelectListBoxProps extends Pick<SelectBaseProps, "label" | "newItemRender" | "onLoadMore" | "selectionMode" | "isSearchable" | "virtualizerOptions">, Omit<AriaListBoxProps<SelectItem>, "children" | "aria-label" | "selectionMode" | "items" | "selectedKeys" | "onSelectionChange" | "escapeKeyBehavior" | "shouldSelectOnPressUp" | "label"> {
4
+ export interface SelectListBoxProps extends Pick<SelectBaseProps, "label" | "newItemRender" | "onLoadMore" | "selectionMode" | "isSearchable" | "virtualizerOptions" | "totalItems" | "hasLoadMore">, Omit<AriaListBoxProps<SelectItem>, "children" | "aria-label" | "selectionMode" | "items" | "selectedKeys" | "onSelectionChange" | "escapeKeyBehavior" | "shouldSelectOnPressUp" | "label"> {
5
5
  className?: string;
6
6
  isScrollable?: boolean;
7
7
  onClose?: () => void;
8
8
  }
9
- export declare const SelectListBox: ({ label, selectionMode, isSearchable, isScrollable, virtualizerOptions, newItemRender, onLoadMore, className, onClose, ...props }: SelectListBoxProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const SelectListBox: ({ label, selectionMode, isSearchable, isScrollable, virtualizerOptions, totalItems, newItemRender, onLoadMore, className, onClose, ...props }: SelectListBoxProps) => import("react/jsx-runtime").JSX.Element;
@@ -7,8 +7,8 @@ import { jsx } from "react/jsx-runtime";
7
7
  import { clsx } from "clsx";
8
8
  import { ListBox, ListLayout, Virtualizer } from "react-aria-components";
9
9
  //#region src/components/inputs/Selection/shared/SelectListBox.tsx
10
- var SelectListBox = ({ label, selectionMode, isSearchable, isScrollable = true, virtualizerOptions, newItemRender, onLoadMore, className, onClose, ...props }) => {
11
- const { fieldState, onChange, listItems, selectableListItems, selectedIds, isMultiple, onClear, onSelectAll } = SelectContext.useSelect();
10
+ var SelectListBox = ({ label, selectionMode, isSearchable, isScrollable = true, virtualizerOptions, totalItems, newItemRender, onLoadMore, className, onClose, ...props }) => {
11
+ const { fieldState, onChange, listItems, selectableListItems, selectedIds, isMultiple, onClear, onSelectAll, hasLoadMore } = SelectContext.useSelect();
12
12
  const onSelectionChange = (value) => {
13
13
  const ids = Array.from(value);
14
14
  if (!isMultiple && ids.length === 0) {
@@ -42,7 +42,7 @@ var SelectListBox = ({ label, selectionMode, isSearchable, isScrollable = true,
42
42
  newItemRender
43
43
  }, item.id);
44
44
  };
45
- if (virtualizerOptions || listItems.length > 100) return /* @__PURE__ */ jsx(Virtualizer, {
45
+ if (virtualizerOptions || (totalItems ?? listItems.length) > 100 || hasLoadMore) return /* @__PURE__ */ jsx(Virtualizer, {
46
46
  layout: ListLayout,
47
47
  layoutOptions: virtualizerOptions,
48
48
  children: /* @__PURE__ */ jsx(ListBox, {
@@ -1,5 +1,5 @@
1
1
  import { Key } from 'react-aria-components';
2
2
  import { SelectBaseProps } from './SelectBase';
3
3
  type SelectMobileProps<TKey extends Key = Key> = SelectBaseProps<TKey>;
4
- export declare const SelectMobile: <TKey extends Key = Key>({ ref, error, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, onMouseEnter, onFocusCapture, ...props }: SelectMobileProps<TKey>) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const SelectMobile: <TKey extends Key = Key>({ ref, error, showSelectionContent, inputClassName, containerClassName, leadingContent, trailingContent, customTrigger, onBlur, onMouseEnter, onFocusCapture, ...props }: SelectMobileProps<TKey>) => import("react/jsx-runtime").JSX.Element;
5
5
  export {};