@julseb-lib/react 0.0.84 → 0.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1620 -1624
- package/dist/index.css +60 -100
- package/dist/index.es.js +12964 -14976
- package/dist/index.umd.js +1519 -1523
- package/dist/lib/Mixins.tsx +85 -80
- package/dist/lib/Variables.ts +1 -31
- package/dist/lib/components/Accordion/Accordion.tsx +72 -75
- package/dist/lib/components/Accordion/AccordionButton.tsx +3 -5
- package/dist/lib/components/Accordion/AccordionContent.tsx +3 -4
- package/dist/lib/components/Accordion/AccordionItem.tsx +60 -58
- package/dist/lib/components/Accordion/index.ts +0 -2
- package/dist/lib/components/Accordion/styles.tsx +0 -2
- package/dist/lib/components/Accordion/subtypes.ts +0 -2
- package/dist/lib/components/Accordion/types.ts +0 -2
- package/dist/lib/components/Alert/Alert.tsx +72 -70
- package/dist/lib/components/Alert/index.ts +0 -2
- package/dist/lib/components/Alert/styles.tsx +0 -2
- package/dist/lib/components/Alert/types.ts +0 -2
- package/dist/lib/components/Aside/Aside.tsx +36 -37
- package/dist/lib/components/Aside/index.ts +0 -2
- package/dist/lib/components/Aside/styles.tsx +8 -6
- package/dist/lib/components/Aside/types.ts +0 -3
- package/dist/lib/components/Autocomplete/Autocomplete.tsx +287 -283
- package/dist/lib/components/Autocomplete/index.ts +0 -2
- package/dist/lib/components/Autocomplete/styles.tsx +0 -2
- package/dist/lib/components/Autocomplete/types.ts +2 -3
- package/dist/lib/components/Avatar/Avatar.tsx +132 -130
- package/dist/lib/components/Avatar/AvatarFunction.tsx +112 -119
- package/dist/lib/components/Avatar/index.ts +0 -2
- package/dist/lib/components/Avatar/styles.tsx +0 -2
- package/dist/lib/components/Avatar/types.ts +0 -2
- package/dist/lib/components/BackToTop/BackToTop.tsx +84 -81
- package/dist/lib/components/BackToTop/index.ts +0 -2
- package/dist/lib/components/BackToTop/styles.tsx +0 -2
- package/dist/lib/components/BackToTop/types.ts +0 -2
- package/dist/lib/components/Badge/Badge.tsx +80 -77
- package/dist/lib/components/Badge/index.ts +0 -2
- package/dist/lib/components/Badge/styles.tsx +0 -2
- package/dist/lib/components/Badge/types.ts +0 -2
- package/dist/lib/components/Breadcrumbs/BreadcrumbItem.tsx +3 -4
- package/dist/lib/components/Breadcrumbs/Breadcrumbs.tsx +54 -44
- package/dist/lib/components/Breadcrumbs/BreadcrumbsFn.tsx +57 -69
- package/dist/lib/components/Breadcrumbs/index.ts +0 -2
- package/dist/lib/components/Breadcrumbs/styles.tsx +0 -2
- package/dist/lib/components/Breadcrumbs/subtypes.ts +0 -2
- package/dist/lib/components/Breadcrumbs/types.ts +0 -2
- package/dist/lib/components/Burger/Burger.tsx +54 -53
- package/dist/lib/components/Burger/index.ts +0 -2
- package/dist/lib/components/Burger/styles.tsx +0 -2
- package/dist/lib/components/Burger/types.ts +0 -2
- package/dist/lib/components/Button/Button.tsx +120 -120
- package/dist/lib/components/Button/index.ts +0 -2
- package/dist/lib/components/Button/styles.tsx +0 -2
- package/dist/lib/components/Button/subtypes.ts +0 -2
- package/dist/lib/components/Button/types.ts +0 -2
- package/dist/lib/components/ButtonGroup/ButtonGroup.tsx +120 -142
- package/dist/lib/components/ButtonGroup/ButtonGroupButton.tsx +61 -74
- package/dist/lib/components/ButtonGroup/ButtonGroupToggle.tsx +69 -80
- package/dist/lib/components/ButtonGroup/index.ts +0 -2
- package/dist/lib/components/ButtonGroup/styles.tsx +0 -2
- package/dist/lib/components/ButtonGroup/subtypes.ts +3 -2
- package/dist/lib/components/ButtonGroup/types.ts +0 -2
- package/dist/lib/components/ButtonIcon/ButtonFunction.tsx +74 -85
- package/dist/lib/components/ButtonIcon/ButtonIcon.tsx +128 -129
- package/dist/lib/components/ButtonIcon/index.ts +0 -2
- package/dist/lib/components/ButtonIcon/styles.tsx +0 -2
- package/dist/lib/components/ButtonIcon/subtypes.ts +0 -2
- package/dist/lib/components/ButtonIcon/types.ts +0 -2
- package/dist/lib/components/Card/Card.tsx +119 -126
- package/dist/lib/components/Card/index.ts +0 -2
- package/dist/lib/components/Card/styles.tsx +0 -2
- package/dist/lib/components/Card/types.ts +0 -2
- package/dist/lib/components/CodeContainer/CodeContainer.tsx +109 -111
- package/dist/lib/components/CodeContainer/index.ts +0 -2
- package/dist/lib/components/CodeContainer/styles.tsx +0 -2
- package/dist/lib/components/CodeContainer/types.ts +0 -2
- package/dist/lib/components/ComponentsMixins/ComponentsMixins.tsx +0 -7
- package/dist/lib/components/ComponentsMixins/hooks/useKeyboardNavigation.tsx +0 -2
- package/dist/lib/components/ComponentsMixins/index.ts +0 -2
- package/dist/lib/components/ComponentsMixins/types.ts +0 -2
- package/dist/lib/components/Cover/Cover.tsx +72 -65
- package/dist/lib/components/Cover/index.ts +0 -2
- package/dist/lib/components/Cover/styles.tsx +0 -2
- package/dist/lib/components/Cover/types.ts +0 -2
- package/dist/lib/components/Datepicker/Calendar.tsx +1 -2
- package/dist/lib/components/Datepicker/Datepicker.tsx +209 -208
- package/dist/lib/components/Datepicker/data.ts +0 -2
- package/dist/lib/components/Datepicker/index.ts +0 -2
- package/dist/lib/components/Datepicker/styles.tsx +0 -2
- package/dist/lib/components/Datepicker/types.ts +0 -2
- package/dist/lib/components/DragList/DragList.tsx +104 -110
- package/dist/lib/components/DragList/DragListItem.tsx +156 -163
- package/dist/lib/components/DragList/index.ts +0 -2
- package/dist/lib/components/DragList/styles.tsx +0 -2
- package/dist/lib/components/DragList/types.ts +0 -6
- package/dist/lib/components/Drawer/Drawer.tsx +98 -95
- package/dist/lib/components/Drawer/index.ts +0 -2
- package/dist/lib/components/Drawer/styles.tsx +0 -2
- package/dist/lib/components/Drawer/types.ts +0 -2
- package/dist/lib/components/Dropdown/Dropdown.tsx +87 -78
- package/dist/lib/components/Dropdown/DropdownContainer.tsx +35 -26
- package/dist/lib/components/Dropdown/DropdownItem.tsx +89 -89
- package/dist/lib/components/Dropdown/index.ts +0 -2
- package/dist/lib/components/Dropdown/styles.tsx +1 -2
- package/dist/lib/components/Dropdown/types.ts +0 -8
- package/dist/lib/components/Fade/Fade.tsx +44 -32
- package/dist/lib/components/Fade/index.ts +0 -2
- package/dist/lib/components/Fade/styles.tsx +0 -2
- package/dist/lib/components/Fade/types.ts +0 -2
- package/dist/lib/components/Fallback/Fallback.tsx +13 -10
- package/dist/lib/components/Fallback/index.ts +0 -2
- package/dist/lib/components/Fieldset/Fieldset.tsx +101 -97
- package/dist/lib/components/Fieldset/index.ts +0 -2
- package/dist/lib/components/Fieldset/styles.tsx +0 -2
- package/dist/lib/components/Fieldset/types.ts +0 -2
- package/dist/lib/components/Flexbox/Flexbox.tsx +67 -63
- package/dist/lib/components/Flexbox/index.ts +0 -2
- package/dist/lib/components/Flexbox/styles.tsx +0 -2
- package/dist/lib/components/Flexbox/types.ts +0 -2
- package/dist/lib/components/Footer/Footer.tsx +87 -90
- package/dist/lib/components/Footer/FooterLink.tsx +8 -8
- package/dist/lib/components/Footer/FooterLogo.tsx +3 -4
- package/dist/lib/components/Footer/index.ts +0 -2
- package/dist/lib/components/Footer/styles.tsx +0 -2
- package/dist/lib/components/Footer/subtypes.ts +2 -2
- package/dist/lib/components/Footer/types.ts +0 -6
- package/dist/lib/components/Form/Form.tsx +145 -136
- package/dist/lib/components/Form/index.ts +0 -2
- package/dist/lib/components/Form/styles.tsx +0 -2
- package/dist/lib/components/Form/types.ts +0 -2
- package/dist/lib/components/FullBleed/FullBleed.tsx +42 -39
- package/dist/lib/components/FullBleed/index.ts +0 -2
- package/dist/lib/components/FullBleed/styles.tsx +0 -2
- package/dist/lib/components/FullBleed/types.ts +0 -2
- package/dist/lib/components/Grid/Grid.tsx +65 -60
- package/dist/lib/components/Grid/index.ts +0 -2
- package/dist/lib/components/Grid/styles.tsx +0 -2
- package/dist/lib/components/Grid/types.ts +0 -2
- package/dist/lib/components/Header/Header.tsx +185 -176
- package/dist/lib/components/Header/HeaderBurger.tsx +42 -50
- package/dist/lib/components/Header/HeaderLogo.tsx +3 -4
- package/dist/lib/components/Header/HeaderNav.tsx +4 -6
- package/dist/lib/components/Header/HeaderNavLink.tsx +3 -4
- package/dist/lib/components/Header/HeaderSearch.tsx +3 -5
- package/dist/lib/components/Header/index.ts +0 -2
- package/dist/lib/components/Header/styles.tsx +0 -2
- package/dist/lib/components/Header/subtypes.ts +3 -11
- package/dist/lib/components/Header/types.ts +0 -2
- package/dist/lib/components/Highlight/Highlight.tsx +40 -38
- package/dist/lib/components/Highlight/index.ts +0 -2
- package/dist/lib/components/Highlight/types.ts +0 -2
- package/dist/lib/components/Hr/Hr.tsx +45 -43
- package/dist/lib/components/Hr/index.ts +0 -2
- package/dist/lib/components/Hr/styles.tsx +0 -2
- package/dist/lib/components/Hr/types.ts +0 -2
- package/dist/lib/components/Icon/Icon.tsx +36 -36
- package/dist/lib/components/Icon/index.ts +0 -2
- package/dist/lib/components/Icon/styles.tsx +0 -2
- package/dist/lib/components/Icon/types.ts +2 -2
- package/dist/lib/components/IconMenu/IconMenu.tsx +127 -136
- package/dist/lib/components/IconMenu/IconMenuItem.tsx +69 -68
- package/dist/lib/components/IconMenu/index.ts +0 -2
- package/dist/lib/components/IconMenu/styles.tsx +0 -2
- package/dist/lib/components/IconMenu/types.ts +0 -6
- package/dist/lib/components/Image/Image.tsx +109 -95
- package/dist/lib/components/Image/ImageFunction.tsx +41 -49
- package/dist/lib/components/Image/index.ts +0 -2
- package/dist/lib/components/Image/styles.tsx +0 -2
- package/dist/lib/components/Image/types.ts +0 -2
- package/dist/lib/components/Input/Input.tsx +105 -131
- package/dist/lib/components/Input/index.ts +0 -2
- package/dist/lib/components/Input/styles.tsx +0 -2
- package/dist/lib/components/Input/subtypes.ts +2 -22
- package/dist/lib/components/Input/templates/ColorInput.tsx +31 -37
- package/dist/lib/components/Input/templates/DateInput.tsx +92 -101
- package/dist/lib/components/Input/templates/FileInput.tsx +48 -54
- package/dist/lib/components/Input/templates/PasswordInput.tsx +166 -178
- package/dist/lib/components/Input/templates/SearchInput.tsx +105 -113
- package/dist/lib/components/Input/templates/SelectInput.tsx +87 -93
- package/dist/lib/components/Input/templates/TextInput.tsx +88 -94
- package/dist/lib/components/Input/templates/TextareaInput.tsx +34 -40
- package/dist/lib/components/Input/templates/TimeInput.tsx +91 -100
- package/dist/lib/components/Input/types.ts +0 -2
- package/dist/lib/components/InputCheck/InputCheck.tsx +122 -115
- package/dist/lib/components/InputCheck/index.ts +0 -2
- package/dist/lib/components/InputCheck/styles.tsx +0 -2
- package/dist/lib/components/InputCheck/types.ts +2 -3
- package/dist/lib/components/InputComponents/components/InputAndListContainer.tsx +28 -37
- package/dist/lib/components/InputComponents/components/InputButton.tsx +3 -4
- package/dist/lib/components/InputComponents/components/InputContainer.tsx +3 -4
- package/dist/lib/components/InputComponents/components/InputIcon.tsx +3 -4
- package/dist/lib/components/InputComponents/components/InputLeftContainer.tsx +8 -9
- package/dist/lib/components/InputComponents/components/InputPrefix.tsx +3 -4
- package/dist/lib/components/InputComponents/components/InputRightContainer.tsx +3 -4
- package/dist/lib/components/InputComponents/components/InputSuffix.tsx +3 -4
- package/dist/lib/components/InputComponents/components/InputValidationHelper.tsx +3 -4
- package/dist/lib/components/InputComponents/components/InputValidationIcon.tsx +3 -4
- package/dist/lib/components/InputComponents/components/InputWrapper.tsx +3 -4
- package/dist/lib/components/InputComponents/components/ListInput.tsx +26 -35
- package/dist/lib/components/InputComponents/components/ListInputItem.tsx +31 -39
- package/dist/lib/components/InputComponents/index.ts +0 -2
- package/dist/lib/components/InputComponents/styles.tsx +0 -22
- package/dist/lib/components/InputComponents/types.ts +4 -31
- package/dist/lib/components/InputContainer/HelperBottom.tsx +0 -2
- package/dist/lib/components/InputContainer/InputContainer.tsx +122 -111
- package/dist/lib/components/InputContainer/index.ts +0 -2
- package/dist/lib/components/InputContainer/styles.tsx +0 -2
- package/dist/lib/components/InputContainer/subtypes.ts +0 -2
- package/dist/lib/components/InputContainer/types.ts +0 -2
- package/dist/lib/components/InputCounter/InputCounter.tsx +255 -246
- package/dist/lib/components/InputCounter/index.ts +0 -2
- package/dist/lib/components/InputCounter/styles.tsx +0 -2
- package/dist/lib/components/InputCounter/subtypes.ts +0 -2
- package/dist/lib/components/InputCounter/types.ts +0 -2
- package/dist/lib/components/InputImage/EmptyContainer.tsx +3 -4
- package/dist/lib/components/InputImage/HoverContainer.tsx +3 -4
- package/dist/lib/components/InputImage/InputImage.tsx +139 -130
- package/dist/lib/components/InputImage/index.ts +0 -2
- package/dist/lib/components/InputImage/styles.tsx +0 -2
- package/dist/lib/components/InputImage/subtypes.ts +0 -2
- package/dist/lib/components/InputImage/types.ts +0 -2
- package/dist/lib/components/InputPhone/InputPhone.tsx +306 -300
- package/dist/lib/components/InputPhone/index.ts +0 -2
- package/dist/lib/components/InputPhone/styles.tsx +0 -2
- package/dist/lib/components/InputPhone/types.ts +0 -2
- package/dist/lib/components/InputPhone/utils/countries.ts +0 -2
- package/dist/lib/components/InputPin/InputPin.tsx +123 -124
- package/dist/lib/components/InputPin/index.ts +0 -2
- package/dist/lib/components/InputPin/styles.tsx +0 -2
- package/dist/lib/components/InputPin/subtypes.ts +0 -2
- package/dist/lib/components/InputPin/types.ts +0 -2
- package/dist/lib/components/InputSlider/InputSlider.tsx +172 -163
- package/dist/lib/components/InputSlider/Slider.tsx +39 -48
- package/dist/lib/components/InputSlider/index.ts +0 -2
- package/dist/lib/components/InputSlider/styles.tsx +0 -2
- package/dist/lib/components/InputSlider/types.ts +2 -3
- package/dist/lib/components/Key/Key.tsx +40 -39
- package/dist/lib/components/Key/index.ts +0 -2
- package/dist/lib/components/Key/styles.tsx +0 -2
- package/dist/lib/components/Key/types.ts +0 -2
- package/dist/lib/components/LibIcon/LibIcon.tsx +3 -4
- package/dist/lib/components/LibIcon/index.ts +0 -2
- package/dist/lib/components/LibIcon/types.ts +0 -2
- package/dist/lib/components/Link/Link.tsx +79 -59
- package/dist/lib/components/Link/index.ts +0 -2
- package/dist/lib/components/Link/types.ts +0 -2
- package/dist/lib/components/Linkify/Linkify.tsx +26 -19
- package/dist/lib/components/Linkify/index.ts +0 -2
- package/dist/lib/components/Linkify/types.ts +0 -2
- package/dist/lib/components/ListGroup/ListGroup.tsx +96 -99
- package/dist/lib/components/ListGroup/ListGroupItem.tsx +149 -142
- package/dist/lib/components/ListGroup/ListGroupTitle.tsx +43 -43
- package/dist/lib/components/ListGroup/index.ts +0 -2
- package/dist/lib/components/ListGroup/styles.tsx +0 -2
- package/dist/lib/components/ListGroup/types.ts +2 -10
- package/dist/lib/components/Loader/Loader.tsx +32 -22
- package/dist/lib/components/Loader/index.ts +0 -2
- package/dist/lib/components/Loader/styles.tsx +0 -2
- package/dist/lib/components/Loader/templates/LoaderFour.tsx +24 -21
- package/dist/lib/components/Loader/templates/LoaderOne.tsx +3 -6
- package/dist/lib/components/Loader/templates/LoaderThree.tsx +27 -26
- package/dist/lib/components/Loader/templates/LoaderTwo.tsx +22 -21
- package/dist/lib/components/Loader/types.ts +0 -2
- package/dist/lib/components/Main/Main.tsx +42 -39
- package/dist/lib/components/Main/index.ts +0 -2
- package/dist/lib/components/Main/styles.tsx +5 -5
- package/dist/lib/components/Main/types.ts +1 -5
- package/dist/lib/components/MarkdownContainer/MarkdownContainer.tsx +35 -28
- package/dist/lib/components/MarkdownContainer/index.ts +0 -2
- package/dist/lib/components/MarkdownContainer/styles.tsx +0 -2
- package/dist/lib/components/MarkdownContainer/types.ts +0 -2
- package/dist/lib/components/MarkdownEditor/MarkdownEditor.tsx +153 -149
- package/dist/lib/components/MarkdownEditor/MdEditorButtons/EditorButtonTitles.tsx +0 -2
- package/dist/lib/components/MarkdownEditor/MdEditorButtons/EditorButtons.tsx +0 -2
- package/dist/lib/components/MarkdownEditor/MdEditorButtons/MarkdownButtons.tsx +0 -2
- package/dist/lib/components/MarkdownEditor/MdEditorInput.tsx +68 -78
- package/dist/lib/components/MarkdownEditor/index.ts +0 -2
- package/dist/lib/components/MarkdownEditor/markdown-buttons.tsx +0 -2
- package/dist/lib/components/MarkdownEditor/styles.tsx +2 -2
- package/dist/lib/components/MarkdownEditor/subtypes.ts +3 -4
- package/dist/lib/components/MarkdownEditor/types.ts +0 -2
- package/dist/lib/components/Masonry/Masonry.tsx +59 -53
- package/dist/lib/components/Masonry/index.ts +0 -2
- package/dist/lib/components/Masonry/styles.tsx +0 -2
- package/dist/lib/components/Masonry/types.ts +0 -2
- package/dist/lib/components/Masonry/utils.ts +0 -2
- package/dist/lib/components/Messaging/Message.tsx +95 -89
- package/dist/lib/components/Messaging/MessageForm.tsx +126 -117
- package/dist/lib/components/Messaging/MessagesContainer.tsx +26 -13
- package/dist/lib/components/Messaging/MessagesList.tsx +117 -113
- package/dist/lib/components/Messaging/Messaging.tsx +97 -97
- package/dist/lib/components/Messaging/index.ts +0 -2
- package/dist/lib/components/Messaging/styles.tsx +1 -2
- package/dist/lib/components/Messaging/types.ts +0 -12
- package/dist/lib/components/Meta/Meta.tsx +69 -0
- package/dist/lib/components/Meta/index.ts +3 -0
- package/dist/lib/components/Meta/types.ts +14 -0
- package/dist/lib/components/Modal/Modal.tsx +108 -101
- package/dist/lib/components/Modal/index.ts +0 -2
- package/dist/lib/components/Modal/styles.tsx +0 -2
- package/dist/lib/components/Modal/types.ts +0 -2
- package/dist/lib/components/PageLayout/PageLayout.tsx +88 -72
- package/dist/lib/components/PageLayout/index.ts +0 -2
- package/dist/lib/components/PageLayout/types.ts +20 -22
- package/dist/lib/components/PageLoading/PageLoading.tsx +57 -54
- package/dist/lib/components/PageLoading/index.ts +0 -2
- package/dist/lib/components/PageLoading/styles.tsx +0 -2
- package/dist/lib/components/PageLoading/types.ts +0 -2
- package/dist/lib/components/Pagination/Pagination.tsx +218 -221
- package/dist/lib/components/Pagination/PaginationButton.tsx +45 -44
- package/dist/lib/components/Pagination/index.ts +0 -2
- package/dist/lib/components/Pagination/styles.tsx +0 -2
- package/dist/lib/components/Pagination/types.ts +0 -6
- package/dist/lib/components/Paginator/Paginator.tsx +150 -145
- package/dist/lib/components/Paginator/index.ts +0 -2
- package/dist/lib/components/Paginator/styles.tsx +0 -2
- package/dist/lib/components/Paginator/types.ts +0 -2
- package/dist/lib/components/ProgressBar/ProgressBar.tsx +58 -52
- package/dist/lib/components/ProgressBar/index.ts +0 -2
- package/dist/lib/components/ProgressBar/styles.tsx +0 -2
- package/dist/lib/components/ProgressBar/types.ts +0 -2
- package/dist/lib/components/ProgressCircle/Circle.tsx +3 -4
- package/dist/lib/components/ProgressCircle/ProgressCircle.tsx +80 -77
- package/dist/lib/components/ProgressCircle/ProgressCircleFn.tsx +34 -40
- package/dist/lib/components/ProgressCircle/Value.tsx +3 -4
- package/dist/lib/components/ProgressCircle/clean-percentage.ts +0 -2
- package/dist/lib/components/ProgressCircle/index.ts +0 -2
- package/dist/lib/components/ProgressCircle/styles.tsx +0 -2
- package/dist/lib/components/ProgressCircle/subtypes.ts +0 -2
- package/dist/lib/components/ProgressCircle/types.ts +0 -2
- package/dist/lib/components/Rating/Rating.tsx +156 -155
- package/dist/lib/components/Rating/index.ts +0 -2
- package/dist/lib/components/Rating/styles.tsx +0 -2
- package/dist/lib/components/Rating/types.ts +0 -2
- package/dist/lib/components/ResetScroll/ResetScroll.tsx +9 -4
- package/dist/lib/components/ResetScroll/index.ts +0 -2
- package/dist/lib/components/Section/Section.tsx +39 -24
- package/dist/lib/components/Section/index.ts +0 -2
- package/dist/lib/components/Section/styles.tsx +0 -2
- package/dist/lib/components/Section/types.ts +0 -2
- package/dist/lib/components/Select/Select.tsx +238 -232
- package/dist/lib/components/Select/SelectButton.tsx +48 -54
- package/dist/lib/components/Select/index.ts +0 -2
- package/dist/lib/components/Select/styles.tsx +0 -2
- package/dist/lib/components/Select/subtypes.ts +1 -2
- package/dist/lib/components/Select/types.ts +0 -2
- package/dist/lib/components/Skeleton/Skeleton.tsx +56 -54
- package/dist/lib/components/Skeleton/SkeletonCard.tsx +73 -70
- package/dist/lib/components/Skeleton/SkeletonShine.tsx +24 -20
- package/dist/lib/components/Skeleton/index.ts +0 -2
- package/dist/lib/components/Skeleton/styles.tsx +1 -9
- package/dist/lib/components/Skeleton/subtypes.ts +0 -2
- package/dist/lib/components/Skeleton/types.ts +0 -2
- package/dist/lib/components/Slideshow/Slideshow.tsx +163 -190
- package/dist/lib/components/Slideshow/SlideshowButton.tsx +3 -4
- package/dist/lib/components/Slideshow/SlideshowPagination.tsx +3 -4
- package/dist/lib/components/Slideshow/index.ts +0 -2
- package/dist/lib/components/Slideshow/styles.tsx +0 -2
- package/dist/lib/components/Slideshow/subtypes.ts +0 -2
- package/dist/lib/components/Slideshow/types.ts +0 -2
- package/dist/lib/components/SrOnly/SrOnly.tsx +28 -17
- package/dist/lib/components/SrOnly/index.ts +0 -2
- package/dist/lib/components/SrOnly/styles.tsx +0 -2
- package/dist/lib/components/SrOnly/types.ts +0 -2
- package/dist/lib/components/Stepper/Step.tsx +106 -102
- package/dist/lib/components/Stepper/Stepper.tsx +83 -87
- package/dist/lib/components/Stepper/index.ts +0 -2
- package/dist/lib/components/Stepper/styles.tsx +0 -2
- package/dist/lib/components/Stepper/types.ts +0 -6
- package/dist/lib/components/Sticky/Sticky.tsx +38 -24
- package/dist/lib/components/Sticky/index.ts +0 -2
- package/dist/lib/components/Sticky/styles.tsx +0 -2
- package/dist/lib/components/Sticky/types.ts +0 -2
- package/dist/lib/components/Table/TBody.tsx +22 -12
- package/dist/lib/components/Table/THead.tsx +22 -12
- package/dist/lib/components/Table/Table.tsx +114 -110
- package/dist/lib/components/Table/Td.tsx +29 -20
- package/dist/lib/components/Table/Tr.tsx +18 -12
- package/dist/lib/components/Table/index.ts +0 -2
- package/dist/lib/components/Table/styles.tsx +0 -2
- package/dist/lib/components/Table/types.ts +0 -12
- package/dist/lib/components/Tabs/TabButton.tsx +47 -43
- package/dist/lib/components/Tabs/TabItem.tsx +38 -27
- package/dist/lib/components/Tabs/Tabs.tsx +109 -106
- package/dist/lib/components/Tabs/TabsButtonsContainer.tsx +42 -40
- package/dist/lib/components/Tabs/TabsContainer.tsx +30 -17
- package/dist/lib/components/Tabs/index.ts +0 -2
- package/dist/lib/components/Tabs/styles.tsx +0 -2
- package/dist/lib/components/Tabs/types.ts +0 -12
- package/dist/lib/components/Tag/Tag.tsx +91 -87
- package/dist/lib/components/Tag/index.ts +0 -2
- package/dist/lib/components/Tag/styles.tsx +0 -2
- package/dist/lib/components/Tag/types.ts +0 -2
- package/dist/lib/components/Text/Text.tsx +52 -50
- package/dist/lib/components/Text/index.ts +0 -2
- package/dist/lib/components/Text/styles.tsx +22 -2
- package/dist/lib/components/Text/subtypes.ts +0 -2
- package/dist/lib/components/Text/templates/Blockquote.tsx +25 -31
- package/dist/lib/components/Text/templates/Dl.tsx +25 -31
- package/dist/lib/components/Text/templates/Em.tsx +25 -31
- package/dist/lib/components/Text/templates/H1.tsx +27 -33
- package/dist/lib/components/Text/templates/H2.tsx +27 -33
- package/dist/lib/components/Text/templates/H3.tsx +27 -33
- package/dist/lib/components/Text/templates/H4.tsx +27 -33
- package/dist/lib/components/Text/templates/H5.tsx +27 -33
- package/dist/lib/components/Text/templates/H6.tsx +25 -31
- package/dist/lib/components/Text/templates/Ol.tsx +25 -31
- package/dist/lib/components/Text/templates/P.tsx +25 -31
- package/dist/lib/components/Text/templates/Small.tsx +25 -31
- package/dist/lib/components/Text/templates/Strong.tsx +25 -31
- package/dist/lib/components/Text/templates/Ul.tsx +25 -31
- package/dist/lib/components/Text/types.ts +0 -2
- package/dist/lib/components/TextIcon/TextIcon.tsx +88 -92
- package/dist/lib/components/TextIcon/index.ts +0 -2
- package/dist/lib/components/TextIcon/styles.tsx +0 -2
- package/dist/lib/components/TextIcon/types.ts +0 -2
- package/dist/lib/components/TextIcon/utils.ts +0 -1
- package/dist/lib/components/Timepicker/Timepicker.tsx +249 -237
- package/dist/lib/components/Timepicker/index.ts +0 -2
- package/dist/lib/components/Timepicker/styles.tsx +0 -2
- package/dist/lib/components/Timepicker/types.ts +0 -2
- package/dist/lib/components/Toast/Toast.tsx +160 -168
- package/dist/lib/components/Toast/Toaster.tsx +108 -120
- package/dist/lib/components/Toast/index.ts +1 -3
- package/dist/lib/components/Toast/styles.tsx +0 -2
- package/dist/lib/components/Toast/types.ts +0 -2
- package/dist/lib/components/Tooltip/Tooltip.tsx +113 -104
- package/dist/lib/components/Tooltip/index.ts +0 -2
- package/dist/lib/components/Tooltip/styles.tsx +0 -2
- package/dist/lib/components/Tooltip/types.ts +0 -2
- package/dist/lib/components/Truncate/Truncate.tsx +105 -90
- package/dist/lib/components/Truncate/index.ts +0 -2
- package/dist/lib/components/Truncate/styles.tsx +1 -2
- package/dist/lib/components/Truncate/types.ts +0 -2
- package/dist/lib/components/Video/Video.tsx +63 -55
- package/dist/lib/components/Video/index.ts +0 -2
- package/dist/lib/components/Video/styles.tsx +0 -2
- package/dist/lib/components/Video/types.ts +0 -2
- package/dist/lib/components/Wrapper/Wrapper.tsx +44 -37
- package/dist/lib/components/Wrapper/index.ts +0 -2
- package/dist/lib/components/Wrapper/styles.tsx +6 -3
- package/dist/lib/components/Wrapper/types.ts +0 -2
- package/dist/lib/components/Youtube/Youtube.tsx +42 -37
- package/dist/lib/components/Youtube/index.ts +0 -2
- package/dist/lib/components/Youtube/styles.tsx +0 -2
- package/dist/lib/components/Youtube/types.ts +0 -2
- package/dist/lib/context/Theme.context.tsx +21 -13
- package/dist/lib/context/Toaster/Toaster.context.tsx +18 -18
- package/dist/lib/context/Toaster/index.ts +1 -3
- package/dist/lib/context/Toaster/toast.reducer.ts +0 -2
- package/dist/lib/hooks/index.ts +0 -2
- package/dist/lib/hooks/useClickOutside.tsx +14 -9
- package/dist/lib/hooks/useCopyToClipboard.tsx +9 -4
- package/dist/lib/hooks/useDebounce.tsx +11 -6
- package/dist/lib/hooks/useExportData.tsx +14 -4
- package/dist/lib/hooks/useFetch.tsx +11 -6
- package/dist/lib/hooks/useForm.tsx +16 -6
- package/dist/lib/hooks/useIsOverflow.ts +16 -14
- package/dist/lib/hooks/useKeyPress.tsx +12 -6
- package/dist/lib/hooks/useMaxWidth.tsx +9 -5
- package/dist/lib/hooks/useMergeRefs.ts +15 -12
- package/dist/lib/hooks/useMinWidth.tsx +9 -5
- package/dist/lib/hooks/usePaginatedData.tsx +11 -6
- package/dist/lib/hooks/usePagination.tsx +18 -8
- package/dist/lib/hooks/useTouchScreen.tsx +8 -4
- package/dist/lib/hooks/useTranslation.tsx +18 -5
- package/dist/lib/icons/ArrowUp.tsx +3 -4
- package/dist/lib/icons/Bold.tsx +3 -4
- package/dist/lib/icons/Calendar.tsx +3 -4
- package/dist/lib/icons/CaretDown.tsx +3 -4
- package/dist/lib/icons/Check.tsx +3 -4
- package/dist/lib/icons/CheckCircle.tsx +3 -4
- package/dist/lib/icons/ChevronDown.tsx +3 -4
- package/dist/lib/icons/ChevronLeft.tsx +3 -4
- package/dist/lib/icons/ChevronRight.tsx +3 -4
- package/dist/lib/icons/ChevronUp.tsx +3 -4
- package/dist/lib/icons/Clipboard.tsx +3 -4
- package/dist/lib/icons/Clock.tsx +3 -4
- package/dist/lib/icons/Close.tsx +3 -4
- package/dist/lib/icons/CloseCircle.tsx +3 -4
- package/dist/lib/icons/Code.tsx +3 -4
- package/dist/lib/icons/CodeBlock.tsx +3 -4
- package/dist/lib/icons/Comment.tsx +3 -4
- package/dist/lib/icons/Drag.tsx +3 -4
- package/dist/lib/icons/Edit.tsx +3 -4
- package/dist/lib/icons/EditorCode.tsx +3 -4
- package/dist/lib/icons/EditorLive.tsx +3 -4
- package/dist/lib/icons/EditorPreview.tsx +3 -4
- package/dist/lib/icons/Hide.tsx +3 -4
- package/dist/lib/icons/Image.tsx +3 -4
- package/dist/lib/icons/Italic.tsx +3 -4
- package/dist/lib/icons/Link.tsx +3 -4
- package/dist/lib/icons/Minus.tsx +3 -4
- package/dist/lib/icons/OrderedList.tsx +3 -4
- package/dist/lib/icons/Plus.tsx +3 -4
- package/dist/lib/icons/Quote.tsx +3 -4
- package/dist/lib/icons/Search.tsx +3 -4
- package/dist/lib/icons/Send.tsx +3 -4
- package/dist/lib/icons/Separator.tsx +3 -4
- package/dist/lib/icons/Show.tsx +3 -4
- package/dist/lib/icons/Star.tsx +3 -4
- package/dist/lib/icons/StarFull.tsx +3 -4
- package/dist/lib/icons/Strikethrough.tsx +3 -4
- package/dist/lib/icons/Underline.tsx +3 -8
- package/dist/lib/icons/UnorderedList.tsx +3 -4
- package/dist/lib/icons/index.ts +0 -2
- package/dist/lib/icons/styles.tsx +0 -2
- package/dist/lib/icons/types.ts +0 -2
- package/dist/lib/index.css +60 -100
- package/dist/lib/index.ts +2 -4
- package/dist/lib/lib-utils/append-styles.ts +0 -2
- package/dist/lib/lib-utils/colors-maps.ts +144 -146
- package/dist/lib/lib-utils/generate-lib-tokens.ts +0 -2
- package/dist/lib/lib-utils/get-highlighted-text.tsx +0 -2
- package/dist/lib/lib-utils/get-icon-size-from-font.ts +0 -2
- package/dist/lib/lib-utils/index.ts +0 -2
- package/dist/lib/lib-utils/round-icon-size.ts +0 -2
- package/dist/lib/lib-utils/transfom-search-keys.ts +1 -3
- package/dist/lib/modules-declare.d.ts +1 -0
- package/dist/lib/types/component-items.ts +2 -38
- package/dist/lib/types/components-props.ts +1 -2
- package/dist/lib/types/{type-values.ts → design-tokens.ts} +2 -3
- package/dist/lib/types/generate-int-range.ts +0 -2
- package/dist/lib/types/global.ts +74 -82
- package/dist/lib/types/index.ts +1 -3
- package/dist/lib/types/theme.ts +0 -2
- package/dist/lib/utils/StyleSheetManager.tsx +0 -2
- package/dist/lib/utils/index.ts +0 -2
- package/dist/lib/utils/linkify-text.tsx +0 -2
- package/dist/lib/utils/options-markdown.ts +0 -2
- package/dist/lib/utils/set-default-theme.ts +1 -3
- package/package.json +106 -107
- package/dist/lib/components/Helmet/Helmet.tsx +0 -65
- package/dist/lib/components/Helmet/index.ts +0 -3
- package/dist/lib/components/Helmet/types.ts +0 -18
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { forwardRef } from "react"
|
|
1
|
+
import type { FC } from "react"
|
|
4
2
|
import { StyledMessagesContainer } from "./styles"
|
|
5
3
|
import type { ILibMessagesContainer } from "./types"
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* MessagesContainer component for wrapping chat messages in a styled scrollable container.
|
|
7
|
+
*
|
|
8
|
+
* @component
|
|
10
9
|
* @extends HTMLDivElement
|
|
11
|
-
* @
|
|
12
|
-
* @
|
|
13
|
-
* @
|
|
10
|
+
* @param {Object} props - MessagesContainer props.
|
|
11
|
+
* @param {string} [props.data-testid] - Test id for testing purposes.
|
|
12
|
+
* @param {ElementType} [props.as] - Custom element type to render as.
|
|
13
|
+
* @param {Ref<HTMLDivElement>} [props.ref] - Ref forwarded to the root element.
|
|
14
|
+
* @param {ReactNode} [props.children] - Messages or content to display inside the container.
|
|
15
|
+
* @param {any} [props.rest] - Additional props passed to the root element.
|
|
16
|
+
* @returns {JSX.Element} The rendered MessagesContainer component.
|
|
17
|
+
*
|
|
18
|
+
* @see https://documentation-components-react.vercel.app/components/messaging
|
|
19
|
+
* @example
|
|
20
|
+
* <MessagesContainer>
|
|
21
|
+
* <Message type="sent" text="Hello!" />
|
|
22
|
+
* <Message type="received" text="Hi!" />
|
|
23
|
+
* </MessagesContainer>
|
|
14
24
|
*/
|
|
15
|
-
export const MessagesContainer =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
export const MessagesContainer: FC<ILibMessagesContainer> = ({
|
|
26
|
+
"data-testid": testid,
|
|
27
|
+
as,
|
|
28
|
+
ref,
|
|
29
|
+
children,
|
|
30
|
+
...rest
|
|
31
|
+
}) => {
|
|
19
32
|
return (
|
|
20
33
|
<StyledMessagesContainer
|
|
21
34
|
data-testid={testid}
|
|
@@ -26,4 +39,4 @@ export const MessagesContainer = forwardRef<
|
|
|
26
39
|
{children}
|
|
27
40
|
</StyledMessagesContainer>
|
|
28
41
|
)
|
|
29
|
-
}
|
|
42
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { forwardRef, useRef, useState, useEffect } from "react"
|
|
1
|
+
import { useRef, useState, useEffect, type FC } from "react"
|
|
4
2
|
import classNames from "classnames"
|
|
5
3
|
import { Text, useMergeRefs } from "../../"
|
|
6
4
|
import { roundIconSize } from "../../lib-utils"
|
|
@@ -9,128 +7,134 @@ import { StyledMessagesList, MessageListBottom, ScrollButton } from "./styles"
|
|
|
9
7
|
import type { ILibMessagesList } from "./types"
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* MessagesList component for displaying a scrollable list of chat messages with optional empty state and scroll-to-bottom button.
|
|
11
|
+
*
|
|
12
|
+
* @component
|
|
14
13
|
* @extends HTMLDivElement & ILibFlexbox
|
|
15
|
-
* @
|
|
16
|
-
* @
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
14
|
+
* @param {Object} props - MessagesList props.
|
|
15
|
+
* @param {string} [props.data-testid] - Test id for testing purposes.
|
|
16
|
+
* @param {ElementType} [props.as] - Custom element type to render as.
|
|
17
|
+
* @param {Ref<HTMLDivElement>} [props.ref] - Ref forwarded to the root element.
|
|
18
|
+
* @param {ReactNode[]} [props.children] - Array of message elements to display.
|
|
19
|
+
* @param {string} [props.emptyText="No message yet."] - Text to display when there are no messages.
|
|
20
|
+
* @param {boolean} [props.hideScrollButton] - Hide the scroll-to-bottom button.
|
|
21
|
+
* @param {{ icon?: string | JSX.Element; iconSize?: number; positionFromBottom?: number; iconBaseUrl?: string }} [props.scrollButton] - Customization for the scroll button (only if hideScrollButton is false or undefined).
|
|
22
|
+
* @param {any} [props.rest] - Additional props passed to the root element.
|
|
23
|
+
* @returns {JSX.Element} The rendered MessagesList component.
|
|
24
|
+
*
|
|
25
|
+
* @see https://documentation-components-react.vercel.app/components/messaging
|
|
26
|
+
* @example
|
|
27
|
+
* <MessagesList>
|
|
28
|
+
* <Message type="sent" text="Hello!" />
|
|
29
|
+
* <Message type="received" text="Hi!" />
|
|
30
|
+
* </MessagesList>
|
|
22
31
|
*/
|
|
23
|
-
export const MessagesList
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
ref
|
|
36
|
-
) => {
|
|
37
|
-
const [isButtonVisible, setIsButtonVisible] = useState(false)
|
|
32
|
+
export const MessagesList: FC<ILibMessagesList> = ({
|
|
33
|
+
"data-testid": testid,
|
|
34
|
+
as,
|
|
35
|
+
ref,
|
|
36
|
+
className,
|
|
37
|
+
children,
|
|
38
|
+
emptyText: textEmpty = "No message yet.",
|
|
39
|
+
scrollButton,
|
|
40
|
+
hideScrollButton,
|
|
41
|
+
...rest
|
|
42
|
+
}) => {
|
|
43
|
+
const [isButtonVisible, setIsButtonVisible] = useState(false)
|
|
38
44
|
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
const containerRef = useRef<HTMLDivElement>(null as any)
|
|
46
|
+
const bottomRef = useRef<HTMLDivElement>(null as any)
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
const scrollToBottom = () => {
|
|
49
|
+
if (containerRef && containerRef.current) {
|
|
50
|
+
const scrollHeight = containerRef?.current?.scrollHeight
|
|
51
|
+
const height = containerRef?.current?.clientHeight
|
|
52
|
+
const maxScrollTop = scrollHeight - height
|
|
47
53
|
|
|
48
|
-
|
|
49
|
-
maxScrollTop > 0 ? maxScrollTop : 0
|
|
54
|
+
containerRef.current.scrollTop = maxScrollTop > 0 ? maxScrollTop : 0
|
|
50
55
|
|
|
51
|
-
|
|
52
|
-
}
|
|
56
|
+
setIsButtonVisible(false)
|
|
53
57
|
}
|
|
58
|
+
}
|
|
54
59
|
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (children?.length) scrollToBottom()
|
|
57
62
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
containerRef?.current?.addEventListener("scroll", () => {
|
|
64
|
+
const scroll = containerRef.current?.scrollTop
|
|
65
|
+
const height = containerRef?.current?.clientHeight
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
67
|
+
if (scroll && height) {
|
|
68
|
+
if (scroll < height) {
|
|
69
|
+
setIsButtonVisible(true)
|
|
70
|
+
} else {
|
|
71
|
+
setIsButtonVisible(false)
|
|
68
72
|
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const isEmpty: boolean = !children?.length
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
}, [children?.length])
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
<StyledMessagesList
|
|
76
|
-
data-testid={testid}
|
|
77
|
-
ref={useMergeRefs([ref, containerRef])}
|
|
78
|
-
as={as}
|
|
79
|
-
className={className}
|
|
80
|
-
flexDirection="column"
|
|
81
|
-
gap="s"
|
|
82
|
-
justifyContent={isEmpty ? "center" : "flex-start"}
|
|
83
|
-
alignItems={isEmpty ? "center" : "stretch"}
|
|
84
|
-
{...rest}
|
|
85
|
-
>
|
|
86
|
-
{children?.length ? (
|
|
87
|
-
<>
|
|
88
|
-
{children}
|
|
77
|
+
const isEmpty: boolean = !children?.length
|
|
89
78
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
79
|
+
return (
|
|
80
|
+
<StyledMessagesList
|
|
81
|
+
data-testid={testid}
|
|
82
|
+
ref={useMergeRefs([ref, containerRef])}
|
|
83
|
+
as={as}
|
|
84
|
+
className={className}
|
|
85
|
+
flexDirection="column"
|
|
86
|
+
gap="s"
|
|
87
|
+
justifyContent={isEmpty ? "center" : "flex-start"}
|
|
88
|
+
alignItems={isEmpty ? "center" : "stretch"}
|
|
89
|
+
{...rest}
|
|
90
|
+
>
|
|
91
|
+
{children?.length ? (
|
|
92
|
+
<>
|
|
93
|
+
{children}
|
|
105
94
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
className={
|
|
110
|
-
{
|
|
111
|
-
MessagesListScrollButton: className,
|
|
112
|
-
},
|
|
113
|
-
{ Visible: isButtonVisible }
|
|
114
|
-
)}
|
|
115
|
-
id="message-container-scroll-button"
|
|
116
|
-
icon={
|
|
117
|
-
scrollButton?.icon ?? (
|
|
118
|
-
<ChevronDown
|
|
119
|
-
data-testid={
|
|
120
|
-
testid && `${testid}.ScrollButton.Icon`
|
|
121
|
-
}
|
|
122
|
-
className={className && "ScrollIcon"}
|
|
123
|
-
size={roundIconSize(32)}
|
|
124
|
-
/>
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
onClick={scrollToBottom}
|
|
128
|
-
variant="ghost"
|
|
129
|
-
shadow="s"
|
|
130
|
-
iconBaseUrl={scrollButton?.iconBaseUrl}
|
|
95
|
+
<MessageListBottom
|
|
96
|
+
data-testid={testid && `${testid}.ListBottom`}
|
|
97
|
+
ref={bottomRef}
|
|
98
|
+
className={className && "MessageListBottom"}
|
|
131
99
|
/>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
100
|
+
</>
|
|
101
|
+
) : (
|
|
102
|
+
<Text
|
|
103
|
+
data-testid={testid && `${testid}.EmptyText`}
|
|
104
|
+
color="gray"
|
|
105
|
+
className={className && "MessageListEmptyText"}
|
|
106
|
+
>
|
|
107
|
+
{textEmpty}
|
|
108
|
+
</Text>
|
|
109
|
+
)}
|
|
110
|
+
|
|
111
|
+
{!hideScrollButton && (
|
|
112
|
+
<ScrollButton
|
|
113
|
+
data-testid={testid && `${testid}.ScrollButton`}
|
|
114
|
+
className={classNames(
|
|
115
|
+
{
|
|
116
|
+
MessagesListScrollButton: className,
|
|
117
|
+
},
|
|
118
|
+
{ Visible: isButtonVisible }
|
|
119
|
+
)}
|
|
120
|
+
id="message-container-scroll-button"
|
|
121
|
+
icon={
|
|
122
|
+
scrollButton?.icon ?? (
|
|
123
|
+
<ChevronDown
|
|
124
|
+
data-testid={
|
|
125
|
+
testid && `${testid}.ScrollButton.Icon`
|
|
126
|
+
}
|
|
127
|
+
className={className && "ScrollIcon"}
|
|
128
|
+
size={roundIconSize(32)}
|
|
129
|
+
/>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
onClick={scrollToBottom}
|
|
133
|
+
variant="ghost"
|
|
134
|
+
shadow="s"
|
|
135
|
+
iconBaseUrl={scrollButton?.iconBaseUrl}
|
|
136
|
+
/>
|
|
137
|
+
)}
|
|
138
|
+
</StyledMessagesList>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { forwardRef, useState } from "react"
|
|
1
|
+
import { useState, type FC } from "react"
|
|
4
2
|
import { getToday, uuid, stringifyPx } from "@julseb-lib/utils"
|
|
5
3
|
import { Hr } from "../../"
|
|
6
4
|
import { appendStyles } from "../../lib-utils"
|
|
@@ -11,47 +9,51 @@ import { Message } from "./Message"
|
|
|
11
9
|
import type { ILibMessaging } from "./types"
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* Messaging component for displaying a complete chat interface with messages list, input form, and scroll handling.
|
|
13
|
+
*
|
|
14
|
+
* @component
|
|
16
15
|
* @extends HTMLDivElement
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
20
|
-
* @
|
|
21
|
-
* @
|
|
22
|
-
* @
|
|
23
|
-
* @
|
|
24
|
-
* @
|
|
16
|
+
* @param {Object} props - Messaging props.
|
|
17
|
+
* @param {string} [props.data-testid] - Test id for testing purposes.
|
|
18
|
+
* @param {ElementType} [props.as] - Custom element type to render as.
|
|
19
|
+
* @param {Ref<HTMLDivElement>} [props.ref] - Ref forwarded to the root element.
|
|
20
|
+
* @param {string} [props.className] - Additional class names.
|
|
21
|
+
* @param {Array<LibMessage>} props.items - Array of message objects to display.
|
|
22
|
+
* @param {string} [props.textDateTime] - Text between date and time in messages.
|
|
23
|
+
* @param {string} [props.emptyText] - Text to display when there are no messages.
|
|
24
|
+
* @param {() => void} [props.handleSubmit] - Function to call on form submit.
|
|
25
|
+
* @param {{ message: string; setMessage: React.Dispatch<React.SetStateAction<string>>; placeholder?: string; autoFocus?: boolean }} props.input - Input state and handlers for the message form.
|
|
26
|
+
* @param {{ icon?: string | JSX.Element; text?: string }} [props.button] - Button configuration for the message form.
|
|
27
|
+
* @param {any} [props.rest] - Additional props passed to the root element.
|
|
28
|
+
* @returns {JSX.Element} The rendered Messaging component.
|
|
25
29
|
*
|
|
26
|
-
* @
|
|
27
|
-
* @
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
* @see https://documentation-components-react.vercel.app/components/messaging
|
|
31
|
+
* @example
|
|
32
|
+
* <Messaging
|
|
33
|
+
* items={[
|
|
34
|
+
* { type: "sent", text: "Hello!", date: new Date(), time: "14:30" },
|
|
35
|
+
* { type: "received", text: "Hi!", date: new Date(), time: "14:31" }
|
|
36
|
+
* ]}
|
|
37
|
+
* input={{ message, setMessage, placeholder: "Type a message..." }}
|
|
38
|
+
* handleSubmit={handleSend}
|
|
39
|
+
* />
|
|
35
40
|
*/
|
|
36
|
-
export const Messaging
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
ref
|
|
51
|
-
) => {
|
|
52
|
-
const [inputHeight, setInputHeight] = useState(32)
|
|
41
|
+
export const Messaging: FC<ILibMessaging> = ({
|
|
42
|
+
"data-testid": testid,
|
|
43
|
+
as,
|
|
44
|
+
ref,
|
|
45
|
+
className,
|
|
46
|
+
items,
|
|
47
|
+
textDateTime,
|
|
48
|
+
emptyText,
|
|
49
|
+
handleSubmit,
|
|
50
|
+
input,
|
|
51
|
+
button,
|
|
52
|
+
...rest
|
|
53
|
+
}) => {
|
|
54
|
+
const [inputHeight, setInputHeight] = useState(32)
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
appendStyles(`
|
|
55
57
|
#message-container-scroll-button,
|
|
56
58
|
#messaging-form,
|
|
57
59
|
#messaging-form-input {
|
|
@@ -61,63 +63,61 @@ export const Messaging = forwardRef<HTMLDivElement, ILibMessaging>(
|
|
|
61
63
|
}
|
|
62
64
|
`)
|
|
63
65
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
return (
|
|
67
|
+
<MessagesContainer
|
|
68
|
+
data-testid={testid}
|
|
69
|
+
ref={ref}
|
|
70
|
+
as={as}
|
|
71
|
+
className={className}
|
|
72
|
+
{...rest}
|
|
73
|
+
>
|
|
74
|
+
<MessagesList
|
|
75
|
+
data-testid={testid && `${testid}.MessagesList`}
|
|
76
|
+
className={className && "MessagesList"}
|
|
77
|
+
emptyText={emptyText}
|
|
71
78
|
>
|
|
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
|
-
ref={message.ref}
|
|
100
|
-
textDateTime={textDateTime}
|
|
101
|
-
{...message}
|
|
102
|
-
/>
|
|
103
|
-
))}
|
|
104
|
-
</MessagesList>
|
|
79
|
+
{items
|
|
80
|
+
?.sort(
|
|
81
|
+
(a, b) =>
|
|
82
|
+
new Date(
|
|
83
|
+
`${a.date}-${a.time}` || getToday()
|
|
84
|
+
)?.getTime() -
|
|
85
|
+
new Date(
|
|
86
|
+
`${b.date}-${b.time}` || getToday()
|
|
87
|
+
).getTime()
|
|
88
|
+
)
|
|
89
|
+
.map(message => (
|
|
90
|
+
<Message
|
|
91
|
+
key={uuid()}
|
|
92
|
+
data-testid={
|
|
93
|
+
message["data-testid"] ||
|
|
94
|
+
(testid && `${testid}.MessagesList.Message`)
|
|
95
|
+
}
|
|
96
|
+
className={
|
|
97
|
+
message.className || (className && "Message")
|
|
98
|
+
}
|
|
99
|
+
id={message.id}
|
|
100
|
+
ref={message.ref}
|
|
101
|
+
textDateTime={textDateTime}
|
|
102
|
+
{...message}
|
|
103
|
+
/>
|
|
104
|
+
))}
|
|
105
|
+
</MessagesList>
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
<Hr
|
|
108
|
+
data-testid={testid && `${testid}.Separator`}
|
|
109
|
+
className={className && "Separator"}
|
|
110
|
+
/>
|
|
110
111
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
)
|
|
112
|
+
<MessageForm
|
|
113
|
+
data-testid={testid && `${testid}.Form`}
|
|
114
|
+
className={className && "Form"}
|
|
115
|
+
handleSubmit={handleSubmit}
|
|
116
|
+
input={input}
|
|
117
|
+
button={button}
|
|
118
|
+
inputHeight={inputHeight}
|
|
119
|
+
setInputHeight={setInputHeight}
|
|
120
|
+
/>
|
|
121
|
+
</MessagesContainer>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/*=============================================== Messaging styles ===============================================*/
|
|
2
|
-
|
|
3
1
|
import styled from "styled-components"
|
|
4
2
|
import {
|
|
5
3
|
setDefaultTheme,
|
|
@@ -36,6 +34,7 @@ const StyledMessagesContainer = styled.div`
|
|
|
36
34
|
const StyledMessagesList = styled(Flexbox)`
|
|
37
35
|
flex-grow: 1;
|
|
38
36
|
overflow-y: scroll;
|
|
37
|
+
${Mixins.HideScrollbar};
|
|
39
38
|
`
|
|
40
39
|
|
|
41
40
|
const MessageListBottom = styled.div`
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/*=============================================== Messaging types ===============================================*/
|
|
2
|
-
|
|
3
1
|
import type { ReactNode } from "react"
|
|
4
2
|
import type {
|
|
5
3
|
LibComponentBase,
|
|
@@ -11,8 +9,6 @@ import type {
|
|
|
11
9
|
} from "../../types"
|
|
12
10
|
import type { ILibFlexbox } from "../Flexbox/types"
|
|
13
11
|
|
|
14
|
-
/*====================== Messaging ======================*/
|
|
15
|
-
|
|
16
12
|
export interface ILibMessaging
|
|
17
13
|
extends LibComponentBase<HTMLDivElement>,
|
|
18
14
|
MessageFormCommon {
|
|
@@ -24,13 +20,9 @@ export interface ILibMessaging
|
|
|
24
20
|
children?: never
|
|
25
21
|
}
|
|
26
22
|
|
|
27
|
-
/*====================== MessagesContainer ======================*/
|
|
28
|
-
|
|
29
23
|
export interface ILibMessagesContainer
|
|
30
24
|
extends LibComponentBase<HTMLDivElement> {}
|
|
31
25
|
|
|
32
|
-
/*====================== MessagesList ======================*/
|
|
33
|
-
|
|
34
26
|
interface ILibMessagesListBase
|
|
35
27
|
extends LibComponentBase<HTMLDivElement>,
|
|
36
28
|
ILibFlexbox {
|
|
@@ -57,8 +49,6 @@ export type ILibMessagesList =
|
|
|
57
49
|
| MessagesListWithScrollButton
|
|
58
50
|
| MessagesListWithoutScrollButton
|
|
59
51
|
|
|
60
|
-
/*====================== MessageForm ======================*/
|
|
61
|
-
|
|
62
52
|
type MessageFormButtonWithIcon = {
|
|
63
53
|
icon?: LibIcon
|
|
64
54
|
text?: never
|
|
@@ -88,8 +78,6 @@ export interface ILibMessageForm
|
|
|
88
78
|
iconBaseUrl?: string
|
|
89
79
|
}
|
|
90
80
|
|
|
91
|
-
/*====================== Message ======================*/
|
|
92
|
-
|
|
93
81
|
interface ILibMessageBase
|
|
94
82
|
extends LibComponentBase<HTMLDivElement>,
|
|
95
83
|
ILibFlexbox,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { FC } from "react"
|
|
2
|
+
import type { ILibMeta } from "./types"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Meta component for setting document metadata such as title, description, favicon, keywords, author, and Open Graph tags.
|
|
6
|
+
*
|
|
7
|
+
* @component
|
|
8
|
+
* @param {Object} props - Meta props.
|
|
9
|
+
* @param {React.ReactNode} [props.children] - Additional meta or link tags to include.
|
|
10
|
+
* @param {string} [props.title] - Document title.
|
|
11
|
+
* @param {string} [props.favicon] - URL to the favicon.
|
|
12
|
+
* @param {string} [props.description] - Meta description for SEO.
|
|
13
|
+
* @param {string[]} [props.keywords] - Array of keywords for SEO.
|
|
14
|
+
* @param {string} [props.author] - Author of the document.
|
|
15
|
+
* @param {string} [props.type] - Open Graph type (e.g., "website", "article").
|
|
16
|
+
* @param {string} [props.cover] - Open Graph image URL.
|
|
17
|
+
* @param {string} [props.siteName] - Open Graph site name.
|
|
18
|
+
* @param {string} [props.language] - Document language (used for <html lang=""> and og:locale).
|
|
19
|
+
* @returns {JSX.Element} The rendered meta tags.
|
|
20
|
+
*
|
|
21
|
+
* @see https://documentation-components-react.vercel.app/components/meta
|
|
22
|
+
* @example
|
|
23
|
+
* <Meta
|
|
24
|
+
* title="My Page"
|
|
25
|
+
* description="This is my page"
|
|
26
|
+
* keywords={["react", "meta", "seo"]}
|
|
27
|
+
* author="Julien Sebag"
|
|
28
|
+
* favicon="/favicon.ico"
|
|
29
|
+
* type="website"
|
|
30
|
+
* cover="/cover.png"
|
|
31
|
+
* siteName="My Site"
|
|
32
|
+
* language="en"
|
|
33
|
+
* />
|
|
34
|
+
*/
|
|
35
|
+
export const Meta: FC<ILibMeta> = ({
|
|
36
|
+
children,
|
|
37
|
+
title,
|
|
38
|
+
favicon,
|
|
39
|
+
description,
|
|
40
|
+
keywords,
|
|
41
|
+
author,
|
|
42
|
+
type,
|
|
43
|
+
cover,
|
|
44
|
+
siteName,
|
|
45
|
+
language,
|
|
46
|
+
}) => {
|
|
47
|
+
return (
|
|
48
|
+
<>
|
|
49
|
+
<title>{title}</title>
|
|
50
|
+
<meta content="IE=edge" httpEquiv="X-UA-Compatible" />
|
|
51
|
+
<meta
|
|
52
|
+
content="width=device-width, initial-scale=1"
|
|
53
|
+
name="viewport"
|
|
54
|
+
/>
|
|
55
|
+
{children && children}
|
|
56
|
+
{favicon && <link rel="icon" href={favicon} />}
|
|
57
|
+
{description && <meta name="description" content={description} />}
|
|
58
|
+
{keywords && (
|
|
59
|
+
<meta name="keywords" content={keywords?.join(", ")} />
|
|
60
|
+
)}
|
|
61
|
+
{author && <meta name="author" content={author} />}
|
|
62
|
+
<meta property="og:title" content={title} />
|
|
63
|
+
{type && <meta property="og:type" content={type} />}
|
|
64
|
+
{cover && <meta property="og:image" content={cover} />}
|
|
65
|
+
{siteName && <meta property="og:site_name" content={siteName} />}
|
|
66
|
+
{language && <meta property="og:locale" content={language} />}
|
|
67
|
+
</>
|
|
68
|
+
)
|
|
69
|
+
}
|