@alveole/components 0.43.3 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Alert/Alert.d.ts +11 -0
- package/dist/core/Alert/Alert.d.ts.map +1 -0
- package/dist/core/Alert/Alert.js +4 -0
- package/dist/core/Alert/Alert.web.d.ts +5 -0
- package/dist/core/Alert/Alert.web.d.ts.map +1 -0
- package/dist/core/Alert/Alert.web.js +7 -0
- package/dist/core/Alert/index.d.ts +2 -0
- package/dist/core/Alert/index.d.ts.map +1 -0
- package/dist/core/Alert/index.js +1 -0
- package/dist/core/Form/Form.d.ts +2 -5
- package/dist/core/Form/Form.d.ts.map +1 -1
- package/dist/core/Form/Form.js +3 -24
- package/dist/core/Form/Form.stories.d.ts +0 -7
- package/dist/core/Form/Form.stories.d.ts.map +1 -1
- package/dist/core/Form/Form.stories.js +2 -3
- package/dist/core/Form/Form.stories.sources.d.ts +0 -2
- package/dist/core/Form/Form.stories.sources.d.ts.map +1 -1
- package/dist/core/Form/Form.stories.sources.js +0 -2
- package/dist/core/Form/Form.styles.d.ts +0 -6
- package/dist/core/Form/Form.styles.d.ts.map +1 -1
- package/dist/core/Form/Form.styles.js +0 -6
- package/dist/core/Image/Image.d.ts.map +1 -1
- package/dist/core/Image/Image.js +1 -5
- package/dist/core/Map/Map.web.d.ts.map +1 -1
- package/dist/core/Map/Map.web.js +41 -41
- package/dist/core/Page/Page.d.ts +2 -0
- package/dist/core/Page/Page.d.ts.map +1 -1
- package/dist/core/Page/Page.stories.d.ts +6 -2
- package/dist/core/Page/Page.stories.d.ts.map +1 -1
- package/dist/core/Page/Page.stories.js +28 -14
- package/dist/core/Page/Page.stories.sources.d.ts +12 -4
- package/dist/core/Page/Page.stories.sources.d.ts.map +1 -1
- package/dist/core/Page/Page.stories.sources.js +12 -4
- package/dist/core/Page/PageContentScrollable.d.ts +1 -0
- package/dist/core/Page/PageContentScrollable.d.ts.map +1 -1
- package/dist/core/Page/PageContentScrollable.js +2 -2
- package/dist/core/Page/PageHead.web.d.ts.map +1 -1
- package/dist/core/Page/PageHead.web.js +5 -2
- package/dist/core/Page/PageMetaContext.d.ts +25 -0
- package/dist/core/Page/PageMetaContext.d.ts.map +1 -0
- package/dist/core/Page/PageMetaContext.js +18 -0
- package/dist/core/Page/index.d.ts +2 -0
- package/dist/core/Page/index.d.ts.map +1 -1
- package/dist/core/Page/index.js +2 -0
- package/dist/core/PdfViewer/PdfViewer.js +1 -1
- package/dist/core/Version/Version.stories.d.ts +1 -1
- package/dist/core/Version/Version.styles.d.ts +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.d.ts.map +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/globals.d.ts +2 -0
- package/dist/globals.d.ts.map +1 -0
- package/dist/globals.js +1 -0
- package/dist/pdfjs/pdf.min.mjs +8 -1
- package/dist/pdfjs/pdf.worker.min.mjs +8 -1
- package/dist/stories/index.d.ts +24 -0
- package/dist/stories/index.d.ts.map +1 -1
- package/dist/stories/index.js +24 -0
- package/dist/ui/Accordion/Accordion.d.ts +19 -0
- package/dist/ui/Accordion/Accordion.d.ts.map +1 -0
- package/dist/ui/Accordion/Accordion.js +10 -0
- package/dist/ui/Accordion/Accordion.stories.d.ts +103 -0
- package/dist/ui/Accordion/Accordion.stories.d.ts.map +1 -0
- package/dist/ui/Accordion/Accordion.stories.js +15 -0
- package/dist/ui/Accordion/Accordion.stories.sources.d.ts +6 -0
- package/dist/ui/Accordion/Accordion.stories.sources.d.ts.map +1 -0
- package/dist/ui/Accordion/Accordion.stories.sources.js +6 -0
- package/dist/ui/Accordion/Accordion.styles.d.ts +90 -0
- package/dist/ui/Accordion/Accordion.styles.d.ts.map +1 -0
- package/dist/ui/Accordion/Accordion.styles.js +86 -0
- package/dist/ui/Accordion/AccordionItem.d.ts +14 -0
- package/dist/ui/Accordion/AccordionItem.d.ts.map +1 -0
- package/dist/ui/Accordion/AccordionItem.js +19 -0
- package/dist/ui/Accordion/index.d.ts +4 -0
- package/dist/ui/Accordion/index.d.ts.map +1 -0
- package/dist/ui/Accordion/index.js +5 -0
- package/dist/ui/ActionMenu/ActionMenu.stories.js +1 -1
- package/dist/ui/ActionMenu/ActionMenu.stories.sources.d.ts.map +1 -1
- package/dist/ui/ActionMenu/ActionMenu.stories.sources.js +1 -1
- package/dist/ui/Autocomplete/Autocomplete.d.ts +41 -0
- package/dist/ui/Autocomplete/Autocomplete.d.ts.map +1 -0
- package/dist/ui/Autocomplete/Autocomplete.js +131 -0
- package/dist/ui/Autocomplete/Autocomplete.stories.d.ts +224 -0
- package/dist/ui/Autocomplete/Autocomplete.stories.d.ts.map +1 -0
- package/dist/ui/Autocomplete/Autocomplete.stories.js +56 -0
- package/dist/ui/Autocomplete/Autocomplete.stories.sources.d.ts +14 -0
- package/dist/ui/Autocomplete/Autocomplete.stories.sources.d.ts.map +1 -0
- package/dist/ui/Autocomplete/Autocomplete.stories.sources.js +14 -0
- package/dist/ui/Autocomplete/Autocomplete.styles.d.ts +208 -0
- package/dist/ui/Autocomplete/Autocomplete.styles.d.ts.map +1 -0
- package/dist/ui/Autocomplete/Autocomplete.styles.js +173 -0
- package/dist/ui/Autocomplete/Autocomplete.web.d.ts +28 -0
- package/dist/ui/Autocomplete/Autocomplete.web.d.ts.map +1 -0
- package/dist/ui/Autocomplete/Autocomplete.web.js +112 -0
- package/dist/ui/Autocomplete/AutocompleteChip.d.ts +8 -0
- package/dist/ui/Autocomplete/AutocompleteChip.d.ts.map +1 -0
- package/dist/ui/Autocomplete/AutocompleteChip.js +12 -0
- package/dist/ui/Autocomplete/index.d.ts +3 -0
- package/dist/ui/Autocomplete/index.d.ts.map +1 -0
- package/dist/ui/Autocomplete/index.js +2 -0
- package/dist/ui/AutocompleteAddress/AutocompleteAddress.d.ts +28 -0
- package/dist/ui/AutocompleteAddress/AutocompleteAddress.d.ts.map +1 -0
- package/dist/ui/AutocompleteAddress/AutocompleteAddress.js +20 -0
- package/dist/ui/AutocompleteAddress/AutocompleteAddress.stories.d.ts +13 -0
- package/dist/ui/AutocompleteAddress/AutocompleteAddress.stories.d.ts.map +1 -0
- package/dist/ui/AutocompleteAddress/AutocompleteAddress.stories.js +30 -0
- package/dist/ui/AutocompleteAddress/AutocompleteAddress.stories.sources.d.ts +6 -0
- package/dist/ui/AutocompleteAddress/AutocompleteAddress.stories.sources.d.ts.map +1 -0
- package/dist/ui/AutocompleteAddress/AutocompleteAddress.stories.sources.js +6 -0
- package/dist/ui/AutocompleteAddress/index.d.ts +2 -0
- package/dist/ui/AutocompleteAddress/index.d.ts.map +1 -0
- package/dist/ui/AutocompleteAddress/index.js +1 -0
- package/dist/ui/Avatar/Avatar.stories.d.ts +3 -3
- package/dist/ui/Avatar/Avatar.styles.d.ts +3 -3
- package/dist/ui/Badge/Badge.js +1 -1
- package/dist/ui/Badge/Badge.stories.d.ts +15 -13
- package/dist/ui/Badge/Badge.stories.d.ts.map +1 -1
- package/dist/ui/Badge/Badge.styles.d.ts +15 -13
- package/dist/ui/Badge/Badge.styles.d.ts.map +1 -1
- package/dist/ui/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
- package/dist/ui/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/ui/Breadcrumbs/Breadcrumbs.stories.d.ts +3 -3
- package/dist/ui/Breadcrumbs/Breadcrumbs.styles.d.ts +3 -3
- package/dist/ui/Button/Button.stories.d.ts +68 -69
- package/dist/ui/Button/Button.stories.d.ts.map +1 -1
- package/dist/ui/Button/Button.styles.d.ts +68 -69
- package/dist/ui/Button/Button.styles.d.ts.map +1 -1
- package/dist/ui/Button/Button.styles.js +0 -1
- package/dist/ui/Button/ButtonIcon.d.ts.map +1 -1
- package/dist/ui/Button/ButtonIcon.js +2 -5
- package/dist/ui/Card/Card.stories.d.ts +3 -3
- package/dist/ui/Card/Card.styles.d.ts +3 -3
- package/dist/ui/Card/CardHeader.styles.d.ts +3 -3
- package/dist/ui/Card/CardSection.styles.d.ts +3 -3
- package/dist/ui/Checkbox/Checkbox.d.ts +19 -0
- package/dist/ui/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/ui/Checkbox/Checkbox.js +17 -0
- package/dist/ui/Checkbox/Checkbox.stories.d.ts +93 -0
- package/dist/ui/Checkbox/Checkbox.stories.d.ts.map +1 -0
- package/dist/ui/Checkbox/Checkbox.stories.js +15 -0
- package/dist/ui/Checkbox/Checkbox.stories.sources.d.ts +8 -0
- package/dist/ui/Checkbox/Checkbox.stories.sources.d.ts.map +1 -0
- package/dist/ui/Checkbox/Checkbox.stories.sources.js +8 -0
- package/dist/ui/Checkbox/Checkbox.styles.d.ts +70 -0
- package/dist/ui/Checkbox/Checkbox.styles.d.ts.map +1 -0
- package/dist/ui/Checkbox/Checkbox.styles.js +62 -0
- package/dist/ui/Checkbox/CheckboxContainer.d.ts +22 -0
- package/dist/ui/Checkbox/CheckboxContainer.d.ts.map +1 -0
- package/dist/ui/Checkbox/CheckboxContainer.js +21 -0
- package/dist/ui/Checkbox/CheckboxIndicator.d.ts +7 -0
- package/dist/ui/Checkbox/CheckboxIndicator.d.ts.map +1 -0
- package/dist/ui/Checkbox/CheckboxIndicator.js +15 -0
- package/dist/ui/Checkbox/CheckboxLabel.d.ts +9 -0
- package/dist/ui/Checkbox/CheckboxLabel.d.ts.map +1 -0
- package/dist/ui/Checkbox/CheckboxLabel.js +15 -0
- package/dist/ui/Checkbox/index.d.ts +5 -0
- package/dist/ui/Checkbox/index.d.ts.map +1 -0
- package/dist/ui/Checkbox/index.js +4 -0
- package/dist/ui/Counter/Counter.d.ts +6 -0
- package/dist/ui/Counter/Counter.d.ts.map +1 -0
- package/dist/ui/Counter/Counter.js +11 -0
- package/dist/ui/Counter/Counter.stories.d.ts +29 -0
- package/dist/ui/Counter/Counter.stories.d.ts.map +1 -0
- package/dist/ui/Counter/Counter.stories.js +15 -0
- package/dist/ui/Counter/Counter.stories.sources.d.ts +6 -0
- package/dist/ui/Counter/Counter.stories.sources.d.ts.map +1 -0
- package/dist/ui/Counter/Counter.stories.sources.js +6 -0
- package/dist/ui/Counter/Counter.styles.d.ts +18 -0
- package/dist/ui/Counter/Counter.styles.d.ts.map +1 -0
- package/dist/ui/Counter/Counter.styles.js +14 -0
- package/dist/ui/Counter/index.d.ts +2 -0
- package/dist/ui/Counter/index.d.ts.map +1 -0
- package/dist/ui/Counter/index.js +1 -0
- package/dist/ui/Divider/Divider.stories.d.ts +1 -1
- package/dist/ui/Divider/Divider.styles.d.ts +1 -1
- package/dist/ui/DocumentViewer/DocumentViewer.d.ts.map +1 -1
- package/dist/ui/DocumentViewer/DocumentViewer.js +1 -3
- package/dist/ui/DocumentViewer/DocumentViewer.stories.d.ts +16 -16
- package/dist/ui/DocumentViewer/DocumentViewer.styles.d.ts +16 -16
- package/dist/ui/DocumentViewer/DocumentViewerPDF.d.ts.map +1 -1
- package/dist/ui/DocumentViewer/DocumentViewerPDF.js +4 -7
- package/dist/ui/DragAndDropFile/DragAndDropFile.d.ts +9 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.d.ts.map +1 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.js +50 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.stories.d.ts +102 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.stories.d.ts.map +1 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.stories.js +17 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.stories.sources.d.ts +10 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.stories.sources.d.ts.map +1 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.stories.sources.js +10 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.styles.d.ts +89 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.styles.d.ts.map +1 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.styles.js +89 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.web.d.ts +4 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.web.d.ts.map +1 -0
- package/dist/ui/DragAndDropFile/DragAndDropFile.web.js +175 -0
- package/dist/ui/DragAndDropFile/index.d.ts +2 -0
- package/dist/ui/DragAndDropFile/index.d.ts.map +1 -0
- package/dist/ui/DragAndDropFile/index.js +1 -0
- package/dist/ui/EmailField/EmailField.d.ts +20 -0
- package/dist/ui/EmailField/EmailField.d.ts.map +1 -0
- package/dist/ui/EmailField/EmailField.js +8 -0
- package/dist/ui/EmailField/EmailField.stories.d.ts +25 -0
- package/dist/ui/EmailField/EmailField.stories.d.ts.map +1 -0
- package/dist/ui/EmailField/EmailField.stories.js +13 -0
- package/dist/ui/EmailField/EmailField.stories.sources.d.ts +6 -0
- package/dist/ui/EmailField/EmailField.stories.sources.d.ts.map +1 -0
- package/dist/ui/EmailField/EmailField.stories.sources.js +6 -0
- package/dist/ui/EmailField/index.d.ts +2 -0
- package/dist/ui/EmailField/index.d.ts.map +1 -0
- package/dist/ui/EmailField/index.js +1 -0
- package/dist/ui/EmailInput/EmailInput.d.ts +16 -0
- package/dist/ui/EmailInput/EmailInput.d.ts.map +1 -0
- package/dist/ui/EmailInput/EmailInput.js +10 -0
- package/dist/ui/EmailInput/EmailInput.stories.d.ts +21 -0
- package/dist/ui/EmailInput/EmailInput.stories.d.ts.map +1 -0
- package/dist/ui/EmailInput/EmailInput.stories.js +13 -0
- package/dist/ui/EmailInput/EmailInput.stories.sources.d.ts +6 -0
- package/dist/ui/EmailInput/EmailInput.stories.sources.d.ts.map +1 -0
- package/dist/ui/EmailInput/EmailInput.stories.sources.js +6 -0
- package/dist/ui/EmailInput/index.d.ts +2 -0
- package/dist/ui/EmailInput/index.d.ts.map +1 -0
- package/dist/ui/EmailInput/index.js +1 -0
- package/dist/ui/EmptyState/EmptyState.stories.d.ts +5 -5
- package/dist/ui/EmptyState/EmptyState.styles.d.ts +5 -5
- package/dist/ui/FileField/FileField.d.ts +5 -0
- package/dist/ui/FileField/FileField.d.ts.map +1 -0
- package/dist/ui/FileField/FileField.js +27 -0
- package/dist/ui/FileField/FileField.stories.d.ts +15 -0
- package/dist/ui/FileField/FileField.stories.d.ts.map +1 -0
- package/dist/ui/FileField/FileField.stories.js +15 -0
- package/dist/ui/FileField/FileField.stories.sources.d.ts +8 -0
- package/dist/ui/FileField/FileField.stories.sources.d.ts.map +1 -0
- package/dist/ui/FileField/FileField.stories.sources.js +8 -0
- package/dist/ui/FileField/FileField.styles.d.ts +4 -0
- package/dist/ui/FileField/FileField.styles.d.ts.map +1 -0
- package/dist/ui/FileField/FileField.styles.js +4 -0
- package/dist/ui/FileField/index.d.ts +2 -0
- package/dist/ui/FileField/index.d.ts.map +1 -0
- package/dist/ui/FileField/index.js +1 -0
- package/dist/ui/FormControl/FormControl.stories.d.ts +17 -17
- package/dist/ui/FormControl/FormControl.stories.js +3 -3
- package/dist/ui/FormControl/FormControl.stories.sources.d.ts.map +1 -1
- package/dist/ui/FormControl/FormControl.stories.sources.js +3 -3
- package/dist/ui/FormControl/FormControl.styles.d.ts +17 -17
- package/dist/ui/FormControl/FormControlFileInput.d.ts.map +1 -1
- package/dist/ui/FormControl/FormControlFileInput.styles.d.ts +6 -6
- package/dist/ui/FormControl/TextInput.d.ts.map +1 -1
- package/dist/ui/Header/Header.stories.d.ts +10 -6
- package/dist/ui/Header/Header.stories.d.ts.map +1 -1
- package/dist/ui/Header/Header.styles.d.ts +10 -6
- package/dist/ui/Header/Header.styles.d.ts.map +1 -1
- package/dist/ui/Header/Header.styles.js +1 -0
- package/dist/ui/InputButtonAdornment/InputButtonAdornment.d.ts +9 -0
- package/dist/ui/InputButtonAdornment/InputButtonAdornment.d.ts.map +1 -0
- package/dist/ui/InputButtonAdornment/InputButtonAdornment.js +13 -0
- package/dist/ui/InputButtonAdornment/InputButtonAdornment.stories.d.ts +23 -0
- package/dist/ui/InputButtonAdornment/InputButtonAdornment.stories.d.ts.map +1 -0
- package/dist/ui/InputButtonAdornment/InputButtonAdornment.stories.js +16 -0
- package/dist/ui/InputButtonAdornment/InputButtonAdornment.stories.sources.d.ts +8 -0
- package/dist/ui/InputButtonAdornment/InputButtonAdornment.stories.sources.d.ts.map +1 -0
- package/dist/ui/InputButtonAdornment/InputButtonAdornment.stories.sources.js +8 -0
- package/dist/ui/InputButtonAdornment/InputButtonAdornment.styles.d.ts +12 -0
- package/dist/ui/InputButtonAdornment/InputButtonAdornment.styles.d.ts.map +1 -0
- package/dist/ui/InputButtonAdornment/InputButtonAdornment.styles.js +12 -0
- package/dist/ui/InputButtonAdornment/index.d.ts +2 -0
- package/dist/ui/InputButtonAdornment/index.d.ts.map +1 -0
- package/dist/ui/InputButtonAdornment/index.js +1 -0
- package/dist/ui/ListItem/ListItem.stories.d.ts +8 -8
- package/dist/ui/ListItem/ListItem.styles.d.ts +8 -8
- package/dist/ui/LucideIcon/LucideIcon.d.ts +3 -1
- package/dist/ui/LucideIcon/LucideIcon.d.ts.map +1 -1
- package/dist/ui/LucideIcon/LucideIcon.js +24 -4
- package/dist/ui/LucideIcon/LucideIcon.props.d.ts +291 -8
- package/dist/ui/LucideIcon/LucideIcon.props.d.ts.map +1 -1
- package/dist/ui/LucideIcon/LucideIcon.stories.d.ts +146 -4
- package/dist/ui/LucideIcon/LucideIcon.stories.d.ts.map +1 -1
- package/dist/ui/LucideIcon/LucideIcon.stories.js +2 -0
- package/dist/ui/LucideIcon/LucideIcon.stories.sources.d.ts +2 -0
- package/dist/ui/LucideIcon/LucideIcon.stories.sources.d.ts.map +1 -1
- package/dist/ui/LucideIcon/LucideIcon.stories.sources.js +2 -0
- package/dist/ui/NumberField/NumberField.d.ts +14 -0
- package/dist/ui/NumberField/NumberField.d.ts.map +1 -0
- package/dist/ui/NumberField/NumberField.js +13 -0
- package/dist/ui/NumberField/NumberField.stories.d.ts +14 -0
- package/dist/ui/NumberField/NumberField.stories.d.ts.map +1 -0
- package/dist/ui/NumberField/NumberField.stories.js +18 -0
- package/dist/ui/NumberField/NumberField.stories.sources.d.ts +6 -0
- package/dist/ui/NumberField/NumberField.stories.sources.d.ts.map +1 -0
- package/dist/ui/NumberField/NumberField.stories.sources.js +6 -0
- package/dist/ui/NumberField/NumberField.styles.d.ts +4 -0
- package/dist/ui/NumberField/NumberField.styles.d.ts.map +1 -0
- package/dist/ui/NumberField/NumberField.styles.js +4 -0
- package/dist/ui/NumberField/NumberField.web.d.ts +4 -0
- package/dist/ui/NumberField/NumberField.web.d.ts.map +1 -0
- package/dist/ui/NumberField/NumberField.web.js +10 -0
- package/dist/ui/NumberField/NumberFieldControlButton.d.ts +8 -0
- package/dist/ui/NumberField/NumberFieldControlButton.d.ts.map +1 -0
- package/dist/ui/NumberField/NumberFieldControlButton.js +6 -0
- package/dist/ui/NumberField/index.d.ts +2 -0
- package/dist/ui/NumberField/index.d.ts.map +1 -0
- package/dist/ui/NumberField/index.js +1 -0
- package/dist/ui/OtpField/OtpField.d.ts +15 -0
- package/dist/ui/OtpField/OtpField.d.ts.map +1 -0
- package/dist/ui/OtpField/OtpField.js +18 -0
- package/dist/ui/OtpField/OtpField.stories.d.ts +57 -0
- package/dist/ui/OtpField/OtpField.stories.d.ts.map +1 -0
- package/dist/ui/OtpField/OtpField.stories.js +14 -0
- package/dist/ui/OtpField/OtpField.stories.sources.d.ts +6 -0
- package/dist/ui/OtpField/OtpField.stories.sources.d.ts.map +1 -0
- package/dist/ui/OtpField/OtpField.stories.sources.js +6 -0
- package/dist/ui/OtpField/OtpField.styles.d.ts +39 -0
- package/dist/ui/OtpField/OtpField.styles.d.ts.map +1 -0
- package/dist/ui/OtpField/OtpField.styles.js +35 -0
- package/dist/ui/OtpField/index.d.ts +2 -0
- package/dist/ui/OtpField/index.d.ts.map +1 -0
- package/dist/ui/OtpField/index.js +1 -0
- package/dist/ui/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/ui/PageHeader/PageHeader.js +1 -1
- package/dist/ui/PageHeader/PageHeader.stories.d.ts +1 -1
- package/dist/ui/PageHeader/PageHeader.stories.js +1 -1
- package/dist/ui/PageHeader/PageHeader.styles.d.ts +1 -1
- package/dist/ui/PasswordField/PasswordField.d.ts +20 -0
- package/dist/ui/PasswordField/PasswordField.d.ts.map +1 -0
- package/dist/ui/PasswordField/PasswordField.js +10 -0
- package/dist/ui/PasswordField/PasswordField.stories.d.ts +33 -0
- package/dist/ui/PasswordField/PasswordField.stories.d.ts.map +1 -0
- package/dist/ui/PasswordField/PasswordField.stories.js +14 -0
- package/dist/ui/PasswordField/PasswordField.stories.sources.d.ts +6 -0
- package/dist/ui/PasswordField/PasswordField.stories.sources.d.ts.map +1 -0
- package/dist/ui/PasswordField/PasswordField.stories.sources.js +6 -0
- package/dist/ui/PasswordField/PasswordField.styles.d.ts +10 -0
- package/dist/ui/PasswordField/PasswordField.styles.d.ts.map +1 -0
- package/dist/ui/PasswordField/PasswordField.styles.js +10 -0
- package/dist/ui/PasswordField/index.d.ts +2 -0
- package/dist/ui/PasswordField/index.d.ts.map +1 -0
- package/dist/ui/PasswordField/index.js +1 -0
- package/dist/ui/PhoneField/PhoneField.d.ts +20 -0
- package/dist/ui/PhoneField/PhoneField.d.ts.map +1 -0
- package/dist/ui/PhoneField/PhoneField.js +8 -0
- package/dist/ui/PhoneField/PhoneField.stories.d.ts +25 -0
- package/dist/ui/PhoneField/PhoneField.stories.d.ts.map +1 -0
- package/dist/ui/PhoneField/PhoneField.stories.js +13 -0
- package/dist/ui/PhoneField/PhoneField.stories.sources.d.ts +6 -0
- package/dist/ui/PhoneField/PhoneField.stories.sources.d.ts.map +1 -0
- package/dist/ui/PhoneField/PhoneField.stories.sources.js +6 -0
- package/dist/ui/PhoneField/index.d.ts +2 -0
- package/dist/ui/PhoneField/index.d.ts.map +1 -0
- package/dist/ui/PhoneField/index.js +1 -0
- package/dist/ui/PhoneInput/PhoneInput.d.ts +16 -0
- package/dist/ui/PhoneInput/PhoneInput.d.ts.map +1 -0
- package/dist/ui/PhoneInput/PhoneInput.js +7 -0
- package/dist/ui/PhoneInput/PhoneInput.stories.d.ts +21 -0
- package/dist/ui/PhoneInput/PhoneInput.stories.d.ts.map +1 -0
- package/dist/ui/PhoneInput/PhoneInput.stories.js +13 -0
- package/dist/ui/PhoneInput/PhoneInput.stories.sources.d.ts +6 -0
- package/dist/ui/PhoneInput/PhoneInput.stories.sources.d.ts.map +1 -0
- package/dist/ui/PhoneInput/PhoneInput.stories.sources.js +6 -0
- package/dist/ui/PhoneInput/index.d.ts +2 -0
- package/dist/ui/PhoneInput/index.d.ts.map +1 -0
- package/dist/ui/PhoneInput/index.js +1 -0
- package/dist/ui/Popover/Popover.stories.d.ts +9 -9
- package/dist/ui/Popover/Popover.styles.d.ts +9 -9
- package/dist/ui/PriceInput/PriceInput.css +9 -0
- package/dist/ui/PriceInput/PriceInput.d.ts +14 -0
- package/dist/ui/PriceInput/PriceInput.d.ts.map +1 -0
- package/dist/ui/PriceInput/PriceInput.js +16 -0
- package/dist/ui/PriceInput/PriceInput.stories.d.ts +51 -0
- package/dist/ui/PriceInput/PriceInput.stories.d.ts.map +1 -0
- package/dist/ui/PriceInput/PriceInput.stories.js +19 -0
- package/dist/ui/PriceInput/PriceInput.stories.sources.d.ts +6 -0
- package/dist/ui/PriceInput/PriceInput.stories.sources.d.ts.map +1 -0
- package/dist/ui/PriceInput/PriceInput.stories.sources.js +6 -0
- package/dist/ui/PriceInput/PriceInput.styles.d.ts +36 -0
- package/dist/ui/PriceInput/PriceInput.styles.d.ts.map +1 -0
- package/dist/ui/PriceInput/PriceInput.styles.js +32 -0
- package/dist/ui/PriceInput/PriceInput.web.d.ts +8 -0
- package/dist/ui/PriceInput/PriceInput.web.d.ts.map +1 -0
- package/dist/ui/PriceInput/PriceInput.web.js +21 -0
- package/dist/ui/PriceInput/index.d.ts +2 -0
- package/dist/ui/PriceInput/index.d.ts.map +1 -0
- package/dist/ui/PriceInput/index.js +1 -0
- package/dist/ui/ProgressBar/ProgressBar.stories.d.ts +13 -13
- package/dist/ui/ProgressBar/ProgressBar.styles.d.ts +13 -13
- package/dist/ui/ProgressBar/ProgressBarDeterminate.js +1 -1
- package/dist/ui/ProgressBar/ProgressBarIndeterminate.js +1 -1
- package/dist/ui/ProgressBar/ProgressBarLoop.js +1 -1
- package/dist/ui/RadioGroup/RadioGroup.d.ts +21 -0
- package/dist/ui/RadioGroup/RadioGroup.d.ts.map +1 -0
- package/dist/ui/RadioGroup/RadioGroup.js +11 -0
- package/dist/ui/RadioGroup/RadioGroup.stories.d.ts +164 -0
- package/dist/ui/RadioGroup/RadioGroup.stories.d.ts.map +1 -0
- package/dist/ui/RadioGroup/RadioGroup.stories.js +23 -0
- package/dist/ui/RadioGroup/RadioGroup.stories.sources.d.ts +10 -0
- package/dist/ui/RadioGroup/RadioGroup.stories.sources.d.ts.map +1 -0
- package/dist/ui/RadioGroup/RadioGroup.stories.sources.js +10 -0
- package/dist/ui/RadioGroup/RadioGroup.styles.d.ts +140 -0
- package/dist/ui/RadioGroup/RadioGroup.styles.d.ts.map +1 -0
- package/dist/ui/RadioGroup/RadioGroup.styles.js +129 -0
- package/dist/ui/RadioGroup/RadioGroupCard.d.ts +12 -0
- package/dist/ui/RadioGroup/RadioGroupCard.d.ts.map +1 -0
- package/dist/ui/RadioGroup/RadioGroupCard.js +15 -0
- package/dist/ui/RadioGroup/RadioGroupContext.d.ts +8 -0
- package/dist/ui/RadioGroup/RadioGroupContext.d.ts.map +1 -0
- package/dist/ui/RadioGroup/RadioGroupContext.js +3 -0
- package/dist/ui/RadioGroup/RadioGroupItem.d.ts +8 -0
- package/dist/ui/RadioGroup/RadioGroupItem.d.ts.map +1 -0
- package/dist/ui/RadioGroup/RadioGroupItem.js +13 -0
- package/dist/ui/RadioGroup/RadioGroupItem.styles.d.ts +24 -0
- package/dist/ui/RadioGroup/RadioGroupItem.styles.d.ts.map +1 -0
- package/dist/ui/RadioGroup/RadioGroupItem.styles.js +20 -0
- package/dist/ui/RadioGroup/RadioInput.d.ts +7 -0
- package/dist/ui/RadioGroup/RadioInput.d.ts.map +1 -0
- package/dist/ui/RadioGroup/RadioInput.js +13 -0
- package/dist/ui/RadioGroup/index.d.ts +18 -0
- package/dist/ui/RadioGroup/index.d.ts.map +1 -0
- package/dist/ui/RadioGroup/index.js +7 -0
- package/dist/ui/ResourceList/ResourceList.stories.d.ts +3 -3
- package/dist/ui/ResourceList/ResourceList.styles.d.ts +3 -3
- package/dist/ui/Select/NativePicker.d.ts +16 -0
- package/dist/ui/Select/NativePicker.d.ts.map +1 -0
- package/dist/ui/Select/NativePicker.js +20 -0
- package/dist/ui/Select/Select.d.ts +24 -0
- package/dist/ui/Select/Select.d.ts.map +1 -0
- package/dist/ui/Select/Select.js +28 -0
- package/dist/ui/Select/Select.stories.d.ts +80 -0
- package/dist/ui/Select/Select.stories.d.ts.map +1 -0
- package/dist/ui/Select/Select.stories.js +24 -0
- package/dist/ui/Select/Select.stories.sources.d.ts +8 -0
- package/dist/ui/Select/Select.stories.sources.d.ts.map +1 -0
- package/dist/ui/Select/Select.stories.sources.js +8 -0
- package/dist/ui/Select/Select.styles.d.ts +60 -0
- package/dist/ui/Select/Select.styles.d.ts.map +1 -0
- package/dist/ui/Select/Select.styles.js +57 -0
- package/dist/ui/Select/SelectInput.d.ts +11 -0
- package/dist/ui/Select/SelectInput.d.ts.map +1 -0
- package/dist/ui/Select/SelectInput.ios.d.ts +9 -0
- package/dist/ui/Select/SelectInput.ios.d.ts.map +1 -0
- package/dist/ui/Select/SelectInput.ios.js +28 -0
- package/dist/ui/Select/SelectInput.js +6 -0
- package/dist/ui/Select/index.d.ts +7 -0
- package/dist/ui/Select/index.d.ts.map +1 -0
- package/dist/ui/Select/index.js +3 -0
- package/dist/ui/SelectMultiple/SelectMultiple.d.ts +14 -0
- package/dist/ui/SelectMultiple/SelectMultiple.d.ts.map +1 -0
- package/dist/ui/SelectMultiple/SelectMultiple.js +6 -0
- package/dist/ui/SelectMultiple/SelectMultiple.stories.d.ts +77 -0
- package/dist/ui/SelectMultiple/SelectMultiple.stories.d.ts.map +1 -0
- package/dist/ui/SelectMultiple/SelectMultiple.stories.js +25 -0
- package/dist/ui/SelectMultiple/SelectMultiple.stories.sources.d.ts +8 -0
- package/dist/ui/SelectMultiple/SelectMultiple.stories.sources.d.ts.map +1 -0
- package/dist/ui/SelectMultiple/SelectMultiple.stories.sources.js +8 -0
- package/dist/ui/SelectMultiple/SelectMultiple.styles.d.ts +66 -0
- package/dist/ui/SelectMultiple/SelectMultiple.styles.d.ts.map +1 -0
- package/dist/ui/SelectMultiple/SelectMultiple.styles.js +66 -0
- package/dist/ui/SelectMultiple/SelectMultiple.web.d.ts +14 -0
- package/dist/ui/SelectMultiple/SelectMultiple.web.d.ts.map +1 -0
- package/dist/ui/SelectMultiple/SelectMultiple.web.js +49 -0
- package/dist/ui/SelectMultiple/index.d.ts +3 -0
- package/dist/ui/SelectMultiple/index.d.ts.map +1 -0
- package/dist/ui/SelectMultiple/index.js +1 -0
- package/dist/ui/Sidebar/Sidebar.stories.d.ts +21 -21
- package/dist/ui/Sidebar/Sidebar.styles.d.ts +21 -21
- package/dist/ui/Signature/Signature.stories.d.ts +3 -3
- package/dist/ui/Signature/Signature.styles.d.ts +3 -3
- package/dist/ui/Signature/Signature.web.d.ts.map +1 -1
- package/dist/ui/Signature/Signature.web.js +5 -2
- package/dist/ui/Switch/Switch.d.ts +20 -0
- package/dist/ui/Switch/Switch.d.ts.map +1 -0
- package/dist/ui/Switch/Switch.js +42 -0
- package/dist/ui/Switch/Switch.stories.d.ts +73 -0
- package/dist/ui/Switch/Switch.stories.d.ts.map +1 -0
- package/dist/ui/Switch/Switch.stories.js +19 -0
- package/dist/ui/Switch/Switch.stories.sources.d.ts +8 -0
- package/dist/ui/Switch/Switch.stories.sources.d.ts.map +1 -0
- package/dist/ui/Switch/Switch.stories.sources.js +8 -0
- package/dist/ui/Switch/Switch.styles.d.ts +55 -0
- package/dist/ui/Switch/Switch.styles.d.ts.map +1 -0
- package/dist/ui/Switch/Switch.styles.js +51 -0
- package/dist/ui/Switch/index.d.ts +2 -0
- package/dist/ui/Switch/index.d.ts.map +1 -0
- package/dist/ui/Switch/index.js +1 -0
- package/dist/ui/Tabs/Tabs.d.ts.map +1 -1
- package/dist/ui/Tabs/Tabs.js +2 -2
- package/dist/ui/Tabs/Tabs.stories.d.ts +6 -18
- package/dist/ui/Tabs/Tabs.stories.d.ts.map +1 -1
- package/dist/ui/Tabs/Tabs.styles.d.ts +6 -18
- package/dist/ui/Tabs/Tabs.styles.d.ts.map +1 -1
- package/dist/ui/Tabs/Tabs.styles.js +0 -8
- package/dist/ui/Tag/Tag.stories.d.ts +5 -5
- package/dist/ui/Tag/Tag.styles.d.ts +5 -5
- package/dist/ui/TextField/TextField.d.ts +22 -0
- package/dist/ui/TextField/TextField.d.ts.map +1 -0
- package/dist/ui/TextField/TextField.js +14 -0
- package/dist/ui/TextField/TextField.stories.d.ts +29 -0
- package/dist/ui/TextField/TextField.stories.d.ts.map +1 -0
- package/dist/ui/TextField/TextField.stories.js +15 -0
- package/dist/ui/TextField/TextField.stories.sources.d.ts +8 -0
- package/dist/ui/TextField/TextField.stories.sources.d.ts.map +1 -0
- package/dist/ui/TextField/TextField.stories.sources.js +8 -0
- package/dist/ui/TextField/TextField.styles.d.ts +4 -0
- package/dist/ui/TextField/TextField.styles.d.ts.map +1 -0
- package/dist/ui/TextField/TextField.styles.js +4 -0
- package/dist/ui/TextField/index.d.ts +2 -0
- package/dist/ui/TextField/index.d.ts.map +1 -0
- package/dist/ui/TextField/index.js +1 -0
- package/dist/ui/TextInputArray/TextInputArray.d.ts +21 -0
- package/dist/ui/TextInputArray/TextInputArray.d.ts.map +1 -0
- package/dist/ui/TextInputArray/TextInputArray.js +53 -0
- package/dist/ui/TextInputArray/TextInputArray.stories.d.ts +13 -0
- package/dist/ui/TextInputArray/TextInputArray.stories.d.ts.map +1 -0
- package/dist/ui/TextInputArray/TextInputArray.stories.js +24 -0
- package/dist/ui/TextInputArray/TextInputArray.stories.sources.d.ts +8 -0
- package/dist/ui/TextInputArray/TextInputArray.stories.sources.d.ts.map +1 -0
- package/dist/ui/TextInputArray/TextInputArray.stories.sources.js +8 -0
- package/dist/ui/TextInputArray/index.d.ts +2 -0
- package/dist/ui/TextInputArray/index.d.ts.map +1 -0
- package/dist/ui/TextInputArray/index.js +1 -0
- package/dist/ui/TextareaField/TextareaField.d.ts +22 -0
- package/dist/ui/TextareaField/TextareaField.d.ts.map +1 -0
- package/dist/ui/TextareaField/TextareaField.js +8 -0
- package/dist/ui/TextareaField/TextareaField.stories.d.ts +26 -0
- package/dist/ui/TextareaField/TextareaField.stories.d.ts.map +1 -0
- package/dist/ui/TextareaField/TextareaField.stories.js +13 -0
- package/dist/ui/TextareaField/TextareaField.stories.sources.d.ts +6 -0
- package/dist/ui/TextareaField/TextareaField.stories.sources.d.ts.map +1 -0
- package/dist/ui/TextareaField/TextareaField.stories.sources.js +6 -0
- package/dist/ui/TextareaField/index.d.ts +2 -0
- package/dist/ui/TextareaField/index.d.ts.map +1 -0
- package/dist/ui/TextareaField/index.js +1 -0
- package/dist/ui/TextareaInput/TextareaInput.d.ts +25 -0
- package/dist/ui/TextareaInput/TextareaInput.d.ts.map +1 -0
- package/dist/ui/TextareaInput/TextareaInput.js +7 -0
- package/dist/ui/TextareaInput/TextareaInput.stories.d.ts +29 -0
- package/dist/ui/TextareaInput/TextareaInput.stories.d.ts.map +1 -0
- package/dist/ui/TextareaInput/TextareaInput.stories.js +13 -0
- package/dist/ui/TextareaInput/TextareaInput.stories.sources.d.ts +6 -0
- package/dist/ui/TextareaInput/TextareaInput.stories.sources.d.ts.map +1 -0
- package/dist/ui/TextareaInput/TextareaInput.stories.sources.js +6 -0
- package/dist/ui/TextareaInput/index.d.ts +2 -0
- package/dist/ui/TextareaInput/index.d.ts.map +1 -0
- package/dist/ui/TextareaInput/index.js +1 -0
- package/dist/ui/Toast/Toast.d.ts +13 -2
- package/dist/ui/Toast/Toast.d.ts.map +1 -1
- package/dist/ui/Toast/Toast.js +6 -35
- package/dist/ui/Toast/Toast.stories.d.ts +42 -24
- package/dist/ui/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/ui/Toast/Toast.stories.js +12 -3
- package/dist/ui/Toast/Toast.stories.sources.d.ts +16 -0
- package/dist/ui/Toast/Toast.stories.sources.d.ts.map +1 -1
- package/dist/ui/Toast/Toast.stories.sources.js +17 -1
- package/dist/ui/Toast/Toast.styles.d.ts +34 -24
- package/dist/ui/Toast/Toast.styles.d.ts.map +1 -1
- package/dist/ui/Toast/Toast.styles.js +29 -19
- package/dist/ui/Toast/ToastContext.d.ts +1 -1
- package/dist/ui/Toast/ToastContext.d.ts.map +1 -1
- package/dist/ui/Toast/ToastType.d.ts +11 -0
- package/dist/ui/Toast/ToastType.d.ts.map +1 -0
- package/dist/ui/Toast/ToastType.js +46 -0
- package/dist/ui/ToolbarBottomNav/ToolbarBottomNav.stories.d.ts +4 -4
- package/dist/ui/ToolbarBottomNav/ToolbarBottomNav.styles.d.ts +4 -4
- package/dist/ui/ToolbarTop/ToolbarTop.stories.d.ts +3 -3
- package/dist/ui/ToolbarTop/ToolbarTop.styles.d.ts +3 -3
- package/dist/ui/index.d.ts +24 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +24 -0
- package/package.json +37 -26
|
@@ -28,11 +28,8 @@ export const DocumentViewerPDF = (props) => {
|
|
|
28
28
|
}, [onReady]);
|
|
29
29
|
const onPdfLoadedSuccess = React.useCallback((documentPdf, active) => {
|
|
30
30
|
if (!active)
|
|
31
|
-
return
|
|
32
|
-
setPdf(
|
|
33
|
-
void currentPdf?.destroy?.();
|
|
34
|
-
return documentPdf;
|
|
35
|
-
});
|
|
31
|
+
return;
|
|
32
|
+
setPdf(documentPdf);
|
|
36
33
|
onReadyRef.current?.(documentPdf);
|
|
37
34
|
}, []);
|
|
38
35
|
const onPdfLoadedError = (active) => {
|
|
@@ -59,6 +56,7 @@ export const DocumentViewerPDF = (props) => {
|
|
|
59
56
|
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
60
57
|
context.clearRect(0, 0, canvas.width, canvas.height);
|
|
61
58
|
return pagePdf.render({
|
|
59
|
+
canvas,
|
|
62
60
|
canvasContext: context,
|
|
63
61
|
viewport,
|
|
64
62
|
transform: pixelRatio === 1 ? undefined : [pixelRatio, 0, 0, pixelRatio, 0, 0],
|
|
@@ -66,7 +64,7 @@ export const DocumentViewerPDF = (props) => {
|
|
|
66
64
|
}, [rotation, scale, viewerSize.height, viewerSize.width]);
|
|
67
65
|
React.useEffect(() => {
|
|
68
66
|
let isActive = true;
|
|
69
|
-
const loadingTask = pdfjs.getDocument(source);
|
|
67
|
+
const loadingTask = pdfjs.getDocument({ url: source });
|
|
70
68
|
loadingTask.promise
|
|
71
69
|
.then(nextPdf => onPdfLoadedSuccess(nextPdf, isActive))
|
|
72
70
|
.catch(error => {
|
|
@@ -119,7 +117,6 @@ export const DocumentViewerPDF = (props) => {
|
|
|
119
117
|
const y = ((event.clientY - rect.top) / rect.height) * 100;
|
|
120
118
|
setTransformOrigin(`${Math.max(0, Math.min(100, x))}% ${Math.max(0, Math.min(100, y))}%`);
|
|
121
119
|
}, []);
|
|
122
|
-
React.useEffect(() => () => void pdf?.destroy?.(), [pdf]);
|
|
123
120
|
return (_jsx(Box, { tag: "document-viewer-pdf", width: '100%', height: height, onLayout: handleLayout, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onPointerEnter: () => setIsHovered(true), onPointerLeave: () => setIsHovered(false), onPointerMove: handlePointerMove, style: styles.viewerPdfContent, children: _jsx(Box, { width: '100%', height: '100%', p: '1V', style: styles.viewerPdfStage, children: Platform.OS === 'web' && (_jsx(Box, { style: [
|
|
124
121
|
styles.viewerPdfCanvasWrapper,
|
|
125
122
|
{
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FormControlCaptionProps, FormControlFileInputProps, FormControlFileInputValue, FormControlHintProps, LucideIconProps } from '@alveole/components';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type DragAndDropFileValue = FormControlFileInputValue;
|
|
4
|
+
export type DragAndDropFileProps = FormControlHintProps & FormControlCaptionProps & FormControlFileInputProps & {
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: LucideIconProps['name'];
|
|
7
|
+
};
|
|
8
|
+
export declare const DragAndDropFile: (props: DragAndDropFileProps) => React.JSX.Element;
|
|
9
|
+
//# sourceMappingURL=DragAndDropFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragAndDropFile.d.ts","sourceRoot":"","sources":["../../../src/ui/DragAndDropFile/DragAndDropFile.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,uBAAuB,EAEvB,yBAAyB,EACzB,yBAAyB,EAEzB,oBAAoB,EAIpB,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,oBAAoB,GAAG,yBAAyB,CAAC;AAC7D,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,GACrD,uBAAuB,GACvB,yBAAyB,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;CAChC,CAAC;AAEJ,eAAO,MAAM,eAAe,GAAI,OAAO,oBAAoB,sBAqG1D,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, FormControlCaption, FormControlFileInput, FormControlHint, FormControlLabel, Image, LucideIcon, } from '@alveole/components';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Alert } from '../../core/Alert';
|
|
5
|
+
import { useStyles } from './DragAndDropFile.styles';
|
|
6
|
+
export const DragAndDropFile = (props) => {
|
|
7
|
+
const { label, hint, icon, type, error, success, onChange, multiple } = props;
|
|
8
|
+
const styles = useStyles();
|
|
9
|
+
const [forceOpen, setForceOpen] = React.useState(false);
|
|
10
|
+
const onValueChange = value => {
|
|
11
|
+
if (type == null)
|
|
12
|
+
return onChange(value);
|
|
13
|
+
if (multiple && Array.isArray(value)) {
|
|
14
|
+
const invalidFiles = value.filter(file => {
|
|
15
|
+
const mimeType = file?.mimeType;
|
|
16
|
+
const fileName = file?.name;
|
|
17
|
+
if (mimeType == null)
|
|
18
|
+
return true;
|
|
19
|
+
return !((type.includes('image') && mimeType.startsWith('image')) ||
|
|
20
|
+
(type.includes('pdf') && mimeType.endsWith('pdf')) ||
|
|
21
|
+
(type.includes('csv') &&
|
|
22
|
+
(mimeType === 'text/csv' || mimeType === 'application/csv' || fileName?.endsWith('.csv'))));
|
|
23
|
+
});
|
|
24
|
+
if (invalidFiles.length > 0) {
|
|
25
|
+
Alert.alert({
|
|
26
|
+
title: 'Type de fichier incorrect',
|
|
27
|
+
message: `Certains fichiers ne sont pas pris en charge`,
|
|
28
|
+
});
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
return onChange(value);
|
|
32
|
+
}
|
|
33
|
+
const mimeType = value?.mimeType;
|
|
34
|
+
if (mimeType == null)
|
|
35
|
+
return onChange(value);
|
|
36
|
+
const fileName = value?.name;
|
|
37
|
+
if ((type.includes('image') && mimeType.startsWith('image')) ||
|
|
38
|
+
(type.includes('pdf') && mimeType.endsWith('pdf')) ||
|
|
39
|
+
(type.includes('csv') &&
|
|
40
|
+
(mimeType === 'text/csv' || mimeType === 'application/csv' || fileName?.endsWith('.csv'))))
|
|
41
|
+
return onChange(value);
|
|
42
|
+
else {
|
|
43
|
+
Alert.alert({
|
|
44
|
+
title: 'Type de fichier incorrect',
|
|
45
|
+
message: `Le format du fichier n'est pas pris en charge`,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return (_jsxs(Box, { tag: "drag-and-drop-file", style: styles.container, display: "flex", flexDirection: "row", justify: "space-between", onPress: () => setForceOpen(true), children: [_jsxs(Box, { children: [_jsxs(Box, { tag: "drag-and-drop-file-icon", display: "flex", flexDirection: "row", justify: "center", gap: '050', children: [_jsx(LucideIcon, { size: "md", name: icon ?? 'Upload' }), _jsx(Box, { mt: 'auto', mb: 'auto', children: _jsx(FormControlLabel, { label: label }) })] }), _jsx(Box, { tag: "drag-and-drop-file-hint", display: "flex", flexDirection: "row", justify: "center", children: hint && _jsx(FormControlHint, { hint: hint }) }), _jsx(Box, { tag: "drag-and-drop-file-input", children: _jsx(FormControlFileInput, { ...props, hideButton: true, hideFilename: true, canChange: false, onChange: onValueChange, reopen: forceOpen, onPickStart: () => setForceOpen(false), type: type, multiple: multiple }) }), (error || success) && (_jsx(Box, { tag: "drag-and-drop-file-error", mt: '075', display: "flex", flexDirection: "row", justify: "center", children: _jsx(Box, { p: 16, children: _jsx(FormControlCaption, { ...props }) }) }))] }), _jsx(Box, { children: props.previewURL && _jsx(Image, { source: { uri: props.previewURL }, height: 40, width: 30, contentFit: "cover" }) })] }));
|
|
50
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
title: string;
|
|
3
|
+
tags: "ui"[];
|
|
4
|
+
experimental: false;
|
|
5
|
+
webOnly: true;
|
|
6
|
+
description: string;
|
|
7
|
+
component: (props: import("./DragAndDropFile").DragAndDropFileProps) => import("react").JSX.Element;
|
|
8
|
+
styleFn: () => {
|
|
9
|
+
container: {
|
|
10
|
+
borderWidth: number;
|
|
11
|
+
borderStyle: "dashed";
|
|
12
|
+
borderColor: string;
|
|
13
|
+
padding: import("@alveole/theme").Spacing;
|
|
14
|
+
borderRadius: number;
|
|
15
|
+
backgroundColor: string;
|
|
16
|
+
cursor: "pointer";
|
|
17
|
+
};
|
|
18
|
+
containerHover: {
|
|
19
|
+
borderStyle: "solid";
|
|
20
|
+
borderColor: string;
|
|
21
|
+
backgroundColor: string;
|
|
22
|
+
};
|
|
23
|
+
containerMouseHover: {
|
|
24
|
+
borderStyle: "dashed";
|
|
25
|
+
borderColor: string;
|
|
26
|
+
backgroundColor: string;
|
|
27
|
+
};
|
|
28
|
+
containerError: {
|
|
29
|
+
borderStyle: "dashed";
|
|
30
|
+
borderColor: string;
|
|
31
|
+
backgroundColor: string;
|
|
32
|
+
};
|
|
33
|
+
webError: {
|
|
34
|
+
width: "100%";
|
|
35
|
+
alignItems: "center";
|
|
36
|
+
};
|
|
37
|
+
icon: {
|
|
38
|
+
color: string;
|
|
39
|
+
backgroundColor: string;
|
|
40
|
+
padding: import("@alveole/theme").Spacing;
|
|
41
|
+
borderRadius: number;
|
|
42
|
+
width: import("@alveole/theme").Spacing;
|
|
43
|
+
height: import("@alveole/theme").Spacing;
|
|
44
|
+
marginBottom: import("@alveole/theme").Spacing;
|
|
45
|
+
};
|
|
46
|
+
filesListContainer: {
|
|
47
|
+
marginTop: import("@alveole/theme").Spacing;
|
|
48
|
+
};
|
|
49
|
+
filesListHeader: {
|
|
50
|
+
display: "flex";
|
|
51
|
+
flexDirection: "row";
|
|
52
|
+
justifyContent: "space-between";
|
|
53
|
+
alignItems: "center";
|
|
54
|
+
marginBottom: import("@alveole/theme").Spacing;
|
|
55
|
+
};
|
|
56
|
+
filesListTitle: {
|
|
57
|
+
fontWeight: "bold";
|
|
58
|
+
};
|
|
59
|
+
filesListBox: {
|
|
60
|
+
borderWidth: number;
|
|
61
|
+
borderColor: string;
|
|
62
|
+
borderRadius: number;
|
|
63
|
+
padding: import("@alveole/theme").Spacing;
|
|
64
|
+
backgroundColor: string;
|
|
65
|
+
};
|
|
66
|
+
fileItemContainer: {
|
|
67
|
+
display: "flex";
|
|
68
|
+
flexDirection: "row";
|
|
69
|
+
alignItems: "center";
|
|
70
|
+
gap: import("@alveole/theme").Spacing;
|
|
71
|
+
padding: import("@alveole/theme").Spacing;
|
|
72
|
+
marginBottom: import("@alveole/theme").Spacing;
|
|
73
|
+
backgroundColor: string;
|
|
74
|
+
borderRadius: number;
|
|
75
|
+
};
|
|
76
|
+
fileItemContainerLast: {
|
|
77
|
+
marginBottom: number;
|
|
78
|
+
};
|
|
79
|
+
fileIcon: {
|
|
80
|
+
color: string;
|
|
81
|
+
};
|
|
82
|
+
fileInfo: {
|
|
83
|
+
flex: number;
|
|
84
|
+
display: "flex";
|
|
85
|
+
flexDirection: "column";
|
|
86
|
+
gap: import("@alveole/theme").Spacing;
|
|
87
|
+
};
|
|
88
|
+
fileName: {
|
|
89
|
+
fontWeight: "bold";
|
|
90
|
+
};
|
|
91
|
+
fileSize: {
|
|
92
|
+
fontSize: number;
|
|
93
|
+
color: string;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export default _default;
|
|
98
|
+
export declare const Default: () => import("react").JSX.Element;
|
|
99
|
+
export declare const Multiple: () => import("react").JSX.Element;
|
|
100
|
+
export declare const WithError: () => import("react").JSX.Element;
|
|
101
|
+
export * as Sources from './DragAndDropFile.stories.sources';
|
|
102
|
+
//# sourceMappingURL=DragAndDropFile.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragAndDropFile.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/DragAndDropFile/DragAndDropFile.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wBAQkB;AAElB,eAAO,MAAM,OAAO,mCAKnB,CAAC;AAEF,eAAO,MAAM,QAAQ,mCAEpB,CAAC;AAEF,eAAO,MAAM,SAAS,mCAErB,CAAC;AAEF,OAAO,KAAK,OAAO,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '../../core';
|
|
3
|
+
import { DragAndDropFile } from './DragAndDropFile';
|
|
4
|
+
import { useStyles } from './DragAndDropFile.styles';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'DragAndDropFile',
|
|
7
|
+
tags: ['ui'],
|
|
8
|
+
experimental: false,
|
|
9
|
+
webOnly: true,
|
|
10
|
+
description: 'Zone de dépôt de fichiers par glisser-déposer ou clic.',
|
|
11
|
+
component: DragAndDropFile,
|
|
12
|
+
styleFn: useStyles,
|
|
13
|
+
};
|
|
14
|
+
export const Default = () => (_jsxs(Box, { display: "flex", flexDirection: "column", gap: 24, children: [_jsx(DragAndDropFile, { label: "Document", value: null, onChange: () => { } }), _jsx(DragAndDropFile, { label: "Image uniquement", type: "image/*", value: null, onChange: () => { } })] }));
|
|
15
|
+
export const Multiple = () => (_jsx(DragAndDropFile, { label: "Documents (plusieurs)", multiple: true, value: null, onChange: () => { } }));
|
|
16
|
+
export const WithError = () => (_jsx(DragAndDropFile, { label: "Document", error: "Format non support\u00E9", value: null, onChange: () => { } }));
|
|
17
|
+
export * as Sources from './DragAndDropFile.stories.sources';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const Default: () => string;
|
|
2
|
+
export declare const Multiple: () => string;
|
|
3
|
+
export declare const WithError: () => string;
|
|
4
|
+
export declare const storySources: {
|
|
5
|
+
readonly Default: () => string;
|
|
6
|
+
readonly Multiple: () => string;
|
|
7
|
+
readonly WithError: () => string;
|
|
8
|
+
};
|
|
9
|
+
export type StorySourceName = keyof typeof storySources;
|
|
10
|
+
//# sourceMappingURL=DragAndDropFile.stories.sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragAndDropFile.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/DragAndDropFile/DragAndDropFile.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAAsS,CAAC;AAE3T,eAAO,MAAM,QAAQ,cAA+I,CAAC;AAErK,eAAO,MAAM,SAAS,cAAwJ,CAAC;AAE/K,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// This file is generated. Do not edit manually.
|
|
2
|
+
// Source: src/ui/DragAndDropFile/DragAndDropFile.stories.tsx
|
|
3
|
+
export const Default = () => "export const Default = () => (\n <Box display=\"flex\" flexDirection=\"column\" gap={24}>\n <DragAndDropFile label=\"Document\" value={null} onChange={() => {}} />\n <DragAndDropFile label=\"Image uniquement\" type=\"image/*\" value={null} onChange={() => {}} />\n </Box>\n);";
|
|
4
|
+
export const Multiple = () => "export const Multiple = () => (\n <DragAndDropFile label=\"Documents (plusieurs)\" multiple value={null} onChange={() => {}} />\n);";
|
|
5
|
+
export const WithError = () => "export const WithError = () => (\n <DragAndDropFile label=\"Document\" error=\"Format non supporté\" value={null} onChange={() => {}} />\n);";
|
|
6
|
+
export const storySources = {
|
|
7
|
+
Default,
|
|
8
|
+
Multiple,
|
|
9
|
+
WithError,
|
|
10
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export declare const useStyles: () => {
|
|
2
|
+
container: {
|
|
3
|
+
borderWidth: number;
|
|
4
|
+
borderStyle: "dashed";
|
|
5
|
+
borderColor: string;
|
|
6
|
+
padding: import("@alveole/theme").Spacing;
|
|
7
|
+
borderRadius: number;
|
|
8
|
+
backgroundColor: string;
|
|
9
|
+
cursor: "pointer";
|
|
10
|
+
};
|
|
11
|
+
containerHover: {
|
|
12
|
+
borderStyle: "solid";
|
|
13
|
+
borderColor: string;
|
|
14
|
+
backgroundColor: string;
|
|
15
|
+
};
|
|
16
|
+
containerMouseHover: {
|
|
17
|
+
borderStyle: "dashed";
|
|
18
|
+
borderColor: string;
|
|
19
|
+
backgroundColor: string;
|
|
20
|
+
};
|
|
21
|
+
containerError: {
|
|
22
|
+
borderStyle: "dashed";
|
|
23
|
+
borderColor: string;
|
|
24
|
+
backgroundColor: string;
|
|
25
|
+
};
|
|
26
|
+
webError: {
|
|
27
|
+
width: "100%";
|
|
28
|
+
alignItems: "center";
|
|
29
|
+
};
|
|
30
|
+
icon: {
|
|
31
|
+
color: string;
|
|
32
|
+
backgroundColor: string;
|
|
33
|
+
padding: import("@alveole/theme").Spacing;
|
|
34
|
+
borderRadius: number;
|
|
35
|
+
width: import("@alveole/theme").Spacing;
|
|
36
|
+
height: import("@alveole/theme").Spacing;
|
|
37
|
+
marginBottom: import("@alveole/theme").Spacing;
|
|
38
|
+
};
|
|
39
|
+
filesListContainer: {
|
|
40
|
+
marginTop: import("@alveole/theme").Spacing;
|
|
41
|
+
};
|
|
42
|
+
filesListHeader: {
|
|
43
|
+
display: "flex";
|
|
44
|
+
flexDirection: "row";
|
|
45
|
+
justifyContent: "space-between";
|
|
46
|
+
alignItems: "center";
|
|
47
|
+
marginBottom: import("@alveole/theme").Spacing;
|
|
48
|
+
};
|
|
49
|
+
filesListTitle: {
|
|
50
|
+
fontWeight: "bold";
|
|
51
|
+
};
|
|
52
|
+
filesListBox: {
|
|
53
|
+
borderWidth: number;
|
|
54
|
+
borderColor: string;
|
|
55
|
+
borderRadius: number;
|
|
56
|
+
padding: import("@alveole/theme").Spacing;
|
|
57
|
+
backgroundColor: string;
|
|
58
|
+
};
|
|
59
|
+
fileItemContainer: {
|
|
60
|
+
display: "flex";
|
|
61
|
+
flexDirection: "row";
|
|
62
|
+
alignItems: "center";
|
|
63
|
+
gap: import("@alveole/theme").Spacing;
|
|
64
|
+
padding: import("@alveole/theme").Spacing;
|
|
65
|
+
marginBottom: import("@alveole/theme").Spacing;
|
|
66
|
+
backgroundColor: string;
|
|
67
|
+
borderRadius: number;
|
|
68
|
+
};
|
|
69
|
+
fileItemContainerLast: {
|
|
70
|
+
marginBottom: number;
|
|
71
|
+
};
|
|
72
|
+
fileIcon: {
|
|
73
|
+
color: string;
|
|
74
|
+
};
|
|
75
|
+
fileInfo: {
|
|
76
|
+
flex: number;
|
|
77
|
+
display: "flex";
|
|
78
|
+
flexDirection: "column";
|
|
79
|
+
gap: import("@alveole/theme").Spacing;
|
|
80
|
+
};
|
|
81
|
+
fileName: {
|
|
82
|
+
fontWeight: "bold";
|
|
83
|
+
};
|
|
84
|
+
fileSize: {
|
|
85
|
+
fontSize: number;
|
|
86
|
+
color: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=DragAndDropFile.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragAndDropFile.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/DragAndDropFile/DragAndDropFile.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuFnB,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { makeStyles } from '@alveole/theme';
|
|
2
|
+
export const useStyles = makeStyles(({ color, spacing }) => ({
|
|
3
|
+
container: {
|
|
4
|
+
borderWidth: 1,
|
|
5
|
+
borderStyle: 'dashed',
|
|
6
|
+
borderColor: color.border['contrast-grey'],
|
|
7
|
+
padding: spacing('200'),
|
|
8
|
+
borderRadius: 8,
|
|
9
|
+
backgroundColor: color.alpha(color.background['alt-grey'], 0.3),
|
|
10
|
+
cursor: 'pointer',
|
|
11
|
+
},
|
|
12
|
+
containerHover: {
|
|
13
|
+
borderStyle: 'solid',
|
|
14
|
+
borderColor: color.border['disabled-grey'],
|
|
15
|
+
backgroundColor: color.alpha(color.background['alt-grey'], 0.25),
|
|
16
|
+
},
|
|
17
|
+
containerMouseHover: {
|
|
18
|
+
borderStyle: 'dashed',
|
|
19
|
+
borderColor: color.border['contrast-grey'],
|
|
20
|
+
backgroundColor: color.alpha(color.background['alt-grey'], 0.75),
|
|
21
|
+
},
|
|
22
|
+
containerError: {
|
|
23
|
+
borderStyle: 'dashed',
|
|
24
|
+
borderColor: color.alpha(color.border['plain-error'], 0.5),
|
|
25
|
+
backgroundColor: color.alpha(color.background['alt-grey'], 0.25),
|
|
26
|
+
},
|
|
27
|
+
webError: {
|
|
28
|
+
width: '100%',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
},
|
|
31
|
+
icon: {
|
|
32
|
+
color: color.text.mention,
|
|
33
|
+
backgroundColor: color.background['alt-grey'],
|
|
34
|
+
padding: spacing('100'),
|
|
35
|
+
borderRadius: 12,
|
|
36
|
+
width: spacing('200'),
|
|
37
|
+
height: spacing('200'),
|
|
38
|
+
marginBottom: spacing('100'),
|
|
39
|
+
},
|
|
40
|
+
filesListContainer: {
|
|
41
|
+
marginTop: spacing('100'),
|
|
42
|
+
},
|
|
43
|
+
filesListHeader: {
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
justifyContent: 'space-between',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
marginBottom: spacing('050'),
|
|
49
|
+
},
|
|
50
|
+
filesListTitle: {
|
|
51
|
+
fontWeight: 'bold',
|
|
52
|
+
},
|
|
53
|
+
filesListBox: {
|
|
54
|
+
borderWidth: 1,
|
|
55
|
+
borderColor: color.border['default-grey'],
|
|
56
|
+
borderRadius: 8,
|
|
57
|
+
padding: spacing('050'),
|
|
58
|
+
backgroundColor: color.background.default,
|
|
59
|
+
},
|
|
60
|
+
fileItemContainer: {
|
|
61
|
+
display: 'flex',
|
|
62
|
+
flexDirection: 'row',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
gap: spacing('050'),
|
|
65
|
+
padding: spacing('050'),
|
|
66
|
+
marginBottom: spacing('025'),
|
|
67
|
+
backgroundColor: color.background['alt-grey'],
|
|
68
|
+
borderRadius: 8,
|
|
69
|
+
},
|
|
70
|
+
fileItemContainerLast: {
|
|
71
|
+
marginBottom: 0,
|
|
72
|
+
},
|
|
73
|
+
fileIcon: {
|
|
74
|
+
color: color.text['default-error'],
|
|
75
|
+
},
|
|
76
|
+
fileInfo: {
|
|
77
|
+
flex: 1,
|
|
78
|
+
display: 'flex',
|
|
79
|
+
flexDirection: 'column',
|
|
80
|
+
gap: spacing('025'),
|
|
81
|
+
},
|
|
82
|
+
fileName: {
|
|
83
|
+
fontWeight: 'bold',
|
|
84
|
+
},
|
|
85
|
+
fileSize: {
|
|
86
|
+
fontSize: 12,
|
|
87
|
+
color: color.text['default-grey'],
|
|
88
|
+
},
|
|
89
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragAndDropFile.web.d.ts","sourceRoot":"","sources":["../../../src/ui/DragAndDropFile/DragAndDropFile.web.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AA8BzD,eAAO,MAAM,eAAe,GAAI,OAAO,oBAAoB,sBAyN1D,CAAC"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, FormControlCaption, FormControlFileInput, FormControlHint, FormControlLabel, LucideIcon, } from '@alveole/components';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Alert } from '../../core/Alert';
|
|
5
|
+
import { useStyles } from './DragAndDropFile.styles';
|
|
6
|
+
function fileMatchesType(file, types) {
|
|
7
|
+
if (!types || types.length === 0)
|
|
8
|
+
return true;
|
|
9
|
+
const mime = file.type || '';
|
|
10
|
+
const wantsImage = types.includes('image');
|
|
11
|
+
const wantsPdf = types.includes('pdf');
|
|
12
|
+
const wantsCsv = types.includes('csv');
|
|
13
|
+
if (wantsImage && mime.startsWith('image/'))
|
|
14
|
+
return true;
|
|
15
|
+
if (wantsPdf && (mime === 'application/pdf' || mime.endsWith('/pdf')))
|
|
16
|
+
return true;
|
|
17
|
+
if (wantsCsv && (mime === 'text/csv' || mime === 'application/csv' || file.name?.endsWith('.csv')))
|
|
18
|
+
return true;
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
function fileToDocumentPickerAsset(file) {
|
|
22
|
+
const uri = URL.createObjectURL(file);
|
|
23
|
+
return {
|
|
24
|
+
uri,
|
|
25
|
+
name: file.name,
|
|
26
|
+
size: file.size,
|
|
27
|
+
mimeType: file.type || 'application/octet-stream',
|
|
28
|
+
file,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function filesToDocumentPickerAssets(files) {
|
|
32
|
+
return files.map(file => fileToDocumentPickerAsset(file));
|
|
33
|
+
}
|
|
34
|
+
export const DragAndDropFile = (props) => {
|
|
35
|
+
const { value, label, hint, icon, type, error, success, onChange, multiple } = props;
|
|
36
|
+
const styles = useStyles();
|
|
37
|
+
const [isOver, setIsOver] = React.useState(false);
|
|
38
|
+
const [isMouthOver, setIsMouthOver] = React.useState(false);
|
|
39
|
+
const [forceOpen, setForceOpen] = React.useState(false);
|
|
40
|
+
const onValueChange = v => {
|
|
41
|
+
if (type == null)
|
|
42
|
+
return onChange(v);
|
|
43
|
+
if (multiple && Array.isArray(v)) {
|
|
44
|
+
const invalidFiles = v.filter(file => {
|
|
45
|
+
const mimeType = file?.mimeType;
|
|
46
|
+
const fileName = file?.name;
|
|
47
|
+
if (mimeType == null)
|
|
48
|
+
return true;
|
|
49
|
+
return !((type.includes('image') && mimeType.startsWith('image')) ||
|
|
50
|
+
(type.includes('pdf') && mimeType.endsWith('pdf')) ||
|
|
51
|
+
(type.includes('csv') &&
|
|
52
|
+
(mimeType === 'text/csv' || mimeType === 'application/csv' || fileName?.endsWith('.csv'))));
|
|
53
|
+
});
|
|
54
|
+
if (invalidFiles.length > 0) {
|
|
55
|
+
Alert.alert({ title: 'Type de fichier incorrect', message: `Certains fichiers ne sont pas pris en charge` });
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
return onChange(v);
|
|
59
|
+
}
|
|
60
|
+
const mimeType = v?.mimeType;
|
|
61
|
+
if (mimeType == null)
|
|
62
|
+
return onChange(v);
|
|
63
|
+
const fileName = v?.name;
|
|
64
|
+
if ((type.includes('image') && mimeType.startsWith('image')) ||
|
|
65
|
+
(type.includes('pdf') && mimeType.endsWith('pdf')) ||
|
|
66
|
+
(type.includes('csv') &&
|
|
67
|
+
(mimeType === 'text/csv' || mimeType === 'application/csv' || fileName?.endsWith('.csv'))))
|
|
68
|
+
return onChange(v);
|
|
69
|
+
Alert.alert({ title: 'Type de fichier incorrect', message: `Le format du fichier n'est pas pris en charge` });
|
|
70
|
+
};
|
|
71
|
+
const emitFile = React.useCallback((file) => {
|
|
72
|
+
if (!fileMatchesType(file, type)) {
|
|
73
|
+
Alert.alert({ title: 'Type de fichier incorrect', message: `Le format du fichier n'est pas pris en charge` });
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const asset = fileToDocumentPickerAsset(file);
|
|
77
|
+
onValueChange?.(asset);
|
|
78
|
+
},
|
|
79
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
80
|
+
[type]);
|
|
81
|
+
const emitFiles = React.useCallback((files) => {
|
|
82
|
+
const validFiles = files.filter(file => fileMatchesType(file, type));
|
|
83
|
+
const invalidFiles = files.filter(file => !fileMatchesType(file, type));
|
|
84
|
+
if (invalidFiles.length > 0) {
|
|
85
|
+
Alert.alert({ title: 'Type de fichier incorrect', message: `Certains fichiers ne sont pas pris en charge` });
|
|
86
|
+
}
|
|
87
|
+
if (validFiles.length > 0) {
|
|
88
|
+
const assets = filesToDocumentPickerAssets(validFiles);
|
|
89
|
+
onValueChange?.(assets);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
93
|
+
[type]);
|
|
94
|
+
const onDrop = React.useCallback((e) => {
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
e.stopPropagation();
|
|
97
|
+
setIsOver(false);
|
|
98
|
+
const dt = e.dataTransfer;
|
|
99
|
+
const files = [];
|
|
100
|
+
if (dt?.items?.length) {
|
|
101
|
+
for (let i = 0; i < dt.items.length; i++) {
|
|
102
|
+
const it = dt.items[i];
|
|
103
|
+
if (it.kind === 'file') {
|
|
104
|
+
const f = it.getAsFile();
|
|
105
|
+
if (f)
|
|
106
|
+
files.push(f);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else if (dt?.files?.length) {
|
|
111
|
+
for (let i = 0; i < dt.files.length; i++) {
|
|
112
|
+
const f = dt.files[i];
|
|
113
|
+
if (f)
|
|
114
|
+
files.push(f);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (files.length > 0) {
|
|
118
|
+
if (multiple)
|
|
119
|
+
emitFiles(files);
|
|
120
|
+
else
|
|
121
|
+
emitFile(files[0]);
|
|
122
|
+
}
|
|
123
|
+
}, [emitFile, emitFiles, multiple]);
|
|
124
|
+
const onDragOver = React.useCallback((e) => {
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
if (!isOver)
|
|
127
|
+
setIsOver(true);
|
|
128
|
+
}, [isOver]);
|
|
129
|
+
const onDragLeave = React.useCallback((e) => {
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
if (isOver)
|
|
132
|
+
setIsOver(false);
|
|
133
|
+
}, [isOver]);
|
|
134
|
+
const onMouseOver = React.useCallback((e) => {
|
|
135
|
+
e.preventDefault();
|
|
136
|
+
if (!isMouthOver)
|
|
137
|
+
setIsMouthOver(true);
|
|
138
|
+
}, [isMouthOver]);
|
|
139
|
+
const onMouseLeave = React.useCallback((e) => {
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
if (isMouthOver)
|
|
142
|
+
setIsMouthOver(false);
|
|
143
|
+
}, [isMouthOver]);
|
|
144
|
+
React.useEffect(() => {
|
|
145
|
+
return () => {
|
|
146
|
+
if (Array.isArray(value)) {
|
|
147
|
+
value.forEach(file => {
|
|
148
|
+
const uri = file?.uri;
|
|
149
|
+
if (uri?.startsWith('blob:'))
|
|
150
|
+
try {
|
|
151
|
+
URL.revokeObjectURL(uri);
|
|
152
|
+
}
|
|
153
|
+
catch { }
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
const uri = value?.uri;
|
|
158
|
+
if (uri?.startsWith('blob:'))
|
|
159
|
+
try {
|
|
160
|
+
URL.revokeObjectURL(uri);
|
|
161
|
+
}
|
|
162
|
+
catch { }
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}, [value]);
|
|
166
|
+
const styleContainer = React.useMemo(() => ({
|
|
167
|
+
...styles.container,
|
|
168
|
+
...(isMouthOver ? styles.containerMouseHover : {}),
|
|
169
|
+
...(isOver ? styles.containerHover : {}),
|
|
170
|
+
...(error ? styles.containerError : {}),
|
|
171
|
+
}),
|
|
172
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
173
|
+
[error, isMouthOver, isOver]);
|
|
174
|
+
return (_jsxs("div", { tabIndex: 0, onDrop: onDrop, onDragOver: onDragOver, onDragEnter: onDragOver, onDragLeave: onDragLeave, onMouseOver: onMouseOver, onMouseEnter: onMouseOver, onMouseLeave: onMouseLeave, onClick: () => setForceOpen(true), style: styleContainer, children: [_jsx(Box, { tag: "drag-and-drop-file-icon", display: "flex", flexDirection: "row", justify: "center", children: _jsx(LucideIcon, { size: "xl", name: icon ?? 'Upload', style: styles.icon }) }), _jsx(Box, { tag: "drag-and-drop-file-label", display: "flex", flexDirection: "row", justify: "center", children: _jsx(FormControlLabel, { label: label }) }), _jsx(Box, { tag: "drag-and-drop-file-hint", display: "flex", flexDirection: "row", justify: "center", children: hint && _jsx(FormControlHint, { hint: hint }) }), _jsx(Box, { tag: "drag-and-drop-file-input", display: "flex", flexDirection: "row", justify: "center", children: _jsx(Box, { pt: 16, children: _jsx(FormControlFileInput, { ...props, canChange: false, onChange: onValueChange, reopen: forceOpen, onPickStart: () => setForceOpen(false), multiple: multiple, type: type }) }) }), (error || success) && (_jsx(Box, { tag: "drag-and-drop-file-error", style: styles.webError, children: _jsx(FormControlCaption, { ...props }) }))] }));
|
|
175
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/DragAndDropFile/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DragAndDropFile';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FormControlCaptionProps, FormControlHintProps, FormControlLabelProps, TextInputProps } from '@alveole/components';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type EmailFieldProps = TextInputProps & FormControlLabelProps & FormControlHintProps & FormControlCaptionProps & {
|
|
4
|
+
onChange?: TextInputProps['onChangeText'];
|
|
5
|
+
};
|
|
6
|
+
export declare const EmailField: React.ForwardRefExoticComponent<Omit<import("react-native").TextInputProps, "style"> & {
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
startAdornment?: React.ReactNode;
|
|
9
|
+
endAdornment?: React.ReactNode;
|
|
10
|
+
openModal?: boolean;
|
|
11
|
+
modalSubmitLabel?: string;
|
|
12
|
+
onModalSubmit?: () => void;
|
|
13
|
+
} & {
|
|
14
|
+
label: string;
|
|
15
|
+
labelRight?: React.ReactNode;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
} & FormControlCaptionProps & FormControlHintProps & {
|
|
18
|
+
onChange?: TextInputProps["onChangeText"];
|
|
19
|
+
} & React.RefAttributes<import("react-native").TextInput>>;
|
|
20
|
+
//# sourceMappingURL=EmailField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmailField.d.ts","sourceRoot":"","sources":["../../../src/ui/EmailField/EmailField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,uBAAuB,EAEvB,oBAAoB,EAEpB,qBAAqB,EAGrB,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,MAAM,eAAe,GAAG,cAAc,GAC1C,qBAAqB,GACrB,oBAAoB,GACpB,uBAAuB,GAAG;IACxB,QAAQ,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CAC3C,CAAC;AAEJ,eAAO,MAAM,UAAU;;;;;;;;;;;;eAHR,cAAc,CAAC,cAAc,CAAC;0DAoB3C,CAAC"}
|