@povio/ui 3.1.0 → 3.2.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/dist/assets/icons/AlignCenter.js +26 -11
- package/dist/assets/icons/AlignLeft.js +26 -11
- package/dist/assets/icons/AlignLeftRight.js +26 -11
- package/dist/assets/icons/AlignRight.js +26 -11
- package/dist/assets/icons/ArrowDropDown.js +26 -11
- package/dist/assets/icons/ArrowDropUp.js +26 -11
- package/dist/assets/icons/ArrowLeft.js +26 -11
- package/dist/assets/icons/ArrowRight.js +26 -11
- package/dist/assets/icons/Bold.js +26 -11
- package/dist/assets/icons/BulletedList.js +26 -11
- package/dist/assets/icons/Calendar.js +28 -13
- package/dist/assets/icons/Check.js +28 -13
- package/dist/assets/icons/CheckCircle.js +26 -11
- package/dist/assets/icons/CheckboxCheckmark.js +29 -14
- package/dist/assets/icons/CheckboxIndeterminate.js +29 -14
- package/dist/assets/icons/ChevronDown.js +28 -13
- package/dist/assets/icons/ChevronLeft.js +28 -13
- package/dist/assets/icons/ChevronRight.js +28 -13
- package/dist/assets/icons/ChevronUp.js +28 -13
- package/dist/assets/icons/ChevronsLeft.js +28 -13
- package/dist/assets/icons/ChevronsRight.js +28 -13
- package/dist/assets/icons/Clock.js +26 -11
- package/dist/assets/icons/Close.js +26 -11
- package/dist/assets/icons/DateTime.js +35 -14
- package/dist/assets/icons/DragIndicator.js +26 -11
- package/dist/assets/icons/File.js +28 -13
- package/dist/assets/icons/Highlight.js +26 -11
- package/dist/assets/icons/HighlightOn.js +49 -15
- package/dist/assets/icons/Home.js +26 -11
- package/dist/assets/icons/Info.js +37 -16
- package/dist/assets/icons/Italic.js +26 -11
- package/dist/assets/icons/Link.js +26 -11
- package/dist/assets/icons/Menu.js +26 -11
- package/dist/assets/icons/NumberedList.js +26 -11
- package/dist/assets/icons/PointerHorizontal.js +26 -11
- package/dist/assets/icons/PointerVertical.js +26 -11
- package/dist/assets/icons/Search.js +26 -11
- package/dist/assets/icons/Send.js +28 -13
- package/dist/assets/icons/Strikethrough.js +26 -11
- package/dist/assets/icons/TextColor.js +48 -14
- package/dist/assets/icons/Today.js +26 -11
- package/dist/assets/icons/Underlined.js +28 -13
- package/dist/assets/icons/Upload.js +35 -14
- package/dist/assets/icons/Visibility.js +26 -11
- package/dist/assets/icons/VisibilityOff.js +26 -11
- package/dist/assets/icons/WarningFilled.js +28 -13
- package/dist/components/Breadcrumbs/Breadcrumbs.js +207 -56
- package/dist/components/Menu/Menu.js +18 -2
- package/dist/components/Menu/MenuDesktop.js +41 -7
- package/dist/components/Menu/MenuItem.js +32 -9
- package/dist/components/Menu/MenuMobile.js +102 -39
- package/dist/components/Menu/MenuPopover.js +105 -29
- package/dist/components/buttons/Button/button.cva.d.ts +3 -3
- package/dist/components/buttons/IconButton/IconButton.js +40 -8
- package/dist/components/buttons/InlineIconButton/InlineIconButton.d.ts +2 -1
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +34 -9
- package/dist/components/buttons/PillButton/PillButton.js +55 -17
- package/dist/components/buttons/PillButton/pillButton.cva.d.ts +1 -1
- package/dist/components/buttons/SplitButton/SplitButton.js +103 -18
- package/dist/components/buttons/TextButton/TextButton.js +30 -8
- package/dist/components/buttons/ToggleButton/ToggleButton.js +28 -8
- package/dist/components/buttons/shared/ButtonContent.js +80 -22
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/inputs/Checkbox/Checkbox.js +201 -35
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
- package/dist/components/inputs/Checkbox/checkbox.cva.d.ts +3 -0
- package/dist/components/inputs/Checkbox/checkbox.cva.js +2 -1
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +380 -75
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +12 -5
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +499 -186
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +14 -5
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +280 -46
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +7 -3
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +616 -121
- package/dist/components/inputs/DateTime/shared/Calendar.d.ts +5 -2
- package/dist/components/inputs/DateTime/shared/Calendar.js +342 -119
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +4 -2
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +310 -103
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +4 -2
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +150 -33
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +233 -98
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
- package/dist/components/inputs/DateTime/shared/DateField.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DateField.js +288 -112
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +14 -3
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +359 -129
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.d.ts +18 -1
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +104 -11
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +83 -28
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
- package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +4 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +211 -65
- package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
- package/dist/components/inputs/DateTime/shared/datePicker.types.d.ts +5 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.d.ts +16 -0
- package/dist/components/inputs/DateTime/shared/datePickerInput.cva.js +16 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.d.ts +15 -0
- package/dist/components/inputs/DateTime/shared/datePickerTodayIcon.js +32 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.d.ts +2 -0
- package/dist/components/inputs/DateTime/shared/dateSegment.utils.spec.d.ts +1 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.d.ts +41 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.js +99 -0
- package/dist/components/inputs/DateTime/shared/staticDateTimeSegments.spec.d.ts +1 -0
- package/dist/components/inputs/File/FileUpload.js +91 -46
- package/dist/components/inputs/File/FileUploadContainer.js +15 -7
- package/dist/components/inputs/File/InputUpload.js +317 -79
- package/dist/components/inputs/File/index.d.ts +1 -1
- package/dist/components/inputs/File/shared/FileCard.js +104 -41
- package/dist/components/inputs/File/shared/FileCardList.js +47 -12
- package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
- package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
- package/dist/components/inputs/File/shared/InputUploadContent.js +148 -34
- package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
- package/dist/components/inputs/File/shared/ProgressBar.js +102 -15
- package/dist/components/inputs/File/shared/fileUpload.cva.d.ts +0 -11
- package/dist/components/inputs/File/shared/fileUpload.cva.js +1 -18
- package/dist/components/inputs/FormField/FormField.d.ts +3 -3
- package/dist/components/inputs/FormField/FormField.js +119 -37
- package/dist/components/inputs/FormField/FormFieldError.js +25 -5
- package/dist/components/inputs/FormField/FormFieldHeader.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldHeader.js +81 -22
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
- package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
- package/dist/components/inputs/FormField/FormFieldLabel.d.ts +2 -2
- package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
- package/dist/components/inputs/FormField/formFieldHeader.cva.d.ts +13 -0
- package/dist/components/inputs/FormField/formFieldHeader.cva.js +14 -0
- package/dist/components/inputs/Input/NumberInput/NumberInput.d.ts +5 -2
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +446 -97
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.d.ts +45 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +571 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.d.ts +35 -0
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +574 -0
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
- package/dist/components/inputs/Input/TextArea/TextArea.cva.d.ts +8 -0
- package/dist/components/inputs/Input/TextArea/TextArea.cva.js +5 -0
- package/dist/components/inputs/Input/TextArea/TextArea.js +305 -90
- package/dist/components/inputs/Input/TextInput/TextInput.d.ts +3 -1
- package/dist/components/inputs/Input/TextInput/TextInput.js +429 -90
- package/dist/components/inputs/Input/shared/InputContent.js +193 -59
- package/dist/components/inputs/Input/shared/numberStatic.utils.d.ts +1 -0
- package/dist/components/inputs/Input/shared/numberStatic.utils.js +7 -0
- package/dist/components/inputs/Inputs/Form.js +40 -11
- package/dist/components/inputs/Inputs/InputItem.d.ts +15 -21
- package/dist/components/inputs/Inputs/InputItem.js +69 -14
- package/dist/components/inputs/Inputs/Inputs.js +37 -11
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +3 -1
- package/dist/components/inputs/RadioGroup/RadioGroup.js +353 -61
- package/dist/components/inputs/RadioGroup/radio.cva.d.ts +45 -0
- package/dist/components/inputs/RadioGroup/radio.cva.js +48 -1
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.d.ts +6 -2
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +217 -22
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.d.ts +3 -18
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +107 -8
- package/dist/components/inputs/Selection/Autocomplete/queryAutocomplete.types.d.ts +37 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.d.ts +14 -0
- package/dist/components/inputs/Selection/Select/QuerySelect.js +178 -0
- package/dist/components/inputs/Selection/Select/Select.d.ts +7 -3
- package/dist/components/inputs/Selection/Select/Select.js +227 -18
- package/dist/components/inputs/Selection/shared/SelectBase.d.ts +8 -1
- package/dist/components/inputs/Selection/shared/SelectBase.js +69 -18
- package/dist/components/inputs/Selection/shared/SelectDesktop.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +393 -138
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +397 -116
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
- package/dist/components/inputs/Selection/shared/SelectListBox.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectListBox.js +164 -52
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
- package/dist/components/inputs/Selection/shared/SelectMobile.d.ts +1 -1
- package/dist/components/inputs/Selection/shared/SelectMobile.js +9 -3
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.d.ts +14 -0
- package/dist/components/inputs/Selection/shared/querySelect.utils.js +43 -0
- package/dist/components/inputs/Selection/shared/select.context.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/select.context.js +67 -36
- package/dist/components/inputs/Selection/shared/select.types.d.ts +3 -2
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.d.ts +6 -0
- package/dist/components/inputs/Selection/shared/selectDesktop.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +12 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +8 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.d.ts +23 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.js +54 -0
- package/dist/components/inputs/Selection/shared/staticSelect.utils.spec.d.ts +1 -0
- package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +83 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +612 -0
- package/dist/components/inputs/Slider/Slider.d.ts +2 -1
- package/dist/components/inputs/Slider/Slider.js +265 -76
- package/dist/components/inputs/TextEditor/TextEditor.d.ts +1 -0
- package/dist/components/inputs/TextEditor/TextEditor.js +447 -98
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
- package/dist/components/inputs/Toggle/Toggle.d.ts +1 -0
- package/dist/components/inputs/Toggle/Toggle.js +214 -37
- package/dist/components/inputs/Toggle/toggle.cva.d.ts +3 -0
- package/dist/components/inputs/Toggle/toggle.cva.js +2 -1
- package/dist/components/inputs/shared/CheckContent.d.ts +2 -1
- package/dist/components/inputs/shared/CheckContent.js +21 -11
- package/dist/components/inputs/shared/InputClear.d.ts +2 -1
- package/dist/components/inputs/shared/InputClear.js +88 -12
- package/dist/components/inputs/shared/TooltipWrapper.js +50 -11
- package/dist/components/inputs/shared/input.cva.d.ts +28 -0
- package/dist/components/inputs/shared/input.cva.js +38 -4
- package/dist/components/inputs/shared/tooltipWrapper.cva.d.ts +8 -0
- package/dist/components/inputs/shared/tooltipWrapper.cva.js +5 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +15 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +112 -0
- package/dist/components/navigation/Accordion/Accordion.js +69 -22
- package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
- package/dist/components/navigation/Stepper/Stepper.js +67 -22
- package/dist/components/navigation/Stepper/StepperItem.js +104 -31
- package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
- package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
- package/dist/components/overlays/BottomSheet/BottomSheet.js +96 -23
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
- package/dist/components/overlays/Drawer/Drawer.js +62 -20
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +85 -28
- package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
- package/dist/components/segment/Segment.js +218 -57
- package/dist/components/segment/SegmentItem.js +67 -10
- package/dist/components/shared/pagination/Pagination.js +108 -22
- package/dist/components/shared/pagination/PaginationList.js +167 -64
- package/dist/components/shared/pagination/minWidth.cva.d.ts +1 -1
- package/dist/components/status/Alert/Alert.js +97 -30
- package/dist/components/status/Loader/Loader.js +77 -22
- package/dist/components/status/Toast/Toast.js +28 -14
- package/dist/components/status/Toast/toast.cva.d.ts +1 -1
- package/dist/components/status/Toast/useToast.js +62 -57
- package/dist/components/table/ColumnConfig.js +158 -54
- package/dist/components/table/InfiniteTable.js +67 -16
- package/dist/components/table/PaginatedTable.js +84 -18
- package/dist/components/table/Table.js +28 -27
- package/dist/components/text/Link/Link.js +19 -7
- package/dist/components/text/Typography/Typography.js +23 -8
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/link.context.js +23 -9
- package/dist/config/router.context.js +42 -16
- package/dist/config/theme.context.js +98 -45
- package/dist/config/uiConfig.context.d.ts +20 -6
- package/dist/config/uiConfig.context.js +68 -14
- package/dist/config/uiOverrides.context.d.ts +30 -11
- package/dist/config/uiOverrides.context.js +54 -14
- package/dist/helpers/dynamicInputs.d.ts +12 -9
- package/dist/helpers/dynamicInputs.js +13 -8
- package/dist/hooks/useAutosave.d.ts +2 -1
- package/dist/hooks/useAutosave.js +12 -4
- package/dist/hooks/useAutosave.spec.d.ts +1 -0
- package/dist/hooks/useBreakpoint.js +16 -3
- package/dist/hooks/useDebounceCallback.js +51 -17
- package/dist/hooks/useFilters.js +125 -64
- package/dist/hooks/useForm.js +42 -8
- package/dist/hooks/useFormAutosave.d.ts +3 -1
- package/dist/hooks/useFormAutosave.js +122 -30
- package/dist/hooks/useFormAutosave.spec.d.ts +1 -0
- package/dist/hooks/useIntersectionObserver.d.ts +1 -1
- package/dist/hooks/useIntersectionObserver.js +91 -24
- package/dist/hooks/useKeyInteractions.d.ts +20 -0
- package/dist/hooks/useKeyInteractions.js +54 -0
- package/dist/hooks/useKeyInteractions.spec.d.ts +1 -0
- package/dist/hooks/useLocalStorage.js +43 -10
- package/dist/hooks/useLongPressRepeat.js +55 -20
- package/dist/hooks/usePagination.js +49 -19
- package/dist/hooks/useQueryAutocomplete.d.ts +14 -0
- package/dist/hooks/useQueryAutocomplete.js +72 -0
- package/dist/hooks/useScrollableListBox.js +37 -16
- package/dist/hooks/useSorting.js +69 -28
- package/dist/hooks/useStateAndRef.js +21 -7
- package/dist/hooks/useTableColumnConfig.js +124 -31
- package/dist/hooks/useTranslationMemo.js +25 -5
- package/dist/index.d.ts +18 -3
- package/dist/index.js +15 -5
- package/dist/tw-ui-plugin.js +6 -0
- package/dist/utils/date-time.utils.d.ts +38 -10
- package/dist/utils/date-time.utils.js +136 -22
- package/dist/utils/query.utils.d.ts +4 -0
- package/dist/utils/query.utils.js +8 -0
- package/dist/utils/zod.utils.d.ts +2 -0
- package/dist/utils/zod.utils.js +5 -0
- package/package.json +2 -2
|
@@ -1,27 +1,76 @@
|
|
|
1
1
|
import "../../../../config/i18n.js";
|
|
2
2
|
import { TextButton } from "../../../buttons/TextButton/TextButton.js";
|
|
3
3
|
import { SelectContext } from "./select.context.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
import { clsx } from "clsx";
|
|
6
7
|
import { useTranslation } from "react-i18next";
|
|
7
8
|
//#region src/components/inputs/Selection/shared/SelectListBoxSelectionBar.tsx
|
|
8
|
-
var SelectListBoxSelectionBar = (
|
|
9
|
+
var SelectListBoxSelectionBar = (t0) => {
|
|
10
|
+
const $ = c(16);
|
|
11
|
+
const { className } = t0;
|
|
9
12
|
const { t } = useTranslation("ui");
|
|
10
13
|
const { onClear, onSelectAll } = SelectContext.useSelect();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
let t1;
|
|
15
|
+
if ($[0] !== className) {
|
|
16
|
+
t1 = clsx("flex items-center justify-between border-elevation-outline-default-1 border-b px-4 py-3", className);
|
|
17
|
+
$[0] = className;
|
|
18
|
+
$[1] = t1;
|
|
19
|
+
} else t1 = $[1];
|
|
20
|
+
let t2;
|
|
21
|
+
if ($[2] !== t) {
|
|
22
|
+
t2 = t(_temp);
|
|
23
|
+
$[2] = t;
|
|
24
|
+
$[3] = t2;
|
|
25
|
+
} else t2 = $[3];
|
|
26
|
+
let t3;
|
|
27
|
+
if ($[4] !== onSelectAll || $[5] !== t2) {
|
|
28
|
+
t3 = /* @__PURE__ */ jsx(TextButton, {
|
|
14
29
|
type: "button",
|
|
15
30
|
color: "primary",
|
|
16
31
|
onPress: onSelectAll,
|
|
17
|
-
children:
|
|
18
|
-
})
|
|
32
|
+
children: t2
|
|
33
|
+
});
|
|
34
|
+
$[4] = onSelectAll;
|
|
35
|
+
$[5] = t2;
|
|
36
|
+
$[6] = t3;
|
|
37
|
+
} else t3 = $[6];
|
|
38
|
+
let t4;
|
|
39
|
+
if ($[7] !== t) {
|
|
40
|
+
t4 = t(_temp2);
|
|
41
|
+
$[7] = t;
|
|
42
|
+
$[8] = t4;
|
|
43
|
+
} else t4 = $[8];
|
|
44
|
+
let t5;
|
|
45
|
+
if ($[9] !== onClear || $[10] !== t4) {
|
|
46
|
+
t5 = /* @__PURE__ */ jsx(TextButton, {
|
|
19
47
|
type: "button",
|
|
20
48
|
color: "secondary",
|
|
21
49
|
onPress: onClear,
|
|
22
|
-
children:
|
|
23
|
-
})
|
|
24
|
-
|
|
50
|
+
children: t4
|
|
51
|
+
});
|
|
52
|
+
$[9] = onClear;
|
|
53
|
+
$[10] = t4;
|
|
54
|
+
$[11] = t5;
|
|
55
|
+
} else t5 = $[11];
|
|
56
|
+
let t6;
|
|
57
|
+
if ($[12] !== t1 || $[13] !== t3 || $[14] !== t5) {
|
|
58
|
+
t6 = /* @__PURE__ */ jsxs("div", {
|
|
59
|
+
className: t1,
|
|
60
|
+
children: [t3, t5]
|
|
61
|
+
});
|
|
62
|
+
$[12] = t1;
|
|
63
|
+
$[13] = t3;
|
|
64
|
+
$[14] = t5;
|
|
65
|
+
$[15] = t6;
|
|
66
|
+
} else t6 = $[15];
|
|
67
|
+
return t6;
|
|
25
68
|
};
|
|
69
|
+
function _temp($) {
|
|
70
|
+
return $.ui.select.selectAll;
|
|
71
|
+
}
|
|
72
|
+
function _temp2($_0) {
|
|
73
|
+
return $_0.ui.select.clearSelection;
|
|
74
|
+
}
|
|
26
75
|
//#endregion
|
|
27
76
|
export { SelectListBoxSelectionBar };
|
|
@@ -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, bottomSheetProps, ...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, bottomSheetProps, ...props }: SelectMobileProps<TKey>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export {};
|
|
@@ -13,8 +13,8 @@ import { useRef } from "react";
|
|
|
13
13
|
import { DialogTrigger } from "react-aria-components";
|
|
14
14
|
import { useLabel } from "react-aria";
|
|
15
15
|
//#region src/components/inputs/Selection/shared/SelectMobile.tsx
|
|
16
|
-
var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containerClassName, customTrigger, onBlur, bottomSheetProps, ...props }) => {
|
|
17
|
-
const { label, tooltipText, helperText, isRequired, rightContent, isHeaderHidden, headerClassName, errorClassName, placeholder, variant, isDisabled, className, hideLabel, hideDropdownIcon, hideSearchIcon, isSearchable, isClearable, as, size, collapseAfter, selectedTagsType } = props;
|
|
16
|
+
var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containerClassName, leadingContent, trailingContent, customTrigger, onBlur, onMouseEnter, onFocusCapture, bottomSheetProps, ...props }) => {
|
|
17
|
+
const { label, tooltipText, helperText, isDirty, isRequired, rightContent, isHeaderHidden, headerClassName, errorClassName, placeholder, variant, isDisabled, className, hideLabel, hideDropdownIcon, hideSearchIcon, isSearchable, isClearable, as, size, collapseAfter, selectedTagsType } = props;
|
|
18
18
|
const formFieldProps = {
|
|
19
19
|
error,
|
|
20
20
|
label,
|
|
@@ -57,6 +57,8 @@ var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containe
|
|
|
57
57
|
as,
|
|
58
58
|
labelProps,
|
|
59
59
|
className: clsx("group w-full", containerClassName),
|
|
60
|
+
onMouseEnter,
|
|
61
|
+
onFocusCapture,
|
|
60
62
|
children: /* @__PURE__ */ jsxs(DialogTrigger, {
|
|
61
63
|
...dialogTriggerProps,
|
|
62
64
|
children: [customTrigger ? /* @__PURE__ */ jsx("div", {
|
|
@@ -79,8 +81,12 @@ var SelectMobile = ({ ref, error, showSelectionContent, inputClassName, containe
|
|
|
79
81
|
onBlur: void 0,
|
|
80
82
|
fieldProps,
|
|
81
83
|
headerProps,
|
|
84
|
+
leadingContent,
|
|
85
|
+
trailingContent,
|
|
82
86
|
collapseAfter,
|
|
83
|
-
selectedTagsType
|
|
87
|
+
selectedTagsType,
|
|
88
|
+
isRequired,
|
|
89
|
+
isDirty
|
|
84
90
|
}), /* @__PURE__ */ jsx(BottomSheet, {
|
|
85
91
|
isDismissable: true,
|
|
86
92
|
hideHeader: isSearchable,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { InputVariantProps } from '../../shared/input.cva';
|
|
3
|
+
interface StaticSelectTrailingContentProps extends Pick<InputVariantProps, "size"> {
|
|
4
|
+
trailingContent?: ReactNode;
|
|
5
|
+
hideDropdownIcon?: boolean;
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const StaticSelectTrailingContent: ({ trailingContent, hideDropdownIcon, isDisabled, size, }: StaticSelectTrailingContentProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ArrowDropDownIcon } from "../../../../assets/icons/ArrowDropDown.js";
|
|
2
|
+
import { UIOverrides } from "../../../../config/uiOverrides.context.js";
|
|
3
|
+
import { inputSizeDefinition } from "../../shared/input.cva.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { clsx } from "clsx";
|
|
7
|
+
//#region src/components/inputs/Selection/shared/StaticSelectTrailingContent.tsx
|
|
8
|
+
var StaticSelectTrailingContent = (t0) => {
|
|
9
|
+
const $ = c(10);
|
|
10
|
+
const { trailingContent, hideDropdownIcon, isDisabled, size } = t0;
|
|
11
|
+
const inputSizeCva = UIOverrides.useCva("input.sizeCva", inputSizeDefinition);
|
|
12
|
+
if (!trailingContent && hideDropdownIcon) return null;
|
|
13
|
+
let t1;
|
|
14
|
+
if ($[0] !== trailingContent) {
|
|
15
|
+
t1 = trailingContent && /* @__PURE__ */ jsx("div", {
|
|
16
|
+
className: "flex shrink-0 items-center",
|
|
17
|
+
children: trailingContent
|
|
18
|
+
});
|
|
19
|
+
$[0] = trailingContent;
|
|
20
|
+
$[1] = t1;
|
|
21
|
+
} else t1 = $[1];
|
|
22
|
+
let t2;
|
|
23
|
+
if ($[2] !== hideDropdownIcon || $[3] !== inputSizeCva || $[4] !== isDisabled || $[5] !== size) {
|
|
24
|
+
t2 = !hideDropdownIcon ? /* @__PURE__ */ jsx("button", {
|
|
25
|
+
type: "button",
|
|
26
|
+
tabIndex: -1,
|
|
27
|
+
className: clsx("self-stretch border-0! pl-1-5 outline-none", inputSizeCva({ size })),
|
|
28
|
+
"aria-hidden": "true",
|
|
29
|
+
children: /* @__PURE__ */ jsx(ArrowDropDownIcon, { className: clsx("size-6 shrink-0", isDisabled ? "text-interactive-text-secondary-disabled" : "text-interactive-text-secondary-idle") })
|
|
30
|
+
}) : void 0;
|
|
31
|
+
$[2] = hideDropdownIcon;
|
|
32
|
+
$[3] = inputSizeCva;
|
|
33
|
+
$[4] = isDisabled;
|
|
34
|
+
$[5] = size;
|
|
35
|
+
$[6] = t2;
|
|
36
|
+
} else t2 = $[6];
|
|
37
|
+
let t3;
|
|
38
|
+
if ($[7] !== t1 || $[8] !== t2) {
|
|
39
|
+
t3 = /* @__PURE__ */ jsxs(Fragment, { children: [t1, t2] });
|
|
40
|
+
$[7] = t1;
|
|
41
|
+
$[8] = t2;
|
|
42
|
+
$[9] = t3;
|
|
43
|
+
} else t3 = $[9];
|
|
44
|
+
return t3;
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { StaticSelectTrailingContent };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UseInfiniteQueryResult, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import { Key } from 'react-aria-components';
|
|
3
|
+
import { SelectItem } from './select.types';
|
|
4
|
+
export type QueryFn<TData = any> = (...args: any[]) => UseQueryResult<TData> | UseInfiniteQueryResult<TData>;
|
|
5
|
+
export type QueryDataType<TQueryFn extends QueryFn> = Exclude<ReturnType<TQueryFn>["data"], undefined>;
|
|
6
|
+
export declare const getSelectionIdsToResolve: <TInitialSelectItem, TKey extends Key = Key>({ initialSelection, value, mapInitialToSelectItem, }: {
|
|
7
|
+
initialSelection: TInitialSelectItem | TInitialSelectItem[] | null | undefined;
|
|
8
|
+
value: TKey | TKey[] | null | undefined;
|
|
9
|
+
mapInitialToSelectItem?: (item: TInitialSelectItem) => SelectItem<TKey>;
|
|
10
|
+
}) => {
|
|
11
|
+
count: number;
|
|
12
|
+
items: TKey[];
|
|
13
|
+
};
|
|
14
|
+
export declare const getQueryItems: <TQueryFn extends QueryFn, TKey extends Key = Key>(data: QueryDataType<TQueryFn> | undefined, queryMap?: (data: QueryDataType<TQueryFn>) => SelectItem<TKey>[]) => SelectItem<TKey>[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/components/inputs/Selection/shared/querySelect.utils.ts
|
|
2
|
+
var getDefaultInitialSelectionLabel = (initialSelection) => {
|
|
3
|
+
if (typeof initialSelection !== "object" || initialSelection === null) return "";
|
|
4
|
+
if ("label" in initialSelection && typeof initialSelection.label === "string") return initialSelection.label;
|
|
5
|
+
if ("name" in initialSelection && typeof initialSelection.name === "string") return initialSelection.name;
|
|
6
|
+
return "";
|
|
7
|
+
};
|
|
8
|
+
var getInitialSelectionItems = (initialSelection) => {
|
|
9
|
+
return Array.isArray(initialSelection) ? initialSelection : initialSelection != null ? [initialSelection] : [];
|
|
10
|
+
};
|
|
11
|
+
var getInitialSelectionLabel = (initialSelection, mapInitialToSelectItem) => mapInitialToSelectItem?.(initialSelection).label ?? getDefaultInitialSelectionLabel(initialSelection);
|
|
12
|
+
var getSelectionIdsToResolve = ({ initialSelection, value, mapInitialToSelectItem }) => {
|
|
13
|
+
const values = Array.isArray(value) ? value : value != null ? [value] : [];
|
|
14
|
+
const initialSelections = getInitialSelectionItems(initialSelection);
|
|
15
|
+
const labeledInitialSelectionIds = /* @__PURE__ */ new Set();
|
|
16
|
+
const missingLabelInitialSelectionIds = [];
|
|
17
|
+
initialSelections.forEach((item) => {
|
|
18
|
+
const id = (mapInitialToSelectItem?.(item))?.id ?? item.id;
|
|
19
|
+
if (id == null) return;
|
|
20
|
+
if (getInitialSelectionLabel(item, mapInitialToSelectItem) === "") {
|
|
21
|
+
missingLabelInitialSelectionIds.push(id);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
labeledInitialSelectionIds.add(id);
|
|
25
|
+
});
|
|
26
|
+
const items = Array.from(new Set([...missingLabelInitialSelectionIds, ...values.filter((id) => !labeledInitialSelectionIds.has(id))]));
|
|
27
|
+
return {
|
|
28
|
+
count: items.length,
|
|
29
|
+
items
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
var getQueryItems = (data, queryMap) => {
|
|
33
|
+
if (!data) return [];
|
|
34
|
+
if (queryMap) return queryMap(data);
|
|
35
|
+
if (Array.isArray(data)) return data;
|
|
36
|
+
if (typeof data === "object" && data !== null) {
|
|
37
|
+
if ("items" in data && Array.isArray(data.items)) return data.items;
|
|
38
|
+
if ("pages" in data && Array.isArray(data.pages)) return data.pages.flatMap((page) => page && typeof page === "object" && "items" in page && Array.isArray(page.items) ? page.items : []);
|
|
39
|
+
}
|
|
40
|
+
return [];
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { getQueryItems, getSelectionIdsToResolve };
|
|
@@ -17,14 +17,15 @@ export declare namespace SelectContext {
|
|
|
17
17
|
onClear: () => void;
|
|
18
18
|
onSelectAll: () => void;
|
|
19
19
|
onRemove: (val: Key) => void;
|
|
20
|
+
onBlur: () => void;
|
|
20
21
|
listItems: ExtendedSelectItem[];
|
|
21
22
|
selectableListItems: SelectItem[];
|
|
22
23
|
selectedItems: SelectItem[];
|
|
23
24
|
selectedIds: Key[];
|
|
24
25
|
isMultiple: boolean;
|
|
25
26
|
} & Pick<SelectBaseProps, "onInputChange" | "isLoading" | "hasLoadMore">;
|
|
26
|
-
export type ProviderProps = GroupedSelectProps & Pick<SelectBaseProps, "items" | "onInputChange" | "onSearchChange" | "showSelectAllOption" | "showNewItemOption" | "newItemMinLength" | "onNewItemOption" | "isLoading" | "hasLoadMore" | "mapInitialToSelectItem" | "isSearchable" | "isClientSearchDisabled">;
|
|
27
|
-
export const Provider: ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, children, mapInitialToSelectItem, ...props }: PropsWithChildren<ProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export type ProviderProps = GroupedSelectProps & Pick<SelectBaseProps, "items" | "onInputChange" | "onSearchChange" | "showSelectAllOption" | "showNewItemOption" | "newItemMinLength" | "onNewItemOption" | "isLoading" | "hasLoadMore" | "mapInitialToSelectItem" | "isSearchable" | "isClientSearchDisabled" | "ignoreInputValueFiltering" | "fireBlurOnChange" | "onBlur">;
|
|
28
|
+
export const Provider: ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, ignoreInputValueFiltering, fireBlurOnChange, onBlur: fieldOnBlur, children, mapInitialToSelectItem, ...props }: PropsWithChildren<ProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
export const useSelect: () => Type;
|
|
29
30
|
export {};
|
|
30
31
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useSelectItems } from "./useSelectItems.js";
|
|
2
1
|
import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
|
|
2
|
+
import { useSelectItems } from "./useSelectItems.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { createContext, use, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
5
|
//#region src/components/inputs/Selection/shared/select.context.tsx
|
|
@@ -10,7 +10,7 @@ var SelectContext;
|
|
|
10
10
|
id: item.id,
|
|
11
11
|
label: item.label ?? item.name ?? ""
|
|
12
12
|
});
|
|
13
|
-
_SelectContext.Provider = ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, children, mapInitialToSelectItem = defaultMapInitialToSelectItem, ...props }) => {
|
|
13
|
+
_SelectContext.Provider = ({ items, onInputChange, onSearchChange, showSelectAllOption, showNewItemOption, newItemMinLength, onNewItemOption, isLoading, hasLoadMore, isClientSearchDisabled, ignoreInputValueFiltering, fireBlurOnChange, onBlur: fieldOnBlur, children, mapInitialToSelectItem = defaultMapInitialToSelectItem, ...props }) => {
|
|
14
14
|
const isMultiple = props.selectionMode === "multiple";
|
|
15
15
|
const initialSelectedItems = useMemo(() => {
|
|
16
16
|
if (!props.initialSelection) return null;
|
|
@@ -42,24 +42,31 @@ var SelectContext;
|
|
|
42
42
|
newItemMinLength,
|
|
43
43
|
isLoading,
|
|
44
44
|
hasLoadMore,
|
|
45
|
-
isClientSearchDisabled
|
|
45
|
+
isClientSearchDisabled: ignoreInputValueFiltering ?? isClientSearchDisabled
|
|
46
46
|
});
|
|
47
|
-
const selectedItems = useMemo(() =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, [
|
|
54
|
-
const
|
|
47
|
+
const selectedItems = useMemo(() => {
|
|
48
|
+
const getItem = (id) => allItems.find((item) => item.id === id) ?? null;
|
|
49
|
+
if (Array.isArray(fieldState.value)) return fieldState.value.map((id_0) => getItem(id_0)).filter((item_0) => item_0 !== null);
|
|
50
|
+
const selectedItem = fieldState.value != null ? getItem(fieldState.value) : null;
|
|
51
|
+
return selectedItem ? [selectedItem] : [];
|
|
52
|
+
}, [allItems, fieldState.value]);
|
|
53
|
+
const selectedIds = useMemo(() => selectedItems.map(({ id: id_1 }) => id_1), [selectedItems]);
|
|
54
|
+
const getItem_0 = useCallback((value) => allItems.find((item_1) => item_1 && item_1.id === value) ?? null, [allItems]);
|
|
55
|
+
const updateValue = useCallback((value_0) => {
|
|
56
|
+
if (Array.isArray(value_0)) valueRef.current = value_0.map((id_2) => getItem_0(id_2)).filter((item_2) => item_2 !== null);
|
|
57
|
+
else valueRef.current = getItem_0(value_0);
|
|
58
|
+
}, [getItem_0]);
|
|
59
|
+
const getValueIds = () => Array.isArray(valueRef.current) ? valueRef.current.map(({ id: id_3 }) => id_3) : valueRef.current?.id ?? null;
|
|
55
60
|
const emitStateChanges = useCallback((changes, skipSelectionChange) => {
|
|
56
|
-
|
|
61
|
+
const valueChanged = JSON.stringify(changes.value) !== JSON.stringify(getValueIds());
|
|
62
|
+
if (valueChanged) {
|
|
57
63
|
updateValue(changes.value);
|
|
58
64
|
if (!skipSelectionChange) if (isMultiple) props.onChange?.(changes.value);
|
|
59
65
|
else props.onChange?.(changes.value);
|
|
60
66
|
}
|
|
61
67
|
if (changes.inputValue !== fieldState.inputValue) onInputChange?.(changes.inputValue);
|
|
62
68
|
if (changes.searchValue !== fieldState.searchValue) onSearchChangeDebounced?.(changes.searchValue);
|
|
69
|
+
return valueChanged;
|
|
63
70
|
}, [
|
|
64
71
|
fieldState,
|
|
65
72
|
isMultiple,
|
|
@@ -68,10 +75,13 @@ var SelectContext;
|
|
|
68
75
|
onSearchChangeDebounced,
|
|
69
76
|
updateValue
|
|
70
77
|
]);
|
|
71
|
-
const
|
|
78
|
+
const triggerBlurOnChange = useCallback(() => {
|
|
79
|
+
if (fireBlurOnChange) fieldOnBlur?.({});
|
|
80
|
+
}, [fireBlurOnChange, fieldOnBlur]);
|
|
81
|
+
const syncFieldState = (value_1) => {
|
|
72
82
|
const newFieldState = {
|
|
73
|
-
value,
|
|
74
|
-
inputValue: isMultiple || Array.isArray(
|
|
83
|
+
value: value_1,
|
|
84
|
+
inputValue: isMultiple || Array.isArray(value_1) ? fieldState.inputValue : getItem_0(value_1)?.label ?? "",
|
|
75
85
|
searchValue: ""
|
|
76
86
|
};
|
|
77
87
|
setFieldState(newFieldState);
|
|
@@ -79,21 +89,21 @@ var SelectContext;
|
|
|
79
89
|
if (!isMultiple) setShowAll(true);
|
|
80
90
|
};
|
|
81
91
|
useEffect(() => {
|
|
82
|
-
const
|
|
83
|
-
if (JSON.stringify(
|
|
84
|
-
else updateValue(
|
|
92
|
+
const value_2 = props.value ?? null;
|
|
93
|
+
if (JSON.stringify(value_2) !== JSON.stringify(fieldState.value)) syncFieldState(value_2);
|
|
94
|
+
else updateValue(value_2);
|
|
85
95
|
}, [props.value]);
|
|
86
96
|
useEffect(() => {
|
|
87
|
-
if (!isMultiple && fieldState.value && fieldState.inputValue === "" &&
|
|
97
|
+
if (!isMultiple && props.value !== null && props.value !== void 0 && fieldState.value !== null && fieldState.value !== void 0 && fieldState.inputValue === "" && getItem_0(fieldState.value)?.label) syncFieldState(fieldState.value);
|
|
88
98
|
}, [allListItems]);
|
|
89
99
|
const handleInputChange = useCallback((inputValue) => {
|
|
90
|
-
const
|
|
100
|
+
const newFieldState_0 = {
|
|
91
101
|
value: isMultiple || inputValue !== "" ? fieldState.value : null,
|
|
92
102
|
inputValue,
|
|
93
103
|
searchValue: inputValue
|
|
94
104
|
};
|
|
95
|
-
setFieldState(
|
|
96
|
-
emitStateChanges(
|
|
105
|
+
setFieldState(newFieldState_0);
|
|
106
|
+
emitStateChanges(newFieldState_0);
|
|
97
107
|
setShowAll(false);
|
|
98
108
|
if (!isOpen && inputValue !== "" && props.isSearchable) setIsOpen(true);
|
|
99
109
|
}, [
|
|
@@ -101,16 +111,16 @@ var SelectContext;
|
|
|
101
111
|
fieldState.value,
|
|
102
112
|
isMultiple
|
|
103
113
|
]);
|
|
104
|
-
const onChange = useCallback((
|
|
105
|
-
if (
|
|
114
|
+
const onChange = useCallback((value_3) => {
|
|
115
|
+
if (value_3 === "new-item-id") onNewItemOption?.(fieldState.inputValue);
|
|
106
116
|
else {
|
|
107
|
-
const
|
|
108
|
-
value,
|
|
109
|
-
inputValue: isMultiple || Array.isArray(
|
|
117
|
+
const newFieldState_1 = {
|
|
118
|
+
value: value_3,
|
|
119
|
+
inputValue: isMultiple || Array.isArray(value_3) ? "" : getItem_0(value_3)?.label ?? "",
|
|
110
120
|
searchValue: ""
|
|
111
121
|
};
|
|
112
|
-
setFieldState(
|
|
113
|
-
emitStateChanges(
|
|
122
|
+
setFieldState(newFieldState_1);
|
|
123
|
+
if (emitStateChanges(newFieldState_1)) triggerBlurOnChange();
|
|
114
124
|
}
|
|
115
125
|
if (!isMultiple) {
|
|
116
126
|
setIsOpen(false);
|
|
@@ -120,8 +130,9 @@ var SelectContext;
|
|
|
120
130
|
emitStateChanges,
|
|
121
131
|
onNewItemOption,
|
|
122
132
|
fieldState.inputValue,
|
|
123
|
-
|
|
124
|
-
isMultiple
|
|
133
|
+
getItem_0,
|
|
134
|
+
isMultiple,
|
|
135
|
+
triggerBlurOnChange
|
|
125
136
|
]);
|
|
126
137
|
const onClear = useCallback(() => {
|
|
127
138
|
if (!valueRef.current || Array.isArray(valueRef.current) && valueRef.current.length === 0) {
|
|
@@ -135,16 +146,34 @@ var SelectContext;
|
|
|
135
146
|
else onChange(null);
|
|
136
147
|
}, [isMultiple, onChange]);
|
|
137
148
|
const onSelectAll = useCallback(() => {
|
|
138
|
-
onChange(selectableListItems.map(({ id }) =>
|
|
149
|
+
onChange(selectableListItems.map(({ id: id_4 }) => id_4));
|
|
139
150
|
}, [selectableListItems, onChange]);
|
|
140
|
-
const onRemove = useCallback((
|
|
141
|
-
if (isMultiple && Array.isArray(fieldState.value)) onChange(fieldState.value.filter((
|
|
151
|
+
const onRemove = useCallback((value_4) => {
|
|
152
|
+
if (isMultiple && Array.isArray(fieldState.value)) onChange(fieldState.value.filter((id_5) => id_5 !== value_4));
|
|
142
153
|
}, [
|
|
143
154
|
isMultiple,
|
|
144
155
|
fieldState.value,
|
|
145
156
|
onChange
|
|
146
157
|
]);
|
|
147
|
-
const
|
|
158
|
+
const onBlur = useCallback(() => {
|
|
159
|
+
if (props.isSearchable && isMultiple && fieldState.searchValue !== "") {
|
|
160
|
+
const newFieldState_2 = {
|
|
161
|
+
...fieldState,
|
|
162
|
+
inputValue: "",
|
|
163
|
+
searchValue: ""
|
|
164
|
+
};
|
|
165
|
+
setFieldState(newFieldState_2);
|
|
166
|
+
emitStateChanges(newFieldState_2);
|
|
167
|
+
setShowAll(true);
|
|
168
|
+
}
|
|
169
|
+
fieldOnBlur?.({});
|
|
170
|
+
}, [
|
|
171
|
+
props.isSearchable,
|
|
172
|
+
isMultiple,
|
|
173
|
+
fieldState,
|
|
174
|
+
fieldOnBlur
|
|
175
|
+
]);
|
|
176
|
+
const value_5 = useMemo(() => ({
|
|
148
177
|
fieldState,
|
|
149
178
|
isOpen,
|
|
150
179
|
setIsOpen,
|
|
@@ -154,6 +183,7 @@ var SelectContext;
|
|
|
154
183
|
onClear,
|
|
155
184
|
onSelectAll,
|
|
156
185
|
onRemove,
|
|
186
|
+
onBlur,
|
|
157
187
|
listItems,
|
|
158
188
|
selectableListItems,
|
|
159
189
|
selectedItems,
|
|
@@ -171,6 +201,7 @@ var SelectContext;
|
|
|
171
201
|
onClear,
|
|
172
202
|
onSelectAll,
|
|
173
203
|
onRemove,
|
|
204
|
+
onBlur,
|
|
174
205
|
listItems,
|
|
175
206
|
selectableListItems,
|
|
176
207
|
selectedIds,
|
|
@@ -180,7 +211,7 @@ var SelectContext;
|
|
|
180
211
|
hasLoadMore
|
|
181
212
|
]);
|
|
182
213
|
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
183
|
-
value,
|
|
214
|
+
value: value_5,
|
|
184
215
|
children
|
|
185
216
|
});
|
|
186
217
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { Key } from 'react-aria-components';
|
|
3
3
|
import { FieldValues } from 'react-hook-form';
|
|
4
4
|
import { ControlProps } from '../../shared/form.types';
|
|
5
5
|
export interface SelectItem<TKey extends Key = Key> {
|
|
6
6
|
id: TKey;
|
|
7
7
|
label: string;
|
|
8
|
-
content?: string |
|
|
8
|
+
content?: string | ReactNode;
|
|
9
9
|
isDisabled?: boolean;
|
|
10
10
|
}
|
|
11
11
|
export interface ExtendedSelectItem<TKey extends Key = Key> extends SelectItem<TKey> {
|
|
@@ -54,6 +54,7 @@ export interface SelectAsyncProps {
|
|
|
54
54
|
onLoadMore?: () => void;
|
|
55
55
|
}
|
|
56
56
|
export interface SelectVirtualizationProps {
|
|
57
|
+
totalItems?: number;
|
|
57
58
|
virtualizerOptions?: {
|
|
58
59
|
rowHeight?: number;
|
|
59
60
|
estimatedRowHeight?: number;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UIOverrides } from '../../../../config/uiOverrides.context';
|
|
2
|
+
export declare const selectPopoverDefinition: {
|
|
3
|
+
base: string[];
|
|
4
|
+
config?: import("../../../../utils/style-merge.util").StyleMergeUtils.Config<Record<never, never>>;
|
|
5
|
+
};
|
|
6
|
+
export type SelectPopoverCva = UIOverrides.VariantProps<NonNullable<typeof selectPopoverDefinition.config>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { UIOverrides } from "../../../../config/uiOverrides.context.js";
|
|
2
|
+
//#region src/components/inputs/Selection/shared/selectDesktop.cva.ts
|
|
3
|
+
var selectPopoverDefinition = UIOverrides.defineConfig({ base: ["my-4 outline-none"] });
|
|
4
|
+
//#endregion
|
|
5
|
+
export { selectPopoverDefinition };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UIOverrides } from '../../../../config/uiOverrides.context';
|
|
2
|
+
export declare const selectInputTagsContentWrapperDefinition: {
|
|
3
|
+
base: string[];
|
|
4
|
+
config: import("../../../../utils/style-merge.util").StyleMergeUtils.Config<{
|
|
5
|
+
readonly isSearchable: {
|
|
6
|
+
readonly false: "pointer-events-none z-raised";
|
|
7
|
+
};
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
export type SelectInputTagsContentWrapperConfig = NonNullable<typeof selectInputTagsContentWrapperDefinition.config>;
|
|
11
|
+
export interface SelectInputTagsContentWrapperVariantProps extends UIOverrides.VariantProps<SelectInputTagsContentWrapperConfig> {
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UIOverrides } from "../../../../config/uiOverrides.context.js";
|
|
2
|
+
//#region src/components/inputs/Selection/shared/selectInput.cva.ts
|
|
3
|
+
var selectInputTagsContentWrapperDefinition = UIOverrides.defineConfig({
|
|
4
|
+
base: ["flex flex-1 flex-wrap gap-input-gap-input-text-to-elements truncate"],
|
|
5
|
+
config: { variants: { isSearchable: { false: "pointer-events-none z-raised" } } }
|
|
6
|
+
});
|
|
7
|
+
//#endregion
|
|
8
|
+
export { selectInputTagsContentWrapperDefinition };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Key } from 'react-aria-components';
|
|
3
|
+
import { SelectBaseProps } from './SelectBase';
|
|
4
|
+
import { DefaultInitialSelectItem, SelectItem } from './select.types';
|
|
5
|
+
interface GetStaticSelectValueOptions<TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>> {
|
|
6
|
+
items: SelectItem<TKey>[];
|
|
7
|
+
value: TKey | TKey[] | null | undefined;
|
|
8
|
+
selectionMode: SelectBaseProps<TKey>["selectionMode"];
|
|
9
|
+
initialSelection?: TInitialSelectItem | TInitialSelectItem[] | null;
|
|
10
|
+
mapInitialToSelectItem?: (item: TInitialSelectItem) => SelectItem<TKey>;
|
|
11
|
+
showSelectionContent?: boolean;
|
|
12
|
+
isDisabled?: boolean;
|
|
13
|
+
collapseAfter?: SelectBaseProps<TKey>["collapseAfter"];
|
|
14
|
+
selectedTagsType?: SelectBaseProps<TKey>["selectedTagsType"];
|
|
15
|
+
}
|
|
16
|
+
interface StaticSelectValueResult<TKey extends Key = Key> {
|
|
17
|
+
selectedItem: SelectItem<TKey> | null;
|
|
18
|
+
selectedItems: SelectItem<TKey>[];
|
|
19
|
+
displayValue: ReactNode;
|
|
20
|
+
isEmpty: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const getStaticSelectValue: <TKey extends Key = Key, TInitialSelectItem = DefaultInitialSelectItem<TKey>>({ items, value, selectionMode, initialSelection, mapInitialToSelectItem, showSelectionContent, isDisabled, collapseAfter, selectedTagsType, }: GetStaticSelectValueOptions<TKey, TInitialSelectItem>) => StaticSelectValueResult<TKey>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { SelectInputTags } from "./SelectInputTags.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/inputs/Selection/shared/staticSelect.utils.tsx
|
|
4
|
+
var getStaticMultipleDisplayValue = ({ selectedItems, isDisabled, collapseAfter, selectedTagsType }) => {
|
|
5
|
+
if (selectedItems.length === 0) return "";
|
|
6
|
+
return /* @__PURE__ */ jsx(SelectInputTags, {
|
|
7
|
+
selectedItems,
|
|
8
|
+
isDisabled,
|
|
9
|
+
collapseAfter,
|
|
10
|
+
selectedTagsType,
|
|
11
|
+
onRemove: () => void 0
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var getStaticSingleDisplayValue = ({ selectedItem, showSelectionContent }) => {
|
|
15
|
+
if (!selectedItem) return "";
|
|
16
|
+
if (showSelectionContent && selectedItem.content) return selectedItem.content;
|
|
17
|
+
return /* @__PURE__ */ jsx("div", {
|
|
18
|
+
className: "min-w-0 flex-1 truncate",
|
|
19
|
+
children: selectedItem.label
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var getStaticSelectValue = ({ items, value, selectionMode, initialSelection, mapInitialToSelectItem = ((item) => ({
|
|
23
|
+
id: item.id,
|
|
24
|
+
label: item.label ?? item.name ?? ""
|
|
25
|
+
})), showSelectionContent, isDisabled, collapseAfter, selectedTagsType }) => {
|
|
26
|
+
const initialSelectedItems = initialSelection ? (Array.isArray(initialSelection) ? initialSelection : [initialSelection]).map((item) => mapInitialToSelectItem(item)) : [];
|
|
27
|
+
const allItemsMap = /* @__PURE__ */ new Map();
|
|
28
|
+
[...initialSelectedItems, ...items].forEach((item) => allItemsMap.set(item.id, item));
|
|
29
|
+
const getItem = (id) => allItemsMap.get(id) ?? null;
|
|
30
|
+
const selectedItems = Array.isArray(value) ? value.map((id) => getItem(id)).filter((item) => item != null) : [];
|
|
31
|
+
const selectedItem = !Array.isArray(value) && value != null ? getItem(value) : null;
|
|
32
|
+
if (selectionMode === "multiple") return {
|
|
33
|
+
selectedItem,
|
|
34
|
+
selectedItems,
|
|
35
|
+
displayValue: getStaticMultipleDisplayValue({
|
|
36
|
+
selectedItems,
|
|
37
|
+
isDisabled,
|
|
38
|
+
collapseAfter,
|
|
39
|
+
selectedTagsType
|
|
40
|
+
}),
|
|
41
|
+
isEmpty: selectedItems.length === 0
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
selectedItem,
|
|
45
|
+
selectedItems,
|
|
46
|
+
displayValue: getStaticSingleDisplayValue({
|
|
47
|
+
selectedItem,
|
|
48
|
+
showSelectionContent
|
|
49
|
+
}),
|
|
50
|
+
isEmpty: selectedItem == null
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { getStaticSelectValue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|