@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,79 @@
|
|
|
1
|
+
import { jsx as t, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { uyTv as m } from "@payfit/unity-themes";
|
|
3
|
+
import { Popover as c, Dialog as g, Separator as f } from "react-aria-components";
|
|
4
|
+
import { FormattedMessage as e } from "react-intl";
|
|
5
|
+
import { Button as r } from "../../button/Button.js";
|
|
6
|
+
const x = m({
|
|
7
|
+
slots: {
|
|
8
|
+
popover: [
|
|
9
|
+
"uy:border uy:border-solid uy:border-border-neutral uy:bg-surface-neutral uy:rounded-sm uy:shadow-floating uy:min-w-[320px] uy:max-w-[800px] uy:relative uy:isolate uy:overflow-hidden",
|
|
10
|
+
"uy:transition-all uy:duration-200 uy:linear uy:data-[entering]:opacity-100 uy:data-[exiting]:opacity-0",
|
|
11
|
+
'uy:data-[entering]:data-[placement="bottom"]:-translate-y-100 uy:data-[entering]:data-[placement="bottom"]:translate-x-0 uy:data-[exiting]:data-[placement="bottom"]:translate-y-0',
|
|
12
|
+
'uy:data-[entering]:data-[placement="top"]:translate-y-100 uy:data-[entering]:data-[placement="top"]:translate-x-0 uy:data-[exiting]:data-[placement="top"]:translate-y-0',
|
|
13
|
+
'uy:data-[entering]:data-[placement="left"]:translate-x-100 uy:data-[entering]:data-[placement="left"]:translate-y-0 uy:data-[exiting]:data-[placement="left"]:translate-x-0',
|
|
14
|
+
'uy:data-[entering]:data-[placement="right"]:-translate-x-100 uy:data-[entering]:data-[placement="right"]:translate-y-0 uy:data-[exiting]:data-[placement="right"]:translate-y-0'
|
|
15
|
+
],
|
|
16
|
+
dialog: ["uy:flex uy:flex-col uy:gap-0"],
|
|
17
|
+
content: ["uy:flex-1 uy:max-h-[500px] uy:overflow-y-auto"],
|
|
18
|
+
footer: [
|
|
19
|
+
"uy:mx-100 uy:mb-100",
|
|
20
|
+
"uy:sticky uy:bottom-0 uy:z-2",
|
|
21
|
+
"uy:flex-0",
|
|
22
|
+
"uy:bg-surface-neutral"
|
|
23
|
+
],
|
|
24
|
+
separator: ["uy:mb-100 uy:bg-border-neutral uy:h-px"],
|
|
25
|
+
actions: ["uy:flex uy:justify-between uy:gap-100"]
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
function P({
|
|
29
|
+
children: n,
|
|
30
|
+
onConfirm: o,
|
|
31
|
+
onClear: l
|
|
32
|
+
}) {
|
|
33
|
+
const { popover: i, dialog: u, content: y, footer: s, separator: d, actions: p } = x();
|
|
34
|
+
return /* @__PURE__ */ t(c, { className: i(), placement: "bottom left", children: /* @__PURE__ */ a(g, { className: u(), children: [
|
|
35
|
+
/* @__PURE__ */ t("div", { className: y(), children: n }),
|
|
36
|
+
/* @__PURE__ */ a("footer", { className: s(), children: [
|
|
37
|
+
/* @__PURE__ */ t(f, { className: d() }),
|
|
38
|
+
/* @__PURE__ */ a("div", { className: p(), children: [
|
|
39
|
+
/* @__PURE__ */ t(
|
|
40
|
+
r,
|
|
41
|
+
{
|
|
42
|
+
variant: "ghost",
|
|
43
|
+
color: "danger",
|
|
44
|
+
size: "full",
|
|
45
|
+
prefixIcon: "TrashOutlined",
|
|
46
|
+
onPress: l,
|
|
47
|
+
children: /* @__PURE__ */ t(
|
|
48
|
+
e,
|
|
49
|
+
{
|
|
50
|
+
id: "unity:component:common:clear:title",
|
|
51
|
+
defaultMessage: "Clear"
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ t(
|
|
57
|
+
r,
|
|
58
|
+
{
|
|
59
|
+
variant: "ghost",
|
|
60
|
+
color: "primary",
|
|
61
|
+
size: "full",
|
|
62
|
+
onPress: o,
|
|
63
|
+
children: /* @__PURE__ */ t(
|
|
64
|
+
e,
|
|
65
|
+
{
|
|
66
|
+
id: "unity:component:filter:action:apply",
|
|
67
|
+
defaultMessage: "Apply"
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] })
|
|
73
|
+
] })
|
|
74
|
+
] }) });
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
P as FilterPopover,
|
|
78
|
+
x as filterPopover
|
|
79
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guard to check if a value is a composite (non-null object).
|
|
3
|
+
* This utility determines whether a value is an object type that can contain
|
|
4
|
+
* properties or be iterable, excluding primitive types and null.
|
|
5
|
+
* @param value - The value to check
|
|
6
|
+
* @returns `true` if the value is a non-null object, `false` otherwise
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* isCompositeValue({}) // true
|
|
10
|
+
* isCompositeValue([]) // true
|
|
11
|
+
* isCompositeValue(null) // false
|
|
12
|
+
* isCompositeValue("string") // false
|
|
13
|
+
* isCompositeValue(123) // false
|
|
14
|
+
* ```
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function isCompositeValue<TType>(value: TType): value is TType & object;
|
|
18
|
+
/**
|
|
19
|
+
* Type guard to check if a value implements the Iterable protocol.
|
|
20
|
+
* This utility determines whether a value can be iterated over using
|
|
21
|
+
* `for...of` loops or spread operators. Common iterable types include
|
|
22
|
+
* arrays, Maps, Sets, and strings.
|
|
23
|
+
* @param value - The value to check
|
|
24
|
+
* @returns `true` if the value is iterable, `false` otherwise
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* isIterable([1, 2, 3]) // true
|
|
28
|
+
* isIterable(new Set([1, 2])) // true
|
|
29
|
+
* isIterable(new Map()) // true
|
|
30
|
+
* isIterable("hello") // true
|
|
31
|
+
* isIterable({}) // false
|
|
32
|
+
* isIterable(123) // false
|
|
33
|
+
* ```
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export declare function isIterable<TType>(value: TType): value is TType & Iterable<unknown>;
|
|
37
|
+
/**
|
|
38
|
+
* Default renderer for filter values that converts any value to a string representation.
|
|
39
|
+
* This utility provides a sensible default for displaying filter values in the UI.
|
|
40
|
+
* For primitive values, it returns their string representation. For iterable values
|
|
41
|
+
* (arrays, Sets, Maps, etc.), it joins all items with a comma and space.
|
|
42
|
+
* @param value - The value to render as a string
|
|
43
|
+
* @returns A string representation of the value
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* // Primitive values
|
|
47
|
+
* defaultRenderLabel("active") // "active"
|
|
48
|
+
* defaultRenderLabel(42) // "42"
|
|
49
|
+
* defaultRenderLabel(true) // "true"
|
|
50
|
+
*
|
|
51
|
+
* // Iterable values
|
|
52
|
+
* defaultRenderLabel(["apple", "banana"]) // "apple, banana"
|
|
53
|
+
* defaultRenderLabel(new Set([1, 2, 3])) // "1, 2, 3"
|
|
54
|
+
*
|
|
55
|
+
* // Edge cases
|
|
56
|
+
* defaultRenderLabel(null) // "null"
|
|
57
|
+
* defaultRenderLabel(undefined) // "undefined"
|
|
58
|
+
* defaultRenderLabel([]) // ""
|
|
59
|
+
* ```
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export declare function defaultRenderLabel(value: unknown): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function t(r) {
|
|
2
|
+
return r !== null && typeof r == "object";
|
|
3
|
+
}
|
|
4
|
+
function n(r) {
|
|
5
|
+
return t(r) && Symbol.iterator in r;
|
|
6
|
+
}
|
|
7
|
+
function i(r) {
|
|
8
|
+
return !t(r) || !n(r) ? String(r) : Array.from(r).join(", ");
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
i as defaultRenderLabel,
|
|
12
|
+
t as isCompositeValue,
|
|
13
|
+
n as isIterable
|
|
14
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { FilterToolbarProps } from './FilterToolbar.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Tailwind variants for the FilterToolbar component styling.
|
|
4
|
+
* Defines layout slots for the toolbar container, filters area, and action buttons.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare const filterToolbar: import('tailwind-variants').TVReturnType<{
|
|
8
|
+
[key: string]: {
|
|
9
|
+
[key: string]: import('tailwind-merge').ClassNameValue | {
|
|
10
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
11
|
+
actions?: import('tailwind-merge').ClassNameValue;
|
|
12
|
+
filters?: import('tailwind-merge').ClassNameValue;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
} | {
|
|
16
|
+
[x: string]: {
|
|
17
|
+
[x: string]: import('tailwind-merge').ClassNameValue | {
|
|
18
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
19
|
+
actions?: import('tailwind-merge').ClassNameValue;
|
|
20
|
+
filters?: import('tailwind-merge').ClassNameValue;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
} | {}, {
|
|
24
|
+
base: string[];
|
|
25
|
+
filters: string[];
|
|
26
|
+
actions: string[];
|
|
27
|
+
}, undefined, {
|
|
28
|
+
[key: string]: {
|
|
29
|
+
[key: string]: import('tailwind-merge').ClassNameValue | {
|
|
30
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
31
|
+
actions?: import('tailwind-merge').ClassNameValue;
|
|
32
|
+
filters?: import('tailwind-merge').ClassNameValue;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
} | {}, {
|
|
36
|
+
base: string[];
|
|
37
|
+
filters: string[];
|
|
38
|
+
actions: string[];
|
|
39
|
+
}, import('tailwind-variants').TVReturnType<unknown, {
|
|
40
|
+
base: string[];
|
|
41
|
+
filters: string[];
|
|
42
|
+
actions: string[];
|
|
43
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
44
|
+
/**
|
|
45
|
+
* The FilterToolbar component manages a dynamic collection of filters in a toolbar layout, enabling users to build complex filtering UIs.
|
|
46
|
+
* The FilterToolbar provides a data-driven approach to filter management where filters can be added, configured,
|
|
47
|
+
* and removed on demand. Each filter maintains its own state while the toolbar orchestrates the overall filtering experience.
|
|
48
|
+
* @param {FilterToolbarProps} props - Configuration for the filter toolbar including filter definitions and event handlers
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* import { FilterToolbar } from '@payfit/unity-components'
|
|
52
|
+
* import { useState } from 'react'
|
|
53
|
+
*
|
|
54
|
+
* function Example() {
|
|
55
|
+
* const [filters, setFilters] = useState([])
|
|
56
|
+
*
|
|
57
|
+
* const filterDefs = [
|
|
58
|
+
* {
|
|
59
|
+
* id: 'status',
|
|
60
|
+
* label: 'Status',
|
|
61
|
+
* renderControl: (value, onChange) => (
|
|
62
|
+
* <Select value={value} onChange={onChange}>
|
|
63
|
+
* <Option value="active">Active</Option>
|
|
64
|
+
* <Option value="inactive">Inactive</Option>
|
|
65
|
+
* </Select>
|
|
66
|
+
* ),
|
|
67
|
+
* renderLabel: (value) => value
|
|
68
|
+
* },
|
|
69
|
+
* {
|
|
70
|
+
* id: 'department',
|
|
71
|
+
* label: 'Department',
|
|
72
|
+
* renderControl: (value, onChange) => (
|
|
73
|
+
* <Select value={value} onChange={onChange}>
|
|
74
|
+
* <Option value="engineering">Engineering</Option>
|
|
75
|
+
* <Option value="sales">Sales</Option>
|
|
76
|
+
* </Select>
|
|
77
|
+
* ),
|
|
78
|
+
* renderLabel: (value) => value
|
|
79
|
+
* }
|
|
80
|
+
* ]
|
|
81
|
+
*
|
|
82
|
+
* return (
|
|
83
|
+
* <FilterToolbar
|
|
84
|
+
* filterDefs={filterDefs}
|
|
85
|
+
* onChange={(appliedFilters) => {
|
|
86
|
+
* setFilters(appliedFilters)
|
|
87
|
+
* }}
|
|
88
|
+
* />
|
|
89
|
+
* )
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
* @remarks
|
|
93
|
+
* - The toolbar manages filter state internally, providing serializable filter values through the `onChange` callback
|
|
94
|
+
* - Filters can be prepopulated using the `initialValue` prop with an array of `AppliedFilter` objects
|
|
95
|
+
* - Each filter definition must include a unique `id`, `label`, and `renderControl` function to render the filter UI
|
|
96
|
+
* - The `renderLabel` function customizes how selected values appear in the filter button
|
|
97
|
+
* - Newly added filters automatically open their popover to guide users through configuration
|
|
98
|
+
* - All filters can be cleared at once using the "Clear filters" button
|
|
99
|
+
* - The component is uncontrolled by default but notifies parent components of state changes via callbacks
|
|
100
|
+
* @see {@link FilterToolbarProps} for all available props
|
|
101
|
+
* @see {@link FilterDef} for filter definition structure
|
|
102
|
+
* @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/components/filter-toolbar GitHub}
|
|
103
|
+
* @see Design specs {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library?node-id=8976-10418 Figma}
|
|
104
|
+
* @see Design docs in {@link https://www.payfit.design/24f360409/p/998c5f-filter Payfit.design}
|
|
105
|
+
* @see Developer docs in {@link https://unity-components.payfit.io/?path=/docs/data-filtertoolbar--docs unity-components.payfit.io}
|
|
106
|
+
*/
|
|
107
|
+
declare const FilterToolbar: import('react').ForwardRefExoticComponent<FilterToolbarProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
108
|
+
export { FilterToolbar };
|
|
109
|
+
export * from './utils/filter-adapters.js';
|
|
110
|
+
export type * from './FilterToolbar.types.js';
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { jsxs as p, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as B, useState as G, useMemo as f } from "react";
|
|
3
|
+
import { uyTv as H } from "@payfit/unity-themes";
|
|
4
|
+
import { useId as W } from "react-aria";
|
|
5
|
+
import { Toolbar as Y, Group as k } from "react-aria-components";
|
|
6
|
+
import { useIntl as q, FormattedMessage as z } from "react-intl";
|
|
7
|
+
import { Button as J } from "../button/Button.js";
|
|
8
|
+
import { Filter as K } from "../filter/Filter.js";
|
|
9
|
+
import { useFilterToolbarState as Q } from "./hooks/use-filter-toolbar-state.js";
|
|
10
|
+
import { AddFilter as U } from "./parts/AddFilter.js";
|
|
11
|
+
const X = H({
|
|
12
|
+
slots: {
|
|
13
|
+
base: ["uy:flex uy:gap-100 uy:flex-wrap uy:items-center"],
|
|
14
|
+
filters: ["uy:list-none uy:contents"],
|
|
15
|
+
actions: ["uy:contents"]
|
|
16
|
+
}
|
|
17
|
+
}), Z = B(
|
|
18
|
+
({
|
|
19
|
+
filterDefs: a,
|
|
20
|
+
initialValue: F,
|
|
21
|
+
onChange: y,
|
|
22
|
+
onClearFiltersPress: g,
|
|
23
|
+
onAddFilterPress: h,
|
|
24
|
+
...C
|
|
25
|
+
}, L) => {
|
|
26
|
+
const i = q(), s = W(), [M, c] = G(
|
|
27
|
+
/* @__PURE__ */ new Set()
|
|
28
|
+
), {
|
|
29
|
+
appliedFilters: m,
|
|
30
|
+
availableFilterDefs: v,
|
|
31
|
+
filterValues: A,
|
|
32
|
+
status: u,
|
|
33
|
+
addFilter: S,
|
|
34
|
+
clearFilters: T,
|
|
35
|
+
removeFilter: w,
|
|
36
|
+
setFilterValue: n
|
|
37
|
+
} = Q({
|
|
38
|
+
filterDefs: a,
|
|
39
|
+
initialValue: F,
|
|
40
|
+
onChange: y
|
|
41
|
+
}), x = f(
|
|
42
|
+
() => new Map(a.map((t) => [t.id, t])),
|
|
43
|
+
[a]
|
|
44
|
+
), D = (t) => {
|
|
45
|
+
if (t === "all") return;
|
|
46
|
+
const l = Array.from(t).map(String);
|
|
47
|
+
S(l), c((e) => /* @__PURE__ */ new Set([...e, ...l])), h?.(l);
|
|
48
|
+
}, I = () => {
|
|
49
|
+
T(), g?.();
|
|
50
|
+
}, _ = (t, l) => {
|
|
51
|
+
n(t, l);
|
|
52
|
+
}, N = (t) => {
|
|
53
|
+
w(t);
|
|
54
|
+
}, P = (t) => {
|
|
55
|
+
c((l) => {
|
|
56
|
+
const e = new Set(l);
|
|
57
|
+
return e.delete(t), e;
|
|
58
|
+
});
|
|
59
|
+
}, E = u === "WITH_ALL_FILTERS_APPLIED", O = u !== "EMPTY", { base: V, filters: $, actions: j } = X(), d = f(() => ({
|
|
60
|
+
toolbar: i.formatMessage({
|
|
61
|
+
id: "unity:component:filter-toolbar:label",
|
|
62
|
+
defaultMessage: "Filter toolbar"
|
|
63
|
+
}),
|
|
64
|
+
filterList: i.formatMessage({
|
|
65
|
+
id: "unity:component:filter-toolbar:filter-list:label",
|
|
66
|
+
defaultMessage: "Applied filters"
|
|
67
|
+
}),
|
|
68
|
+
filterControls: i.formatMessage({
|
|
69
|
+
id: "unity:component:filter-toolbar:filter-controls:label",
|
|
70
|
+
defaultMessage: "Filter control"
|
|
71
|
+
})
|
|
72
|
+
}), [i]), o = f(() => ({
|
|
73
|
+
filterList: `filter-toolbar-${s}__filter-list`,
|
|
74
|
+
filterControls: `filter-toolbar-${s}__filter-controls`
|
|
75
|
+
}), [s]);
|
|
76
|
+
return /* @__PURE__ */ p(
|
|
77
|
+
Y,
|
|
78
|
+
{
|
|
79
|
+
ref: L,
|
|
80
|
+
className: V(),
|
|
81
|
+
"aria-label": d.toolbar,
|
|
82
|
+
...C,
|
|
83
|
+
children: [
|
|
84
|
+
m.length > 0 && /* @__PURE__ */ r(
|
|
85
|
+
"ul",
|
|
86
|
+
{
|
|
87
|
+
className: $(),
|
|
88
|
+
"aria-live": "polite",
|
|
89
|
+
"aria-atomic": "true",
|
|
90
|
+
"aria-relevant": "additions removals",
|
|
91
|
+
"aria-label": d.filterList,
|
|
92
|
+
id: o.filterList,
|
|
93
|
+
children: m.map((t, l) => {
|
|
94
|
+
const e = x.get(t);
|
|
95
|
+
if (!e) return null;
|
|
96
|
+
const b = A.get(t);
|
|
97
|
+
return /* @__PURE__ */ r("li", { role: "presentation", children: /* @__PURE__ */ r(
|
|
98
|
+
K,
|
|
99
|
+
{
|
|
100
|
+
id: e.id,
|
|
101
|
+
label: e.label,
|
|
102
|
+
value: b,
|
|
103
|
+
onChange: (R) => {
|
|
104
|
+
_(e.id, R);
|
|
105
|
+
},
|
|
106
|
+
renderControl: e.renderControl,
|
|
107
|
+
renderLabel: e.renderLabel,
|
|
108
|
+
isDismissable: !0,
|
|
109
|
+
isDefaultOpen: M.has(t),
|
|
110
|
+
onFilterOpen: () => {
|
|
111
|
+
P(e.id);
|
|
112
|
+
},
|
|
113
|
+
onDismiss: () => {
|
|
114
|
+
N(e.id);
|
|
115
|
+
},
|
|
116
|
+
onClearSelection: () => {
|
|
117
|
+
n(e.id, void 0);
|
|
118
|
+
},
|
|
119
|
+
onConfirmSelection: () => {
|
|
120
|
+
n(e.id, b);
|
|
121
|
+
},
|
|
122
|
+
...e.filterProps
|
|
123
|
+
}
|
|
124
|
+
) }, `filter-item-${l}`);
|
|
125
|
+
})
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
/* @__PURE__ */ p(
|
|
129
|
+
k,
|
|
130
|
+
{
|
|
131
|
+
className: j(),
|
|
132
|
+
"aria-label": d.filterControls,
|
|
133
|
+
id: o.filterControls,
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ r(
|
|
136
|
+
U,
|
|
137
|
+
{
|
|
138
|
+
availableFilterDefs: [...v],
|
|
139
|
+
isDisabled: E,
|
|
140
|
+
onSelectionChange: D,
|
|
141
|
+
"aria-controls": o.filterControls
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
O && /* @__PURE__ */ r(
|
|
145
|
+
J,
|
|
146
|
+
{
|
|
147
|
+
variant: "ghost",
|
|
148
|
+
color: "neutral",
|
|
149
|
+
onPress: I,
|
|
150
|
+
"aria-controls": o.filterList,
|
|
151
|
+
children: /* @__PURE__ */ r(
|
|
152
|
+
z,
|
|
153
|
+
{
|
|
154
|
+
id: "unity:component:filter-toolbar:clear-filters:label",
|
|
155
|
+
defaultMessage: "Clear filters"
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
Z.displayName = "FilterToolbar";
|
|
169
|
+
export {
|
|
170
|
+
Z as FilterToolbar,
|
|
171
|
+
X as filterToolbar
|
|
172
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { FilterDisplayProps, FilterEventProps, FilterProps } from '../filter/Filter.types.js';
|
|
2
|
+
import { AppliedFilter, SerializableAppliedFilter } from './hooks/use-filter-toolbar-state.js';
|
|
3
|
+
export type { AppliedFilter, SerializableAppliedFilter };
|
|
4
|
+
/**
|
|
5
|
+
* Defines the configuration for an individual filter within the FilterToolbar.
|
|
6
|
+
* Each FilterDef specifies how a filter should render its control UI, display selected values,
|
|
7
|
+
* and handle user interactions.
|
|
8
|
+
* @template TDataType - The type of data this filter works with (e.g., string, number, string[], etc.)
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const statusFilterDef: FilterDef<string> = {
|
|
12
|
+
* id: 'status',
|
|
13
|
+
* label: 'Employee Status',
|
|
14
|
+
* renderControl: (value, onChange) => (
|
|
15
|
+
* <Select value={value} onChange={onChange}>
|
|
16
|
+
* <Option value="active">Active</Option>
|
|
17
|
+
* <Option value="inactive">Inactive</Option>
|
|
18
|
+
* </Select>
|
|
19
|
+
* ),
|
|
20
|
+
* renderLabel: (value) => value,
|
|
21
|
+
* filterProps: {
|
|
22
|
+
* prefixIcon: 'filter',
|
|
23
|
+
* maxVisibleValues: 2
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export interface FilterDef<TDataType = unknown> {
|
|
29
|
+
/**
|
|
30
|
+
* Unique identifier for the filter. Used to track filter state and must be unique across all filters in the toolbar.
|
|
31
|
+
*/
|
|
32
|
+
id: string;
|
|
33
|
+
/**
|
|
34
|
+
* Display label shown on the filter button.
|
|
35
|
+
*/
|
|
36
|
+
label: string;
|
|
37
|
+
/**
|
|
38
|
+
* Render function that provides the control UI for selecting filter values.
|
|
39
|
+
* Receives the current value and an onChange callback to update the value.
|
|
40
|
+
* @param value - The current filter value
|
|
41
|
+
* @param onChange - Callback to update the filter value
|
|
42
|
+
* @returns ReactNode representing the filter control (e.g., Select, Checkbox group, DatePicker)
|
|
43
|
+
*/
|
|
44
|
+
renderControl: FilterProps<TDataType>['renderControl'];
|
|
45
|
+
/**
|
|
46
|
+
* render function to customize how selected values are displayed in the filter button.
|
|
47
|
+
* If not provided, values are rendered as strings or comma-separated lists for arrays.
|
|
48
|
+
* @param value - The current filter value
|
|
49
|
+
* @returns ReactNode representing the formatted value display
|
|
50
|
+
*/
|
|
51
|
+
renderLabel?: FilterProps<TDataType>['renderLabel'];
|
|
52
|
+
/**
|
|
53
|
+
* Optional additional props to customize the filter button appearance and behavior.
|
|
54
|
+
* Accepts a subset of Filter component props including display and event handler props.
|
|
55
|
+
*/
|
|
56
|
+
filterProps?: Partial<FilterDisplayProps & FilterEventProps>;
|
|
57
|
+
/**
|
|
58
|
+
* Index signature allowing additional custom properties for extended filter definitions.
|
|
59
|
+
*/
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Props for the FilterToolbar component.
|
|
64
|
+
* @example
|
|
65
|
+
* ```tsx
|
|
66
|
+
* const filterToolbarProps: FilterToolbarProps = {
|
|
67
|
+
* filterDefs: [
|
|
68
|
+
* { id: 'status', label: 'Status', renderControl: (v, onChange) => <Select value={v} onChange={onChange} /> }
|
|
69
|
+
* ],
|
|
70
|
+
* initialValue: [{ id: 'status', value: 'active' }],
|
|
71
|
+
* onChange: (filters) => console.log('Filters changed:', filters),
|
|
72
|
+
* onClearFiltersPress: () => console.log('Filters cleared'),
|
|
73
|
+
* onAddFilterPress: (filterIds) => console.log('Filters added:', filterIds)
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export type FilterToolbarProps = {
|
|
78
|
+
/**
|
|
79
|
+
* Array of filter definitions that configure the available filters in the toolbar.
|
|
80
|
+
* Each definition specifies the filter's UI, behavior, and data type.
|
|
81
|
+
*/
|
|
82
|
+
filterDefs: FilterDef[];
|
|
83
|
+
/**
|
|
84
|
+
* Optional array of filters to prepopulate the toolbar on initial render.
|
|
85
|
+
* Use this to restore previously applied filters or set default filters.
|
|
86
|
+
* @default undefined
|
|
87
|
+
*/
|
|
88
|
+
initialValue?: AppliedFilter[];
|
|
89
|
+
/**
|
|
90
|
+
* Callback invoked whenever the filter state changes (filters added, removed, or values modified).
|
|
91
|
+
* Receives an array of serializable filter objects containing filter IDs and their current values.
|
|
92
|
+
* @param filters - Array of currently applied filters with their values
|
|
93
|
+
* @default undefined
|
|
94
|
+
*/
|
|
95
|
+
onChange?: (filters: SerializableAppliedFilter[]) => void;
|
|
96
|
+
/**
|
|
97
|
+
* Callback invoked when the user presses the "Clear filters" button.
|
|
98
|
+
* Use this to perform additional cleanup or analytics tracking.
|
|
99
|
+
* @default undefined
|
|
100
|
+
*/
|
|
101
|
+
onClearFiltersPress?: () => void;
|
|
102
|
+
/**
|
|
103
|
+
* Callback invoked when the user adds one or more filters using the "Add filter" button.
|
|
104
|
+
* Receives the ID(s) of the newly added filter(s).
|
|
105
|
+
* @param filterId - Single filter ID or array of filter IDs that were added
|
|
106
|
+
* @default undefined
|
|
107
|
+
*/
|
|
108
|
+
onAddFilterPress?: (filterId: string | string[]) => void;
|
|
109
|
+
/**
|
|
110
|
+
* Custom label for the "Add filter" button.
|
|
111
|
+
* @default "Add filter" (internationalized)
|
|
112
|
+
*/
|
|
113
|
+
addFilterLabel?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Custom label for the "Clear filters" button.
|
|
116
|
+
* @default "Clear filters" (internationalized)
|
|
117
|
+
*/
|
|
118
|
+
clearAllLabel?: string;
|
|
119
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a filter that has been added to the toolbar with an optional value.
|
|
3
|
+
* Used internally to track applied filters and their current state.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export type AppliedFilter = {
|
|
7
|
+
/** Unique identifier matching a filter definition ID */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Optional value for the filter, can be any type supported by the filter's control */
|
|
10
|
+
value?: unknown;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Serializable representation of an applied filter suitable for URL parameters or JSON storage.
|
|
14
|
+
* Filter values are normalized to strings or string arrays for consistent serialization.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export type SerializableAppliedFilter = {
|
|
18
|
+
/** Unique identifier matching a filter definition ID */
|
|
19
|
+
id: string;
|
|
20
|
+
/** Normalized filter value as string or string array */
|
|
21
|
+
value?: string | string[];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Minimal filter definition interface required for state management.
|
|
25
|
+
* Extends this interface to add additional properties specific to your filter implementation.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export type FilterDefBase = {
|
|
29
|
+
/** Unique identifier for the filter */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Index signature allowing additional custom properties */
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Configuration parameters for the useFilterToolbarState hook.
|
|
36
|
+
* @template T - Filter definition type extending FilterDefBase
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export type UseFilterToolbarStateParams<T extends FilterDefBase = FilterDefBase> = {
|
|
40
|
+
/** Array of available filter definitions */
|
|
41
|
+
filterDefs: T[];
|
|
42
|
+
/** Optional initial filters to prepopulate the toolbar */
|
|
43
|
+
initialValue?: AppliedFilter[];
|
|
44
|
+
/** Callback invoked when filter state changes */
|
|
45
|
+
onChange?: (appliedFilters: SerializableAppliedFilter[]) => void;
|
|
46
|
+
};
|
|
47
|
+
type FilterToolbarStatus = 'EMPTY' | 'WITH_SOME_FILTERS_APPLIED' | 'WITH_ALL_FILTERS_APPLIED';
|
|
48
|
+
/**
|
|
49
|
+
* Return value from the useFilterToolbarState hook providing state and actions.
|
|
50
|
+
* @template T - Filter definition type extending FilterDefBase
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export type UseFilterToolbarStateReturn<T extends FilterDefBase = FilterDefBase> = {
|
|
54
|
+
/** Current status of the toolbar */
|
|
55
|
+
status: FilterToolbarStatus;
|
|
56
|
+
/** Array of currently applied filter IDs in order */
|
|
57
|
+
appliedFilters: readonly string[];
|
|
58
|
+
/** Array of filter IDs that haven't been applied yet */
|
|
59
|
+
remainingFilters: readonly string[];
|
|
60
|
+
/** Filter definitions for filters that haven't been applied */
|
|
61
|
+
availableFilterDefs: T[];
|
|
62
|
+
/** Map of filter IDs to their current values */
|
|
63
|
+
filterValues: ReadonlyMap<string, unknown>;
|
|
64
|
+
/** Add one or more filters to the toolbar */
|
|
65
|
+
addFilter: (filterId: string | string[]) => void;
|
|
66
|
+
/** Remove one or more filters from the toolbar */
|
|
67
|
+
removeFilter: (filterId: string | string[]) => void;
|
|
68
|
+
/** Clear all applied filters */
|
|
69
|
+
clearFilters: () => void;
|
|
70
|
+
/** Set the value for a specific filter */
|
|
71
|
+
setFilterValue: (filterId: string, value: unknown) => void;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Manages the state for a filter toolbar, handling filter application, removal, and value updates.
|
|
75
|
+
* This hook provides a complete state management solution for dynamic filter toolbars where users can
|
|
76
|
+
* add and remove filters on demand. It maintains an internal reducer for efficient state updates and
|
|
77
|
+
* provides serializable filter values through callbacks.
|
|
78
|
+
* @template T - Filter definition type extending FilterDefBase
|
|
79
|
+
* @param params - Configuration including filter definitions, initial values, and change callback
|
|
80
|
+
* @returns State and action handlers for the filter toolbar
|
|
81
|
+
* @example
|
|
82
|
+
* ```tsx
|
|
83
|
+
* const { appliedFilters, addFilter, setFilterValue } = useFilterToolbarState({
|
|
84
|
+
* filterDefs: [
|
|
85
|
+
* { id: 'status', label: 'Status' },
|
|
86
|
+
* { id: 'department', label: 'Department' }
|
|
87
|
+
* ],
|
|
88
|
+
* onChange: (filters) => {
|
|
89
|
+
* console.log('Filters changed:', filters)
|
|
90
|
+
* }
|
|
91
|
+
* })
|
|
92
|
+
* ```
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
export declare function useFilterToolbarState<T extends FilterDefBase = FilterDefBase>(params: UseFilterToolbarStateParams<T>): UseFilterToolbarStateReturn<T>;
|
|
96
|
+
export {};
|