@povio/ui 3.3.0-rc.3 → 3.3.0
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/README.md +15 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +55 -206
- package/dist/components/buttons/Button/button.cva.d.ts +1 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +9 -34
- package/dist/components/buttons/shared/ButtonContent.js +22 -80
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +10 -24
- package/dist/components/inputs/Checkbox/CheckboxGroup.d.ts +5 -1
- package/dist/components/inputs/Checkbox/CheckboxGroup.js +234 -201
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +93 -227
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +170 -273
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +60 -147
- package/dist/components/inputs/DateTime/shared/Calendar.js +139 -339
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +114 -308
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +35 -150
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +95 -229
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +115 -296
- package/dist/components/inputs/DateTime/shared/DateField.js +135 -301
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +142 -338
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +10 -59
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +144 -134
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/useFirefoxDateSegmentSelectionGuard.js +33 -0
- package/dist/components/inputs/File/FileUpload.js +1 -1
- package/dist/components/inputs/File/InputUpload.js +65 -261
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +48 -180
- package/dist/components/inputs/File/shared/FileUploadContentError.js +95 -265
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +99 -261
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +56 -234
- package/dist/components/inputs/File/shared/ProgressBar.js +15 -102
- package/dist/components/inputs/FormField/FormField.js +34 -47
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +2 -1
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +77 -314
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +23 -83
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +56 -2
- package/dist/components/inputs/Selection/Select/QuerySelect.js +82 -94
- package/dist/components/inputs/Selection/Select/Select.js +3 -3
- package/dist/components/inputs/Selection/shared/SelectInput.js +1 -0
- package/dist/components/inputs/Selection/shared/SelectListBox.js +51 -163
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +1 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +1 -0
- package/dist/components/inputs/Selection/shared/select.context.js +19 -9
- package/dist/components/inputs/Selection/shared/useSelectItems.js +48 -108
- package/dist/components/inputs/Skeleton/InputFrame.js +177 -552
- package/dist/components/inputs/TextEditor/TextEditor.js +87 -389
- package/dist/components/inputs/shared/InputClear.js +24 -40
- package/dist/components/inputs/shared/input.cva.js +1 -1
- 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/overlays/ActionModal/ActionModal.js +35 -169
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +29 -110
- package/dist/components/shared/pagination/Pagination.js +22 -108
- package/dist/components/shared/pagination/minWidth.cva.d.ts +1 -1
- package/dist/components/status/Alert/Alert.js +30 -97
- package/dist/components/table/InfiniteTable.js +16 -67
- package/dist/components/table/Table.d.ts +2 -8
- package/dist/components/table/Table.js +33 -55
- package/dist/components/text/Typography/Typography.js +8 -23
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/theme.context.js +45 -98
- package/dist/config/uiConfig.context.d.ts +1 -0
- package/dist/config/uiConfig.context.js +10 -40
- package/dist/config/uiOverrides.context.d.ts +0 -1
- package/dist/helpers/dynamicColumns.js +2 -1
- package/dist/hooks/useDebounceCallback.js +17 -51
- package/dist/hooks/useFormAutosave.js +33 -120
- package/dist/hooks/useLongPressRepeat.js +20 -55
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/utils/date-time.utils.d.ts +0 -1
- package/dist/utils/date-time.utils.js +21 -45
- package/dist/utils/intl.utils.d.ts +7 -0
- package/dist/utils/intl.utils.js +38 -0
- package/dist/utils/intl.utils.spec.d.ts +1 -0
- package/package.json +2 -2
- package/dist/components/inputs/FormField/formField.cva.d.ts +0 -11
- package/dist/components/inputs/FormField/formField.cva.js +0 -16
- package/dist/components/table/TableColumnFilterInput.d.ts +0 -9
- package/dist/components/table/TableColumnFilterInput.js +0 -108
- package/dist/components/table/TableColumnFilterPlaceholder.d.ts +0 -5
- package/dist/components/table/TableColumnFilterPlaceholder.js +0 -41
- package/dist/components/table/TableColumnFilterRow.d.ts +0 -16
- package/dist/components/table/TableColumnFilterRow.js +0 -68
|
@@ -8,9 +8,7 @@ import { useState } from "react";
|
|
|
8
8
|
import { mergeRefs } from "@react-aria/utils";
|
|
9
9
|
import { Controller } from "react-hook-form";
|
|
10
10
|
//#region src/components/inputs/Selection/Select/QuerySelect.tsx
|
|
11
|
-
var
|
|
12
|
-
const $ = c(31);
|
|
13
|
-
const { query, queryParams, queryOptions, queryMap, resolveSelectedItemsWithIds, ...props } = t0;
|
|
11
|
+
var LoadedQuerySelectContent = ({ query, queryParams, queryOptions, queryMap, resolveSelectedItemsWithIds, isQueryEnabledInitially = false, ...props }) => {
|
|
14
12
|
const ui = UIConfig.useConfig();
|
|
15
13
|
const [search, setSearch] = useState("");
|
|
16
14
|
const isSearchable = props.isSearchable ?? ui.select.isSearchable;
|
|
@@ -21,101 +19,91 @@ var QuerySelectContent = (t0) => {
|
|
|
21
19
|
mapInitialToSelectItem: props.mapInitialToSelectItem
|
|
22
20
|
});
|
|
23
21
|
const shouldEnableInitialQuery = selectedIdsToResolve.count > 0;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
$[10] = t5;
|
|
54
|
-
} else t5 = $[10];
|
|
55
|
-
const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete(t5);
|
|
56
|
-
let onSearchChange;
|
|
57
|
-
let selectProps;
|
|
58
|
-
if ($[11] !== props) {
|
|
59
|
-
const { isInitialQueryDisabled: _, onSearchChange: t6, ...t7 } = props;
|
|
60
|
-
onSearchChange = t6;
|
|
61
|
-
selectProps = t7;
|
|
62
|
-
$[11] = props;
|
|
63
|
-
$[12] = onSearchChange;
|
|
64
|
-
$[13] = selectProps;
|
|
65
|
-
} else {
|
|
66
|
-
onSearchChange = $[12];
|
|
67
|
-
selectProps = $[13];
|
|
68
|
-
}
|
|
69
|
-
let t6;
|
|
70
|
-
if ($[14] !== handleEnableQuery || $[15] !== onSearchChange || $[16] !== setSearch) {
|
|
71
|
-
t6 = (value_0) => {
|
|
72
|
-
setSearch(value_0);
|
|
73
|
-
handleEnableQuery();
|
|
74
|
-
onSearchChange?.(value_0);
|
|
75
|
-
};
|
|
76
|
-
$[14] = handleEnableQuery;
|
|
77
|
-
$[15] = onSearchChange;
|
|
78
|
-
$[16] = setSearch;
|
|
79
|
-
$[17] = t6;
|
|
80
|
-
} else t6 = $[17];
|
|
81
|
-
const handleSearchChange = t6;
|
|
82
|
-
const t7 = props.searchDebounceDelay ?? ui.querySelect?.searchDebounceDelay;
|
|
83
|
-
let t8;
|
|
84
|
-
if ($[18] !== handleSearchChange || $[19] !== isSearchable) {
|
|
85
|
-
t8 = isSearchable && {
|
|
22
|
+
const isInitialQueryDisabled = props.isInitialQueryDisabled ?? ui.querySelect?.isInitialQueryDisabled;
|
|
23
|
+
const shouldDisableInitialQuery = !isQueryEnabledInitially && !shouldEnableInitialQuery && (selectedIdsToResolve.isResolvedByInitialSelection || isInitialQueryDisabled);
|
|
24
|
+
const { items, totalItems, isLoading, handleEnableQuery, hasNextPage, fetchNextPage } = useQueryAutocomplete({
|
|
25
|
+
query,
|
|
26
|
+
queryParams,
|
|
27
|
+
queryOptions,
|
|
28
|
+
mapItems: (data) => getQueryItems(data, queryMap),
|
|
29
|
+
resolveSelectedItemsWithIds: resolveSelectedItemsWithIds ?? ui.querySelect?.resolveSelectedItemsWithIds,
|
|
30
|
+
search: isSearchable ? search : void 0,
|
|
31
|
+
initialQueryState: shouldDisableInitialQuery,
|
|
32
|
+
selectedIdsToResolve: selectedIdsToResolve.items
|
|
33
|
+
});
|
|
34
|
+
const { isInitialQueryDisabled: _, onSearchChange, ...selectProps } = props;
|
|
35
|
+
const handleSearchChange = (value_0) => {
|
|
36
|
+
setSearch(value_0);
|
|
37
|
+
handleEnableQuery();
|
|
38
|
+
onSearchChange?.(value_0);
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ jsx(Select, {
|
|
41
|
+
...selectProps,
|
|
42
|
+
items,
|
|
43
|
+
isLoading,
|
|
44
|
+
totalItems,
|
|
45
|
+
hasLoadMore: hasNextPage,
|
|
46
|
+
onLoadMore: fetchNextPage,
|
|
47
|
+
searchDebounceDelay: props.searchDebounceDelay ?? ui.querySelect?.searchDebounceDelay,
|
|
48
|
+
onMouseEnter: handleEnableQuery,
|
|
49
|
+
onFocusCapture: handleEnableQuery,
|
|
50
|
+
...isSearchable && {
|
|
86
51
|
isClientSearchDisabled: true,
|
|
87
52
|
onSearchChange: handleSearchChange
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
var QuerySelectContent = (props) => {
|
|
57
|
+
const $ = c(9);
|
|
58
|
+
const [isQueryMounted, setIsQueryMounted] = useState(false);
|
|
59
|
+
const value = "value" in props ? props.value : void 0;
|
|
60
|
+
if (!getSelectionIdsToResolve({
|
|
61
|
+
initialSelection: props.initialSelection,
|
|
62
|
+
value,
|
|
63
|
+
mapInitialToSelectItem: props.mapInitialToSelectItem
|
|
64
|
+
}).isResolvedByInitialSelection || isQueryMounted) {
|
|
65
|
+
let t0;
|
|
66
|
+
if ($[0] !== isQueryMounted || $[1] !== props) {
|
|
67
|
+
t0 = /* @__PURE__ */ jsx(LoadedQuerySelectContent, {
|
|
68
|
+
...props,
|
|
69
|
+
isQueryEnabledInitially: isQueryMounted
|
|
70
|
+
});
|
|
71
|
+
$[0] = isQueryMounted;
|
|
72
|
+
$[1] = props;
|
|
73
|
+
$[2] = t0;
|
|
74
|
+
} else t0 = $[2];
|
|
75
|
+
return t0;
|
|
76
|
+
}
|
|
77
|
+
let selectProps;
|
|
78
|
+
if ($[3] !== props) {
|
|
79
|
+
const { query: _, queryParams: _queryParams, queryOptions: _queryOptions, queryMap: _queryMap, resolveSelectedItemsWithIds: _resolveSelectedItemsWithIds, isInitialQueryDisabled: _isInitialQueryDisabled, ...t0 } = props;
|
|
80
|
+
selectProps = t0;
|
|
81
|
+
$[3] = props;
|
|
82
|
+
$[4] = selectProps;
|
|
83
|
+
} else selectProps = $[4];
|
|
84
|
+
let t0;
|
|
85
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
86
|
+
t0 = () => setIsQueryMounted(true);
|
|
87
|
+
$[5] = t0;
|
|
88
|
+
} else t0 = $[5];
|
|
89
|
+
const mountQuery = t0;
|
|
90
|
+
let t1;
|
|
91
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
92
|
+
t1 = [];
|
|
93
|
+
$[6] = t1;
|
|
94
|
+
} else t1 = $[6];
|
|
95
|
+
let t2;
|
|
96
|
+
if ($[7] !== selectProps) {
|
|
97
|
+
t2 = /* @__PURE__ */ jsx(Select, {
|
|
96
98
|
...selectProps,
|
|
97
|
-
items,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
hasLoadMore: hasNextPage,
|
|
101
|
-
onLoadMore: fetchNextPage,
|
|
102
|
-
searchDebounceDelay: t7,
|
|
103
|
-
onMouseEnter: handleEnableQuery,
|
|
104
|
-
onFocusCapture: handleEnableQuery,
|
|
105
|
-
...t8
|
|
99
|
+
items: t1,
|
|
100
|
+
onMouseEnter: mountQuery,
|
|
101
|
+
onFocusCapture: mountQuery
|
|
106
102
|
});
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
$[25] = items;
|
|
112
|
-
$[26] = selectProps;
|
|
113
|
-
$[27] = t7;
|
|
114
|
-
$[28] = t8;
|
|
115
|
-
$[29] = totalItems;
|
|
116
|
-
$[30] = t9;
|
|
117
|
-
} else t9 = $[30];
|
|
118
|
-
return t9;
|
|
103
|
+
$[7] = selectProps;
|
|
104
|
+
$[8] = t2;
|
|
105
|
+
} else t2 = $[8];
|
|
106
|
+
return t2;
|
|
119
107
|
};
|
|
120
108
|
var QuerySelect = (props) => {
|
|
121
109
|
const $ = c(16);
|
|
@@ -77,12 +77,12 @@ function SelectInner(t0) {
|
|
|
77
77
|
};
|
|
78
78
|
const buttonContent = isMultiple && !isEmpty ? /* @__PURE__ */ jsx(Fragment, { children: "\xA0" }) : isEmpty ? /* @__PURE__ */ jsx(Typography, {
|
|
79
79
|
size: "label-1",
|
|
80
|
-
as: "
|
|
80
|
+
as: "span",
|
|
81
81
|
className: "block truncate text-text-default-3",
|
|
82
|
-
children: placeholder
|
|
82
|
+
children: placeholder
|
|
83
83
|
}) : /* @__PURE__ */ jsx(Typography, {
|
|
84
84
|
size: "label-1",
|
|
85
|
-
as: "
|
|
85
|
+
as: "span",
|
|
86
86
|
className: "block truncate",
|
|
87
87
|
children: displayValue
|
|
88
88
|
});
|
|
@@ -313,6 +313,7 @@ var SelectInput = (t0) => {
|
|
|
313
313
|
...fieldProps,
|
|
314
314
|
children: [(as === "floating" && isEmpty || isMultiple && !isEmpty) && /* @__PURE__ */ jsx(Fragment, { children: "\xA0" }), (isEmpty || !isMultiple) && (as !== "floating" || !isEmpty) && /* @__PURE__ */ jsxs(Typography, {
|
|
315
315
|
size: "label-1",
|
|
316
|
+
as: "span",
|
|
316
317
|
className: clsx("truncate empty:before:inline-block empty:before:content-['']", isEmpty && "text-text-default-3 group-disabled/select-trigger:text-interactive-text-secondary-disabled"),
|
|
317
318
|
children: [isEmpty && placeholder, !isEmpty && (showSelectionContent ? selectedItems[0].content : selectedItems[0].label)]
|
|
318
319
|
})]
|
|
@@ -3,185 +3,73 @@ import { SelectContext } from "./select.context.js";
|
|
|
3
3
|
import { SelectListBoxItem } from "./SelectListBoxItem.js";
|
|
4
4
|
import { SelectListBoxItemSelectAll } from "./SelectListBoxItemSelectAll.js";
|
|
5
5
|
import { SelectListBoxLoadingItem } from "./SelectListBoxLoadingItem.js";
|
|
6
|
-
import { c } from "react/compiler-runtime";
|
|
7
6
|
import { jsx } from "react/jsx-runtime";
|
|
8
7
|
import { clsx } from "clsx";
|
|
9
8
|
import { ListBox, ListLayout, Virtualizer } from "react-aria-components";
|
|
10
9
|
//#region src/components/inputs/Selection/shared/SelectListBox.tsx
|
|
11
|
-
var SelectListBox = (
|
|
12
|
-
const $ = c(51);
|
|
13
|
-
let className;
|
|
14
|
-
let isSearchable;
|
|
15
|
-
let label;
|
|
16
|
-
let newItemRender;
|
|
17
|
-
let onClose;
|
|
18
|
-
let onLoadMore;
|
|
19
|
-
let props;
|
|
20
|
-
let selectionMode;
|
|
21
|
-
let t1;
|
|
22
|
-
let totalItems;
|
|
23
|
-
let virtualizerOptions;
|
|
24
|
-
if ($[0] !== t0) {
|
|
25
|
-
({label, selectionMode, isSearchable, isScrollable: t1, virtualizerOptions, totalItems, newItemRender, onLoadMore, className, onClose, ...props} = t0);
|
|
26
|
-
$[0] = t0;
|
|
27
|
-
$[1] = className;
|
|
28
|
-
$[2] = isSearchable;
|
|
29
|
-
$[3] = label;
|
|
30
|
-
$[4] = newItemRender;
|
|
31
|
-
$[5] = onClose;
|
|
32
|
-
$[6] = onLoadMore;
|
|
33
|
-
$[7] = props;
|
|
34
|
-
$[8] = selectionMode;
|
|
35
|
-
$[9] = t1;
|
|
36
|
-
$[10] = totalItems;
|
|
37
|
-
$[11] = virtualizerOptions;
|
|
38
|
-
} else {
|
|
39
|
-
className = $[1];
|
|
40
|
-
isSearchable = $[2];
|
|
41
|
-
label = $[3];
|
|
42
|
-
newItemRender = $[4];
|
|
43
|
-
onClose = $[5];
|
|
44
|
-
onLoadMore = $[6];
|
|
45
|
-
props = $[7];
|
|
46
|
-
selectionMode = $[8];
|
|
47
|
-
t1 = $[9];
|
|
48
|
-
totalItems = $[10];
|
|
49
|
-
virtualizerOptions = $[11];
|
|
50
|
-
}
|
|
51
|
-
const isScrollable = t1 === void 0 ? true : t1;
|
|
10
|
+
var SelectListBox = ({ label, selectionMode, isSearchable, isScrollable = true, virtualizerOptions, totalItems, newItemRender, onLoadMore, className, onClose, ...props }) => {
|
|
52
11
|
const { fieldState, onChange, listItems, selectableListItems, selectedIds, isMultiple, onClear, onSelectAll, hasLoadMore } = SelectContext.useSelect();
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!isMultiple && ids.length === 0) {
|
|
58
|
-
if (fieldState.value) {
|
|
59
|
-
onClose?.();
|
|
60
|
-
onChange(fieldState.value);
|
|
61
|
-
}
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (isMultiple && ids.includes("all-item-id")) {
|
|
65
|
-
if (ids.length > selectableListItems.length) onClear();
|
|
66
|
-
else onSelectAll();
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (isMultiple) onChange(ids);
|
|
70
|
-
else {
|
|
12
|
+
const onSelectionChange = (value) => {
|
|
13
|
+
const ids = Array.from(value);
|
|
14
|
+
if (!isMultiple && ids.length === 0) {
|
|
15
|
+
if (fieldState.value) {
|
|
71
16
|
onClose?.();
|
|
72
|
-
onChange(
|
|
17
|
+
onChange(fieldState.value);
|
|
73
18
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
} else t3 = $[23];
|
|
105
|
-
const renderItem = t3;
|
|
106
|
-
if (virtualizerOptions || (totalItems ?? listItems.length) > 100 || hasLoadMore) {
|
|
107
|
-
const t4 = isScrollable ? "max-h-full overflow-y-auto overflow-x-hidden" : "overflow-hidden";
|
|
108
|
-
let t5;
|
|
109
|
-
if ($[24] !== className || $[25] !== t4) {
|
|
110
|
-
t5 = clsx("flex-1 outline-none [&>div:last-child>*]:border-b-0", t4, className);
|
|
111
|
-
$[24] = className;
|
|
112
|
-
$[25] = t4;
|
|
113
|
-
$[26] = t5;
|
|
114
|
-
} else t5 = $[26];
|
|
115
|
-
let t6;
|
|
116
|
-
if ($[27] !== label || $[28] !== listItems || $[29] !== onSelectionChange || $[30] !== props || $[31] !== renderItem || $[32] !== selectedIds || $[33] !== selectionMode || $[34] !== t5) {
|
|
117
|
-
t6 = /* @__PURE__ */ jsx(ListBox, {
|
|
118
|
-
...props,
|
|
119
|
-
"aria-label": label,
|
|
120
|
-
selectionMode,
|
|
121
|
-
className: t5,
|
|
122
|
-
items: listItems,
|
|
123
|
-
selectedKeys: selectedIds,
|
|
124
|
-
onSelectionChange,
|
|
125
|
-
escapeKeyBehavior: "none",
|
|
126
|
-
shouldSelectOnPressUp: true,
|
|
127
|
-
children: renderItem
|
|
128
|
-
});
|
|
129
|
-
$[27] = label;
|
|
130
|
-
$[28] = listItems;
|
|
131
|
-
$[29] = onSelectionChange;
|
|
132
|
-
$[30] = props;
|
|
133
|
-
$[31] = renderItem;
|
|
134
|
-
$[32] = selectedIds;
|
|
135
|
-
$[33] = selectionMode;
|
|
136
|
-
$[34] = t5;
|
|
137
|
-
$[35] = t6;
|
|
138
|
-
} else t6 = $[35];
|
|
139
|
-
let t7;
|
|
140
|
-
if ($[36] !== t6 || $[37] !== virtualizerOptions) {
|
|
141
|
-
t7 = /* @__PURE__ */ jsx(Virtualizer, {
|
|
142
|
-
layout: ListLayout,
|
|
143
|
-
layoutOptions: virtualizerOptions,
|
|
144
|
-
children: t6
|
|
145
|
-
});
|
|
146
|
-
$[36] = t6;
|
|
147
|
-
$[37] = virtualizerOptions;
|
|
148
|
-
$[38] = t7;
|
|
149
|
-
} else t7 = $[38];
|
|
150
|
-
return t7;
|
|
151
|
-
}
|
|
152
|
-
const t4 = isScrollable ? "max-h-full overflow-y-auto overflow-x-hidden" : "overflow-hidden";
|
|
153
|
-
let t5;
|
|
154
|
-
if ($[39] !== className || $[40] !== t4) {
|
|
155
|
-
t5 = clsx("flex-1 outline-none [&>div:last-child]:border-b-0", t4, className);
|
|
156
|
-
$[39] = className;
|
|
157
|
-
$[40] = t4;
|
|
158
|
-
$[41] = t5;
|
|
159
|
-
} else t5 = $[41];
|
|
160
|
-
let t6;
|
|
161
|
-
if ($[42] !== label || $[43] !== listItems || $[44] !== onSelectionChange || $[45] !== props || $[46] !== renderItem || $[47] !== selectedIds || $[48] !== selectionMode || $[49] !== t5) {
|
|
162
|
-
t6 = /* @__PURE__ */ jsx(ListBox, {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (isMultiple && ids.includes("all-item-id")) {
|
|
22
|
+
if (ids.length > selectableListItems.length) onClear();
|
|
23
|
+
else onSelectAll();
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (isMultiple) onChange(ids);
|
|
27
|
+
else {
|
|
28
|
+
onClose?.();
|
|
29
|
+
onChange(ids[0]);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const renderItem = (item) => {
|
|
33
|
+
if (item.isSelectAllItem) return /* @__PURE__ */ jsx(SelectListBoxItemSelectAll, { ...item }, item.id);
|
|
34
|
+
if (item.isLoadingItem) return /* @__PURE__ */ jsx(SelectListBoxLoadingItem, {
|
|
35
|
+
...item,
|
|
36
|
+
onLoadMore
|
|
37
|
+
}, item.id);
|
|
38
|
+
return /* @__PURE__ */ jsx(SelectListBoxItem, {
|
|
39
|
+
...item,
|
|
40
|
+
isSearchable,
|
|
41
|
+
isNewItem: item.isNewItem,
|
|
42
|
+
newItemRender
|
|
43
|
+
}, item.id);
|
|
44
|
+
};
|
|
45
|
+
if (virtualizerOptions || (totalItems ?? listItems.length) > 100 || hasLoadMore) return /* @__PURE__ */ jsx(Virtualizer, {
|
|
46
|
+
layout: ListLayout,
|
|
47
|
+
layoutOptions: virtualizerOptions,
|
|
48
|
+
children: /* @__PURE__ */ jsx(ListBox, {
|
|
163
49
|
...props,
|
|
164
50
|
"aria-label": label,
|
|
165
51
|
selectionMode,
|
|
166
|
-
className:
|
|
52
|
+
className: clsx("flex-1 outline-none [&>div:last-child>*]:border-b-0", isScrollable ? "max-h-full overflow-y-auto overflow-x-hidden" : "overflow-hidden", className),
|
|
167
53
|
items: listItems,
|
|
168
54
|
selectedKeys: selectedIds,
|
|
169
55
|
onSelectionChange,
|
|
170
56
|
escapeKeyBehavior: "none",
|
|
171
57
|
shouldSelectOnPressUp: true,
|
|
172
58
|
children: renderItem
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
return /* @__PURE__ */ jsx(ListBox, {
|
|
62
|
+
...props,
|
|
63
|
+
"aria-label": label,
|
|
64
|
+
selectionMode,
|
|
65
|
+
className: clsx("flex-1 outline-none [&>div:last-child]:border-b-0", isScrollable ? "max-h-full overflow-y-auto overflow-x-hidden" : "overflow-hidden", className),
|
|
66
|
+
items: listItems,
|
|
67
|
+
selectedKeys: selectedIds,
|
|
68
|
+
onSelectionChange,
|
|
69
|
+
escapeKeyBehavior: "none",
|
|
70
|
+
shouldSelectOnPressUp: true,
|
|
71
|
+
children: renderItem
|
|
72
|
+
});
|
|
185
73
|
};
|
|
186
74
|
//#endregion
|
|
187
75
|
export { SelectListBox };
|
|
@@ -9,6 +9,7 @@ export declare const getSelectionIdsToResolve: <TInitialSelectItem, TKey extends
|
|
|
9
9
|
mapInitialToSelectItem?: (item: TInitialSelectItem) => SelectItem<TKey>;
|
|
10
10
|
}) => {
|
|
11
11
|
count: number;
|
|
12
|
+
isResolvedByInitialSelection: boolean;
|
|
12
13
|
items: TKey[];
|
|
13
14
|
};
|
|
14
15
|
export declare const getQueryItems: <TQueryFn extends QueryFn, TKey extends Key = Key>(data: QueryDataType<TQueryFn> | undefined, queryMap?: (data: QueryDataType<TQueryFn>) => SelectItem<TKey>[]) => SelectItem<TKey>[];
|
|
@@ -26,6 +26,7 @@ var getSelectionIdsToResolve = ({ initialSelection, value, mapInitialToSelectIte
|
|
|
26
26
|
const items = Array.from(new Set([...missingLabelInitialSelectionIds, ...values.filter((id) => !labeledInitialSelectionIds.has(id))]));
|
|
27
27
|
return {
|
|
28
28
|
count: items.length,
|
|
29
|
+
isResolvedByInitialSelection: values.length > 0 && values.every((id) => labeledInitialSelectionIds.has(id)),
|
|
29
30
|
items
|
|
30
31
|
};
|
|
31
32
|
};
|
|
@@ -135,16 +135,26 @@ var SelectContext;
|
|
|
135
135
|
triggerBlurOnChange
|
|
136
136
|
]);
|
|
137
137
|
const onClear = useCallback(() => {
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
...
|
|
141
|
-
inputValue: ""
|
|
142
|
-
|
|
138
|
+
if (selectedIds.length === 0) {
|
|
139
|
+
const newFieldState_2 = {
|
|
140
|
+
...fieldState,
|
|
141
|
+
inputValue: "",
|
|
142
|
+
searchValue: ""
|
|
143
|
+
};
|
|
144
|
+
setFieldState(newFieldState_2);
|
|
145
|
+
emitStateChanges(newFieldState_2, true);
|
|
146
|
+
setShowAll(true);
|
|
143
147
|
return;
|
|
144
148
|
}
|
|
145
149
|
if (isMultiple) onChange([]);
|
|
146
150
|
else onChange(null);
|
|
147
|
-
}, [
|
|
151
|
+
}, [
|
|
152
|
+
emitStateChanges,
|
|
153
|
+
fieldState,
|
|
154
|
+
isMultiple,
|
|
155
|
+
onChange,
|
|
156
|
+
selectedIds.length
|
|
157
|
+
]);
|
|
148
158
|
const onSelectAll = useCallback(() => {
|
|
149
159
|
onChange(selectableListItems.map(({ id: id_4 }) => id_4));
|
|
150
160
|
}, [selectableListItems, onChange]);
|
|
@@ -157,13 +167,13 @@ var SelectContext;
|
|
|
157
167
|
]);
|
|
158
168
|
const onBlur = useCallback(() => {
|
|
159
169
|
if (props.isSearchable && isMultiple && fieldState.searchValue !== "") {
|
|
160
|
-
const
|
|
170
|
+
const newFieldState_3 = {
|
|
161
171
|
...fieldState,
|
|
162
172
|
inputValue: "",
|
|
163
173
|
searchValue: ""
|
|
164
174
|
};
|
|
165
|
-
setFieldState(
|
|
166
|
-
emitStateChanges(
|
|
175
|
+
setFieldState(newFieldState_3);
|
|
176
|
+
emitStateChanges(newFieldState_3);
|
|
167
177
|
setShowAll(true);
|
|
168
178
|
}
|
|
169
179
|
fieldOnBlur?.({});
|