@payfit/unity-components 1.2.0 → 2.1.4
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/esm/components/action-bar/ActionBar.js +14 -14
- package/dist/esm/components/actionable/Actionable.js +31 -28
- package/dist/esm/components/alert/Alert.js +41 -29
- package/dist/esm/components/alert/parts/AlertTitle.js +8 -8
- package/dist/esm/components/app-layout/AppLayout.d.ts +2 -0
- package/dist/esm/components/app-layout/AppLayout.js +17 -17
- package/dist/esm/components/app-menu/parts/AppMenuFooter.js +23 -23
- package/dist/esm/components/app-menu/parts/AppMenuHeader.d.ts +87 -5
- package/dist/esm/components/app-menu/parts/AppMenuHeader.js +25 -25
- package/dist/esm/components/autocomplete/Autocomplete.d.ts +0 -9
- package/dist/esm/components/autocomplete/Autocomplete.js +54 -57
- package/dist/esm/components/autocomplete/parts/AutocompleteItem.js +8 -8
- package/dist/esm/components/avatar/Avatar.variants.js +1 -1
- package/dist/esm/components/avatar/parts/AvatarFallback.js +26 -27
- package/dist/esm/components/badge/Badge.js +1 -1
- package/dist/esm/components/breadcrumbs/Breadcrumbs.context.js +3 -3
- package/dist/esm/components/breadcrumbs/Breadcrumbs.d.ts +19 -11
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +29 -18
- package/dist/esm/components/breadcrumbs/Breadcrumbs.variant.js +1 -1
- package/dist/esm/components/breadcrumbs/parts/Breadcrumb.d.ts +30 -5
- package/dist/esm/components/breadcrumbs/parts/Breadcrumb.js +35 -27
- package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.d.ts +37 -0
- package/dist/esm/components/breadcrumbs/parts/RawBreadcrumbLink.js +36 -0
- package/dist/esm/components/button/Button.js +6 -6
- package/dist/esm/components/button/Button.variants.d.ts +1 -0
- package/dist/esm/components/button/Button.variants.js +22 -15
- package/dist/esm/components/card/Card.context.d.ts +5 -0
- package/dist/esm/components/card/Card.context.js +14 -0
- package/dist/esm/components/card/Card.d.ts +210 -0
- package/dist/esm/components/card/Card.js +93 -0
- package/dist/esm/components/card/parts/CardContent.d.ts +37 -0
- package/dist/esm/components/card/parts/CardContent.js +8 -0
- package/dist/esm/components/card/parts/CardTitle.d.ts +55 -0
- package/dist/esm/components/card/parts/CardTitle.js +33 -0
- package/dist/esm/components/checkbox/Checkbox.js +38 -30
- package/dist/esm/components/checkbox/Checkbox.variants.d.ts +9 -9
- package/dist/esm/components/checkbox/Checkbox.variants.js +23 -7
- package/dist/esm/components/checkbox/TanstackCheckbox.d.ts +28 -0
- package/dist/esm/components/checkbox/TanstackCheckbox.js +51 -0
- package/dist/esm/components/checkbox/parts/CheckboxIndicator.js +7 -7
- package/dist/esm/components/checkbox-field/CheckboxField.d.ts +2 -0
- package/dist/esm/components/checkbox-field/TanstackCheckboxField.d.ts +14 -0
- package/dist/esm/components/checkbox-field/TanstackCheckboxField.js +40 -0
- package/dist/esm/components/checkbox-group/TanstackCheckboxGroup.d.ts +4 -0
- package/dist/esm/components/checkbox-group/TanstackCheckboxGroup.js +37 -0
- package/dist/esm/components/checkbox-group-field/CheckboxGroupField.d.ts +2 -0
- package/dist/esm/components/checkbox-group-field/TanstackCheckGroupField.d.ts +72 -0
- package/dist/esm/components/checkbox-group-field/TanstackCheckGroupField.js +40 -0
- package/dist/esm/components/client-side-pagination/ClientSidePagination.d.ts +103 -0
- package/dist/esm/components/client-side-pagination/ClientSidePagination.js +177 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.d.ts +11 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationEllipsis.js +30 -0
- package/dist/esm/components/client-side-pagination/parts/PaginationJumpDialog.d.ts +8 -0
- package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.js +1 -1
- package/dist/esm/components/{pagination/parts/PaginationLink.d.ts → client-side-pagination/parts/RawPaginationLink.d.ts} +2 -2
- package/dist/esm/components/{pagination/parts/PaginationLink.js → client-side-pagination/parts/RawPaginationLink.js} +12 -12
- package/dist/esm/components/client-side-pagination/utils/pagination-window.d.ts +8 -0
- package/dist/esm/components/client-side-pagination/utils/pagination-window.js +33 -0
- package/dist/esm/components/collapsible/parts/CollapsibleContent.js +5 -5
- package/dist/esm/components/collapsible/parts/CollapsibleTitle.js +8 -8
- package/dist/esm/components/data-table/DataTable.d.ts +109 -16
- package/dist/esm/components/data-table/DataTable.js +107 -93
- package/dist/esm/components/data-table/mocks/employee-data.d.ts +1 -0
- package/dist/esm/components/date-calendar/DateCalendar.js +1 -1
- package/dist/esm/components/date-calendar/parts/DateSegmentSelect.js +1 -1
- package/dist/esm/components/date-picker/DatePicker.d.ts +1 -1
- package/dist/esm/components/date-picker/DatePicker.js +59 -50
- package/dist/esm/components/date-picker/TanstackDatePicker.d.ts +22 -0
- package/dist/esm/components/date-picker/TanstackDatePicker.js +53 -0
- package/dist/esm/components/date-picker/parts/DateInput.js +4 -4
- package/dist/esm/components/date-picker-field/DatePickerField.d.ts +2 -0
- package/dist/esm/components/date-picker-field/TanstackDatePickerField.d.ts +71 -0
- package/dist/esm/components/date-picker-field/TanstackDatePickerField.js +41 -0
- package/dist/esm/components/definition-list/DefinitionList.context.d.ts +19 -0
- package/dist/esm/components/definition-list/DefinitionList.d.ts +24 -0
- package/dist/esm/components/definition-list/parts/DefinitionItem.d.ts +25 -0
- package/dist/esm/components/dialog/Dialog.d.ts +34 -22
- package/dist/esm/components/dialog/Dialog.js +90 -52
- package/dist/esm/components/dialog/parts/DialogActions.js +6 -6
- package/dist/esm/components/dialog/parts/DialogTitle.js +7 -4
- package/dist/esm/components/dialog/test-utils.d.ts +28 -0
- package/dist/esm/components/dialog/test-utils.js +78 -0
- package/dist/esm/components/error-state/ErrorState.d.ts +13 -1
- package/dist/esm/components/error-state/ErrorState.js +133 -92
- package/dist/esm/components/error-state/initConfig.js +1 -1
- package/dist/esm/components/fieldset/Fieldset.d.ts +19 -0
- package/dist/esm/components/fieldset/Fieldset.js +32 -26
- package/dist/esm/components/filter/Filter.controls.d.ts +192 -0
- package/dist/esm/components/filter/Filter.controls.js +45 -0
- package/dist/esm/components/filter/Filter.d.ts +189 -0
- package/dist/esm/components/filter/Filter.js +147 -0
- package/dist/esm/components/filter/Filter.types.d.ts +121 -0
- package/dist/esm/components/filter/hooks/useFilterIds.d.ts +49 -0
- package/dist/esm/components/filter/hooks/useFilterIds.js +13 -0
- package/dist/esm/components/filter/hooks/useFilterState.d.ts +74 -0
- package/dist/esm/components/filter/hooks/useFilterState.js +23 -0
- package/dist/esm/components/filter/hooks/useFilterValue.d.ts +61 -0
- package/dist/esm/components/filter/hooks/useFilterValue.js +31 -0
- package/dist/esm/components/filter/parts/FilterButton.d.ts +75 -0
- package/dist/esm/components/filter/parts/FilterButton.js +55 -0
- package/dist/esm/components/filter/parts/FilterLabel.d.ts +96 -0
- package/dist/esm/components/filter/parts/FilterLabel.js +57 -0
- package/dist/esm/components/filter/parts/FilterPopover.d.ts +95 -0
- package/dist/esm/components/filter/parts/FilterPopover.js +79 -0
- package/dist/esm/components/filter/utils/value-formatters.d.ts +62 -0
- package/dist/esm/components/filter/utils/value-formatters.js +14 -0
- package/dist/esm/components/filter-toolbar/FilterToolbar.d.ts +110 -0
- package/dist/esm/components/filter-toolbar/FilterToolbar.js +172 -0
- package/dist/esm/components/filter-toolbar/FilterToolbar.types.d.ts +119 -0
- package/dist/esm/components/filter-toolbar/hooks/use-filter-toolbar-state.d.ts +96 -0
- package/dist/esm/components/filter-toolbar/hooks/use-filter-toolbar-state.js +132 -0
- package/dist/esm/components/filter-toolbar/parts/AddFilter.d.ts +63 -0
- package/dist/esm/components/filter-toolbar/parts/AddFilter.js +107 -0
- package/dist/esm/components/filter-toolbar/parts/AddFilterItem.d.ts +18 -0
- package/dist/esm/components/filter-toolbar/parts/AddFilterItem.js +18 -0
- package/dist/esm/components/filter-toolbar/utils/filter-adapters.d.ts +93 -0
- package/dist/esm/components/filter-toolbar/utils/filter-adapters.js +88 -0
- package/dist/esm/components/filter-toolbar/utils/normalize-filter-value.d.ts +24 -0
- package/dist/esm/components/filter-toolbar/utils/normalize-filter-value.js +19 -0
- package/dist/esm/components/flex/Flex.js +52 -37
- package/dist/esm/components/form/Form.d.ts +2 -0
- package/dist/esm/components/form/TanstackForm.d.ts +24 -0
- package/dist/esm/components/form/TanstackForm.js +29 -0
- package/dist/esm/components/form-field/FormField.d.ts +2 -0
- package/dist/esm/components/form-field/FormField.js +12 -12
- package/dist/esm/components/form-field/TanstackFormField.context.d.ts +10 -0
- package/dist/esm/components/form-field/TanstackFormField.context.js +14 -0
- package/dist/esm/components/form-field/TanstackFormField.d.ts +49 -0
- package/dist/esm/components/form-field/TanstackFormField.js +46 -0
- package/dist/esm/components/form-field/parts/FormControl.d.ts +2 -0
- package/dist/esm/components/form-field/parts/FormFeedbackText.d.ts +2 -0
- package/dist/esm/components/form-field/parts/FormHelperText.d.ts +2 -0
- package/dist/esm/components/form-field/parts/FormLabel.d.ts +2 -0
- package/dist/esm/components/form-field/parts/RawFormContextualLink.d.ts +22 -0
- package/dist/esm/components/form-field/parts/RawFormContextualLink.js +39 -0
- package/dist/esm/components/form-field/parts/TanstackFormFeedbackText.d.ts +12 -0
- package/dist/esm/components/form-field/parts/TanstackFormFeedbackText.js +32 -0
- package/dist/esm/components/form-field/parts/TanstackFormHelperText.d.ts +11 -0
- package/dist/esm/components/form-field/parts/TanstackFormHelperText.js +25 -0
- package/dist/esm/components/form-field/parts/TanstackFormLabel.d.ts +8 -0
- package/dist/esm/components/form-field/parts/TanstackFormLabel.js +26 -0
- package/dist/esm/components/form-field/parts/TanstackRawFormContextualLink.d.ts +26 -0
- package/dist/esm/components/form-field/parts/TanstackRawFormContextualLink.js +45 -0
- package/dist/esm/components/funnel-layout/parts/FunnelSidebar.d.ts +2 -2
- package/dist/esm/components/icon/Icon.js +23 -19
- package/dist/esm/components/icon-button/CircularIconButton.d.ts +9 -9
- package/dist/esm/components/icon-button/CircularIconButton.js +53 -36
- package/dist/esm/components/icon-button/IconButton.variants.d.ts +1 -0
- package/dist/esm/components/icon-button/IconButton.variants.js +44 -28
- package/dist/esm/components/input/Input.js +36 -35
- package/dist/esm/components/input/TanstackInput.d.ts +22 -0
- package/dist/esm/components/input/TanstackInput.js +38 -0
- package/dist/esm/components/label/Label.js +12 -12
- package/dist/esm/components/link/{Link.variants.d.ts → RawLink.d.ts} +92 -0
- package/dist/esm/components/link/{Link.variants.js → RawLink.js} +78 -5
- package/dist/esm/components/list-view/ListView.d.ts +56 -0
- package/dist/esm/components/list-view/ListView.fixtures.d.ts +20 -0
- package/dist/esm/components/list-view/ListView.js +44 -0
- package/dist/esm/components/list-view/parts/ListViewItemLabel.d.ts +34 -0
- package/dist/esm/components/list-view/parts/ListViewItemLabel.js +22 -0
- package/dist/esm/components/list-view/parts/ListViewItemText.d.ts +33 -0
- package/dist/esm/components/list-view/parts/ListViewItemText.js +22 -0
- package/dist/esm/components/list-view/parts/ListViewSection.d.ts +14 -0
- package/dist/esm/components/list-view/parts/ListViewSection.js +21 -0
- package/dist/esm/components/list-view/parts/RawListViewItem.d.ts +102 -0
- package/dist/esm/components/list-view/parts/RawListViewItem.js +80 -0
- package/dist/esm/components/menu/parts/{MenuItem.d.ts → RawMenuItem.d.ts} +3 -4
- package/dist/esm/components/menu/parts/{MenuItem.js → RawMenuItem.js} +9 -9
- package/dist/esm/components/multi-select/MultiSelect.d.ts +5 -7
- package/dist/esm/components/multi-select/MultiSelect.js +199 -176
- package/dist/esm/components/multi-select/MultiselectTypes.d.ts +114 -0
- package/dist/esm/components/multi-select/TanstackMultiSelect.d.ts +7 -0
- package/dist/esm/components/multi-select/TanstackMultiSelect.js +41 -0
- package/dist/esm/components/multi-select/parts/MultiSelectButton.d.ts +2 -0
- package/dist/esm/components/multi-select/parts/MultiSelectButton.js +62 -46
- package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +15 -15
- package/dist/esm/components/multi-select-field/MultiSelectField.d.ts +45 -12
- package/dist/esm/components/multi-select-field/MultiSelectField.js +56 -66
- package/dist/esm/components/multi-select-field/TanstackMultiSelectField.d.ts +92 -0
- package/dist/esm/components/multi-select-field/TanstackMultiSelectField.js +48 -0
- package/dist/esm/components/multi-select-field/test-utils.d.ts +17 -0
- package/dist/esm/components/multi-select-field/test-utils.js +45 -0
- package/dist/esm/components/nav/parts/NavGroup.d.ts +3 -3
- package/dist/esm/components/nav/parts/NavGroup.js +62 -51
- package/dist/esm/components/nav/parts/{NavItem.d.ts → RawNavItem.d.ts} +102 -5
- package/dist/esm/components/nav/parts/RawNavItem.js +106 -0
- package/dist/esm/components/navigation-card/NavigationCard.context.d.ts +31 -0
- package/dist/esm/components/navigation-card/NavigationCard.context.js +13 -0
- package/dist/esm/components/navigation-card/NavigationCard.d.ts +46 -0
- package/dist/esm/components/navigation-card/NavigationCard.js +62 -0
- package/dist/esm/components/navigation-card/NavigationCard.types.d.ts +37 -0
- package/dist/esm/components/navigation-card/NavigationCard.variants.d.ts +1147 -0
- package/dist/esm/components/navigation-card/NavigationCard.variants.js +164 -0
- package/dist/esm/components/navigation-card/parts/NavigationCardDescription.d.ts +39 -0
- package/dist/esm/components/navigation-card/parts/NavigationCardDescription.js +22 -0
- package/dist/esm/components/navigation-card/parts/NavigationCardGroup.d.ts +146 -0
- package/dist/esm/components/navigation-card/parts/NavigationCardGroup.js +93 -0
- package/dist/esm/components/navigation-card/parts/NavigationCardLabel.d.ts +32 -0
- package/dist/esm/components/navigation-card/parts/NavigationCardLabel.js +24 -0
- package/dist/esm/components/number-field/NumberField.d.ts +2 -0
- package/dist/esm/components/number-field/TanstackNumberField.d.ts +74 -0
- package/dist/esm/components/number-field/TanstackNumberField.js +44 -0
- package/dist/esm/components/number-input/NumberInput.js +31 -29
- package/dist/esm/components/number-input/TanstackNumberInput.d.ts +58 -0
- package/dist/esm/components/number-input/TanstackNumberInput.js +38 -0
- package/dist/esm/components/page/Page.js +13 -12
- package/dist/esm/components/page/parts/PageHeader.d.ts +79 -9
- package/dist/esm/components/page/parts/PageHeader.js +22 -20
- package/dist/esm/components/pagination/Pagination.d.ts +23 -44
- package/dist/esm/components/pagination/Pagination.js +89 -163
- package/dist/esm/components/pagination/PaginationContext.d.ts +11 -0
- package/dist/esm/components/pagination/PaginationContext.js +15 -0
- package/dist/esm/components/pagination/hooks/use-pagination-state.d.ts +63 -0
- package/dist/esm/components/pagination/hooks/use-pagination-state.js +27 -0
- package/dist/esm/components/pagination/hooks/use-pagination-window.d.ts +64 -0
- package/dist/esm/components/pagination/hooks/use-pagination-window.js +15 -0
- package/dist/esm/components/pagination/parts/PaginationContent.d.ts +30 -0
- package/dist/esm/components/pagination/parts/PaginationContent.js +37 -0
- package/dist/esm/components/pagination/parts/PaginationEllipsis.d.ts +23 -4
- package/dist/esm/components/pagination/parts/PaginationEllipsis.js +20 -16
- package/dist/esm/components/pagination/parts/PaginationItem.d.ts +38 -0
- package/dist/esm/components/pagination/parts/PaginationItem.js +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationLink.d.ts +11 -0
- package/dist/esm/components/pagination/parts/RawPaginationLink.js +60 -0
- package/dist/esm/components/pagination/parts/RawPaginationNext.d.ts +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationNext.js +70 -0
- package/dist/esm/components/pagination/parts/RawPaginationPrevious.d.ts +22 -0
- package/dist/esm/components/pagination/parts/RawPaginationPrevious.js +67 -0
- package/dist/esm/components/pagination/utils/pagination-window.js +29 -20
- package/dist/esm/components/payfit-brand/PayFitBrand.d.ts +4 -0
- package/dist/esm/components/payfit-brand/PayFitBrand.js +30 -22
- package/dist/esm/components/payfit-brand/PayFitPreprod.js +25 -25
- package/dist/esm/components/phone-number/PhoneNumberInput.d.ts +67 -0
- package/dist/esm/components/phone-number/PhoneNumberInput.js +322 -0
- package/dist/esm/components/phone-number/TanstackPhoneNumberInput.d.ts +64 -0
- package/dist/esm/components/phone-number/TanstackPhoneNumberInput.js +33 -0
- package/dist/esm/components/phone-number/parts/PhoneNumberItem.d.ts +42 -0
- package/dist/esm/components/phone-number/parts/PhoneNumberItem.js +68 -0
- package/dist/esm/components/phone-number/unknownFlag.svg.js +4 -0
- package/dist/esm/components/phone-number-field/TanstackPhoneNumberField.d.ts +15 -0
- package/dist/esm/components/phone-number-field/TanstackPhoneNumberField.js +32 -0
- package/dist/esm/components/pill/Pill.d.ts +2 -2
- package/dist/esm/components/pill/Pill.js +8 -8
- package/dist/esm/components/popover/Popover.js +6 -6
- package/dist/esm/components/promo-dialog/PromoDialog.d.ts +149 -0
- package/dist/esm/components/promo-dialog/PromoDialog.js +219 -0
- package/dist/esm/components/promo-dialog/parts/PromoDialogActions.d.ts +44 -0
- package/dist/esm/components/promo-dialog/parts/PromoDialogActions.js +29 -0
- package/dist/esm/components/promo-dialog/parts/PromoDialogContent.d.ts +43 -0
- package/dist/esm/components/promo-dialog/parts/PromoDialogContent.js +20 -0
- package/dist/esm/components/promo-dialog/parts/PromoDialogHero.d.ts +47 -0
- package/dist/esm/components/promo-dialog/parts/PromoDialogHero.js +25 -0
- package/dist/esm/components/promo-dialog/parts/PromoDialogSubtitle.d.ts +53 -0
- package/dist/esm/components/promo-dialog/parts/PromoDialogSubtitle.js +21 -0
- package/dist/esm/components/promo-dialog/parts/PromoDialogTitle.d.ts +6 -0
- package/dist/esm/components/promo-dialog/parts/PromoDialogTitle.js +18 -0
- package/dist/esm/components/radio-button-group/TanstackRadioButtonGroup.d.ts +13 -0
- package/dist/esm/components/radio-button-group/TanstackRadioButtonGroup.js +43 -0
- package/dist/esm/components/radio-button-group/parts/RadioButton.d.ts +29 -11
- package/dist/esm/components/radio-button-group/parts/RadioButton.js +53 -51
- package/dist/esm/components/radio-button-group-field/RadioButtonGroupField.d.ts +2 -0
- package/dist/esm/components/radio-button-group-field/TanstackRadioButtonGroupField.d.ts +13 -0
- package/dist/esm/components/radio-button-group-field/TanstackRadioButtonGroupField.js +38 -0
- package/dist/esm/components/search/Search.js +46 -46
- package/dist/esm/components/segmented-button-group/parts/ToggleButton.js +5 -5
- package/dist/esm/components/select/Select.d.ts +5 -4
- package/dist/esm/components/select/Select.js +79 -53
- package/dist/esm/components/select/TanstackSelect.d.ts +80 -0
- package/dist/esm/components/select/TanstackSelect.js +34 -0
- package/dist/esm/components/select/parts/SearchInput.d.ts +4 -1
- package/dist/esm/components/select/parts/SearchInput.js +49 -31
- package/dist/esm/components/select/parts/SelectButton.js +19 -17
- package/dist/esm/components/select/parts/SelectOption.js +9 -9
- package/dist/esm/components/select-field/SelectField.d.ts +2 -0
- package/dist/esm/components/select-field/SelectField.js +8 -9
- package/dist/esm/components/select-field/TanstackSelectField.d.ts +124 -0
- package/dist/esm/components/select-field/TanstackSelectField.js +44 -0
- package/dist/esm/components/select-list/SelectList.d.ts +95 -0
- package/dist/esm/components/select-list/SelectList.js +79 -0
- package/dist/esm/components/select-list/SelectList.types.d.ts +29 -0
- package/dist/esm/components/select-list/constants.d.ts +36 -0
- package/dist/esm/components/select-list/constants.js +29 -0
- package/dist/esm/components/select-list/helpers.d.ts +42 -0
- package/dist/esm/components/select-list/helpers.js +48 -0
- package/dist/esm/components/select-list/hooks/useControlledSelection.d.ts +23 -0
- package/dist/esm/components/select-list/hooks/useControlledSelection.js +16 -0
- package/dist/esm/components/select-list/hooks/useSelectedFirstSorting.d.ts +23 -0
- package/dist/esm/components/select-list/hooks/useSelectedFirstSorting.js +31 -0
- package/dist/esm/components/select-list/parts/SelectListEmptyState.d.ts +8 -0
- package/dist/esm/components/select-list/parts/SelectListEmptyState.js +25 -0
- package/dist/esm/components/select-list/parts/SelectListOptGroup.d.ts +118 -0
- package/dist/esm/components/select-list/parts/SelectListOptGroup.js +28 -0
- package/dist/esm/components/select-list/parts/SelectListOption.d.ts +24 -0
- package/dist/esm/components/select-list/parts/SelectListOption.js +72 -0
- package/dist/esm/components/select-list/parts/SelectListSearchInput.d.ts +2 -0
- package/dist/esm/components/select-list/parts/SelectListSearchInput.js +43 -0
- package/dist/esm/components/select-list/parts/SelectedItemsSection.d.ts +54 -0
- package/dist/esm/components/select-list/parts/SelectedItemsSection.js +35 -0
- package/dist/esm/components/select-list/utils/partition.d.ts +13 -0
- package/dist/esm/components/select-list/utils/partition.js +9 -0
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.context.d.ts +1 -5
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.d.ts +6 -1
- package/dist/esm/components/selectable-button-group/SelectableButtonGroup.js +23 -23
- package/dist/esm/components/selectable-button-group/TanstackSelectableButtonGroup.d.ts +27 -0
- package/dist/esm/components/selectable-button-group/TanstackSelectableButtonGroup.js +34 -0
- package/dist/esm/components/selectable-button-group/parts/SelectableButton.d.ts +1 -16
- package/dist/esm/components/selectable-button-group/parts/SelectableButton.js +56 -57
- package/dist/esm/components/selectable-button-group-field/SelectableButtonGroupField.d.ts +2 -0
- package/dist/esm/components/selectable-button-group-field/TanstackSelectableButtonGroupField.d.ts +81 -0
- package/dist/esm/components/selectable-button-group-field/TanstackSelectableButtonGroupField.js +47 -0
- package/dist/esm/components/selectable-card/internals/Description.js +1 -1
- package/dist/esm/components/selectable-card/selectable-card-checkbox-group/SelectableCardCheckboxGroup.js +1 -1
- package/dist/esm/components/selectable-card/selectable-card-checkbox-group/TanstackSelectableCardCheckboxGroup.d.ts +26 -0
- package/dist/esm/components/selectable-card/selectable-card-checkbox-group/TanstackSelectableCardCheckboxGroup.js +32 -0
- package/dist/esm/components/selectable-card/selectable-card-checkbox-group/parts/SelectableCardCheckbox.js +24 -24
- package/dist/esm/components/selectable-card/selectable-card-radio-group/SelectableCardRadioGroup.d.ts +2 -0
- package/dist/esm/components/selectable-card/selectable-card-radio-group/SelectableCardRadioGroup.js +12 -14
- package/dist/esm/components/selectable-card/selectable-card-radio-group/TanstackSelectableCardRadioGroup.d.ts +28 -0
- package/dist/esm/components/selectable-card/selectable-card-radio-group/TanstackSelectableCardRadioGroup.js +32 -0
- package/dist/esm/components/selectable-card/selectable-card-radio-group/parts/RadioIndicator.js +14 -13
- package/dist/esm/components/selectable-card/selectable-card-radio-group/parts/SelectableCardRadio.js +27 -25
- package/dist/esm/components/selectable-card/selectableCard.variant.js +5 -5
- package/dist/esm/components/selectable-card-checkbox-group-field/SelectableCardCheckboxGroupField.d.ts +2 -0
- package/dist/esm/components/selectable-card-checkbox-group-field/TanstackSelectableCardCheckboxGroupField.d.ts +10 -0
- package/dist/esm/components/selectable-card-checkbox-group-field/TanstackSelectableCardCheckboxGroupField.js +38 -0
- package/dist/esm/components/selectable-card-radio-group-field/SelectableCardRadioGroupField.d.ts +2 -0
- package/dist/esm/components/selectable-card-radio-group-field/TanstackSelectableCardRadioGroupField.d.ts +10 -0
- package/dist/esm/components/selectable-card-radio-group-field/TanstackSelectableCardRadioGroupField.js +38 -0
- package/dist/esm/components/skip-links/SkipLinks.js +1 -1
- package/dist/esm/components/table/Table.context.d.ts +5 -0
- package/dist/esm/components/table/Table.context.js +14 -13
- package/dist/esm/components/table/Table.d.ts +94 -0
- package/dist/esm/components/table/Table.js +145 -108
- package/dist/esm/components/table/hooks/useTableKeyboardNavigation.js +6 -6
- package/dist/esm/components/table/parts/TableBody.js +83 -21
- package/dist/esm/components/table/parts/TableCell.js +29 -26
- package/dist/esm/components/table/parts/TableEmptyState.js +6 -6
- package/dist/esm/components/table/parts/TableHeader.js +1 -1
- package/dist/esm/components/table/parts/TablePagination.d.ts +5 -5
- package/dist/esm/components/table/parts/TablePagination.js +11 -11
- package/dist/esm/components/table/parts/TableRow.js +22 -18
- package/dist/esm/components/tabs/Tabs.variant.d.ts +0 -6
- package/dist/esm/components/tabs/Tabs.variant.js +11 -12
- package/dist/esm/components/tabs/parts/{Tab.d.ts → RawTab.d.ts} +2 -2
- package/dist/esm/components/tabs/parts/{Tab.js → RawTab.js} +6 -6
- package/dist/esm/components/task-menu/TaskMenu.d.ts +4 -4
- package/dist/esm/components/task-menu/parts/{SubTask.d.ts → RawSubTask.d.ts} +7 -7
- package/dist/esm/components/task-menu/parts/{SubTask.js → RawSubTask.js} +43 -43
- package/dist/esm/components/task-menu/parts/{Task.d.ts → RawTask.d.ts} +7 -7
- package/dist/esm/components/task-menu/parts/{Task.js → RawTask.js} +45 -41
- package/dist/esm/components/task-menu/parts/TaskGroup.d.ts +5 -5
- package/dist/esm/components/task-menu/parts/TaskGroup.js +30 -26
- package/dist/esm/components/task-menu/parts/task.variants.js +4 -2
- package/dist/esm/components/text/Text.d.ts +11 -1
- package/dist/esm/components/text/Text.js +43 -30
- package/dist/esm/components/text/Text.variants.d.ts +12 -0
- package/dist/esm/components/text/Text.variants.js +4 -0
- package/dist/esm/components/text-area/TanstackTextArea.d.ts +21 -0
- package/dist/esm/components/text-area/TanstackTextArea.js +35 -0
- package/dist/esm/components/text-area/TextArea.js +31 -29
- package/dist/esm/components/text-field/TanstackTextField.d.ts +79 -0
- package/dist/esm/components/text-field/TanstackTextField.js +60 -0
- package/dist/esm/components/text-field/TextField.d.ts +2 -0
- package/dist/esm/components/toast/UnityToast.js +5 -5
- package/dist/esm/components/toast/test-utils.d.ts +36 -0
- package/dist/esm/components/toast/test-utils.js +118 -0
- package/dist/esm/components/toggle-switch/TanstackToggleSwitch.d.ts +46 -0
- package/dist/esm/components/toggle-switch/TanstackToggleSwitch.js +25 -0
- package/dist/esm/components/toggle-switch/ToggleSwitch.d.ts +21 -9
- package/dist/esm/components/toggle-switch/ToggleSwitch.js +71 -32
- package/dist/esm/components/toggle-switch-field/TanstackToggleSwitchField.d.ts +11 -0
- package/dist/esm/components/toggle-switch-field/TanstackToggleSwitchField.js +34 -0
- package/dist/esm/components/toggle-switch-field/ToggleSwitchField.d.ts +2 -0
- package/dist/esm/components/toggle-switch-group/TanstackToggleSwitchGroup.d.ts +57 -0
- package/dist/esm/components/toggle-switch-group/TanstackToggleSwitchGroup.js +23 -0
- package/dist/esm/components/toggle-switch-group/ToggleSwitchGroup.js +1 -1
- package/dist/esm/components/toggle-switch-group-field/TanstackToggleSwitchGroupField.d.ts +19 -0
- package/dist/esm/components/toggle-switch-group-field/TanstackToggleSwitchGroupField.js +50 -0
- package/dist/esm/components/toggle-switch-group-field/ToggleSwitchGroupField.d.ts +2 -0
- package/dist/esm/docs/{table → examples/data}/mocks/employee-columns.d.ts +1 -1
- package/dist/esm/hooks/tanstack-form-context.d.ts +1 -0
- package/dist/esm/hooks/tanstack-form-context.js +8 -0
- package/dist/esm/hooks/use-container-query-level.d.ts +42 -0
- package/dist/esm/hooks/use-container-query-level.js +33 -0
- package/dist/esm/hooks/use-form.d.ts +2 -0
- package/dist/esm/hooks/use-has-scroll.d.ts +71 -0
- package/dist/esm/hooks/use-has-scroll.js +75 -0
- package/dist/esm/hooks/use-tanstack-form.d.ts +369 -0
- package/dist/esm/hooks/use-tanstack-form.js +209 -0
- package/dist/esm/index.d.ts +64 -30
- package/dist/esm/index.js +482 -394
- package/dist/esm/index.storybook-testing.d.ts +3 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumb.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.d.ts +38 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/BreadcrumbLink.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/Breadcrumbs.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router/components/breadcrumbs/use-route-breadcrumb.d.ts +53 -0
- package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.d.ts +45 -0
- package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/form-contextual-link/TanstackFormContextualLink.d.ts +43 -0
- package/dist/esm/integrations/tanstack-router/components/link/Link.d.ts +33 -0
- package/dist/esm/integrations/tanstack-router/components/link/Link.js +7 -0
- package/dist/esm/integrations/tanstack-router/components/list-view/ListView.d.ts +34 -0
- package/dist/esm/integrations/tanstack-router/components/list-view/ListView.js +25 -0
- package/dist/esm/integrations/tanstack-router/components/list-view/parts/ListViewItem.d.ts +51 -0
- package/dist/esm/integrations/tanstack-router/components/list-view/parts/ListViewItem.js +32 -0
- package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.d.ts +49 -0
- package/dist/esm/integrations/tanstack-router/components/menu-item/MenuItem.js +16 -0
- package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/nav-item/NavItem.js +29 -0
- package/dist/esm/integrations/tanstack-router/components/navigation-card/NavigationCard.d.ts +73 -0
- package/dist/esm/integrations/tanstack-router/components/navigation-card/NavigationCard.js +37 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.d.ts +54 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationLink.js +21 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationNext.js +22 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.d.ts +51 -0
- package/dist/esm/integrations/tanstack-router/components/pagination/PaginationPrevious.js +22 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.d.ts +82 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/Tabs.js +41 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.d.ts +52 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/Tab.js +15 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabList.d.ts +5 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.d.ts +77 -0
- package/dist/esm/integrations/tanstack-router/components/tabs/parts/TabPanel.js +16 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.d.ts +69 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/SubTask.js +14 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/Task.d.ts +64 -0
- package/dist/esm/integrations/tanstack-router/components/task-menu/Task.js +14 -0
- package/dist/esm/integrations/tanstack-router/index.d.ts +19 -0
- package/dist/esm/integrations/tanstack-router/utils/decorators.d.ts +23 -0
- package/dist/esm/integrations/tanstack-router.js +40 -0
- package/dist/esm/mocks/employees.d.ts +1 -5
- package/dist/esm/providers/router/RouterProvider.d.ts +7 -2
- package/dist/esm/providers/router/RouterProvider.js +14 -10
- package/dist/esm/storybook-testing.js +8 -2
- package/dist/esm/storybook-utilities/previewTransform.d.ts +1 -0
- package/dist/esm/types/DataAttributes.d.ts +1 -1
- package/dist/esm/utils/scroll-detection.d.ts +77 -0
- package/dist/esm/utils/scroll-detection.js +33 -0
- package/dist/esm/utils/spacing.d.ts +63 -0
- package/dist/esm/utils/spacing.js +15 -0
- package/i18n/en-GB.json +22 -8
- package/i18n/es-ES.json +24 -10
- package/i18n/fr-FR.json +25 -11
- package/package.json +66 -45
- package/dist/esm/components/form-field/parts/FormContextualLink.d.ts +0 -20
- package/dist/esm/components/form-field/parts/FormContextualLink.js +0 -37
- package/dist/esm/components/link/Link.d.ts +0 -93
- package/dist/esm/components/link/Link.js +0 -68
- package/dist/esm/components/multi-select/Multiselect.types.d.ts +0 -109
- package/dist/esm/components/nav/parts/NavItem.js +0 -95
- package/dist/esm/integrations/react-router/v5/UnityReactRouterV5Provider.d.ts +0 -6
- package/dist/esm/integrations/react-router/v5/UnityReactRouterV5Provider.js +0 -28
- package/dist/esm/integrations/react-router/v5/index.d.ts +0 -1
- package/dist/esm/integrations/react-router/v5.js +0 -4
- /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.d.ts +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/hooks/use-pagination.js +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationJumpDialog.js +0 -0
- /package/dist/esm/components/{pagination → client-side-pagination}/parts/PaginationNavButton.d.ts +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { ForwardedRef, JSX, ReactNode } from 'react';
|
|
2
|
+
import { LabelProps } from '../label/Label.js';
|
|
3
|
+
import { TanstackSelectProps } from '../select/TanstackSelect.js';
|
|
4
|
+
interface FieldProps<T extends object> extends Pick<LabelProps, 'isRequired' | 'requiredVariant'>, TanstackSelectProps<T> {
|
|
5
|
+
/** The label for the select field. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Helper text to display below the select field. */
|
|
8
|
+
helperText?: ReactNode;
|
|
9
|
+
/** A contextual link to display below the select field. */
|
|
10
|
+
contextualLink?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export type TanstackSelectFieldProps<T extends object> = FieldProps<T>;
|
|
13
|
+
type TanstackSelectFieldComponent = (<TItems extends object>(props: TanstackSelectFieldProps<TItems> & {
|
|
14
|
+
ref?: ForwardedRef<HTMLDivElement>;
|
|
15
|
+
}) => JSX.Element) & {
|
|
16
|
+
displayName?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The `TanstackSelectField` component renders a complete select field (label, select, feedback)
|
|
20
|
+
* wired to the TanStack Form context. It manages state and accessibility via the
|
|
21
|
+
* context provided by `useTanstackUnityForm` and `<form.AppField name="…">`.
|
|
22
|
+
*
|
|
23
|
+
* Behavior:
|
|
24
|
+
* - Renders a full field structure including `TanstackFormLabel`, `TanstackFormHelperText`,
|
|
25
|
+
* `TanstackSelect`, and `TanstackFormFeedbackText`.
|
|
26
|
+
* - Supports both static options (using `SelectOption` components) and dynamic options
|
|
27
|
+
* (using the `items` prop with a render function).
|
|
28
|
+
* - Can be configured with search functionality via the `isSearchable` prop.
|
|
29
|
+
* - Displays validation feedback automatically based on the form's validation state.
|
|
30
|
+
*
|
|
31
|
+
* Accessibility:
|
|
32
|
+
* - Automatically wires `aria-labelledby`, `aria-describedby` (helper/feedback), and
|
|
33
|
+
* `aria-details` using identifiers from the `a11y` context.
|
|
34
|
+
*
|
|
35
|
+
* Key props:
|
|
36
|
+
* - `label: string` — label text for the field.
|
|
37
|
+
* - `children: ReactNode | ((item: T) => ReactNode)` — static options or render function for dynamic items.
|
|
38
|
+
* - `items?: Iterable<T>` — array of items for dynamic rendering.
|
|
39
|
+
* - `isSearchable?: boolean` — enables search input in the select dropdown.
|
|
40
|
+
* - `helperText?: ReactNode` — helper text displayed below the field.
|
|
41
|
+
* - `contextualLink?: ReactNode` — optional contextual link, referenced via `aria-details`.
|
|
42
|
+
* - `isRequired?`, `requiredVariant?` — control the required indicator in the label.
|
|
43
|
+
* - `placeholder?: string` — placeholder text when no value is selected.
|
|
44
|
+
* - `placement?: 'top' | 'bottom'` — popover placement.
|
|
45
|
+
*
|
|
46
|
+
* Example (static options):
|
|
47
|
+
* ```tsx
|
|
48
|
+
* import { TanstackSelectField } from "@/components/select/TanstackSelectField"
|
|
49
|
+
* import { SelectOption } from "@/components/select/parts/SelectOption"
|
|
50
|
+
* import { useTanstackUnityForm } from "@/hooks/use-tanstack-form"
|
|
51
|
+
* import { z } from "zod"
|
|
52
|
+
*
|
|
53
|
+
* function Example() {
|
|
54
|
+
* const schema = z.object({
|
|
55
|
+
* fruit: z.string().min(1, 'Please select a fruit'),
|
|
56
|
+
* })
|
|
57
|
+
*
|
|
58
|
+
* const form = useTanstackUnityForm({
|
|
59
|
+
* validators: { onBlur: schema },
|
|
60
|
+
* defaultValues: { fruit: '' }
|
|
61
|
+
* })
|
|
62
|
+
*
|
|
63
|
+
* return (
|
|
64
|
+
* <form>
|
|
65
|
+
* <form.AppField name="fruit">
|
|
66
|
+
* {() => (
|
|
67
|
+
* <TanstackSelectField
|
|
68
|
+
* label="Favorite Fruit"
|
|
69
|
+
* helperText="Select your favorite fruit"
|
|
70
|
+
* placeholder="Choose a fruit"
|
|
71
|
+
* >
|
|
72
|
+
* <SelectOption id="Apple">Apple</SelectOption>
|
|
73
|
+
* <SelectOption id="Banana">Banana</SelectOption>
|
|
74
|
+
* <SelectOption id="Orange">Orange</SelectOption>
|
|
75
|
+
* </TanstackSelectField>
|
|
76
|
+
* )}
|
|
77
|
+
* </form.AppField>
|
|
78
|
+
* </form>
|
|
79
|
+
* )
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* Example (dynamic items with search):
|
|
84
|
+
* ```tsx
|
|
85
|
+
* function ExampleDynamic() {
|
|
86
|
+
* const items = [
|
|
87
|
+
* { id: 'Apple', name: 'Apple' },
|
|
88
|
+
* { id: 'Banana', name: 'Banana' },
|
|
89
|
+
* { id: 'Orange', name: 'Orange' },
|
|
90
|
+
* ]
|
|
91
|
+
*
|
|
92
|
+
* const schema = z.object({
|
|
93
|
+
* fruit: z.string(),
|
|
94
|
+
* })
|
|
95
|
+
*
|
|
96
|
+
* const form = useTanstackUnityForm({
|
|
97
|
+
* validators: { onBlur: schema },
|
|
98
|
+
* defaultValues: { fruit: '' }
|
|
99
|
+
* })
|
|
100
|
+
*
|
|
101
|
+
* return (
|
|
102
|
+
* <form>
|
|
103
|
+
* <form.AppField name="fruit">
|
|
104
|
+
* {() => (
|
|
105
|
+
* <TanstackSelectField
|
|
106
|
+
* label="Favorite Fruit"
|
|
107
|
+
* isSearchable
|
|
108
|
+
* items={items}
|
|
109
|
+
* >
|
|
110
|
+
* {item => <SelectOption id={item.id}>{item.name}</SelectOption>}
|
|
111
|
+
* </TanstackSelectField>
|
|
112
|
+
* )}
|
|
113
|
+
* </form.AppField>
|
|
114
|
+
* </form>
|
|
115
|
+
* )
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
* @remarks Migration from `SelectField` (non-TanStack):
|
|
119
|
+
* - Do not pass a `name` prop to the field: use `<form.AppField name="…">`.
|
|
120
|
+
* - `value`, `defaultValue`, `onChange`, and `isInvalid` are derived from the TanStack form context.
|
|
121
|
+
* - The field automatically manages validation state and displays error messages.
|
|
122
|
+
*/
|
|
123
|
+
declare const TanstackSelectField: TanstackSelectFieldComponent;
|
|
124
|
+
export { TanstackSelectField };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsxs as s, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as d } from "react";
|
|
3
|
+
import { TanstackFormFeedbackText as f } from "../form-field/parts/TanstackFormFeedbackText.js";
|
|
4
|
+
import { TanstackFormHelperText as k } from "../form-field/parts/TanstackFormHelperText.js";
|
|
5
|
+
import { TanstackFormLabel as p } from "../form-field/parts/TanstackFormLabel.js";
|
|
6
|
+
import { TanstackFormField as F } from "../form-field/TanstackFormField.js";
|
|
7
|
+
import { TanstackSelect as T } from "../select/TanstackSelect.js";
|
|
8
|
+
const S = ({
|
|
9
|
+
label: a,
|
|
10
|
+
helperText: t,
|
|
11
|
+
contextualLink: e,
|
|
12
|
+
isRequired: o,
|
|
13
|
+
isDisabled: c,
|
|
14
|
+
isReadOnly: m,
|
|
15
|
+
requiredVariant: n,
|
|
16
|
+
...i
|
|
17
|
+
}, l) => /* @__PURE__ */ s(F, { children: [
|
|
18
|
+
/* @__PURE__ */ r(
|
|
19
|
+
p,
|
|
20
|
+
{
|
|
21
|
+
requiredVariant: n,
|
|
22
|
+
isRequired: o,
|
|
23
|
+
children: a
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
t && /* @__PURE__ */ r(k, { children: t }),
|
|
27
|
+
/* @__PURE__ */ r(
|
|
28
|
+
T,
|
|
29
|
+
{
|
|
30
|
+
ref: l,
|
|
31
|
+
isDisabled: c,
|
|
32
|
+
isReadOnly: m,
|
|
33
|
+
...i
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ r(f, {}),
|
|
37
|
+
e
|
|
38
|
+
] }), x = d(function(t, e) {
|
|
39
|
+
return S(t, e);
|
|
40
|
+
});
|
|
41
|
+
x.displayName = "TanstackSelectField";
|
|
42
|
+
export {
|
|
43
|
+
x as TanstackSelectField
|
|
44
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { JSX, Ref } from 'react';
|
|
2
|
+
import { ListBoxProps as AriaListBoxProps } from 'react-aria-components';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the SelectList component.
|
|
5
|
+
* @template TType - The type of items in the list
|
|
6
|
+
*/
|
|
7
|
+
export interface SelectListProps<TType extends object = object> extends Omit<AriaListBoxProps<TType>, 'className' | 'style' | 'selectedKeys' | 'onSelectionChange' | 'children'> {
|
|
8
|
+
/**
|
|
9
|
+
* An iterable data structure containing items to render in the list.
|
|
10
|
+
*/
|
|
11
|
+
items: Iterable<TType>;
|
|
12
|
+
/**
|
|
13
|
+
* Render function for each item. Receives an item and should generally returns a `SelectListOption` component.
|
|
14
|
+
*/
|
|
15
|
+
children: (item: TType) => React.ReactElement;
|
|
16
|
+
/**
|
|
17
|
+
* The current selected keys of the list. Pass a `Set` of keys to control the selection state.
|
|
18
|
+
*/
|
|
19
|
+
value: AriaListBoxProps<TType>['selectedKeys'];
|
|
20
|
+
/**
|
|
21
|
+
* Callback function invoked when the user selection changes. Use this to update the controlled `value` prop.
|
|
22
|
+
* @param keys - The new selection as a `Selection` type (Set of keys or "all")
|
|
23
|
+
*/
|
|
24
|
+
onChange: AriaListBoxProps<TType>['onSelectionChange'];
|
|
25
|
+
/**
|
|
26
|
+
* Controls whether to display a search input at the top of the list. Set to `true` to always show the search bar, or `false` to never show it. When undefined, the search bar appears automatically when there are 10 or more items.
|
|
27
|
+
* @default undefined - Auto-shows when items >= 10
|
|
28
|
+
*/
|
|
29
|
+
showSearch?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Additional CSS classes to apply to the list container. Use this to customize height or other container styles.
|
|
32
|
+
*/
|
|
33
|
+
className?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Enables selected-first sorting, which moves selected items into a dedicated section at the top of the list. Selected items can be deselected directly from this section.
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
sortSelectedFirst?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Accessible label for the selected items section. This label is screen-reader only and provides context for the separated selected items.
|
|
41
|
+
* @default "Selected"
|
|
42
|
+
*/
|
|
43
|
+
selectedSectionLabel?: string;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
isLoading?: boolean;
|
|
48
|
+
}
|
|
49
|
+
type SelectListComponent = {
|
|
50
|
+
<TType extends object>(props: SelectListProps<TType> & {
|
|
51
|
+
ref?: Ref<HTMLDivElement>;
|
|
52
|
+
}): JSX.Element;
|
|
53
|
+
displayName: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Provides a high-performance, accessible list for selecting items with built-in virtualization, search, and sorting capabilities.
|
|
57
|
+
* Use this component to allow users to select one or multiple items from a list of options. The component automatically handles large datasets through virtualization, provides built-in search functionality when needed, and can optionally organize selected items into a dedicated section at the top for better visibility.
|
|
58
|
+
* @param {SelectListProps} props - Regular props from React Aria's ListBox, plus selection, search, and sorting configuration
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* import { SelectList, SelectListOption } from '@payfit/unity-components'
|
|
62
|
+
*
|
|
63
|
+
* function FruitSelector() {
|
|
64
|
+
* const [selected, setSelected] = useState(new Set())
|
|
65
|
+
* const fruits = [
|
|
66
|
+
* { id: 'apple', label: 'Apple' },
|
|
67
|
+
* { id: 'banana', label: 'Banana' }
|
|
68
|
+
* ]
|
|
69
|
+
*
|
|
70
|
+
* return (
|
|
71
|
+
* <SelectList
|
|
72
|
+
* items={fruits}
|
|
73
|
+
* value={selected}
|
|
74
|
+
* onChange={setSelected}
|
|
75
|
+
* selectionMode="multiple"
|
|
76
|
+
* >
|
|
77
|
+
* {item => <SelectListOption id={item.id}>{item.label}</SelectListOption>}
|
|
78
|
+
* </SelectList>
|
|
79
|
+
* )
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
* @remarks
|
|
83
|
+
* - List items are automatically virtualized for optimal performance with large datasets (hundreds or thousands of items)
|
|
84
|
+
* - Search bar appears automatically when the list contains 10 or more items, or can be controlled via the `showSearch` prop
|
|
85
|
+
* - Set `sortSelectedFirst` to `true` to move selected items into a dedicated section at the top of the list
|
|
86
|
+
* - The component requires the dynamic API pattern: provide both `items` array and a render function as `children`
|
|
87
|
+
* - Selection state is fully controlled via the `value` and `onChange` props following React's controlled component pattern
|
|
88
|
+
* - Supports both flat item lists and grouped sections using `SelectListOptGroup`
|
|
89
|
+
* @see {@link SelectListProps} for all available props
|
|
90
|
+
* @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/components/select-list GitHub}
|
|
91
|
+
* @see Design specs in {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library Figma}
|
|
92
|
+
* @see Developer docs in {@link https://unity-components.payfit.io/?path=/docs/data-selectlist unity-components.payfit.io}
|
|
93
|
+
*/
|
|
94
|
+
declare const SelectList: SelectListComponent;
|
|
95
|
+
export { SelectList };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as F, useMemo as y } from "react";
|
|
3
|
+
import { uyTv as R } from "@payfit/unity-themes";
|
|
4
|
+
import { useFilter as T, ListBox as H, Collection as M, Autocomplete as O, Separator as _, Virtualizer as m } from "react-aria-components";
|
|
5
|
+
import { DEFAULT_SEARCH_THRESHOLD as j, VIRTUALIZATION_CONFIG as d } from "./constants.js";
|
|
6
|
+
import { useControlledSelection as k } from "./hooks/useControlledSelection.js";
|
|
7
|
+
import { useSelectedFirstSorting as D } from "./hooks/useSelectedFirstSorting.js";
|
|
8
|
+
import { SelectedItemsSection as U } from "./parts/SelectedItemsSection.js";
|
|
9
|
+
import { SelectListEmptyState as V } from "./parts/SelectListEmptyState.js";
|
|
10
|
+
import { SelectListSearchInput as z } from "./parts/SelectListSearchInput.js";
|
|
11
|
+
const G = R({
|
|
12
|
+
slots: {
|
|
13
|
+
wrapper: "uy:bg-surface-neutral uy:p-100 uy:overscroll-contain uy:overflow-hidden",
|
|
14
|
+
base: "uy:flex uy:w-full uy:gap-100 uy:h-500 uy:border uy:border-solid uy:rounded-75 uy:py-100 uy:border-border-form-enabled uy:bg-surface-form-enabled uy:px-150 uy:typography-body uy:focus-within:outline-none uy:focus-within:ring-2 uy:focus-within:ring-utility-focus-ring uy:focus-within:ring-offset-2 uy:active:border-border-form-active",
|
|
15
|
+
inputContainer: "uy:sticky uy:top-0 uy:bg-surface-neutral",
|
|
16
|
+
separator: "uy:h-[1px] uy:bg-border-neutral uy:w-full uy:mt-100",
|
|
17
|
+
list: "uy:overflow-y-auto uy:mt-100",
|
|
18
|
+
selectedListBox: "uy:bg-surface-neutral uy:border-b uy:border-border-neutral uy:py-100 uy:data-[empty=true]:border-0 uy:data-[is-last=true]:border-0 uy:data-[is-last=true]:py-0"
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
function K({
|
|
22
|
+
items: r,
|
|
23
|
+
children: f,
|
|
24
|
+
value: p,
|
|
25
|
+
onChange: h,
|
|
26
|
+
className: b,
|
|
27
|
+
showSearch: a = !1,
|
|
28
|
+
sortSelectedFirst: g = !1,
|
|
29
|
+
selectedSectionLabel: S = "Selected",
|
|
30
|
+
...o
|
|
31
|
+
}, I) {
|
|
32
|
+
const { contains: L } = T({ sensitivity: "base" }), { wrapper: v, inputContainer: w, list: x, separator: C, selectedListBox: A } = G(), [i, l] = k(
|
|
33
|
+
p,
|
|
34
|
+
h
|
|
35
|
+
), N = y(() => (Array.isArray(r) ? r.length : Array.from(r).length) >= j || a, [r, a]), t = D(
|
|
36
|
+
r,
|
|
37
|
+
i,
|
|
38
|
+
g
|
|
39
|
+
), n = y(() => t.remainingItems ? !t.remainingItems[Symbol.iterator]().next().done : !1, [t.remainingItems]), u = /* @__PURE__ */ e(
|
|
40
|
+
U,
|
|
41
|
+
{
|
|
42
|
+
items: t.selectedItems,
|
|
43
|
+
selectedKeys: i,
|
|
44
|
+
onSelectionChange: l,
|
|
45
|
+
selectionMode: o.selectionMode,
|
|
46
|
+
selectionBehavior: o.selectionBehavior,
|
|
47
|
+
label: S,
|
|
48
|
+
className: A(),
|
|
49
|
+
"data-is-last": !n
|
|
50
|
+
}
|
|
51
|
+
), c = /* @__PURE__ */ e(
|
|
52
|
+
H,
|
|
53
|
+
{
|
|
54
|
+
...o,
|
|
55
|
+
className: x({ className: b }),
|
|
56
|
+
items: t.remainingItems,
|
|
57
|
+
selectedKeys: i,
|
|
58
|
+
onSelectionChange: l,
|
|
59
|
+
renderEmptyState: V,
|
|
60
|
+
children: /* @__PURE__ */ e(M, { items: t.remainingItems, children: f })
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
return /* @__PURE__ */ e("div", { ref: I, className: v(), children: N ? /* @__PURE__ */ s(O, { filter: L, children: [
|
|
64
|
+
/* @__PURE__ */ s("div", { className: w(), "data-dd-privacy": "mask", children: [
|
|
65
|
+
/* @__PURE__ */ e(z, {}),
|
|
66
|
+
/* @__PURE__ */ e(_, { className: C() })
|
|
67
|
+
] }),
|
|
68
|
+
u,
|
|
69
|
+
n && /* @__PURE__ */ e(m, { ...d, children: c })
|
|
70
|
+
] }) : /* @__PURE__ */ s(E, { children: [
|
|
71
|
+
u,
|
|
72
|
+
n && /* @__PURE__ */ e(m, { ...d, children: c })
|
|
73
|
+
] }) });
|
|
74
|
+
}
|
|
75
|
+
const Z = F(K);
|
|
76
|
+
Z.displayName = "SelectList";
|
|
77
|
+
export {
|
|
78
|
+
Z as SelectList
|
|
79
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Key } from 'react-aria-components';
|
|
2
|
+
/**
|
|
3
|
+
* Type for items that have an id and can be selected
|
|
4
|
+
*/
|
|
5
|
+
export interface SelectableItem {
|
|
6
|
+
id: Key;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Type for sections that contain selectable items
|
|
11
|
+
*/
|
|
12
|
+
export interface SectionWithChildren<TChild extends SelectableItem> {
|
|
13
|
+
children: TChild[];
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Helper types for processing results from flat items
|
|
18
|
+
*/
|
|
19
|
+
export interface ProcessedFlatDynamicContent<TType> {
|
|
20
|
+
selectedItems: TType[];
|
|
21
|
+
remainingItems: TType[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Helper types for processing results from nested items
|
|
25
|
+
*/
|
|
26
|
+
export interface ProcessedDynamicContent<TType> {
|
|
27
|
+
selectedItems: TType[];
|
|
28
|
+
remainingSections: TType[];
|
|
29
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ListLayout } from 'react-aria-components';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for list virtualization.
|
|
4
|
+
* @remarks
|
|
5
|
+
* - `estimatedRowHeight` should ideally reference a design token
|
|
6
|
+
* - `estimatedHeadingHeight` should ideally reference a design token
|
|
7
|
+
* - These values affect scroll behavior and performance
|
|
8
|
+
*/
|
|
9
|
+
export declare const VIRTUALIZATION_CONFIG: {
|
|
10
|
+
readonly layout: typeof ListLayout;
|
|
11
|
+
readonly layoutOptions: {
|
|
12
|
+
/**
|
|
13
|
+
* Estimated height of each list item in pixels.
|
|
14
|
+
* Used for virtualization calculations.
|
|
15
|
+
*/
|
|
16
|
+
readonly estimatedRowHeight: number;
|
|
17
|
+
/**
|
|
18
|
+
* Estimated height of section headings in pixels.
|
|
19
|
+
* Used for virtualization calculations.
|
|
20
|
+
*/
|
|
21
|
+
readonly estimatedHeadingHeight: number;
|
|
22
|
+
/**
|
|
23
|
+
* Gap between items in pixels
|
|
24
|
+
*/
|
|
25
|
+
readonly gap: 0;
|
|
26
|
+
/**
|
|
27
|
+
* Padding around the list in pixels
|
|
28
|
+
*/
|
|
29
|
+
readonly padding: 0;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Default threshold for showing search input.
|
|
34
|
+
* Search is shown automatically when item count exceeds this value.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DEFAULT_SEARCH_THRESHOLD = 10;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as t from "@payfit/unity-themes/tokens/spacings.json";
|
|
2
|
+
import { ListLayout as s } from "react-aria-components";
|
|
3
|
+
const a = (o) => parseInt(o.replace("px", "").trim(), 10), i = a(t.spacing[500].$value), n = a(t.spacing[400].$value), p = {
|
|
4
|
+
layout: s,
|
|
5
|
+
layoutOptions: {
|
|
6
|
+
/**
|
|
7
|
+
* Estimated height of each list item in pixels.
|
|
8
|
+
* Used for virtualization calculations.
|
|
9
|
+
*/
|
|
10
|
+
estimatedRowHeight: i,
|
|
11
|
+
/**
|
|
12
|
+
* Estimated height of section headings in pixels.
|
|
13
|
+
* Used for virtualization calculations.
|
|
14
|
+
*/
|
|
15
|
+
estimatedHeadingHeight: n,
|
|
16
|
+
/**
|
|
17
|
+
* Gap between items in pixels
|
|
18
|
+
*/
|
|
19
|
+
gap: 0,
|
|
20
|
+
/**
|
|
21
|
+
* Padding around the list in pixels
|
|
22
|
+
*/
|
|
23
|
+
padding: 0
|
|
24
|
+
}
|
|
25
|
+
}, r = 10;
|
|
26
|
+
export {
|
|
27
|
+
r as DEFAULT_SEARCH_THRESHOLD,
|
|
28
|
+
p as VIRTUALIZATION_CONFIG
|
|
29
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Key } from 'react-aria-components';
|
|
2
|
+
import { ProcessedDynamicContent, ProcessedFlatDynamicContent, SectionWithChildren, SelectableItem } from './SelectList.types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Type guard to check if an object has a children array property,
|
|
5
|
+
* indicating it's a section containing selectable items.
|
|
6
|
+
* @param obj - Object to check
|
|
7
|
+
* @returns True if object is a section with children array
|
|
8
|
+
*/
|
|
9
|
+
export declare function hasSectionChildren<TChild extends SelectableItem>(obj: unknown): obj is SectionWithChildren<TChild>;
|
|
10
|
+
/**
|
|
11
|
+
* Type guard to check if items array contains nested sections or flat items
|
|
12
|
+
* by inspecting the first item in the iterable.
|
|
13
|
+
* Uses iterator directly to avoid converting entire iterable to array.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isNestedStructure<TChild extends SelectableItem>(items: Iterable<unknown>): items is Iterable<SectionWithChildren<TChild>>;
|
|
16
|
+
/**
|
|
17
|
+
* Processes a flat array of items, partitioning them into selected
|
|
18
|
+
* and unselected groups based on the provided selected keys.
|
|
19
|
+
* @param items - Flat iterable of items to process
|
|
20
|
+
* @param selectedKeys - Set of currently selected item keys
|
|
21
|
+
* @returns Object with selectedItems and remainingItems arrays
|
|
22
|
+
*/
|
|
23
|
+
export declare function processSelectedItemsForFlatDynamicItems<TItem extends SelectableItem>(items: Iterable<TItem>, selectedKeys: Set<Key>): ProcessedFlatDynamicContent<TItem>;
|
|
24
|
+
/**
|
|
25
|
+
* Extracts all selectable child items from a nested section structure,
|
|
26
|
+
* flattening the hierarchy into a single array.
|
|
27
|
+
* @param items - Iterable of sections containing child items
|
|
28
|
+
* @returns Object with flat array of all child items
|
|
29
|
+
*/
|
|
30
|
+
export declare function extractAllSelectableItems<TSection extends SectionWithChildren<TChild>, TChild extends SelectableItem>(items: Iterable<TSection>): {
|
|
31
|
+
allItems: TChild[];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Processes a nested structure (sections with children), extracting selected
|
|
35
|
+
* items and creating modified sections with selected items removed.
|
|
36
|
+
* @param items - Iterable of sections containing child items
|
|
37
|
+
* @param selectedKeys - Set of currently selected item keys
|
|
38
|
+
* @returns Object with selectedItems array and modified sections array
|
|
39
|
+
*/
|
|
40
|
+
export declare function processSelectedItemsForNestedDynamicItems<TSection extends SectionWithChildren<TChild>, TChild extends SelectableItem & {
|
|
41
|
+
label: string;
|
|
42
|
+
}>(items: Iterable<TSection>, selectedKeys: Set<Key>): ProcessedDynamicContent<TChild | TSection>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { partition as l } from "./utils/partition.js";
|
|
2
|
+
function c(r) {
|
|
3
|
+
return typeof r == "object" && r !== null && "children" in r && Array.isArray(r.children);
|
|
4
|
+
}
|
|
5
|
+
function d(r) {
|
|
6
|
+
const t = r[Symbol.iterator]().next();
|
|
7
|
+
return t.done ? !1 : c(t.value);
|
|
8
|
+
}
|
|
9
|
+
function u(r, n) {
|
|
10
|
+
const t = Array.from(r), [i, s] = l(
|
|
11
|
+
t,
|
|
12
|
+
(e) => n.has(e.id)
|
|
13
|
+
);
|
|
14
|
+
return { selectedItems: i, remainingItems: s };
|
|
15
|
+
}
|
|
16
|
+
function m(r) {
|
|
17
|
+
const n = [];
|
|
18
|
+
return Array.from(r).forEach((t) => {
|
|
19
|
+
c(t) && t.children.forEach((i) => {
|
|
20
|
+
n.push(i);
|
|
21
|
+
});
|
|
22
|
+
}), { allItems: n };
|
|
23
|
+
}
|
|
24
|
+
function h(r, n) {
|
|
25
|
+
const { allItems: t } = m(r), i = t.filter((e) => n.has(e.id)), s = Array.from(r).map((e) => {
|
|
26
|
+
if (c(e)) {
|
|
27
|
+
const o = e.children.filter(
|
|
28
|
+
(a) => !n.has(a.id)
|
|
29
|
+
);
|
|
30
|
+
return {
|
|
31
|
+
...e,
|
|
32
|
+
children: o
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return e;
|
|
36
|
+
}).filter((e) => c(e) && e.children.length > 0);
|
|
37
|
+
return {
|
|
38
|
+
selectedItems: i,
|
|
39
|
+
remainingSections: s
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
m as extractAllSelectableItems,
|
|
44
|
+
c as hasSectionChildren,
|
|
45
|
+
d as isNestedStructure,
|
|
46
|
+
u as processSelectedItemsForFlatDynamicItems,
|
|
47
|
+
h as processSelectedItemsForNestedDynamicItems
|
|
48
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Key, Selection } from 'react-aria-components';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to manage controlled/uncontrolled selection state.
|
|
4
|
+
* Follows React's controlled component pattern.
|
|
5
|
+
* @param value - Controlled value (undefined for uncontrolled mode)
|
|
6
|
+
* @param onChange - Callback when selection changes
|
|
7
|
+
* @returns Tuple of [currentSelection, handleSelectionChange]
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* // Controlled mode
|
|
11
|
+
* const [selection, setSelection] = useControlledSelection(
|
|
12
|
+
* selectedKeys,
|
|
13
|
+
* handleChange
|
|
14
|
+
* )
|
|
15
|
+
*
|
|
16
|
+
* // Uncontrolled mode
|
|
17
|
+
* const [selection, setSelection] = useControlledSelection(
|
|
18
|
+
* undefined,
|
|
19
|
+
* handleChange
|
|
20
|
+
* )
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function useControlledSelection(value: 'all' | Iterable<Key> | undefined, onChange?: (keys: Selection) => void): [Selection, (keys: Selection) => void];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useState as i, useMemo as S, useCallback as a } from "react";
|
|
2
|
+
function m(e, o) {
|
|
3
|
+
const [l, s] = i(/* @__PURE__ */ new Set()), t = e !== void 0, c = S(
|
|
4
|
+
() => t ? e === "all" ? "all" : e instanceof Set ? e : new Set(e) : l,
|
|
5
|
+
[t, e, l]
|
|
6
|
+
), r = a(
|
|
7
|
+
(n) => {
|
|
8
|
+
t || s(n === "all" ? /* @__PURE__ */ new Set() : n), o?.(n);
|
|
9
|
+
},
|
|
10
|
+
[t, o]
|
|
11
|
+
);
|
|
12
|
+
return [c, r];
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
m as useControlledSelection
|
|
16
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Selection } from 'react-aria-components';
|
|
2
|
+
interface ProcessedItems<TType> {
|
|
3
|
+
selectedItems: TType[];
|
|
4
|
+
remainingItems: Iterable<TType> | undefined;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Hook to process items for selected-first sorting.
|
|
8
|
+
* Separates selected items into a dedicated section at the top.
|
|
9
|
+
* @param items - The items to process (flat or nested structure)
|
|
10
|
+
* @param selectedKeys - Currently selected keys
|
|
11
|
+
* @param enabled - Whether selected-first sorting is enabled
|
|
12
|
+
* @returns Processed items with selected items separated
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const processed = useSelectedFirstSorting(
|
|
16
|
+
* items,
|
|
17
|
+
* selectedKeys,
|
|
18
|
+
* sortSelectedFirst
|
|
19
|
+
* )
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function useSelectedFirstSorting<TType extends object>(items: Iterable<TType> | undefined, selectedKeys: Selection, enabled: boolean): ProcessedItems<TType>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useMemo as m } from "react";
|
|
2
|
+
import { isNestedStructure as c, processSelectedItemsForNestedDynamicItems as i, processSelectedItemsForFlatDynamicItems as o } from "../helpers.js";
|
|
3
|
+
function d(e, s, n) {
|
|
4
|
+
const r = m(() => s === "all" ? /* @__PURE__ */ new Set() : s, [s]);
|
|
5
|
+
return m(() => {
|
|
6
|
+
if (!n || !e || r.size === 0)
|
|
7
|
+
return { selectedItems: [], remainingItems: e };
|
|
8
|
+
if (c(e)) {
|
|
9
|
+
const t = i(
|
|
10
|
+
e,
|
|
11
|
+
r
|
|
12
|
+
);
|
|
13
|
+
return {
|
|
14
|
+
selectedItems: t.selectedItems,
|
|
15
|
+
remainingItems: t.remainingSections
|
|
16
|
+
};
|
|
17
|
+
} else {
|
|
18
|
+
const t = o(
|
|
19
|
+
e,
|
|
20
|
+
r
|
|
21
|
+
);
|
|
22
|
+
return {
|
|
23
|
+
selectedItems: t.selectedItems,
|
|
24
|
+
remainingItems: t.remainingItems
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}, [e, r, n]);
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
d as useSelectedFirstSorting
|
|
31
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Icon as s } from "@payfit/unity-icons";
|
|
3
|
+
import { FormattedMessage as u } from "react-intl";
|
|
4
|
+
import { Text as t } from "../../text/Text.js";
|
|
5
|
+
const a = () => /* @__PURE__ */ r("div", { className: "uy:flex uy:flex-col uy:gap-200 uy:items-center uy:justify-center uy:h-full uy:py-600", children: [
|
|
6
|
+
/* @__PURE__ */ e(
|
|
7
|
+
t,
|
|
8
|
+
{
|
|
9
|
+
variant: "body",
|
|
10
|
+
className: "uy:w-500 uy:h-500 uy:bg-surface-neutral-lowest uy:flex uy:items-center uy:justify-center uy:rounded-75",
|
|
11
|
+
children: /* @__PURE__ */ e(s, { size: 24, src: "MagnifyingGlassOutlined" })
|
|
12
|
+
}
|
|
13
|
+
),
|
|
14
|
+
/* @__PURE__ */ e(t, { variant: "bodyLarge", children: /* @__PURE__ */ e(
|
|
15
|
+
u,
|
|
16
|
+
{
|
|
17
|
+
id: "unity:component:autocomplete:panel:empty:label",
|
|
18
|
+
defaultMessage: "No results found"
|
|
19
|
+
}
|
|
20
|
+
) })
|
|
21
|
+
] });
|
|
22
|
+
a.displayName = "SelectListEmptyState";
|
|
23
|
+
export {
|
|
24
|
+
a as SelectListEmptyState
|
|
25
|
+
};
|