cozy-ui-plus 1.1.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/CHANGELOG.md +10 -0
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/babel.config.js +24 -0
- package/dist/AppIcon/index.js +265 -0
- package/dist/AppLinker/index.js +159 -0
- package/dist/AppLinker/native.config.js +8 -0
- package/dist/AppLinker/native.js +81 -0
- package/dist/AppSections/Sections.js +461 -0
- package/dist/AppSections/_mockApps.js +210 -0
- package/dist/AppSections/_testApps.js +162 -0
- package/dist/AppSections/categories.js +183 -0
- package/dist/AppSections/components/AppsSection.js +112 -0
- package/dist/AppSections/components/DropdownFilter.js +101 -0
- package/dist/AppSections/constants.js +16 -0
- package/dist/AppSections/generateI18nConfig.js +37 -0
- package/dist/AppSections/helpers.js +28 -0
- package/dist/AppSections/index.js +24 -0
- package/dist/AppSections/search.js +161 -0
- package/dist/AppTile/helpers.js +41 -0
- package/dist/AppTile/index.js +171 -0
- package/dist/CipherIcon/index.js +102 -0
- package/dist/CollectionField/index.js +166 -0
- package/dist/ContactPicker/index.js +129 -0
- package/dist/Contacts/AddModal/ContactAddressDialog/helpers.js +31 -0
- package/dist/Contacts/AddModal/ContactAddressDialog/index.js +106 -0
- package/dist/Contacts/AddModal/ContactAddressDialog/locales/index.js +113 -0
- package/dist/Contacts/AddModal/ContactForm/FieldInput.js +164 -0
- package/dist/Contacts/AddModal/ContactForm/FieldInputAccordion.js +91 -0
- package/dist/Contacts/AddModal/ContactForm/FieldInputArray.js +105 -0
- package/dist/Contacts/AddModal/ContactForm/FieldInputLayout.js +98 -0
- package/dist/Contacts/AddModal/ContactForm/FieldInputWrapper.js +51 -0
- package/dist/Contacts/AddModal/ContactForm/HasValueCondition.js +44 -0
- package/dist/Contacts/AddModal/ContactForm/RelatedContactList.js +55 -0
- package/dist/Contacts/AddModal/ContactForm/TextFieldCustomLabelSelect.js +104 -0
- package/dist/Contacts/AddModal/ContactForm/TextFieldSelect.js +59 -0
- package/dist/Contacts/AddModal/ContactForm/contactToFormValues.js +119 -0
- package/dist/Contacts/AddModal/ContactForm/fieldsConfig.js +314 -0
- package/dist/Contacts/AddModal/ContactForm/formValuesToContact.js +110 -0
- package/dist/Contacts/AddModal/ContactForm/helpers.js +466 -0
- package/dist/Contacts/AddModal/ContactForm/index.js +184 -0
- package/dist/Contacts/AddModal/ContactForm/locales/index.js +313 -0
- package/dist/Contacts/AddModal/CustomLabelDialog/index.js +138 -0
- package/dist/Contacts/AddModal/CustomLabelDialog/locales/index.js +73 -0
- package/dist/Contacts/AddModal/index.js +134 -0
- package/dist/Contacts/AddModal/locales/index.js +65 -0
- package/dist/Contacts/AddModal/mocks.js +265 -0
- package/dist/Contacts/AddModal/types.js +110 -0
- package/dist/Contacts/GroupsSelect/GroupCreation.js +157 -0
- package/dist/Contacts/GroupsSelect/GroupsSelect.js +207 -0
- package/dist/Contacts/GroupsSelect/GroupsSelectProvider.js +60 -0
- package/dist/Contacts/GroupsSelect/SelectBox/Control.js +54 -0
- package/dist/Contacts/GroupsSelect/SelectBox/EditGroupName.js +89 -0
- package/dist/Contacts/GroupsSelect/SelectBox/Menu.js +49 -0
- package/dist/Contacts/GroupsSelect/SelectBox/Option.js +80 -0
- package/dist/Contacts/GroupsSelect/SelectBox/SelectContainer.js +25 -0
- package/dist/Contacts/GroupsSelect/helpers.js +45 -0
- package/dist/Contacts/GroupsSelect/locales/index.js +97 -0
- package/dist/Contacts/GroupsSelect/useGroupSelect.js +196 -0
- package/dist/Contacts/Header/GroupsSelection.js +101 -0
- package/dist/Contacts/Header/ImportDropdown.js +115 -0
- package/dist/Contacts/Header/SearchInput.js +40 -0
- package/dist/Contacts/Header/index.js +93 -0
- package/dist/Contacts/Header/locales/index.js +73 -0
- package/dist/ContactsList/ContactCell.js +45 -0
- package/dist/ContactsList/ContactRow.js +84 -0
- package/dist/ContactsList/Contacts/ContactCozy.js +44 -0
- package/dist/ContactsList/Contacts/ContactEmail.js +44 -0
- package/dist/ContactsList/Contacts/ContactIdentity.js +86 -0
- package/dist/ContactsList/Contacts/ContactName.js +48 -0
- package/dist/ContactsList/Contacts/ContactPhone.js +44 -0
- package/dist/ContactsList/ContactsList.js +74 -0
- package/dist/ContactsList/helpers.js +156 -0
- package/dist/ContactsList/index.js +13 -0
- package/dist/ContactsList/locales/withContactsListLocales.js +42 -0
- package/dist/ContactsListModal/AddContact/AddContactActions.js +32 -0
- package/dist/ContactsListModal/AddContact/AddContactContent.js +85 -0
- package/dist/ContactsListModal/AddContact/AddContactDialog.js +63 -0
- package/dist/ContactsListModal/AddContact/AddContactTitle.js +21 -0
- package/dist/ContactsListModal/AddContact/helpers.js +61 -0
- package/dist/ContactsListModal/ContactsListContent.js +88 -0
- package/dist/ContactsListModal/ContactsListModal.js +178 -0
- package/dist/ContactsListModal/ContactsListModalWithQuery.js +44 -0
- package/dist/ContactsListModal/EmptyMessage.js +33 -0
- package/dist/ContactsListModal/MobileHeader.js +67 -0
- package/dist/ContactsListModal/index.js +58 -0
- package/dist/ContactsListModal/mockClient.js +2009 -0
- package/dist/ContactsListModal/queries.js +26 -0
- package/dist/ContactsListModal/withContactsListLocales.js +40 -0
- package/dist/Dialogs/AuthenticationDialogs/index.js +139 -0
- package/dist/Field/index.js +297 -0
- package/dist/FileImageLoader/checkImageSource.js +61 -0
- package/dist/FileImageLoader/index.js +394 -0
- package/dist/FilePicker/FilePickerBody.js +108 -0
- package/dist/FilePicker/FilePickerBodyItem.js +132 -0
- package/dist/FilePicker/FilePickerBreadcrumb.js +74 -0
- package/dist/FilePicker/FilePickerFooter.js +91 -0
- package/dist/FilePicker/FilePickerHeader.js +110 -0
- package/dist/FilePicker/docs/DemoProvider.js +280 -0
- package/dist/FilePicker/helpers.js +57 -0
- package/dist/FilePicker/index.js +125 -0
- package/dist/FilePicker/queries.js +61 -0
- package/dist/Intent/IntentDialogOpener/index.js +142 -0
- package/dist/Intent/IntentIframe/index.js +182 -0
- package/dist/ListItem/ExpandedAttributes/ExpandedAttribute.js +64 -0
- package/dist/ListItem/ExpandedAttributes/helpers.js +263 -0
- package/dist/ListItem/ExpandedAttributes/index.js +90 -0
- package/dist/ListItem/ListItemBase/Renaming/RenameDialog.js +52 -0
- package/dist/ListItem/ListItemBase/Renaming/RenameInput.js +319 -0
- package/dist/ListItem/ListItemBase/Renaming/helpers.js +73 -0
- package/dist/ListItem/ListItemBase/index.js +153 -0
- package/dist/ListItem/ListItemByDoc/index.js +109 -0
- package/dist/ListItem/ListItemContact/helpers.js +39 -0
- package/dist/ListItem/ListItemContact/index.js +87 -0
- package/dist/ListItem/ListItemContact/useActions.js +28 -0
- package/dist/ListItem/ListItemFile/ExpirationAnnotation.js +54 -0
- package/dist/ListItem/ListItemFile/ItemIcon.js +61 -0
- package/dist/ListItem/ListItemFile/PrimaryText.js +47 -0
- package/dist/ListItem/ListItemFile/SecondaryText.js +41 -0
- package/dist/ListItem/ListItemFile/index.js +96 -0
- package/dist/ListItem/hoc/withListItemLocales.js +322 -0
- package/dist/Paywall/MaxAccountsByKonnectorPaywall.js +48 -0
- package/dist/Paywall/MaxAccountsPaywall.js +43 -0
- package/dist/Paywall/MaxDaysToCapturePaywall.js +43 -0
- package/dist/Paywall/MaxPapersPaywall.js +44 -0
- package/dist/Paywall/OnlyOfficePaywall.js +41 -0
- package/dist/Paywall/PasswordSharingPaywall.js +34 -0
- package/dist/Paywall/Paywall.js +205 -0
- package/dist/Paywall/QuotaPaywall.js +32 -0
- package/dist/Paywall/helpers.js +31 -0
- package/dist/Paywall/index.js +63 -0
- package/dist/Paywall/locales/withPaywallLocales.js +401 -0
- package/dist/Qualification/QualificationGrid/helpers.js +16 -0
- package/dist/Qualification/QualificationGrid/index.js +136 -0
- package/dist/Qualification/QualificationGrid/locales/withLocales.js +82 -0
- package/dist/Qualification/QualificationIcon/index.js +156 -0
- package/dist/Qualification/QualificationItem/index.js +87 -0
- package/dist/Qualification/QualificationModal/helpers.js +95 -0
- package/dist/Qualification/QualificationModal/index.js +121 -0
- package/dist/Qualification/QualificationModal/locales/index.js +37 -0
- package/dist/ShortcutTile/index.js +68 -0
- package/dist/SquareAppIcon/index.js +262 -0
- package/dist/Storage/StorageButton.js +54 -0
- package/dist/Storage/StorageProgress.js +68 -0
- package/dist/Storage/index.js +49 -0
- package/dist/Storage/locales/index.js +41 -0
- package/dist/UploadQueue/FileUploadProgress.js +86 -0
- package/dist/UploadQueue/Item.js +132 -0
- package/dist/UploadQueue/Pending.js +23 -0
- package/dist/UploadQueue/RemainingTime.js +59 -0
- package/dist/UploadQueue/helpers.js +13 -0
- package/dist/UploadQueue/index.js +277 -0
- package/dist/UploadQueue/useStatusIcon.js +60 -0
- package/dist/hooks/useClientErrors.js +185 -0
- package/dist/proptypes.js +33 -0
- package/dist/providers/CozyTheme/CozyThemeWithQuery.js +41 -0
- package/dist/providers/CozyTheme/index.js +58 -0
- package/dist/providers/CozyTheme/queries.js +25 -0
- package/dist/providers/DemoProvider.js +49 -0
- package/dist/providers/Intent/index.js +130 -0
- package/dist/src/AppIcon/index.d.ts +50 -0
- package/dist/src/AppIcon/index.spec.d.ts +1 -0
- package/dist/src/AppLinker/index.d.ts +35 -0
- package/dist/src/AppLinker/index.spec.d.ts +1 -0
- package/dist/src/AppLinker/native.config.d.ts +1 -0
- package/dist/src/AppLinker/native.d.ts +6 -0
- package/dist/src/AppLinker/native.spec.d.ts +1 -0
- package/dist/src/AppSections/Sections.d.ts +49 -0
- package/dist/src/AppSections/_mockApps.d.ts +242 -0
- package/dist/src/AppSections/_testApps.d.ts +203 -0
- package/dist/src/AppSections/categories.d.ts +7 -0
- package/dist/src/AppSections/categories.spec.d.ts +1 -0
- package/dist/src/AppSections/components/AppsSection.d.ts +20 -0
- package/dist/src/AppSections/components/AppsSection.spec.d.ts +1 -0
- package/dist/src/AppSections/components/DropdownFilter.d.ts +17 -0
- package/dist/src/AppSections/constants.d.ts +8 -0
- package/dist/src/AppSections/generateI18nConfig.d.ts +4 -0
- package/dist/src/AppSections/helpers.d.ts +2 -0
- package/dist/src/AppSections/helpers.spec.d.ts +1 -0
- package/dist/src/AppSections/index.d.ts +3 -0
- package/dist/src/AppSections/index.spec.d.ts +1 -0
- package/dist/src/AppSections/search.d.ts +3 -0
- package/dist/src/AppSections/search.spec.d.ts +1 -0
- package/dist/src/AppTile/AppTile.spec.d.ts +1 -0
- package/dist/src/AppTile/helpers.d.ts +9 -0
- package/dist/src/AppTile/index.d.ts +33 -0
- package/dist/src/CipherIcon/index.d.ts +2 -0
- package/dist/src/CipherIcon/index.spec.d.ts +1 -0
- package/dist/src/CollectionField/index.d.ts +23 -0
- package/dist/src/ContactPicker/index.d.ts +21 -0
- package/dist/src/Contacts/AddModal/ContactAddressDialog/helpers.d.ts +4 -0
- package/dist/src/Contacts/AddModal/ContactAddressDialog/helpers.spec.d.ts +1 -0
- package/dist/src/Contacts/AddModal/ContactAddressDialog/index.d.ts +39 -0
- package/dist/src/Contacts/AddModal/ContactAddressDialog/locales/index.d.ts +10 -0
- package/dist/src/Contacts/AddModal/ContactForm/FieldInput.d.ts +39 -0
- package/dist/src/Contacts/AddModal/ContactForm/FieldInputAccordion.d.ts +12 -0
- package/dist/src/Contacts/AddModal/ContactForm/FieldInputArray.d.ts +14 -0
- package/dist/src/Contacts/AddModal/ContactForm/FieldInputLayout.d.ts +22 -0
- package/dist/src/Contacts/AddModal/ContactForm/FieldInputWrapper.d.ts +19 -0
- package/dist/src/Contacts/AddModal/ContactForm/HasValueCondition.d.ts +18 -0
- package/dist/src/Contacts/AddModal/ContactForm/HasValueCondition.spec.d.ts +1 -0
- package/dist/src/Contacts/AddModal/ContactForm/RelatedContactList.d.ts +15 -0
- package/dist/src/Contacts/AddModal/ContactForm/TextFieldCustomLabelSelect.d.ts +9 -0
- package/dist/src/Contacts/AddModal/ContactForm/TextFieldSelect.d.ts +5 -0
- package/dist/src/Contacts/AddModal/ContactForm/contactToFormValues.d.ts +6 -0
- package/dist/src/Contacts/AddModal/ContactForm/contactToFormValues.spec.d.ts +1 -0
- package/dist/src/Contacts/AddModal/ContactForm/fieldsConfig.d.ts +4 -0
- package/dist/src/Contacts/AddModal/ContactForm/formValuesToContact.d.ts +7 -0
- package/dist/src/Contacts/AddModal/ContactForm/formValuesToContact.spec.d.ts +1 -0
- package/dist/src/Contacts/AddModal/ContactForm/helpers.d.ts +35 -0
- package/dist/src/Contacts/AddModal/ContactForm/helpers.spec.d.ts +1 -0
- package/dist/src/Contacts/AddModal/ContactForm/index.d.ts +17 -0
- package/dist/src/Contacts/AddModal/ContactForm/index.spec.d.ts +1 -0
- package/dist/src/Contacts/AddModal/ContactForm/locales/index.d.ts +10 -0
- package/dist/src/Contacts/AddModal/CustomLabelDialog/index.d.ts +22 -0
- package/dist/src/Contacts/AddModal/CustomLabelDialog/locales/index.d.ts +10 -0
- package/dist/src/Contacts/AddModal/index.d.ts +8 -0
- package/dist/src/Contacts/AddModal/locales/index.d.ts +10 -0
- package/dist/src/Contacts/AddModal/mocks.d.ts +276 -0
- package/dist/src/Contacts/AddModal/types.d.ts +188 -0
- package/dist/src/Contacts/GroupsSelect/GroupCreation.d.ts +3 -0
- package/dist/src/Contacts/GroupsSelect/GroupsSelect.d.ts +56 -0
- package/dist/src/Contacts/GroupsSelect/GroupsSelect.spec.d.ts +22 -0
- package/dist/src/Contacts/GroupsSelect/GroupsSelectProvider.d.ts +5 -0
- package/dist/src/Contacts/GroupsSelect/SelectBox/Control.d.ts +14 -0
- package/dist/src/Contacts/GroupsSelect/SelectBox/EditGroupName.d.ts +7 -0
- package/dist/src/Contacts/GroupsSelect/SelectBox/Menu.d.ts +7 -0
- package/dist/src/Contacts/GroupsSelect/SelectBox/Option.d.ts +18 -0
- package/dist/src/Contacts/GroupsSelect/SelectBox/SelectContainer.d.ts +2 -0
- package/dist/src/Contacts/GroupsSelect/helpers.d.ts +9 -0
- package/dist/src/Contacts/GroupsSelect/locales/index.d.ts +10 -0
- package/dist/src/Contacts/GroupsSelect/useGroupSelect.d.ts +11 -0
- package/dist/src/Contacts/Header/GroupsSelection.d.ts +7 -0
- package/dist/src/Contacts/Header/ImportDropdown.d.ts +4 -0
- package/dist/src/Contacts/Header/SearchInput.d.ts +4 -0
- package/dist/src/Contacts/Header/index.d.ts +26 -0
- package/dist/src/Contacts/Header/locales/index.d.ts +10 -0
- package/dist/src/ContactsList/ContactCell.d.ts +8 -0
- package/dist/src/ContactsList/ContactRow.d.ts +16 -0
- package/dist/src/ContactsList/ContactRow.spec.d.ts +1 -0
- package/dist/src/ContactsList/Contacts/ContactCozy.d.ts +14 -0
- package/dist/src/ContactsList/Contacts/ContactEmail.d.ts +14 -0
- package/dist/src/ContactsList/Contacts/ContactIdentity.d.ts +10 -0
- package/dist/src/ContactsList/Contacts/ContactName.d.ts +10 -0
- package/dist/src/ContactsList/Contacts/ContactPhone.d.ts +14 -0
- package/dist/src/ContactsList/ContactsList.d.ts +2 -0
- package/dist/src/ContactsList/helpers.d.ts +9 -0
- package/dist/src/ContactsList/helpers.spec.d.ts +1 -0
- package/dist/src/ContactsList/index.d.ts +2 -0
- package/dist/src/ContactsList/locales/withContactsListLocales.d.ts +12 -0
- package/dist/src/ContactsListModal/AddContact/AddContactActions.d.ts +2 -0
- package/dist/src/ContactsListModal/AddContact/AddContactContent.d.ts +2 -0
- package/dist/src/ContactsListModal/AddContact/AddContactDialog.d.ts +6 -0
- package/dist/src/ContactsListModal/AddContact/AddContactTitle.d.ts +2 -0
- package/dist/src/ContactsListModal/AddContact/helpers.d.ts +6 -0
- package/dist/src/ContactsListModal/AddContact/helpers.spec.d.ts +1 -0
- package/dist/src/ContactsListModal/ContactsListContent.d.ts +2 -0
- package/dist/src/ContactsListModal/ContactsListModal.d.ts +20 -0
- package/dist/src/ContactsListModal/ContactsListModalWithQuery.d.ts +12 -0
- package/dist/src/ContactsListModal/EmptyMessage.d.ts +2 -0
- package/dist/src/ContactsListModal/MobileHeader.d.ts +16 -0
- package/dist/src/ContactsListModal/index.d.ts +2 -0
- package/dist/src/ContactsListModal/mockClient.d.ts +3 -0
- package/dist/src/ContactsListModal/queries.d.ts +7 -0
- package/dist/src/ContactsListModal/withContactsListLocales.d.ts +7 -0
- package/dist/src/Dialogs/AuthenticationDialogs/index.d.ts +2 -0
- package/dist/src/Field/index.d.ts +53 -0
- package/dist/src/Field/index.spec.d.ts +1 -0
- package/dist/src/FileImageLoader/checkImageSource.d.ts +1 -0
- package/dist/src/FileImageLoader/index.d.ts +45 -0
- package/dist/src/FileImageLoader/index.spec.d.ts +1 -0
- package/dist/src/FilePicker/FilePickerBody.d.ts +19 -0
- package/dist/src/FilePicker/FilePickerBodyItem.d.ts +22 -0
- package/dist/src/FilePicker/FilePickerBodyItem.spec.d.ts +1 -0
- package/dist/src/FilePicker/FilePickerBreadcrumb.d.ts +13 -0
- package/dist/src/FilePicker/FilePickerFooter.d.ts +15 -0
- package/dist/src/FilePicker/FilePickerFooter.spec.d.ts +1 -0
- package/dist/src/FilePicker/FilePickerHeader.d.ts +14 -0
- package/dist/src/FilePicker/docs/DemoProvider.d.ts +23 -0
- package/dist/src/FilePicker/helpers.d.ts +3 -0
- package/dist/src/FilePicker/helpers.spec.d.ts +1 -0
- package/dist/src/FilePicker/index.d.ts +22 -0
- package/dist/src/FilePicker/queries.d.ts +14 -0
- package/dist/src/Intent/IntentDialogOpener/index.d.ts +32 -0
- package/dist/src/Intent/IntentIframe/index.d.ts +8 -0
- package/dist/src/ListItem/ExpandedAttributes/ExpandedAttribute.d.ts +14 -0
- package/dist/src/ListItem/ExpandedAttributes/helpers.d.ts +43 -0
- package/dist/src/ListItem/ExpandedAttributes/helpers.spec.d.ts +1 -0
- package/dist/src/ListItem/ExpandedAttributes/index.d.ts +2 -0
- package/dist/src/ListItem/ListItemBase/Renaming/RenameDialog.d.ts +2 -0
- package/dist/src/ListItem/ListItemBase/Renaming/RenameInput.d.ts +12 -0
- package/dist/src/ListItem/ListItemBase/Renaming/helpers.d.ts +1 -0
- package/dist/src/ListItem/ListItemBase/index.d.ts +2 -0
- package/dist/src/ListItem/ListItemByDoc/index.d.ts +46 -0
- package/dist/src/ListItem/ListItemContact/helpers.d.ts +1 -0
- package/dist/src/ListItem/ListItemContact/helpers.spec.d.ts +1 -0
- package/dist/src/ListItem/ListItemContact/index.d.ts +35 -0
- package/dist/src/ListItem/ListItemContact/useActions.d.ts +2 -0
- package/dist/src/ListItem/ListItemFile/ExpirationAnnotation.d.ts +2 -0
- package/dist/src/ListItem/ListItemFile/ItemIcon.d.ts +12 -0
- package/dist/src/ListItem/ListItemFile/PrimaryText.d.ts +12 -0
- package/dist/src/ListItem/ListItemFile/SecondaryText.d.ts +12 -0
- package/dist/src/ListItem/ListItemFile/index.d.ts +37 -0
- package/dist/src/ListItem/hoc/withListItemLocales.d.ts +12 -0
- package/dist/src/Paywall/MaxAccountsByKonnectorPaywall.d.ts +2 -0
- package/dist/src/Paywall/MaxAccountsPaywall.d.ts +2 -0
- package/dist/src/Paywall/MaxDaysToCapturePaywall.d.ts +2 -0
- package/dist/src/Paywall/MaxPapersPaywall.d.ts +2 -0
- package/dist/src/Paywall/OnlyOfficePaywall.d.ts +16 -0
- package/dist/src/Paywall/PasswordSharingPaywall.d.ts +10 -0
- package/dist/src/Paywall/Paywall.d.ts +2 -0
- package/dist/src/Paywall/Paywall.spec.d.ts +1 -0
- package/dist/src/Paywall/QuotaPaywall.d.ts +13 -0
- package/dist/src/Paywall/helpers.d.ts +1 -0
- package/dist/src/Paywall/index.d.ts +7 -0
- package/dist/src/Paywall/locales/withPaywallLocales.d.ts +2 -0
- package/dist/src/Qualification/QualificationGrid/helpers.d.ts +1 -0
- package/dist/src/Qualification/QualificationGrid/index.d.ts +2 -0
- package/dist/src/Qualification/QualificationGrid/locales/withLocales.d.ts +12 -0
- package/dist/src/Qualification/QualificationIcon/index.d.ts +13 -0
- package/dist/src/Qualification/QualificationItem/index.d.ts +17 -0
- package/dist/src/Qualification/QualificationModal/helpers.d.ts +14 -0
- package/dist/src/Qualification/QualificationModal/helpers.spec.d.ts +1 -0
- package/dist/src/Qualification/QualificationModal/index.d.ts +16 -0
- package/dist/src/Qualification/QualificationModal/locales/index.d.ts +10 -0
- package/dist/src/ShortcutTile/index.d.ts +13 -0
- package/dist/src/SquareAppIcon/SquareAppIcon.spec.d.ts +1 -0
- package/dist/src/SquareAppIcon/index.d.ts +26 -0
- package/dist/src/Storage/StorageButton.d.ts +4 -0
- package/dist/src/Storage/StorageProgress.d.ts +5 -0
- package/dist/src/Storage/index.d.ts +14 -0
- package/dist/src/Storage/locales/index.d.ts +10 -0
- package/dist/src/UploadQueue/FileUploadProgress.d.ts +4 -0
- package/dist/src/UploadQueue/Item.d.ts +3 -0
- package/dist/src/UploadQueue/Pending.d.ts +3 -0
- package/dist/src/UploadQueue/RemainingTime.d.ts +4 -0
- package/dist/src/UploadQueue/helpers.d.ts +1 -0
- package/dist/src/UploadQueue/index.d.ts +42 -0
- package/dist/src/UploadQueue/index.spec.d.ts +1 -0
- package/dist/src/UploadQueue/useStatusIcon.d.ts +1 -0
- package/dist/src/hooks/useClientErrors.d.ts +29 -0
- package/dist/src/hooks/useClientErrors.spec.d.ts +1 -0
- package/dist/src/proptypes.d.ts +18 -0
- package/dist/src/providers/CozyTheme/CozyThemeWithQuery.d.ts +2 -0
- package/dist/src/providers/CozyTheme/index.d.ts +24 -0
- package/dist/src/providers/CozyTheme/queries.d.ts +8 -0
- package/dist/src/providers/DemoProvider.d.ts +6 -0
- package/dist/src/providers/Intent/index.d.ts +9 -0
- package/dist/stylesheet.css +898 -0
- package/dist/test/I18n.d.ts +6 -0
- package/dist/types.d.js +1 -0
- package/jest.config.js +20 -0
- package/package.json +76 -0
- package/preprocess.js +16 -0
- package/src/AppIcon/Readme.md +96 -0
- package/src/AppIcon/index.jsx +168 -0
- package/src/AppIcon/index.spec.js +145 -0
- package/src/AppIcon/styles.styl +37 -0
- package/src/AppLinker/Readme.md +32 -0
- package/src/AppLinker/__snapshots__/index.spec.jsx.snap +13 -0
- package/src/AppLinker/index.jsx +107 -0
- package/src/AppLinker/index.spec.jsx +60 -0
- package/src/AppLinker/native.config.js +1 -0
- package/src/AppLinker/native.js +57 -0
- package/src/AppLinker/native.spec.js +120 -0
- package/src/AppSections/Readme.md +35 -0
- package/src/AppSections/Sections.jsx +285 -0
- package/src/AppSections/Sections.styl +4 -0
- package/src/AppSections/__snapshots__/search.spec.js.snap +972 -0
- package/src/AppSections/_mockApps.js +197 -0
- package/src/AppSections/_testApps.js +151 -0
- package/src/AppSections/categories.js +138 -0
- package/src/AppSections/categories.spec.js +289 -0
- package/src/AppSections/components/AppsSection.jsx +82 -0
- package/src/AppSections/components/AppsSection.spec.jsx +50 -0
- package/src/AppSections/components/AppsSection.styl +7 -0
- package/src/AppSections/components/DropdownFilter.jsx +50 -0
- package/src/AppSections/components/DropdownFilter.styl +14 -0
- package/src/AppSections/constants.js +9 -0
- package/src/AppSections/generateI18nConfig.ts +23 -0
- package/src/AppSections/helpers.js +16 -0
- package/src/AppSections/helpers.spec.js +40 -0
- package/src/AppSections/index.jsx +3 -0
- package/src/AppSections/index.spec.jsx +137 -0
- package/src/AppSections/locales/en.json +37 -0
- package/src/AppSections/locales/fr.json +37 -0
- package/src/AppSections/locales/ru.json +37 -0
- package/src/AppSections/locales/vi.json +37 -0
- package/src/AppSections/search.js +104 -0
- package/src/AppSections/search.spec.js +158 -0
- package/src/AppTile/AppTile.spec.jsx +117 -0
- package/src/AppTile/Readme.md +24 -0
- package/src/AppTile/helpers.js +25 -0
- package/src/AppTile/index.jsx +139 -0
- package/src/AppTile/locales/en.json +9 -0
- package/src/AppTile/locales/fr.json +9 -0
- package/src/AppTile/locales/ru.json +9 -0
- package/src/AppTile/locales/vi.json +9 -0
- package/src/AppTile/styles.styl +27 -0
- package/src/CipherIcon/Readme.md +14 -0
- package/src/CipherIcon/index.jsx +46 -0
- package/src/CipherIcon/index.spec.jsx +53 -0
- package/src/CollectionField/Readme.md +41 -0
- package/src/CollectionField/index.jsx +141 -0
- package/src/CollectionField/styles.styl +15 -0
- package/src/ContactPicker/Readme.md +26 -0
- package/src/ContactPicker/index.jsx +86 -0
- package/src/ContactPicker/styles.styl +5 -0
- package/src/Contacts/AddModal/ContactAddressDialog/helpers.js +22 -0
- package/src/Contacts/AddModal/ContactAddressDialog/helpers.spec.js +64 -0
- package/src/Contacts/AddModal/ContactAddressDialog/index.jsx +85 -0
- package/src/Contacts/AddModal/ContactAddressDialog/locales/en.json +25 -0
- package/src/Contacts/AddModal/ContactAddressDialog/locales/fr.json +25 -0
- package/src/Contacts/AddModal/ContactAddressDialog/locales/index.jsx +11 -0
- package/src/Contacts/AddModal/ContactAddressDialog/locales/ru.json +25 -0
- package/src/Contacts/AddModal/ContactAddressDialog/locales/vi.json +25 -0
- package/src/Contacts/AddModal/ContactForm/FieldInput.jsx +124 -0
- package/src/Contacts/AddModal/ContactForm/FieldInputAccordion.jsx +58 -0
- package/src/Contacts/AddModal/ContactForm/FieldInputArray.jsx +81 -0
- package/src/Contacts/AddModal/ContactForm/FieldInputLayout.jsx +77 -0
- package/src/Contacts/AddModal/ContactForm/FieldInputWrapper.jsx +44 -0
- package/src/Contacts/AddModal/ContactForm/HasValueCondition.jsx +31 -0
- package/src/Contacts/AddModal/ContactForm/HasValueCondition.spec.jsx +79 -0
- package/src/Contacts/AddModal/ContactForm/RelatedContactList.jsx +37 -0
- package/src/Contacts/AddModal/ContactForm/TextFieldCustomLabelSelect.jsx +79 -0
- package/src/Contacts/AddModal/ContactForm/TextFieldSelect.jsx +40 -0
- package/src/Contacts/AddModal/ContactForm/__snapshots__/HasValueCondition.spec.jsx.snap +33 -0
- package/src/Contacts/AddModal/ContactForm/contactToFormValues.js +109 -0
- package/src/Contacts/AddModal/ContactForm/contactToFormValues.spec.js +133 -0
- package/src/Contacts/AddModal/ContactForm/fieldsConfig.jsx +357 -0
- package/src/Contacts/AddModal/ContactForm/formValuesToContact.js +111 -0
- package/src/Contacts/AddModal/ContactForm/formValuesToContact.spec.js +557 -0
- package/src/Contacts/AddModal/ContactForm/helpers.js +393 -0
- package/src/Contacts/AddModal/ContactForm/helpers.spec.js +391 -0
- package/src/Contacts/AddModal/ContactForm/index.jsx +138 -0
- package/src/Contacts/AddModal/ContactForm/index.spec.jsx +301 -0
- package/src/Contacts/AddModal/ContactForm/locales/en.json +75 -0
- package/src/Contacts/AddModal/ContactForm/locales/fr.json +75 -0
- package/src/Contacts/AddModal/ContactForm/locales/index.jsx +11 -0
- package/src/Contacts/AddModal/ContactForm/locales/ru.json +75 -0
- package/src/Contacts/AddModal/ContactForm/locales/vi.json +75 -0
- package/src/Contacts/AddModal/ContactForm/styles.styl +2 -0
- package/src/Contacts/AddModal/CustomLabelDialog/index.jsx +109 -0
- package/src/Contacts/AddModal/CustomLabelDialog/locales/en.json +15 -0
- package/src/Contacts/AddModal/CustomLabelDialog/locales/fr.json +15 -0
- package/src/Contacts/AddModal/CustomLabelDialog/locales/index.jsx +11 -0
- package/src/Contacts/AddModal/CustomLabelDialog/locales/ru.json +15 -0
- package/src/Contacts/AddModal/CustomLabelDialog/locales/vi.json +15 -0
- package/src/Contacts/AddModal/Readme.md +55 -0
- package/src/Contacts/AddModal/index.jsx +86 -0
- package/src/Contacts/AddModal/locales/en.json +13 -0
- package/src/Contacts/AddModal/locales/fr.json +13 -0
- package/src/Contacts/AddModal/locales/index.jsx +11 -0
- package/src/Contacts/AddModal/locales/ru.json +13 -0
- package/src/Contacts/AddModal/locales/vi.json +13 -0
- package/src/Contacts/AddModal/mocks.js +299 -0
- package/src/Contacts/AddModal/types.js +102 -0
- package/src/Contacts/GroupsSelect/GroupCreation.jsx +96 -0
- package/src/Contacts/GroupsSelect/GroupsSelect.jsx +159 -0
- package/src/Contacts/GroupsSelect/GroupsSelect.spec.jsx +249 -0
- package/src/Contacts/GroupsSelect/GroupsSelectProvider.jsx +40 -0
- package/src/Contacts/GroupsSelect/Readme.md +1 -0
- package/src/Contacts/GroupsSelect/SelectBox/Control.jsx +37 -0
- package/src/Contacts/GroupsSelect/SelectBox/EditGroupName.jsx +52 -0
- package/src/Contacts/GroupsSelect/SelectBox/Menu.jsx +27 -0
- package/src/Contacts/GroupsSelect/SelectBox/Option.jsx +71 -0
- package/src/Contacts/GroupsSelect/SelectBox/SelectContainer.jsx +15 -0
- package/src/Contacts/GroupsSelect/SelectBox/styles.styl +2 -0
- package/src/Contacts/GroupsSelect/helpers.js +25 -0
- package/src/Contacts/GroupsSelect/locales/en.json +21 -0
- package/src/Contacts/GroupsSelect/locales/fr.json +21 -0
- package/src/Contacts/GroupsSelect/locales/index.jsx +11 -0
- package/src/Contacts/GroupsSelect/locales/ru.json +21 -0
- package/src/Contacts/GroupsSelect/locales/vi.json +21 -0
- package/src/Contacts/GroupsSelect/styles.styl +48 -0
- package/src/Contacts/GroupsSelect/useGroupSelect.jsx +89 -0
- package/src/Contacts/Header/GroupsSelection.jsx +75 -0
- package/src/Contacts/Header/ImportDropdown.jsx +80 -0
- package/src/Contacts/Header/Readme.md +38 -0
- package/src/Contacts/Header/SearchInput.jsx +19 -0
- package/src/Contacts/Header/index.jsx +80 -0
- package/src/Contacts/Header/locales/en.json +15 -0
- package/src/Contacts/Header/locales/fr.json +15 -0
- package/src/Contacts/Header/locales/index.jsx +11 -0
- package/src/Contacts/Header/locales/ru.json +15 -0
- package/src/Contacts/Header/locales/vi.json +15 -0
- package/src/Contacts/Readme.md +1 -0
- package/src/ContactsList/ContactCell.jsx +23 -0
- package/src/ContactsList/ContactRow.jsx +46 -0
- package/src/ContactsList/ContactRow.spec.js +75 -0
- package/src/ContactsList/Contacts/ContactCozy.jsx +23 -0
- package/src/ContactsList/Contacts/ContactEmail.jsx +23 -0
- package/src/ContactsList/Contacts/ContactIdentity.jsx +57 -0
- package/src/ContactsList/Contacts/ContactName.jsx +43 -0
- package/src/ContactsList/Contacts/ContactPhone.jsx +24 -0
- package/src/ContactsList/ContactsList.jsx +52 -0
- package/src/ContactsList/Readme.md +47 -0
- package/src/ContactsList/_mockContacts.json +2494 -0
- package/src/ContactsList/helpers.js +132 -0
- package/src/ContactsList/helpers.spec.js +150 -0
- package/src/ContactsList/index.js +3 -0
- package/src/ContactsList/locales/en.json +5 -0
- package/src/ContactsList/locales/fr.json +5 -0
- package/src/ContactsList/locales/ru.json +5 -0
- package/src/ContactsList/locales/vi.json +5 -0
- package/src/ContactsList/locales/withContactsListLocales.jsx +15 -0
- package/src/ContactsList/styles.styl +35 -0
- package/src/ContactsListModal/AddContact/AddContactActions.jsx +16 -0
- package/src/ContactsListModal/AddContact/AddContactContent.jsx +60 -0
- package/src/ContactsListModal/AddContact/AddContactDialog.jsx +38 -0
- package/src/ContactsListModal/AddContact/AddContactTitle.jsx +9 -0
- package/src/ContactsListModal/AddContact/helpers.js +18 -0
- package/src/ContactsListModal/AddContact/helpers.spec.js +74 -0
- package/src/ContactsListModal/AddContact/styles.styl +2 -0
- package/src/ContactsListModal/ContactsListContent.jsx +74 -0
- package/src/ContactsListModal/ContactsListModal.jsx +143 -0
- package/src/ContactsListModal/ContactsListModalWithQuery.jsx +27 -0
- package/src/ContactsListModal/EmptyMessage.jsx +18 -0
- package/src/ContactsListModal/MobileHeader.jsx +50 -0
- package/src/ContactsListModal/Readme.md +45 -0
- package/src/ContactsListModal/index.jsx +28 -0
- package/src/ContactsListModal/locales/en.json +11 -0
- package/src/ContactsListModal/locales/fr.json +11 -0
- package/src/ContactsListModal/locales/ru.json +11 -0
- package/src/ContactsListModal/locales/vi.json +11 -0
- package/src/ContactsListModal/mockClient.jsx +47 -0
- package/src/ContactsListModal/queries.js +12 -0
- package/src/ContactsListModal/styles.styl +12 -0
- package/src/ContactsListModal/withContactsListLocales.jsx +11 -0
- package/src/Dialogs/AuthenticationDialogs/index.jsx +115 -0
- package/src/Field/Readme.md +357 -0
- package/src/Field/index.jsx +317 -0
- package/src/Field/index.spec.js +59 -0
- package/src/Field/styles.styl +41 -0
- package/src/FileImageLoader/Readme.md +112 -0
- package/src/FileImageLoader/checkImageSource.js +29 -0
- package/src/FileImageLoader/index.jsx +186 -0
- package/src/FileImageLoader/index.spec.jsx +176 -0
- package/src/FilePicker/FilePickerBody.jsx +111 -0
- package/src/FilePicker/FilePickerBodyItem.jsx +126 -0
- package/src/FilePicker/FilePickerBodyItem.spec.jsx +164 -0
- package/src/FilePicker/FilePickerBreadcrumb.jsx +55 -0
- package/src/FilePicker/FilePickerFooter.jsx +42 -0
- package/src/FilePicker/FilePickerFooter.spec.jsx +41 -0
- package/src/FilePicker/FilePickerHeader.jsx +89 -0
- package/src/FilePicker/Readme.md +50 -0
- package/src/FilePicker/docs/DemoProvider.jsx +273 -0
- package/src/FilePicker/helpers.js +46 -0
- package/src/FilePicker/helpers.spec.js +84 -0
- package/src/FilePicker/index.jsx +94 -0
- package/src/FilePicker/locales/en.json +8 -0
- package/src/FilePicker/locales/fr.json +8 -0
- package/src/FilePicker/locales/ru.json +8 -0
- package/src/FilePicker/locales/vi.json +8 -0
- package/src/FilePicker/queries.js +37 -0
- package/src/FilePicker/styles.styl +18 -0
- package/src/Intent/IntentDialogOpener/Readme.md +25 -0
- package/src/Intent/IntentDialogOpener/index.jsx +110 -0
- package/src/Intent/IntentIframe/Readme.md +80 -0
- package/src/Intent/IntentIframe/index.jsx +112 -0
- package/src/Intent/IntentIframe/styles.styl +21 -0
- package/src/ListItem/ExpandedAttributes/ExpandedAttribute.jsx +40 -0
- package/src/ListItem/ExpandedAttributes/helpers.js +214 -0
- package/src/ListItem/ExpandedAttributes/helpers.spec.js +175 -0
- package/src/ListItem/ExpandedAttributes/index.jsx +62 -0
- package/src/ListItem/ListItemBase/Renaming/RenameDialog.jsx +38 -0
- package/src/ListItem/ListItemBase/Renaming/RenameInput.jsx +134 -0
- package/src/ListItem/ListItemBase/Renaming/helpers.js +35 -0
- package/src/ListItem/ListItemBase/index.jsx +116 -0
- package/src/ListItem/ListItemByDoc/index.jsx +103 -0
- package/src/ListItem/ListItemContact/helpers.js +28 -0
- package/src/ListItem/ListItemContact/helpers.spec.js +41 -0
- package/src/ListItem/ListItemContact/index.jsx +68 -0
- package/src/ListItem/ListItemContact/useActions.jsx +22 -0
- package/src/ListItem/ListItemFile/ExpirationAnnotation.jsx +39 -0
- package/src/ListItem/ListItemFile/ItemIcon.jsx +49 -0
- package/src/ListItem/ListItemFile/PrimaryText.jsx +38 -0
- package/src/ListItem/ListItemFile/SecondaryText.jsx +36 -0
- package/src/ListItem/ListItemFile/index.jsx +75 -0
- package/src/ListItem/Readme.md +211 -0
- package/src/ListItem/hoc/withListItemLocales.jsx +15 -0
- package/src/ListItem/locales/en.json +75 -0
- package/src/ListItem/locales/fr.json +75 -0
- package/src/ListItem/locales/ru.json +75 -0
- package/src/ListItem/locales/vi.json +75 -0
- package/src/Paywall/MaxAccountsByKonnectorPaywall.jsx +32 -0
- package/src/Paywall/MaxAccountsPaywall.jsx +27 -0
- package/src/Paywall/MaxDaysToCapturePaywall.jsx +27 -0
- package/src/Paywall/MaxPapersPaywall.jsx +29 -0
- package/src/Paywall/OnlyOfficePaywall.jsx +24 -0
- package/src/Paywall/PasswordSharingPaywall.jsx +20 -0
- package/src/Paywall/Paywall.jsx +130 -0
- package/src/Paywall/Paywall.spec.jsx +228 -0
- package/src/Paywall/QuotaPaywall.jsx +18 -0
- package/src/Paywall/Readme.md +139 -0
- package/src/Paywall/helpers.js +22 -0
- package/src/Paywall/howto.md +28 -0
- package/src/Paywall/index.jsx +7 -0
- package/src/Paywall/locales/en.json +95 -0
- package/src/Paywall/locales/fr.json +95 -0
- package/src/Paywall/locales/ru.json +95 -0
- package/src/Paywall/locales/vi.json +95 -0
- package/src/Paywall/locales/withPaywallLocales.jsx +15 -0
- package/src/Qualification/QualificationGrid/Readme.md +26 -0
- package/src/Qualification/QualificationGrid/helpers.js +4 -0
- package/src/Qualification/QualificationGrid/index.jsx +91 -0
- package/src/Qualification/QualificationGrid/locales/en.json +15 -0
- package/src/Qualification/QualificationGrid/locales/fr.json +15 -0
- package/src/Qualification/QualificationGrid/locales/ru.json +15 -0
- package/src/Qualification/QualificationGrid/locales/vi.json +15 -0
- package/src/Qualification/QualificationGrid/locales/withLocales.jsx +15 -0
- package/src/Qualification/QualificationIcon/Readme.md +14 -0
- package/src/Qualification/QualificationIcon/index.jsx +104 -0
- package/src/Qualification/QualificationItem/Readme.md +8 -0
- package/src/Qualification/QualificationItem/index.jsx +64 -0
- package/src/Qualification/QualificationModal/Readme.md +28 -0
- package/src/Qualification/QualificationModal/helpers.js +63 -0
- package/src/Qualification/QualificationModal/helpers.spec.js +61 -0
- package/src/Qualification/QualificationModal/index.jsx +71 -0
- package/src/Qualification/QualificationModal/locales/en.json +6 -0
- package/src/Qualification/QualificationModal/locales/fr.json +6 -0
- package/src/Qualification/QualificationModal/locales/index.jsx +11 -0
- package/src/Qualification/QualificationModal/locales/ru.json +6 -0
- package/src/Qualification/QualificationModal/locales/vi.json +6 -0
- package/src/ShortcutTile/index.tsx +60 -0
- package/src/SquareAppIcon/Readme.md +185 -0
- package/src/SquareAppIcon/SquareAppIcon.spec.js +86 -0
- package/src/SquareAppIcon/__snapshots__/SquareAppIcon.spec.js.snap +474 -0
- package/src/SquareAppIcon/constants.json +6 -0
- package/src/SquareAppIcon/index.jsx +289 -0
- package/src/SquareAppIcon/styles.styl +141 -0
- package/src/Storage/Readme.md +45 -0
- package/src/Storage/StorageButton.jsx +34 -0
- package/src/Storage/StorageProgress.jsx +52 -0
- package/src/Storage/index.jsx +41 -0
- package/src/Storage/locales/en.json +7 -0
- package/src/Storage/locales/fr.json +7 -0
- package/src/Storage/locales/index.jsx +11 -0
- package/src/Storage/locales/ru.json +7 -0
- package/src/Storage/locales/vi.json +7 -0
- package/src/UploadQueue/FileUploadProgress.jsx +50 -0
- package/src/UploadQueue/Item.jsx +99 -0
- package/src/UploadQueue/Pending.jsx +12 -0
- package/src/UploadQueue/Readme.md +95 -0
- package/src/UploadQueue/RemainingTime.jsx +27 -0
- package/src/UploadQueue/helpers.js +3 -0
- package/src/UploadQueue/index.jsx +161 -0
- package/src/UploadQueue/index.spec.jsx +163 -0
- package/src/UploadQueue/locales/en.json +10 -0
- package/src/UploadQueue/locales/es.json +10 -0
- package/src/UploadQueue/locales/fr.json +10 -0
- package/src/UploadQueue/locales/ru.json +10 -0
- package/src/UploadQueue/locales/vi.json +10 -0
- package/src/UploadQueue/styles.styl +155 -0
- package/src/UploadQueue/useStatusIcon.js +32 -0
- package/src/hooks/useClientErrors.jsx +140 -0
- package/src/hooks/useClientErrors.spec.jsx +94 -0
- package/src/proptypes.js +20 -0
- package/src/providers/CozyTheme/CozyThemeWithQuery.jsx +25 -0
- package/src/providers/CozyTheme/Readme.md +88 -0
- package/src/providers/CozyTheme/index.jsx +35 -0
- package/src/providers/CozyTheme/queries.js +14 -0
- package/src/providers/DemoProvider.jsx +30 -0
- package/src/providers/Intent/index.jsx +83 -0
- package/src/types.d.ts +4 -0
- package/test/I18n.js +13 -0
- package/test/fileMock.js +3 -0
- package/test/jestsetup.js +1 -0
- package/tsconfig-build.json +16 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import PropTypes from 'prop-types'
|
|
2
|
+
|
|
3
|
+
import { iconPropType } from 'cozy-ui/transpiled/react/Icon'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {'text'|'tel'|'email'|'button'|'url'|'date'} FieldType
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Object} CustomLabelOptions
|
|
11
|
+
* @property {string} defaultType - The default type of the option
|
|
12
|
+
* @property {string} defaultLabel - The default label of the option
|
|
13
|
+
* @property {boolean} [hide] - Whether the radio choices is hidden
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {Object} LabelField
|
|
18
|
+
* @property {string} name - The name of the label field
|
|
19
|
+
* @property {boolean} select - Whether the field is a select
|
|
20
|
+
* @property {CustomLabelOptions} customLabelOptions - The custom label field options
|
|
21
|
+
* @property {Option[]} options - The options of the label field
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {Object} InputLabelProps
|
|
26
|
+
* @property {boolean} shrink - passed to InputLabelProps props
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {Object} Field
|
|
31
|
+
* @property {string} name - The name of the field
|
|
32
|
+
* @property {string|null} icon - The icon of the field
|
|
33
|
+
* @property {FieldType} type - The type of the field
|
|
34
|
+
* @property {boolean} [isSecondary] - Whether the field is hidden from the main form
|
|
35
|
+
* @property {LabelField} [label] - Add a "label" field next to the main field
|
|
36
|
+
* @property {'accordion'|'array'} [layout] - Whether the field is an array (To add fields dynamically (e.g. email, address, etc.))
|
|
37
|
+
* @property {Field[]} [subFields] - The subfields of the field
|
|
38
|
+
* @property {InputLabelProps} [InputLabelProps] - The object passed to InputLabelProps props
|
|
39
|
+
* @property {boolean} [multiline] - Whether the field is multiline
|
|
40
|
+
* @property {number} [position] - Position of a field in the form. 1 is first.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @typedef {Object} RelatedContact
|
|
45
|
+
* @property {string} relatedContactId - The id of the related contact
|
|
46
|
+
* @property {string} relatedContact - The displayName of the related contact
|
|
47
|
+
* @property {string} relatedContactLabel - Object with the type of the related contact stringified (e.g. '{\"type\":\"spouse\"}')
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
export const labelPropTypes = PropTypes.shape({
|
|
51
|
+
name: PropTypes.string,
|
|
52
|
+
options: PropTypes.arrayOf(
|
|
53
|
+
PropTypes.shape({
|
|
54
|
+
value: PropTypes.string,
|
|
55
|
+
label: PropTypes.string
|
|
56
|
+
})
|
|
57
|
+
),
|
|
58
|
+
customLabelOptions: PropTypes.shape({
|
|
59
|
+
hide: PropTypes.bool,
|
|
60
|
+
defaultType: PropTypes.string,
|
|
61
|
+
defaultLabel: PropTypes.string
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
export const fieldInputAttributesTypes = PropTypes.shape({
|
|
66
|
+
name: PropTypes.string,
|
|
67
|
+
icon: iconPropType,
|
|
68
|
+
type: PropTypes.string,
|
|
69
|
+
label: labelPropTypes,
|
|
70
|
+
layout: PropTypes.string,
|
|
71
|
+
subFields: PropTypes.arrayOf(
|
|
72
|
+
PropTypes.shape({
|
|
73
|
+
name: PropTypes.string.isRequired,
|
|
74
|
+
icon: PropTypes.string,
|
|
75
|
+
type: PropTypes.string.isRequired
|
|
76
|
+
})
|
|
77
|
+
),
|
|
78
|
+
labelProps: PropTypes.shape({
|
|
79
|
+
shrink: PropTypes.bool
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
export const FieldInputWrapperPropTypes = {
|
|
84
|
+
// See official documentation for more information: https://final-form.org/docs/react-final-form/types/FieldRenderProps
|
|
85
|
+
input: PropTypes.object,
|
|
86
|
+
//
|
|
87
|
+
attributes: fieldInputAttributesTypes,
|
|
88
|
+
// Destructuring props
|
|
89
|
+
// See official documentation for more information: https://final-form.org/docs/react-final-form/types/FieldRenderProps
|
|
90
|
+
meta: PropTypes.object,
|
|
91
|
+
//
|
|
92
|
+
id: PropTypes.string,
|
|
93
|
+
label: PropTypes.string,
|
|
94
|
+
required: PropTypes.bool,
|
|
95
|
+
variant: PropTypes.string,
|
|
96
|
+
customLabelOptions: PropTypes.shape({
|
|
97
|
+
hide: PropTypes.bool,
|
|
98
|
+
defaultType: PropTypes.string.isRequired,
|
|
99
|
+
defaultLabel: PropTypes.string.isRequired
|
|
100
|
+
}),
|
|
101
|
+
fullWidth: PropTypes.bool
|
|
102
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import classNames from 'classnames'
|
|
2
|
+
import React, { Component } from 'react'
|
|
3
|
+
|
|
4
|
+
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
5
|
+
import PlusIcon from 'cozy-ui/transpiled/react/Icons/Plus'
|
|
6
|
+
import Input from 'cozy-ui/transpiled/react/legacy/Input'
|
|
7
|
+
import { translate } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
8
|
+
|
|
9
|
+
import styles from './styles.styl'
|
|
10
|
+
|
|
11
|
+
const normalizeGroupData = name => {
|
|
12
|
+
return {
|
|
13
|
+
name: name,
|
|
14
|
+
metadata: {
|
|
15
|
+
version: 1
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
class GroupCreation extends Component {
|
|
20
|
+
state = {
|
|
21
|
+
isInputDisplayed: false,
|
|
22
|
+
groupName: ''
|
|
23
|
+
}
|
|
24
|
+
constructor(props) {
|
|
25
|
+
super(props)
|
|
26
|
+
this.textInput = React.createRef()
|
|
27
|
+
}
|
|
28
|
+
handleClick = () => {
|
|
29
|
+
this.setState({ isInputDisplayed: !this.state.isInputDisplayed })
|
|
30
|
+
}
|
|
31
|
+
onFocus = e => {
|
|
32
|
+
e.stopPropagation()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
onClick = e => {
|
|
36
|
+
e.stopPropagation()
|
|
37
|
+
}
|
|
38
|
+
keyPress = async e => {
|
|
39
|
+
if (e.keyCode == 13) {
|
|
40
|
+
this.props.createGroup(normalizeGroupData(e.target.value))
|
|
41
|
+
this.textInput.current.value = ''
|
|
42
|
+
}
|
|
43
|
+
e.stopPropagation()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
onMouseDown = e => {
|
|
47
|
+
e.stopPropagation()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
render() {
|
|
51
|
+
const { isInputDisplayed } = this.state
|
|
52
|
+
const { t } = this.props
|
|
53
|
+
return (
|
|
54
|
+
<div>
|
|
55
|
+
<div className={styles['contact-group-creation-divider']} />
|
|
56
|
+
<div
|
|
57
|
+
className={classNames(
|
|
58
|
+
'u-ml-half',
|
|
59
|
+
'u-mr-half',
|
|
60
|
+
'u-c-pointer',
|
|
61
|
+
styles['container']
|
|
62
|
+
)}
|
|
63
|
+
>
|
|
64
|
+
{!isInputDisplayed && (
|
|
65
|
+
<div
|
|
66
|
+
onClick={this.handleClick}
|
|
67
|
+
className={styles['contact-group-create-div-icon']}
|
|
68
|
+
>
|
|
69
|
+
<Icon icon={PlusIcon} />
|
|
70
|
+
<span className="u-pl-half">
|
|
71
|
+
{t('Contacts.GroupsSelect.create')}
|
|
72
|
+
</span>
|
|
73
|
+
</div>
|
|
74
|
+
)}
|
|
75
|
+
{isInputDisplayed && (
|
|
76
|
+
<Input
|
|
77
|
+
id="createGroupInput"
|
|
78
|
+
ref={this.textInput}
|
|
79
|
+
type="text"
|
|
80
|
+
placeholder={t('Contacts.GroupsSelect.name')}
|
|
81
|
+
onClick={this.onClick}
|
|
82
|
+
onFocus={this.onFocus}
|
|
83
|
+
onKeyDown={this.keyPress}
|
|
84
|
+
size="tiny"
|
|
85
|
+
autoComplete="off"
|
|
86
|
+
autoFocus={true}
|
|
87
|
+
onMouseDown={this.onMouseDown}
|
|
88
|
+
/>
|
|
89
|
+
)}
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default translate()(GroupCreation)
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import PropTypes from 'prop-types'
|
|
2
|
+
import React, { useState } from 'react'
|
|
3
|
+
|
|
4
|
+
import { useClient } from 'cozy-client'
|
|
5
|
+
import ClickAwayListener from 'cozy-ui/transpiled/react/ClickAwayListener'
|
|
6
|
+
import SelectBox from 'cozy-ui/transpiled/react/SelectBox'
|
|
7
|
+
import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
8
|
+
|
|
9
|
+
import CustomMenu from './SelectBox/Menu'
|
|
10
|
+
import CustomOption from './SelectBox/Option'
|
|
11
|
+
import CustomSelectContainer from './SelectBox/SelectContainer'
|
|
12
|
+
import useGroupsSelect from './useGroupSelect'
|
|
13
|
+
|
|
14
|
+
const captureEscapeEvent = e => {
|
|
15
|
+
if (e.key === 'Escape') {
|
|
16
|
+
e.stopPropagation()
|
|
17
|
+
e.target.blur()
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const GroupsSelect = ({
|
|
22
|
+
allGroups,
|
|
23
|
+
closeMenuOnSelect,
|
|
24
|
+
value,
|
|
25
|
+
styles,
|
|
26
|
+
isMulti,
|
|
27
|
+
noOptionsMessage,
|
|
28
|
+
withCheckbox,
|
|
29
|
+
components,
|
|
30
|
+
onGroupCreated,
|
|
31
|
+
onChange,
|
|
32
|
+
onGroupCreate,
|
|
33
|
+
onGroupUpdate,
|
|
34
|
+
onGroupDelete,
|
|
35
|
+
menuPosition
|
|
36
|
+
}) => {
|
|
37
|
+
const client = useClient()
|
|
38
|
+
const { isMobile } = useBreakpoints()
|
|
39
|
+
const [{ menuIsOpen, editedGroupId }, setState] = useState({
|
|
40
|
+
menuIsOpen: false,
|
|
41
|
+
editedGroupId: ''
|
|
42
|
+
})
|
|
43
|
+
const { createGroup, renameGroup } = useGroupsSelect({
|
|
44
|
+
allGroups,
|
|
45
|
+
onGroupCreated,
|
|
46
|
+
client,
|
|
47
|
+
onGroupCreate,
|
|
48
|
+
onGroupUpdate
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const toggleMenu = () => {
|
|
52
|
+
setState(prev => ({ ...prev, menuIsOpen: !prev.menuIsOpen }))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const closeMenu = () => {
|
|
56
|
+
setState(prev => ({ ...prev, menuIsOpen: false }))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const setEditedGroupId = id => {
|
|
60
|
+
setState(prev => ({ ...prev, editedGroupId: id }))
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const handleChange = props => {
|
|
64
|
+
if (closeMenuOnSelect) {
|
|
65
|
+
closeMenu()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
onChange(props)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const handleDelete = group => {
|
|
72
|
+
closeMenu()
|
|
73
|
+
onGroupDelete(group)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const defaultComponents = {
|
|
77
|
+
Menu: CustomMenu,
|
|
78
|
+
Option: CustomOption,
|
|
79
|
+
SelectContainer: CustomSelectContainer
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<>
|
|
84
|
+
<ClickAwayListener onClickAway={menuIsOpen ? closeMenu : () => {}}>
|
|
85
|
+
<SelectBox
|
|
86
|
+
className={isMobile ? 'u-mb-half' : 'u-mr-half'}
|
|
87
|
+
classNamePrefix="react-select"
|
|
88
|
+
isMulti={isMulti}
|
|
89
|
+
withCheckbox={withCheckbox}
|
|
90
|
+
menuIsOpen={menuIsOpen}
|
|
91
|
+
blurInputOnSelect={true}
|
|
92
|
+
hideSelectedOptions={false}
|
|
93
|
+
isSearchable={false}
|
|
94
|
+
isClearable={false}
|
|
95
|
+
closeMenuOnSelect={closeMenuOnSelect}
|
|
96
|
+
tabSelectsValue={false}
|
|
97
|
+
onKeyDown={captureEscapeEvent}
|
|
98
|
+
noOptionsMessage={noOptionsMessage}
|
|
99
|
+
options={allGroups}
|
|
100
|
+
value={value}
|
|
101
|
+
onChange={handleChange}
|
|
102
|
+
getOptionLabel={group => group.name}
|
|
103
|
+
getOptionValue={group => group._id}
|
|
104
|
+
components={{ ...defaultComponents, ...components }}
|
|
105
|
+
createGroup={createGroup}
|
|
106
|
+
deleteGroup={handleDelete}
|
|
107
|
+
renameGroup={renameGroup}
|
|
108
|
+
styles={styles}
|
|
109
|
+
onControlClicked={toggleMenu}
|
|
110
|
+
setEditedGroupId={setEditedGroupId}
|
|
111
|
+
editedGroupId={editedGroupId}
|
|
112
|
+
menuPosition={menuPosition}
|
|
113
|
+
fullwidth
|
|
114
|
+
/>
|
|
115
|
+
</ClickAwayListener>
|
|
116
|
+
</>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
GroupsSelect.propTypes = {
|
|
121
|
+
allGroups: PropTypes.array.isRequired,
|
|
122
|
+
styles: PropTypes.object,
|
|
123
|
+
// for multiple selections, value can be an array
|
|
124
|
+
value: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).isRequired,
|
|
125
|
+
// to customize react-select elements
|
|
126
|
+
components: PropTypes.object,
|
|
127
|
+
// to define if it is possible to select more than one option
|
|
128
|
+
isMulti: PropTypes.bool,
|
|
129
|
+
// noOptionsMessage is used to show a message when there is no options in the menu list
|
|
130
|
+
noOptionsMessage: PropTypes.func,
|
|
131
|
+
// hide/show checkbox besides menu list options
|
|
132
|
+
withCheckbox: PropTypes.bool,
|
|
133
|
+
onChange: PropTypes.func.isRequired,
|
|
134
|
+
// function to be triggered after creating a group
|
|
135
|
+
onGroupCreated: PropTypes.func,
|
|
136
|
+
// function to be triggered when creating a group
|
|
137
|
+
onGroupCreate: PropTypes.func,
|
|
138
|
+
// function to be triggered when updating a group
|
|
139
|
+
onGroupUpdate: PropTypes.func,
|
|
140
|
+
// function to be triggered when deleting a group
|
|
141
|
+
onGroupDelete: PropTypes.func,
|
|
142
|
+
closeMenuOnSelect: PropTypes.bool,
|
|
143
|
+
menuPosition: PropTypes.oneOf(['fixed', 'absolute'])
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
GroupsSelect.defaultProps = {
|
|
147
|
+
isMulti: false,
|
|
148
|
+
components: {},
|
|
149
|
+
closeMenuOnSelect: false
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
GroupsSelect.propTypes = {
|
|
153
|
+
allGroups: PropTypes.array.isRequired,
|
|
154
|
+
onGroupCreate: PropTypes.func.isRequired,
|
|
155
|
+
onGroupUpdate: PropTypes.func.isRequired,
|
|
156
|
+
onGroupDelete: PropTypes.func.isRequired
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export default GroupsSelect
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { render, screen, fireEvent, act } from '@testing-library/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import AlertProvider from 'cozy-ui/transpiled/react/providers/Alert'
|
|
5
|
+
|
|
6
|
+
import GroupsSelect from './GroupsSelect'
|
|
7
|
+
import SelectedGroupProvider from './GroupsSelectProvider'
|
|
8
|
+
import Control from './SelectBox/Control'
|
|
9
|
+
import DemoProvider from '../../providers/DemoProvider'
|
|
10
|
+
|
|
11
|
+
const createGroup = jest.fn()
|
|
12
|
+
const updateGroup = jest.fn()
|
|
13
|
+
const deleteGroup = jest.fn()
|
|
14
|
+
|
|
15
|
+
export const groups = [
|
|
16
|
+
{
|
|
17
|
+
id: '5b49553c5916cf7b5b2a5f48600078a8',
|
|
18
|
+
_id: '5b49553c5916cf7b5b2a5f48600078a8',
|
|
19
|
+
_type: 'io.cozy.contacts.groups',
|
|
20
|
+
_rev: '1-7862def64fb044932d3264e2f8477454',
|
|
21
|
+
cozyMetadata: {
|
|
22
|
+
createdAt: '2019-07-15T11:22:13.551Z',
|
|
23
|
+
createdByApp: 'Contacts',
|
|
24
|
+
createdByAppVersion: '0.8.5',
|
|
25
|
+
metadataVersion: 1,
|
|
26
|
+
updatedAt: '2019-07-15T11:22:13.551Z',
|
|
27
|
+
updatedByApps: [
|
|
28
|
+
{ date: '2019-07-15T11:22:13.551Z', slug: 'Contacts', version: '0.8.5' }
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
metadata: { version: 1 },
|
|
32
|
+
name: '2018-2019 Enseignants'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: '8cb7ea7fe264260e997529439b0091c0',
|
|
36
|
+
_id: '8cb7ea7fe264260e997529439b0091c0',
|
|
37
|
+
_type: 'io.cozy.contacts.groups',
|
|
38
|
+
_rev: '1-8b92242f1ccaca20e7862306cddbe37f',
|
|
39
|
+
cozyMetadata: {
|
|
40
|
+
createdAt: '2020-04-15T06:46:20.128Z',
|
|
41
|
+
createdByApp: 'Contacts',
|
|
42
|
+
createdByAppVersion: '0.8.7',
|
|
43
|
+
metadataVersion: 1,
|
|
44
|
+
updatedAt: '2020-04-15T06:46:20.128Z',
|
|
45
|
+
updatedByApps: [
|
|
46
|
+
{ date: '2020-04-15T06:46:20.128Z', slug: 'Contacts', version: '0.8.7' }
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
metadata: { version: 1 },
|
|
50
|
+
name: 'ez'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: '18c031b0ac9f47cdc48b275b1900726d',
|
|
54
|
+
_id: '18c031b0ac9f47cdc48b275b1900726d',
|
|
55
|
+
_type: 'io.cozy.contacts.groups',
|
|
56
|
+
_rev: '1-f438477a749fa0b90cde2e7c53a41bd6',
|
|
57
|
+
cozyMetadata: {
|
|
58
|
+
createdAt: '2019-11-08T07:45:55.424Z',
|
|
59
|
+
createdByApp: 'Contacts',
|
|
60
|
+
createdByAppVersion: '0.8.6',
|
|
61
|
+
metadataVersion: 1,
|
|
62
|
+
updatedAt: '2019-11-08T07:45:55.424Z',
|
|
63
|
+
updatedByApps: [
|
|
64
|
+
{ date: '2019-11-08T07:45:55.424Z', slug: 'Contacts', version: '0.8.6' }
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
metadata: { version: 1 },
|
|
68
|
+
name: 'groupe test'
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
const setup = () => {
|
|
73
|
+
const root = render(
|
|
74
|
+
<DemoProvider>
|
|
75
|
+
<AlertProvider>
|
|
76
|
+
<SelectedGroupProvider>
|
|
77
|
+
<GroupsSelect
|
|
78
|
+
value={[groups[0]]}
|
|
79
|
+
allGroups={groups}
|
|
80
|
+
components={{ Control }}
|
|
81
|
+
onChange={() => {}}
|
|
82
|
+
onGroupCreate={createGroup}
|
|
83
|
+
onGroupUpdate={updateGroup}
|
|
84
|
+
onGroupDelete={deleteGroup}
|
|
85
|
+
/>
|
|
86
|
+
</SelectedGroupProvider>
|
|
87
|
+
</AlertProvider>
|
|
88
|
+
</DemoProvider>
|
|
89
|
+
)
|
|
90
|
+
return { root }
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
describe('GroupsSelect', () => {
|
|
94
|
+
beforeEach(() => {
|
|
95
|
+
jest.clearAllMocks()
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
it('should display every groups and group creation button', () => {
|
|
99
|
+
setup()
|
|
100
|
+
|
|
101
|
+
act(() => {
|
|
102
|
+
fireEvent.click(screen.getByText('Groups'))
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
for (const group of groups) {
|
|
106
|
+
expect(screen.queryByText(group.name)).not.toBeNull()
|
|
107
|
+
}
|
|
108
|
+
expect(screen.queryByText('Create a group')).not.toBeNull()
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it('should be able to create a new group', () => {
|
|
112
|
+
setup()
|
|
113
|
+
|
|
114
|
+
act(() => {
|
|
115
|
+
fireEvent.click(screen.getByText('Groups'))
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
act(() => {
|
|
119
|
+
fireEvent.click(screen.getByText('Create a group'))
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
// it should replace the button by an empty input
|
|
123
|
+
let createGroupInput = screen.queryByRole('textbox', {
|
|
124
|
+
id: 'createGroupInput'
|
|
125
|
+
})
|
|
126
|
+
expect(createGroupInput).not.toBeNull()
|
|
127
|
+
expect(createGroupInput.value).toBe('')
|
|
128
|
+
|
|
129
|
+
act(() => {
|
|
130
|
+
// it should trigger creation function by pressing Enter key, and clear the input
|
|
131
|
+
fireEvent.change(
|
|
132
|
+
screen.getByRole('textbox', {
|
|
133
|
+
id: 'createGroupInput'
|
|
134
|
+
}),
|
|
135
|
+
{ target: { value: 'new group' } }
|
|
136
|
+
)
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
createGroupInput = screen.queryByRole('textbox', {
|
|
140
|
+
id: 'createGroupInput'
|
|
141
|
+
})
|
|
142
|
+
expect(createGroupInput).not.toBeNull()
|
|
143
|
+
expect(createGroupInput.value).toBe('new group')
|
|
144
|
+
|
|
145
|
+
act(() => {
|
|
146
|
+
fireEvent.keyDown(
|
|
147
|
+
screen.getByRole('textbox', {
|
|
148
|
+
id: 'createGroupInput'
|
|
149
|
+
}),
|
|
150
|
+
{ key: 'Enter', keyCode: '13' }
|
|
151
|
+
)
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
expect(createGroup).toHaveBeenCalled()
|
|
155
|
+
createGroupInput = screen.queryByRole('textbox', {
|
|
156
|
+
id: 'createGroupInput'
|
|
157
|
+
})
|
|
158
|
+
expect(createGroupInput).not.toBeNull()
|
|
159
|
+
expect(createGroupInput.value).toBe('')
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
it("shouldn't be able to create a new group", () => {
|
|
163
|
+
setup()
|
|
164
|
+
|
|
165
|
+
act(() => {
|
|
166
|
+
fireEvent.click(screen.getByText('Groups'))
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
act(() => {
|
|
170
|
+
fireEvent.click(screen.getByText('Create a group'))
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
// it should replace the button by an empty input
|
|
174
|
+
let createGroupInput = screen.queryByRole('textbox', {
|
|
175
|
+
id: 'createGroupInput'
|
|
176
|
+
})
|
|
177
|
+
expect(createGroupInput).not.toBeNull()
|
|
178
|
+
expect(createGroupInput.value).toBe('')
|
|
179
|
+
|
|
180
|
+
act(() => {
|
|
181
|
+
// it should trigger creation function by pressing Enter key, and clear the input
|
|
182
|
+
fireEvent.change(
|
|
183
|
+
screen.getByRole('textbox', {
|
|
184
|
+
id: 'createGroupInput'
|
|
185
|
+
}),
|
|
186
|
+
{ target: { value: '' } }
|
|
187
|
+
)
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
createGroupInput = screen.queryByRole('textbox', {
|
|
191
|
+
id: 'createGroupInput'
|
|
192
|
+
})
|
|
193
|
+
expect(createGroupInput).not.toBeNull()
|
|
194
|
+
expect(createGroupInput.value).toBe('')
|
|
195
|
+
|
|
196
|
+
act(() => {
|
|
197
|
+
fireEvent.keyDown(
|
|
198
|
+
screen.getByRole('textbox', {
|
|
199
|
+
id: 'createGroupInput'
|
|
200
|
+
}),
|
|
201
|
+
{ key: 'Enter', keyCode: '13' }
|
|
202
|
+
)
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
expect(createGroup).not.toHaveBeenCalled()
|
|
206
|
+
createGroupInput = screen.queryByRole('textbox', {
|
|
207
|
+
id: 'createGroupInput'
|
|
208
|
+
})
|
|
209
|
+
expect(createGroupInput).not.toBeNull()
|
|
210
|
+
expect(createGroupInput.value).toBe('')
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
it('should be able to rename a group', () => {
|
|
214
|
+
setup()
|
|
215
|
+
|
|
216
|
+
act(() => {
|
|
217
|
+
// it should replace the field by input with group name as value
|
|
218
|
+
fireEvent.click(screen.getByText('Groups'))
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
act(() => {
|
|
222
|
+
fireEvent.click(
|
|
223
|
+
screen.getByTestId(`ActionsOption_${groups[0].name}-icon_pen`)
|
|
224
|
+
)
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
let editGroupInput = screen.queryByRole('textbox', {
|
|
228
|
+
id: 'editGroupInput'
|
|
229
|
+
})
|
|
230
|
+
expect(editGroupInput).not.toBeNull()
|
|
231
|
+
expect(editGroupInput.value).toBe(groups[0].name)
|
|
232
|
+
|
|
233
|
+
act(() => {
|
|
234
|
+
// it should trigger rename function by pressing Enter key, and remove input
|
|
235
|
+
fireEvent.keyDown(
|
|
236
|
+
screen.getByRole('textbox', {
|
|
237
|
+
id: 'editGroupInput'
|
|
238
|
+
}),
|
|
239
|
+
{ key: 'Enter', keyCode: '13' }
|
|
240
|
+
)
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
expect(updateGroup).toHaveBeenCalled()
|
|
244
|
+
editGroupInput = screen.queryByRole('textbox', {
|
|
245
|
+
id: 'editGroupInput'
|
|
246
|
+
})
|
|
247
|
+
expect(editGroupInput).toBeNull()
|
|
248
|
+
})
|
|
249
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { useContext, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
import { useI18n, useExtendI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
4
|
+
|
|
5
|
+
import { translatedDefaultSelectedGroup } from './helpers'
|
|
6
|
+
import { locales } from './locales'
|
|
7
|
+
|
|
8
|
+
const SelectedGroupContext = React.createContext()
|
|
9
|
+
|
|
10
|
+
export const useSelectedGroup = () => {
|
|
11
|
+
const context = useContext(SelectedGroupContext)
|
|
12
|
+
|
|
13
|
+
if (!context) {
|
|
14
|
+
throw new Error(
|
|
15
|
+
'useSelectedGroup must be used within a SelectedGroupProvider'
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
return context
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const SelectedGroupProvider = ({ children }) => {
|
|
22
|
+
useExtendI18n(locales)
|
|
23
|
+
const { t } = useI18n()
|
|
24
|
+
const [selectedGroup, setSelectedGroup] = useState(
|
|
25
|
+
translatedDefaultSelectedGroup(t)
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
const contextValue = {
|
|
29
|
+
selectedGroup,
|
|
30
|
+
setSelectedGroup
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<SelectedGroupContext.Provider value={contextValue}>
|
|
35
|
+
{children}
|
|
36
|
+
</SelectedGroupContext.Provider>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default SelectedGroupProvider
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!-- For styleguidist, a .md file is needed in directories -->
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import PropTypes from 'prop-types'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import Button from 'cozy-ui/transpiled/react/Buttons'
|
|
5
|
+
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
6
|
+
import BottomSelectIcon from 'cozy-ui/transpiled/react/Icons/BottomSelect'
|
|
7
|
+
import { useI18n, useExtendI18n } from 'cozy-ui/transpiled/react/providers/I18n'
|
|
8
|
+
|
|
9
|
+
import { locales } from '../locales'
|
|
10
|
+
|
|
11
|
+
const Control = ({
|
|
12
|
+
innerRef,
|
|
13
|
+
innerProps,
|
|
14
|
+
selectProps: { onControlClicked }
|
|
15
|
+
}) => {
|
|
16
|
+
useExtendI18n(locales)
|
|
17
|
+
const { t } = useI18n()
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div ref={innerRef} {...innerProps}>
|
|
21
|
+
<Button
|
|
22
|
+
variant="secondary"
|
|
23
|
+
size="small"
|
|
24
|
+
onClick={onControlClicked}
|
|
25
|
+
onTouchStart={onControlClicked}
|
|
26
|
+
label={t('Contacts.GroupsSelect.manage')}
|
|
27
|
+
startIcon={<Icon icon={BottomSelectIcon} width="12" />}
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Control.propTypes = {
|
|
34
|
+
selectProps: PropTypes.object.isRequired
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default Control
|