@povio/ui 2.3.0-rc.9 → 2.3.1
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.
- package/dist/assets/icons/AlignCenter.js +11 -26
- package/dist/assets/icons/AlignLeft.js +11 -26
- package/dist/assets/icons/AlignLeftRight.js +11 -26
- package/dist/assets/icons/AlignRight.js +11 -26
- package/dist/assets/icons/ArrowDropDown.js +11 -26
- package/dist/assets/icons/ArrowDropUp.js +11 -26
- package/dist/assets/icons/ArrowLeft.js +11 -26
- package/dist/assets/icons/ArrowRight.js +11 -26
- package/dist/assets/icons/Bold.js +11 -26
- package/dist/assets/icons/BulletedList.js +11 -26
- package/dist/assets/icons/Calendar.js +13 -28
- package/dist/assets/icons/Check.js +13 -28
- package/dist/assets/icons/CheckCircle.js +11 -26
- package/dist/assets/icons/CheckboxCheckmark.js +14 -29
- package/dist/assets/icons/CheckboxIndeterminate.js +14 -29
- package/dist/assets/icons/ChevronDown.js +13 -28
- package/dist/assets/icons/ChevronLeft.js +13 -28
- package/dist/assets/icons/ChevronRight.js +13 -28
- package/dist/assets/icons/ChevronUp.js +13 -28
- package/dist/assets/icons/ChevronsLeft.js +13 -28
- package/dist/assets/icons/ChevronsRight.js +13 -28
- package/dist/assets/icons/Clock.js +11 -26
- package/dist/assets/icons/Close.js +11 -26
- package/dist/assets/icons/DateTime.js +14 -35
- package/dist/assets/icons/DragIndicator.js +11 -26
- package/dist/assets/icons/File.js +13 -28
- package/dist/assets/icons/Highlight.js +11 -26
- package/dist/assets/icons/HighlightOn.js +15 -49
- package/dist/assets/icons/Home.js +11 -26
- package/dist/assets/icons/Info.js +16 -37
- package/dist/assets/icons/Italic.js +11 -26
- package/dist/assets/icons/Link.js +11 -26
- package/dist/assets/icons/Menu.js +11 -26
- package/dist/assets/icons/NumberedList.js +11 -26
- package/dist/assets/icons/PointerHorizontal.js +11 -26
- package/dist/assets/icons/PointerVertical.js +11 -26
- package/dist/assets/icons/Search.js +11 -26
- package/dist/assets/icons/Send.js +13 -28
- package/dist/assets/icons/Strikethrough.js +11 -26
- package/dist/assets/icons/TextColor.js +14 -48
- package/dist/assets/icons/Today.js +11 -26
- package/dist/assets/icons/Underlined.js +13 -28
- package/dist/assets/icons/Upload.js +14 -35
- package/dist/assets/icons/Visibility.js +11 -26
- package/dist/assets/icons/VisibilityOff.js +11 -26
- package/dist/assets/icons/WarningFilled.js +13 -28
- package/dist/components/Breadcrumbs/Breadcrumbs.js +56 -207
- package/dist/components/Menu/Menu.js +2 -18
- package/dist/components/Menu/MenuDesktop.js +7 -41
- package/dist/components/Menu/MenuItem.js +9 -32
- package/dist/components/Menu/MenuMobile.js +38 -97
- package/dist/components/Menu/MenuPopover.js +29 -105
- package/dist/components/buttons/IconButton/IconButton.js +8 -40
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +1 -2
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
- package/dist/components/buttons/PillButton/PillButton.js +17 -55
- package/dist/components/buttons/SplitButton/SplitButton.js +18 -103
- package/dist/components/buttons/TextButton/TextButton.js +8 -30
- package/dist/components/buttons/ToggleButton/ToggleButton.js +8 -28
- package/dist/components/buttons/shared/ButtonContent.js +22 -80
- package/dist/components/inputs/Checkbox/Checkbox.js +35 -172
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +0 -3
- package/dist/components/inputs/Checkbox/checkbox.cva.js +1 -2
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +5 -10
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +20 -121
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +5 -10
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +111 -215
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +5 -11
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +19 -123
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +3 -5
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +104 -448
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +2 -5
- package/dist/components/inputs/DateTime/shared/Calendar.js +119 -330
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +102 -283
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +1 -1
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +33 -142
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +93 -249
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +137 -318
- package/dist/components/inputs/DateTime/shared/DateField.js +112 -296
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +3 -6
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +136 -355
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +0 -14
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +11 -97
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +27 -81
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +58 -103
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +82 -193
- package/dist/components/inputs/DateTime/shared/TimeField.js +8 -27
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +110 -279
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +1 -2
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +65 -207
- package/dist/components/inputs/DateTime/shared/YearPicker.js +68 -119
- package/dist/components/inputs/File/FileUpload.js +44 -87
- package/dist/components/inputs/File/FileUploadContainer.js +7 -15
- package/dist/components/inputs/File/InputUpload.js +79 -317
- package/dist/components/inputs/File/shared/FileCard.js +41 -104
- package/dist/components/inputs/File/shared/FileCardList.js +12 -47
- package/dist/components/inputs/File/shared/FileUploadContent.js +44 -175
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +46 -149
- package/dist/components/inputs/File/shared/FileUploadContentError.js +93 -234
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +97 -230
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +55 -199
- package/dist/components/inputs/File/shared/InputUploadContent.js +34 -148
- package/dist/components/inputs/File/shared/InputUploadFilled.js +8 -49
- package/dist/components/inputs/File/shared/ProgressBar.js +9 -48
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormField.js +37 -119
- package/dist/components/inputs/FormField/FormFieldError.js +5 -25
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldHeader.js +22 -81
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +7 -31
- package/dist/components/inputs/FormField/FormFieldHelper.js +6 -26
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +9 -40
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +2 -5
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +88 -334
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +9 -48
- package/dist/components/inputs/Input/TextArea/TextArea.js +90 -305
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +1 -3
- package/dist/components/inputs/Input/TextInput/TextInput.js +79 -319
- package/dist/components/inputs/Input/shared/InputContent.js +59 -192
- package/dist/components/inputs/Inputs/Form.js +11 -40
- package/dist/components/inputs/Inputs/InputItem.d.ts +21 -16
- package/dist/components/inputs/Inputs/InputItem.js +14 -71
- package/dist/components/inputs/Inputs/Inputs.js +11 -37
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -2
- package/dist/components/inputs/RadioGroup/RadioGroup.js +60 -352
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +0 -17
- package/dist/components/inputs/RadioGroup/radio.cva.js +1 -42
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +2 -6
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +7 -109
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +18 -3
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +8 -34
- package/dist/components/inputs/Selection/Select/Select.d.ts +3 -7
- package/dist/components/inputs/Selection/Select/Select.js +5 -132
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +1 -8
- package/dist/components/inputs/Selection/shared/SelectBase.js +18 -69
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +138 -393
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +116 -338
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +25 -99
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +52 -164
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +35 -85
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +16 -69
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +21 -70
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +9 -58
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +3 -9
- package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -3
- package/dist/components/inputs/Selection/shared/select.context.js +34 -57
- package/dist/components/inputs/Selection/shared/select.types.d.ts +2 -3
- package/dist/components/inputs/Selection/shared/useSelectItems.js +49 -109
- package/dist/components/inputs/Slider/Slider.js +74 -250
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +0 -1
- package/dist/components/inputs/TextEditor/TextEditor.js +98 -447
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +11 -37
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +30 -102
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +45 -194
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +28 -88
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +14 -48
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +19 -66
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +15 -49
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +32 -92
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +54 -126
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +38 -141
- package/dist/components/inputs/Toggle/Toggle.js +37 -189
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +0 -3
- package/dist/components/inputs/Toggle/toggle.cva.js +1 -2
- package/dist/components/inputs/shared/CheckContent.d.ts +1 -2
- package/dist/components/inputs/shared/CheckContent.js +11 -21
- package/dist/components/inputs/shared/InputClear.d.ts +1 -2
- package/dist/components/inputs/shared/InputClear.js +13 -79
- package/dist/components/inputs/shared/TooltipWrapper.js +11 -50
- package/dist/components/inputs/shared/input.cva.d.ts +0 -10
- package/dist/components/inputs/shared/input.cva.js +4 -32
- package/dist/components/navigation/Accordion/Accordion.js +22 -69
- package/dist/components/navigation/Accordion/AccordionItem.js +41 -86
- package/dist/components/navigation/Stepper/Stepper.js +22 -67
- package/dist/components/navigation/Stepper/StepperItem.js +31 -104
- package/dist/components/navigation/Stepper/StepperSeparator.js +5 -23
- package/dist/components/overlays/ActionModal/ActionModal.js +35 -169
- package/dist/components/overlays/BottomSheet/BottomSheet.js +49 -98
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +8 -48
- package/dist/components/overlays/Drawer/Drawer.js +20 -62
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +27 -83
- package/dist/components/overlays/Tooltip/Tooltip.js +28 -137
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +12 -37
- package/dist/components/segment/Segment.js +57 -218
- package/dist/components/segment/SegmentItem.js +10 -67
- package/dist/components/shared/pagination/Pagination.js +22 -108
- package/dist/components/shared/pagination/PaginationList.js +64 -167
- package/dist/components/status/Alert/Alert.js +30 -97
- package/dist/components/status/Loader/Loader.js +22 -77
- package/dist/components/status/Toast/Toast.js +13 -21
- package/dist/components/status/Toast/useToast.js +57 -62
- package/dist/components/table/ColumnConfig.js +54 -158
- package/dist/components/table/InfiniteTable.js +16 -67
- package/dist/components/table/PaginatedTable.js +18 -84
- package/dist/components/table/Table.js +27 -28
- package/dist/components/text/Link/Link.js +7 -19
- package/dist/components/text/Typography/Typography.js +8 -23
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/link.context.js +9 -23
- package/dist/config/router.context.js +16 -42
- package/dist/config/theme.context.js +45 -98
- package/dist/config/uiConfig.context.d.ts +6 -16
- package/dist/config/uiConfig.context.js +13 -56
- package/dist/config/uiStyle.context.d.ts +4 -27
- package/dist/config/uiStyle.context.js +5 -15
- package/dist/helpers/dynamicInputs.d.ts +5 -5
- package/dist/helpers/dynamicInputs.js +0 -3
- package/dist/hooks/useBreakpoint.js +3 -16
- package/dist/hooks/useDebounceCallback.js +17 -51
- package/dist/hooks/useFilters.js +64 -125
- package/dist/hooks/useForm.js +8 -42
- package/dist/hooks/useFormAutosave.js +30 -101
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +24 -91
- package/dist/hooks/useLocalStorage.js +10 -43
- package/dist/hooks/useLongPressRepeat.js +20 -55
- package/dist/hooks/usePagination.js +19 -49
- package/dist/hooks/useScrollableListBox.js +16 -37
- package/dist/hooks/useSorting.js +28 -69
- package/dist/hooks/useStateAndRef.js +7 -21
- package/dist/hooks/useTableColumnConfig.js +31 -124
- package/dist/hooks/useTranslationMemo.js +5 -25
- package/dist/index.d.ts +0 -7
- package/dist/index.js +3 -5
- package/dist/tw-ui-plugin.js +0 -2
- package/dist/utils/date-time.utils.d.ts +10 -31
- package/dist/utils/date-time.utils.js +22 -123
- package/dist/utils/dom.utils.js +1 -1
- package/package.json +1 -1
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +0 -4
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +0 -7
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +0 -13
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +0 -6
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +0 -21
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +0 -2
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +0 -1
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +0 -31
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +0 -80
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +0 -1
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +0 -6
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +0 -11
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +0 -45
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +0 -571
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +0 -35
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +0 -479
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +0 -4
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +0 -5
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +0 -1
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +0 -7
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +0 -36
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +0 -14
- package/dist/components/inputs/Selection/Select/QuerySelect.js +0 -122
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +0 -9
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +0 -47
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +0 -6
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +0 -13
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +0 -3
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +0 -5
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +0 -5
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +0 -5
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +0 -23
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +0 -37
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +0 -1
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +0 -79
- package/dist/components/inputs/Skeleton/InputFrame.js +0 -526
- package/dist/components/inputs/shared/StaticInput.d.ts +0 -38
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +0 -4
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +0 -5
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +0 -14
- package/dist/components/inputs/shared/useStaticInputHandoff.js +0 -100
- package/dist/hooks/useQueryAutocomplete.d.ts +0 -14
- package/dist/hooks/useQueryAutocomplete.js +0 -57
- package/dist/utils/query.utils.d.ts +0 -4
- package/dist/utils/query.utils.js +0 -8
|
@@ -1,4 +1,19 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import { Key } from 'react-aria-components';
|
|
1
3
|
import { FieldValues } from 'react-hook-form';
|
|
2
|
-
import {
|
|
3
|
-
import { SelectItem } from '../shared/select.types';
|
|
4
|
-
|
|
4
|
+
import { AutocompleteProps } from './Autocomplete';
|
|
5
|
+
import { GroupedSelectControlProps, GroupedSelectProps, SelectItem } from '../shared/select.types';
|
|
6
|
+
import { OmitDiscriminatedUnion } from '../../../../types/common';
|
|
7
|
+
type QueryFn<TSelectItem extends SelectItem = SelectItem> = (...args: any) => UseQueryResult<Array<TSelectItem>>;
|
|
8
|
+
type TKey<TQueryFn extends QueryFn> = Exclude<ReturnType<TQueryFn>["data"], undefined>[0] extends {
|
|
9
|
+
id: infer InferredKey extends Key;
|
|
10
|
+
} ? InferredKey : never;
|
|
11
|
+
type QueryAutocompleteProps<TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn<TSelectItem>> = OmitDiscriminatedUnion<AutocompleteProps<TKey<TQueryFn>>, "items" | "onSearchChange" | "isLoading" | keyof GroupedSelectProps> & GroupedSelectControlProps<TFieldValues, TKey<TQueryFn>> & {
|
|
12
|
+
query: Parameters<TQueryFn>[0] extends {
|
|
13
|
+
search?: string;
|
|
14
|
+
} ? TQueryFn : never;
|
|
15
|
+
queryParams?: Omit<Parameters<TQueryFn>[0], "search">;
|
|
16
|
+
queryOptions?: Parameters<TQueryFn>[1];
|
|
17
|
+
};
|
|
18
|
+
export declare const QueryAutocomplete: <TFieldValues extends FieldValues, TSelectItem extends SelectItem<any>, TQueryFn extends QueryFn<TSelectItem>>({ query, queryParams, queryOptions, ...props }: QueryAutocompleteProps<TFieldValues, TSelectItem, TQueryFn>) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -1,45 +1,19 @@
|
|
|
1
|
-
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
2
1
|
import { Autocomplete } from "./Autocomplete.js";
|
|
3
|
-
import { getQueryItems } from "../shared/querySelect.utils.js";
|
|
4
|
-
import { useQueryAutocomplete } from "../../../../hooks/useQueryAutocomplete.js";
|
|
5
2
|
import { jsx } from "react/jsx-runtime";
|
|
6
3
|
import { useState } from "react";
|
|
7
4
|
//#region src/components/inputs/Selection/Autocomplete/QueryAutocomplete.tsx
|
|
8
|
-
var QueryAutocomplete = ({ query, queryParams, queryOptions,
|
|
9
|
-
"use no memo";
|
|
10
|
-
const ui = UIConfig.useConfig();
|
|
5
|
+
var QueryAutocomplete = ({ query, queryParams, queryOptions, ...props }) => {
|
|
11
6
|
const [search, setSearch] = useState("");
|
|
12
|
-
const {
|
|
13
|
-
const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete({
|
|
14
|
-
query,
|
|
15
|
-
queryParams,
|
|
16
|
-
queryOptions,
|
|
17
|
-
mapItems: (data) => getQueryItems(data, queryMap),
|
|
7
|
+
const { data: items, isLoading } = query({
|
|
18
8
|
search,
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
const handleChange = (value) => {
|
|
22
|
-
onChange?.(value);
|
|
23
|
-
props.onBlur?.({ target: { value: null } });
|
|
24
|
-
};
|
|
25
|
-
const { isInitialQueryDisabled: _, ...autocompleteProps } = restProps;
|
|
26
|
-
const onSearchChange = (value_0) => {
|
|
27
|
-
setSearch(value_0);
|
|
28
|
-
handleEnableQuery();
|
|
29
|
-
};
|
|
9
|
+
...queryParams
|
|
10
|
+
}, queryOptions);
|
|
30
11
|
return /* @__PURE__ */ jsx(Autocomplete, {
|
|
31
|
-
...
|
|
32
|
-
items,
|
|
33
|
-
|
|
34
|
-
onSearchChange,
|
|
12
|
+
...props,
|
|
13
|
+
items: items ?? [],
|
|
14
|
+
onSearchChange: setSearch,
|
|
35
15
|
isClientSearchDisabled: true,
|
|
36
|
-
isLoading
|
|
37
|
-
onChange: handleChange,
|
|
38
|
-
onMouseEnter: handleEnableQuery,
|
|
39
|
-
onFocusCapture: handleEnableQuery,
|
|
40
|
-
leadingContent,
|
|
41
|
-
hasLoadMore: hasNextPage,
|
|
42
|
-
onLoadMore: fetchNextPage
|
|
16
|
+
isLoading
|
|
43
17
|
});
|
|
44
18
|
};
|
|
45
19
|
//#endregion
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
1
|
import { Key } from 'react-aria-components';
|
|
3
2
|
import { FieldValues } from 'react-hook-form';
|
|
4
3
|
import { SelectBaseProps } from '../shared/SelectBase';
|
|
5
4
|
import { DefaultInitialSelectItem, GroupedSelectControlProps, GroupedSelectProps, SelectAsyncProps } from '../shared/select.types';
|
|
6
5
|
import { OmitDiscriminatedUnion } from '../../../../types/common';
|
|
7
|
-
export type SelectProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = OmitDiscriminatedUnion<SelectBaseProps<TKey, TInitialSelectItem>, keyof SelectAsyncProps
|
|
8
|
-
|
|
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;
|
|
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;
|
|
@@ -1,153 +1,26 @@
|
|
|
1
|
-
import { Typography } from "../../../text/Typography/Typography.js";
|
|
2
|
-
import { UIConfig } from "../../../../config/uiConfig.context.js";
|
|
3
|
-
import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
4
|
-
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
5
|
-
import { selectInputTagsContentWrapperCva } from "../shared/selectInput.cva.js";
|
|
6
1
|
import { SelectBase } from "../shared/SelectBase.js";
|
|
7
|
-
import {
|
|
8
|
-
import { getStaticSelectValue } from "../shared/staticSelect.utils.js";
|
|
9
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { clsx } from "clsx";
|
|
11
|
-
import { useRef, useState } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
3
|
import { mergeRefs } from "@react-aria/utils";
|
|
13
|
-
import { Controller
|
|
4
|
+
import { Controller } from "react-hook-form";
|
|
14
5
|
//#region src/components/inputs/Selection/Select/Select.tsx
|
|
15
|
-
|
|
6
|
+
var Select = (props) => {
|
|
16
7
|
if ("formControl" in props && props.formControl) {
|
|
17
8
|
const { formControl, ref, ...innerProps } = props;
|
|
18
9
|
return /* @__PURE__ */ jsx(Controller, {
|
|
19
10
|
control: formControl.control,
|
|
20
11
|
name: formControl.name,
|
|
21
|
-
render: ({ field, fieldState: { error
|
|
12
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsx(SelectBase, {
|
|
22
13
|
...innerProps,
|
|
23
14
|
ref: mergeRefs(ref, field.ref),
|
|
24
15
|
value: field.value,
|
|
25
16
|
onChange: field.onChange,
|
|
26
17
|
onBlur: field.onBlur,
|
|
27
|
-
isDirty,
|
|
28
18
|
isDisabled: field.disabled || props.isDisabled,
|
|
29
19
|
error: props.error ?? error?.message
|
|
30
20
|
})
|
|
31
21
|
});
|
|
32
22
|
}
|
|
33
23
|
return /* @__PURE__ */ jsx(SelectBase, { ...props });
|
|
34
|
-
}
|
|
35
|
-
function Select({ renderStaticInput, ...props }) {
|
|
36
|
-
const ui = UIConfig.useConfig();
|
|
37
|
-
const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
|
|
38
|
-
const rootRef = useRef(null);
|
|
39
|
-
const { renderRealInput, replayStaticInputChange, replayStaticInputPress } = useStaticInputHandoff({
|
|
40
|
-
inputRef: rootRef,
|
|
41
|
-
renderInput,
|
|
42
|
-
setRenderInput,
|
|
43
|
-
getFocusTarget: (root) => root.querySelector("[data-type='select-trigger'], input, button, [tabindex]")
|
|
44
|
-
});
|
|
45
|
-
const currentValue = ("formControl" in props && props.formControl ? useWatch({
|
|
46
|
-
control: props.formControl.control,
|
|
47
|
-
name: props.formControl.name
|
|
48
|
-
}) : props.value) ?? props.value;
|
|
49
|
-
let isFormControlDisabled = false;
|
|
50
|
-
if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
|
|
51
|
-
if (!renderInput && props.selectionMode !== "multiple" && !!props.showSelectionContent && currentValue != null) setRenderInput(true);
|
|
52
|
-
if (!renderInput && !!props.customTrigger) setRenderInput(true);
|
|
53
|
-
if (!renderInput) {
|
|
54
|
-
const as = props.as ?? ui.input.as;
|
|
55
|
-
const size = props.size ?? ui.input.size;
|
|
56
|
-
let isDisabled = !!props.isDisabled;
|
|
57
|
-
if (isFormControlDisabled) isDisabled = true;
|
|
58
|
-
const mode = props.selectionMode ?? ui.select.selectionMode;
|
|
59
|
-
const isMultiple = mode === "multiple";
|
|
60
|
-
const { selectedItem, displayValue, isEmpty } = getStaticSelectValue({
|
|
61
|
-
items: props.items,
|
|
62
|
-
value: currentValue,
|
|
63
|
-
selectionMode: mode,
|
|
64
|
-
initialSelection: props.initialSelection,
|
|
65
|
-
mapInitialToSelectItem: props.mapInitialToSelectItem,
|
|
66
|
-
showSelectionContent: props.showSelectionContent,
|
|
67
|
-
isDisabled,
|
|
68
|
-
collapseAfter: props.collapseAfter ?? ui.select.collapseAfter,
|
|
69
|
-
selectedTagsType: props.selectedTagsType ?? ui.select.selectedTagsType
|
|
70
|
-
});
|
|
71
|
-
const isSearchable = props.isSearchable ?? ui.select.isSearchable;
|
|
72
|
-
const trailingContent = /* @__PURE__ */ jsx(StaticSelectTrailingContent, {
|
|
73
|
-
trailingContent: props.trailingContent,
|
|
74
|
-
hideDropdownIcon: props.hideDropdownIcon,
|
|
75
|
-
isDisabled,
|
|
76
|
-
size
|
|
77
|
-
});
|
|
78
|
-
const placeholder = as === "floating" ? null : props.placeholder;
|
|
79
|
-
const inputValue = !isMultiple && selectedItem ? selectedItem.label : "";
|
|
80
|
-
const shouldRenderPlaceholderAfterValue = isMultiple && props.placeholder && !isEmpty;
|
|
81
|
-
const dataAttributes = {
|
|
82
|
-
dataIsEmpty: isEmpty,
|
|
83
|
-
dataIsFilled: !isEmpty,
|
|
84
|
-
dataIsDirty: props.isDirty,
|
|
85
|
-
dataIsRequired: props.isRequired,
|
|
86
|
-
dataIsDisabled: isDisabled,
|
|
87
|
-
dataDisabled: isDisabled,
|
|
88
|
-
dataInvalid: !!props.error,
|
|
89
|
-
dataHasSelection: !isEmpty,
|
|
90
|
-
dataHasSearch: false
|
|
91
|
-
};
|
|
92
|
-
const buttonContent = isMultiple && !isEmpty ? /* @__PURE__ */ jsx(Fragment, { children: "\xA0" }) : isEmpty ? /* @__PURE__ */ jsx(Typography, {
|
|
93
|
-
size: "label-1",
|
|
94
|
-
as: "span",
|
|
95
|
-
className: "block truncate text-text-default-3",
|
|
96
|
-
children: placeholder
|
|
97
|
-
}) : /* @__PURE__ */ jsx(Typography, {
|
|
98
|
-
size: "label-1",
|
|
99
|
-
as: "span",
|
|
100
|
-
className: "block truncate",
|
|
101
|
-
children: displayValue
|
|
102
|
-
});
|
|
103
|
-
return /* @__PURE__ */ jsx(InputFrame, {
|
|
104
|
-
...props,
|
|
105
|
-
isDisabled,
|
|
106
|
-
className: clsx("w-full", props.containerClassName),
|
|
107
|
-
inputClassName: clsx(props.className, props.inputClassName),
|
|
108
|
-
contentWrapperClassName: selectInputTagsContentWrapperCva({ isSearchable }),
|
|
109
|
-
typographySize: "label-1",
|
|
110
|
-
labelPlacement: "content-row",
|
|
111
|
-
dataAttributes,
|
|
112
|
-
renderStatic: true,
|
|
113
|
-
wrapTrailingContent: false,
|
|
114
|
-
onStaticInteract: renderRealInput,
|
|
115
|
-
leadingContent: props.leadingContent && /* @__PURE__ */ jsx("div", {
|
|
116
|
-
className: "ml-input-side-default flex shrink-0 items-center",
|
|
117
|
-
children: props.leadingContent
|
|
118
|
-
}),
|
|
119
|
-
showClear: false,
|
|
120
|
-
trailingContent,
|
|
121
|
-
children: (dataAttributeProps) => /* @__PURE__ */ jsxs(Fragment, { children: [isMultiple && !isEmpty && displayValue, isSearchable ? /* @__PURE__ */ jsx("input", {
|
|
122
|
-
disabled: isDisabled,
|
|
123
|
-
tabIndex: -1,
|
|
124
|
-
role: "combobox",
|
|
125
|
-
"aria-autocomplete": "list",
|
|
126
|
-
"aria-controls": `${dataAttributeProps.id}-listbox`,
|
|
127
|
-
"aria-expanded": false,
|
|
128
|
-
value: inputValue,
|
|
129
|
-
placeholder: shouldRenderPlaceholderAfterValue ? props.placeholder : placeholder ?? void 0,
|
|
130
|
-
className: clsx("w-full flex-1 bg-transparent text-label-1 outline-none placeholder:text-text-default-3 disabled:text-interactive-text-secondary-disabled", props.inputClassName),
|
|
131
|
-
onChange: (event) => replayStaticInputChange(event.target.value),
|
|
132
|
-
...dataAttributeProps,
|
|
133
|
-
"data-rac": true
|
|
134
|
-
}) : /* @__PURE__ */ jsx("button", {
|
|
135
|
-
type: "button",
|
|
136
|
-
disabled: isDisabled,
|
|
137
|
-
tabIndex: -1,
|
|
138
|
-
"data-type": "select-trigger",
|
|
139
|
-
className: clsx("w-full truncate bg-transparent text-start outline-none disabled:text-interactive-text-secondary-disabled", isMultiple && !isEmpty && "absolute inset-0 z-0"),
|
|
140
|
-
onPointerDown: replayStaticInputPress,
|
|
141
|
-
...dataAttributeProps,
|
|
142
|
-
"data-rac": true,
|
|
143
|
-
children: buttonContent
|
|
144
|
-
})] })
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
return /* @__PURE__ */ jsx(_Select, {
|
|
148
|
-
...props,
|
|
149
|
-
ref: mergeRefs(props.ref, rootRef)
|
|
150
|
-
});
|
|
151
|
-
}
|
|
24
|
+
};
|
|
152
25
|
//#endregion
|
|
153
26
|
export { Select };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement, 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';
|
|
@@ -7,28 +7,21 @@ import { InputVariantProps } from '../../shared/input.cva';
|
|
|
7
7
|
export type SelectBaseProps<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> = FormFieldProps & GroupedSelectProps<TKey, TInitialSelectItem> & SelectNewItemProps & SelectAsyncProps & SelectVirtualizationProps & InputVariantProps & Pick<AriaButtonProps, "onBlur"> & {
|
|
8
8
|
ref?: Ref<HTMLDivElement>;
|
|
9
9
|
className?: string;
|
|
10
|
-
isDirty?: boolean;
|
|
11
10
|
placeholder?: string;
|
|
12
11
|
hideDropdownIcon?: boolean;
|
|
13
12
|
hideSearchIcon?: boolean;
|
|
14
13
|
isSearchable?: boolean;
|
|
15
14
|
isClearable?: boolean;
|
|
16
15
|
isClientSearchDisabled?: boolean;
|
|
17
|
-
ignoreInputValueFiltering?: boolean;
|
|
18
16
|
ignoreTriggerWidth?: boolean;
|
|
19
17
|
items: SelectItem<TKey>[];
|
|
20
18
|
inputClassName?: string;
|
|
21
19
|
containerClassName?: string;
|
|
22
|
-
leadingContent?: ReactNode;
|
|
23
|
-
trailingContent?: ReactNode;
|
|
24
20
|
customTrigger?: ReactElement;
|
|
25
21
|
selectedTagsType?: "tags" | "list";
|
|
26
22
|
collapseAfter?: number;
|
|
27
|
-
fireBlurOnChange?: boolean;
|
|
28
23
|
onInputChange?: (value: string) => void;
|
|
29
24
|
onSearchChange?: (value: string) => void;
|
|
30
25
|
mapInitialToSelectItem?: (item: TInitialSelectItem) => SelectItem<TKey>;
|
|
31
|
-
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
32
|
-
onFocusCapture?: FocusEventHandler<HTMLDivElement>;
|
|
33
26
|
};
|
|
34
27
|
export declare const SelectBase: <TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>(dProps: SelectBaseProps<TKey, TInitialSelectItem>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,80 +3,29 @@ import { useBreakpoint } from "../../../../hooks/useBreakpoint.js";
|
|
|
3
3
|
import { SelectContext } from "./select.context.js";
|
|
4
4
|
import { SelectDesktop } from "./SelectDesktop.js";
|
|
5
5
|
import { SelectMobile } from "./SelectMobile.js";
|
|
6
|
-
import { c } from "react/compiler-runtime";
|
|
7
6
|
import { jsx } from "react/jsx-runtime";
|
|
8
7
|
//#region src/components/inputs/Selection/shared/SelectBase.tsx
|
|
9
8
|
var SelectBase = (dProps) => {
|
|
10
|
-
const $ = c(21);
|
|
11
9
|
const ui = UIConfig.useConfig();
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if ($[0] !== dProps || $[1] !== t0 || $[2] !== t1 || $[3] !== t10 || $[4] !== t11 || $[5] !== t12 || $[6] !== t2 || $[7] !== t3 || $[8] !== t4 || $[9] !== t5 || $[10] !== t6 || $[11] !== t7 || $[12] !== t8 || $[13] !== t9) {
|
|
27
|
-
t13 = {
|
|
28
|
-
...dProps,
|
|
29
|
-
selectionMode: t0,
|
|
30
|
-
variant: t1,
|
|
31
|
-
as: t2,
|
|
32
|
-
size: t3,
|
|
33
|
-
hideLabel: t4,
|
|
34
|
-
isClearable: t5,
|
|
35
|
-
isSearchable: t6,
|
|
36
|
-
selectedTagsType: t7,
|
|
37
|
-
ignoreTriggerWidth: t8,
|
|
38
|
-
collapseAfter: t9,
|
|
39
|
-
hideSearchIcon: t10,
|
|
40
|
-
fireBlurOnChange: t11,
|
|
41
|
-
isClientSearchDisabled: t12
|
|
42
|
-
};
|
|
43
|
-
$[0] = dProps;
|
|
44
|
-
$[1] = t0;
|
|
45
|
-
$[2] = t1;
|
|
46
|
-
$[3] = t10;
|
|
47
|
-
$[4] = t11;
|
|
48
|
-
$[5] = t12;
|
|
49
|
-
$[6] = t2;
|
|
50
|
-
$[7] = t3;
|
|
51
|
-
$[8] = t4;
|
|
52
|
-
$[9] = t5;
|
|
53
|
-
$[10] = t6;
|
|
54
|
-
$[11] = t7;
|
|
55
|
-
$[12] = t8;
|
|
56
|
-
$[13] = t9;
|
|
57
|
-
$[14] = t13;
|
|
58
|
-
} else t13 = $[14];
|
|
59
|
-
const props = t13;
|
|
10
|
+
const props = {
|
|
11
|
+
...dProps,
|
|
12
|
+
selectionMode: dProps.selectionMode ?? ui.select.selectionMode,
|
|
13
|
+
variant: dProps.variant ?? ui.input.variant,
|
|
14
|
+
as: dProps.as ?? ui.input.as,
|
|
15
|
+
size: dProps.size ?? ui.input.size,
|
|
16
|
+
hideLabel: dProps.hideLabel ?? ui.input.hideLabel,
|
|
17
|
+
isClearable: dProps.isClearable ?? ui.input.isClearable,
|
|
18
|
+
isSearchable: dProps.isSearchable ?? ui.select.isSearchable,
|
|
19
|
+
selectedTagsType: dProps.selectedTagsType ?? ui.select.selectedTagsType,
|
|
20
|
+
ignoreTriggerWidth: dProps.virtualizerOptions || dProps.items.length > 100 ? false : dProps.ignoreTriggerWidth ?? false,
|
|
21
|
+
collapseAfter: dProps.collapseAfter ?? ui.select.collapseAfter,
|
|
22
|
+
hideSearchIcon: dProps.hideSearchIcon ?? ui.select.hideSearchIcon
|
|
23
|
+
};
|
|
60
24
|
const isDesktop = useBreakpoint("md");
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
$[15] = isDesktop;
|
|
66
|
-
$[16] = props;
|
|
67
|
-
$[17] = t15;
|
|
68
|
-
} else t15 = $[17];
|
|
69
|
-
let t16;
|
|
70
|
-
if ($[18] !== t14 || $[19] !== t15) {
|
|
71
|
-
t16 = /* @__PURE__ */ jsx(SelectContext.Provider, {
|
|
72
|
-
...t14,
|
|
73
|
-
children: t15
|
|
74
|
-
});
|
|
75
|
-
$[18] = t14;
|
|
76
|
-
$[19] = t15;
|
|
77
|
-
$[20] = t16;
|
|
78
|
-
} else t16 = $[20];
|
|
79
|
-
return t16;
|
|
25
|
+
return /* @__PURE__ */ jsx(SelectContext.Provider, {
|
|
26
|
+
...props,
|
|
27
|
+
children: isDesktop ? /* @__PURE__ */ jsx(SelectDesktop, { ...props }) : /* @__PURE__ */ jsx(SelectMobile, { ...props })
|
|
28
|
+
});
|
|
80
29
|
};
|
|
81
30
|
//#endregion
|
|
82
31
|
export { SelectBase };
|
|
@@ -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,
|
|
4
|
+
export declare const SelectDesktop: <TKey extends Key = Key>({ ref, error, ignoreTriggerWidth, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, ...props }: SelectDesktopProps<TKey>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export {};
|