@payfit/unity-components 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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-menu/parts/AppMenuFooter.js +23 -23
- package/dist/esm/components/app-menu/parts/AppMenuHeader.d.ts +1 -1
- package/dist/esm/components/app-menu/parts/AppMenuHeader.js +9 -9
- 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.context.d.ts +2 -1
- package/dist/esm/components/avatar/Avatar.context.js +13 -11
- package/dist/esm/components/avatar/Avatar.d.ts +126 -0
- package/dist/esm/components/avatar/Avatar.js +34 -20
- package/dist/esm/components/avatar/Avatar.variants.d.ts +39 -0
- package/dist/esm/components/avatar/Avatar.variants.js +23 -5
- package/dist/esm/components/avatar/parts/AvatarFallback.d.ts +52 -0
- package/dist/esm/components/avatar/parts/AvatarFallback.js +26 -27
- package/dist/esm/components/avatar/parts/AvatarIcon.d.ts +31 -0
- package/dist/esm/components/avatar/parts/AvatarIcon.js +40 -0
- package/dist/esm/components/badge/Badge.js +1 -1
- package/dist/esm/components/breadcrumbs/Breadcrumbs.variant.js +1 -1
- package/dist/esm/components/button/Button.js +12 -11
- 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/parts/PaginationNavButton.js +1 -1
- package/dist/esm/components/client-side-pagination/parts/RawPaginationLink.js +10 -10
- 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.js +7 -7
- 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/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/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 +2 -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/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/inline-field-group/InlineFieldGroup.context.d.ts +23 -0
- package/dist/esm/components/inline-field-group/InlineFieldGroup.context.js +6 -0
- package/dist/esm/components/inline-field-group/InlineFieldGroup.d.ts +119 -0
- package/dist/esm/components/inline-field-group/InlineFieldGroup.js +185 -0
- package/dist/esm/components/inline-field-group/hooks/useInlineFieldGroupMode.d.ts +46 -0
- package/dist/esm/components/inline-field-group/hooks/useInlineFieldGroupMode.js +27 -0
- package/dist/esm/components/inline-field-group/parts/InlineFieldGroupEditView.d.ts +64 -0
- package/dist/esm/components/inline-field-group/parts/InlineFieldGroupEditView.js +56 -0
- package/dist/esm/components/inline-field-group/parts/InlineFieldGroupHeader.d.ts +95 -0
- package/dist/esm/components/inline-field-group/parts/InlineFieldGroupHeader.js +106 -0
- package/dist/esm/components/inline-field-group/parts/InlineFieldGroupReadView.d.ts +56 -0
- package/dist/esm/components/inline-field-group/parts/InlineFieldGroupReadView.js +28 -0
- 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/RawLink.js +38 -31
- 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/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/RawNavItem.js +6 -6
- 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 +12 -11
- package/dist/esm/components/pagination/parts/RawPaginationLink.js +22 -22
- package/dist/esm/components/pagination/parts/RawPaginationNext.js +13 -13
- package/dist/esm/components/pagination/parts/RawPaginationPrevious.js +10 -10
- 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 +53 -45
- 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-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/side-panel/parts/SidePanelFooter.js +19 -10
- 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 +93 -0
- package/dist/esm/components/table/Table.js +135 -107
- package/dist/esm/components/table/parts/TableBody.js +83 -21
- 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.js +1 -1
- package/dist/esm/components/table/parts/TableRow.js +1 -0
- 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/task-menu/parts/RawSubTask.js +26 -26
- package/dist/esm/components/task-menu/parts/RawTask.js +32 -28
- 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 +41 -31
- 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-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 +393 -0
- package/dist/esm/hooks/use-tanstack-form.js +232 -0
- package/dist/esm/index.d.ts +45 -20
- package/dist/esm/index.js +472 -407
- package/dist/esm/index.storybook-testing.d.ts +3 -0
- package/dist/esm/integrations/tanstack-router/components/form-contextual-link/FormContextualLink.d.ts +6 -1
- package/dist/esm/integrations/tanstack-router/components/form-contextual-link/TanstackFormContextualLink.d.ts +43 -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/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/index.d.ts +3 -0
- package/dist/esm/integrations/tanstack-router/utils/decorators.d.ts +1 -1
- package/dist/esm/integrations/tanstack-router.js +32 -26
- package/dist/esm/mocks/employees.d.ts +1 -5
- package/dist/esm/storybook-testing.js +8 -2
- package/dist/esm/storybook-utilities/previewTransform.d.ts +1 -0
- 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 +27 -8
- package/i18n/es-ES.json +29 -10
- package/i18n/fr-FR.json +30 -11
- package/package.json +41 -42
- package/dist/esm/components/multi-select/Multiselect.types.d.ts +0 -109
- 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
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { jsx as x, jsxs as z } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as J, useRef as l, useState as V, useEffect as r, useCallback as P, useImperativeHandle as Q, useMemo as W } from "react";
|
|
3
|
+
import { uyTv as X } from "@payfit/unity-themes";
|
|
4
|
+
import { useStore as Y } from "@tanstack/react-form";
|
|
5
|
+
import { useId as Z, useKeyboard as L, FocusScope as ee } from "react-aria";
|
|
6
|
+
import { useIntl as te } from "react-intl";
|
|
7
|
+
import { useFormContext as ie } from "../../hooks/tanstack-form-context.js";
|
|
8
|
+
import { useInlineFieldGroupMode as re } from "./hooks/useInlineFieldGroupMode.js";
|
|
9
|
+
import { InlineFieldGroupContext as oe } from "./InlineFieldGroup.context.js";
|
|
10
|
+
const se = X({
|
|
11
|
+
slots: {
|
|
12
|
+
form: "uy:flex uy:flex-col uy:gap-300"
|
|
13
|
+
}
|
|
14
|
+
}), D = (a) => {
|
|
15
|
+
if (!a.current) return;
|
|
16
|
+
const c = a.current.querySelector(
|
|
17
|
+
'[aria-invalid="true"]'
|
|
18
|
+
);
|
|
19
|
+
c && c.focus();
|
|
20
|
+
}, k = 5e3, ne = J(
|
|
21
|
+
({
|
|
22
|
+
children: a,
|
|
23
|
+
mode: c,
|
|
24
|
+
defaultMode: j,
|
|
25
|
+
onModeChange: q,
|
|
26
|
+
shouldModeChange: m,
|
|
27
|
+
isLoading: N,
|
|
28
|
+
className: K,
|
|
29
|
+
"aria-label": _,
|
|
30
|
+
successMessage: g,
|
|
31
|
+
errorMessage: d
|
|
32
|
+
}, O) => {
|
|
33
|
+
const s = Z(), A = `unity-InlineFieldGroup-${s}__header`, C = `unity-InlineFieldGroup-${s}__edit-view`, E = l(null), n = l(null), M = l(!0), [G, R] = V(""), [h, f] = V(""), p = te(), u = ie(), { mode: t, enterEditMode: b, exitEditMode: o } = re({
|
|
34
|
+
mode: c,
|
|
35
|
+
defaultMode: j,
|
|
36
|
+
onModeChange: q,
|
|
37
|
+
shouldModeChange: m
|
|
38
|
+
}), { isSubmitting: i, isValid: v, isSubmitSuccessful: S, submissionAttempts: y } = Y(u.store, (e) => ({
|
|
39
|
+
isSubmitting: e.isSubmitting,
|
|
40
|
+
isValid: e.isValid,
|
|
41
|
+
isSubmitSuccessful: e.isSubmitSuccessful,
|
|
42
|
+
submissionAttempts: e.submissionAttempts
|
|
43
|
+
})), F = l(i), T = l(y);
|
|
44
|
+
r(() => {
|
|
45
|
+
i && !F.current && (R(""), f(""));
|
|
46
|
+
}, [i]), r(() => {
|
|
47
|
+
if (y > T.current && !v) {
|
|
48
|
+
const I = d ?? p.formatMessage({
|
|
49
|
+
id: "unity:component:inline-field-group:validation-error",
|
|
50
|
+
defaultMessage: "Please fix the errors before saving."
|
|
51
|
+
});
|
|
52
|
+
f(I), D(n);
|
|
53
|
+
}
|
|
54
|
+
}, [y, v, d, p]), r(() => {
|
|
55
|
+
F.current && !i && S && (g && R(g), o());
|
|
56
|
+
}, [i, S, g, o]), r(() => {
|
|
57
|
+
if (F.current && !i && !S && v) {
|
|
58
|
+
const I = d ?? p.formatMessage({
|
|
59
|
+
id: "unity:component:inline-field-group:save-error",
|
|
60
|
+
defaultMessage: "An error occurred while saving. Please try again."
|
|
61
|
+
});
|
|
62
|
+
f(I);
|
|
63
|
+
}
|
|
64
|
+
}, [i, S, v, d, p]), r(() => {
|
|
65
|
+
F.current = i, T.current = y;
|
|
66
|
+
});
|
|
67
|
+
const $ = P(
|
|
68
|
+
(e) => {
|
|
69
|
+
e.preventDefault(), e.stopPropagation(), u.handleSubmit();
|
|
70
|
+
},
|
|
71
|
+
[u]
|
|
72
|
+
), w = P(() => {
|
|
73
|
+
m !== void 0 && !m(t, "read") || (u.reset(), o());
|
|
74
|
+
}, [u, t, o, m]);
|
|
75
|
+
Q(
|
|
76
|
+
O,
|
|
77
|
+
() => ({
|
|
78
|
+
focusFirstInvalidField: () => {
|
|
79
|
+
D(n);
|
|
80
|
+
},
|
|
81
|
+
exitEditMode: o,
|
|
82
|
+
enterEditMode: b
|
|
83
|
+
}),
|
|
84
|
+
[o, b]
|
|
85
|
+
), r(() => {
|
|
86
|
+
if (M.current) {
|
|
87
|
+
M.current = !1;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (t === "edit") {
|
|
91
|
+
if (n.current) {
|
|
92
|
+
const e = n.current.querySelectorAll(
|
|
93
|
+
'input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
94
|
+
);
|
|
95
|
+
e.length > 0 && e[0].focus();
|
|
96
|
+
}
|
|
97
|
+
} else
|
|
98
|
+
E.current && E.current.focus();
|
|
99
|
+
}, [t]);
|
|
100
|
+
const { keyboardProps: B } = L({
|
|
101
|
+
onKeyDown: (e) => {
|
|
102
|
+
e.key === "Escape" && t === "edit" && (e.preventDefault(), w());
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
r(() => {
|
|
106
|
+
if (G) {
|
|
107
|
+
const e = setTimeout(() => {
|
|
108
|
+
R("");
|
|
109
|
+
}, k);
|
|
110
|
+
return () => {
|
|
111
|
+
clearTimeout(e);
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}, [G]), r(() => {
|
|
115
|
+
if (h) {
|
|
116
|
+
const e = setTimeout(() => {
|
|
117
|
+
f("");
|
|
118
|
+
}, k);
|
|
119
|
+
return () => {
|
|
120
|
+
clearTimeout(e);
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}, [h]);
|
|
124
|
+
const H = W(
|
|
125
|
+
() => ({
|
|
126
|
+
mode: t,
|
|
127
|
+
enterEditMode: b,
|
|
128
|
+
exitEditMode: w,
|
|
129
|
+
groupId: s,
|
|
130
|
+
headerId: A,
|
|
131
|
+
editViewId: C,
|
|
132
|
+
isLoading: N,
|
|
133
|
+
editButtonRef: E,
|
|
134
|
+
editViewRef: n
|
|
135
|
+
}),
|
|
136
|
+
[
|
|
137
|
+
t,
|
|
138
|
+
b,
|
|
139
|
+
w,
|
|
140
|
+
s,
|
|
141
|
+
A,
|
|
142
|
+
C,
|
|
143
|
+
N
|
|
144
|
+
]
|
|
145
|
+
), { form: U } = se();
|
|
146
|
+
return /* @__PURE__ */ x(oe.Provider, { value: H, children: /* @__PURE__ */ x(
|
|
147
|
+
"form",
|
|
148
|
+
{
|
|
149
|
+
...B,
|
|
150
|
+
id: s,
|
|
151
|
+
className: U({ className: K }),
|
|
152
|
+
onSubmit: $,
|
|
153
|
+
"aria-label": _,
|
|
154
|
+
"aria-labelledby": _ ? void 0 : A,
|
|
155
|
+
children: /* @__PURE__ */ z(ee, { contain: t === "edit", children: [
|
|
156
|
+
a,
|
|
157
|
+
/* @__PURE__ */ x(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
role: "status",
|
|
161
|
+
"aria-live": "polite",
|
|
162
|
+
"aria-atomic": "true",
|
|
163
|
+
className: "uy:sr-only",
|
|
164
|
+
children: G
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
/* @__PURE__ */ x(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
role: "alert",
|
|
171
|
+
"aria-live": "assertive",
|
|
172
|
+
"aria-atomic": "true",
|
|
173
|
+
className: "uy:sr-only",
|
|
174
|
+
children: h
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
] })
|
|
178
|
+
}
|
|
179
|
+
) });
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
ne.displayName = "InlineFieldGroup";
|
|
183
|
+
export {
|
|
184
|
+
ne as InlineFieldGroup
|
|
185
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { InlineFieldGroupMode } from '../InlineFieldGroup.context.js';
|
|
2
|
+
export interface UseInlineFieldGroupModeProps {
|
|
3
|
+
/**
|
|
4
|
+
* Controlled mode value. When provided, the component operates in controlled mode.
|
|
5
|
+
*/
|
|
6
|
+
mode?: InlineFieldGroupMode;
|
|
7
|
+
/**
|
|
8
|
+
* Default mode value for uncontrolled mode.
|
|
9
|
+
* @default 'read'
|
|
10
|
+
*/
|
|
11
|
+
defaultMode?: InlineFieldGroupMode;
|
|
12
|
+
/**
|
|
13
|
+
* Callback fired when mode changes.
|
|
14
|
+
*/
|
|
15
|
+
onModeChange?: (mode: InlineFieldGroupMode) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Callback to intercept and potentially prevent mode changes.
|
|
18
|
+
* Return `false` to prevent the mode transition.
|
|
19
|
+
* Return `true` or `undefined` to allow the transition.
|
|
20
|
+
*/
|
|
21
|
+
shouldModeChange?: (fromMode: InlineFieldGroupMode, toMode: InlineFieldGroupMode) => boolean | undefined;
|
|
22
|
+
}
|
|
23
|
+
export interface UseInlineFieldGroupModeReturn {
|
|
24
|
+
/** Current mode value */
|
|
25
|
+
mode: InlineFieldGroupMode;
|
|
26
|
+
/** Switch to edit mode */
|
|
27
|
+
enterEditMode: () => void;
|
|
28
|
+
/** Exit edit mode (return to read mode) */
|
|
29
|
+
exitEditMode: () => void;
|
|
30
|
+
/** Check if component is in controlled mode */
|
|
31
|
+
isControlled: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Hook to manage the mode state (read/edit) for InlineFieldGroup.
|
|
35
|
+
* Supports both controlled and uncontrolled modes, following the pattern
|
|
36
|
+
* established by NavGroup.tsx
|
|
37
|
+
* @param props - Configuration for the mode hook
|
|
38
|
+
* @param props.mode - Controlled mode value. When provided, the component operates in controlled mode.
|
|
39
|
+
* @param props.defaultMode - Default mode value for uncontrolled mode.
|
|
40
|
+
* @param props.onModeChange - Callback fired when mode changes.
|
|
41
|
+
* @param props.shouldModeChange - Callback to intercept and potentially prevent mode changes.
|
|
42
|
+
* Return `false` to prevent the mode transition.
|
|
43
|
+
* Return `true` or `undefined` to allow the transition.
|
|
44
|
+
* @returns Mode state and handlers
|
|
45
|
+
*/
|
|
46
|
+
export declare function useInlineFieldGroupMode({ mode: controlledMode, defaultMode, onModeChange, shouldModeChange, }: UseInlineFieldGroupModeProps): UseInlineFieldGroupModeReturn;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useState as m, useCallback as i } from "react";
|
|
2
|
+
function x({
|
|
3
|
+
mode: d,
|
|
4
|
+
defaultMode: c = "read",
|
|
5
|
+
onModeChange: s,
|
|
6
|
+
shouldModeChange: o
|
|
7
|
+
}) {
|
|
8
|
+
const [l, u] = m(c), t = d !== void 0, n = t ? d : l, e = i(
|
|
9
|
+
(r) => {
|
|
10
|
+
o && o(n, r) === !1 || (t || u(r), s?.(r));
|
|
11
|
+
},
|
|
12
|
+
[t, n, s, o]
|
|
13
|
+
), a = i(() => {
|
|
14
|
+
e("edit");
|
|
15
|
+
}, [e]), f = i(() => {
|
|
16
|
+
e("read");
|
|
17
|
+
}, [e]);
|
|
18
|
+
return {
|
|
19
|
+
mode: n,
|
|
20
|
+
enterEditMode: a,
|
|
21
|
+
exitEditMode: f,
|
|
22
|
+
isControlled: t
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
x as useInlineFieldGroupMode
|
|
27
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
export interface InlineFieldGroupEditViewProps extends PropsWithChildren {
|
|
3
|
+
/**
|
|
4
|
+
* Optional className for custom styling
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Legend text for the fieldset. Should describe the group of fields.
|
|
9
|
+
* This is required for accessibility but will be visually hidden.
|
|
10
|
+
*/
|
|
11
|
+
legend?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* InlineFieldGroupEditView displays form fields only when the parent InlineFieldGroup is in edit mode.
|
|
15
|
+
* Wrap form field components in this component to show them when editing.
|
|
16
|
+
* The component uses a semantic `<fieldset>` with a visually hidden `<legend>` for accessibility.
|
|
17
|
+
* It automatically disables all fields during loading states and hides content in read mode.
|
|
18
|
+
* @example Basic usage with form fields
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import { useTanstackUnityForm } from '@payfit/unity-components'
|
|
21
|
+
*
|
|
22
|
+
* function Example() {
|
|
23
|
+
* const form = useTanstackUnityForm({
|
|
24
|
+
* defaultValues: { email: 'john@example.com', phone: '+33123456789' }
|
|
25
|
+
* })
|
|
26
|
+
*
|
|
27
|
+
* return (
|
|
28
|
+
* <form.AppForm>
|
|
29
|
+
* <form.InlineFieldGroup>
|
|
30
|
+
* <form.InlineFieldGroupHeader title="Contact" />
|
|
31
|
+
* <form.InlineFieldGroupReadView>
|
|
32
|
+
* <DefinitionList>
|
|
33
|
+
* <DefinitionItem term="Email" description={form.state.values.email} />
|
|
34
|
+
* </DefinitionList>
|
|
35
|
+
* </form.InlineFieldGroupReadView>
|
|
36
|
+
* <form.InlineFieldGroupEditView legend="Edit contact information">
|
|
37
|
+
* <form.AppField name="email">
|
|
38
|
+
* {field => <field.TextField label="Email" isRequired />}
|
|
39
|
+
* </form.AppField>
|
|
40
|
+
* <form.AppField name="phone">
|
|
41
|
+
* {field => <field.PhoneNumberField label="Phone" />}
|
|
42
|
+
* </form.AppField>
|
|
43
|
+
* </form.InlineFieldGroupEditView>
|
|
44
|
+
* </form.InlineFieldGroup>
|
|
45
|
+
* </form.AppForm>
|
|
46
|
+
* )
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
* @remarks
|
|
50
|
+
* - Must be used as a child of InlineFieldGroup
|
|
51
|
+
* - Set the `legend` prop to describe the group of fields for screen readers
|
|
52
|
+
* - The fieldset is disabled automatically when the parent's `isLoading` prop is true
|
|
53
|
+
* - Uses `aria-busy` to indicate loading state to assistive technologies
|
|
54
|
+
* - Content remains in the DOM but is hidden with `hidden` and `inert` attributes in read mode
|
|
55
|
+
* @see {@link InlineFieldGroupEditViewProps} for all available props
|
|
56
|
+
* @see {@link InlineFieldGroup} for the parent container component
|
|
57
|
+
* @see {@link InlineFieldGroupReadView} for the corresponding read mode component
|
|
58
|
+
* @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/components/inline-field-group GitHub}
|
|
59
|
+
* @see Developer docs in {@link https://unity-components.payfit.io/?path=/docs/forms-reference-inlinefieldgroup--docs unity-components.payfit.io}
|
|
60
|
+
*/
|
|
61
|
+
export declare function InlineFieldGroupEditView({ children, className, legend, }: InlineFieldGroupEditViewProps): import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
export declare namespace InlineFieldGroupEditView {
|
|
63
|
+
var displayName: string;
|
|
64
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsxs as h, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as g } from "react";
|
|
3
|
+
import { uyTv as w } from "@payfit/unity-themes";
|
|
4
|
+
import { useIntl as x } from "react-intl";
|
|
5
|
+
import { Button as v } from "../../button/Button.js";
|
|
6
|
+
import { InlineFieldGroupContext as I } from "../InlineFieldGroup.context.js";
|
|
7
|
+
const N = w({
|
|
8
|
+
slots: {
|
|
9
|
+
fieldset: "uy:border-0 uy:p-0 uy:m-0",
|
|
10
|
+
legend: "uy:sr-only",
|
|
11
|
+
fieldsContainer: "uy:flex uy:flex-col uy:gap-250",
|
|
12
|
+
hiddenButtons: "uy:sr-only"
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
function b({
|
|
16
|
+
children: d,
|
|
17
|
+
className: s,
|
|
18
|
+
legend: o
|
|
19
|
+
}) {
|
|
20
|
+
const l = x(), t = g(I);
|
|
21
|
+
if (!t)
|
|
22
|
+
throw new Error(
|
|
23
|
+
"InlineFieldGroupEditView must be used within InlineFieldGroup"
|
|
24
|
+
);
|
|
25
|
+
const { mode: r, editViewId: a, isLoading: n, editViewRef: u } = t, i = r === "edit", {
|
|
26
|
+
fieldset: m,
|
|
27
|
+
legend: f,
|
|
28
|
+
fieldsContainer: c,
|
|
29
|
+
hiddenButtons: p
|
|
30
|
+
} = N(), y = l.formatMessage({
|
|
31
|
+
id: "unity:component:inline-field-group:save",
|
|
32
|
+
defaultMessage: "Save"
|
|
33
|
+
});
|
|
34
|
+
return /* @__PURE__ */ h(
|
|
35
|
+
"fieldset",
|
|
36
|
+
{
|
|
37
|
+
ref: u,
|
|
38
|
+
id: a,
|
|
39
|
+
className: m({ className: s }),
|
|
40
|
+
disabled: n,
|
|
41
|
+
hidden: !i,
|
|
42
|
+
"aria-hidden": !i,
|
|
43
|
+
"aria-busy": n,
|
|
44
|
+
...!i && { inert: "" },
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ e("legend", { className: f(), children: o }),
|
|
47
|
+
/* @__PURE__ */ e("div", { className: c(), children: d }),
|
|
48
|
+
/* @__PURE__ */ e("div", { className: p(), children: /* @__PURE__ */ e(v, { type: "submit", variant: "primary", children: y }) })
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
b.displayName = "InlineFieldGroupEditView";
|
|
54
|
+
export {
|
|
55
|
+
b as InlineFieldGroupEditView
|
|
56
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface InlineFieldGroupHeaderProps {
|
|
3
|
+
/**
|
|
4
|
+
* The title to display in the header.
|
|
5
|
+
* This will be used for aria-labelledby on the form element.
|
|
6
|
+
*/
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Custom label for the edit button.
|
|
10
|
+
* @default "Edit" (translated)
|
|
11
|
+
*/
|
|
12
|
+
editLabel?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Custom label for the save button.
|
|
15
|
+
* @default "Save" (translated)
|
|
16
|
+
*/
|
|
17
|
+
saveLabel?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Custom label for the cancel button.
|
|
20
|
+
* @default "Cancel" (translated)
|
|
21
|
+
*/
|
|
22
|
+
cancelLabel?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Additional custom actions to render alongside the default buttons.
|
|
25
|
+
* These will be displayed between the title and the edit/save/cancel buttons.
|
|
26
|
+
*/
|
|
27
|
+
customActions?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Optional callback fired when the edit button is clicked.
|
|
30
|
+
* This is called before entering edit mode and is useful for analytics or side effects.
|
|
31
|
+
*/
|
|
32
|
+
onEditPress?: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Optional callback fired when the save button is clicked.
|
|
35
|
+
* This is called before form submission and is useful for analytics or side effects.
|
|
36
|
+
* Note: Form submission is handled via the form's onSubmit configuration.
|
|
37
|
+
*/
|
|
38
|
+
onSavePress?: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Optional callback fired when the cancel button is clicked.
|
|
41
|
+
* This is called before canceling and is useful for analytics or side effects.
|
|
42
|
+
* The form will be reset and edit mode exited automatically.
|
|
43
|
+
*/
|
|
44
|
+
onCancelPress?: () => void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* InlineFieldGroupHeader renders the title and contextual action buttons for an InlineFieldGroup.
|
|
48
|
+
* It automatically switches between Edit button (read mode) and Save/Cancel buttons (edit mode)
|
|
49
|
+
* based on the parent InlineFieldGroup's current mode.
|
|
50
|
+
* The Save button integrates with TanStack Form and remains disabled until the form has changes.
|
|
51
|
+
* Cancel resets the form and returns to read mode.
|
|
52
|
+
* @example Basic usage
|
|
53
|
+
* ```tsx
|
|
54
|
+
* import { useTanstackUnityForm } from '@payfit/unity-components'
|
|
55
|
+
*
|
|
56
|
+
* function Example() {
|
|
57
|
+
* const form = useTanstackUnityForm({ defaultValues: { name: 'John' } })
|
|
58
|
+
*
|
|
59
|
+
* return (
|
|
60
|
+
* <form.AppForm>
|
|
61
|
+
* <form.InlineFieldGroup>
|
|
62
|
+
* <form.InlineFieldGroupHeader title="Contact Information" />
|
|
63
|
+
* <form.InlineFieldGroupReadView>...</form.InlineFieldGroupReadView>
|
|
64
|
+
* <form.InlineFieldGroupEditView legend="Edit">...</form.InlineFieldGroupEditView>
|
|
65
|
+
* </form.InlineFieldGroup>
|
|
66
|
+
* </form.AppForm>
|
|
67
|
+
* )
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
* @example Custom button labels and actions
|
|
71
|
+
* ```tsx
|
|
72
|
+
* <form.InlineFieldGroupHeader
|
|
73
|
+
* title="Contact Information"
|
|
74
|
+
* editLabel="Modify"
|
|
75
|
+
* saveLabel="Confirm"
|
|
76
|
+
* cancelLabel="Discard"
|
|
77
|
+
* customActions={<Button onPress={handleDelete}>Delete</Button>}
|
|
78
|
+
* onSavePress={() => trackAnalytics('save_clicked')}
|
|
79
|
+
* />
|
|
80
|
+
* ```
|
|
81
|
+
* @remarks
|
|
82
|
+
* - Must be used as a child of InlineFieldGroup
|
|
83
|
+
* - The title serves as the accessible label for the form via `aria-labelledby`
|
|
84
|
+
* - The Edit button uses `aria-expanded` and `aria-controls` for accessibility
|
|
85
|
+
* - Use `customActions` to add buttons that appear in both read and edit modes
|
|
86
|
+
* - Use `onEditPress`, `onSavePress`, `onCancelPress` for analytics or side effects
|
|
87
|
+
* @see {@link InlineFieldGroupHeaderProps} for all available props
|
|
88
|
+
* @see {@link InlineFieldGroup} for the parent container component
|
|
89
|
+
* @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/components/inline-field-group GitHub}
|
|
90
|
+
* @see Developer docs in {@link https://unity-components.payfit.io/?path=/docs/forms-reference-inlinefieldgroup--docs unity-components.payfit.io}
|
|
91
|
+
*/
|
|
92
|
+
export declare function InlineFieldGroupHeader({ title, editLabel, saveLabel, cancelLabel, customActions, onEditPress, onSavePress, onCancelPress, }: InlineFieldGroupHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
93
|
+
export declare namespace InlineFieldGroupHeader {
|
|
94
|
+
var displayName: string;
|
|
95
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e, Fragment as N } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as L } from "react";
|
|
3
|
+
import { uyTv as P } from "@payfit/unity-themes";
|
|
4
|
+
import { useStore as S } from "@tanstack/react-form";
|
|
5
|
+
import { useIntl as j } from "react-intl";
|
|
6
|
+
import { useFormContext as z } from "../../../hooks/tanstack-form-context.js";
|
|
7
|
+
import { Button as o } from "../../button/Button.js";
|
|
8
|
+
import { Text as H } from "../../text/Text.js";
|
|
9
|
+
import { InlineFieldGroupContext as B } from "../InlineFieldGroup.context.js";
|
|
10
|
+
const T = P({
|
|
11
|
+
slots: {
|
|
12
|
+
base: "uy:flex uy:items-center uy:justify-between uy:w-full",
|
|
13
|
+
titleContainer: "uy:flex uy:flex-col uy:gap-0 uy:flex-1",
|
|
14
|
+
actions: "uy:flex uy:gap-100 uy:items-center"
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
function A({
|
|
18
|
+
title: a,
|
|
19
|
+
editLabel: s,
|
|
20
|
+
saveLabel: l,
|
|
21
|
+
cancelLabel: d,
|
|
22
|
+
customActions: u,
|
|
23
|
+
onEditPress: c,
|
|
24
|
+
onSavePress: m,
|
|
25
|
+
onCancelPress: f
|
|
26
|
+
}) {
|
|
27
|
+
const i = j(), r = L(B);
|
|
28
|
+
if (!r)
|
|
29
|
+
throw new Error(
|
|
30
|
+
"InlineFieldGroupHeader must be used within InlineFieldGroup"
|
|
31
|
+
);
|
|
32
|
+
const {
|
|
33
|
+
mode: p,
|
|
34
|
+
enterEditMode: y,
|
|
35
|
+
exitEditMode: x,
|
|
36
|
+
headerId: g,
|
|
37
|
+
editViewId: h,
|
|
38
|
+
isLoading: t,
|
|
39
|
+
editButtonRef: b
|
|
40
|
+
} = r, v = z(), { isDirty: I } = S(v.store, (G) => ({
|
|
41
|
+
isDirty: G.isDirty
|
|
42
|
+
})), { base: C, titleContainer: M, actions: F } = T(), w = s || i.formatMessage({
|
|
43
|
+
id: "unity:component:inline-field-group:edit",
|
|
44
|
+
defaultMessage: "Edit"
|
|
45
|
+
}), D = l || i.formatMessage({
|
|
46
|
+
id: "unity:component:inline-field-group:save",
|
|
47
|
+
defaultMessage: "Save"
|
|
48
|
+
}), E = d || i.formatMessage({
|
|
49
|
+
id: "unity:component:inline-field-group:cancel",
|
|
50
|
+
defaultMessage: "Cancel"
|
|
51
|
+
});
|
|
52
|
+
return /* @__PURE__ */ n("header", { className: C(), children: [
|
|
53
|
+
/* @__PURE__ */ e("div", { className: M(), children: /* @__PURE__ */ e(H, { id: g, variant: "h3", color: "content.neutral", children: a }) }),
|
|
54
|
+
/* @__PURE__ */ n("div", { className: F(), role: "group", children: [
|
|
55
|
+
u,
|
|
56
|
+
p === "read" ? /* @__PURE__ */ e(
|
|
57
|
+
o,
|
|
58
|
+
{
|
|
59
|
+
ref: b,
|
|
60
|
+
variant: "secondary",
|
|
61
|
+
size: "default",
|
|
62
|
+
onPress: () => {
|
|
63
|
+
c?.(), y();
|
|
64
|
+
},
|
|
65
|
+
isDisabled: t,
|
|
66
|
+
prefixIcon: "PencilSimpleOutlined",
|
|
67
|
+
"aria-expanded": !1,
|
|
68
|
+
"aria-controls": h,
|
|
69
|
+
children: w
|
|
70
|
+
}
|
|
71
|
+
) : /* @__PURE__ */ n(N, { children: [
|
|
72
|
+
/* @__PURE__ */ e(
|
|
73
|
+
o,
|
|
74
|
+
{
|
|
75
|
+
variant: "secondary",
|
|
76
|
+
size: "default",
|
|
77
|
+
onPress: () => {
|
|
78
|
+
f?.(), x();
|
|
79
|
+
},
|
|
80
|
+
isDisabled: t,
|
|
81
|
+
type: "button",
|
|
82
|
+
children: E
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ e(
|
|
86
|
+
o,
|
|
87
|
+
{
|
|
88
|
+
variant: "primary",
|
|
89
|
+
size: "default",
|
|
90
|
+
isDisabled: !I || t,
|
|
91
|
+
isLoading: t,
|
|
92
|
+
type: "submit",
|
|
93
|
+
onPress: () => {
|
|
94
|
+
m?.();
|
|
95
|
+
},
|
|
96
|
+
children: D
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] })
|
|
100
|
+
] })
|
|
101
|
+
] });
|
|
102
|
+
}
|
|
103
|
+
A.displayName = "InlineFieldGroupHeader";
|
|
104
|
+
export {
|
|
105
|
+
A as InlineFieldGroupHeader
|
|
106
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export interface InlineFieldGroupReadViewProps extends PropsWithChildren {
|
|
3
|
+
/**
|
|
4
|
+
* Optional className for custom styling
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* InlineFieldGroupReadView displays content only when the parent InlineFieldGroup is in read mode.
|
|
10
|
+
* Wrap read-only data displays (like DefinitionList) in this component to show them when not editing.
|
|
11
|
+
* The component automatically hides its content when entering edit mode using the `hidden` attribute
|
|
12
|
+
* and `inert` for proper accessibility, ensuring screen readers and keyboard navigation skip it.
|
|
13
|
+
* @example Basic usage with DefinitionList
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { useTanstackUnityForm, DefinitionList, DefinitionItem } from '@payfit/unity-components'
|
|
16
|
+
*
|
|
17
|
+
* function Example() {
|
|
18
|
+
* const form = useTanstackUnityForm({ defaultValues: { email: 'john@example.com' } })
|
|
19
|
+
*
|
|
20
|
+
* return (
|
|
21
|
+
* <form.AppForm>
|
|
22
|
+
* <form.InlineFieldGroup>
|
|
23
|
+
* <form.InlineFieldGroupHeader title="Contact" />
|
|
24
|
+
* <form.InlineFieldGroupReadView>
|
|
25
|
+
* <form.Subscribe selector={state => state.values}>
|
|
26
|
+
* {values => (
|
|
27
|
+
* <DefinitionList>
|
|
28
|
+
* <DefinitionItem term="Email" description={values.email} />
|
|
29
|
+
* </DefinitionList>
|
|
30
|
+
* )}
|
|
31
|
+
* </form.Subscribe>
|
|
32
|
+
* </form.InlineFieldGroupReadView>
|
|
33
|
+
* <form.InlineFieldGroupEditView legend="Edit contact">
|
|
34
|
+
* <form.AppField name="email">
|
|
35
|
+
* {field => <field.TextField label="Email" />}
|
|
36
|
+
* </form.AppField>
|
|
37
|
+
* </form.InlineFieldGroupEditView>
|
|
38
|
+
* </form.InlineFieldGroup>
|
|
39
|
+
* </form.AppForm>
|
|
40
|
+
* )
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
* @remarks
|
|
44
|
+
* - Must be used as a child of InlineFieldGroup
|
|
45
|
+
* - Use `form.Subscribe` to display current form values that update after saving
|
|
46
|
+
* - The content remains in the DOM but is hidden with `hidden` and `inert` attributes in edit mode
|
|
47
|
+
* @see {@link InlineFieldGroupReadViewProps} for all available props
|
|
48
|
+
* @see {@link InlineFieldGroup} for the parent container component
|
|
49
|
+
* @see {@link InlineFieldGroupEditView} for the corresponding edit mode component
|
|
50
|
+
* @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/components/inline-field-group GitHub}
|
|
51
|
+
* @see Developer docs in {@link https://unity-components.payfit.io/?path=/docs/forms-reference-inlinefieldgroup--docs unity-components.payfit.io}
|
|
52
|
+
*/
|
|
53
|
+
export declare function InlineFieldGroupReadView({ children, className, }: InlineFieldGroupReadViewProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
export declare namespace InlineFieldGroupReadView {
|
|
55
|
+
var displayName: string;
|
|
56
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as d } from "react";
|
|
3
|
+
import { InlineFieldGroupContext as t } from "../InlineFieldGroup.context.js";
|
|
4
|
+
function l({
|
|
5
|
+
children: n,
|
|
6
|
+
className: o
|
|
7
|
+
}) {
|
|
8
|
+
const i = d(t);
|
|
9
|
+
if (!i)
|
|
10
|
+
throw new Error(
|
|
11
|
+
"InlineFieldGroupReadView must be used within InlineFieldGroup"
|
|
12
|
+
);
|
|
13
|
+
const e = i.mode === "read";
|
|
14
|
+
return /* @__PURE__ */ r(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
className: o,
|
|
18
|
+
hidden: !e,
|
|
19
|
+
"aria-hidden": !e,
|
|
20
|
+
...!e && { inert: "" },
|
|
21
|
+
children: n
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
l.displayName = "InlineFieldGroupReadView";
|
|
26
|
+
export {
|
|
27
|
+
l as InlineFieldGroupReadView
|
|
28
|
+
};
|