@forgedevstack/bear 1.2.3 → 1.2.5
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/components/Accordion/Accordion.cjs +1 -1
- package/dist/components/Accordion/Accordion.js +45 -47
- package/dist/components/ActionIcon/ActionIcon.types.d.ts +1 -0
- package/dist/components/ActiveBar/ActiveBar.const.d.ts +1 -0
- package/dist/components/ActiveBar/ActiveBar.types.d.ts +2 -0
- package/dist/components/ActivityItem/ActivityItem.const.d.ts +1 -0
- package/dist/components/ActivityItem/ActivityItem.types.d.ts +2 -0
- package/dist/components/Affix/Affix.types.d.ts +1 -0
- package/dist/components/Alert/Alert.cjs +1 -1
- package/dist/components/Alert/Alert.js +16 -18
- package/dist/components/AlertDialog/AlertDialog.types.d.ts +1 -0
- package/dist/components/Anchor/Anchor.types.d.ts +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.types.d.ts +1 -0
- package/dist/components/AppBar/AppBar.const.d.ts +1 -0
- package/dist/components/AppBar/AppBar.types.d.ts +2 -0
- package/dist/components/AspectRatio/AspectRatio.cjs +1 -1
- package/dist/components/AspectRatio/AspectRatio.const.d.ts +1 -0
- package/dist/components/AspectRatio/AspectRatio.js +9 -1
- package/dist/components/AspectRatio/AspectRatio.types.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.types.d.ts +1 -0
- package/dist/components/Avatar/Avatar.types.d.ts +1 -0
- package/dist/components/BackTop/BackTop.types.d.ts +1 -0
- package/dist/components/Badge/Badge.types.d.ts +1 -0
- package/dist/components/BearLoader/BearLoader.const.d.ts +1 -0
- package/dist/components/BearLoader/BearLoader.types.d.ts +1 -0
- package/dist/components/BearLogo/BearLogo.const.d.ts +1 -0
- package/dist/components/BearLogo/BearLogo.types.d.ts +2 -0
- package/dist/components/Biometric/Biometric.const.d.ts +1 -0
- package/dist/components/Biometric/Biometric.types.d.ts +1 -0
- package/dist/components/Blockquote/Blockquote.types.d.ts +1 -0
- package/dist/components/BottomNavigation/BottomNavigation.const.d.ts +1 -0
- package/dist/components/BottomNavigation/BottomNavigation.types.d.ts +2 -0
- package/dist/components/BottomSheet/BottomSheet.const.d.ts +1 -0
- package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
- package/dist/components/Box/Box.const.d.ts +1 -0
- package/dist/components/Box/Box.types.d.ts +3 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +21 -23
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.js +112 -100
- package/dist/components/Button/Button.types.d.ts +5 -1
- package/dist/components/ButtonGroup/ButtonGroup.const.d.ts +1 -0
- package/dist/components/ButtonGroup/ButtonGroup.types.d.ts +1 -0
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.js +3 -2
- package/dist/components/Calendar/Calendar.types.d.ts +1 -0
- package/dist/components/Card/Card.cjs +1 -1
- package/dist/components/Card/Card.js +15 -17
- package/dist/components/Card/Card.types.d.ts +2 -2
- package/dist/components/CardSkeleton/CardSkeleton.const.d.ts +1 -0
- package/dist/components/CardSkeleton/index.d.ts +2 -0
- package/dist/components/Carousel/Carousel.types.d.ts +1 -0
- package/dist/components/Cascader/Cascader.cjs +1 -1
- package/dist/components/Cascader/Cascader.d.ts +1 -2
- package/dist/components/Cascader/Cascader.js +3 -3
- package/dist/components/Cascader/Cascader.types.d.ts +1 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.js +6 -2
- package/dist/components/Chart/Chart.types.d.ts +1 -0
- package/dist/components/Chat/Chat.const.cjs +1 -1
- package/dist/components/Chat/Chat.const.d.ts +1 -1
- package/dist/components/Chat/Chat.const.js +1 -1
- package/dist/components/Chat/Chat.types.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/Checkbox/Checkbox.const.cjs +1 -0
- package/dist/components/Checkbox/Checkbox.const.d.ts +30 -0
- package/dist/components/Checkbox/Checkbox.const.js +58 -0
- package/dist/components/Checkbox/Checkbox.d.ts +0 -11
- package/dist/components/Checkbox/Checkbox.js +67 -110
- package/dist/components/Checkbox/Checkbox.types.d.ts +3 -12
- package/dist/components/Checkbox/helpers/CheckboxIndicatorIcon.cjs +1 -0
- package/dist/components/Checkbox/helpers/CheckboxIndicatorIcon.d.ts +2 -0
- package/dist/components/Checkbox/helpers/CheckboxIndicatorIcon.js +18 -0
- package/dist/components/Checkbox/helpers/CheckboxIndicatorIcon.types.d.ts +6 -0
- package/dist/components/Checkbox/helpers/index.d.ts +1 -0
- package/dist/components/Checkbox/index.d.ts +2 -2
- package/dist/components/CheckboxCard/CheckboxCard.types.d.ts +1 -0
- package/dist/components/Chip/Chip.const.d.ts +1 -0
- package/dist/components/Chip/Chip.types.d.ts +2 -0
- package/dist/components/CloseButton/CloseButton.const.d.ts +1 -0
- package/dist/components/CloseButton/CloseButton.types.d.ts +1 -0
- package/dist/components/CodeBlock/CodeBlock.cjs +2 -2
- package/dist/components/CodeBlock/CodeBlock.const.d.ts +1 -0
- package/dist/components/CodeBlock/CodeBlock.js +22 -24
- package/dist/components/CodeEditor/CodeEditor.types.d.ts +1 -0
- package/dist/components/Collapsible/Collapsible.const.d.ts +1 -0
- package/dist/components/Collapsible/Collapsible.types.d.ts +2 -0
- package/dist/components/ColorPicker/ColorPicker.types.d.ts +2 -0
- package/dist/components/ColorSwatch/ColorSwatch.cjs +1 -1
- package/dist/components/ColorSwatch/ColorSwatch.js +8 -8
- package/dist/components/ColorSwatch/ColorSwatch.types.d.ts +1 -0
- package/dist/components/Columns/Columns.const.d.ts +1 -0
- package/dist/components/Columns/Columns.types.d.ts +2 -0
- package/dist/components/CommandPalette/CommandPalette.cjs +1 -1
- package/dist/components/CommandPalette/CommandPalette.js +71 -71
- package/dist/components/CommandPalette/CommandPalette.types.d.ts +1 -0
- package/dist/components/Confetti/Confetti.types.d.ts +1 -0
- package/dist/components/Container/Container.const.d.ts +1 -0
- package/dist/components/Container/Container.types.d.ts +1 -0
- package/dist/components/ContextMenu/ContextMenu.cjs +1 -1
- package/dist/components/ContextMenu/ContextMenu.const.cjs +1 -1
- package/dist/components/ContextMenu/ContextMenu.const.d.ts +3 -0
- package/dist/components/ContextMenu/ContextMenu.const.js +13 -10
- package/dist/components/ContextMenu/ContextMenu.d.ts +1 -3
- package/dist/components/ContextMenu/ContextMenu.js +30 -59
- package/dist/components/ContextMenu/ContextMenu.types.d.ts +1 -0
- package/dist/components/ContextMenu/ContextMenu.utils.cjs +1 -1
- package/dist/components/ContextMenu/ContextMenu.utils.d.ts +7 -0
- package/dist/components/ContextMenu/ContextMenu.utils.js +11 -2
- package/dist/components/ContextMenu/components/ContextMenuMenuList/ContextMenuMenuList.cjs +1 -0
- package/dist/components/ContextMenu/components/ContextMenuMenuList/ContextMenuMenuList.d.ts +11 -0
- package/dist/components/ContextMenu/components/ContextMenuMenuList/ContextMenuMenuList.js +69 -0
- package/dist/components/ContextMenu/components/ContextMenuMenuList/index.d.ts +1 -0
- package/dist/components/CopyButton/CopyButton.const.d.ts +1 -0
- package/dist/components/CopyButton/CopyButton.types.d.ts +2 -0
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +1 -0
- package/dist/components/CreditInput/CreditInput.types.d.ts +1 -0
- package/dist/components/CssBaseline/CssBaseline.cjs +1 -0
- package/dist/components/CssBaseline/CssBaseline.const.cjs +5 -0
- package/dist/components/CssBaseline/CssBaseline.const.d.ts +2 -0
- package/dist/components/CssBaseline/CssBaseline.const.js +9 -0
- package/dist/components/CssBaseline/CssBaseline.d.ts +2 -0
- package/dist/components/CssBaseline/CssBaseline.js +24 -0
- package/dist/components/CssBaseline/CssBaseline.types.d.ts +4 -0
- package/dist/components/CssBaseline/index.d.ts +2 -0
- package/dist/components/CurrencyInput/CurrencyInput.types.d.ts +1 -0
- package/dist/components/DataTable/DataTable.const.d.ts +1 -0
- package/dist/components/DataTable/DataTable.types.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.const.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.js +12 -11
- package/dist/components/DatePicker/DatePicker.types.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.types.d.ts +1 -0
- package/dist/components/Descriptions/Descriptions.types.d.ts +1 -0
- package/dist/components/DiffSquares/DiffSquares.cjs +1 -1
- package/dist/components/DiffSquares/DiffSquares.js +11 -11
- package/dist/components/DiffSquares/DiffSquares.types.d.ts +1 -0
- package/dist/components/DiffViewer/DiffViewer.types.d.ts +1 -0
- package/dist/components/Divider/Divider.const.d.ts +1 -0
- package/dist/components/Divider/Divider.types.d.ts +1 -0
- package/dist/components/Dock/Dock.types.d.ts +1 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +44 -39
- package/dist/components/Drawer/Drawer.types.d.ts +5 -10
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.js +3 -2
- package/dist/components/Dropdown/Dropdown.types.d.ts +1 -0
- package/dist/components/Editable/Editable.const.d.ts +1 -0
- package/dist/components/Editable/Editable.types.d.ts +2 -0
- package/dist/components/Em/Em.const.d.ts +1 -0
- package/dist/components/Em/Em.types.d.ts +2 -0
- package/dist/components/EmojiPicker/EmojiPicker.types.d.ts +2 -0
- package/dist/components/EmptyState/EmptyState.const.d.ts +1 -0
- package/dist/components/EmptyState/EmptyState.types.d.ts +2 -0
- package/dist/components/Fab/Fab.const.d.ts +1 -0
- package/dist/components/Fab/Fab.types.d.ts +1 -0
- package/dist/components/Fieldset/Fieldset.types.d.ts +1 -0
- package/dist/components/FileTree/FileTree.const.d.ts +1 -0
- package/dist/components/FileTree/FileTree.types.d.ts +1 -0
- package/dist/components/FileUpload/FileUpload.const.d.ts +1 -0
- package/dist/components/FileUpload/FileUpload.types.d.ts +2 -0
- package/dist/components/Flex/Flex.cjs +1 -1
- package/dist/components/Flex/Flex.const.cjs +1 -0
- package/dist/components/Flex/Flex.const.d.ts +6 -0
- package/dist/components/Flex/Flex.const.js +42 -0
- package/dist/components/Flex/Flex.d.ts +0 -11
- package/dist/components/Flex/Flex.js +28 -67
- package/dist/components/Flex/Flex.types.d.ts +1 -0
- package/dist/components/FloatingChat/FloatingChat.types.d.ts +1 -0
- package/dist/components/Form/Form.types.d.ts +1 -0
- package/dist/components/FormControl/FormControl.cjs +1 -0
- package/dist/components/FormControl/FormControl.const.cjs +1 -0
- package/dist/components/FormControl/FormControl.const.d.ts +5 -0
- package/dist/components/FormControl/FormControl.const.js +8 -0
- package/dist/components/FormControl/FormControl.context.cjs +1 -0
- package/dist/components/FormControl/FormControl.context.d.ts +2 -0
- package/dist/components/FormControl/FormControl.context.js +5 -0
- package/dist/components/FormControl/FormControl.d.ts +2 -0
- package/dist/components/FormControl/FormControl.js +90 -0
- package/dist/components/FormControl/FormControl.types.d.ts +19 -0
- package/dist/components/FormControl/index.d.ts +4 -0
- package/dist/components/FormField/FormField.cjs +1 -1
- package/dist/components/FormField/FormField.js +70 -67
- package/dist/components/FormField/FormField.types.d.ts +2 -0
- package/dist/components/FormSkeleton/FormSkeleton.cjs +1 -0
- package/dist/components/FormSkeleton/FormSkeleton.const.cjs +1 -0
- package/dist/components/FormSkeleton/FormSkeleton.const.d.ts +5 -0
- package/dist/components/FormSkeleton/FormSkeleton.const.js +8 -0
- package/dist/components/FormSkeleton/FormSkeleton.d.ts +2 -0
- package/dist/components/FormSkeleton/FormSkeleton.js +32 -0
- package/dist/components/FormSkeleton/FormSkeleton.types.d.ts +8 -0
- package/dist/components/FormSkeleton/index.d.ts +2 -0
- package/dist/components/Gauge/Gauge.cjs +1 -1
- package/dist/components/Gauge/Gauge.const.cjs +1 -0
- package/dist/components/Gauge/Gauge.const.d.ts +9 -0
- package/dist/components/Gauge/Gauge.const.js +12 -0
- package/dist/components/Gauge/Gauge.js +71 -95
- package/dist/components/Gauge/Gauge.types.d.ts +2 -0
- package/dist/components/Gauge/helpers/GaugeArcSvg.cjs +1 -0
- package/dist/components/Gauge/helpers/GaugeArcSvg.d.ts +14 -0
- package/dist/components/Gauge/helpers/GaugeArcSvg.js +65 -0
- package/dist/components/Gauge/hooks/useGauge.cjs +1 -0
- package/dist/components/Gauge/hooks/useGauge.d.ts +14 -0
- package/dist/components/Gauge/hooks/useGauge.js +42 -0
- package/dist/components/GlowCard/GlowCard.types.d.ts +1 -0
- package/dist/components/GradientText/GradientText.types.d.ts +1 -0
- package/dist/components/Grid/Grid.const.d.ts +1 -0
- package/dist/components/Grid/Grid.types.d.ts +1 -0
- package/dist/components/Heatmap/Heatmap.types.d.ts +1 -0
- package/dist/components/Highlight/Highlight.types.d.ts +1 -0
- package/dist/components/HoverCard/HoverCard.const.d.ts +1 -0
- package/dist/components/HoverCard/HoverCard.types.d.ts +2 -0
- package/dist/components/Icon/Icon.const.d.ts +1 -0
- package/dist/components/Icon/Icon.types.d.ts +1 -0
- package/dist/components/Icon/icons/misc.cjs +1 -1
- package/dist/components/Icon/icons/misc.d.ts +3 -0
- package/dist/components/Icon/icons/misc.js +118 -104
- package/dist/components/Icon/index.d.ts +3 -0
- package/dist/components/Image/Image.const.d.ts +1 -0
- package/dist/components/Image/Image.types.d.ts +2 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.types.d.ts +1 -0
- package/dist/components/ImageGallery/ImageGallery.types.d.ts +1 -0
- package/dist/components/Indicator/Indicator.types.d.ts +1 -0
- package/dist/components/InfiniteScroll/InfiniteScroll.types.d.ts +1 -0
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.const.cjs +1 -0
- package/dist/components/Input/Input.const.d.ts +13 -0
- package/dist/components/Input/Input.const.js +16 -0
- package/dist/components/Input/Input.js +216 -177
- package/dist/components/Input/Input.types.d.ts +8 -27
- package/dist/components/InputGroup/InputGroup.const.d.ts +1 -0
- package/dist/components/InputGroup/InputGroup.types.d.ts +1 -0
- package/dist/components/JsonViewer/JsonViewer.types.d.ts +1 -0
- package/dist/components/Kanban/Kanban.cjs +1 -1
- package/dist/components/Kanban/Kanban.const.d.ts +1 -0
- package/dist/components/Kanban/Kanban.js +9 -8
- package/dist/components/Kanban/Kanban.types.d.ts +2 -0
- package/dist/components/Kbd/Kbd.const.d.ts +1 -0
- package/dist/components/Kbd/Kbd.types.d.ts +2 -0
- package/dist/components/Link/Link.const.d.ts +1 -0
- package/dist/components/Link/Link.types.d.ts +1 -0
- package/dist/components/List/List.cjs +1 -1
- package/dist/components/List/List.const.cjs +1 -0
- package/dist/components/List/List.const.d.ts +11 -0
- package/dist/components/List/List.const.js +18 -0
- package/dist/components/List/List.js +96 -105
- package/dist/components/List/List.types.d.ts +2 -1
- package/dist/components/LoadingOverlay/LoadingOverlay.types.d.ts +1 -0
- package/dist/components/Map/Map.types.d.ts +1 -0
- package/dist/components/Mark/Mark.const.d.ts +1 -0
- package/dist/components/Mark/Mark.types.d.ts +2 -0
- package/dist/components/Marquee/Marquee.types.d.ts +1 -0
- package/dist/components/Masonry/Masonry.types.d.ts +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +1 -0
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.const.d.ts +1 -0
- package/dist/components/MentionsInput/MentionsInput.js +114 -92
- package/dist/components/MentionsInput/MentionsInput.types.d.ts +6 -0
- package/dist/components/Menu/Menu.const.d.ts +1 -0
- package/dist/components/Menu/Menu.types.d.ts +1 -0
- package/dist/components/MessageList/MessageList.cjs +1 -0
- package/dist/components/MessageList/MessageList.const.cjs +1 -0
- package/dist/components/MessageList/MessageList.const.d.ts +23 -0
- package/dist/components/MessageList/MessageList.const.js +30 -0
- package/dist/components/MessageList/MessageList.d.ts +19 -0
- package/dist/components/MessageList/MessageList.js +182 -0
- package/dist/components/MessageList/MessageList.types.d.ts +72 -0
- package/dist/components/MessageList/MessageList.utils.cjs +1 -0
- package/dist/components/MessageList/MessageList.utils.d.ts +6 -0
- package/dist/components/MessageList/MessageList.utils.js +35 -0
- package/dist/components/MessageList/index.d.ts +2 -0
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.js +46 -43
- package/dist/components/Modal/Modal.types.d.ts +3 -1
- package/dist/components/MultiSelect/MultiSelect.const.d.ts +1 -0
- package/dist/components/MultiSelect/MultiSelect.types.d.ts +1 -0
- package/dist/components/NavigableSelect/NavigableSelect.types.d.ts +1 -0
- package/dist/components/NotificationCenter/NotificationCenter.types.d.ts +1 -0
- package/dist/components/NumberFormatter/NumberFormatter.types.d.ts +1 -0
- package/dist/components/NumberInput/NumberInput.const.d.ts +1 -0
- package/dist/components/NumberInput/NumberInput.types.d.ts +2 -0
- package/dist/components/OTPInput/OTPInput.types.d.ts +2 -0
- package/dist/components/Overlay/Overlay.const.d.ts +1 -0
- package/dist/components/Overlay/Overlay.types.d.ts +1 -0
- package/dist/components/PageNav/PageNav.types.d.ts +1 -0
- package/dist/components/Pagination/Pagination.const.d.ts +1 -0
- package/dist/components/Pagination/Pagination.types.d.ts +1 -0
- package/dist/components/Paper/Paper.const.d.ts +1 -0
- package/dist/components/Paper/Paper.types.d.ts +1 -0
- package/dist/components/PasswordInput/PasswordInput.const.d.ts +1 -0
- package/dist/components/PasswordInput/PasswordInput.types.d.ts +2 -0
- package/dist/components/PhoneInput/PhoneInput.types.d.ts +1 -0
- package/dist/components/Popconfirm/Popconfirm.types.d.ts +1 -0
- package/dist/components/Popover/Popover.const.d.ts +1 -0
- package/dist/components/Popover/Popover.types.d.ts +2 -0
- package/dist/components/Portal/Portal.const.d.ts +1 -0
- package/dist/components/Progress/Progress.const.d.ts +1 -0
- package/dist/components/Progress/Progress.types.d.ts +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.types.d.ts +1 -0
- package/dist/components/QRCode/QRCode.types.d.ts +1 -0
- package/dist/components/Radio/Radio.cjs +1 -1
- package/dist/components/Radio/Radio.const.d.ts +1 -0
- package/dist/components/Radio/Radio.js +99 -96
- package/dist/components/Radio/Radio.types.d.ts +1 -0
- package/dist/components/RadioCard/RadioCard.types.d.ts +1 -0
- package/dist/components/Rating/Rating.types.d.ts +1 -0
- package/dist/components/ResizablePanel/ResizablePanel.types.d.ts +1 -0
- package/dist/components/ResizableTextarea/ResizableTextarea.types.d.ts +1 -0
- package/dist/components/Result/Result.types.d.ts +1 -0
- package/dist/components/RichEditor/RichEditor.cjs +1 -1
- package/dist/components/RichEditor/RichEditor.js +69 -71
- package/dist/components/RingProgress/RingProgress.types.d.ts +1 -0
- package/dist/components/ScrollArea/ScrollArea.const.d.ts +1 -0
- package/dist/components/ScrollArea/ScrollArea.types.d.ts +2 -0
- package/dist/components/SegmentedControl/SegmentedControl.const.d.ts +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.types.d.ts +2 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.const.d.ts +1 -0
- package/dist/components/Select/Select.js +3 -2
- package/dist/components/Select/Select.types.d.ts +6 -1
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.js +15 -17
- package/dist/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/SignPad/SignPad.js +24 -26
- package/dist/components/Skeleton/Skeleton.types.d.ts +1 -0
- package/dist/components/Slider/Slider.const.d.ts +1 -0
- package/dist/components/Slider/Slider.types.d.ts +1 -0
- package/dist/components/SliderRange/SliderRange.const.d.ts +1 -0
- package/dist/components/SliderRange/SliderRange.types.d.ts +2 -0
- package/dist/components/Snackbar/Snackbar.cjs +1 -0
- package/dist/components/Snackbar/Snackbar.const.cjs +1 -0
- package/dist/components/Snackbar/Snackbar.const.d.ts +13 -0
- package/dist/components/Snackbar/Snackbar.const.js +18 -0
- package/dist/components/Snackbar/Snackbar.d.ts +2 -0
- package/dist/components/Snackbar/Snackbar.js +114 -0
- package/dist/components/Snackbar/Snackbar.types.d.ts +44 -0
- package/dist/components/Snackbar/hooks/index.d.ts +1 -0
- package/dist/components/Snackbar/hooks/useSnackbar.cjs +1 -0
- package/dist/components/Snackbar/hooks/useSnackbar.d.ts +2 -0
- package/dist/components/Snackbar/hooks/useSnackbar.js +42 -0
- package/dist/components/Snackbar/index.d.ts +3 -0
- package/dist/components/Sparkline/Sparkline.types.d.ts +2 -0
- package/dist/components/SpeedDial/SpeedDial.types.d.ts +1 -0
- package/dist/components/Spinner/Spinner.const.d.ts +1 -0
- package/dist/components/Spinner/Spinner.types.d.ts +2 -0
- package/dist/components/SplitButton/SplitButton.types.d.ts +1 -0
- package/dist/components/Spoiler/Spoiler.types.d.ts +1 -0
- package/dist/components/Spotlight/Spotlight.types.d.ts +1 -0
- package/dist/components/StatCard/StatCard.const.d.ts +1 -0
- package/dist/components/StatCard/StatCard.types.d.ts +2 -0
- package/dist/components/Statistic/Statistic.const.d.ts +1 -0
- package/dist/components/Statistic/Statistic.types.d.ts +2 -0
- package/dist/components/Stepper/Stepper.types.d.ts +1 -0
- package/dist/components/Switch/Switch.cjs +1 -1
- package/dist/components/Switch/Switch.const.cjs +1 -0
- package/dist/components/Switch/Switch.const.d.ts +54 -0
- package/dist/components/Switch/Switch.const.js +37 -0
- package/dist/components/Switch/Switch.d.ts +1 -2
- package/dist/components/Switch/Switch.js +51 -80
- package/dist/components/Switch/Switch.types.d.ts +18 -10
- package/dist/components/Switch/SwitchGroup.cjs +1 -0
- package/dist/components/Switch/SwitchGroup.d.ts +2 -0
- package/dist/components/Switch/SwitchGroup.js +50 -0
- package/dist/components/Switch/index.d.ts +2 -1
- package/dist/components/TableSkeleton/TableSkeleton.cjs +1 -0
- package/dist/components/TableSkeleton/TableSkeleton.const.cjs +1 -0
- package/dist/components/TableSkeleton/TableSkeleton.const.d.ts +6 -0
- package/dist/components/TableSkeleton/TableSkeleton.const.js +9 -0
- package/dist/components/TableSkeleton/TableSkeleton.d.ts +2 -0
- package/dist/components/TableSkeleton/TableSkeleton.js +51 -0
- package/dist/components/TableSkeleton/TableSkeleton.types.d.ts +9 -0
- package/dist/components/TableSkeleton/index.d.ts +2 -0
- package/dist/components/Tabs/Tabs.const.d.ts +1 -0
- package/dist/components/Tabs/Tabs.types.d.ts +1 -0
- package/dist/components/TagCloud/TagCloud.types.d.ts +1 -0
- package/dist/components/TagsInput/TagsInput.const.d.ts +1 -0
- package/dist/components/TagsInput/TagsInput.types.d.ts +2 -0
- package/dist/components/Terminal/Terminal.types.d.ts +1 -0
- package/dist/components/ThemeIcon/ThemeIcon.const.d.ts +1 -0
- package/dist/components/ThemeIcon/ThemeIcon.types.d.ts +1 -0
- package/dist/components/TimePicker/TimePicker.types.d.ts +2 -0
- package/dist/components/Timeline/Timeline.cjs +1 -1
- package/dist/components/Timeline/Timeline.const.cjs +1 -1
- package/dist/components/Timeline/Timeline.const.d.ts +21 -0
- package/dist/components/Timeline/Timeline.const.js +41 -20
- package/dist/components/Timeline/Timeline.d.ts +0 -15
- package/dist/components/Timeline/Timeline.js +133 -132
- package/dist/components/Timeline/Timeline.types.d.ts +7 -0
- package/dist/components/TimelineChart/TimelineChart.types.d.ts +1 -0
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.const.d.ts +1 -0
- package/dist/components/Toast/Toast.d.ts +3 -6
- package/dist/components/Toast/Toast.js +82 -76
- package/dist/components/Toast/Toast.types.d.ts +10 -0
- package/dist/components/Toast/index.d.ts +1 -1
- package/dist/components/ToggleButton/ToggleButton.cjs +1 -0
- package/dist/components/ToggleButton/ToggleButton.const.cjs +1 -0
- package/dist/components/ToggleButton/ToggleButton.const.d.ts +6 -0
- package/dist/components/ToggleButton/ToggleButton.const.js +15 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +3 -0
- package/dist/components/ToggleButton/ToggleButton.js +89 -0
- package/dist/components/ToggleButton/ToggleButton.types.d.ts +30 -0
- package/dist/components/ToggleButton/index.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.const.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +2 -0
- package/dist/components/Tour/Tour.types.d.ts +1 -0
- package/dist/components/TransferList/TransferList.const.d.ts +1 -0
- package/dist/components/TransferList/TransferList.types.d.ts +1 -0
- package/dist/components/Transition/Transition.types.d.ts +1 -0
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.js +22 -22
- package/dist/components/TreeSelect/TreeSelect.types.d.ts +1 -0
- package/dist/components/TreeView/TreeView.const.d.ts +1 -0
- package/dist/components/TreeView/TreeView.types.d.ts +2 -0
- package/dist/components/Typewriter/Typewriter.types.d.ts +1 -0
- package/dist/components/Typography/Typography.types.d.ts +1 -0
- package/dist/components/VirtualList/VirtualList.cjs +1 -1
- package/dist/components/VirtualList/VirtualList.const.cjs +1 -0
- package/dist/components/VirtualList/VirtualList.const.d.ts +2 -0
- package/dist/components/VirtualList/VirtualList.const.js +4 -0
- package/dist/components/VirtualList/VirtualList.js +18 -39
- package/dist/components/VirtualList/VirtualList.types.d.ts +2 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.const.d.ts +1 -0
- package/dist/components/Watermark/Watermark.types.d.ts +1 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +18 -3
- package/dist/components/index.js +419 -398
- package/dist/context/BearProvider.cjs +1 -1
- package/dist/context/BearProvider.d.ts +21 -43
- package/dist/context/BearProvider.js +208 -163
- package/dist/context/bearProvider.const.cjs +1 -0
- package/dist/context/bearProvider.const.d.ts +7 -0
- package/dist/context/bearProvider.const.js +8 -0
- package/dist/context/bearProvider.types.d.ts +6 -0
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.ts +2 -1
- package/dist/context/index.js +8 -6
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +31 -27
- package/dist/hooks/useBearComponent/useBearComponent.cjs +1 -1
- package/dist/hooks/useBearComponent/useBearComponent.js +45 -44
- package/dist/hooks/useBearDefaultProps.cjs +1 -0
- package/dist/hooks/useBearDefaultProps.d.ts +2 -0
- package/dist/hooks/useBearDefaultProps.js +8 -0
- package/dist/hooks/useFormControl/index.d.ts +1 -0
- package/dist/hooks/useFormControl/useFormControl.cjs +1 -0
- package/dist/hooks/useFormControl/useFormControl.d.ts +2 -0
- package/dist/hooks/useFormControl/useFormControl.js +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +519 -480
- package/dist/styles/_message-list.css +42 -0
- package/dist/styles/main.css +1 -0
- package/dist/styles.css +72 -21
- package/dist/types/base.types.d.ts +5 -0
- package/dist/types/component.types.d.ts +5 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/generateBearId.const.cjs +1 -0
- package/dist/utils/generateBearId.const.d.ts +5 -0
- package/dist/utils/generateBearId.const.js +8 -0
- package/dist/utils/generateBearId.types.d.ts +4 -0
- package/dist/utils/generateBearId.utils.cjs +1 -0
- package/dist/utils/generateBearId.utils.d.ts +4 -0
- package/dist/utils/generateBearId.utils.js +29 -0
- package/dist/utils/getResponsiveClass.utils.cjs +1 -0
- package/dist/utils/getResponsiveClass.utils.d.ts +2 -0
- package/dist/utils/getResponsiveClass.utils.js +12 -0
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +19 -5
- package/dist/utils/useBearId.cjs +1 -0
- package/dist/utils/useBearId.d.ts +1 -0
- package/dist/utils/useBearId.js +15 -0
- package/package.json +15 -2
- package/dist/components/Toast/Toast.utils.cjs +0 -1
- package/dist/components/Toast/Toast.utils.js +0 -4
|
@@ -1,149 +1,171 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Portal as
|
|
5
|
-
import { defaultFilter as
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as K, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useRef as w, useCallback as X, useEffect as d } from "react";
|
|
3
|
+
import { cn as g } from "../../utils/cn.js";
|
|
4
|
+
import { Portal as Y } from "../Portal/Portal.js";
|
|
5
|
+
import { defaultFilter as ee } from "./MentionsInput.utils.js";
|
|
6
|
+
const re = 1e4, te = 3, ae = {
|
|
7
7
|
sm: "bear-h-8 bear-text-sm bear-px-3",
|
|
8
8
|
md: "bear-h-10 bear-text-base bear-px-4",
|
|
9
9
|
lg: "bear-h-12 bear-text-lg bear-px-5"
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
}, ne = {
|
|
11
|
+
sm: "bear-text-sm bear-px-3 bear-py-2",
|
|
12
|
+
md: "bear-text-base bear-px-4 bear-py-2",
|
|
13
|
+
lg: "bear-text-lg bear-px-5 bear-py-3"
|
|
14
|
+
}, ce = ({
|
|
15
|
+
value: y,
|
|
16
|
+
defaultValue: U = "",
|
|
17
|
+
onChange: o,
|
|
18
|
+
onMentionSelect: v,
|
|
15
19
|
options: $,
|
|
16
|
-
trigger:
|
|
17
|
-
placeholder:
|
|
18
|
-
disabled:
|
|
19
|
-
maxSuggestions:
|
|
20
|
-
filterOptions:
|
|
21
|
-
size:
|
|
22
|
-
fullWidth:
|
|
23
|
-
className:
|
|
20
|
+
trigger: i = "@",
|
|
21
|
+
placeholder: L = "Type @ to mention...",
|
|
22
|
+
disabled: f = !1,
|
|
23
|
+
maxSuggestions: j = 5,
|
|
24
|
+
filterOptions: B = ee,
|
|
25
|
+
size: N = "md",
|
|
26
|
+
fullWidth: F = !1,
|
|
27
|
+
className: Q,
|
|
28
|
+
multiline: W = !1,
|
|
29
|
+
rows: H = te
|
|
24
30
|
}) => {
|
|
25
|
-
const [
|
|
26
|
-
const e = a.lastIndexOf(
|
|
31
|
+
const [V, D] = b(U), [h, Z] = b(""), [C, p] = b(!1), [c, x] = b(0), [k, G] = b(null), M = w(null), m = w(null), z = w(null), O = w(null), [E, J] = b({ top: 0, left: 0, width: 0 }), a = y ?? V, u = B($, h).slice(0, j), R = C && h.length >= 0, I = R && u.length > 0, q = X(() => {
|
|
32
|
+
const e = a.lastIndexOf(i);
|
|
27
33
|
if (e === -1) return { query: "", start: null };
|
|
28
|
-
const
|
|
29
|
-
return { query:
|
|
30
|
-
}, [a,
|
|
34
|
+
const r = a.slice(e + i.length), t = r.indexOf(" ");
|
|
35
|
+
return { query: t === -1 ? r : r.slice(0, t), start: e };
|
|
36
|
+
}, [a, i]);
|
|
31
37
|
d(() => {
|
|
32
|
-
const { query: e, start:
|
|
33
|
-
|
|
34
|
-
}, [a,
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
-
if (
|
|
38
|
-
const e =
|
|
38
|
+
const { query: e, start: r } = q();
|
|
39
|
+
Z(e), G(r), p(r !== null && !e.includes(" "));
|
|
40
|
+
}, [a, q]), d(() => {
|
|
41
|
+
x(0);
|
|
42
|
+
}, [h]), d(() => {
|
|
43
|
+
if (c >= 0 && z.current) {
|
|
44
|
+
const e = z.current.children[c];
|
|
39
45
|
e == null || e.scrollIntoView({ block: "nearest" });
|
|
40
46
|
}
|
|
41
|
-
}, [
|
|
42
|
-
if (!
|
|
47
|
+
}, [c]), d(() => {
|
|
48
|
+
if (!I) return;
|
|
43
49
|
const e = () => {
|
|
44
|
-
var
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
top:
|
|
48
|
-
left: Math.max(8, Math.min(
|
|
49
|
-
width:
|
|
50
|
+
var t;
|
|
51
|
+
const r = (t = m.current) == null ? void 0 : t.getBoundingClientRect();
|
|
52
|
+
r && J({
|
|
53
|
+
top: r.bottom + 4,
|
|
54
|
+
left: Math.max(8, Math.min(r.left, window.innerWidth - r.width - 8)),
|
|
55
|
+
width: r.width
|
|
50
56
|
});
|
|
51
57
|
};
|
|
52
58
|
return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
53
59
|
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
54
60
|
};
|
|
55
|
-
}, [
|
|
56
|
-
const e = (
|
|
57
|
-
var n,
|
|
58
|
-
const
|
|
59
|
-
(n =
|
|
61
|
+
}, [I]), d(() => {
|
|
62
|
+
const e = (r) => {
|
|
63
|
+
var n, l;
|
|
64
|
+
const t = r.target;
|
|
65
|
+
(n = M.current) != null && n.contains(t) || (l = O.current) != null && l.contains(t) || p(!1);
|
|
60
66
|
};
|
|
61
67
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
62
68
|
}, []);
|
|
63
|
-
const
|
|
64
|
-
const
|
|
69
|
+
const P = (e) => {
|
|
70
|
+
const r = new RegExp(`${i}(\\w+)`, "g"), t = [];
|
|
65
71
|
let n;
|
|
66
|
-
for (; (n =
|
|
67
|
-
|
|
68
|
-
return [...new Set(
|
|
69
|
-
},
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
var
|
|
74
|
-
if (
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
if (!(!
|
|
72
|
+
for (; (n = r.exec(e)) !== null; )
|
|
73
|
+
t.push(n[1]);
|
|
74
|
+
return [...new Set(t)];
|
|
75
|
+
}, T = (e) => {
|
|
76
|
+
const r = e.target.value;
|
|
77
|
+
y === void 0 && D(r), o == null || o(r, P(r));
|
|
78
|
+
}, A = (e) => {
|
|
79
|
+
var _;
|
|
80
|
+
if (k == null) return;
|
|
81
|
+
const r = a.slice(0, k), t = a.slice(k + i.length + h.length), n = `${i}${e.value}`, l = r + n + " " + t;
|
|
82
|
+
y === void 0 && D(l), o == null || o(l, P(l)), v == null || v(e), p(!1), (_ = m.current) == null || _.focus();
|
|
83
|
+
}, S = (e) => {
|
|
84
|
+
if (!(!R || u.length === 0)) {
|
|
79
85
|
if (e.key === "ArrowDown") {
|
|
80
|
-
e.preventDefault(),
|
|
86
|
+
e.preventDefault(), x((r) => Math.min(r + 1, u.length - 1));
|
|
81
87
|
return;
|
|
82
88
|
}
|
|
83
89
|
if (e.key === "ArrowUp") {
|
|
84
|
-
e.preventDefault(),
|
|
90
|
+
e.preventDefault(), x((r) => Math.max(r - 1, 0));
|
|
85
91
|
return;
|
|
86
92
|
}
|
|
87
93
|
if (e.key === "Enter" || e.key === "Tab") {
|
|
88
94
|
e.preventDefault();
|
|
89
|
-
const
|
|
90
|
-
|
|
95
|
+
const r = u[c];
|
|
96
|
+
r && A(r);
|
|
91
97
|
return;
|
|
92
98
|
}
|
|
93
|
-
e.key === "Escape" &&
|
|
99
|
+
e.key === "Escape" && p(!1);
|
|
94
100
|
}
|
|
95
101
|
};
|
|
96
|
-
return /* @__PURE__ */
|
|
102
|
+
return /* @__PURE__ */ K(
|
|
97
103
|
"div",
|
|
98
104
|
{
|
|
99
|
-
ref:
|
|
100
|
-
className:
|
|
105
|
+
ref: M,
|
|
106
|
+
className: g(
|
|
101
107
|
"Bear-MentionsInput bear-relative",
|
|
102
|
-
|
|
103
|
-
|
|
108
|
+
F && "bear-w-full",
|
|
109
|
+
Q
|
|
104
110
|
),
|
|
105
111
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
112
|
+
W ? /* @__PURE__ */ s(
|
|
113
|
+
"textarea",
|
|
114
|
+
{
|
|
115
|
+
ref: m,
|
|
116
|
+
value: a,
|
|
117
|
+
rows: H,
|
|
118
|
+
onChange: T,
|
|
119
|
+
onKeyDown: S,
|
|
120
|
+
placeholder: L,
|
|
121
|
+
disabled: f,
|
|
122
|
+
className: g(
|
|
123
|
+
"bear-w-full bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-bg-white dark:bear-bg-zinc-900 bear-text-gray-900 dark:bear-text-white placeholder:bear-text-gray-500 dark:placeholder:bear-text-zinc-500 bear-outline-none bear-transition-colors focus:bear-border-bear-500 focus:bear-ring-2 focus:bear-ring-bear-500/20 bear-resize-none",
|
|
124
|
+
f && "bear-opacity-50 bear-cursor-not-allowed",
|
|
125
|
+
ne[N]
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
) : /* @__PURE__ */ s(
|
|
107
129
|
"input",
|
|
108
130
|
{
|
|
109
|
-
ref:
|
|
131
|
+
ref: m,
|
|
110
132
|
type: "text",
|
|
111
133
|
value: a,
|
|
112
|
-
onChange:
|
|
113
|
-
onKeyDown:
|
|
114
|
-
placeholder:
|
|
115
|
-
disabled:
|
|
116
|
-
className:
|
|
134
|
+
onChange: T,
|
|
135
|
+
onKeyDown: S,
|
|
136
|
+
placeholder: L,
|
|
137
|
+
disabled: f,
|
|
138
|
+
className: g(
|
|
117
139
|
"bear-w-full bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-bg-white dark:bear-bg-zinc-900 bear-text-gray-900 dark:bear-text-white placeholder:bear-text-gray-500 dark:placeholder:bear-text-zinc-500 bear-outline-none bear-transition-colors focus:bear-border-bear-500 focus:bear-ring-2 focus:bear-ring-bear-500/20",
|
|
118
|
-
|
|
119
|
-
|
|
140
|
+
f && "bear-opacity-50 bear-cursor-not-allowed",
|
|
141
|
+
ae[N]
|
|
120
142
|
)
|
|
121
143
|
}
|
|
122
144
|
),
|
|
123
|
-
|
|
145
|
+
I && /* @__PURE__ */ s(Y, { children: /* @__PURE__ */ s(
|
|
124
146
|
"div",
|
|
125
147
|
{
|
|
126
|
-
ref:
|
|
148
|
+
ref: O,
|
|
127
149
|
className: "bear-fixed bear-rounded-lg bear-border bear-border-gray-200 dark:bear-border-zinc-600 bear-bg-white dark:bear-bg-zinc-800 bear-shadow-lg",
|
|
128
150
|
style: {
|
|
129
|
-
top:
|
|
130
|
-
left:
|
|
131
|
-
width:
|
|
132
|
-
zIndex:
|
|
151
|
+
top: E.top,
|
|
152
|
+
left: E.left,
|
|
153
|
+
width: E.width,
|
|
154
|
+
zIndex: re
|
|
133
155
|
},
|
|
134
|
-
children: /* @__PURE__ */
|
|
156
|
+
children: /* @__PURE__ */ s("div", { ref: z, className: "bear-max-h-48 bear-overflow-auto bear-py-1", children: u.map((e, r) => /* @__PURE__ */ K(
|
|
135
157
|
"button",
|
|
136
158
|
{
|
|
137
159
|
type: "button",
|
|
138
|
-
className:
|
|
160
|
+
className: g(
|
|
139
161
|
"bear-w-full bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-text-left bear-text-gray-800 dark:bear-text-zinc-200 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700 bear-transition-colors",
|
|
140
|
-
|
|
162
|
+
r === c && "bear-bg-gray-100 dark:bear-bg-zinc-700"
|
|
141
163
|
),
|
|
142
|
-
onMouseEnter: () =>
|
|
143
|
-
onClick: () =>
|
|
164
|
+
onMouseEnter: () => x(r),
|
|
165
|
+
onClick: () => A(e),
|
|
144
166
|
children: [
|
|
145
|
-
e.avatar && /* @__PURE__ */
|
|
146
|
-
/* @__PURE__ */
|
|
167
|
+
e.avatar && /* @__PURE__ */ s("span", { className: "bear-shrink-0", children: e.avatar }),
|
|
168
|
+
/* @__PURE__ */ s("span", { children: e.label })
|
|
147
169
|
]
|
|
148
170
|
},
|
|
149
171
|
e.value
|
|
@@ -155,5 +177,5 @@ const C = 1e4, ee = {
|
|
|
155
177
|
);
|
|
156
178
|
};
|
|
157
179
|
export {
|
|
158
|
-
|
|
180
|
+
ce as MentionsInput
|
|
159
181
|
};
|
|
@@ -5,6 +5,8 @@ export interface MentionOption {
|
|
|
5
5
|
avatar?: ReactNode;
|
|
6
6
|
}
|
|
7
7
|
export interface MentionsInputProps {
|
|
8
|
+
testId?: string;
|
|
9
|
+
id?: string;
|
|
8
10
|
value?: string;
|
|
9
11
|
defaultValue?: string;
|
|
10
12
|
onChange?: (value: string, mentions: string[]) => void;
|
|
@@ -18,4 +20,8 @@ export interface MentionsInputProps {
|
|
|
18
20
|
size?: 'sm' | 'md' | 'lg';
|
|
19
21
|
fullWidth?: boolean;
|
|
20
22
|
className?: string;
|
|
23
|
+
/** Render a textarea instead of a single-line input */
|
|
24
|
+
multiline?: boolean;
|
|
25
|
+
/** Visible rows when multiline */
|
|
26
|
+
rows?: number;
|
|
21
27
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const M_E_N_U_ROOT_CLASS = "Bear-Menu";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react/jsx-runtime"),E=require("react"),g=require("../Avatar/Avatar.cjs"),a=require("../Typography/Typography.cjs"),S=require("./MessageList.const.cjs"),d=require("./MessageList.utils.cjs"),s=require("../../utils/cn.cjs"),w=require("../../utils/generateBearId.utils.cjs"),Y=require("../../utils/useBearId.cjs"),W=({id:m,testId:p,messages:n,currentUserId:y,groupWindowMs:N=S.MESSAGE_LIST_GROUP_WINDOW_MS,showDaySeparators:x=!0,showAvatars:B=!0,showTimestamps:M=!0,autoScroll:u=!0,height:r=S.MESSAGE_LIST_DEFAULT_HEIGHT,renderMessage:A,emptyState:j,formatDayLabel:l,formatTimestamp:L,translations:v,onNewMessagesClick:i,className:b})=>{const $=Y.useBearId("MessageList"),f=w.resolveBearId(m,$),o=E.useRef(null),G=E.useRef(!0),T=E.useRef(null),[P,O]=E.useState(!1),I={...S.MESSAGE_LIST_DEFAULT_TRANSLATIONS,...v},R=d.buildMessageListItems(n,y,N,x),U=e=>(l==null?void 0:l(e))??d.getDefaultDayLabel(e,I),h=e=>(L==null?void 0:L(e))??d.getDefaultTimestamp(e),C=e=>{const t=o.current;t&&t.scrollTo({top:t.scrollHeight,behavior:e?"smooth":"auto"})},q=()=>{const e=o.current;if(!e)return;const c=e.scrollHeight-e.scrollTop-e.clientHeight<=S.MESSAGE_LIST_BOTTOM_THRESHOLD_PX;G.current=c,c&&O(!1)};E.useEffect(()=>{const e=n.length>0?n[n.length-1].id:null,t=T.current===null,c=e!==null&&e!==T.current;if(T.current=e,!!c){if(t||u&&G.current){C(!t);return}O(!0)}},[n,u]);const D=()=>{C(!0),O(!1),i==null||i()},H=e=>_.jsxs("div",{className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__group`,S.MESSAGE_LIST_GROUP_CLASSES,e.isOwn&&S.MESSAGE_LIST_GROUP_OWN_CLASSES),children:[B&&!e.isOwn&&_.jsx(g.Avatar,{src:e.author.avatar,initials:e.author.name[0],size:"sm",className:"bear-flex-shrink-0"}),_.jsxs("div",{className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__group-body`,S.MESSAGE_LIST_GROUP_BODY_CLASSES,e.isOwn&&S.MESSAGE_LIST_GROUP_BODY_OWN_CLASSES),children:[!e.isOwn&&_.jsxs("div",{className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__meta`,S.MESSAGE_LIST_META_CLASSES),children:[_.jsx(a.Typography,{variant:"caption",component:"span",className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__author`,S.MESSAGE_LIST_AUTHOR_CLASSES),children:e.author.name}),M&&_.jsx(a.Typography,{variant:"caption",component:"span",className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__timestamp`,S.MESSAGE_LIST_TIMESTAMP_CLASSES),children:h(e.messages[0].timestamp)})]}),e.messages.map(t=>_.jsx("div",{className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__bubble`,S.MESSAGE_LIST_BUBBLE_CLASSES,e.isOwn&&`${S.MESSAGE_LIST_ROOT_CLASS}__bubble--own`,e.isOwn&&S.MESSAGE_LIST_BUBBLE_OWN_CLASSES),children:(A==null?void 0:A(t))??t.content},t.id)),e.isOwn&&M&&_.jsx(a.Typography,{variant:"caption",component:"span",className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__timestamp`,S.MESSAGE_LIST_TIMESTAMP_CLASSES),children:h(e.messages[e.messages.length-1].timestamp)})]})]},e.key);return _.jsxs("div",{id:f,"data-testid":p,className:s.cn(S.MESSAGE_LIST_ROOT_CLASS,S.MESSAGE_LIST_BASE_CLASSES,b),style:{height:typeof r=="number"?`${r}px`:r},children:[_.jsxs("div",{ref:o,onScroll:q,className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__scroller`,S.MESSAGE_LIST_SCROLLER_CLASSES),role:"log","aria-live":"polite",children:[R.length===0&&_.jsx("div",{className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__empty`,S.MESSAGE_LIST_EMPTY_CLASSES),children:j??_.jsx(a.Typography,{variant:"body2",component:"span",children:I.emptyLabel})}),R.map(e=>e.kind==="day"?_.jsxs("div",{className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__day-separator`,S.MESSAGE_LIST_DAY_SEPARATOR_CLASSES),children:[_.jsx("span",{className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__day-line`,S.MESSAGE_LIST_DAY_LINE_CLASSES)}),_.jsx("span",{className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__day-label`,S.MESSAGE_LIST_DAY_LABEL_CLASSES),children:U(e.date)}),_.jsx("span",{className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__day-line`,S.MESSAGE_LIST_DAY_LINE_CLASSES)})]},e.key):H(e))]}),P&&_.jsx("button",{type:"button",onClick:D,className:s.cn(`${S.MESSAGE_LIST_ROOT_CLASS}__new-messages`,S.MESSAGE_LIST_NEW_MESSAGES_CLASSES),children:I.newMessages})]})};exports.MessageList=W;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S="Bear-MessageList",E=400,_=300*1e3,e=40,A=1440*60*1e3,L={newMessages:"New messages",today:"Today",yesterday:"Yesterday",emptyLabel:"No messages yet"},r="bear-relative bear-flex bear-flex-col bear-rounded-xl bear-border bear-overflow-hidden",a="bear-flex-1 bear-overflow-y-auto bear-p-4 bear-flex bear-flex-col bear-gap-3",T="bear-flex bear-items-center bear-gap-3 bear-my-1",b="bear-flex-1 bear-h-px",t="bear-text-xs bear-font-medium bear-whitespace-nowrap",M="bear-flex bear-gap-2",s="bear-flex-row-reverse",G="bear-flex bear-flex-col bear-gap-1 bear-min-w-0 bear-flex-1",o="bear-items-end",I="bear-px-4 bear-py-2 bear-rounded-2xl bear-text-sm bear-max-w-[70%] bear-w-fit",n="bear-self-end",O="bear-flex bear-items-baseline bear-gap-2 bear-mb-1",C="bear-text-xs bear-font-semibold",c="bear-text-xs",l="bear-absolute-x-center bear-bottom-4 bear-flex bear-items-center bear-gap-2 bear-px-4 bear-py-2 bear-rounded-full bear-border-none bear-cursor-pointer bear-shadow-lg bear-text-xs bear-font-medium hover:bear-opacity-90",x="bear-flex-1 bear-flex bear-items-center bear-justify-center bear-text-sm";exports.MESSAGE_LIST_AUTHOR_CLASSES=C;exports.MESSAGE_LIST_BASE_CLASSES=r;exports.MESSAGE_LIST_BOTTOM_THRESHOLD_PX=e;exports.MESSAGE_LIST_BUBBLE_CLASSES=I;exports.MESSAGE_LIST_BUBBLE_OWN_CLASSES=n;exports.MESSAGE_LIST_DAY_LABEL_CLASSES=t;exports.MESSAGE_LIST_DAY_LINE_CLASSES=b;exports.MESSAGE_LIST_DAY_SEPARATOR_CLASSES=T;exports.MESSAGE_LIST_DEFAULT_HEIGHT=E;exports.MESSAGE_LIST_DEFAULT_TRANSLATIONS=L;exports.MESSAGE_LIST_EMPTY_CLASSES=x;exports.MESSAGE_LIST_GROUP_BODY_CLASSES=G;exports.MESSAGE_LIST_GROUP_BODY_OWN_CLASSES=o;exports.MESSAGE_LIST_GROUP_CLASSES=M;exports.MESSAGE_LIST_GROUP_OWN_CLASSES=s;exports.MESSAGE_LIST_GROUP_WINDOW_MS=_;exports.MESSAGE_LIST_META_CLASSES=O;exports.MESSAGE_LIST_MS_PER_DAY=A;exports.MESSAGE_LIST_NEW_MESSAGES_CLASSES=l;exports.MESSAGE_LIST_ROOT_CLASS=S;exports.MESSAGE_LIST_SCROLLER_CLASSES=a;exports.MESSAGE_LIST_TIMESTAMP_CLASSES=c;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MessageListTranslations } from './MessageList.types';
|
|
2
|
+
export declare const MESSAGE_LIST_ROOT_CLASS = "Bear-MessageList";
|
|
3
|
+
export declare const MESSAGE_LIST_DEFAULT_HEIGHT = 400;
|
|
4
|
+
export declare const MESSAGE_LIST_GROUP_WINDOW_MS: number;
|
|
5
|
+
export declare const MESSAGE_LIST_BOTTOM_THRESHOLD_PX = 40;
|
|
6
|
+
export declare const MESSAGE_LIST_MS_PER_DAY: number;
|
|
7
|
+
export declare const MESSAGE_LIST_DEFAULT_TRANSLATIONS: MessageListTranslations;
|
|
8
|
+
export declare const MESSAGE_LIST_BASE_CLASSES = "bear-relative bear-flex bear-flex-col bear-rounded-xl bear-border bear-overflow-hidden";
|
|
9
|
+
export declare const MESSAGE_LIST_SCROLLER_CLASSES = "bear-flex-1 bear-overflow-y-auto bear-p-4 bear-flex bear-flex-col bear-gap-3";
|
|
10
|
+
export declare const MESSAGE_LIST_DAY_SEPARATOR_CLASSES = "bear-flex bear-items-center bear-gap-3 bear-my-1";
|
|
11
|
+
export declare const MESSAGE_LIST_DAY_LINE_CLASSES = "bear-flex-1 bear-h-px";
|
|
12
|
+
export declare const MESSAGE_LIST_DAY_LABEL_CLASSES = "bear-text-xs bear-font-medium bear-whitespace-nowrap";
|
|
13
|
+
export declare const MESSAGE_LIST_GROUP_CLASSES = "bear-flex bear-gap-2";
|
|
14
|
+
export declare const MESSAGE_LIST_GROUP_OWN_CLASSES = "bear-flex-row-reverse";
|
|
15
|
+
export declare const MESSAGE_LIST_GROUP_BODY_CLASSES = "bear-flex bear-flex-col bear-gap-1 bear-min-w-0 bear-flex-1";
|
|
16
|
+
export declare const MESSAGE_LIST_GROUP_BODY_OWN_CLASSES = "bear-items-end";
|
|
17
|
+
export declare const MESSAGE_LIST_BUBBLE_CLASSES = "bear-px-4 bear-py-2 bear-rounded-2xl bear-text-sm bear-max-w-[70%] bear-w-fit";
|
|
18
|
+
export declare const MESSAGE_LIST_BUBBLE_OWN_CLASSES = "bear-self-end";
|
|
19
|
+
export declare const MESSAGE_LIST_META_CLASSES = "bear-flex bear-items-baseline bear-gap-2 bear-mb-1";
|
|
20
|
+
export declare const MESSAGE_LIST_AUTHOR_CLASSES = "bear-text-xs bear-font-semibold";
|
|
21
|
+
export declare const MESSAGE_LIST_TIMESTAMP_CLASSES = "bear-text-xs";
|
|
22
|
+
export declare const MESSAGE_LIST_NEW_MESSAGES_CLASSES = "bear-absolute-x-center bear-bottom-4 bear-flex bear-items-center bear-gap-2 bear-px-4 bear-py-2 bear-rounded-full bear-border-none bear-cursor-pointer bear-shadow-lg bear-text-xs bear-font-medium hover:bear-opacity-90";
|
|
23
|
+
export declare const MESSAGE_LIST_EMPTY_CLASSES = "bear-flex-1 bear-flex bear-items-center bear-justify-center bear-text-sm";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const e = "Bear-MessageList", S = 400, r = 3e5, a = 40, E = 864e5, _ = {
|
|
2
|
+
newMessages: "New messages",
|
|
3
|
+
today: "Today",
|
|
4
|
+
yesterday: "Yesterday",
|
|
5
|
+
emptyLabel: "No messages yet"
|
|
6
|
+
}, b = "bear-relative bear-flex bear-flex-col bear-rounded-xl bear-border bear-overflow-hidden", t = "bear-flex-1 bear-overflow-y-auto bear-p-4 bear-flex bear-flex-col bear-gap-3", s = "bear-flex bear-items-center bear-gap-3 bear-my-1", A = "bear-flex-1 bear-h-px", o = "bear-text-xs bear-font-medium bear-whitespace-nowrap", L = "bear-flex bear-gap-2", n = "bear-flex-row-reverse", T = "bear-flex bear-flex-col bear-gap-1 bear-min-w-0 bear-flex-1", x = "bear-items-end", c = "bear-px-4 bear-py-2 bear-rounded-2xl bear-text-sm bear-max-w-[70%] bear-w-fit", l = "bear-self-end", M = "bear-flex bear-items-baseline bear-gap-2 bear-mb-1", G = "bear-text-xs bear-font-semibold", I = "bear-text-xs", f = "bear-absolute-x-center bear-bottom-4 bear-flex bear-items-center bear-gap-2 bear-px-4 bear-py-2 bear-rounded-full bear-border-none bear-cursor-pointer bear-shadow-lg bear-text-xs bear-font-medium hover:bear-opacity-90", d = "bear-flex-1 bear-flex bear-items-center bear-justify-center bear-text-sm";
|
|
7
|
+
export {
|
|
8
|
+
G as MESSAGE_LIST_AUTHOR_CLASSES,
|
|
9
|
+
b as MESSAGE_LIST_BASE_CLASSES,
|
|
10
|
+
a as MESSAGE_LIST_BOTTOM_THRESHOLD_PX,
|
|
11
|
+
c as MESSAGE_LIST_BUBBLE_CLASSES,
|
|
12
|
+
l as MESSAGE_LIST_BUBBLE_OWN_CLASSES,
|
|
13
|
+
o as MESSAGE_LIST_DAY_LABEL_CLASSES,
|
|
14
|
+
A as MESSAGE_LIST_DAY_LINE_CLASSES,
|
|
15
|
+
s as MESSAGE_LIST_DAY_SEPARATOR_CLASSES,
|
|
16
|
+
S as MESSAGE_LIST_DEFAULT_HEIGHT,
|
|
17
|
+
_ as MESSAGE_LIST_DEFAULT_TRANSLATIONS,
|
|
18
|
+
d as MESSAGE_LIST_EMPTY_CLASSES,
|
|
19
|
+
T as MESSAGE_LIST_GROUP_BODY_CLASSES,
|
|
20
|
+
x as MESSAGE_LIST_GROUP_BODY_OWN_CLASSES,
|
|
21
|
+
L as MESSAGE_LIST_GROUP_CLASSES,
|
|
22
|
+
n as MESSAGE_LIST_GROUP_OWN_CLASSES,
|
|
23
|
+
r as MESSAGE_LIST_GROUP_WINDOW_MS,
|
|
24
|
+
M as MESSAGE_LIST_META_CLASSES,
|
|
25
|
+
E as MESSAGE_LIST_MS_PER_DAY,
|
|
26
|
+
f as MESSAGE_LIST_NEW_MESSAGES_CLASSES,
|
|
27
|
+
e as MESSAGE_LIST_ROOT_CLASS,
|
|
28
|
+
t as MESSAGE_LIST_SCROLLER_CLASSES,
|
|
29
|
+
I as MESSAGE_LIST_TIMESTAMP_CLASSES
|
|
30
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { MessageListProps } from './MessageList.types';
|
|
3
|
+
/**
|
|
4
|
+
* MessageList - Chat message list with consecutive-author grouping,
|
|
5
|
+
* day separators, and auto-scroll with a "new messages" affordance.
|
|
6
|
+
*
|
|
7
|
+
* Rendering is plain (non-virtualized); virtualization is planned as
|
|
8
|
+
* future work for very long conversations.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <MessageList
|
|
13
|
+
* messages={messages}
|
|
14
|
+
* currentUserId="me"
|
|
15
|
+
* height={420}
|
|
16
|
+
* />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const MessageList: FC<MessageListProps>;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { jsxs as _, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as I, useState as j, useEffect as k } from "react";
|
|
3
|
+
import { Avatar as z } from "../Avatar/Avatar.js";
|
|
4
|
+
import { Typography as r } from "../Typography/Typography.js";
|
|
5
|
+
import { MESSAGE_LIST_DEFAULT_HEIGHT as X, MESSAGE_LIST_DEFAULT_TRANSLATIONS as q, MESSAGE_LIST_EMPTY_CLASSES as J, MESSAGE_LIST_ROOT_CLASS as t, MESSAGE_LIST_DAY_LINE_CLASSES as N, MESSAGE_LIST_DAY_LABEL_CLASSES as K, MESSAGE_LIST_DAY_SEPARATOR_CLASSES as Q, MESSAGE_LIST_SCROLLER_CLASSES as V, MESSAGE_LIST_NEW_MESSAGES_CLASSES as Z, MESSAGE_LIST_BASE_CLASSES as g, MESSAGE_LIST_GROUP_WINDOW_MS as SS, MESSAGE_LIST_AUTHOR_CLASSES as tS, MESSAGE_LIST_TIMESTAMP_CLASSES as f, MESSAGE_LIST_META_CLASSES as eS, MESSAGE_LIST_BUBBLE_OWN_CLASSES as sS, MESSAGE_LIST_BUBBLE_CLASSES as nS, MESSAGE_LIST_GROUP_BODY_OWN_CLASSES as _S, MESSAGE_LIST_GROUP_BODY_CLASSES as aS, MESSAGE_LIST_GROUP_OWN_CLASSES as lS, MESSAGE_LIST_GROUP_CLASSES as rS, MESSAGE_LIST_BOTTOM_THRESHOLD_PX as cS } from "./MessageList.const.js";
|
|
6
|
+
import { buildMessageListItems as oS, getDefaultDayLabel as ES, getDefaultTimestamp as iS } from "./MessageList.utils.js";
|
|
7
|
+
import { cn as e } from "../../utils/cn.js";
|
|
8
|
+
import { resolveBearId as AS } from "../../utils/generateBearId.utils.js";
|
|
9
|
+
import { useBearId as LS } from "../../utils/useBearId.js";
|
|
10
|
+
const OS = ({
|
|
11
|
+
id: B,
|
|
12
|
+
testId: R,
|
|
13
|
+
messages: a,
|
|
14
|
+
currentUserId: v,
|
|
15
|
+
groupWindowMs: C = SS,
|
|
16
|
+
showDaySeparators: $ = !0,
|
|
17
|
+
showAvatars: b = !0,
|
|
18
|
+
showTimestamps: h = !0,
|
|
19
|
+
autoScroll: u = !0,
|
|
20
|
+
height: c = X,
|
|
21
|
+
renderMessage: o,
|
|
22
|
+
emptyState: y,
|
|
23
|
+
formatDayLabel: E,
|
|
24
|
+
formatTimestamp: i,
|
|
25
|
+
translations: U,
|
|
26
|
+
onNewMessagesClick: A,
|
|
27
|
+
className: H
|
|
28
|
+
}) => {
|
|
29
|
+
const P = LS("MessageList"), w = AS(B, P), L = I(null), G = I(!0), d = I(null), [D, m] = j(!1), T = { ...q, ...U }, p = oS(a, v, C, $), W = (S) => (E == null ? void 0 : E(S)) ?? ES(S, T), M = (S) => (i == null ? void 0 : i(S)) ?? iS(S), O = (S) => {
|
|
30
|
+
const s = L.current;
|
|
31
|
+
s && s.scrollTo({ top: s.scrollHeight, behavior: S ? "smooth" : "auto" });
|
|
32
|
+
}, Y = () => {
|
|
33
|
+
const S = L.current;
|
|
34
|
+
if (!S) return;
|
|
35
|
+
const l = S.scrollHeight - S.scrollTop - S.clientHeight <= cS;
|
|
36
|
+
G.current = l, l && m(!1);
|
|
37
|
+
};
|
|
38
|
+
k(() => {
|
|
39
|
+
const S = a.length > 0 ? a[a.length - 1].id : null, s = d.current === null, l = S !== null && S !== d.current;
|
|
40
|
+
if (d.current = S, !!l) {
|
|
41
|
+
if (s || u && G.current) {
|
|
42
|
+
O(!s);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
m(!0);
|
|
46
|
+
}
|
|
47
|
+
}, [a, u]);
|
|
48
|
+
const x = () => {
|
|
49
|
+
O(!0), m(!1), A == null || A();
|
|
50
|
+
}, F = (S) => /* @__PURE__ */ _(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
className: e(
|
|
54
|
+
`${t}__group`,
|
|
55
|
+
rS,
|
|
56
|
+
S.isOwn && lS
|
|
57
|
+
),
|
|
58
|
+
children: [
|
|
59
|
+
b && !S.isOwn && /* @__PURE__ */ n(
|
|
60
|
+
z,
|
|
61
|
+
{
|
|
62
|
+
src: S.author.avatar,
|
|
63
|
+
initials: S.author.name[0],
|
|
64
|
+
size: "sm",
|
|
65
|
+
className: "bear-flex-shrink-0"
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ _(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
className: e(
|
|
72
|
+
`${t}__group-body`,
|
|
73
|
+
aS,
|
|
74
|
+
S.isOwn && _S
|
|
75
|
+
),
|
|
76
|
+
children: [
|
|
77
|
+
!S.isOwn && /* @__PURE__ */ _("div", { className: e(`${t}__meta`, eS), children: [
|
|
78
|
+
/* @__PURE__ */ n(
|
|
79
|
+
r,
|
|
80
|
+
{
|
|
81
|
+
variant: "caption",
|
|
82
|
+
component: "span",
|
|
83
|
+
className: e(`${t}__author`, tS),
|
|
84
|
+
children: S.author.name
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
h && /* @__PURE__ */ n(
|
|
88
|
+
r,
|
|
89
|
+
{
|
|
90
|
+
variant: "caption",
|
|
91
|
+
component: "span",
|
|
92
|
+
className: e(`${t}__timestamp`, f),
|
|
93
|
+
children: M(S.messages[0].timestamp)
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
] }),
|
|
97
|
+
S.messages.map((s) => /* @__PURE__ */ n(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
className: e(
|
|
101
|
+
`${t}__bubble`,
|
|
102
|
+
nS,
|
|
103
|
+
S.isOwn && `${t}__bubble--own`,
|
|
104
|
+
S.isOwn && sS
|
|
105
|
+
),
|
|
106
|
+
children: (o == null ? void 0 : o(s)) ?? s.content
|
|
107
|
+
},
|
|
108
|
+
s.id
|
|
109
|
+
)),
|
|
110
|
+
S.isOwn && h && /* @__PURE__ */ n(
|
|
111
|
+
r,
|
|
112
|
+
{
|
|
113
|
+
variant: "caption",
|
|
114
|
+
component: "span",
|
|
115
|
+
className: e(`${t}__timestamp`, f),
|
|
116
|
+
children: M(S.messages[S.messages.length - 1].timestamp)
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
S.key
|
|
125
|
+
);
|
|
126
|
+
return /* @__PURE__ */ _(
|
|
127
|
+
"div",
|
|
128
|
+
{
|
|
129
|
+
id: w,
|
|
130
|
+
"data-testid": R,
|
|
131
|
+
className: e(t, g, H),
|
|
132
|
+
style: { height: typeof c == "number" ? `${c}px` : c },
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ _(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
ref: L,
|
|
138
|
+
onScroll: Y,
|
|
139
|
+
className: e(`${t}__scroller`, V),
|
|
140
|
+
role: "log",
|
|
141
|
+
"aria-live": "polite",
|
|
142
|
+
children: [
|
|
143
|
+
p.length === 0 && /* @__PURE__ */ n("div", { className: e(`${t}__empty`, J), children: y ?? /* @__PURE__ */ n(r, { variant: "body2", component: "span", children: T.emptyLabel }) }),
|
|
144
|
+
p.map(
|
|
145
|
+
(S) => S.kind === "day" ? /* @__PURE__ */ _(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
className: e(
|
|
149
|
+
`${t}__day-separator`,
|
|
150
|
+
Q
|
|
151
|
+
),
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ n("span", { className: e(`${t}__day-line`, N) }),
|
|
154
|
+
/* @__PURE__ */ n("span", { className: e(`${t}__day-label`, K), children: W(S.date) }),
|
|
155
|
+
/* @__PURE__ */ n("span", { className: e(`${t}__day-line`, N) })
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
S.key
|
|
159
|
+
) : F(S)
|
|
160
|
+
)
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
D && /* @__PURE__ */ n(
|
|
165
|
+
"button",
|
|
166
|
+
{
|
|
167
|
+
type: "button",
|
|
168
|
+
onClick: x,
|
|
169
|
+
className: e(
|
|
170
|
+
`${t}__new-messages`,
|
|
171
|
+
Z
|
|
172
|
+
),
|
|
173
|
+
children: T.newMessages
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
};
|
|
180
|
+
export {
|
|
181
|
+
OS as MessageList
|
|
182
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface MessageListAuthor {
|
|
3
|
+
/** Unique author identifier — used for consecutive message grouping */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Display name */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Avatar image URL */
|
|
8
|
+
avatar?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface MessageListMessage {
|
|
11
|
+
/** Unique message identifier */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Message author */
|
|
14
|
+
author: MessageListAuthor;
|
|
15
|
+
/** Message content */
|
|
16
|
+
content: ReactNode;
|
|
17
|
+
/** Message timestamp — required for grouping and day separators */
|
|
18
|
+
timestamp: Date;
|
|
19
|
+
}
|
|
20
|
+
export interface MessageListTranslations {
|
|
21
|
+
newMessages: string;
|
|
22
|
+
today: string;
|
|
23
|
+
yesterday: string;
|
|
24
|
+
emptyLabel: string;
|
|
25
|
+
}
|
|
26
|
+
export interface MessageListDayItem {
|
|
27
|
+
kind: 'day';
|
|
28
|
+
key: string;
|
|
29
|
+
date: Date;
|
|
30
|
+
}
|
|
31
|
+
export interface MessageListGroupItem {
|
|
32
|
+
kind: 'group';
|
|
33
|
+
key: string;
|
|
34
|
+
author: MessageListAuthor;
|
|
35
|
+
isOwn: boolean;
|
|
36
|
+
messages: MessageListMessage[];
|
|
37
|
+
}
|
|
38
|
+
export type MessageListItem = MessageListDayItem | MessageListGroupItem;
|
|
39
|
+
export interface MessageListProps {
|
|
40
|
+
id?: string;
|
|
41
|
+
testId?: string;
|
|
42
|
+
/** Messages in chronological order (oldest first) */
|
|
43
|
+
messages: MessageListMessage[];
|
|
44
|
+
/** Author id whose messages are aligned right as "own" messages */
|
|
45
|
+
currentUserId?: string;
|
|
46
|
+
/** Max gap in ms between consecutive messages of the same author to stay in one group */
|
|
47
|
+
groupWindowMs?: number;
|
|
48
|
+
/** Show day separator rows between messages of different days */
|
|
49
|
+
showDaySeparators?: boolean;
|
|
50
|
+
/** Show author avatars */
|
|
51
|
+
showAvatars?: boolean;
|
|
52
|
+
/** Show group timestamps */
|
|
53
|
+
showTimestamps?: boolean;
|
|
54
|
+
/** Auto-scroll to bottom on new messages when already at the bottom */
|
|
55
|
+
autoScroll?: boolean;
|
|
56
|
+
/** Height of the scrollable area */
|
|
57
|
+
height?: number | string;
|
|
58
|
+
/** Custom message content renderer */
|
|
59
|
+
renderMessage?: (message: MessageListMessage) => ReactNode;
|
|
60
|
+
/** Content rendered when there are no messages */
|
|
61
|
+
emptyState?: ReactNode;
|
|
62
|
+
/** Custom day separator label formatter */
|
|
63
|
+
formatDayLabel?: (date: Date) => string;
|
|
64
|
+
/** Custom timestamp formatter */
|
|
65
|
+
formatTimestamp?: (date: Date) => string;
|
|
66
|
+
/** Replaceable user-facing strings */
|
|
67
|
+
translations?: Partial<MessageListTranslations>;
|
|
68
|
+
/** Callback when the "new messages" affordance is clicked */
|
|
69
|
+
onNewMessagesClick?: () => void;
|
|
70
|
+
/** Additional CSS class */
|
|
71
|
+
className?: string;
|
|
72
|
+
}
|