@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,192 @@
|
|
|
1
|
+
import { Selection } from 'react-aria-components';
|
|
2
|
+
import { SelectListProps } from '../select-list/SelectList.js';
|
|
3
|
+
import { FilterProps } from './Filter.types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Represents a single selectable item in a filter.
|
|
6
|
+
*
|
|
7
|
+
* Use this type to define the data structure for individual options in your filter.
|
|
8
|
+
* Each item must have a unique `id` and a human-readable `label`.
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const statusItems: FilterItem[] = [
|
|
12
|
+
* { id: 'active', label: 'Active' },
|
|
13
|
+
* { id: 'inactive', label: 'Inactive' },
|
|
14
|
+
* { id: 'pending', label: 'Pending' },
|
|
15
|
+
* ]
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export interface FilterItem {
|
|
19
|
+
/**
|
|
20
|
+
* Unique identifier for the item. Used as the value in selections.
|
|
21
|
+
*/
|
|
22
|
+
id: string;
|
|
23
|
+
/**
|
|
24
|
+
* Human-readable label displayed to users.
|
|
25
|
+
*/
|
|
26
|
+
label: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Represents a group of related filter items.
|
|
30
|
+
*
|
|
31
|
+
* Use this type to organize filter options into logical categories, improving UX when
|
|
32
|
+
* dealing with many options. Groups are rendered with a header label and contain multiple
|
|
33
|
+
* child items.
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* const departmentGroups: FilterItemGroup[] = [
|
|
37
|
+
* {
|
|
38
|
+
* id: 'business',
|
|
39
|
+
* label: 'Business',
|
|
40
|
+
* children: [
|
|
41
|
+
* { id: 'sales', label: 'Sales' },
|
|
42
|
+
* { id: 'marketing', label: 'Marketing' },
|
|
43
|
+
* ],
|
|
44
|
+
* },
|
|
45
|
+
* {
|
|
46
|
+
* id: 'tech',
|
|
47
|
+
* label: 'Tech',
|
|
48
|
+
* children: [
|
|
49
|
+
* { id: 'engineering', label: 'Engineering' },
|
|
50
|
+
* { id: 'product', label: 'Product' },
|
|
51
|
+
* ],
|
|
52
|
+
* },
|
|
53
|
+
* ]
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export interface FilterItemGroup {
|
|
57
|
+
/**
|
|
58
|
+
* Unique identifier for the group.
|
|
59
|
+
*/
|
|
60
|
+
id: string;
|
|
61
|
+
/**
|
|
62
|
+
* Label for the group header.
|
|
63
|
+
*/
|
|
64
|
+
label: string;
|
|
65
|
+
/**
|
|
66
|
+
* Array of items belonging to this group.
|
|
67
|
+
*/
|
|
68
|
+
children: FilterItem[];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Creates a pre-configured SelectList control for use with the Filter component.
|
|
72
|
+
*
|
|
73
|
+
* This helper function simplifies the most common filter use case: selecting items from a list.
|
|
74
|
+
* It handles the rendering of SelectList with proper multi-select behavior, keyboard navigation,
|
|
75
|
+
* and support for both flat lists and grouped items. Use this function to quickly create filter
|
|
76
|
+
* controls without manually managing SelectList configuration.
|
|
77
|
+
*
|
|
78
|
+
* The function returns a render function compatible with the Filter component's `renderControl` prop.
|
|
79
|
+
* It automatically configures the SelectList with sensible defaults: multiple selection, selected items
|
|
80
|
+
* sorted first, and proper accessibility attributes.
|
|
81
|
+
* @template TFilterType - The type of the filter value (defaults to Selection from React Aria)
|
|
82
|
+
* @template TItemType - The type of items in the list (FilterItem or FilterItemGroup)
|
|
83
|
+
* @param items - An iterable collection of items or item groups to display in the list
|
|
84
|
+
* @param props - Additional props to pass to the SelectList component (excluding items, value,
|
|
85
|
+
* onChange, and children which are managed internally)
|
|
86
|
+
* @returns A render function that creates a SelectList with the provided items and configuration
|
|
87
|
+
* @example
|
|
88
|
+
* ```tsx
|
|
89
|
+
* import { Filter, selectListFilter } from '@payfit/unity-components'
|
|
90
|
+
* import { useState } from 'react'
|
|
91
|
+
*
|
|
92
|
+
* // Simple flat list
|
|
93
|
+
* const statusItems = [
|
|
94
|
+
* { id: 'active', label: 'Active' },
|
|
95
|
+
* { id: 'inactive', label: 'Inactive' },
|
|
96
|
+
* { id: 'pending', label: 'Pending' },
|
|
97
|
+
* ]
|
|
98
|
+
*
|
|
99
|
+
* function StatusFilter() {
|
|
100
|
+
* const [value, setValue] = useState<Set<string>>(new Set())
|
|
101
|
+
*
|
|
102
|
+
* return (
|
|
103
|
+
* <Filter
|
|
104
|
+
* label="Status"
|
|
105
|
+
* value={value}
|
|
106
|
+
* onChange={setValue}
|
|
107
|
+
* renderControl={selectListFilter(statusItems, {})}
|
|
108
|
+
* />
|
|
109
|
+
* )
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
* @example
|
|
113
|
+
* ```tsx
|
|
114
|
+
* // Grouped list with custom aria-label
|
|
115
|
+
* const departmentGroups = [
|
|
116
|
+
* {
|
|
117
|
+
* id: 'business',
|
|
118
|
+
* label: 'Business',
|
|
119
|
+
* children: [
|
|
120
|
+
* { id: 'sales', label: 'Sales' },
|
|
121
|
+
* { id: 'marketing', label: 'Marketing' },
|
|
122
|
+
* ],
|
|
123
|
+
* },
|
|
124
|
+
* {
|
|
125
|
+
* id: 'tech',
|
|
126
|
+
* label: 'Tech',
|
|
127
|
+
* children: [
|
|
128
|
+
* { id: 'engineering', label: 'Engineering' },
|
|
129
|
+
* { id: 'product', label: 'Product' },
|
|
130
|
+
* ],
|
|
131
|
+
* },
|
|
132
|
+
* ]
|
|
133
|
+
*
|
|
134
|
+
* function DepartmentFilter() {
|
|
135
|
+
* const [value, setValue] = useState<Set<string>>(new Set())
|
|
136
|
+
*
|
|
137
|
+
* return (
|
|
138
|
+
* <Filter
|
|
139
|
+
* label="Departments"
|
|
140
|
+
* value={value}
|
|
141
|
+
* onChange={setValue}
|
|
142
|
+
* renderControl={selectListFilter(departmentGroups, {
|
|
143
|
+
* 'aria-label': 'Select departments',
|
|
144
|
+
* })}
|
|
145
|
+
* />
|
|
146
|
+
* )
|
|
147
|
+
* }
|
|
148
|
+
* ```
|
|
149
|
+
* @remarks
|
|
150
|
+
* - The returned SelectList is configured with `selectionMode="multiple"` by default
|
|
151
|
+
* - Selected items are automatically sorted to the top of the list using `sortSelectedFirst`
|
|
152
|
+
* - The escape key behavior is set to `"none"` to prevent closing the filter popover accidentally
|
|
153
|
+
* - A maximum height of 300px is applied with scrolling enabled for long lists
|
|
154
|
+
* - Both flat lists (FilterItem[]) and grouped lists (FilterItemGroup[]) are supported
|
|
155
|
+
*/
|
|
156
|
+
export declare function selectListFilter<TFilterType extends Selection = Selection, TItemType extends FilterItem | FilterItemGroup = FilterItem | FilterItemGroup>(items: Iterable<TItemType>, props: Omit<SelectListProps<TItemType>, 'items' | 'value' | 'onChange' | 'children'>): (value: TFilterType, onChange: FilterProps<TFilterType>["onChange"]) => import("react/jsx-runtime").JSX.Element;
|
|
157
|
+
/**
|
|
158
|
+
* Render the label of a filter that uses the default SelectList component.
|
|
159
|
+
* This function will extract all the labels of all the selected items, and
|
|
160
|
+
* create a comma-separated string from them.
|
|
161
|
+
* @param items the array of items used in the select list
|
|
162
|
+
* @return A curried function that flattens items into a comma-separated string
|
|
163
|
+
* @example
|
|
164
|
+
* ```tsx
|
|
165
|
+
* import { Filter, selectListFilter, selectListLabel } from '@payfit/unity-components'
|
|
166
|
+
* import { useState } from 'react'
|
|
167
|
+
*
|
|
168
|
+
* // Simple flat list
|
|
169
|
+
* const statusItems = [
|
|
170
|
+
* { id: 'active', label: 'Active' },
|
|
171
|
+
* { id: 'inactive', label: 'Inactive' },
|
|
172
|
+
* { id: 'pending', label: 'Pending' },
|
|
173
|
+
* ]
|
|
174
|
+
*
|
|
175
|
+
* function StatusFilter() {
|
|
176
|
+
* const [value, setValue] = useState<Set<string>>(new Set())
|
|
177
|
+
*
|
|
178
|
+
* return (
|
|
179
|
+
* <Filter
|
|
180
|
+
* label="Status"
|
|
181
|
+
* value={value}
|
|
182
|
+
* onChange={setValue}
|
|
183
|
+
* renderControl={selectListFilter(statusItems, {})}
|
|
184
|
+
* renderLabel={selectListLabel(items)}
|
|
185
|
+
* />
|
|
186
|
+
* )
|
|
187
|
+
* }
|
|
188
|
+
* ```
|
|
189
|
+
* @remarks
|
|
190
|
+
* - Both flat lists (FilterItem[]) and grouped lists (FilterItemGroup[]) are supported
|
|
191
|
+
*/
|
|
192
|
+
export declare function selectListLabel(items: Array<FilterItem | FilterItemGroup>): (value: Selection) => string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { SelectListOptGroup as u } from "../select-list/parts/SelectListOptGroup.js";
|
|
3
|
+
import { SelectListOption as a } from "../select-list/parts/SelectListOption.js";
|
|
4
|
+
import { SelectList as p } from "../select-list/SelectList.js";
|
|
5
|
+
function s(l) {
|
|
6
|
+
return "children" in l && l.children.length > 0;
|
|
7
|
+
}
|
|
8
|
+
function m(l, t) {
|
|
9
|
+
const n = (r) => /* @__PURE__ */ c(u, { items: r.children, label: r.label, children: (o) => /* @__PURE__ */ c(a, { id: o.id, textValue: o.label, children: o.label }) }), e = (r) => /* @__PURE__ */ c(a, { id: r.id, textValue: r.label, children: r.label });
|
|
10
|
+
return (r, o) => /* @__PURE__ */ c(
|
|
11
|
+
p,
|
|
12
|
+
{
|
|
13
|
+
...t,
|
|
14
|
+
items: l,
|
|
15
|
+
value: r,
|
|
16
|
+
selectionMode: "multiple",
|
|
17
|
+
onChange: (i) => {
|
|
18
|
+
o(i);
|
|
19
|
+
},
|
|
20
|
+
escapeKeyBehavior: "none",
|
|
21
|
+
sortSelectedFirst: !0,
|
|
22
|
+
className: "uy:overflow-y-auto uy:scroll-pb-500",
|
|
23
|
+
children: (i) => s(i) ? n(i) : e(i)
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
function L(l) {
|
|
28
|
+
return (t) => {
|
|
29
|
+
if (t === "all")
|
|
30
|
+
return l.flatMap((e) => s(e) ? e.children : e).map((e) => e.label).join(", ");
|
|
31
|
+
const n = [];
|
|
32
|
+
for (const e of l) {
|
|
33
|
+
if (s(e)) {
|
|
34
|
+
n.push(...e.children.filter((r) => t.has(r.id)));
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
t.has(e.id) && n.push(e);
|
|
38
|
+
}
|
|
39
|
+
return n.map((e) => e.label).join(", ");
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
m as selectListFilter,
|
|
44
|
+
L as selectListLabel
|
|
45
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { JSX, Ref } from 'react';
|
|
2
|
+
import { FilterProps } from './Filter.types.js';
|
|
3
|
+
import { selectListFilter, selectListLabel } from './Filter.controls.js';
|
|
4
|
+
/**
|
|
5
|
+
* Tailwind variants for the Filter container.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare const filterContainer: import('tailwind-variants').TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import('tailwind-variants').TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
9
|
+
export declare const filterDismissButton: import('tailwind-variants').TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import('tailwind-variants').TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;
|
|
10
|
+
type FilterComponent = {
|
|
11
|
+
<TType>(props: FilterProps<TType> & {
|
|
12
|
+
ref?: Ref<HTMLDivElement>;
|
|
13
|
+
}): JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The `Filter` component allows users to refine data by selecting specific criteria from a customizable control.
|
|
18
|
+
* It provides a consistent, accessible interface for filtering operations across the application, reducing the need
|
|
19
|
+
* to build custom filter UIs for each data set. The component automatically handles common filtering patterns like
|
|
20
|
+
* multi-select, value display, and popover management, letting you focus on the filtering logic itself.
|
|
21
|
+
* The Filter component offers flexible value selection through the `renderControl` prop, which can render any
|
|
22
|
+
* interactive control (SelectList, DateCalendar, CheckboxGroup, etc.). It displays selected values with smart
|
|
23
|
+
* formatting: showing the values inline when few are selected, or displaying a numeric badge when many values
|
|
24
|
+
* are selected. The component includes built-in internationalization support and follows accessibility best practices
|
|
25
|
+
* with proper ARIA attributes and keyboard navigation.
|
|
26
|
+
* @template TType - The type of the filter value. Use `Set<string>` for multi-select filters or primitive types
|
|
27
|
+
* for single-value filters. This ensures type safety across value, onChange, and renderControl.
|
|
28
|
+
* @param {FilterProps<TType>} props - The component props
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* import { Filter, selectListFilter } from '@payfit/unity-components'
|
|
32
|
+
* import { useState } from 'react'
|
|
33
|
+
*
|
|
34
|
+
* // Define your filter items
|
|
35
|
+
* const statusItems = [
|
|
36
|
+
* { id: 'active', label: 'Active' },
|
|
37
|
+
* { id: 'inactive', label: 'Inactive' },
|
|
38
|
+
* { id: 'pending', label: 'Pending' },
|
|
39
|
+
* ]
|
|
40
|
+
*
|
|
41
|
+
* function EmployeeFilters() {
|
|
42
|
+
* const [status, setStatus] = useState<Set<string>>(new Set())
|
|
43
|
+
*
|
|
44
|
+
* return (
|
|
45
|
+
* <Filter
|
|
46
|
+
* label="Status"
|
|
47
|
+
* value={status}
|
|
48
|
+
* onChange={setStatus}
|
|
49
|
+
* renderControl={selectListFilter(statusItems, {})}
|
|
50
|
+
* />
|
|
51
|
+
* )
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx
|
|
56
|
+
* // Multi-select filter with grouped items and custom formatting
|
|
57
|
+
* import { Filter, selectListFilter } from '@payfit/unity-components'
|
|
58
|
+
* import { useState } from 'react'
|
|
59
|
+
*
|
|
60
|
+
* const departmentGroups = [
|
|
61
|
+
* {
|
|
62
|
+
* id: 'business',
|
|
63
|
+
* label: 'Business',
|
|
64
|
+
* children: [
|
|
65
|
+
* { id: 'sales', label: 'Sales' },
|
|
66
|
+
* { id: 'marketing', label: 'Marketing' },
|
|
67
|
+
* ],
|
|
68
|
+
* },
|
|
69
|
+
* {
|
|
70
|
+
* id: 'tech',
|
|
71
|
+
* label: 'Tech',
|
|
72
|
+
* children: [
|
|
73
|
+
* { id: 'engineering', label: 'Engineering' },
|
|
74
|
+
* { id: 'product', label: 'Product' },
|
|
75
|
+
* ],
|
|
76
|
+
* },
|
|
77
|
+
* ]
|
|
78
|
+
*
|
|
79
|
+
* function DepartmentFilter() {
|
|
80
|
+
* const [selected, setSelected] = useState<Set<string>>(new Set(['sales']))
|
|
81
|
+
*
|
|
82
|
+
* return (
|
|
83
|
+
* <Filter
|
|
84
|
+
* label="Departments"
|
|
85
|
+
* prefixIcon="BusinessCenterOutlined"
|
|
86
|
+
* value={selected}
|
|
87
|
+
* onChange={setSelected}
|
|
88
|
+
* maxVisibleValues={2}
|
|
89
|
+
* renderControl={selectListFilter(departmentGroups, {})}
|
|
90
|
+
* renderLabel={(values) =>
|
|
91
|
+
* Array.from(values)
|
|
92
|
+
* .map((v) => v.charAt(0).toUpperCase() + v.slice(1))
|
|
93
|
+
* .join(' • ')
|
|
94
|
+
* }
|
|
95
|
+
* />
|
|
96
|
+
* )
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
* @remarks
|
|
100
|
+
* - Use the `renderControl` prop to provide the interactive element for value selection. The helper function
|
|
101
|
+
* `selectListFilter` simplifies this for common SelectList-based filters, but you can render any control
|
|
102
|
+
* like DateCalendar, CheckboxGroup, or custom components
|
|
103
|
+
* - Customize the display of selected values by providing a `renderLabel` function. This function receives
|
|
104
|
+
* the current `value` and should return a string representation for display in the filter button
|
|
105
|
+
* - Control badge visibility with the `maxVisibleValues` prop (default: 3). When the number of selected values
|
|
106
|
+
* exceeds this threshold, the filter automatically shows a numeric badge instead of listing all values
|
|
107
|
+
* - Set `isDismissable={true}` and provide an `onDismiss` callback to allow users to remove the filter entirely.
|
|
108
|
+
* This is useful for optional filters that can be added/removed dynamically
|
|
109
|
+
* - The component is fully internationalized with support for English, French, and Spanish. The "Clear" and
|
|
110
|
+
* "Apply" button labels adapt automatically based on the user's locale
|
|
111
|
+
* @see {@link FilterProps} for all available props
|
|
112
|
+
* @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/components/filter GitHub}
|
|
113
|
+
* @see Design specs {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library?node-id=8976-13410&t=Hd2aEwwHm7cNU2L5-4 Figma}
|
|
114
|
+
* @see Design docs in {@link https://www.payfit.design/ Payfit.design}
|
|
115
|
+
* @see Developer docs in {@link https://unity-components.payfit.io/?path=/docs/components-filter--docs unity-components.payfit.io}
|
|
116
|
+
*/
|
|
117
|
+
declare const Filter: FilterComponent;
|
|
118
|
+
/**
|
|
119
|
+
* This module contains preconfigured render functions
|
|
120
|
+
* that are ready to be used for the `Filter` component's `renderControl` prop.
|
|
121
|
+
* @remarks
|
|
122
|
+
* - Contains utilities for rendering controls: SelectList
|
|
123
|
+
* - These render functions are higher-order function. When called, they return a function matching the `Filter` component's `renderLabel` signature
|
|
124
|
+
* @example
|
|
125
|
+
* ```tsx
|
|
126
|
+
* import { Filter, FilterControls } from '@payfit/unity-components'
|
|
127
|
+
* import { useState } from 'react'
|
|
128
|
+
*
|
|
129
|
+
* // Define your filter items
|
|
130
|
+
* const statusItems = [
|
|
131
|
+
* { id: 'active', label: 'Active' },
|
|
132
|
+
* { id: 'inactive', label: 'Inactive' },
|
|
133
|
+
* { id: 'pending', label: 'Pending' },
|
|
134
|
+
* ]
|
|
135
|
+
*
|
|
136
|
+
* function EmployeeFilters() {
|
|
137
|
+
* const [status, setStatus] = useState<Set<string>>(new Set())
|
|
138
|
+
*
|
|
139
|
+
* return (
|
|
140
|
+
* <Filter
|
|
141
|
+
* label="Status"
|
|
142
|
+
* value={status}
|
|
143
|
+
* onChange={setStatus}
|
|
144
|
+
* renderControl={FilterControls.selectList(statusItems, {})}
|
|
145
|
+
* />
|
|
146
|
+
* )
|
|
147
|
+
* }
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
export declare const FilterControls: {
|
|
151
|
+
selectList: typeof selectListFilter;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* This module contains preconfigured render functions that are ready to be used for `Filter` component's `renderLabel` prop.
|
|
155
|
+
* @remarks
|
|
156
|
+
* - Contains utilities for rendering labels managed by: SelectList
|
|
157
|
+
* - These render functions are higher-order function. When called, they return a function matching the `Filter` component's `renderLabel` signature
|
|
158
|
+
* @example
|
|
159
|
+
* ```tsx
|
|
160
|
+
* import { Filter, FilterControls, FilterLabels } from '@payfit/unity-components'
|
|
161
|
+
* import { useState } from 'react'
|
|
162
|
+
*
|
|
163
|
+
* // Define your filter items
|
|
164
|
+
* const statusItems = [
|
|
165
|
+
* { id: 'active', label: 'Active' },
|
|
166
|
+
* { id: 'inactive', label: 'Inactive' },
|
|
167
|
+
* { id: 'pending', label: 'Pending' },
|
|
168
|
+
* ]
|
|
169
|
+
*
|
|
170
|
+
* function EmployeeFilters() {
|
|
171
|
+
* const [status, setStatus] = useState<Set<string>>(new Set())
|
|
172
|
+
*
|
|
173
|
+
* return (
|
|
174
|
+
* <Filter
|
|
175
|
+
* label="Status"
|
|
176
|
+
* value={status}
|
|
177
|
+
* onChange={setStatus}
|
|
178
|
+
* renderControl={FilterControls.selectList(statusItems, {})}
|
|
179
|
+
* renderLabel={FilterLabels.selectList(statusItems)}
|
|
180
|
+
* />
|
|
181
|
+
* )
|
|
182
|
+
* }
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
export declare const FilterLabels: {
|
|
186
|
+
selectList: typeof selectListLabel;
|
|
187
|
+
};
|
|
188
|
+
export { Filter };
|
|
189
|
+
export type { FilterProps } from './Filter.types.js';
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsxs as f, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as A, useCallback as D } from "react";
|
|
3
|
+
import { uyTv as c } from "@payfit/unity-themes";
|
|
4
|
+
import { DialogTrigger as E } from "react-aria-components";
|
|
5
|
+
import { useIntl as G } from "react-intl";
|
|
6
|
+
import { CircularIconButton as H } from "../icon-button/CircularIconButton.js";
|
|
7
|
+
import { selectListFilter as J, selectListLabel as K } from "./Filter.controls.js";
|
|
8
|
+
import { useFilterIds as Q } from "./hooks/useFilterIds.js";
|
|
9
|
+
import { useFilterState as U } from "./hooks/useFilterState.js";
|
|
10
|
+
import { useFilterValue as V } from "./hooks/useFilterValue.js";
|
|
11
|
+
import { FilterButton as W } from "./parts/FilterButton.js";
|
|
12
|
+
import { FilterLabel as X } from "./parts/FilterLabel.js";
|
|
13
|
+
import { FilterPopover as Y } from "./parts/FilterPopover.js";
|
|
14
|
+
import { defaultRenderLabel as Z } from "./utils/value-formatters.js";
|
|
15
|
+
const _ = c({
|
|
16
|
+
base: [
|
|
17
|
+
"uy:group uy:transition-colors",
|
|
18
|
+
"uy:flex uy:items-center",
|
|
19
|
+
"uy:rounded-md uy:sm:rounded-sm",
|
|
20
|
+
"uy:border uy:border-solid",
|
|
21
|
+
"uy:cursor-pointer uy:aria-[disabled=true]:cursor-not-allowed",
|
|
22
|
+
"uy:w-fit",
|
|
23
|
+
"uy:border-border-form-enabled uy:bg-surface-form-enabled uy:text-content-form-enabled",
|
|
24
|
+
"uy:has-data-[hovered]:border-border-form-hover uy:has-data-[hovered]:bg-surface-form-hover",
|
|
25
|
+
"uy:has-data-[pressed]:border-border-form-pressed uy:has-data-[pressed]:bg-surface-form-pressed",
|
|
26
|
+
"uy:aria-[disabled=true]:border-border-form-disabled uy:aria-[disabled=true]:bg-surface-form-disabled uy:aria-[disabled=true]:text-content-form-disabled",
|
|
27
|
+
"uy:data-[status=active]:text-content-primary-enabled",
|
|
28
|
+
"uy:focus-within:outline-2 uy:focus-within:outline-offset-2 uy:focus-within:outline-utility-focus-ring",
|
|
29
|
+
'uy:[&:not(:has([data-unity-slot="dismiss"]))]:pr-1.5'
|
|
30
|
+
]
|
|
31
|
+
}), $ = c({
|
|
32
|
+
base: [
|
|
33
|
+
"uy:rounded-r-sm uy:leading-0",
|
|
34
|
+
"uy:pl-0.25 uy:py-1 uy:pr-1 uy:h-full"
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
function ee({
|
|
38
|
+
id: y,
|
|
39
|
+
label: p,
|
|
40
|
+
prefixIcon: b,
|
|
41
|
+
onDismiss: h,
|
|
42
|
+
renderControl: g,
|
|
43
|
+
value: t,
|
|
44
|
+
onChange: v,
|
|
45
|
+
isDismissable: F = !0,
|
|
46
|
+
isDisabled: r = !1,
|
|
47
|
+
isActive: I = !1,
|
|
48
|
+
renderLabel: w = Z,
|
|
49
|
+
maxVisibleValues: i = 3,
|
|
50
|
+
shouldCloseOnConfirm: C = !0,
|
|
51
|
+
onClearSelection: L,
|
|
52
|
+
shouldCloseOnClear: x = !0,
|
|
53
|
+
onConfirmSelection: B,
|
|
54
|
+
onFilterOpen: s,
|
|
55
|
+
onFilterClose: a,
|
|
56
|
+
isDefaultOpen: O = !1,
|
|
57
|
+
...N
|
|
58
|
+
}, R) {
|
|
59
|
+
const j = G(), { rootId: l, labelId: o, valueId: d, dismissButtonId: M } = Q(y), { isOpen: u, setIsOpen: n, confirm: P, clear: S } = U({
|
|
60
|
+
initialIsOpen: O,
|
|
61
|
+
shouldCloseOnConfirm: C,
|
|
62
|
+
shouldCloseOnClear: x,
|
|
63
|
+
onConfirmSelection: B,
|
|
64
|
+
onClearSelection: L
|
|
65
|
+
}), T = D(
|
|
66
|
+
(m) => {
|
|
67
|
+
n(m), m ? s?.() : a?.();
|
|
68
|
+
},
|
|
69
|
+
[n, s, a]
|
|
70
|
+
), { valuesCount: k, shouldShowBadge: q, formattedValue: z } = V(
|
|
71
|
+
t,
|
|
72
|
+
i,
|
|
73
|
+
w
|
|
74
|
+
);
|
|
75
|
+
return /* @__PURE__ */ f(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
ref: R,
|
|
79
|
+
role: "group",
|
|
80
|
+
id: l,
|
|
81
|
+
className: _(),
|
|
82
|
+
"aria-labelledby": o,
|
|
83
|
+
"aria-describedby": d,
|
|
84
|
+
"aria-disabled": r,
|
|
85
|
+
"data-dd-privacy": "allow",
|
|
86
|
+
"data-status": I || u ? "active" : "idle",
|
|
87
|
+
"data-unity-component": "Filter",
|
|
88
|
+
...N,
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ f(E, { isOpen: u, onOpenChange: T, children: [
|
|
91
|
+
/* @__PURE__ */ e(
|
|
92
|
+
W,
|
|
93
|
+
{
|
|
94
|
+
labelId: o,
|
|
95
|
+
prefixIcon: b,
|
|
96
|
+
isDisabled: r,
|
|
97
|
+
children: /* @__PURE__ */ e(
|
|
98
|
+
X,
|
|
99
|
+
{
|
|
100
|
+
labelId: o,
|
|
101
|
+
valueId: d,
|
|
102
|
+
label: p,
|
|
103
|
+
value: t,
|
|
104
|
+
valuesCount: k,
|
|
105
|
+
shouldShowBadge: q,
|
|
106
|
+
formattedValue: z,
|
|
107
|
+
maxVisibleValues: i,
|
|
108
|
+
isDisabled: r
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ e(Y, { onConfirm: P, onClear: S, children: g(t, v) })
|
|
114
|
+
] }),
|
|
115
|
+
F && /* @__PURE__ */ e("div", { "data-unity-slot": "dismiss", className: $(), children: /* @__PURE__ */ e(
|
|
116
|
+
H,
|
|
117
|
+
{
|
|
118
|
+
icon: "CloseOutlined",
|
|
119
|
+
color: "content.neutral.lowest",
|
|
120
|
+
title: j.formatMessage({
|
|
121
|
+
id: "unity:component:filter:dismiss:title",
|
|
122
|
+
defaultMessage: "Remove filter"
|
|
123
|
+
}),
|
|
124
|
+
onPress: h,
|
|
125
|
+
id: M,
|
|
126
|
+
"aria-controls": l,
|
|
127
|
+
isDisabled: r
|
|
128
|
+
}
|
|
129
|
+
) })
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
const re = A(ee);
|
|
135
|
+
re.displayName = "Filter";
|
|
136
|
+
const be = {
|
|
137
|
+
selectList: J
|
|
138
|
+
}, he = {
|
|
139
|
+
selectList: K
|
|
140
|
+
};
|
|
141
|
+
export {
|
|
142
|
+
re as Filter,
|
|
143
|
+
be as FilterControls,
|
|
144
|
+
he as FilterLabels,
|
|
145
|
+
_ as filterContainer,
|
|
146
|
+
$ as filterDismissButton
|
|
147
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { UnityIcon } from '@payfit/unity-icons';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
type Prettify<T> = {
|
|
4
|
+
[K in keyof T]: T[K];
|
|
5
|
+
} & {};
|
|
6
|
+
export interface FilterEventProps {
|
|
7
|
+
/**
|
|
8
|
+
* Callback function invoked when the filter popover opens.
|
|
9
|
+
* @default undefined
|
|
10
|
+
*/
|
|
11
|
+
onFilterOpen?: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* Callback function invoked when the filter popover closes.
|
|
14
|
+
* @default undefined
|
|
15
|
+
*/
|
|
16
|
+
onFilterClose?: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Callback function called when the user presses "confirm" or "apply" button.
|
|
19
|
+
* @default undefined
|
|
20
|
+
*/
|
|
21
|
+
onConfirmSelection?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Callback function called when the user presses "clear" button.
|
|
24
|
+
* @default undefined
|
|
25
|
+
*/
|
|
26
|
+
onClearSelection?: () => void;
|
|
27
|
+
}
|
|
28
|
+
export interface FilterDisplayProps {
|
|
29
|
+
/**
|
|
30
|
+
* The label for the filter.
|
|
31
|
+
*/
|
|
32
|
+
label: string;
|
|
33
|
+
/**
|
|
34
|
+
* The prefix icon show at the start of the filter.
|
|
35
|
+
* @default undefined
|
|
36
|
+
*/
|
|
37
|
+
prefixIcon?: UnityIcon;
|
|
38
|
+
/**
|
|
39
|
+
* The maximum number of visible selected values in the filter label.
|
|
40
|
+
* If there are more selected values than this number, the label will be hidden and a counter badge will be shown instead.
|
|
41
|
+
* @default 3
|
|
42
|
+
*/
|
|
43
|
+
maxVisibleValues?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the filter is disabled.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
isDisabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the filter is active.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
isActive?: boolean;
|
|
54
|
+
}
|
|
55
|
+
type FilterDismissProps = {
|
|
56
|
+
/**
|
|
57
|
+
* Whether the filter is dismissable by the user. Shows a dismiss button at the end of the filter.
|
|
58
|
+
* @default true
|
|
59
|
+
*/
|
|
60
|
+
isDismissable: true;
|
|
61
|
+
/**
|
|
62
|
+
* Callback function called when the user dismisses the filter.
|
|
63
|
+
* @default undefined
|
|
64
|
+
*/
|
|
65
|
+
onDismiss: () => void;
|
|
66
|
+
} | {
|
|
67
|
+
isDismissable: false;
|
|
68
|
+
onDismiss?: never;
|
|
69
|
+
} | {
|
|
70
|
+
isDismissable?: undefined;
|
|
71
|
+
onDismiss?: never;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Filter component props supporting both controlled and uncontrolled modes
|
|
75
|
+
* @template TType - The type of the filter value
|
|
76
|
+
*/
|
|
77
|
+
export type FilterProps<TType> = Prettify<FilterEventProps & FilterDisplayProps & FilterDismissProps & {
|
|
78
|
+
/**
|
|
79
|
+
* The unique identifier for the filter.
|
|
80
|
+
*/
|
|
81
|
+
id?: string;
|
|
82
|
+
/**
|
|
83
|
+
* The value of the filter.
|
|
84
|
+
* @default undefined
|
|
85
|
+
*/
|
|
86
|
+
value: TType;
|
|
87
|
+
/**
|
|
88
|
+
* Callback function to handle changes in the filter value.
|
|
89
|
+
* @param value - The new value of the filter
|
|
90
|
+
*/
|
|
91
|
+
onChange: (value: TType) => void;
|
|
92
|
+
/**
|
|
93
|
+
* render prop to render the controlling component for filter value selection
|
|
94
|
+
* @param value
|
|
95
|
+
* @param onChange
|
|
96
|
+
*/
|
|
97
|
+
renderControl: (value: TType, onChange: (value: TType) => void) => ReactNode;
|
|
98
|
+
/**
|
|
99
|
+
* render prop to render the label for the filter value selection. By default, it will render the value as a string.
|
|
100
|
+
* If the value is iterable, it will render the values as a comma-separated string.
|
|
101
|
+
* @param value
|
|
102
|
+
*/
|
|
103
|
+
renderLabel?: (value: TType) => ReactNode;
|
|
104
|
+
/**
|
|
105
|
+
* whether the filter should close when the user confirms the selection.
|
|
106
|
+
* @default true
|
|
107
|
+
*/
|
|
108
|
+
shouldCloseOnConfirm?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* whether the filter should close when the user clears the selection.
|
|
111
|
+
* @default true
|
|
112
|
+
*/
|
|
113
|
+
shouldCloseOnClear?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Whether the filter popover should be open by default when the component first mounts.
|
|
116
|
+
* This only affects the initial state on mount - the component manages its own state after that.
|
|
117
|
+
* @default false
|
|
118
|
+
*/
|
|
119
|
+
isDefaultOpen?: boolean;
|
|
120
|
+
}>;
|
|
121
|
+
export {};
|