@onesy/ui-react 1.0.130 → 1.0.132
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/Accordion/Accordion.d.ts +2 -2
- package/Accordion/Accordion.js +342 -242
- package/Accordion/index.js +12 -7
- package/AdvancedTextField/AdvancedTextField.d.ts +1 -1
- package/AdvancedTextField/AdvancedTextField.js +165 -157
- package/AdvancedTextField/index.js +12 -7
- package/Append/Append.d.ts +3 -3
- package/Append/Append.js +502 -519
- package/Append/index.js +12 -7
- package/AreaChart/AreaChart.d.ts +1 -1
- package/AreaChart/AreaChart.js +53 -40
- package/AreaChart/index.js +12 -7
- package/AreaChartItem/AreaChartItem.d.ts +1 -1
- package/AreaChartItem/AreaChartItem.js +325 -237
- package/AreaChartItem/index.js +12 -7
- package/AudioPlayer/AudioPlayer.d.ts +1 -1
- package/AudioPlayer/AudioPlayer.js +683 -466
- package/AudioPlayer/index.js +12 -7
- package/AudioRecorder/AudioRecorder.d.ts +1 -1
- package/AudioRecorder/AudioRecorder.js +359 -259
- package/AudioRecorder/index.js +12 -7
- package/AutoComplete/AutoComplete.d.ts +3 -3
- package/AutoComplete/AutoComplete.js +693 -568
- package/AutoComplete/index.js +12 -7
- package/AutoCompleteCountry/AutoCompleteCountry.d.ts +1 -1
- package/AutoCompleteCountry/AutoCompleteCountry.js +99 -62
- package/AutoCompleteCountry/index.js +12 -7
- package/AutoCompleteCurrency/AutoCompleteCurrency.d.ts +1 -1
- package/AutoCompleteCurrency/AutoCompleteCurrency.js +73 -61
- package/AutoCompleteCurrency/index.js +12 -7
- package/Avatar/Avatar.d.ts +1 -1
- package/Avatar/Avatar.js +113 -86
- package/Avatar/index.js +12 -7
- package/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/AvatarGroup/AvatarGroup.js +104 -87
- package/AvatarGroup/index.js +12 -7
- package/Backdrop/Backdrop.d.ts +1 -1
- package/Backdrop/Backdrop.js +160 -139
- package/Backdrop/index.js +12 -7
- package/Badge/Badge.d.ts +1 -1
- package/Badge/Badge.js +116 -96
- package/Badge/index.js +12 -7
- package/Banner/Banner.d.ts +1 -1
- package/Banner/Banner.js +126 -85
- package/Banner/index.js +12 -7
- package/BottomAppBar/BottomAppBar.d.ts +1 -1
- package/BottomAppBar/BottomAppBar.js +89 -60
- package/BottomAppBar/index.js +12 -7
- package/BottomSheet/BottomSheet.d.ts +1 -1
- package/BottomSheet/BottomSheet.js +66 -59
- package/BottomSheet/index.js +12 -7
- package/Box/Box.d.ts +1 -1
- package/Box/Box.js +43 -35
- package/Box/index.js +12 -7
- package/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/Breadcrumbs/Breadcrumbs.js +168 -144
- package/Breadcrumbs/index.js +12 -7
- package/BubbleChart/BubbleChart.d.ts +1 -1
- package/BubbleChart/BubbleChart.js +261 -132
- package/BubbleChart/index.js +12 -7
- package/BubbleChartItem/BubbleChartItem.d.ts +1 -1
- package/BubbleChartItem/BubbleChartItem.js +228 -161
- package/BubbleChartItem/index.js +12 -7
- package/Button/Button.d.ts +1 -1
- package/Button/Button.js +488 -467
- package/Button/index.js +12 -7
- package/Buttons/Buttons.d.ts +1 -1
- package/Buttons/Buttons.js +343 -294
- package/Buttons/index.js +12 -7
- package/Calendar/Calendar.d.ts +3 -3
- package/Calendar/Calendar.js +715 -452
- package/Calendar/index.js +12 -7
- package/CalendarAvailability/CalendarAvailability.d.ts +2 -2
- package/CalendarAvailability/CalendarAvailability.js +709 -388
- package/CalendarAvailability/index.js +12 -7
- package/CalendarMenu/CalendarMenu.d.ts +1 -1
- package/CalendarMenu/CalendarMenu.js +430 -303
- package/CalendarMenu/index.js +12 -7
- package/CalendarMonth/CalendarMonth.d.ts +5 -5
- package/CalendarMonth/CalendarMonth.js +537 -498
- package/CalendarMonth/index.js +12 -7
- package/CalendarViews/CalendarViews.d.ts +2 -2
- package/CalendarViews/CalendarViews.js +403 -254
- package/CalendarViews/index.js +12 -7
- package/CalendarWeek/CalendarWeek.d.ts +1 -1
- package/CalendarWeek/CalendarWeek.js +536 -395
- package/CalendarWeek/index.js +12 -7
- package/Card/Card.d.ts +1 -1
- package/Card/Card.js +133 -101
- package/Card/index.js +12 -7
- package/CardButton/CardButton.d.ts +1 -1
- package/CardButton/CardButton.js +78 -58
- package/CardButton/index.js +12 -7
- package/CardFooter/CardFooter.d.ts +1 -1
- package/CardFooter/CardFooter.js +58 -39
- package/CardFooter/index.js +12 -7
- package/CardHeader/CardHeader.d.ts +1 -1
- package/CardHeader/CardHeader.js +61 -44
- package/CardHeader/index.js +12 -7
- package/CardImage/CardImage.d.ts +1 -1
- package/CardImage/CardImage.js +80 -67
- package/CardImage/index.js +12 -7
- package/CardMain/CardMain.d.ts +1 -1
- package/CardMain/CardMain.js +53 -39
- package/CardMain/index.js +12 -7
- package/Carousel/Carousel.d.ts +4 -4
- package/Carousel/Carousel.js +1025 -913
- package/Carousel/index.js +12 -7
- package/Chart/Chart.d.ts +4 -4
- package/Chart/Chart.js +1325 -1174
- package/Chart/index.js +12 -7
- package/Checkbox/Checkbox.d.ts +1 -1
- package/Checkbox/Checkbox.js +339 -325
- package/Checkbox/index.js +12 -7
- package/Chip/Chip.d.ts +1 -1
- package/Chip/Chip.js +131 -102
- package/Chip/index.js +12 -7
- package/Chips/Chips.d.ts +1 -1
- package/Chips/Chips.js +121 -94
- package/Chips/index.js +12 -7
- package/ClickListener/ClickListener.d.ts +1 -1
- package/ClickListener/ClickListener.js +86 -89
- package/ClickListener/index.js +12 -7
- package/Clock/Clock.d.ts +5 -5
- package/Clock/Clock.js +470 -417
- package/Clock/index.js +12 -7
- package/ColorTextField/ColorTextField.d.ts +1 -1
- package/ColorTextField/ColorTextField.js +234 -171
- package/ColorTextField/index.js +12 -7
- package/ColumnChart/ColumnChart.d.ts +1 -1
- package/ColumnChart/ColumnChart.js +63 -46
- package/ColumnChart/index.js +12 -7
- package/ColumnChartItem/ColumnChartItem.d.ts +1 -1
- package/ColumnChartItem/ColumnChartItem.js +208 -149
- package/ColumnChartItem/index.js +12 -7
- package/Confirm/Confirm.d.ts +4 -4
- package/Confirm/Confirm.js +184 -129
- package/Confirm/Context.js +9 -7
- package/Confirm/index.js +32 -13
- package/Confirm/useConfirm.js +11 -10
- package/Container/Container.d.ts +1 -1
- package/Container/Container.js +154 -133
- package/Container/index.js +12 -7
- package/CookieBanner/CookieBanner.d.ts +1 -1
- package/CookieBanner/CookieBanner.js +142 -76
- package/CookieBanner/index.js +12 -7
- package/Countdown/Countdown.d.ts +1 -1
- package/Countdown/Countdown.js +403 -255
- package/Countdown/index.js +12 -7
- package/DatePicker/DatePicker.d.ts +1 -1
- package/DatePicker/DatePicker.js +802 -547
- package/DatePicker/index.js +12 -7
- package/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/DateRangePicker/DateRangePicker.js +44 -37
- package/DateRangePicker/index.js +12 -7
- package/DateTimePicker/DateTimePicker.d.ts +2 -2
- package/DateTimePicker/DateTimePicker.js +672 -459
- package/DateTimePicker/index.js +12 -7
- package/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -1
- package/DateTimeRangePicker/DateTimeRangePicker.js +44 -37
- package/DateTimeRangePicker/index.js +12 -7
- package/Divider/Divider.d.ts +1 -1
- package/Divider/Divider.js +198 -185
- package/Divider/index.js +12 -7
- package/DonutChart/DonutChart.d.ts +1 -1
- package/DonutChart/DonutChart.js +49 -42
- package/DonutChart/index.js +12 -7
- package/DragAndDropList/DragAndDropList.d.ts +1 -1
- package/DragAndDropList/DragAndDropList.js +160 -156
- package/DragAndDropList/index.js +12 -7
- package/Drawing/Drawing.d.ts +2 -2
- package/Drawing/Drawing.js +850 -523
- package/Drawing/index.js +12 -7
- package/DropZone/DropZone.d.ts +1 -1
- package/DropZone/DropZone.js +239 -201
- package/DropZone/index.js +12 -7
- package/Emojis/Emojis.d.ts +3 -3
- package/Emojis/Emojis.js +409 -317
- package/Emojis/emojis_list.js +7279 -9250
- package/Emojis/index.js +19 -9
- package/Expand/Expand.d.ts +1 -1
- package/Expand/Expand.js +201 -149
- package/Expand/index.js +12 -7
- package/Fab/Fab.d.ts +1 -1
- package/Fab/Fab.js +46 -26
- package/Fab/index.js +12 -7
- package/Fade/Fade.d.ts +1 -1
- package/Fade/Fade.js +131 -101
- package/Fade/index.js +12 -7
- package/FileChoose/FileChoose.d.ts +2 -2
- package/FileChoose/FileChoose.js +218 -150
- package/FileChoose/index.js +12 -7
- package/Focus/Focus.d.ts +1 -1
- package/Focus/Focus.js +87 -88
- package/Focus/index.js +12 -7
- package/Form/Form.d.ts +1 -1
- package/Form/Form.js +194 -120
- package/Form/index.js +12 -7
- package/FormRow/FormRow.d.ts +1 -1
- package/FormRow/FormRow.js +123 -78
- package/FormRow/index.js +12 -7
- package/Forms/Forms.d.ts +1 -1
- package/Forms/Forms.js +55 -41
- package/Forms/index.js +12 -7
- package/Frame/Frame.d.ts +1 -1
- package/Frame/Frame.js +212 -150
- package/Frame/index.js +12 -7
- package/Grid/Grid.d.ts +2 -2
- package/Grid/Grid.js +231 -166
- package/Grid/index.js +12 -7
- package/Grow/Grow.d.ts +1 -1
- package/Grow/Grow.js +137 -109
- package/Grow/index.js +12 -7
- package/HTMLCanvas/HTMLCanvas.d.ts +2 -2
- package/HTMLCanvas/HTMLCanvas.js +752 -542
- package/HTMLCanvas/index.js +23 -21
- package/IFrame/IFrame.d.ts +1 -1
- package/IFrame/IFrame.js +122 -104
- package/IFrame/index.js +12 -7
- package/Icon/Icon.d.ts +1 -1
- package/Icon/Icon.js +112 -95
- package/Icon/index.js +23 -21
- package/IconButton/IconButton.d.ts +1 -1
- package/IconButton/IconButton.js +49 -37
- package/IconButton/index.js +12 -7
- package/Image/Image.d.ts +1 -1
- package/Image/Image.js +285 -252
- package/Image/index.js +12 -7
- package/ImageCrop/ImageCrop.d.ts +2 -2
- package/ImageCrop/ImageCrop.js +1073 -1048
- package/ImageCrop/index.js +12 -7
- package/ImageEdit/ImageEdit.d.ts +2 -2
- package/ImageEdit/ImageEdit.js +1088 -783
- package/ImageEdit/index.js +12 -7
- package/ImageGallery/ImageGallery.d.ts +1 -1
- package/ImageGallery/ImageGallery.js +518 -473
- package/ImageGallery/index.js +12 -7
- package/ImageList/ImageList.d.ts +1 -1
- package/ImageList/ImageList.js +136 -129
- package/ImageList/index.js +12 -7
- package/ImageListItem/ImageListItem.d.ts +1 -1
- package/ImageListItem/ImageListItem.js +101 -87
- package/ImageListItem/index.js +12 -7
- package/ImageListItemBox/ImageListItemBox.d.ts +1 -1
- package/ImageListItemBox/ImageListItemBox.js +61 -50
- package/ImageListItemBox/index.js +12 -7
- package/Info/Info.d.ts +1 -1
- package/Info/Info.js +99 -63
- package/Info/index.js +12 -7
- package/Interaction/Interaction.d.ts +2 -2
- package/Interaction/Interaction.js +405 -345
- package/Interaction/index.js +12 -7
- package/Keyframes/Context.js +9 -7
- package/Keyframes/Keyframes.d.ts +3 -3
- package/Keyframes/Keyframes.js +189 -174
- package/Keyframes/index.js +41 -25
- package/Keyframes/useKeyframes.js +11 -10
- package/Label/Label.d.ts +1 -1
- package/Label/Label.js +177 -151
- package/Label/index.js +12 -7
- package/Labels/Labels.d.ts +1 -1
- package/Labels/Labels.js +126 -98
- package/Labels/index.js +12 -7
- package/Line/Line.d.ts +6 -6
- package/Line/Line.js +296 -174
- package/Line/index.js +12 -7
- package/LineChart/LineChart.d.ts +1 -1
- package/LineChart/LineChart.js +57 -40
- package/LineChart/index.js +12 -7
- package/LineChartItem/LineChartItem.d.ts +1 -1
- package/LineChartItem/LineChartItem.js +239 -177
- package/LineChartItem/index.js +12 -7
- package/LinearMeter/LinearMeter.d.ts +1 -1
- package/LinearMeter/LinearMeter.js +453 -377
- package/LinearMeter/index.js +12 -7
- package/LinearProgress/LinearProgress.d.ts +1 -1
- package/LinearProgress/LinearProgress.js +324 -255
- package/LinearProgress/index.js +12 -7
- package/Link/Link.d.ts +1 -1
- package/Link/Link.js +182 -127
- package/Link/index.js +12 -7
- package/Links/Links.d.ts +2 -2
- package/Links/Links.js +277 -156
- package/Links/index.js +12 -7
- package/List/List.d.ts +1 -1
- package/List/List.js +148 -113
- package/List/index.js +12 -7
- package/ListItem/ListItem.d.ts +1 -1
- package/ListItem/ListItem.js +388 -362
- package/ListItem/index.js +12 -7
- package/ListSubheader/ListSubheader.d.ts +1 -1
- package/ListSubheader/ListSubheader.js +52 -44
- package/ListSubheader/index.js +12 -7
- package/MainProgress/Context.js +9 -7
- package/MainProgress/MainProgress.d.ts +3 -3
- package/MainProgress/MainProgress.js +193 -161
- package/MainProgress/index.js +32 -13
- package/MainProgress/useMainProgress.js +11 -10
- package/Markdown/Markdown.d.ts +1 -1
- package/Markdown/Markdown.js +676 -704
- package/Markdown/index.js +12 -7
- package/Masonry/Masonry.d.ts +1 -1
- package/Masonry/Masonry.js +207 -181
- package/Masonry/index.js +12 -7
- package/Medias/Medias.d.ts +3 -3
- package/Medias/Medias.js +436 -398
- package/Medias/index.js +12 -7
- package/Menu/Menu.d.ts +1 -1
- package/Menu/Menu.js +278 -243
- package/Menu/index.js +12 -7
- package/MenuDesktop/MenuDesktop.d.ts +3 -3
- package/MenuDesktop/MenuDesktop.js +496 -419
- package/MenuDesktop/index.js +12 -7
- package/MenuItem/MenuItem.d.ts +1 -1
- package/MenuItem/MenuItem.js +286 -231
- package/MenuItem/index.js +12 -7
- package/Meta/Meta.d.ts +1 -1
- package/Meta/Meta.js +78 -54
- package/Meta/index.js +12 -7
- package/Modal/Modal.d.ts +1 -1
- package/Modal/Modal.js +333 -272
- package/Modal/index.js +12 -7
- package/ModalFooter/ModalFooter.d.ts +1 -1
- package/ModalFooter/ModalFooter.js +50 -39
- package/ModalFooter/index.js +12 -7
- package/ModalHeader/ModalHeader.d.ts +1 -1
- package/ModalHeader/ModalHeader.js +51 -39
- package/ModalHeader/index.js +12 -7
- package/ModalIcon/ModalIcon.d.ts +1 -1
- package/ModalIcon/ModalIcon.js +29 -23
- package/ModalIcon/index.js +12 -7
- package/ModalMain/ModalMain.d.ts +1 -1
- package/ModalMain/ModalMain.js +50 -41
- package/ModalMain/index.js +12 -7
- package/ModalText/ModalText.d.ts +1 -1
- package/ModalText/ModalText.js +47 -37
- package/ModalText/index.js +12 -7
- package/ModalTitle/ModalTitle.d.ts +1 -1
- package/ModalTitle/ModalTitle.js +47 -37
- package/ModalTitle/index.js +12 -7
- package/MoreOptions/MoreOptions.d.ts +1 -1
- package/MoreOptions/MoreOptions.js +72 -52
- package/MoreOptions/index.js +12 -7
- package/Move/Move.d.ts +1 -1
- package/Move/Move.js +166 -141
- package/Move/index.js +12 -7
- package/NavigationBar/NavigationBar.d.ts +2 -2
- package/NavigationBar/NavigationBar.js +133 -109
- package/NavigationBar/index.js +12 -7
- package/NavigationDrawer/NavigationDrawer.d.ts +1 -1
- package/NavigationDrawer/NavigationDrawer.js +241 -211
- package/NavigationDrawer/index.js +12 -7
- package/NavigationItem/NavigationItem.d.ts +2 -2
- package/NavigationItem/NavigationItem.js +293 -262
- package/NavigationItem/index.js +12 -7
- package/NavigationRail/NavigationRail.d.ts +1 -1
- package/NavigationRail/NavigationRail.js +187 -150
- package/NavigationRail/index.js +12 -7
- package/NotFound/NotFound.d.ts +1 -1
- package/NotFound/NotFound.js +89 -66
- package/NotFound/index.js +12 -7
- package/NumericTextField/NumericTextField.d.ts +1 -1
- package/NumericTextField/NumericTextField.js +217 -212
- package/NumericTextField/index.js +12 -7
- package/Page/Page.d.ts +2 -2
- package/Page/Page.js +131 -67
- package/Page/index.js +12 -7
- package/PageTransition/PageTransition.d.ts +1 -1
- package/PageTransition/PageTransition.js +112 -102
- package/PageTransition/index.js +12 -7
- package/Pagination/Pagination.d.ts +1 -1
- package/Pagination/Pagination.js +153 -98
- package/Pagination/index.js +12 -7
- package/PaginationItem/PaginationItem.d.ts +1 -1
- package/PaginationItem/PaginationItem.js +85 -65
- package/PaginationItem/index.js +12 -7
- package/Parallax/Parallax.d.ts +2 -2
- package/Parallax/Parallax.js +138 -145
- package/Parallax/index.js +12 -7
- package/Path/Path.d.ts +1 -1
- package/Path/Path.js +40 -35
- package/Path/index.js +12 -7
- package/PieChart/PieChart.d.ts +1 -1
- package/PieChart/PieChart.js +382 -267
- package/PieChart/index.js +12 -7
- package/Placeholder/Placeholder.d.ts +1 -1
- package/Placeholder/Placeholder.js +125 -117
- package/Placeholder/index.js +12 -7
- package/Portal/Portal.d.ts +1 -1
- package/Portal/Portal.js +37 -38
- package/Portal/index.js +12 -7
- package/Properties/Properties.d.ts +2 -2
- package/Properties/Properties.js +85 -64
- package/Properties/index.js +12 -7
- package/Property/Property.d.ts +1 -1
- package/Property/Property.js +120 -108
- package/Property/index.js +12 -7
- package/Radio/Radio.d.ts +1 -1
- package/Radio/Radio.js +211 -181
- package/Radio/index.js +12 -7
- package/Radios/Radios.d.ts +1 -1
- package/Radios/Radios.js +124 -92
- package/Radios/index.js +12 -7
- package/Rating/Rating.d.ts +1 -1
- package/Rating/Rating.js +353 -360
- package/Rating/index.js +12 -7
- package/Reset/Reset.d.ts +1 -1
- package/Reset/Reset.js +19 -24
- package/Reset/index.js +12 -7
- package/Reveal/Reveal.d.ts +1 -1
- package/Reveal/Reveal.js +98 -89
- package/Reveal/index.js +12 -7
- package/RichTextEditor/RichTextEditor.d.ts +1 -1
- package/RichTextEditor/RichTextEditor.js +1764 -972
- package/RichTextEditor/index.js +12 -7
- package/RoundMeter/RoundMeter.d.ts +1 -1
- package/RoundMeter/RoundMeter.js +629 -537
- package/RoundMeter/index.js +12 -7
- package/RoundProgress/RoundProgress.d.ts +1 -1
- package/RoundProgress/RoundProgress.js +233 -174
- package/RoundProgress/index.js +12 -7
- package/ScatterChart/ScatterChart.d.ts +1 -1
- package/ScatterChart/ScatterChart.js +53 -40
- package/ScatterChart/index.js +12 -7
- package/ScatterChartItem/ScatterChartItem.d.ts +1 -1
- package/ScatterChartItem/ScatterChartItem.js +214 -153
- package/ScatterChartItem/index.js +12 -7
- package/ScreenCapture/ScreenCapture.d.ts +2 -2
- package/ScreenCapture/ScreenCapture.js +427 -335
- package/ScreenCapture/index.js +12 -7
- package/Section/Section.d.ts +2 -2
- package/Section/Section.js +380 -319
- package/Section/index.js +12 -7
- package/SectionAction/SectionAction.d.ts +1 -1
- package/SectionAction/SectionAction.js +72 -61
- package/SectionAction/index.js +12 -7
- package/SectionBoxes/SectionBoxes.d.ts +2 -2
- package/SectionBoxes/SectionBoxes.js +240 -208
- package/SectionBoxes/index.js +12 -7
- package/SectionCards/SectionCards.d.ts +2 -2
- package/SectionCards/SectionCards.js +256 -217
- package/SectionCards/index.js +12 -7
- package/SectionCarousel/SectionCarousel.d.ts +2 -2
- package/SectionCarousel/SectionCarousel.js +284 -242
- package/SectionCarousel/index.js +12 -7
- package/SectionContact/SectionContact.d.ts +1 -1
- package/SectionContact/SectionContact.js +174 -116
- package/SectionContact/index.js +12 -7
- package/SectionImageGallery/SectionImageGallery.d.ts +1 -1
- package/SectionImageGallery/SectionImageGallery.js +64 -51
- package/SectionImageGallery/index.js +12 -7
- package/SectionLogos/SectionLogos.d.ts +1 -1
- package/SectionLogos/SectionLogos.js +123 -109
- package/SectionLogos/index.js +12 -7
- package/SectionMedia/SectionMedia.d.ts +1 -1
- package/SectionMedia/SectionMedia.js +170 -152
- package/SectionMedia/index.js +12 -7
- package/SectionReviews/SectionReviews.d.ts +2 -2
- package/SectionReviews/SectionReviews.js +170 -129
- package/SectionReviews/index.js +12 -7
- package/SectionTextMedia/SectionTextMedia.d.ts +1 -1
- package/SectionTextMedia/SectionTextMedia.js +187 -142
- package/SectionTextMedia/index.js +12 -7
- package/SectionTimeline/SectionTimeline.d.ts +2 -2
- package/SectionTimeline/SectionTimeline.js +126 -95
- package/SectionTimeline/index.js +12 -7
- package/SectionWatch/SectionWatch.d.ts +1 -1
- package/SectionWatch/SectionWatch.js +65 -53
- package/SectionWatch/index.js +12 -7
- package/Select/Select.d.ts +1 -1
- package/Select/Select.js +517 -406
- package/Select/index.js +12 -7
- package/Share/Share.d.ts +1 -1
- package/Share/Share.js +458 -319
- package/Share/index.js +12 -7
- package/Slide/Slide.d.ts +1 -1
- package/Slide/Slide.js +184 -140
- package/Slide/index.js +12 -7
- package/Slider/Slider.d.ts +2 -2
- package/Slider/Slider.js +927 -837
- package/Slider/index.js +12 -7
- package/SmartTextField/SmartTextField.d.ts +1 -1
- package/SmartTextField/SmartTextField.js +1406 -1014
- package/SmartTextField/index.js +12 -7
- package/Snackbar/Snackbar.d.ts +1 -1
- package/Snackbar/Snackbar.js +227 -185
- package/Snackbar/index.js +12 -7
- package/Snackbars/Context.d.ts +1 -1
- package/Snackbars/Context.js +9 -7
- package/Snackbars/Snackbars.d.ts +2 -2
- package/Snackbars/Snackbars.js +234 -210
- package/Snackbars/index.js +32 -13
- package/Snackbars/useSnackbars.js +11 -10
- package/Space/Space.d.ts +1 -1
- package/Space/Space.js +1683 -968
- package/Space/index.js +23 -21
- package/SpeechToText/SpeechToText.d.ts +1 -1
- package/SpeechToText/SpeechToText.js +207 -172
- package/SpeechToText/index.js +12 -7
- package/SpeedDial/SpeedDial.d.ts +1 -1
- package/SpeedDial/SpeedDial.js +434 -398
- package/SpeedDial/index.js +12 -7
- package/SpeedDialItem/SpeedDialItem.d.ts +1 -1
- package/SpeedDialItem/SpeedDialItem.js +89 -63
- package/SpeedDialItem/index.js +12 -7
- package/SpyScroll/SpyScroll.d.ts +1 -1
- package/SpyScroll/SpyScroll.js +154 -142
- package/SpyScroll/index.js +12 -7
- package/Step/Step.d.ts +1 -1
- package/Step/Step.js +181 -127
- package/Step/index.js +12 -7
- package/Stepper/Stepper.d.ts +1 -1
- package/Stepper/Stepper.js +159 -139
- package/Stepper/index.js +12 -7
- package/Surface/Surface.d.ts +1 -1
- package/Surface/Surface.js +760 -798
- package/Surface/index.js +12 -7
- package/Switch/Switch.d.ts +1 -1
- package/Switch/Switch.js +688 -532
- package/Switch/index.js +12 -7
- package/Tab/Tab.d.ts +1 -1
- package/Tab/Tab.js +185 -150
- package/Tab/index.js +12 -7
- package/Table/Table.d.ts +1 -1
- package/Table/Table.js +100 -77
- package/Table/index.js +12 -7
- package/TableBody/TableBody.d.ts +1 -1
- package/TableBody/TableBody.js +76 -63
- package/TableBody/index.js +12 -7
- package/TableCell/TableCell.d.ts +2 -2
- package/TableCell/TableCell.js +258 -220
- package/TableCell/index.js +12 -7
- package/TableFooter/TableFooter.d.ts +1 -1
- package/TableFooter/TableFooter.js +60 -48
- package/TableFooter/index.js +12 -7
- package/TableHead/TableHead.d.ts +1 -1
- package/TableHead/TableHead.js +139 -120
- package/TableHead/index.js +12 -7
- package/TableHeader/TableHeader.d.ts +1 -1
- package/TableHeader/TableHeader.js +65 -50
- package/TableHeader/index.js +12 -7
- package/TablePagination/TablePagination.d.ts +1 -1
- package/TablePagination/TablePagination.js +171 -98
- package/TablePagination/index.js +12 -7
- package/TableRow/TableRow.d.ts +1 -1
- package/TableRow/TableRow.js +77 -64
- package/TableRow/index.js +12 -7
- package/Tabs/Tabs.d.ts +1 -1
- package/Tabs/Tabs.js +425 -377
- package/Tabs/index.js +12 -7
- package/Text/Text.d.ts +1 -1
- package/Text/Text.js +131 -113
- package/Text/index.js +12 -7
- package/TextField/TextField.d.ts +1 -1
- package/TextField/TextField.js +940 -879
- package/TextField/index.js +12 -7
- package/TextToSpeech/TextToSpeech.d.ts +1 -1
- package/TextToSpeech/TextToSpeech.js +176 -153
- package/TextToSpeech/index.js +12 -7
- package/TimePicker/TimePicker.d.ts +3 -3
- package/TimePicker/TimePicker.js +985 -718
- package/TimePicker/index.js +12 -7
- package/TimeRangePicker/TimeRangePicker.d.ts +1 -1
- package/TimeRangePicker/TimeRangePicker.js +44 -37
- package/TimeRangePicker/index.js +12 -7
- package/Timeline/Timeline.d.ts +1 -1
- package/Timeline/Timeline.js +54 -42
- package/Timeline/index.js +12 -7
- package/TimelineItem/TimelineItem.d.ts +1 -1
- package/TimelineItem/TimelineItem.js +144 -147
- package/TimelineItem/index.js +12 -7
- package/Timer/Timer.d.ts +1 -1
- package/Timer/Timer.js +321 -204
- package/Timer/index.js +12 -7
- package/ToggleButton/ToggleButton.d.ts +1 -1
- package/ToggleButton/ToggleButton.js +67 -58
- package/ToggleButton/index.js +12 -7
- package/ToggleButtons/ToggleButtons.d.ts +1 -1
- package/ToggleButtons/ToggleButtons.js +46 -37
- package/ToggleButtons/index.js +12 -7
- package/Tooltip/Tooltip.d.ts +1 -1
- package/Tooltip/Tooltip.js +489 -454
- package/Tooltip/index.js +12 -7
- package/TopAppBar/TopAppBar.d.ts +1 -1
- package/TopAppBar/TopAppBar.js +237 -197
- package/TopAppBar/index.js +12 -7
- package/Transition/Context.js +9 -7
- package/Transition/Transition.d.ts +3 -3
- package/Transition/Transition.js +321 -339
- package/Transition/index.js +41 -25
- package/Transition/useTransition.js +11 -10
- package/Transitions/Transitions.d.ts +2 -2
- package/Transitions/Transitions.js +215 -179
- package/Transitions/index.js +12 -7
- package/Tree/Tree.d.ts +1 -1
- package/Tree/Tree.js +375 -312
- package/Tree/index.js +12 -7
- package/Type/Type.d.ts +1 -1
- package/Type/Type.js +251 -152
- package/Type/index.js +12 -7
- package/VideoPlayer/VideoPlayer.d.ts +1 -1
- package/VideoPlayer/VideoPlayer.js +866 -656
- package/VideoPlayer/index.js +12 -7
- package/ViewSplit/ViewSplit.d.ts +1 -1
- package/ViewSplit/ViewSplit.js +413 -387
- package/ViewSplit/index.js +12 -7
- package/Watch/Watch.d.ts +1 -1
- package/Watch/Watch.js +436 -290
- package/Watch/index.js +12 -7
- package/Weather/Weather.d.ts +4 -4
- package/Weather/Weather.js +294 -247
- package/Weather/index.js +12 -7
- package/Whiteboard/Whiteboard.d.ts +5 -5
- package/Whiteboard/Whiteboard.js +1392 -1292
- package/Whiteboard/index.js +12 -7
- package/Widgets/Context.js +9 -7
- package/Widgets/Widgets.d.ts +2 -2
- package/Widgets/Widgets.js +220 -168
- package/Widgets/index.js +32 -13
- package/Widgets/useWidgets.js +11 -10
- package/WindowSplit/WindowSplit.d.ts +1 -1
- package/WindowSplit/WindowSplit.js +381 -336
- package/WindowSplit/index.js +12 -7
- package/Zoom/Zoom.d.ts +1 -1
- package/Zoom/Zoom.js +126 -99
- package/Zoom/index.js +12 -7
- package/esm/Append/Append.js +6 -8
- package/esm/AutoComplete/AutoComplete.js +8 -20
- package/esm/Breadcrumbs/Breadcrumbs.js +1 -3
- package/esm/Buttons/Buttons.js +8 -33
- package/esm/Calendar/Calendar.js +74 -80
- package/esm/CalendarAvailability/CalendarAvailability.js +1 -2
- package/esm/CalendarMenu/CalendarMenu.js +2 -2
- package/esm/CalendarMonth/CalendarMonth.js +65 -68
- package/esm/CalendarWeek/CalendarWeek.js +3 -7
- package/esm/Carousel/Carousel.js +4 -12
- package/esm/Chart/Chart.js +19 -25
- package/esm/Clock/Clock.js +5 -8
- package/esm/Confirm/Confirm.js +1 -2
- package/esm/DatePicker/DatePicker.js +8 -13
- package/esm/DateTimePicker/DateTimePicker.js +6 -9
- package/esm/Drawing/Drawing.js +1 -6
- package/esm/Expand/Expand.js +1 -2
- package/esm/Fade/Fade.js +1 -2
- package/esm/Focus/Focus.js +1 -2
- package/esm/Grow/Grow.js +1 -2
- package/esm/HTMLCanvas/HTMLCanvas.js +2 -5
- package/esm/ImageCrop/ImageCrop.js +2 -5
- package/esm/ImageEdit/ImageEdit.js +5 -12
- package/esm/ImageGallery/ImageGallery.js +1 -2
- package/esm/Interaction/Interaction.js +1 -2
- package/esm/Keyframes/Keyframes.js +1 -2
- package/esm/LinearMeter/LinearMeter.js +77 -80
- package/esm/Markdown/Markdown.js +41 -144
- package/esm/MenuDesktop/MenuDesktop.js +5 -6
- package/esm/Rating/Rating.js +2 -4
- package/esm/RichTextEditor/RichTextEditor.js +36 -50
- package/esm/RoundMeter/RoundMeter.js +70 -73
- package/esm/ScreenCapture/ScreenCapture.js +2 -5
- package/esm/Select/Select.js +5 -9
- package/esm/Share/Share.js +4 -5
- package/esm/Slide/Slide.js +2 -4
- package/esm/Slider/Slider.js +3 -6
- package/esm/SmartTextField/SmartTextField.js +2 -4
- package/esm/Snackbar/Snackbar.js +1 -2
- package/esm/Snackbars/Snackbars.js +3 -3
- package/esm/Space/Space.js +3 -6
- package/esm/Switch/Switch.js +1 -2
- package/esm/Tabs/Tabs.js +1 -2
- package/esm/TimePicker/TimePicker.js +27 -38
- package/esm/Timer/Timer.js +3 -4
- package/esm/Tooltip/Tooltip.js +1 -2
- package/esm/ViewSplit/ViewSplit.js +1 -2
- package/esm/Watch/Watch.js +4 -5
- package/esm/Weather/Weather.js +14 -17
- package/esm/Whiteboard/Whiteboard.js +1 -4
- package/esm/WindowSplit/WindowSplit.js +1 -2
- package/esm/Zoom/Zoom.js +1 -2
- package/esm/index.js +1 -1
- package/esm/useForm/useForm.js +1 -4
- package/esm/useLocation/useLocation.js +1 -2
- package/esm/useSwipe/useSwipe.js +1 -2
- package/esm/utils.js +3 -11
- package/index.js +4052 -660
- package/package.json +3 -3
- package/types.d.ts +27 -27
- package/types.js +4 -1
- package/useForm/index.js +25 -11
- package/useForm/useForm.d.ts +2 -2
- package/useForm/useForm.js +203 -174
- package/useForm/validate.d.ts +12 -12
- package/useForm/validate.js +215 -203
- package/useLocation/index.js +12 -7
- package/useLocation/useLocation.d.ts +1 -1
- package/useLocation/useLocation.js +54 -49
- package/useMediaQuery/index.js +12 -7
- package/useMediaQuery/useMediaQuery.d.ts +1 -1
- package/useMediaQuery/useMediaQuery.js +44 -43
- package/useQuery/index.js +12 -7
- package/useQuery/useQuery.js +14 -10
- package/useScroll/index.js +12 -7
- package/useScroll/useScroll.d.ts +2 -2
- package/useScroll/useScroll.js +61 -56
- package/useSubscription/index.js +12 -7
- package/useSubscription/useSubscription.js +35 -35
- package/useSwipe/index.js +12 -7
- package/useSwipe/useSwipe.d.ts +2 -2
- package/useSwipe/useSwipe.js +157 -131
- package/useVisible/index.js +12 -7
- package/useVisible/useVisible.d.ts +2 -2
- package/useVisible/useVisible.js +86 -76
- package/utils.js +1224 -1362
package/ImageEdit/ImageEdit.js
CHANGED
|
@@ -1,790 +1,1095 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
optionInput: {
|
|
109
|
-
'& .onesy-TextField-input-wrapper': {
|
|
110
|
-
padding: '0px',
|
|
111
|
-
height: 'auto'
|
|
112
|
-
},
|
|
113
|
-
'& .onesy-TextField-input': {
|
|
114
|
-
textAlign: 'center'
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
filters: {
|
|
118
|
-
width: '100%',
|
|
119
|
-
overflowX: 'auto',
|
|
120
|
-
'& > *': {
|
|
121
|
-
flex: '0 0 auto'
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
action: {
|
|
125
|
-
width: '100%',
|
|
126
|
-
paddingTop: theme.methods.space.value(2, 'px')
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _utils = require("@onesy/utils");
|
|
13
|
+
var _styleReact = require("@onesy/style-react");
|
|
14
|
+
var _IconMaterialDoneW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialDoneW100"));
|
|
15
|
+
var _IconMaterialCloseW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialCloseW100"));
|
|
16
|
+
var _IconMaterialTuneW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialTuneW100"));
|
|
17
|
+
var _IconMaterialCropW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialCropW100"));
|
|
18
|
+
var _IconMaterialAspectRatioW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialAspectRatioW100"));
|
|
19
|
+
var _IconMaterialHighQualityW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialHighQualityW100"));
|
|
20
|
+
var _IconMaterialClearAllW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialClearAllW100"));
|
|
21
|
+
var _IconMaterialDownloadW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialDownloadW100"));
|
|
22
|
+
var _IconMaterialCloudW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialCloudW100"));
|
|
23
|
+
var _IconMaterialWaterDropW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialWaterDropW100"));
|
|
24
|
+
var _IconMaterialFlakyW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialFlakyW100"));
|
|
25
|
+
var _IconMaterialWbSunnyW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialWbSunnyW100"));
|
|
26
|
+
var _IconMaterialTonalityW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialTonalityW100"));
|
|
27
|
+
var _IconMaterialNightlightW = _interopRequireDefault(require("@onesy/icons-material-rounded-react/IconMaterialNightlightW100"));
|
|
28
|
+
var _Type = _interopRequireDefault(require("../Type"));
|
|
29
|
+
var _Surface = _interopRequireDefault(require("../Surface"));
|
|
30
|
+
var _Tooltip = _interopRequireDefault(require("../Tooltip"));
|
|
31
|
+
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
|
32
|
+
var _Expand = _interopRequireDefault(require("../Expand"));
|
|
33
|
+
var _Divider = _interopRequireDefault(require("../Divider"));
|
|
34
|
+
var _Slider = _interopRequireDefault(require("../Slider"));
|
|
35
|
+
var _NumericTextField = _interopRequireDefault(require("../NumericTextField"));
|
|
36
|
+
var _ImageCrop = _interopRequireDefault(require("../ImageCrop"));
|
|
37
|
+
var _Chip = _interopRequireDefault(require("../Chip"));
|
|
38
|
+
var _Line = _interopRequireDefault(require("../Line"));
|
|
39
|
+
var _utils2 = require("../utils");
|
|
40
|
+
const _excluded = ["tonal", "color", "image", "name", "type", "openDefault", "openedOptionDefault", "valueDefault", "value", "valueCopyDefault", "valueCopy", "onChange", "onChangeCopy", "onlyFilters", "filters", "meta", "filtersOption", "cropOption", "resizeOption", "qualityOption", "downloadOption", "resizeAspectRatio", "renderOption", "renderOptionClear", "renderSave", "renderCancel", "renderSlider", "renderDownload", "renderInput", "IconBrightness", "IconContrast", "IconSaturation", "IconFade", "IconInvert", "IconOldPhoto", "IconSave", "IconCancel", "IconClear", "IconCrop", "IconFilters", "IconResize", "IconQuality", "IconDownload", "ChipProps", "SliderProps", "TooltipProps", "ImageCropProps", "IconButtonProps", "className", "children"];
|
|
41
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
42
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
43
|
+
const useStyle = (0, _styleReact.style)(theme => ({
|
|
44
|
+
root: {},
|
|
45
|
+
option: {
|
|
46
|
+
width: '100%',
|
|
47
|
+
padding: `${theme.methods.space.value(2, 'px')} ${theme.methods.space.value(3, 'px')}`
|
|
48
|
+
},
|
|
49
|
+
options: {
|
|
50
|
+
width: '100%',
|
|
51
|
+
overflowX: 'auto',
|
|
52
|
+
padding: `${theme.methods.space.value(2, 'px')} ${theme.methods.space.value(3, 'px')}`
|
|
53
|
+
},
|
|
54
|
+
canvas: {
|
|
55
|
+
width: '100%',
|
|
56
|
+
height: 'auto',
|
|
57
|
+
zIndex: '1'
|
|
58
|
+
},
|
|
59
|
+
inputs: {
|
|
60
|
+
width: '100%'
|
|
61
|
+
},
|
|
62
|
+
divider: {
|
|
63
|
+
'&.onesy-Divider-root': {
|
|
64
|
+
margin: '0px'
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
imageWrapper: {
|
|
68
|
+
position: 'relative',
|
|
69
|
+
height: '400px',
|
|
70
|
+
width: '100%',
|
|
71
|
+
'&::before': {
|
|
72
|
+
content: '""',
|
|
73
|
+
position: 'absolute',
|
|
74
|
+
inset: '0',
|
|
75
|
+
width: '100%',
|
|
76
|
+
height: '100%',
|
|
77
|
+
background: 'currentColor',
|
|
78
|
+
zIndex: '0',
|
|
79
|
+
opacity: '0.94'
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
canvasWrapper: {
|
|
83
|
+
position: 'relative',
|
|
84
|
+
lineHeight: '0'
|
|
85
|
+
},
|
|
86
|
+
image: {
|
|
87
|
+
width: '100%',
|
|
88
|
+
height: 'auto'
|
|
89
|
+
},
|
|
90
|
+
imageCopy: {
|
|
91
|
+
width: '100%',
|
|
92
|
+
height: 'auto'
|
|
93
|
+
},
|
|
94
|
+
imageCrop: {
|
|
95
|
+
position: 'absolute',
|
|
96
|
+
inset: '0',
|
|
97
|
+
width: '100% !important',
|
|
98
|
+
height: '100% !important'
|
|
99
|
+
},
|
|
100
|
+
meta: {
|
|
101
|
+
width: '100%',
|
|
102
|
+
padding: `${theme.methods.space.value(1.5, 'px')} ${theme.methods.space.value(3, 'px')}`
|
|
103
|
+
},
|
|
104
|
+
optionInput: {
|
|
105
|
+
'& .onesy-TextField-input-wrapper': {
|
|
106
|
+
padding: '0px',
|
|
107
|
+
height: 'auto'
|
|
127
108
|
},
|
|
128
|
-
|
|
129
|
-
|
|
109
|
+
'& .onesy-TextField-input': {
|
|
110
|
+
textAlign: 'center'
|
|
130
111
|
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
},
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
}, 140);
|
|
334
|
-
const onFilterSliderChange = (valueNew, valueFilter) => {
|
|
335
|
-
setFilterValuesCopy(values_ => (Object.assign(Object.assign({}, values_), { [valueFilter]: valueNew })));
|
|
336
|
-
};
|
|
337
|
-
const onChangeFilter = (valueNew) => {
|
|
338
|
-
// If moving to another filter or closing current one
|
|
339
|
-
// clean up previous one filter for mainCanvas
|
|
340
|
-
if (filter === valueNew)
|
|
341
|
-
setFilter('');
|
|
342
|
-
else
|
|
343
|
-
setFilter(valueNew);
|
|
344
|
-
};
|
|
345
|
-
const onChangeAspectRatioCustom = (valueNew_, left_ = true) => {
|
|
346
|
-
const valueNew = !valueNew_ ? 1 : valueNew_;
|
|
347
|
-
let left = (aspectRatioCustom === null || aspectRatioCustom === void 0 ? void 0 : aspectRatioCustom[0]) || 1;
|
|
348
|
-
let right = (aspectRatioCustom === null || aspectRatioCustom === void 0 ? void 0 : aspectRatioCustom[1]) || 1;
|
|
349
|
-
left_ ? left = valueNew : right = valueNew;
|
|
350
|
-
setAspectRatioCustom([left, right]);
|
|
351
|
-
onChangeAspectRatio(left / right);
|
|
352
|
-
};
|
|
353
|
-
const onChangeAspectRatio = (valueNew) => {
|
|
354
|
-
if (aspectRatio === valueNew)
|
|
355
|
-
setAspectRatio('');
|
|
356
|
-
else
|
|
357
|
-
setAspectRatio(valueNew);
|
|
358
|
-
};
|
|
359
|
-
const onChangeResize = async (valueNew, width_ = true) => {
|
|
360
|
-
let width;
|
|
361
|
-
let height;
|
|
362
|
-
if (!refs.resizeAspectRatio.current) {
|
|
363
|
-
if (width_) {
|
|
364
|
-
width = +valueNew;
|
|
365
|
-
height = resize === null || resize === void 0 ? void 0 : resize[1];
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
width = resize === null || resize === void 0 ? void 0 : resize[0];
|
|
369
|
-
height = +valueNew;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
else {
|
|
373
|
-
const aspectRatio_ = (value === null || value === void 0 ? void 0 : value.width) / (value === null || value === void 0 ? void 0 : value.height);
|
|
374
|
-
if (width_) {
|
|
375
|
-
width = +valueNew;
|
|
376
|
-
height = valueNew / aspectRatio_;
|
|
377
|
-
}
|
|
378
|
-
else {
|
|
379
|
-
height = +valueNew;
|
|
380
|
-
width = height * aspectRatio_;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
width = (0, utils_1.clamp)(width, 0);
|
|
384
|
-
height = (0, utils_1.clamp)(height, 0);
|
|
385
|
-
setResize([width, height]);
|
|
386
|
-
await updateResize(width, height);
|
|
387
|
-
};
|
|
388
|
-
const updateQuality = (0, utils_1.debounce)(async (valueNew) => {
|
|
389
|
-
var _a, _b;
|
|
390
|
-
const rootDocument = (0, utils_1.isEnvironment)('browser') ? (((_a = refs.root.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) || window.document) : undefined;
|
|
391
|
-
// Update copy value
|
|
392
|
-
const uri = value.toDataURL('image/jpeg', valueNew / 100);
|
|
393
|
-
const img = await (0, utils_2.image)(uri);
|
|
394
|
-
const canvas = rootDocument.createElement('canvas');
|
|
395
|
-
canvas.width = img.width;
|
|
396
|
-
canvas.height = img.height;
|
|
397
|
-
canvas.getContext('2d').drawImage(img, 0, 0, img.width, img.height);
|
|
398
|
-
onChangeCopy(canvas);
|
|
399
|
-
// Update the canvas value
|
|
400
|
-
refs.canvasMain.current.width = canvas.width;
|
|
401
|
-
refs.canvasMain.current.height = canvas.height;
|
|
402
|
-
(_b = refs.canvasMain.current) === null || _b === void 0 ? void 0 : _b.getContext('2d').drawImage(canvas, 0, 0, canvas.width, canvas.height);
|
|
403
|
-
// Update size
|
|
404
|
-
updateSize();
|
|
405
|
-
}, 40);
|
|
406
|
-
const onChangeQuality = async (valueNew) => {
|
|
407
|
-
setQuality(valueNew);
|
|
408
|
-
await updateQuality(valueNew);
|
|
409
|
-
};
|
|
410
|
-
const onChange = (valueNew) => {
|
|
411
|
-
// Update inner or controlled
|
|
412
|
-
if (!props.hasOwnProperty('value'))
|
|
413
|
-
setValue(valueNew);
|
|
414
|
-
if ((0, utils_1.is)('function', onChange_))
|
|
415
|
-
onChange_(valueNew);
|
|
416
|
-
};
|
|
417
|
-
const onChangeCopy = (valueNew) => {
|
|
418
|
-
// Update inner or controlled
|
|
419
|
-
if (!props.hasOwnProperty('valueCopy'))
|
|
420
|
-
setValueCopy(valueNew);
|
|
421
|
-
if ((0, utils_1.is)('function', onChangeCopy_))
|
|
422
|
-
onChangeCopy_(valueNew);
|
|
423
|
-
};
|
|
424
|
-
const onReset = (imageReset = true, valueCopyReset = true, resizeReset = true) => {
|
|
425
|
-
var _a;
|
|
426
|
-
const rootDocument = (0, utils_1.isEnvironment)('browser') ? (((_a = refs.root.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) || window.document) : undefined;
|
|
427
|
-
setOpen(false);
|
|
428
|
-
setQuality(100);
|
|
429
|
-
setAspectRatio('');
|
|
430
|
-
setAspectRatioCustom([1, 1]);
|
|
431
|
-
setSelection('');
|
|
432
|
-
setFilter('');
|
|
433
|
-
setFilterValuesCopy(Object.assign({}, filterValues));
|
|
434
|
-
if (resizeReset)
|
|
435
|
-
setResize([value === null || value === void 0 ? void 0 : value.width, value === null || value === void 0 ? void 0 : value.height]);
|
|
436
|
-
if (valueCopyReset) {
|
|
437
|
-
const canvas = rootDocument.createElement('canvas');
|
|
438
|
-
canvas.width = refs.value.current.width;
|
|
439
|
-
canvas.height = refs.value.current.height;
|
|
440
|
-
canvas.getContext('2d').drawImage(refs.value.current, 0, 0, refs.value.current.width, refs.value.current.height);
|
|
441
|
-
onChangeCopy(canvas);
|
|
442
|
-
}
|
|
443
|
-
if (imageReset) {
|
|
444
|
-
setFilterValues({});
|
|
445
|
-
setFilterValuesCopy({});
|
|
446
|
-
makeImage(image);
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
const openOption = (valueNew) => {
|
|
450
|
-
setOpenedOption(valueNew);
|
|
451
|
-
if (open && openedOption === valueNew) {
|
|
452
|
-
setOpen(false);
|
|
453
|
-
onReset(false);
|
|
454
|
-
}
|
|
455
|
-
else if (!open)
|
|
456
|
-
setOpen(true);
|
|
457
|
-
};
|
|
458
|
-
const onSave = () => {
|
|
459
|
-
var _a, _b;
|
|
460
|
-
const rootDocument = (0, utils_1.isEnvironment)('browser') ? (((_a = refs.root.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) || window.document) : undefined;
|
|
461
|
-
// Make value copy into value
|
|
462
|
-
let canvas = rootDocument.createElement('canvas');
|
|
463
|
-
canvas.width = refs.valueCopy.current.width;
|
|
464
|
-
canvas.height = refs.valueCopy.current.height;
|
|
465
|
-
canvas.getContext('2d').drawImage(refs.valueCopy.current, 0, 0, refs.valueCopy.current.width, refs.valueCopy.current.height);
|
|
466
|
-
// Update crop
|
|
467
|
-
if (openedOption === 'crop' && selection) {
|
|
468
|
-
// Crop the canvas
|
|
469
|
-
canvas.width = selection.width;
|
|
470
|
-
canvas.height = selection.height;
|
|
471
|
-
canvas = (0, utils_1.canvasCrop)(refs.valueCopy.current, selection.left, selection.top, selection.width, selection.height);
|
|
472
|
-
}
|
|
473
|
-
// Update filters
|
|
474
|
-
setFilterValues(Object.assign({}, filterValuesCopy));
|
|
475
|
-
applyAllFilters(canvas);
|
|
476
|
-
// Update the main canvas value
|
|
477
|
-
refs.canvasMain.current.width = canvas.width;
|
|
478
|
-
refs.canvasMain.current.height = canvas.height;
|
|
479
|
-
(_b = refs.canvasMain.current) === null || _b === void 0 ? void 0 : _b.getContext('2d').drawImage(canvas, 0, 0, canvas.width, canvas.height);
|
|
480
|
-
// Update value
|
|
481
|
-
onChange(canvas);
|
|
482
|
-
const canvasCopy = rootDocument.createElement('canvas');
|
|
483
|
-
canvasCopy.width = canvas.width;
|
|
484
|
-
canvasCopy.height = canvas.height;
|
|
485
|
-
canvasCopy.getContext('2d').drawImage(canvas, 0, 0, canvasCopy.width, canvasCopy.height);
|
|
486
|
-
// Update value copy
|
|
487
|
-
onChangeCopy(canvasCopy);
|
|
488
|
-
// Reset
|
|
489
|
-
onReset(false, false, false);
|
|
490
|
-
};
|
|
491
|
-
const onDownload = () => {
|
|
492
|
-
// Download the image from canvas datauri
|
|
493
|
-
// of the image type and quality, name
|
|
494
|
-
const uri = refs.value.current.toDataURL(type);
|
|
495
|
-
(0, utils_1.download)(name, uri, type);
|
|
496
|
-
};
|
|
497
|
-
const onCancel = () => {
|
|
498
|
-
var _a, _b, _c, _d;
|
|
499
|
-
const rootDocument = (0, utils_1.isEnvironment)('browser') ? (((_a = refs.root.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) || window.document) : undefined;
|
|
500
|
-
// Reset to unopen
|
|
501
|
-
onReset(false);
|
|
502
|
-
// Make value copy into value
|
|
503
|
-
const canvas = rootDocument.createElement('canvas');
|
|
504
|
-
canvas.width = refs.value.current.width;
|
|
505
|
-
canvas.height = refs.value.current.height;
|
|
506
|
-
canvas.getContext('2d').drawImage(refs.value.current, 0, 0, refs.value.current.width, refs.value.current.height);
|
|
507
|
-
onChangeCopy(canvas);
|
|
508
|
-
// Update the main canvas value
|
|
509
|
-
refs.canvasMain.current.width = (_b = refs.value.current) === null || _b === void 0 ? void 0 : _b.width;
|
|
510
|
-
refs.canvasMain.current.height = (_c = refs.value.current) === null || _c === void 0 ? void 0 : _c.height;
|
|
511
|
-
(_d = refs.canvasMain.current) === null || _d === void 0 ? void 0 : _d.getContext('2d').drawImage(refs.value.current, 0, 0, refs.value.current.width, refs.value.current.height);
|
|
112
|
+
},
|
|
113
|
+
filters: {
|
|
114
|
+
width: '100%',
|
|
115
|
+
overflowX: 'auto',
|
|
116
|
+
'& > *': {
|
|
117
|
+
flex: '0 0 auto'
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
action: {
|
|
121
|
+
width: '100%',
|
|
122
|
+
paddingTop: theme.methods.space.value(2, 'px')
|
|
123
|
+
},
|
|
124
|
+
slider: {
|
|
125
|
+
width: '100%'
|
|
126
|
+
}
|
|
127
|
+
}), {
|
|
128
|
+
name: 'onesy-ImageEdit'
|
|
129
|
+
});
|
|
130
|
+
const ImageEdit = /*#__PURE__*/_react.default.forwardRef((props_, ref) => {
|
|
131
|
+
var _ref, _ref2;
|
|
132
|
+
const theme = (0, _styleReact.useOnesyTheme)();
|
|
133
|
+
const l = theme.l;
|
|
134
|
+
const props = _react.default.useMemo(() => {
|
|
135
|
+
var _theme$ui, _theme$ui2;
|
|
136
|
+
return _objectSpread(_objectSpread(_objectSpread({}, theme === null || theme === void 0 || (_theme$ui = theme.ui) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.elements) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.all) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.props) === null || _theme$ui === void 0 ? void 0 : _theme$ui.default), theme === null || theme === void 0 || (_theme$ui2 = theme.ui) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.elements) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.onesyImageEdit) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.props) === null || _theme$ui2 === void 0 ? void 0 : _theme$ui2.default), props_);
|
|
137
|
+
}, [props_]);
|
|
138
|
+
const Line = _react.default.useMemo(() => {
|
|
139
|
+
var _theme$elements;
|
|
140
|
+
return (theme === null || theme === void 0 || (_theme$elements = theme.elements) === null || _theme$elements === void 0 ? void 0 : _theme$elements.Line) || _Line.default;
|
|
141
|
+
}, [theme]);
|
|
142
|
+
const Type = _react.default.useMemo(() => {
|
|
143
|
+
var _theme$elements2;
|
|
144
|
+
return (theme === null || theme === void 0 || (_theme$elements2 = theme.elements) === null || _theme$elements2 === void 0 ? void 0 : _theme$elements2.Type) || _Type.default;
|
|
145
|
+
}, [theme]);
|
|
146
|
+
const Surface = _react.default.useMemo(() => {
|
|
147
|
+
var _theme$elements3;
|
|
148
|
+
return (theme === null || theme === void 0 || (_theme$elements3 = theme.elements) === null || _theme$elements3 === void 0 ? void 0 : _theme$elements3.Surface) || _Surface.default;
|
|
149
|
+
}, [theme]);
|
|
150
|
+
const IconButton = _react.default.useMemo(() => {
|
|
151
|
+
var _theme$elements4;
|
|
152
|
+
return (theme === null || theme === void 0 || (_theme$elements4 = theme.elements) === null || _theme$elements4 === void 0 ? void 0 : _theme$elements4.IconButton) || _IconButton.default;
|
|
153
|
+
}, [theme]);
|
|
154
|
+
const Tooltip = _react.default.useMemo(() => {
|
|
155
|
+
var _theme$elements5;
|
|
156
|
+
return (theme === null || theme === void 0 || (_theme$elements5 = theme.elements) === null || _theme$elements5 === void 0 ? void 0 : _theme$elements5.Tooltip) || _Tooltip.default;
|
|
157
|
+
}, [theme]);
|
|
158
|
+
const Expand = _react.default.useMemo(() => {
|
|
159
|
+
var _theme$elements6;
|
|
160
|
+
return (theme === null || theme === void 0 || (_theme$elements6 = theme.elements) === null || _theme$elements6 === void 0 ? void 0 : _theme$elements6.Expand) || _Expand.default;
|
|
161
|
+
}, [theme]);
|
|
162
|
+
const Divider = _react.default.useMemo(() => {
|
|
163
|
+
var _theme$elements7;
|
|
164
|
+
return (theme === null || theme === void 0 || (_theme$elements7 = theme.elements) === null || _theme$elements7 === void 0 ? void 0 : _theme$elements7.Divider) || _Divider.default;
|
|
165
|
+
}, [theme]);
|
|
166
|
+
const Slider = _react.default.useMemo(() => {
|
|
167
|
+
var _theme$elements8;
|
|
168
|
+
return (theme === null || theme === void 0 || (_theme$elements8 = theme.elements) === null || _theme$elements8 === void 0 ? void 0 : _theme$elements8.Slider) || _Slider.default;
|
|
169
|
+
}, [theme]);
|
|
170
|
+
const NumericTextField = _react.default.useMemo(() => {
|
|
171
|
+
var _theme$elements9;
|
|
172
|
+
return (theme === null || theme === void 0 || (_theme$elements9 = theme.elements) === null || _theme$elements9 === void 0 ? void 0 : _theme$elements9.NumericTextField) || _NumericTextField.default;
|
|
173
|
+
}, [theme]);
|
|
174
|
+
const ImageCrop = _react.default.useMemo(() => {
|
|
175
|
+
var _theme$elements0;
|
|
176
|
+
return (theme === null || theme === void 0 || (_theme$elements0 = theme.elements) === null || _theme$elements0 === void 0 ? void 0 : _theme$elements0.ImageCrop) || _ImageCrop.default;
|
|
177
|
+
}, [theme]);
|
|
178
|
+
const Chip = _react.default.useMemo(() => {
|
|
179
|
+
var _theme$elements1;
|
|
180
|
+
return (theme === null || theme === void 0 || (_theme$elements1 = theme.elements) === null || _theme$elements1 === void 0 ? void 0 : _theme$elements1.Chip) || _Chip.default;
|
|
181
|
+
}, [theme]);
|
|
182
|
+
const {
|
|
183
|
+
tonal = true,
|
|
184
|
+
color = 'primary',
|
|
185
|
+
image,
|
|
186
|
+
name = 'onesy-image.jpg',
|
|
187
|
+
type = 'image/jpeg',
|
|
188
|
+
openDefault,
|
|
189
|
+
openedOptionDefault,
|
|
190
|
+
valueDefault,
|
|
191
|
+
value: value_,
|
|
192
|
+
valueCopyDefault,
|
|
193
|
+
valueCopy: valueCopy_,
|
|
194
|
+
onChange: onChange_,
|
|
195
|
+
onChangeCopy: onChangeCopy_,
|
|
196
|
+
onlyFilters,
|
|
197
|
+
filters: filters_,
|
|
198
|
+
meta = true,
|
|
199
|
+
filtersOption = true,
|
|
200
|
+
cropOption = true,
|
|
201
|
+
resizeOption = true,
|
|
202
|
+
qualityOption = true,
|
|
203
|
+
downloadOption = true,
|
|
204
|
+
resizeAspectRatio = true,
|
|
205
|
+
renderOption,
|
|
206
|
+
renderOptionClear,
|
|
207
|
+
renderSave,
|
|
208
|
+
renderCancel,
|
|
209
|
+
renderSlider,
|
|
210
|
+
renderDownload,
|
|
211
|
+
renderInput,
|
|
212
|
+
IconBrightness = _IconMaterialWbSunnyW.default,
|
|
213
|
+
IconContrast = _IconMaterialFlakyW.default,
|
|
214
|
+
IconSaturation = _IconMaterialWaterDropW.default,
|
|
215
|
+
IconFade = _IconMaterialCloudW.default,
|
|
216
|
+
IconInvert = _IconMaterialTonalityW.default,
|
|
217
|
+
IconOldPhoto = _IconMaterialNightlightW.default,
|
|
218
|
+
IconSave = _IconMaterialDoneW.default,
|
|
219
|
+
IconCancel = _IconMaterialCloseW.default,
|
|
220
|
+
IconClear = _IconMaterialClearAllW.default,
|
|
221
|
+
IconCrop = _IconMaterialCropW.default,
|
|
222
|
+
IconFilters = _IconMaterialTuneW.default,
|
|
223
|
+
IconResize = _IconMaterialAspectRatioW.default,
|
|
224
|
+
IconQuality = _IconMaterialHighQualityW.default,
|
|
225
|
+
IconDownload = _IconMaterialDownloadW.default,
|
|
226
|
+
ChipProps: ChipProps_,
|
|
227
|
+
SliderProps: SliderProps_,
|
|
228
|
+
TooltipProps: TooltipProps_,
|
|
229
|
+
ImageCropProps: ImageCropProps_,
|
|
230
|
+
IconButtonProps: IconButtonProps_,
|
|
231
|
+
className,
|
|
232
|
+
children
|
|
233
|
+
} = props,
|
|
234
|
+
other = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
235
|
+
const [init, setInit] = _react.default.useState(false);
|
|
236
|
+
const [value, setValue] = _react.default.useState(valueDefault !== undefined ? valueDefault : value_);
|
|
237
|
+
const [valueCopy, setValueCopy] = _react.default.useState(valueCopyDefault !== undefined ? valueCopyDefault : valueCopy_);
|
|
238
|
+
const [open, setOpen] = _react.default.useState(openDefault);
|
|
239
|
+
const [openedOption, setOpenedOption] = _react.default.useState(openedOptionDefault);
|
|
240
|
+
const [quality, setQuality] = _react.default.useState(100);
|
|
241
|
+
const [filterValues, setFilterValues] = _react.default.useState({});
|
|
242
|
+
const [filterValuesCopy, setFilterValuesCopy] = _react.default.useState({});
|
|
243
|
+
const [filter, setFilter] = _react.default.useState();
|
|
244
|
+
const [resize, setResize] = _react.default.useState();
|
|
245
|
+
const [selection, setSelection] = _react.default.useState();
|
|
246
|
+
const [aspectRatio, setAspectRatio] = _react.default.useState();
|
|
247
|
+
const [aspectRatioCustom, setAspectRatioCustom] = _react.default.useState([1, 1]);
|
|
248
|
+
const [size, setSize] = _react.default.useState('');
|
|
249
|
+
const {
|
|
250
|
+
classes
|
|
251
|
+
} = useStyle();
|
|
252
|
+
const refs = {
|
|
253
|
+
root: _react.default.useRef(null),
|
|
254
|
+
option: _react.default.useRef(null),
|
|
255
|
+
value: _react.default.useRef(null),
|
|
256
|
+
valueCopy: _react.default.useRef(null),
|
|
257
|
+
canvasMain: _react.default.useRef(null),
|
|
258
|
+
open: _react.default.useRef(null),
|
|
259
|
+
resizeAspectRatio: _react.default.useRef(null),
|
|
260
|
+
filterValues: _react.default.useRef(null),
|
|
261
|
+
filterValuesCopy: _react.default.useRef(null)
|
|
262
|
+
};
|
|
263
|
+
refs.value.current = value;
|
|
264
|
+
refs.valueCopy.current = valueCopy;
|
|
265
|
+
refs.open.current = open;
|
|
266
|
+
refs.resizeAspectRatio.current = resizeAspectRatio;
|
|
267
|
+
refs.filterValues.current = filterValues;
|
|
268
|
+
refs.filterValuesCopy.current = filterValuesCopy;
|
|
269
|
+
const updateSize = (valueNew = refs.canvasMain.current) => {
|
|
270
|
+
const uri = valueNew.toDataURL(type);
|
|
271
|
+
|
|
272
|
+
// Update size
|
|
273
|
+
setSize((0, _utils.to)((0, _utils.to)(uri, 'byte-size'), 'size-format'));
|
|
274
|
+
};
|
|
275
|
+
_react.default.useEffect(() => {
|
|
276
|
+
var _refs$root$current;
|
|
277
|
+
const method = event => {
|
|
278
|
+
if (['Escape'].includes(event.key) || ['s', 'S'].includes(event.key) && event.metaKey || ['f', 'F'].includes(event.key) && event.metaKey && event.shiftKey || ['c', 'C'].includes(event.key) && event.metaKey && event.shiftKey || ['d', 'D'].includes(event.key) && (event.metaKey || event.shiftKey) || ['r', 'R'].includes(event.key) && (event.metaKey || event.shiftKey) || ['q', 'Q'].includes(event.key) && event.metaKey && event.shiftKey) {
|
|
279
|
+
event.preventDefault();
|
|
280
|
+
}
|
|
281
|
+
switch (event.key) {
|
|
282
|
+
case 's':
|
|
283
|
+
case 'S':
|
|
284
|
+
if (refs.open.current && event.metaKey) onSave();
|
|
285
|
+
return;
|
|
286
|
+
case 'f':
|
|
287
|
+
case 'F':
|
|
288
|
+
if (event.metaKey && event.shiftKey) openOption('filters');
|
|
289
|
+
return;
|
|
290
|
+
case 'c':
|
|
291
|
+
case 'C':
|
|
292
|
+
if (event.metaKey && event.shiftKey) openOption('crop');
|
|
293
|
+
return;
|
|
294
|
+
case 'd':
|
|
295
|
+
case 'D':
|
|
296
|
+
if (event.metaKey && event.shiftKey) onDownload();
|
|
297
|
+
return;
|
|
298
|
+
case 'r':
|
|
299
|
+
case 'R':
|
|
300
|
+
if (event.metaKey && !event.shiftKey) onReset();
|
|
301
|
+
if (event.metaKey && event.shiftKey) openOption('resize');
|
|
302
|
+
return;
|
|
303
|
+
case 'q':
|
|
304
|
+
case 'Q':
|
|
305
|
+
if (event.metaKey && event.shiftKey) openOption('quality');
|
|
306
|
+
return;
|
|
307
|
+
case 'Escape':
|
|
308
|
+
if (refs.open.current) onCancel();
|
|
309
|
+
return;
|
|
310
|
+
default:
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
512
313
|
};
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
{ value: 0, label: '0' },
|
|
523
|
-
{ value: 100, label: '100' }
|
|
524
|
-
], labels: true, tooltip: true, onChange: (valueNew) => {
|
|
525
|
-
if ((0, utils_1.is)('function', onFilterSliderChange_))
|
|
526
|
-
onFilterSliderChange_(valueNew, value__);
|
|
527
|
-
} }, SliderProps, { className: (0, style_react_1.classNames)([
|
|
528
|
-
(0, utils_2.staticClassName)('ImageEdit', theme) && [
|
|
529
|
-
'onesy-ImageEdit-slider'
|
|
530
|
-
],
|
|
531
|
-
SliderProps.className,
|
|
532
|
-
classes.slider
|
|
533
|
-
]) }), value__))
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
label: l('Contrast'),
|
|
537
|
-
Icon: IconContrast,
|
|
538
|
-
value: 'contrast',
|
|
539
|
-
method: utils_2.canvasContrast,
|
|
540
|
-
renderIconButton: (value__, selected_, onChangeFilter_) => ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Contrast') }, TooltipProps, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ version: 'outlined', selected: selected_, onClick: () => onChangeFilter_(value__) }, IconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconContrast, {}) })) }), value__)),
|
|
541
|
-
renderSlider: (value__, filterValuesCopy_, onFilterSliderChange_) => ((0, jsx_runtime_1.jsx)(Slider, Object.assign({ valueDefault: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0, value: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0, min: -100, max: 100, precision: 1, marks: [
|
|
542
|
-
{ value: -100, label: '-100' },
|
|
543
|
-
{ value: 0, label: '0' },
|
|
544
|
-
{ value: 100, label: '100' }
|
|
545
|
-
], labels: true, tooltip: true, onChange: (valueNew) => {
|
|
546
|
-
if ((0, utils_1.is)('function', onFilterSliderChange_))
|
|
547
|
-
onFilterSliderChange_(valueNew, value__);
|
|
548
|
-
} }, SliderProps, { className: (0, style_react_1.classNames)([
|
|
549
|
-
(0, utils_2.staticClassName)('ImageEdit', theme) && [
|
|
550
|
-
'onesy-ImageEdit-slider'
|
|
551
|
-
],
|
|
552
|
-
SliderProps.className,
|
|
553
|
-
classes.slider
|
|
554
|
-
]) }), value__))
|
|
555
|
-
},
|
|
556
|
-
{
|
|
557
|
-
label: l('Saturation'),
|
|
558
|
-
Icon: IconSaturation,
|
|
559
|
-
value: 'saturation',
|
|
560
|
-
method: utils_2.canvasSaturation,
|
|
561
|
-
renderIconButton: (value__, selected_, onChangeFilter_) => ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Saturation') }, TooltipProps, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ version: 'outlined', selected: selected_, onClick: () => onChangeFilter_(value__) }, IconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconSaturation, {}) })) }), value__)),
|
|
562
|
-
renderSlider: (value__, filterValuesCopy_, onFilterSliderChange_) => ((0, jsx_runtime_1.jsx)(Slider, Object.assign({ valueDefault: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0, value: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0, min: -100, max: 100, precision: 1, marks: [
|
|
563
|
-
{ value: -100, label: '-100' },
|
|
564
|
-
{ value: 0, label: '0' },
|
|
565
|
-
{ value: 100, label: '100' }
|
|
566
|
-
], labels: true, tooltip: true, onChange: (valueNew) => {
|
|
567
|
-
if ((0, utils_1.is)('function', onFilterSliderChange_))
|
|
568
|
-
onFilterSliderChange_(valueNew, value__);
|
|
569
|
-
} }, SliderProps, { className: (0, style_react_1.classNames)([
|
|
570
|
-
(0, utils_2.staticClassName)('ImageEdit', theme) && [
|
|
571
|
-
'onesy-ImageEdit-slider'
|
|
572
|
-
],
|
|
573
|
-
SliderProps.className,
|
|
574
|
-
classes.slider
|
|
575
|
-
]) }), value__))
|
|
576
|
-
},
|
|
577
|
-
{
|
|
578
|
-
label: l('Fade'),
|
|
579
|
-
Icon: IconFade,
|
|
580
|
-
value: 'fade',
|
|
581
|
-
method: utils_2.canvasFade,
|
|
582
|
-
renderIconButton: (value__, selected_, onChangeFilter_) => ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Fade') }, TooltipProps, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ version: 'outlined', selected: selected_, onClick: () => onChangeFilter_(value__) }, IconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconFade, {}) })) }), value__)),
|
|
583
|
-
renderSlider: (value__, filterValuesCopy_, onFilterSliderChange_) => ((0, jsx_runtime_1.jsx)(Slider, Object.assign({ valueDefault: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0, value: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0, min: 0, max: 100, precision: 1, marks: [
|
|
584
|
-
{ value: 0, label: '0' },
|
|
585
|
-
{ value: 100, label: '100' }
|
|
586
|
-
], labels: true, tooltip: true, onChange: (valueNew) => {
|
|
587
|
-
if ((0, utils_1.is)('function', onFilterSliderChange_))
|
|
588
|
-
onFilterSliderChange_(valueNew, value__);
|
|
589
|
-
} }, SliderProps, { className: (0, style_react_1.classNames)([
|
|
590
|
-
(0, utils_2.staticClassName)('ImageEdit', theme) && [
|
|
591
|
-
'onesy-ImageEdit-slider'
|
|
592
|
-
],
|
|
593
|
-
SliderProps.className,
|
|
594
|
-
classes.slider
|
|
595
|
-
]) }), value__))
|
|
596
|
-
},
|
|
597
|
-
{
|
|
598
|
-
label: l('Invert'),
|
|
599
|
-
Icon: IconInvert,
|
|
600
|
-
value: 'invert',
|
|
601
|
-
method: utils_2.canvasInvert,
|
|
602
|
-
renderIconButton: (value__, selected_, onChangeFilter_) => ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Invert') }, TooltipProps, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ version: 'outlined', selected: selected_, onClick: () => onChangeFilter_(value__) }, IconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconInvert, {}) })) }), value__)),
|
|
603
|
-
renderSlider: (value__, filterValuesCopy_, onFilterSliderChange_) => ((0, jsx_runtime_1.jsx)(Slider, Object.assign({ valueDefault: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0, value: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0, min: 0, max: 1, precision: 1, marks: [
|
|
604
|
-
{ value: 0, label: 'Not inverted' },
|
|
605
|
-
{ value: 1, label: 'Inverted' }
|
|
606
|
-
], labels: true, tooltip: true, onChange: (valueNew) => {
|
|
607
|
-
if ((0, utils_1.is)('function', onFilterSliderChange_))
|
|
608
|
-
onFilterSliderChange_(valueNew, value__);
|
|
609
|
-
} }, SliderProps, { className: (0, style_react_1.classNames)([
|
|
610
|
-
(0, utils_2.staticClassName)('ImageEdit', theme) && [
|
|
611
|
-
'onesy-ImageEdit-slider'
|
|
612
|
-
],
|
|
613
|
-
SliderProps.className,
|
|
614
|
-
classes.slider
|
|
615
|
-
]) }), value__))
|
|
616
|
-
},
|
|
617
|
-
{
|
|
618
|
-
label: l('Old photo'),
|
|
619
|
-
Icon: IconOldPhoto,
|
|
620
|
-
value: 'old_photo',
|
|
621
|
-
method: utils_2.canvasOldPhoto,
|
|
622
|
-
renderIconButton: (value__, selected_, onChangeFilter_) => ((0, jsx_runtime_1.jsx)(Tooltip, Object.assign({ name: l('Old photo') }, TooltipProps, { children: (0, jsx_runtime_1.jsx)(IconButton, Object.assign({ version: 'outlined', selected: selected_, onClick: () => onChangeFilter_(value__) }, IconButtonProps, { children: (0, jsx_runtime_1.jsx)(IconOldPhoto, {}) })) }), value__)),
|
|
623
|
-
renderSlider: (value__, filterValuesCopy_, onFilterSliderChange_) => ((0, jsx_runtime_1.jsx)(Slider, Object.assign({ valueDefault: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0, value: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0, min: -40, max: 40, precision: 1, marks: [
|
|
624
|
-
{ value: -40, label: '-40' },
|
|
625
|
-
{ value: 0, label: 'No filter' },
|
|
626
|
-
{ value: 40, label: '40' }
|
|
627
|
-
], labels: true, tooltip: true, onChange: (valueNew) => {
|
|
628
|
-
if ((0, utils_1.is)('function', onFilterSliderChange_))
|
|
629
|
-
onFilterSliderChange_(valueNew, value__);
|
|
630
|
-
} }, SliderProps, { className: (0, style_react_1.classNames)([
|
|
631
|
-
(0, utils_2.staticClassName)('ImageEdit', theme) && [
|
|
632
|
-
'onesy-ImageEdit-slider'
|
|
633
|
-
],
|
|
634
|
-
SliderProps.className,
|
|
635
|
-
classes.slider
|
|
636
|
-
]) }), value__))
|
|
637
|
-
},
|
|
638
|
-
...(filters_ || [])
|
|
639
|
-
], [filters_]);
|
|
640
|
-
// Only filters
|
|
641
|
-
if ((0, utils_1.is)('array', onlyFilters))
|
|
642
|
-
filters = filters.filter(item => onlyFilters.includes(item.value));
|
|
643
|
-
const ImageCropProps = Object.assign({ gridLines: true }, ImageCropProps_);
|
|
644
|
-
const TooltipProps = Object.assign({ position: 'bottom', interactive: false }, TooltipProps_);
|
|
645
|
-
const IconButtonProps = Object.assign({ tonal, color: 'inherit' }, IconButtonProps_);
|
|
646
|
-
const SliderProps = Object.assign({ tonal: false, color: 'default' }, SliderProps_);
|
|
647
|
-
const ChipProps = Object.assign({ size: 'small' }, ChipProps_);
|
|
648
|
-
const chips = [
|
|
649
|
-
{ label: '1:1', value: 1 / 1 },
|
|
650
|
-
{ label: '4:3', value: 4 / 3 },
|
|
651
|
-
{ label: '16:9', value: 16 / 9 }
|
|
652
|
-
];
|
|
653
|
-
const options = [
|
|
654
|
-
filtersOption && { label: l('Filters'), value: 'filters', Icon: IconFilters },
|
|
655
|
-
cropOption && { label: l('Crop'), value: 'crop', Icon: IconCrop },
|
|
656
|
-
resizeOption && { label: l('Resize'), value: 'resize', Icon: IconResize },
|
|
657
|
-
qualityOption && { label: l('Quality'), value: 'quality', Icon: IconQuality }
|
|
658
|
-
]
|
|
659
|
-
.filter(Boolean);
|
|
660
|
-
const MetaTypeProps = {
|
|
661
|
-
version: 'b3'
|
|
314
|
+
if (!refs.value.current) {
|
|
315
|
+
if (image instanceof HTMLCanvasElement) onChange(image);else if ((0, _utils.is)('string', image)) makeImage(image);
|
|
316
|
+
}
|
|
317
|
+
const rootDocument = (0, _utils.isEnvironment)('browser') ? ((_refs$root$current = refs.root.current) === null || _refs$root$current === void 0 ? void 0 : _refs$root$current.ownerDocument) || window.document : undefined;
|
|
318
|
+
rootDocument.addEventListener('keydown', method);
|
|
319
|
+
setInit(true);
|
|
320
|
+
return () => {
|
|
321
|
+
// Clean up
|
|
322
|
+
rootDocument.removeEventListener('keydown', method);
|
|
662
323
|
};
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
324
|
+
}, []);
|
|
325
|
+
_react.default.useEffect(() => {
|
|
326
|
+
if (image instanceof HTMLCanvasElement) onChange(image);else if ((0, _utils.is)('string', image)) makeImage(image);
|
|
327
|
+
}, [image]);
|
|
328
|
+
_react.default.useEffect(() => {
|
|
329
|
+
const valueToUse = !open ? refs.value.current : refs.valueCopy.current;
|
|
330
|
+
if (valueToUse) {
|
|
331
|
+
var _refs$canvasMain$curr;
|
|
332
|
+
refs.canvasMain.current.width = valueToUse.width;
|
|
333
|
+
refs.canvasMain.current.height = valueToUse.height;
|
|
334
|
+
(_refs$canvasMain$curr = refs.canvasMain.current) === null || _refs$canvasMain$curr === void 0 || _refs$canvasMain$curr.getContext('2d').drawImage(valueToUse, 0, 0, valueToUse.width, valueToUse.height);
|
|
335
|
+
updateSize();
|
|
336
|
+
}
|
|
337
|
+
}, [value, valueCopy, open]);
|
|
338
|
+
_react.default.useEffect(() => {
|
|
339
|
+
if (init) {
|
|
340
|
+
if (value_ !== value) onChange(value_);
|
|
341
|
+
}
|
|
342
|
+
}, [value_]);
|
|
343
|
+
_react.default.useEffect(() => {
|
|
344
|
+
if (init) {
|
|
345
|
+
if (valueCopy_ !== valueCopy) onChangeCopy(valueCopy_);
|
|
346
|
+
}
|
|
347
|
+
}, [valueCopy_]);
|
|
348
|
+
const applyAllFilters = canvas => {
|
|
349
|
+
let valueCopy__ = refs.valueCopy.current;
|
|
350
|
+
|
|
351
|
+
// Update filters
|
|
352
|
+
Object.keys(refs.filterValuesCopy.current).forEach(item => {
|
|
353
|
+
const filterValue_ = filters.find(item_ => item_.value === item);
|
|
354
|
+
if (filterValue_) {
|
|
355
|
+
const {
|
|
356
|
+
method
|
|
357
|
+
} = filterValue_;
|
|
358
|
+
if ((0, _utils.is)('function', method) && refs.filterValuesCopy.current[item] !== undefined) valueCopy__ = method(refs.filterValuesCopy.current[item], canvas, valueCopy__);
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
};
|
|
362
|
+
const applyAllFiltersDebounced = _react.default.useCallback((0, _utils.debounce)(applyAllFilters, 140), []);
|
|
363
|
+
_react.default.useEffect(() => {
|
|
364
|
+
applyAllFiltersDebounced(refs.canvasMain.current);
|
|
365
|
+
}, [filterValuesCopy]);
|
|
366
|
+
const makeImage = async (valueNew = refs.value.current) => {
|
|
367
|
+
var _refs$root$current2;
|
|
368
|
+
const img = await (0, _utils2.image)(valueNew);
|
|
369
|
+
const rootDocument = (0, _utils.isEnvironment)('browser') ? ((_refs$root$current2 = refs.root.current) === null || _refs$root$current2 === void 0 ? void 0 : _refs$root$current2.ownerDocument) || window.document : undefined;
|
|
370
|
+
const canvas = rootDocument.createElement('canvas');
|
|
371
|
+
canvas.width = img.width;
|
|
372
|
+
canvas.height = img.height;
|
|
373
|
+
canvas.getContext('2d').drawImage(img, 0, 0, img.width, img.height);
|
|
374
|
+
|
|
375
|
+
// Image
|
|
376
|
+
onChange(canvas);
|
|
377
|
+
|
|
378
|
+
// Image copy
|
|
379
|
+
const copy = rootDocument.createElement('canvas');
|
|
380
|
+
copy.width = canvas.width;
|
|
381
|
+
copy.height = canvas.height;
|
|
382
|
+
copy.getContext('2d').drawImage(canvas, 0, 0, canvas.width, canvas.height);
|
|
383
|
+
onChangeCopy(copy);
|
|
384
|
+
};
|
|
385
|
+
const updateResize = (0, _utils.debounce)(async (width, height) => {
|
|
386
|
+
var _refs$root$current3;
|
|
387
|
+
const rootDocument = (0, _utils.isEnvironment)('browser') ? ((_refs$root$current3 = refs.root.current) === null || _refs$root$current3 === void 0 ? void 0 : _refs$root$current3.ownerDocument) || window.document : undefined;
|
|
388
|
+
|
|
389
|
+
// Update value copy
|
|
390
|
+
const canvas = rootDocument.createElement('canvas');
|
|
391
|
+
if (width > 1 && height > 1) {
|
|
392
|
+
canvas.width = width;
|
|
393
|
+
canvas.height = height;
|
|
394
|
+
canvas.getContext('2d').drawImage(refs.value.current, 0, 0, width, height);
|
|
395
|
+
|
|
396
|
+
// Value copy
|
|
397
|
+
onChangeCopy(canvas);
|
|
398
|
+
|
|
399
|
+
// Update the canvas value
|
|
400
|
+
refs.canvasMain.current.width = width;
|
|
401
|
+
refs.canvasMain.current.height = height;
|
|
402
|
+
refs.canvasMain.current.getContext('2d').drawImage(value, 0, 0, width, height);
|
|
403
|
+
|
|
404
|
+
// Update size
|
|
405
|
+
updateSize();
|
|
406
|
+
}
|
|
407
|
+
}, 140);
|
|
408
|
+
const onFilterSliderChange = (valueNew, valueFilter) => {
|
|
409
|
+
setFilterValuesCopy(values_ => _objectSpread(_objectSpread({}, values_), {}, {
|
|
410
|
+
[valueFilter]: valueNew
|
|
411
|
+
}));
|
|
412
|
+
};
|
|
413
|
+
const onChangeFilter = valueNew => {
|
|
414
|
+
// If moving to another filter or closing current one
|
|
415
|
+
// clean up previous one filter for mainCanvas
|
|
416
|
+
if (filter === valueNew) setFilter('');else setFilter(valueNew);
|
|
417
|
+
};
|
|
418
|
+
const onChangeAspectRatioCustom = (valueNew_, left_ = true) => {
|
|
419
|
+
const valueNew = !valueNew_ ? 1 : valueNew_;
|
|
420
|
+
let left = (aspectRatioCustom === null || aspectRatioCustom === void 0 ? void 0 : aspectRatioCustom[0]) || 1;
|
|
421
|
+
let right = (aspectRatioCustom === null || aspectRatioCustom === void 0 ? void 0 : aspectRatioCustom[1]) || 1;
|
|
422
|
+
left_ ? left = valueNew : right = valueNew;
|
|
423
|
+
setAspectRatioCustom([left, right]);
|
|
424
|
+
onChangeAspectRatio(left / right);
|
|
425
|
+
};
|
|
426
|
+
const onChangeAspectRatio = valueNew => {
|
|
427
|
+
if (aspectRatio === valueNew) setAspectRatio('');else setAspectRatio(valueNew);
|
|
428
|
+
};
|
|
429
|
+
const onChangeResize = async (valueNew, width_ = true) => {
|
|
430
|
+
let width;
|
|
431
|
+
let height;
|
|
432
|
+
if (!refs.resizeAspectRatio.current) {
|
|
433
|
+
if (width_) {
|
|
434
|
+
width = +valueNew;
|
|
435
|
+
height = resize === null || resize === void 0 ? void 0 : resize[1];
|
|
436
|
+
} else {
|
|
437
|
+
width = resize === null || resize === void 0 ? void 0 : resize[0];
|
|
438
|
+
height = +valueNew;
|
|
439
|
+
}
|
|
440
|
+
} else {
|
|
441
|
+
const aspectRatio_ = (value === null || value === void 0 ? void 0 : value.width) / (value === null || value === void 0 ? void 0 : value.height);
|
|
442
|
+
if (width_) {
|
|
443
|
+
width = +valueNew;
|
|
444
|
+
height = valueNew / aspectRatio_;
|
|
445
|
+
} else {
|
|
446
|
+
height = +valueNew;
|
|
447
|
+
width = height * aspectRatio_;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
width = (0, _utils.clamp)(width, 0);
|
|
451
|
+
height = (0, _utils.clamp)(height, 0);
|
|
452
|
+
setResize([width, height]);
|
|
453
|
+
await updateResize(width, height);
|
|
454
|
+
};
|
|
455
|
+
const updateQuality = (0, _utils.debounce)(async valueNew => {
|
|
456
|
+
var _refs$root$current4, _refs$canvasMain$curr2;
|
|
457
|
+
const rootDocument = (0, _utils.isEnvironment)('browser') ? ((_refs$root$current4 = refs.root.current) === null || _refs$root$current4 === void 0 ? void 0 : _refs$root$current4.ownerDocument) || window.document : undefined;
|
|
458
|
+
|
|
459
|
+
// Update copy value
|
|
460
|
+
const uri = value.toDataURL('image/jpeg', valueNew / 100);
|
|
461
|
+
const img = await (0, _utils2.image)(uri);
|
|
462
|
+
const canvas = rootDocument.createElement('canvas');
|
|
463
|
+
canvas.width = img.width;
|
|
464
|
+
canvas.height = img.height;
|
|
465
|
+
canvas.getContext('2d').drawImage(img, 0, 0, img.width, img.height);
|
|
466
|
+
onChangeCopy(canvas);
|
|
467
|
+
|
|
468
|
+
// Update the canvas value
|
|
469
|
+
refs.canvasMain.current.width = canvas.width;
|
|
470
|
+
refs.canvasMain.current.height = canvas.height;
|
|
471
|
+
(_refs$canvasMain$curr2 = refs.canvasMain.current) === null || _refs$canvasMain$curr2 === void 0 || _refs$canvasMain$curr2.getContext('2d').drawImage(canvas, 0, 0, canvas.width, canvas.height);
|
|
472
|
+
|
|
473
|
+
// Update size
|
|
474
|
+
updateSize();
|
|
475
|
+
}, 40);
|
|
476
|
+
const onChangeQuality = async valueNew => {
|
|
477
|
+
setQuality(valueNew);
|
|
478
|
+
await updateQuality(valueNew);
|
|
479
|
+
};
|
|
480
|
+
const onChange = valueNew => {
|
|
481
|
+
// Update inner or controlled
|
|
482
|
+
if (!props.hasOwnProperty('value')) setValue(valueNew);
|
|
483
|
+
if ((0, _utils.is)('function', onChange_)) onChange_(valueNew);
|
|
484
|
+
};
|
|
485
|
+
const onChangeCopy = valueNew => {
|
|
486
|
+
// Update inner or controlled
|
|
487
|
+
if (!props.hasOwnProperty('valueCopy')) setValueCopy(valueNew);
|
|
488
|
+
if ((0, _utils.is)('function', onChangeCopy_)) onChangeCopy_(valueNew);
|
|
489
|
+
};
|
|
490
|
+
const onReset = (imageReset = true, valueCopyReset = true, resizeReset = true) => {
|
|
491
|
+
var _refs$root$current5;
|
|
492
|
+
const rootDocument = (0, _utils.isEnvironment)('browser') ? ((_refs$root$current5 = refs.root.current) === null || _refs$root$current5 === void 0 ? void 0 : _refs$root$current5.ownerDocument) || window.document : undefined;
|
|
493
|
+
setOpen(false);
|
|
494
|
+
setQuality(100);
|
|
495
|
+
setAspectRatio('');
|
|
496
|
+
setAspectRatioCustom([1, 1]);
|
|
497
|
+
setSelection('');
|
|
498
|
+
setFilter('');
|
|
499
|
+
setFilterValuesCopy(_objectSpread({}, filterValues));
|
|
500
|
+
if (resizeReset) setResize([value === null || value === void 0 ? void 0 : value.width, value === null || value === void 0 ? void 0 : value.height]);
|
|
501
|
+
if (valueCopyReset) {
|
|
502
|
+
const canvas = rootDocument.createElement('canvas');
|
|
503
|
+
canvas.width = refs.value.current.width;
|
|
504
|
+
canvas.height = refs.value.current.height;
|
|
505
|
+
canvas.getContext('2d').drawImage(refs.value.current, 0, 0, refs.value.current.width, refs.value.current.height);
|
|
506
|
+
onChangeCopy(canvas);
|
|
507
|
+
}
|
|
508
|
+
if (imageReset) {
|
|
509
|
+
setFilterValues({});
|
|
510
|
+
setFilterValuesCopy({});
|
|
511
|
+
makeImage(image);
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
const openOption = valueNew => {
|
|
515
|
+
setOpenedOption(valueNew);
|
|
516
|
+
if (open && openedOption === valueNew) {
|
|
517
|
+
setOpen(false);
|
|
518
|
+
onReset(false);
|
|
519
|
+
} else if (!open) setOpen(true);
|
|
520
|
+
};
|
|
521
|
+
const onSave = () => {
|
|
522
|
+
var _refs$root$current6, _refs$canvasMain$curr3;
|
|
523
|
+
const rootDocument = (0, _utils.isEnvironment)('browser') ? ((_refs$root$current6 = refs.root.current) === null || _refs$root$current6 === void 0 ? void 0 : _refs$root$current6.ownerDocument) || window.document : undefined;
|
|
524
|
+
|
|
525
|
+
// Make value copy into value
|
|
526
|
+
let canvas = rootDocument.createElement('canvas');
|
|
527
|
+
canvas.width = refs.valueCopy.current.width;
|
|
528
|
+
canvas.height = refs.valueCopy.current.height;
|
|
529
|
+
canvas.getContext('2d').drawImage(refs.valueCopy.current, 0, 0, refs.valueCopy.current.width, refs.valueCopy.current.height);
|
|
530
|
+
|
|
531
|
+
// Update crop
|
|
532
|
+
if (openedOption === 'crop' && selection) {
|
|
533
|
+
// Crop the canvas
|
|
534
|
+
canvas.width = selection.width;
|
|
535
|
+
canvas.height = selection.height;
|
|
536
|
+
canvas = (0, _utils.canvasCrop)(refs.valueCopy.current, selection.left, selection.top, selection.width, selection.height);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// Update filters
|
|
540
|
+
setFilterValues(_objectSpread({}, filterValuesCopy));
|
|
541
|
+
applyAllFilters(canvas);
|
|
542
|
+
|
|
543
|
+
// Update the main canvas value
|
|
544
|
+
refs.canvasMain.current.width = canvas.width;
|
|
545
|
+
refs.canvasMain.current.height = canvas.height;
|
|
546
|
+
(_refs$canvasMain$curr3 = refs.canvasMain.current) === null || _refs$canvasMain$curr3 === void 0 || _refs$canvasMain$curr3.getContext('2d').drawImage(canvas, 0, 0, canvas.width, canvas.height);
|
|
547
|
+
|
|
548
|
+
// Update value
|
|
549
|
+
onChange(canvas);
|
|
550
|
+
const canvasCopy = rootDocument.createElement('canvas');
|
|
551
|
+
canvasCopy.width = canvas.width;
|
|
552
|
+
canvasCopy.height = canvas.height;
|
|
553
|
+
canvasCopy.getContext('2d').drawImage(canvas, 0, 0, canvasCopy.width, canvasCopy.height);
|
|
554
|
+
|
|
555
|
+
// Update value copy
|
|
556
|
+
onChangeCopy(canvasCopy);
|
|
557
|
+
|
|
558
|
+
// Reset
|
|
559
|
+
onReset(false, false, false);
|
|
560
|
+
};
|
|
561
|
+
const onDownload = () => {
|
|
562
|
+
// Download the image from canvas datauri
|
|
563
|
+
// of the image type and quality, name
|
|
564
|
+
const uri = refs.value.current.toDataURL(type);
|
|
565
|
+
(0, _utils.download)(name, uri, type);
|
|
566
|
+
};
|
|
567
|
+
const onCancel = () => {
|
|
568
|
+
var _refs$root$current7, _refs$value$current, _refs$value$current2, _refs$canvasMain$curr4;
|
|
569
|
+
const rootDocument = (0, _utils.isEnvironment)('browser') ? ((_refs$root$current7 = refs.root.current) === null || _refs$root$current7 === void 0 ? void 0 : _refs$root$current7.ownerDocument) || window.document : undefined;
|
|
570
|
+
|
|
571
|
+
// Reset to unopen
|
|
572
|
+
onReset(false);
|
|
573
|
+
|
|
574
|
+
// Make value copy into value
|
|
575
|
+
const canvas = rootDocument.createElement('canvas');
|
|
576
|
+
canvas.width = refs.value.current.width;
|
|
577
|
+
canvas.height = refs.value.current.height;
|
|
578
|
+
canvas.getContext('2d').drawImage(refs.value.current, 0, 0, refs.value.current.width, refs.value.current.height);
|
|
579
|
+
onChangeCopy(canvas);
|
|
580
|
+
|
|
581
|
+
// Update the main canvas value
|
|
582
|
+
refs.canvasMain.current.width = (_refs$value$current = refs.value.current) === null || _refs$value$current === void 0 ? void 0 : _refs$value$current.width;
|
|
583
|
+
refs.canvasMain.current.height = (_refs$value$current2 = refs.value.current) === null || _refs$value$current2 === void 0 ? void 0 : _refs$value$current2.height;
|
|
584
|
+
(_refs$canvasMain$curr4 = refs.canvasMain.current) === null || _refs$canvasMain$curr4 === void 0 || _refs$canvasMain$curr4.getContext('2d').drawImage(refs.value.current, 0, 0, refs.value.current.width, refs.value.current.height);
|
|
585
|
+
};
|
|
586
|
+
let filters = _react.default.useMemo(() => [{
|
|
587
|
+
label: l('Brightness'),
|
|
588
|
+
Icon: IconBrightness,
|
|
589
|
+
value: 'brightness',
|
|
590
|
+
method: _utils2.canvasBrightness,
|
|
591
|
+
renderIconButton: (value__, selected_, onChangeFilter_) => /*#__PURE__*/_react.default.createElement(Tooltip, (0, _extends2.default)({
|
|
592
|
+
key: value__,
|
|
593
|
+
name: l('Brightness')
|
|
594
|
+
}, TooltipProps), /*#__PURE__*/_react.default.createElement(IconButton, (0, _extends2.default)({
|
|
595
|
+
version: "outlined",
|
|
596
|
+
selected: selected_,
|
|
597
|
+
onClick: () => onChangeFilter_(value__)
|
|
598
|
+
}, IconButtonProps), /*#__PURE__*/_react.default.createElement(IconBrightness, null))),
|
|
599
|
+
renderSlider: (value__, filterValuesCopy_, onFilterSliderChange_) => /*#__PURE__*/_react.default.createElement(Slider, (0, _extends2.default)({
|
|
600
|
+
key: value__,
|
|
601
|
+
valueDefault: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0,
|
|
602
|
+
value: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0,
|
|
603
|
+
min: -100,
|
|
604
|
+
max: 100,
|
|
605
|
+
precision: 1,
|
|
606
|
+
marks: [{
|
|
607
|
+
value: -100,
|
|
608
|
+
label: '-100'
|
|
609
|
+
}, {
|
|
610
|
+
value: 0,
|
|
611
|
+
label: '0'
|
|
612
|
+
}, {
|
|
613
|
+
value: 100,
|
|
614
|
+
label: '100'
|
|
615
|
+
}],
|
|
616
|
+
labels: true,
|
|
617
|
+
tooltip: true,
|
|
618
|
+
onChange: valueNew => {
|
|
619
|
+
if ((0, _utils.is)('function', onFilterSliderChange_)) onFilterSliderChange_(valueNew, value__);
|
|
620
|
+
}
|
|
621
|
+
}, SliderProps, {
|
|
622
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-slider'], SliderProps.className, classes.slider])
|
|
623
|
+
}))
|
|
624
|
+
}, {
|
|
625
|
+
label: l('Contrast'),
|
|
626
|
+
Icon: IconContrast,
|
|
627
|
+
value: 'contrast',
|
|
628
|
+
method: _utils2.canvasContrast,
|
|
629
|
+
renderIconButton: (value__, selected_, onChangeFilter_) => /*#__PURE__*/_react.default.createElement(Tooltip, (0, _extends2.default)({
|
|
630
|
+
key: value__,
|
|
631
|
+
name: l('Contrast')
|
|
632
|
+
}, TooltipProps), /*#__PURE__*/_react.default.createElement(IconButton, (0, _extends2.default)({
|
|
633
|
+
version: "outlined",
|
|
634
|
+
selected: selected_,
|
|
635
|
+
onClick: () => onChangeFilter_(value__)
|
|
636
|
+
}, IconButtonProps), /*#__PURE__*/_react.default.createElement(IconContrast, null))),
|
|
637
|
+
renderSlider: (value__, filterValuesCopy_, onFilterSliderChange_) => /*#__PURE__*/_react.default.createElement(Slider, (0, _extends2.default)({
|
|
638
|
+
key: value__,
|
|
639
|
+
valueDefault: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0,
|
|
640
|
+
value: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0,
|
|
641
|
+
min: -100,
|
|
642
|
+
max: 100,
|
|
643
|
+
precision: 1,
|
|
644
|
+
marks: [{
|
|
645
|
+
value: -100,
|
|
646
|
+
label: '-100'
|
|
647
|
+
}, {
|
|
648
|
+
value: 0,
|
|
649
|
+
label: '0'
|
|
650
|
+
}, {
|
|
651
|
+
value: 100,
|
|
652
|
+
label: '100'
|
|
653
|
+
}],
|
|
654
|
+
labels: true,
|
|
655
|
+
tooltip: true,
|
|
656
|
+
onChange: valueNew => {
|
|
657
|
+
if ((0, _utils.is)('function', onFilterSliderChange_)) onFilterSliderChange_(valueNew, value__);
|
|
658
|
+
}
|
|
659
|
+
}, SliderProps, {
|
|
660
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-slider'], SliderProps.className, classes.slider])
|
|
661
|
+
}))
|
|
662
|
+
}, {
|
|
663
|
+
label: l('Saturation'),
|
|
664
|
+
Icon: IconSaturation,
|
|
665
|
+
value: 'saturation',
|
|
666
|
+
method: _utils2.canvasSaturation,
|
|
667
|
+
renderIconButton: (value__, selected_, onChangeFilter_) => /*#__PURE__*/_react.default.createElement(Tooltip, (0, _extends2.default)({
|
|
668
|
+
key: value__,
|
|
669
|
+
name: l('Saturation')
|
|
670
|
+
}, TooltipProps), /*#__PURE__*/_react.default.createElement(IconButton, (0, _extends2.default)({
|
|
671
|
+
version: "outlined",
|
|
672
|
+
selected: selected_,
|
|
673
|
+
onClick: () => onChangeFilter_(value__)
|
|
674
|
+
}, IconButtonProps), /*#__PURE__*/_react.default.createElement(IconSaturation, null))),
|
|
675
|
+
renderSlider: (value__, filterValuesCopy_, onFilterSliderChange_) => /*#__PURE__*/_react.default.createElement(Slider, (0, _extends2.default)({
|
|
676
|
+
key: value__,
|
|
677
|
+
valueDefault: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0,
|
|
678
|
+
value: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0,
|
|
679
|
+
min: -100,
|
|
680
|
+
max: 100,
|
|
681
|
+
precision: 1,
|
|
682
|
+
marks: [{
|
|
683
|
+
value: -100,
|
|
684
|
+
label: '-100'
|
|
685
|
+
}, {
|
|
686
|
+
value: 0,
|
|
687
|
+
label: '0'
|
|
688
|
+
}, {
|
|
689
|
+
value: 100,
|
|
690
|
+
label: '100'
|
|
691
|
+
}],
|
|
692
|
+
labels: true,
|
|
693
|
+
tooltip: true,
|
|
694
|
+
onChange: valueNew => {
|
|
695
|
+
if ((0, _utils.is)('function', onFilterSliderChange_)) onFilterSliderChange_(valueNew, value__);
|
|
696
|
+
}
|
|
697
|
+
}, SliderProps, {
|
|
698
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-slider'], SliderProps.className, classes.slider])
|
|
699
|
+
}))
|
|
700
|
+
}, {
|
|
701
|
+
label: l('Fade'),
|
|
702
|
+
Icon: IconFade,
|
|
703
|
+
value: 'fade',
|
|
704
|
+
method: _utils2.canvasFade,
|
|
705
|
+
renderIconButton: (value__, selected_, onChangeFilter_) => /*#__PURE__*/_react.default.createElement(Tooltip, (0, _extends2.default)({
|
|
706
|
+
key: value__,
|
|
707
|
+
name: l('Fade')
|
|
708
|
+
}, TooltipProps), /*#__PURE__*/_react.default.createElement(IconButton, (0, _extends2.default)({
|
|
709
|
+
version: "outlined",
|
|
710
|
+
selected: selected_,
|
|
711
|
+
onClick: () => onChangeFilter_(value__)
|
|
712
|
+
}, IconButtonProps), /*#__PURE__*/_react.default.createElement(IconFade, null))),
|
|
713
|
+
renderSlider: (value__, filterValuesCopy_, onFilterSliderChange_) => /*#__PURE__*/_react.default.createElement(Slider, (0, _extends2.default)({
|
|
714
|
+
key: value__,
|
|
715
|
+
valueDefault: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0,
|
|
716
|
+
value: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0,
|
|
717
|
+
min: 0,
|
|
718
|
+
max: 100,
|
|
719
|
+
precision: 1,
|
|
720
|
+
marks: [{
|
|
721
|
+
value: 0,
|
|
722
|
+
label: '0'
|
|
723
|
+
}, {
|
|
724
|
+
value: 100,
|
|
725
|
+
label: '100'
|
|
726
|
+
}],
|
|
727
|
+
labels: true,
|
|
728
|
+
tooltip: true,
|
|
729
|
+
onChange: valueNew => {
|
|
730
|
+
if ((0, _utils.is)('function', onFilterSliderChange_)) onFilterSliderChange_(valueNew, value__);
|
|
731
|
+
}
|
|
732
|
+
}, SliderProps, {
|
|
733
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-slider'], SliderProps.className, classes.slider])
|
|
734
|
+
}))
|
|
735
|
+
}, {
|
|
736
|
+
label: l('Invert'),
|
|
737
|
+
Icon: IconInvert,
|
|
738
|
+
value: 'invert',
|
|
739
|
+
method: _utils2.canvasInvert,
|
|
740
|
+
renderIconButton: (value__, selected_, onChangeFilter_) => /*#__PURE__*/_react.default.createElement(Tooltip, (0, _extends2.default)({
|
|
741
|
+
key: value__,
|
|
742
|
+
name: l('Invert')
|
|
743
|
+
}, TooltipProps), /*#__PURE__*/_react.default.createElement(IconButton, (0, _extends2.default)({
|
|
744
|
+
version: "outlined",
|
|
745
|
+
selected: selected_,
|
|
746
|
+
onClick: () => onChangeFilter_(value__)
|
|
747
|
+
}, IconButtonProps), /*#__PURE__*/_react.default.createElement(IconInvert, null))),
|
|
748
|
+
renderSlider: (value__, filterValuesCopy_, onFilterSliderChange_) => /*#__PURE__*/_react.default.createElement(Slider, (0, _extends2.default)({
|
|
749
|
+
key: value__,
|
|
750
|
+
valueDefault: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0,
|
|
751
|
+
value: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0,
|
|
752
|
+
min: 0,
|
|
753
|
+
max: 1,
|
|
754
|
+
precision: 1,
|
|
755
|
+
marks: [{
|
|
756
|
+
value: 0,
|
|
757
|
+
label: 'Not inverted'
|
|
758
|
+
}, {
|
|
759
|
+
value: 1,
|
|
760
|
+
label: 'Inverted'
|
|
761
|
+
}],
|
|
762
|
+
labels: true,
|
|
763
|
+
tooltip: true,
|
|
764
|
+
onChange: valueNew => {
|
|
765
|
+
if ((0, _utils.is)('function', onFilterSliderChange_)) onFilterSliderChange_(valueNew, value__);
|
|
766
|
+
}
|
|
767
|
+
}, SliderProps, {
|
|
768
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-slider'], SliderProps.className, classes.slider])
|
|
769
|
+
}))
|
|
770
|
+
}, {
|
|
771
|
+
label: l('Old photo'),
|
|
772
|
+
Icon: IconOldPhoto,
|
|
773
|
+
value: 'old_photo',
|
|
774
|
+
method: _utils2.canvasOldPhoto,
|
|
775
|
+
renderIconButton: (value__, selected_, onChangeFilter_) => /*#__PURE__*/_react.default.createElement(Tooltip, (0, _extends2.default)({
|
|
776
|
+
key: value__,
|
|
777
|
+
name: l('Old photo')
|
|
778
|
+
}, TooltipProps), /*#__PURE__*/_react.default.createElement(IconButton, (0, _extends2.default)({
|
|
779
|
+
version: "outlined",
|
|
780
|
+
selected: selected_,
|
|
781
|
+
onClick: () => onChangeFilter_(value__)
|
|
782
|
+
}, IconButtonProps), /*#__PURE__*/_react.default.createElement(IconOldPhoto, null))),
|
|
783
|
+
renderSlider: (value__, filterValuesCopy_, onFilterSliderChange_) => /*#__PURE__*/_react.default.createElement(Slider, (0, _extends2.default)({
|
|
784
|
+
key: value__,
|
|
785
|
+
valueDefault: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0,
|
|
786
|
+
value: (filterValuesCopy_ === null || filterValuesCopy_ === void 0 ? void 0 : filterValuesCopy_[value__]) || 0,
|
|
787
|
+
min: -40,
|
|
788
|
+
max: 40,
|
|
789
|
+
precision: 1,
|
|
790
|
+
marks: [{
|
|
791
|
+
value: -40,
|
|
792
|
+
label: '-40'
|
|
793
|
+
}, {
|
|
794
|
+
value: 0,
|
|
795
|
+
label: 'No filter'
|
|
796
|
+
}, {
|
|
797
|
+
value: 40,
|
|
798
|
+
label: '40'
|
|
799
|
+
}],
|
|
800
|
+
labels: true,
|
|
801
|
+
tooltip: true,
|
|
802
|
+
onChange: valueNew => {
|
|
803
|
+
if ((0, _utils.is)('function', onFilterSliderChange_)) onFilterSliderChange_(valueNew, value__);
|
|
804
|
+
}
|
|
805
|
+
}, SliderProps, {
|
|
806
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-slider'], SliderProps.className, classes.slider])
|
|
807
|
+
}))
|
|
808
|
+
}, ...(filters_ || [])], [filters_]);
|
|
809
|
+
|
|
810
|
+
// Only filters
|
|
811
|
+
if ((0, _utils.is)('array', onlyFilters)) filters = filters.filter(item => onlyFilters.includes(item.value));
|
|
812
|
+
const ImageCropProps = _objectSpread({
|
|
813
|
+
gridLines: true
|
|
814
|
+
}, ImageCropProps_);
|
|
815
|
+
const TooltipProps = _objectSpread({
|
|
816
|
+
position: 'bottom',
|
|
817
|
+
interactive: false
|
|
818
|
+
}, TooltipProps_);
|
|
819
|
+
const IconButtonProps = _objectSpread({
|
|
820
|
+
tonal,
|
|
821
|
+
color: 'inherit'
|
|
822
|
+
}, IconButtonProps_);
|
|
823
|
+
const SliderProps = _objectSpread({
|
|
824
|
+
tonal: false,
|
|
825
|
+
color: 'default'
|
|
826
|
+
}, SliderProps_);
|
|
827
|
+
const ChipProps = _objectSpread({
|
|
828
|
+
size: 'small'
|
|
829
|
+
}, ChipProps_);
|
|
830
|
+
const chips = [{
|
|
831
|
+
label: '1:1',
|
|
832
|
+
value: 1 / 1
|
|
833
|
+
}, {
|
|
834
|
+
label: '4:3',
|
|
835
|
+
value: 4 / 3
|
|
836
|
+
}, {
|
|
837
|
+
label: '16:9',
|
|
838
|
+
value: 16 / 9
|
|
839
|
+
}];
|
|
840
|
+
const options = [filtersOption && {
|
|
841
|
+
label: l('Filters'),
|
|
842
|
+
value: 'filters',
|
|
843
|
+
Icon: IconFilters
|
|
844
|
+
}, cropOption && {
|
|
845
|
+
label: l('Crop'),
|
|
846
|
+
value: 'crop',
|
|
847
|
+
Icon: IconCrop
|
|
848
|
+
}, resizeOption && {
|
|
849
|
+
label: l('Resize'),
|
|
850
|
+
value: 'resize',
|
|
851
|
+
Icon: IconResize
|
|
852
|
+
}, qualityOption && {
|
|
853
|
+
label: l('Quality'),
|
|
854
|
+
value: 'quality',
|
|
855
|
+
Icon: IconQuality
|
|
856
|
+
}].filter(Boolean);
|
|
857
|
+
const MetaTypeProps = {
|
|
858
|
+
version: 'b3'
|
|
859
|
+
};
|
|
860
|
+
const filterValue = filters.find(item_ => item_.value === filter);
|
|
861
|
+
return /*#__PURE__*/_react.default.createElement(Line, (0, _extends2.default)({
|
|
862
|
+
ref: item => {
|
|
863
|
+
if (ref) {
|
|
864
|
+
if ((0, _utils.is)('function', ref)) ref(item);else if (ref !== null && ref !== void 0 && ref.current) ref.current = item;
|
|
865
|
+
}
|
|
866
|
+
refs.root.current = item;
|
|
867
|
+
},
|
|
868
|
+
tonal: tonal,
|
|
869
|
+
color: color,
|
|
870
|
+
gap: 0,
|
|
871
|
+
direction: "column",
|
|
872
|
+
Component: Surface,
|
|
873
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-root', `onesy-ImageEdit-size-${size}`], className, classes.root])
|
|
874
|
+
}, other), /*#__PURE__*/_react.default.createElement(Line, {
|
|
875
|
+
gap: 0,
|
|
876
|
+
direction: "column",
|
|
877
|
+
align: "center",
|
|
878
|
+
justify: "center",
|
|
879
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-image-wrapper'], classes.imageWrapper])
|
|
880
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
881
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-canvas-wrapper'], classes.canvasWrapper])
|
|
882
|
+
}, /*#__PURE__*/_react.default.createElement("canvas", {
|
|
883
|
+
ref: refs.canvasMain,
|
|
884
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-canvas', 'onesy-ImageEdit-canvas-main'], classes.canvas, classes.canvas_main])
|
|
885
|
+
}), open && openedOption === 'crop' && /*#__PURE__*/_react.default.createElement(ImageCrop, (0, _extends2.default)({
|
|
886
|
+
image: valueCopy,
|
|
887
|
+
aspectRatio: aspectRatio ? aspectRatio : undefined,
|
|
888
|
+
onSelectorChange: selector => setSelection(selector)
|
|
889
|
+
}, ImageCropProps, {
|
|
890
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-image-crop'], ImageCropProps.className, classes.imageCrop]),
|
|
891
|
+
style: {
|
|
892
|
+
width: valueCopy === null || valueCopy === void 0 ? void 0 : valueCopy.width,
|
|
893
|
+
height: valueCopy === null || valueCopy === void 0 ? void 0 : valueCopy.height
|
|
894
|
+
}
|
|
895
|
+
})))), (filtersOption || cropOption || resizeOption || qualityOption) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Expand, {
|
|
896
|
+
in: !!open,
|
|
897
|
+
parent: refs.root.current,
|
|
898
|
+
style: {
|
|
899
|
+
width: '100%'
|
|
900
|
+
}
|
|
901
|
+
}, /*#__PURE__*/_react.default.createElement(Line, {
|
|
902
|
+
gap: 0,
|
|
903
|
+
ref: refs.option,
|
|
904
|
+
direction: "column",
|
|
905
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-option'], classes.option])
|
|
906
|
+
}, openedOption === 'filters' && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Expand, {
|
|
907
|
+
in: !!filterValue,
|
|
908
|
+
parent: refs.option.current,
|
|
909
|
+
style: {
|
|
910
|
+
width: '100%'
|
|
911
|
+
}
|
|
912
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
913
|
+
style: {
|
|
914
|
+
paddingInline: theme.methods.space.value(5, 'px'),
|
|
915
|
+
paddingBottom: theme.methods.space.value(5, 'px')
|
|
916
|
+
}
|
|
917
|
+
}, (0, _utils.is)('function', filterValue === null || filterValue === void 0 ? void 0 : filterValue.renderSlider) && (filterValue === null || filterValue === void 0 ? void 0 : filterValue.renderSlider(filterValue.value, refs.filterValuesCopy.current, onFilterSliderChange)))), /*#__PURE__*/_react.default.createElement(Line, {
|
|
918
|
+
gap: 1,
|
|
919
|
+
direction: "row",
|
|
920
|
+
align: "center",
|
|
921
|
+
justify: "flex-start",
|
|
922
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-filters'], classes.filters])
|
|
923
|
+
}, filters.map(item => (0, _utils.is)('function', item.renderIconButton) && item.renderIconButton(item.value, item.value === filter, onChangeFilter)))), openedOption === 'crop' && /*#__PURE__*/_react.default.createElement(Line, {
|
|
924
|
+
gap: 1,
|
|
925
|
+
direction: "row",
|
|
926
|
+
align: "center",
|
|
927
|
+
justify: "center",
|
|
928
|
+
style: {
|
|
929
|
+
width: '100%'
|
|
930
|
+
}
|
|
931
|
+
}, chips.map((item, index) => /*#__PURE__*/_react.default.createElement(Chip, (0, _extends2.default)({
|
|
932
|
+
key: index,
|
|
933
|
+
selected: aspectRatio === item.value,
|
|
934
|
+
onClick: () => onChangeAspectRatio(item.value)
|
|
935
|
+
}, ChipProps), item.label)), /*#__PURE__*/_react.default.createElement(Line, {
|
|
936
|
+
gap: 0,
|
|
937
|
+
direction: "row",
|
|
938
|
+
align: "center",
|
|
939
|
+
justify: "center"
|
|
940
|
+
}, (0, _utils.is)('function', renderInput) ? renderInput(value, valueCopy, aspectRatioCustom, onChangeAspectRatioCustom, 'left') : /*#__PURE__*/_react.default.createElement(NumericTextField, {
|
|
941
|
+
tonal: tonal,
|
|
942
|
+
color: "default",
|
|
943
|
+
version: "text",
|
|
944
|
+
size: "small",
|
|
945
|
+
min: 1,
|
|
946
|
+
value: aspectRatioCustom === null || aspectRatioCustom === void 0 ? void 0 : aspectRatioCustom[0],
|
|
947
|
+
onChange: valueNew => onChangeAspectRatioCustom(+valueNew),
|
|
948
|
+
increment: false,
|
|
949
|
+
decrement: false,
|
|
950
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-option-input'], classes.optionInput]),
|
|
951
|
+
style: {
|
|
952
|
+
width: 24
|
|
953
|
+
}
|
|
954
|
+
}), /*#__PURE__*/_react.default.createElement(Type, null, ":"), (0, _utils.is)('function', renderInput) ? renderInput(value, valueCopy, aspectRatioCustom, onChangeAspectRatioCustom, 'right') : /*#__PURE__*/_react.default.createElement(NumericTextField, {
|
|
955
|
+
tonal: tonal,
|
|
956
|
+
color: "default",
|
|
957
|
+
version: "text",
|
|
958
|
+
size: "small",
|
|
959
|
+
min: 1,
|
|
960
|
+
value: aspectRatioCustom === null || aspectRatioCustom === void 0 ? void 0 : aspectRatioCustom[1],
|
|
961
|
+
onChange: valueNew => onChangeAspectRatioCustom(+valueNew, false),
|
|
962
|
+
increment: false,
|
|
963
|
+
decrement: false,
|
|
964
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-option-input'], classes.optionInput]),
|
|
965
|
+
style: {
|
|
966
|
+
width: 24
|
|
967
|
+
}
|
|
968
|
+
}))), openedOption === 'resize' && /*#__PURE__*/_react.default.createElement(Line, {
|
|
969
|
+
direction: "row",
|
|
970
|
+
align: "center",
|
|
971
|
+
justify: "center",
|
|
972
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-inputs'], classes.inputs])
|
|
973
|
+
}, (0, _utils.is)('function', renderInput) ? renderInput(value, valueCopy, resize, onChangeResize, 'width') : /*#__PURE__*/_react.default.createElement(NumericTextField, {
|
|
974
|
+
tonal: tonal,
|
|
975
|
+
name: l('Width'),
|
|
976
|
+
color: "default",
|
|
977
|
+
version: "text",
|
|
978
|
+
size: "small",
|
|
979
|
+
min: 1,
|
|
980
|
+
max: value === null || value === void 0 ? void 0 : value.width,
|
|
981
|
+
valueDefault: value === null || value === void 0 ? void 0 : value.width,
|
|
982
|
+
value: resize === null || resize === void 0 ? void 0 : resize[0],
|
|
983
|
+
onChange: valueNew => onChangeResize(valueNew)
|
|
984
|
+
}), (0, _utils.is)('function', renderInput) ? renderInput(value, valueCopy, resize, onChangeResize, 'height') : /*#__PURE__*/_react.default.createElement(NumericTextField, {
|
|
985
|
+
tonal: tonal,
|
|
986
|
+
name: l('Height'),
|
|
987
|
+
color: "default",
|
|
988
|
+
version: "text",
|
|
989
|
+
size: "small",
|
|
990
|
+
min: 1,
|
|
991
|
+
max: value === null || value === void 0 ? void 0 : value.height,
|
|
992
|
+
valueDefault: value === null || value === void 0 ? void 0 : value.height,
|
|
993
|
+
value: resize === null || resize === void 0 ? void 0 : resize[1],
|
|
994
|
+
onChange: valueNew => onChangeResize(valueNew, false)
|
|
995
|
+
})), openedOption === 'quality' && /*#__PURE__*/_react.default.createElement(Line, {
|
|
996
|
+
gap: 3,
|
|
997
|
+
direction: "row",
|
|
998
|
+
align: "center",
|
|
999
|
+
style: {
|
|
1000
|
+
width: '100%'
|
|
1001
|
+
}
|
|
1002
|
+
}, /*#__PURE__*/_react.default.createElement(Slider, (0, _extends2.default)({
|
|
1003
|
+
valueDefault: quality,
|
|
1004
|
+
value: quality,
|
|
1005
|
+
min: 1,
|
|
1006
|
+
max: 100,
|
|
1007
|
+
precision: 1,
|
|
1008
|
+
marks: [{
|
|
1009
|
+
value: 1
|
|
1010
|
+
}, {
|
|
1011
|
+
value: 50
|
|
1012
|
+
}, {
|
|
1013
|
+
value: 100
|
|
1014
|
+
}],
|
|
1015
|
+
tooltip: true,
|
|
1016
|
+
onChange: onChangeQuality
|
|
1017
|
+
}, SliderProps, {
|
|
1018
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-slider'], SliderProps.className, classes.slider])
|
|
1019
|
+
})), /*#__PURE__*/_react.default.createElement(NumericTextField, {
|
|
1020
|
+
tonal: tonal,
|
|
1021
|
+
color: "default",
|
|
1022
|
+
version: "text",
|
|
1023
|
+
size: "small",
|
|
1024
|
+
min: 1,
|
|
1025
|
+
max: 100,
|
|
1026
|
+
value: quality,
|
|
1027
|
+
increment: false,
|
|
1028
|
+
decrement: false,
|
|
1029
|
+
onChange: valueNew => onChangeQuality(+valueNew),
|
|
1030
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-option-input'], classes.optionInput]),
|
|
1031
|
+
style: {
|
|
1032
|
+
width: 34
|
|
1033
|
+
}
|
|
1034
|
+
})), /*#__PURE__*/_react.default.createElement(Line, {
|
|
1035
|
+
gap: 1,
|
|
1036
|
+
direction: "row",
|
|
1037
|
+
align: "center",
|
|
1038
|
+
justify: "center",
|
|
1039
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-action'], classes.action])
|
|
1040
|
+
}, (0, _utils.is)('function', renderSave) ? renderSave(onSave) : /*#__PURE__*/_react.default.createElement(Tooltip, (0, _extends2.default)({
|
|
1041
|
+
name: l('Save')
|
|
1042
|
+
}, TooltipProps), /*#__PURE__*/_react.default.createElement(IconButton, (0, _extends2.default)({
|
|
1043
|
+
version: "outlined",
|
|
1044
|
+
onClick: onSave
|
|
1045
|
+
}, IconButtonProps), /*#__PURE__*/_react.default.createElement(IconSave, null))), (0, _utils.is)('function', renderCancel) ? renderCancel(onSave) : /*#__PURE__*/_react.default.createElement(Tooltip, (0, _extends2.default)({
|
|
1046
|
+
name: l('Cancel')
|
|
1047
|
+
}, TooltipProps), /*#__PURE__*/_react.default.createElement(IconButton, (0, _extends2.default)({
|
|
1048
|
+
version: "outlined",
|
|
1049
|
+
onClick: onCancel
|
|
1050
|
+
}, IconButtonProps), /*#__PURE__*/_react.default.createElement(IconCancel, null))))), /*#__PURE__*/_react.default.createElement(Divider, {
|
|
1051
|
+
color: "inherit",
|
|
1052
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-divider'], classes.divider])
|
|
1053
|
+
})), /*#__PURE__*/_react.default.createElement(Line, {
|
|
1054
|
+
direction: "column",
|
|
1055
|
+
align: "center",
|
|
1056
|
+
justify: "center",
|
|
1057
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-options'], classes.options])
|
|
1058
|
+
}, /*#__PURE__*/_react.default.createElement(Line, {
|
|
1059
|
+
gap: 1,
|
|
1060
|
+
direction: "row",
|
|
1061
|
+
justify: "flex-start"
|
|
1062
|
+
}, options.map((item, index) => (0, _utils.is)('function', renderOption) ? renderOption(item, open && openOption === item.value, openOption) : /*#__PURE__*/_react.default.createElement(Tooltip, (0, _extends2.default)({
|
|
1063
|
+
key: index,
|
|
1064
|
+
name: item.label
|
|
1065
|
+
}, TooltipProps), /*#__PURE__*/_react.default.createElement(IconButton, (0, _extends2.default)({
|
|
1066
|
+
version: "outlined",
|
|
1067
|
+
selected: open && openedOption === item.value,
|
|
1068
|
+
onClick: () => openOption(item.value)
|
|
1069
|
+
}, IconButtonProps), /*#__PURE__*/_react.default.createElement(item.Icon, null)))), /*#__PURE__*/_react.default.createElement(Line, {
|
|
1070
|
+
gap: 0,
|
|
1071
|
+
direction: "row",
|
|
1072
|
+
align: "center"
|
|
1073
|
+
}, downloadOption && (0, _utils.is)('function', renderDownload) ? renderDownload(onDownload) : /*#__PURE__*/_react.default.createElement(Tooltip, (0, _extends2.default)({
|
|
1074
|
+
name: l('Download')
|
|
1075
|
+
}, TooltipProps), /*#__PURE__*/_react.default.createElement(IconButton, (0, _extends2.default)({
|
|
1076
|
+
version: "text",
|
|
1077
|
+
onClick: onDownload
|
|
1078
|
+
}, IconButtonProps), /*#__PURE__*/_react.default.createElement(IconDownload, null))), (0, _utils.is)('function', renderOptionClear) ? renderOptionClear(onReset) : /*#__PURE__*/_react.default.createElement(Tooltip, (0, _extends2.default)({
|
|
1079
|
+
name: l('Reset')
|
|
1080
|
+
}, TooltipProps), /*#__PURE__*/_react.default.createElement(IconButton, (0, _extends2.default)({
|
|
1081
|
+
version: "text",
|
|
1082
|
+
onClick: onReset
|
|
1083
|
+
}, IconButtonProps), /*#__PURE__*/_react.default.createElement(IconClear, null))))))), children, meta && value && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(Divider, {
|
|
1084
|
+
color: "inherit",
|
|
1085
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-divider'], classes.divider])
|
|
1086
|
+
}), /*#__PURE__*/_react.default.createElement(Line, {
|
|
1087
|
+
gap: 1,
|
|
1088
|
+
direction: "row",
|
|
1089
|
+
align: "center",
|
|
1090
|
+
justify: "center",
|
|
1091
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ImageEdit', theme) && ['onesy-ImageEdit-meta'], classes.meta])
|
|
1092
|
+
}, /*#__PURE__*/_react.default.createElement(Type, MetaTypeProps, l('Dimensions'), ": ", (_ref = !open ? value : valueCopy) === null || _ref === void 0 ? void 0 : _ref.width, "x", (_ref2 = !open ? value : valueCopy) === null || _ref2 === void 0 ? void 0 : _ref2.height), /*#__PURE__*/_react.default.createElement(Type, MetaTypeProps, "\xB7"), /*#__PURE__*/_react.default.createElement(Type, MetaTypeProps, l('Size'), ": ", size))));
|
|
788
1093
|
});
|
|
789
1094
|
ImageEdit.displayName = 'onesy-ImageEdit';
|
|
790
|
-
exports.default = ImageEdit;
|
|
1095
|
+
var _default = exports.default = ImageEdit;
|