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
package/dist/types.d.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
testURL: 'http://localhost/',
|
|
3
|
+
moduleFileExtensions: ['js', 'jsx', 'json', 'styl', 'ts', 'tsx'],
|
|
4
|
+
setupFilesAfterEnv: ['./test/jestsetup.js', 'jest-canvas-mock'],
|
|
5
|
+
moduleDirectories: ['src', 'node_modules'],
|
|
6
|
+
moduleNameMapper: {
|
|
7
|
+
'\\.(png|gif|jpe?g|svg)$': '<rootDir>/test/fileMock.js',
|
|
8
|
+
'\\.styl$': 'identity-obj-proxy',
|
|
9
|
+
'^cozy-client$': '<rootDir>/node_modules/cozy-client/dist/index',
|
|
10
|
+
'^cozy-client/dist/types$':
|
|
11
|
+
'<rootDir>/node_modules/cozy-client/dist/types.js',
|
|
12
|
+
'^cozy-ui(.*)': '<rootDir>/node_modules/cozy-ui/$1'
|
|
13
|
+
},
|
|
14
|
+
transformIgnorePatterns: ['node_modules/(?!(cozy-ui))'],
|
|
15
|
+
testPathIgnorePatterns: ['node_modules', 'dist'],
|
|
16
|
+
testEnvironment: 'jest-environment-jsdom',
|
|
17
|
+
transform: {
|
|
18
|
+
'^.+\\.(ts|tsx|js|jsx)?$': 'babel-jest'
|
|
19
|
+
}
|
|
20
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cozy-ui-plus",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Cozy-ui-plus is an extension of cozy-ui and provides components based on cozy-client",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/cozy/cozy-libs/blob/master/packages/cozy-ui-plus/Readme.md",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/cozy/cozy-libs.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/cozy/cozy-libs/issues"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "yarn build:clean && yarn build:types && env BABEL_ENV=transpilation babel --extensions .ts,.tsx,.js,.jsx,.md,.styl,.json,.snap ./src -d ./dist --copy-files --no-copy-ignored --verbose",
|
|
17
|
+
"build:clean": "rm -rf ./dist",
|
|
18
|
+
"build:types": "tsc -p tsconfig-build.json",
|
|
19
|
+
"start": "yarn build --watch",
|
|
20
|
+
"prepublishOnly": "yarn build",
|
|
21
|
+
"test": "env NODE_ENV=test jest",
|
|
22
|
+
"lint": "cd .. && yarn eslint --ext js,jsx packages/cozy-ui-plus"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@babel/cli": "7.16.8",
|
|
26
|
+
"@babel/core": "7.16.12",
|
|
27
|
+
"@testing-library/jest-dom": "^5.14.1",
|
|
28
|
+
"@testing-library/react": "11.2.7",
|
|
29
|
+
"@testing-library/react-hooks": "^3.2.1",
|
|
30
|
+
"@testing-library/user-event": "^14.4.0",
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "5.54.0",
|
|
32
|
+
"@typescript-eslint/parser": "5.54.0",
|
|
33
|
+
"babel-plugin-inline-json-import": "0.3.2",
|
|
34
|
+
"babel-preset-cozy-app": "^2.8.1",
|
|
35
|
+
"cozy-client": "^60.5.0",
|
|
36
|
+
"cozy-device-helper": "2.0.0",
|
|
37
|
+
"cozy-intent": "^2.30.0",
|
|
38
|
+
"cozy-logger": "^1.17.0",
|
|
39
|
+
"cozy-stack-client": "^60.1.0",
|
|
40
|
+
"cozy-ui": "^132.0.0",
|
|
41
|
+
"jest": "26.6.3",
|
|
42
|
+
"jest-canvas-mock": "2.3.1",
|
|
43
|
+
"jest-environment-jsdom": "26.6.2",
|
|
44
|
+
"node-polyglot": "^2.4.0",
|
|
45
|
+
"prop-types": "15.8.1",
|
|
46
|
+
"react": "16.12.0",
|
|
47
|
+
"react-dnd": "16.0.1",
|
|
48
|
+
"react-dnd-html5-backend": "16.0.1",
|
|
49
|
+
"react-dom": "16.12.0",
|
|
50
|
+
"react-test-renderer": "16.12.0",
|
|
51
|
+
"stylus": "0.64.0",
|
|
52
|
+
"typescript": "5.5.2"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"classnames": "^2.5.1",
|
|
56
|
+
"cozy-interapp": "^0.5.4",
|
|
57
|
+
"filesize": "8.0.7",
|
|
58
|
+
"final-form": "4.20.9",
|
|
59
|
+
"final-form-arrays": "3.1.0",
|
|
60
|
+
"lodash": "^4.17.21",
|
|
61
|
+
"mime-types": "2.1.35",
|
|
62
|
+
"react-final-form": "6.5.9",
|
|
63
|
+
"react-final-form-arrays": "3.1.4",
|
|
64
|
+
"rooks": "7.14.1"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"cozy-client": ">=60.5.0",
|
|
68
|
+
"cozy-device-helper": ">=2.0.0",
|
|
69
|
+
"cozy-intent": ">=2.30.0",
|
|
70
|
+
"cozy-logger": ">=1.17.0",
|
|
71
|
+
"cozy-ui": ">=132.0.0",
|
|
72
|
+
"react": "^16 || ^17 || ^18",
|
|
73
|
+
"react-dom": "^16 || ^17 || ^18"
|
|
74
|
+
},
|
|
75
|
+
"gitHead": "f1f3c0b415dd50a3f4b4c7a3dc7dcb143727078b"
|
|
76
|
+
}
|
package/preprocess.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const stylus = require('stylus')
|
|
2
|
+
|
|
3
|
+
const cozyStylusPlugin = require('cozy-ui/stylus')
|
|
4
|
+
|
|
5
|
+
const renderStylus = function (css, filename) {
|
|
6
|
+
try {
|
|
7
|
+
return stylus(css)
|
|
8
|
+
.use(cozyStylusPlugin())
|
|
9
|
+
.set('filename', filename)
|
|
10
|
+
.render()
|
|
11
|
+
} catch (e) {
|
|
12
|
+
console.log(e) // eslint-disable-line no-console
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = renderStylus
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
`<AppIcon />` renders an app icon.
|
|
2
|
+
|
|
3
|
+
AppIcon takes all the space available, it needs to be in a container that specifies its width/height.
|
|
4
|
+
|
|
5
|
+
It contains business logic related to apps documents.
|
|
6
|
+
|
|
7
|
+
Apps documents provided by the stack are containing a `links.icon` property which is public and can be directly used as `src` value for an `<img />` tag.
|
|
8
|
+
|
|
9
|
+
`<AppIcon />` is also able to retrieve an icon for a registry app. If no attribute `links.icon` is present on the app document, `<AppIcon />` tries to fetch the icon with a registry link, computed thanks to the app attributes `slug` and `latest_version.version`.
|
|
10
|
+
|
|
11
|
+
The given app can be:
|
|
12
|
+
|
|
13
|
+
- An object representing an app fetched from the registry
|
|
14
|
+
- An app's slug string
|
|
15
|
+
|
|
16
|
+
### Example
|
|
17
|
+
|
|
18
|
+
if no application was found, we fallback on a default `CubeIcon`
|
|
19
|
+
|
|
20
|
+
```jsx static
|
|
21
|
+
<div>
|
|
22
|
+
<AppIcon app={app} />
|
|
23
|
+
</div>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```jsx
|
|
27
|
+
import AppIcon from 'cozy-ui/transpiled/react/AppIcon'
|
|
28
|
+
|
|
29
|
+
;
|
|
30
|
+
<div>
|
|
31
|
+
<div style={{ width: '100px' }}>
|
|
32
|
+
<AppIcon app="test" />
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Using fetchIcon
|
|
38
|
+
|
|
39
|
+
Is it also possible to provide a custom asynchronous `fetchIcon` which takes an app document as argument and resolves with an icon URL (see [`URL.createObjectURL`](https://developer.mozilla.org/en/docs/Web/API/URL/createObjectURL)). `fetchIcon` may also throw errors.
|
|
40
|
+
|
|
41
|
+
### Example with fetchIcon
|
|
42
|
+
|
|
43
|
+
```jsx static
|
|
44
|
+
<div>
|
|
45
|
+
<AppIcon app={app} fetchIcon={icon => client.fetch(...)} />
|
|
46
|
+
</div>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```jsx
|
|
50
|
+
import AppIcon from 'cozy-ui/transpiled/react/AppIcon'
|
|
51
|
+
import { placeholder100, placeholder100Red } from 'docs/placeholders/img'
|
|
52
|
+
|
|
53
|
+
const fetchIcon1 = () => placeholder100
|
|
54
|
+
const fetchIcon2 = () => placeholder100Red
|
|
55
|
+
|
|
56
|
+
const handleSwitch = () => {
|
|
57
|
+
const newFetchIcon = state.fetchIcon.name === 'fetchIcon1' ? fetchIcon2 : fetchIcon1
|
|
58
|
+
setState({ fetchIcon: newFetchIcon })
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
initialState = { fetchIcon: fetchIcon1 }
|
|
62
|
+
|
|
63
|
+
;
|
|
64
|
+
<div>
|
|
65
|
+
<button onClick={handleSwitch}>Switch</button>{' '}
|
|
66
|
+
fetchIcon: {state.fetchIcon.name}<br/>
|
|
67
|
+
<div style={{ width: '100px' }}>
|
|
68
|
+
<AppIcon app={'test'} fetchIcon={state.fetchIcon} />
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Provide `fallbackIcon`
|
|
74
|
+
|
|
75
|
+
You can provide an `<Icon />` `icon` props to fallback when the AppIcon fetched is broken or the `fetchIcon` function errored.
|
|
76
|
+
|
|
77
|
+
```jsx
|
|
78
|
+
import AppIcon from 'cozy-ui/transpiled/react/AppIcon'
|
|
79
|
+
import WarningIcon from 'cozy-ui/transpiled/react/Icons/Warning'
|
|
80
|
+
import { placeholder100Red } from 'docs/placeholders/img'
|
|
81
|
+
|
|
82
|
+
const fetchIcon = () => placeholder100Red
|
|
83
|
+
const fetchIconBroken = () => 'blahblahblah'
|
|
84
|
+
|
|
85
|
+
const brokeFetchIcon = () => setState({ fetchIcon: fetchIconBroken })
|
|
86
|
+
|
|
87
|
+
initialState = { fetchIcon }
|
|
88
|
+
|
|
89
|
+
;
|
|
90
|
+
<div>
|
|
91
|
+
<button onClick={brokeFetchIcon}>Break it</button>
|
|
92
|
+
<div style={{ width: '100px' }}>
|
|
93
|
+
<AppIcon fetchIcon={state.fetchIcon} fallbackIcon={WarningIcon} />
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
```
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import cx from 'classnames'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import React, { Component } from 'react'
|
|
4
|
+
|
|
5
|
+
import { withClient } from 'cozy-client'
|
|
6
|
+
import Icon, { iconPropType } from 'cozy-ui/transpiled/react/Icon'
|
|
7
|
+
import CubeIcon from 'cozy-ui/transpiled/react/Icons/Cube'
|
|
8
|
+
|
|
9
|
+
import styles from './styles.styl'
|
|
10
|
+
import { isShortcutFile } from '../AppSections/helpers'
|
|
11
|
+
import { ShortcutTile } from '../ShortcutTile'
|
|
12
|
+
import { AppDoctype } from '../proptypes'
|
|
13
|
+
|
|
14
|
+
const DONE = 'done'
|
|
15
|
+
const ERRORED = 'errored'
|
|
16
|
+
const FETCHING = 'fetching'
|
|
17
|
+
|
|
18
|
+
export class AppIcon extends Component {
|
|
19
|
+
constructor(props, context) {
|
|
20
|
+
super(props, context)
|
|
21
|
+
this.isUnmounting = false
|
|
22
|
+
this.handleError = this.handleError.bind(this)
|
|
23
|
+
this.fetchIcon = this.fetchIcon.bind(this)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
state = {
|
|
27
|
+
error: null,
|
|
28
|
+
icon: null,
|
|
29
|
+
status: this.props.client ? FETCHING : ERRORED
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
componentWillUnmount() {
|
|
33
|
+
this.isUnmounting = true
|
|
34
|
+
}
|
|
35
|
+
componentDidMount() {
|
|
36
|
+
this.isUnmounting = false
|
|
37
|
+
this.load()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
componentDidUpdate(prevProps) {
|
|
41
|
+
if (this.props.fetchIcon !== prevProps.fetchIcon) {
|
|
42
|
+
this.load()
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
fetchIcon() {
|
|
47
|
+
const { app, type, priority, client } = this.props
|
|
48
|
+
|
|
49
|
+
// Shortcut files used in cozy-store have their own icon in their doctype metadata
|
|
50
|
+
if (isShortcutFile(app)) return
|
|
51
|
+
|
|
52
|
+
return client.getStackClient().getIconURL({
|
|
53
|
+
type,
|
|
54
|
+
slug: app.slug || app,
|
|
55
|
+
appData: app,
|
|
56
|
+
priority
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
handleError() {
|
|
61
|
+
this.setState({ status: ERRORED })
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async load() {
|
|
65
|
+
const { app, fetchIcon, onReady, client } = this.props
|
|
66
|
+
|
|
67
|
+
const loadFn = fetchIcon || this.fetchIcon
|
|
68
|
+
let loadedUrl
|
|
69
|
+
let loadError
|
|
70
|
+
let domain
|
|
71
|
+
let secure
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
if (client) {
|
|
75
|
+
const cozyURL = new URL(client.getStackClient().uri)
|
|
76
|
+
domain = cozyURL.host
|
|
77
|
+
secure = cozyURL.protocol === 'https:'
|
|
78
|
+
}
|
|
79
|
+
loadedUrl = await loadFn(app, domain, secure)
|
|
80
|
+
} catch (error) {
|
|
81
|
+
loadError = error
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (!this.isUnmounting) {
|
|
85
|
+
this.setState({
|
|
86
|
+
error: loadError,
|
|
87
|
+
icon: loadedUrl,
|
|
88
|
+
status: loadError ? ERRORED : DONE
|
|
89
|
+
})
|
|
90
|
+
if (typeof onReady === 'function') {
|
|
91
|
+
onReady()
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
render() {
|
|
97
|
+
const { alt, className, fallbackIcon } = this.props
|
|
98
|
+
const { icon, status } = this.state
|
|
99
|
+
|
|
100
|
+
if (isShortcutFile(this.props.app)) {
|
|
101
|
+
return <ShortcutTile file={this.props.app} />
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
switch (status) {
|
|
105
|
+
case FETCHING:
|
|
106
|
+
return (
|
|
107
|
+
<div
|
|
108
|
+
role="progressbar"
|
|
109
|
+
className={cx(
|
|
110
|
+
styles['c-loading-placeholder'],
|
|
111
|
+
styles['c-app-icon'],
|
|
112
|
+
className
|
|
113
|
+
)}
|
|
114
|
+
/>
|
|
115
|
+
)
|
|
116
|
+
case DONE:
|
|
117
|
+
return (
|
|
118
|
+
<img
|
|
119
|
+
alt={alt}
|
|
120
|
+
className={cx(styles['c-app-icon'], className)}
|
|
121
|
+
onError={this.handleError}
|
|
122
|
+
ref={this.props.iconRef}
|
|
123
|
+
src={icon}
|
|
124
|
+
/>
|
|
125
|
+
)
|
|
126
|
+
case ERRORED:
|
|
127
|
+
default:
|
|
128
|
+
return (
|
|
129
|
+
<Icon
|
|
130
|
+
className={cx(
|
|
131
|
+
styles['c-app-icon'],
|
|
132
|
+
styles['c-app-icon-default'],
|
|
133
|
+
className
|
|
134
|
+
)}
|
|
135
|
+
height="100%"
|
|
136
|
+
icon={fallbackIcon || CubeIcon}
|
|
137
|
+
width="100%"
|
|
138
|
+
color="var(--coolGrey)"
|
|
139
|
+
iconRef={this.props.iconRef}
|
|
140
|
+
/>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
AppIcon.propTypes = {
|
|
147
|
+
alt: PropTypes.string,
|
|
148
|
+
/** Required if fetchIcon is not provided */
|
|
149
|
+
app: PropTypes.oneOfType([AppDoctype, PropTypes.string]),
|
|
150
|
+
/** Icon to fallback on error (optional), default cube icon */
|
|
151
|
+
fallbackIcon: iconPropType,
|
|
152
|
+
/** Custom implementation of how to fetch icon */
|
|
153
|
+
fetchIcon: PropTypes.func,
|
|
154
|
+
client: PropTypes.object.isRequired,
|
|
155
|
+
className: PropTypes.string,
|
|
156
|
+
onReady: PropTypes.func,
|
|
157
|
+
/** Type of application */
|
|
158
|
+
type: PropTypes.oneOf(['app', 'konnector']),
|
|
159
|
+
/** First source to fetch the icon. If nothing is found, there is a second try with the other source */
|
|
160
|
+
priority: PropTypes.oneOf(['stack', 'registry'])
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
AppIcon.defaultProps = {
|
|
164
|
+
type: 'app',
|
|
165
|
+
priority: 'stack'
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export default withClient(AppIcon)
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
|
|
3
|
+
'use strict'
|
|
4
|
+
/* eslint-env jest */
|
|
5
|
+
|
|
6
|
+
import { render, screen } from '@testing-library/react'
|
|
7
|
+
import React from 'react'
|
|
8
|
+
|
|
9
|
+
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
10
|
+
|
|
11
|
+
import { AppIcon } from '.'
|
|
12
|
+
|
|
13
|
+
jest.mock('cozy-ui/transpiled/react/Icon', () => ({
|
|
14
|
+
...jest.requireActual('cozy-ui/transpiled/react/Icon'),
|
|
15
|
+
__esModule: true,
|
|
16
|
+
default: jest.fn(() => <div data-testid="icon-component"></div>)
|
|
17
|
+
}))
|
|
18
|
+
|
|
19
|
+
describe('AppIcon component', () => {
|
|
20
|
+
const app = {}
|
|
21
|
+
const domain = 'cozy.tools'
|
|
22
|
+
const secure = true
|
|
23
|
+
|
|
24
|
+
const mockClient = {
|
|
25
|
+
getStackClient: () => ({ uri: `https://${domain}` })
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let successFetchIcon
|
|
29
|
+
let failureFetchIcon
|
|
30
|
+
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
jest.resetModules()
|
|
33
|
+
jest.clearAllMocks()
|
|
34
|
+
|
|
35
|
+
successFetchIcon = jest
|
|
36
|
+
.fn()
|
|
37
|
+
.mockResolvedValue('http://cozy.tools/apps/test/icon')
|
|
38
|
+
|
|
39
|
+
failureFetchIcon = jest
|
|
40
|
+
.fn()
|
|
41
|
+
.mockImplementation(() => Promise.reject(new Error('Mocked error')))
|
|
42
|
+
|
|
43
|
+
console.error = jest.fn()
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it(`renders as loading`, () => {
|
|
47
|
+
render(
|
|
48
|
+
<AppIcon app={app} fetchIcon={successFetchIcon} client={mockClient} />
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
const loadingElement = screen.getByRole('progressbar')
|
|
52
|
+
|
|
53
|
+
expect(loadingElement).toBeInTheDocument()
|
|
54
|
+
expect(successFetchIcon).toHaveBeenCalledWith(app, domain, secure)
|
|
55
|
+
expect(console.error).not.toHaveBeenCalled()
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it(`should provide appData to getIconUrl in order to get icon simply, when oauth not needed`, async () => {
|
|
59
|
+
const app = {
|
|
60
|
+
name: 'app name',
|
|
61
|
+
slug: 'slug',
|
|
62
|
+
links: {
|
|
63
|
+
icon: 'icon url'
|
|
64
|
+
},
|
|
65
|
+
latest_version: {
|
|
66
|
+
version: 'version'
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const getIconURLMock = jest
|
|
70
|
+
.fn()
|
|
71
|
+
.mockImplementation(() => `https://${domain}`)
|
|
72
|
+
const mockClient = {
|
|
73
|
+
getStackClient: () => ({
|
|
74
|
+
uri: `https://${domain}`,
|
|
75
|
+
getIconURL: getIconURLMock
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
render(<AppIcon app={app} client={mockClient} />)
|
|
80
|
+
|
|
81
|
+
expect(getIconURLMock).toHaveBeenNthCalledWith(1, {
|
|
82
|
+
appData: app,
|
|
83
|
+
priority: 'stack',
|
|
84
|
+
slug: 'slug',
|
|
85
|
+
type: 'app'
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it(`renders correctly`, async () => {
|
|
90
|
+
render(
|
|
91
|
+
<AppIcon app={app} fetchIcon={successFetchIcon} client={mockClient} />
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
const iconElement = await screen.findByRole('img')
|
|
95
|
+
expect(iconElement).toBeInTheDocument()
|
|
96
|
+
|
|
97
|
+
expect(successFetchIcon).toHaveBeenCalledWith(app, domain, secure)
|
|
98
|
+
expect(console.error).not.toHaveBeenCalled()
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
it(`renders default when fetch error occurs`, async () => {
|
|
102
|
+
render(
|
|
103
|
+
<AppIcon app={app} fetchIcon={failureFetchIcon} client={mockClient} />
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
const iconFallbackElement = await screen.findByTestId('icon-component')
|
|
107
|
+
expect(iconFallbackElement).toBeInTheDocument()
|
|
108
|
+
|
|
109
|
+
expect(failureFetchIcon).toHaveBeenCalledWith(app, domain, secure)
|
|
110
|
+
expect(console.error).not.toHaveBeenCalled()
|
|
111
|
+
|
|
112
|
+
// Check that the Icon component has been called with a function (CubeIcon function is the default icon)
|
|
113
|
+
expect(Icon).toHaveBeenCalledWith(
|
|
114
|
+
expect.objectContaining({
|
|
115
|
+
icon: expect.any(Function)
|
|
116
|
+
}),
|
|
117
|
+
{}
|
|
118
|
+
)
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
it(`renders provided fallbackIcon when fetch error occurs`, async () => {
|
|
122
|
+
render(
|
|
123
|
+
<AppIcon
|
|
124
|
+
app={app}
|
|
125
|
+
fetchIcon={failureFetchIcon}
|
|
126
|
+
client={mockClient}
|
|
127
|
+
fallbackIcon="warning"
|
|
128
|
+
/>
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
const iconFallbackElement = await screen.findByTestId('icon-component')
|
|
132
|
+
expect(iconFallbackElement).toBeInTheDocument()
|
|
133
|
+
|
|
134
|
+
expect(failureFetchIcon).toHaveBeenCalledWith(app, domain, secure)
|
|
135
|
+
expect(console.error).not.toHaveBeenCalled()
|
|
136
|
+
|
|
137
|
+
// Check that the Icon component has been called with "warning"
|
|
138
|
+
expect(Icon).toHaveBeenCalledWith(
|
|
139
|
+
expect.objectContaining({
|
|
140
|
+
icon: 'warning'
|
|
141
|
+
}),
|
|
142
|
+
{}
|
|
143
|
+
)
|
|
144
|
+
})
|
|
145
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@keyframes placeHolderShimmer {
|
|
2
|
+
0% { background-position: -20rem 0; }
|
|
3
|
+
80% { background-position: 20rem 0; }
|
|
4
|
+
80.1% { background-position: -20rem 0; }
|
|
5
|
+
100% { background-position: -20rem 0; }
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.c-loading-placeholder {
|
|
9
|
+
animation-delay: 0.1s;
|
|
10
|
+
animation-duration: 2s;
|
|
11
|
+
animation-iteration-count: infinite;
|
|
12
|
+
animation-name: placeHolderShimmer;
|
|
13
|
+
animation-timing-function: linear;
|
|
14
|
+
background-position: -20rem 0;
|
|
15
|
+
background-image: linear-gradient(to right, silver 0%, #fcfcfc 50%, silver 100%);
|
|
16
|
+
background-size: 20rem 10rem;
|
|
17
|
+
background-repeat: no-repeat;
|
|
18
|
+
background-color: silver;
|
|
19
|
+
border-radius: 0.15rem;
|
|
20
|
+
max-width: 100%;
|
|
21
|
+
position: relative;
|
|
22
|
+
margin: .1rem 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.c-app-icon,
|
|
26
|
+
.c-app-icon svg {
|
|
27
|
+
height 100%
|
|
28
|
+
width 100%
|
|
29
|
+
// Prevent flex-grow and flex-shrink
|
|
30
|
+
flex-grow 0
|
|
31
|
+
flex-shrink 0
|
|
32
|
+
object-fit contain
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.c-app-icon-default {
|
|
36
|
+
color var(--silver)
|
|
37
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Render-props component that provides onClick/href handler to
|
|
2
|
+
apply to an anchor that needs to open an app.
|
|
3
|
+
|
|
4
|
+
The app's manifest can be set in the `app` prop. Then, in a
|
|
5
|
+
ReactNative environment, the AppLinker will be able to send
|
|
6
|
+
`openApp` message to the native environment with this `app`
|
|
7
|
+
data.
|
|
8
|
+
|
|
9
|
+
Handles several cases:
|
|
10
|
+
|
|
11
|
+
- On mobile app and other mobile app available
|
|
12
|
+
- On web (not mobile)
|
|
13
|
+
- On web mobile
|
|
14
|
+
|
|
15
|
+
As it uses the render props pattern, it is flexible and can be used to build components that are more complex than a simple
|
|
16
|
+
anchor.
|
|
17
|
+
|
|
18
|
+
```jsx
|
|
19
|
+
import AppLinker from 'cozy-ui/transpiled/react/AppLinker';
|
|
20
|
+
|
|
21
|
+
const app = {
|
|
22
|
+
slug: 'banks'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
<AppLinker app={app} href='http://dalailama-banks.mycozy.cloud'>{
|
|
26
|
+
({ onClick, href }) => (
|
|
27
|
+
<a href={href} onClick={onClick}>
|
|
28
|
+
Open
|
|
29
|
+
</a>
|
|
30
|
+
)
|
|
31
|
+
}</AppLinker>
|
|
32
|
+
```
|