@forgedevstack/bear 1.0.7 → 1.0.9
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/ActivityItem/ActivityItem.cjs +1 -1
- package/dist/components/ActivityItem/ActivityItem.js +1 -0
- package/dist/components/Alert/Alert.cjs +1 -1
- package/dist/components/Alert/Alert.const.cjs +1 -1
- package/dist/components/Alert/Alert.const.d.ts +4 -0
- package/dist/components/Alert/Alert.const.js +10 -15
- package/dist/components/Alert/Alert.js +43 -38
- package/dist/components/AppBar/AppBar.cjs +1 -1
- package/dist/components/AppBar/AppBar.js +19 -14
- package/dist/components/BackTop/BackTop.cjs +1 -0
- package/dist/components/BackTop/BackTop.const.cjs +1 -0
- package/dist/components/BackTop/BackTop.const.d.ts +34 -0
- package/dist/components/BackTop/BackTop.const.js +29 -0
- package/dist/components/BackTop/BackTop.d.ts +21 -0
- package/dist/components/BackTop/BackTop.js +87 -0
- package/dist/components/BackTop/BackTop.types.d.ts +28 -0
- package/dist/components/BackTop/index.d.ts +3 -0
- package/dist/components/Badge/Badge.cjs +1 -1
- package/dist/components/Badge/Badge.constants.d.ts +4 -4
- package/dist/components/Badge/Badge.js +15 -14
- package/dist/components/Badge/Badge.types.d.ts +3 -3
- package/dist/components/BearLogo/EmberLogo.cjs +1 -1
- package/dist/components/BearLogo/EmberLogo.js +3 -2
- package/dist/components/BottomNavigation/BottomNavigation.cjs +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.js +3 -2
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +39 -38
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.constants.cjs +38 -48
- package/dist/components/Button/Button.constants.d.ts +22 -3
- package/dist/components/Button/Button.constants.js +51 -50
- package/dist/components/Button/Button.d.ts +14 -7
- package/dist/components/Button/Button.js +123 -45
- package/dist/components/Button/Button.types.d.ts +22 -4
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.js +3 -2
- package/dist/components/Card/Card.const.d.ts +2 -2
- package/dist/components/Card/Card.types.d.ts +2 -2
- package/dist/components/Carousel/Carousel.cjs +1 -1
- package/dist/components/Carousel/Carousel.const.cjs +1 -0
- package/dist/components/Carousel/Carousel.const.d.ts +12 -0
- package/dist/components/Carousel/Carousel.const.js +9 -0
- package/dist/components/Carousel/Carousel.d.ts +14 -3
- package/dist/components/Carousel/Carousel.js +222 -75
- package/dist/components/Carousel/Carousel.types.d.ts +32 -2
- package/dist/components/Carousel/index.d.ts +1 -1
- package/dist/components/Chat/Chat.cjs +1 -0
- package/dist/components/Chat/Chat.const.cjs +1 -0
- package/dist/components/Chat/Chat.const.d.ts +26 -0
- package/dist/components/Chat/Chat.const.js +29 -0
- package/dist/components/Chat/Chat.d.ts +21 -0
- package/dist/components/Chat/Chat.js +179 -0
- package/dist/components/Chat/Chat.types.d.ts +55 -0
- package/dist/components/Chat/index.d.ts +2 -0
- package/dist/components/Chip/Chip.cjs +1 -1
- package/dist/components/Chip/Chip.js +3 -2
- package/dist/components/CodeEditor/CodeEditor.cjs +5 -0
- package/dist/components/CodeEditor/CodeEditor.const.cjs +1 -0
- package/dist/components/CodeEditor/CodeEditor.const.d.ts +21 -0
- package/dist/components/CodeEditor/CodeEditor.const.js +119 -0
- package/dist/components/CodeEditor/CodeEditor.d.ts +22 -0
- package/dist/components/CodeEditor/CodeEditor.js +250 -0
- package/dist/components/CodeEditor/CodeEditor.types.d.ts +80 -0
- package/dist/components/CodeEditor/CodeEditor.utils.cjs +1 -0
- package/dist/components/CodeEditor/CodeEditor.utils.d.ts +6 -0
- package/dist/components/CodeEditor/CodeEditor.utils.js +75 -0
- package/dist/components/CodeEditor/index.d.ts +2 -0
- package/dist/components/Columns/Columns.cjs +1 -1
- package/dist/components/Columns/Columns.js +9 -8
- package/dist/components/Confetti/Confetti.cjs +1 -0
- package/dist/components/Confetti/Confetti.const.cjs +1 -0
- package/dist/components/Confetti/Confetti.const.d.ts +16 -0
- package/dist/components/Confetti/Confetti.const.js +36 -0
- package/dist/components/Confetti/Confetti.d.ts +23 -0
- package/dist/components/Confetti/Confetti.js +94 -0
- package/dist/components/Confetti/Confetti.types.d.ts +50 -0
- package/dist/components/Confetti/index.d.ts +4 -0
- package/dist/components/Confetti/useConfetti.cjs +1 -0
- package/dist/components/Confetti/useConfetti.d.ts +13 -0
- package/dist/components/Confetti/useConfetti.js +12 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +27 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.js +35 -0
- package/dist/components/CountdownTimer/CountdownTimer.d.ts +7 -0
- package/dist/components/CountdownTimer/CountdownTimer.js +115 -0
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +56 -0
- package/dist/components/CountdownTimer/index.d.ts +2 -0
- package/dist/components/Cropper/Cropper.cjs +1 -0
- package/dist/components/Cropper/Cropper.const.cjs +1 -0
- package/dist/components/Cropper/Cropper.const.d.ts +31 -0
- package/dist/components/Cropper/Cropper.const.js +33 -0
- package/dist/components/Cropper/Cropper.d.ts +21 -0
- package/dist/components/Cropper/Cropper.js +362 -0
- package/dist/components/Cropper/Cropper.types.d.ts +72 -0
- package/dist/components/Cropper/index.d.ts +2 -0
- package/dist/components/DataTable/DataTable.cjs +1 -1
- package/dist/components/DataTable/DataTable.js +5 -4
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.js +3 -2
- package/dist/components/DiffViewer/DiffViewer.cjs +1 -0
- package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -0
- package/dist/components/DiffViewer/DiffViewer.const.d.ts +18 -0
- package/dist/components/DiffViewer/DiffViewer.const.js +21 -0
- package/dist/components/DiffViewer/DiffViewer.d.ts +18 -0
- package/dist/components/DiffViewer/DiffViewer.js +127 -0
- package/dist/components/DiffViewer/DiffViewer.types.d.ts +40 -0
- package/dist/components/DiffViewer/DiffViewer.utils.cjs +3 -0
- package/dist/components/DiffViewer/DiffViewer.utils.d.ts +9 -0
- package/dist/components/DiffViewer/DiffViewer.utils.js +39 -0
- package/dist/components/DiffViewer/index.d.ts +2 -0
- package/dist/components/Divider/Divider.cjs +1 -1
- package/dist/components/Divider/Divider.js +15 -14
- package/dist/components/Dock/Dock.cjs +1 -0
- package/dist/components/Dock/Dock.const.cjs +1 -0
- package/dist/components/Dock/Dock.const.d.ts +25 -0
- package/dist/components/Dock/Dock.const.js +22 -0
- package/dist/components/Dock/Dock.d.ts +7 -0
- package/dist/components/Dock/Dock.js +144 -0
- package/dist/components/Dock/Dock.types.d.ts +42 -0
- package/dist/components/Dock/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +35 -35
- package/dist/components/EmptyState/EmptyState.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.js +7 -6
- package/dist/components/FloatingChat/FloatingChat.cjs +1 -0
- package/dist/components/FloatingChat/FloatingChat.const.cjs +1 -0
- package/dist/components/FloatingChat/FloatingChat.const.d.ts +12 -0
- package/dist/components/FloatingChat/FloatingChat.const.js +15 -0
- package/dist/components/FloatingChat/FloatingChat.d.ts +19 -0
- package/dist/components/FloatingChat/FloatingChat.js +144 -0
- package/dist/components/FloatingChat/FloatingChat.types.d.ts +44 -0
- package/dist/components/FloatingChat/index.d.ts +2 -0
- package/dist/components/GradientText/GradientText.cjs +1 -0
- package/dist/components/GradientText/GradientText.const.cjs +1 -0
- package/dist/components/GradientText/GradientText.const.d.ts +15 -0
- package/dist/components/GradientText/GradientText.const.js +36 -0
- package/dist/components/GradientText/GradientText.d.ts +7 -0
- package/dist/components/GradientText/GradientText.js +52 -0
- package/dist/components/GradientText/GradientText.types.d.ts +27 -0
- package/dist/components/GradientText/index.d.ts +2 -0
- package/dist/components/Highlight/Highlight.cjs +1 -1
- package/dist/components/Highlight/Highlight.const.cjs +1 -0
- package/dist/components/Highlight/Highlight.const.d.ts +8 -0
- package/dist/components/Highlight/Highlight.const.js +15 -0
- package/dist/components/Highlight/Highlight.d.ts +4 -0
- package/dist/components/Highlight/Highlight.js +32 -24
- package/dist/components/Highlight/Highlight.types.d.ts +9 -1
- package/dist/components/Highlight/index.d.ts +1 -1
- package/dist/components/Icon/Icon.cjs +1 -1
- package/dist/components/Icon/Icon.js +17 -16
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.js +12 -11
- package/dist/components/JsonViewer/JsonViewer.cjs +1 -0
- package/dist/components/JsonViewer/JsonViewer.const.cjs +1 -0
- package/dist/components/JsonViewer/JsonViewer.const.d.ts +4 -0
- package/dist/components/JsonViewer/JsonViewer.const.js +24 -0
- package/dist/components/JsonViewer/JsonViewer.d.ts +17 -0
- package/dist/components/JsonViewer/JsonViewer.js +195 -0
- package/dist/components/JsonViewer/JsonViewer.types.d.ts +54 -0
- package/dist/components/JsonViewer/index.d.ts +2 -0
- package/dist/components/Kanban/Kanban.cjs +1 -1
- package/dist/components/Kanban/Kanban.js +18 -17
- package/dist/components/Kbd/Kbd.cjs +1 -1
- package/dist/components/Kbd/Kbd.js +17 -16
- package/dist/components/Map/Map.cjs +1 -0
- package/dist/components/Map/Map.const.cjs +1 -0
- package/dist/components/Map/Map.const.d.ts +20 -0
- package/dist/components/Map/Map.const.js +26 -0
- package/dist/components/Map/Map.d.ts +20 -0
- package/dist/components/Map/Map.js +259 -0
- package/dist/components/Map/Map.types.d.ts +81 -0
- package/dist/components/Map/index.d.ts +2 -0
- package/dist/components/Marquee/Marquee.cjs +1 -0
- package/dist/components/Marquee/Marquee.const.cjs +1 -0
- package/dist/components/Marquee/Marquee.const.d.ts +11 -0
- package/dist/components/Marquee/Marquee.const.js +12 -0
- package/dist/components/Marquee/Marquee.d.ts +7 -0
- package/dist/components/Marquee/Marquee.js +106 -0
- package/dist/components/Marquee/Marquee.types.d.ts +32 -0
- package/dist/components/Marquee/index.d.ts +2 -0
- package/dist/components/Masonry/Masonry.cjs +1 -0
- package/dist/components/Masonry/Masonry.const.cjs +1 -0
- package/dist/components/Masonry/Masonry.const.d.ts +9 -0
- package/dist/components/Masonry/Masonry.const.js +9 -0
- package/dist/components/Masonry/Masonry.d.ts +7 -0
- package/dist/components/Masonry/Masonry.js +51 -0
- package/dist/components/Masonry/Masonry.types.d.ts +21 -0
- package/dist/components/Masonry/index.d.ts +2 -0
- package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -0
- package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -0
- package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +23 -0
- package/dist/components/NavigableSelect/NavigableSelect.const.js +33 -0
- package/dist/components/NavigableSelect/NavigableSelect.d.ts +7 -0
- package/dist/components/NavigableSelect/NavigableSelect.js +361 -0
- package/dist/components/NavigableSelect/NavigableSelect.types.d.ts +56 -0
- package/dist/components/NavigableSelect/index.d.ts +2 -0
- package/dist/components/Progress/Progress.cjs +1 -1
- package/dist/components/Progress/Progress.js +3 -2
- package/dist/components/QRCode/QRCode.cjs +1 -0
- package/dist/components/QRCode/QRCode.const.cjs +1 -0
- package/dist/components/QRCode/QRCode.const.d.ts +21 -0
- package/dist/components/QRCode/QRCode.const.js +11 -0
- package/dist/components/QRCode/QRCode.d.ts +29 -0
- package/dist/components/QRCode/QRCode.js +68 -0
- package/dist/components/QRCode/QRCode.types.d.ts +32 -0
- package/dist/components/QRCode/QRCode.utils.cjs +1 -0
- package/dist/components/QRCode/QRCode.utils.d.ts +12 -0
- package/dist/components/QRCode/QRCode.utils.js +74 -0
- package/dist/components/QRCode/index.d.ts +3 -0
- package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
- package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.js +3 -2
- package/dist/components/ScrollArea/ScrollArea.cjs +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +3 -2
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.js +13 -12
- package/dist/components/Spinner/Spinner.cjs +1 -1
- package/dist/components/Spinner/Spinner.js +3 -2
- package/dist/components/Spinner/Spinner.types.d.ts +2 -2
- package/dist/components/Spotlight/Spotlight.cjs +1 -0
- package/dist/components/Spotlight/Spotlight.const.cjs +1 -0
- package/dist/components/Spotlight/Spotlight.const.d.ts +18 -0
- package/dist/components/Spotlight/Spotlight.const.js +9 -0
- package/dist/components/Spotlight/Spotlight.d.ts +7 -0
- package/dist/components/Spotlight/Spotlight.js +220 -0
- package/dist/components/Spotlight/Spotlight.types.d.ts +51 -0
- package/dist/components/Spotlight/index.d.ts +2 -0
- package/dist/components/StatCard/StatCard.cjs +1 -1
- package/dist/components/StatCard/StatCard.js +9 -8
- package/dist/components/Statistic/Statistic.cjs +1 -1
- package/dist/components/Statistic/Statistic.js +7 -6
- package/dist/components/Switch/Switch.cjs +1 -1
- package/dist/components/Switch/Switch.js +11 -10
- package/dist/components/Terminal/Terminal.cjs +1 -0
- package/dist/components/Terminal/Terminal.const.cjs +1 -0
- package/dist/components/Terminal/Terminal.const.d.ts +32 -0
- package/dist/components/Terminal/Terminal.const.js +42 -0
- package/dist/components/Terminal/Terminal.d.ts +27 -0
- package/dist/components/Terminal/Terminal.js +155 -0
- package/dist/components/Terminal/Terminal.types.d.ts +49 -0
- package/dist/components/Terminal/index.d.ts +2 -0
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.js +16 -15
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +13 -12
- package/dist/components/Tour/Tour.cjs +1 -0
- package/dist/components/Tour/Tour.const.cjs +1 -0
- package/dist/components/Tour/Tour.const.d.ts +25 -0
- package/dist/components/Tour/Tour.const.js +38 -0
- package/dist/components/Tour/Tour.d.ts +17 -0
- package/dist/components/Tour/Tour.js +179 -0
- package/dist/components/Tour/Tour.types.d.ts +80 -0
- package/dist/components/Tour/index.d.ts +4 -0
- package/dist/components/Tour/useTour.cjs +1 -0
- package/dist/components/Tour/useTour.d.ts +14 -0
- package/dist/components/Tour/useTour.js +27 -0
- package/dist/components/Transition/Transition.cjs +1 -0
- package/dist/components/Transition/Transition.const.cjs +1 -0
- package/dist/components/Transition/Transition.const.d.ts +15 -0
- package/dist/components/Transition/Transition.const.js +73 -0
- package/dist/components/Transition/Transition.d.ts +37 -0
- package/dist/components/Transition/Transition.js +107 -0
- package/dist/components/Transition/Transition.types.d.ts +69 -0
- package/dist/components/Transition/index.d.ts +2 -0
- package/dist/components/Typewriter/Typewriter.cjs +1 -0
- package/dist/components/Typewriter/Typewriter.const.cjs +1 -0
- package/dist/components/Typewriter/Typewriter.const.d.ts +22 -0
- package/dist/components/Typewriter/Typewriter.const.js +11 -0
- package/dist/components/Typewriter/Typewriter.d.ts +7 -0
- package/dist/components/Typewriter/Typewriter.js +88 -0
- package/dist/components/Typewriter/Typewriter.types.d.ts +32 -0
- package/dist/components/Typewriter/index.d.ts +2 -0
- package/dist/components/Typography/Typography.cjs +1 -1
- package/dist/components/Typography/Typography.d.ts +5 -1
- package/dist/components/Typography/Typography.js +93 -57
- package/dist/components/Typography/Typography.types.d.ts +29 -2
- package/dist/components/Watermark/Watermark.cjs +1 -0
- package/dist/components/Watermark/Watermark.const.cjs +1 -0
- package/dist/components/Watermark/Watermark.const.d.ts +30 -0
- package/dist/components/Watermark/Watermark.const.js +18 -0
- package/dist/components/Watermark/Watermark.d.ts +7 -0
- package/dist/components/Watermark/Watermark.js +96 -0
- package/dist/components/Watermark/Watermark.types.d.ts +35 -0
- package/dist/components/Watermark/index.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +46 -2
- package/dist/components/index.js +288 -237
- package/dist/context/BearProvider.cjs +1 -1
- package/dist/context/BearProvider.d.ts +110 -5
- package/dist/context/BearProvider.js +198 -53
- package/dist/context/defaultTheme.cjs +1 -1
- package/dist/context/defaultTheme.js +11 -11
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +18 -0
- package/dist/hooks/index.js +61 -39
- package/dist/hooks/useAnimate.cjs +1 -0
- package/dist/hooks/useAnimate.d.ts +61 -0
- package/dist/hooks/useAnimate.js +125 -0
- package/dist/hooks/useBearComponent/index.d.ts +2 -0
- package/dist/hooks/useBearComponent/useBearComponent.cjs +1 -0
- package/dist/hooks/useBearComponent/useBearComponent.d.ts +71 -0
- package/dist/hooks/useBearComponent/useBearComponent.js +54 -0
- package/dist/hooks/useBearComponent/useBearComponent.types.d.ts +40 -0
- package/dist/hooks/useIdle/index.d.ts +2 -0
- package/dist/hooks/useIdle/useIdle.cjs +1 -0
- package/dist/hooks/useIdle/useIdle.d.ts +22 -0
- package/dist/hooks/useIdle/useIdle.js +66 -0
- package/dist/hooks/useIdle/useIdle.types.d.ts +29 -0
- package/dist/hooks/useLongPress/index.d.ts +2 -0
- package/dist/hooks/useLongPress/useLongPress.cjs +1 -0
- package/dist/hooks/useLongPress/useLongPress.d.ts +17 -0
- package/dist/hooks/useLongPress/useLongPress.js +44 -0
- package/dist/hooks/useLongPress/useLongPress.types.d.ts +26 -0
- package/dist/hooks/useOnline/index.d.ts +2 -0
- package/dist/hooks/useOnline/useOnline.cjs +1 -0
- package/dist/hooks/useOnline/useOnline.d.ts +16 -0
- package/dist/hooks/useOnline/useOnline.js +25 -0
- package/dist/hooks/useOnline/useOnline.types.d.ts +15 -0
- package/dist/hooks/usePageVisibility/index.d.ts +2 -0
- package/dist/hooks/usePageVisibility/usePageVisibility.cjs +1 -0
- package/dist/hooks/usePageVisibility/usePageVisibility.d.ts +19 -0
- package/dist/hooks/usePageVisibility/usePageVisibility.js +26 -0
- package/dist/hooks/usePageVisibility/usePageVisibility.types.d.ts +15 -0
- package/dist/hooks/useResponsive.cjs +1 -0
- package/dist/hooks/useResponsive.d.ts +35 -0
- package/dist/hooks/useResponsive.js +74 -0
- package/dist/hooks/useSpotlight/index.d.ts +2 -0
- package/dist/hooks/useSpotlight/useSpotlight.cjs +1 -0
- package/dist/hooks/useSpotlight/useSpotlight.d.ts +24 -0
- package/dist/hooks/useSpotlight/useSpotlight.js +49 -0
- package/dist/hooks/useSpotlight/useSpotlight.types.d.ts +23 -0
- package/dist/hooks/useWebSocket/index.d.ts +2 -0
- package/dist/hooks/useWebSocket/useWebSocket.cjs +1 -0
- package/dist/hooks/useWebSocket/useWebSocket.d.ts +22 -0
- package/dist/hooks/useWebSocket/useWebSocket.js +75 -0
- package/dist/hooks/useWebSocket/useWebSocket.types.d.ts +44 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +363 -288
- package/dist/styles.css +1 -1
- package/dist/types/component.types.d.ts +125 -42
- package/dist/types/theme.types.d.ts +82 -0
- package/dist/utils/createSlots.cjs +1 -0
- package/dist/utils/createSlots.d.ts +70 -0
- package/dist/utils/createSlots.js +65 -0
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +4 -2
- package/package.json +1 -1
|
@@ -1,122 +1,269 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as M, jsx as t, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
+
import { useState as n, useRef as X, Children as de, useCallback as c, useEffect as ue } from "react";
|
|
3
3
|
import { cn as b } from "../../utils/cn.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
import { DEFAULT_TRANSITION_DURATION as he, MIN_SWIPE_DISTANCE as w, PROGRESS_BAR_HEIGHT as fe, DEFAULT_ACTIVE_COLOR as ge, ARROW_BUTTON_SIZE as N, DEFAULT_THUMBNAIL_SIZE as me } from "./Carousel.const.js";
|
|
5
|
+
const we = ({
|
|
6
|
+
children: F,
|
|
7
|
+
autoPlay: m = 0,
|
|
8
|
+
showDots: P = !0,
|
|
9
|
+
showArrows: H = !0,
|
|
10
|
+
loop: y = !0,
|
|
11
|
+
slidesToShow: d = 1,
|
|
12
|
+
gap: I = 16,
|
|
13
|
+
pauseOnHover: _ = !0,
|
|
14
|
+
onSlideChange: p,
|
|
15
|
+
transition: v = "slide",
|
|
16
|
+
transitionDuration: u = he,
|
|
17
|
+
indicator: k = "dots",
|
|
18
|
+
thumbnails: L,
|
|
19
|
+
thumbnailSize: R = me,
|
|
20
|
+
keyboard: T = !0,
|
|
21
|
+
draggable: j = !0,
|
|
22
|
+
showProgress: K = !1,
|
|
23
|
+
showCounter: V = !1,
|
|
24
|
+
activeColor: h = ge,
|
|
25
|
+
className: Y,
|
|
26
|
+
style: Z,
|
|
27
|
+
testId: q
|
|
16
28
|
}) => {
|
|
17
|
-
const [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
const [a, J] = n(0), [z, C] = n(!1), [U, Q] = n(null), [D, S] = n(null), [G, O] = n(!1), ee = X(null), $ = X(null), x = de.toArray(F), f = x.length, s = Math.max(0, f - d), o = c(
|
|
30
|
+
(r) => {
|
|
31
|
+
if (G) return;
|
|
32
|
+
let e = r;
|
|
33
|
+
y ? r < 0 ? e = s : r > s && (e = 0) : e = Math.max(0, Math.min(s, r)), O(!0), J(e), p == null || p(e), setTimeout(() => O(!1), u);
|
|
34
|
+
},
|
|
35
|
+
[G, y, s, p, u]
|
|
36
|
+
), l = c(() => o(a + 1), [o, a]), i = c(() => o(a - 1), [o, a]);
|
|
37
|
+
ue(() => {
|
|
38
|
+
if (m > 0 && !z)
|
|
39
|
+
return $.current = setInterval(l, m), () => {
|
|
40
|
+
$.current && clearInterval($.current);
|
|
41
|
+
};
|
|
42
|
+
}, [m, z, l]);
|
|
43
|
+
const re = c(
|
|
44
|
+
(r) => {
|
|
45
|
+
T && (r.key === "ArrowLeft" ? i() : r.key === "ArrowRight" && l());
|
|
46
|
+
},
|
|
47
|
+
[T, i, l]
|
|
48
|
+
), ae = (r) => {
|
|
49
|
+
S(null), Q(r.targetTouches[0].clientX);
|
|
50
|
+
}, te = (r) => {
|
|
51
|
+
S(r.targetTouches[0].clientX);
|
|
52
|
+
}, se = () => {
|
|
53
|
+
if (!U || !D) return;
|
|
54
|
+
const r = U - D;
|
|
55
|
+
r > w ? l() : r < -w && i();
|
|
56
|
+
}, [E, A] = n(!1), [B, oe] = n(0), le = c(
|
|
57
|
+
(r) => {
|
|
58
|
+
j && (A(!0), oe(r.clientX));
|
|
59
|
+
},
|
|
60
|
+
[j]
|
|
61
|
+
), ne = c(
|
|
62
|
+
(r) => {
|
|
63
|
+
if (!E) return;
|
|
64
|
+
A(!1);
|
|
65
|
+
const e = B - r.clientX;
|
|
66
|
+
e > w ? l() : e < -w && i();
|
|
67
|
+
},
|
|
68
|
+
[E, B, l, i]
|
|
69
|
+
), W = `calc((100% - ${I * (d - 1)}px) / ${d})`, be = (r) => {
|
|
70
|
+
const e = r === a, g = `${u}ms`;
|
|
71
|
+
switch (v) {
|
|
72
|
+
case "fade":
|
|
73
|
+
return {
|
|
74
|
+
position: "absolute",
|
|
75
|
+
inset: 0,
|
|
76
|
+
opacity: e ? 1 : 0,
|
|
77
|
+
transition: `opacity ${g} ease-in-out`,
|
|
78
|
+
zIndex: e ? 1 : 0,
|
|
79
|
+
pointerEvents: e ? "auto" : "none"
|
|
80
|
+
};
|
|
81
|
+
case "zoom":
|
|
82
|
+
return {
|
|
83
|
+
position: "absolute",
|
|
84
|
+
inset: 0,
|
|
85
|
+
opacity: e ? 1 : 0,
|
|
86
|
+
transform: e ? "scale(1)" : "scale(0.85)",
|
|
87
|
+
transition: `opacity ${g} ease, transform ${g} ease`,
|
|
88
|
+
zIndex: e ? 1 : 0,
|
|
89
|
+
pointerEvents: e ? "auto" : "none"
|
|
90
|
+
};
|
|
91
|
+
case "flip":
|
|
92
|
+
return {
|
|
93
|
+
position: "absolute",
|
|
94
|
+
inset: 0,
|
|
95
|
+
opacity: e ? 1 : 0,
|
|
96
|
+
transform: e ? "rotateY(0deg)" : "rotateY(90deg)",
|
|
97
|
+
transition: `opacity ${g} ease, transform ${g} ease`,
|
|
98
|
+
zIndex: e ? 1 : 0,
|
|
99
|
+
pointerEvents: e ? "auto" : "none",
|
|
100
|
+
backfaceVisibility: "hidden"
|
|
101
|
+
};
|
|
102
|
+
case "slide":
|
|
103
|
+
default:
|
|
104
|
+
return {};
|
|
24
105
|
}
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
let r = e;
|
|
28
|
-
i ? e < 0 ? r = s : e > s && (r = 0) : r = Math.max(0, Math.min(s, e)), C(r), d == null || d(r);
|
|
29
|
-
}, f = () => h(t + 1), w = () => h(t - 1), N = 50, X = (e) => {
|
|
30
|
-
x(null), R(e.targetTouches[0].clientX);
|
|
31
|
-
}, z = (e) => {
|
|
32
|
-
x(e.targetTouches[0].clientX);
|
|
33
|
-
}, A = () => {
|
|
34
|
-
if (!v || !y) return;
|
|
35
|
-
const e = v - y, r = e > N, B = e < -N;
|
|
36
|
-
r ? f() : B && w();
|
|
37
|
-
}, M = `calc((100% - ${c * (n - 1)}px) / ${n})`;
|
|
38
|
-
return /* @__PURE__ */ j(
|
|
106
|
+
}, ie = v === "fade" || v === "zoom" || v === "flip";
|
|
107
|
+
return /* @__PURE__ */ M(
|
|
39
108
|
"div",
|
|
40
109
|
{
|
|
41
|
-
ref:
|
|
42
|
-
className: b("bear-relative bear-overflow-hidden",
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
110
|
+
ref: ee,
|
|
111
|
+
className: b("bear-relative bear-overflow-hidden bear-outline-none", Y),
|
|
112
|
+
style: Z,
|
|
113
|
+
onMouseEnter: () => _ && C(!0),
|
|
114
|
+
onMouseLeave: () => {
|
|
115
|
+
_ && C(!1), E && A(!1);
|
|
116
|
+
},
|
|
117
|
+
onTouchStart: ae,
|
|
118
|
+
onTouchMove: te,
|
|
119
|
+
onTouchEnd: se,
|
|
120
|
+
onMouseDown: le,
|
|
121
|
+
onMouseUp: ne,
|
|
122
|
+
onKeyDown: re,
|
|
123
|
+
tabIndex: T ? 0 : void 0,
|
|
124
|
+
"data-testid": q,
|
|
125
|
+
role: "region",
|
|
126
|
+
"aria-label": "Carousel",
|
|
127
|
+
"aria-roledescription": "carousel",
|
|
49
128
|
children: [
|
|
50
|
-
/* @__PURE__ */
|
|
129
|
+
K && m > 0 && /* @__PURE__ */ t(
|
|
51
130
|
"div",
|
|
52
131
|
{
|
|
53
|
-
className: "bear-
|
|
54
|
-
style: {
|
|
55
|
-
|
|
56
|
-
transform: `translateX(calc(-${t} * (${M} + ${c}px)))`
|
|
57
|
-
},
|
|
58
|
-
children: p.map((e, r) => /* @__PURE__ */ a(
|
|
132
|
+
className: "bear-absolute bear-top-0 bear-left-0 bear-right-0 bear-z-20",
|
|
133
|
+
style: { height: fe },
|
|
134
|
+
children: /* @__PURE__ */ t(
|
|
59
135
|
"div",
|
|
60
136
|
{
|
|
61
|
-
className: "bear-
|
|
62
|
-
style: {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
137
|
+
className: "bear-h-full bear-transition-all bear-ease-linear",
|
|
138
|
+
style: {
|
|
139
|
+
width: `${(a + 1) / f * 100}%`,
|
|
140
|
+
background: h,
|
|
141
|
+
transition: `width ${u}ms ease`
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
)
|
|
67
145
|
}
|
|
68
146
|
),
|
|
69
|
-
|
|
70
|
-
|
|
147
|
+
ie ? /* @__PURE__ */ t("div", { className: "bear-relative", style: { minHeight: 200 }, children: x.map((r, e) => /* @__PURE__ */ t("div", { style: be(e), children: r }, e)) }) : /* @__PURE__ */ t(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
className: "bear-flex",
|
|
151
|
+
style: {
|
|
152
|
+
gap: `${I}px`,
|
|
153
|
+
transform: `translateX(calc(-${a} * (${W} + ${I}px)))`,
|
|
154
|
+
transition: `transform ${u}ms cubic-bezier(0.25, 0.1, 0.25, 1)`
|
|
155
|
+
},
|
|
156
|
+
children: x.map((r, e) => /* @__PURE__ */ t("div", { className: "bear-shrink-0", style: { width: W }, children: r }, e))
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
H && f > d && /* @__PURE__ */ M(ce, { children: [
|
|
160
|
+
/* @__PURE__ */ t(
|
|
71
161
|
"button",
|
|
72
162
|
{
|
|
73
|
-
onClick:
|
|
74
|
-
disabled: !
|
|
163
|
+
onClick: i,
|
|
164
|
+
disabled: !y && a === 0,
|
|
75
165
|
className: b(
|
|
76
166
|
"bear-absolute bear-left-2 bear-top-1/2 bear--translate-y-1/2",
|
|
77
|
-
"bear-
|
|
167
|
+
"bear-rounded-full bear-flex bear-items-center bear-justify-center",
|
|
78
168
|
"bear-bg-white/90 dark:bear-bg-gray-800/90 bear-shadow-lg",
|
|
79
169
|
"bear-text-gray-700 dark:bear-text-gray-200",
|
|
80
170
|
"hover:bear-bg-white dark:hover:bear-bg-gray-700",
|
|
81
171
|
"bear-transition-all bear-z-10",
|
|
82
172
|
"disabled:bear-opacity-50 disabled:bear-cursor-not-allowed"
|
|
83
173
|
),
|
|
84
|
-
|
|
174
|
+
style: { width: N, height: N },
|
|
175
|
+
"aria-label": "Previous slide",
|
|
176
|
+
children: /* @__PURE__ */ t("svg", { className: "bear-w-5 bear-h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) })
|
|
85
177
|
}
|
|
86
178
|
),
|
|
87
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ t(
|
|
88
180
|
"button",
|
|
89
181
|
{
|
|
90
|
-
onClick:
|
|
91
|
-
disabled: !
|
|
182
|
+
onClick: l,
|
|
183
|
+
disabled: !y && a === s,
|
|
92
184
|
className: b(
|
|
93
185
|
"bear-absolute bear-right-2 bear-top-1/2 bear--translate-y-1/2",
|
|
94
|
-
"bear-
|
|
186
|
+
"bear-rounded-full bear-flex bear-items-center bear-justify-center",
|
|
95
187
|
"bear-bg-white/90 dark:bear-bg-gray-800/90 bear-shadow-lg",
|
|
96
188
|
"bear-text-gray-700 dark:bear-text-gray-200",
|
|
97
189
|
"hover:bear-bg-white dark:hover:bear-bg-gray-700",
|
|
98
190
|
"bear-transition-all bear-z-10",
|
|
99
191
|
"disabled:bear-opacity-50 disabled:bear-cursor-not-allowed"
|
|
100
192
|
),
|
|
101
|
-
|
|
193
|
+
style: { width: N, height: N },
|
|
194
|
+
"aria-label": "Next slide",
|
|
195
|
+
children: /* @__PURE__ */ t("svg", { className: "bear-w-5 bear-h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })
|
|
102
196
|
}
|
|
103
197
|
)
|
|
104
198
|
] }),
|
|
105
|
-
|
|
199
|
+
V && /* @__PURE__ */ M("div", { className: "bear-absolute bear-top-3 bear-right-3 bear-z-10 bear-bg-black/50 bear-text-white bear-text-xs bear-font-medium bear-px-2.5 bear-py-1 bear-rounded-full", children: [
|
|
200
|
+
a + 1,
|
|
201
|
+
" / ",
|
|
202
|
+
f
|
|
203
|
+
] }),
|
|
204
|
+
P && k !== "none" && f > d && /* @__PURE__ */ t("div", { className: "bear-flex bear-justify-center bear-gap-2 bear-mt-4", children: k === "thumbnails" && L ? L.map((r, e) => /* @__PURE__ */ t(
|
|
106
205
|
"button",
|
|
107
206
|
{
|
|
108
|
-
onClick: () =>
|
|
207
|
+
onClick: () => o(e),
|
|
109
208
|
className: b(
|
|
110
|
-
"bear-
|
|
111
|
-
|
|
112
|
-
)
|
|
209
|
+
"bear-rounded bear-overflow-hidden bear-border-2 bear-transition-all",
|
|
210
|
+
e === a ? "bear-opacity-100 bear-scale-110" : "bear-opacity-60 hover:bear-opacity-80"
|
|
211
|
+
),
|
|
212
|
+
style: {
|
|
213
|
+
width: R,
|
|
214
|
+
height: R,
|
|
215
|
+
borderColor: e === a ? h : "transparent"
|
|
216
|
+
},
|
|
217
|
+
"aria-label": `Go to slide ${e + 1}`,
|
|
218
|
+
children: /* @__PURE__ */ t("img", { src: r, alt: "", className: "bear-w-full bear-h-full bear-object-cover" })
|
|
113
219
|
},
|
|
114
|
-
|
|
115
|
-
)) })
|
|
220
|
+
e
|
|
221
|
+
)) : k === "numbers" ? Array.from({ length: s + 1 }).map((r, e) => /* @__PURE__ */ t(
|
|
222
|
+
"button",
|
|
223
|
+
{
|
|
224
|
+
onClick: () => o(e),
|
|
225
|
+
className: b(
|
|
226
|
+
"bear-w-7 bear-h-7 bear-rounded-full bear-text-xs bear-font-medium bear-transition-all",
|
|
227
|
+
"bear-flex bear-items-center bear-justify-center",
|
|
228
|
+
e === a ? "bear-text-white bear-shadow-md" : "bear-bg-gray-200 dark:bear-bg-gray-600 bear-text-gray-600 dark:bear-text-gray-300 hover:bear-bg-gray-300 dark:hover:bear-bg-gray-500"
|
|
229
|
+
),
|
|
230
|
+
style: e === a ? { background: h } : void 0,
|
|
231
|
+
"aria-label": `Go to slide ${e + 1}`,
|
|
232
|
+
children: e + 1
|
|
233
|
+
},
|
|
234
|
+
e
|
|
235
|
+
)) : k === "bars" ? Array.from({ length: s + 1 }).map((r, e) => /* @__PURE__ */ t(
|
|
236
|
+
"button",
|
|
237
|
+
{
|
|
238
|
+
onClick: () => o(e),
|
|
239
|
+
className: b(
|
|
240
|
+
"bear-h-1 bear-rounded-full bear-transition-all",
|
|
241
|
+
e === a ? "bear-w-8" : "bear-w-4 bear-bg-gray-300 dark:bear-bg-gray-600 hover:bear-bg-gray-400 dark:hover:bear-bg-gray-500"
|
|
242
|
+
),
|
|
243
|
+
style: e === a ? { background: h } : void 0,
|
|
244
|
+
"aria-label": `Go to slide ${e + 1}`
|
|
245
|
+
},
|
|
246
|
+
e
|
|
247
|
+
)) : (
|
|
248
|
+
/* Default dots */
|
|
249
|
+
Array.from({ length: s + 1 }).map((r, e) => /* @__PURE__ */ t(
|
|
250
|
+
"button",
|
|
251
|
+
{
|
|
252
|
+
onClick: () => o(e),
|
|
253
|
+
className: b(
|
|
254
|
+
"bear-h-2.5 bear-rounded-full bear-transition-all",
|
|
255
|
+
e === a ? "bear-w-6" : "bear-w-2.5 bear-bg-gray-300 dark:bear-bg-gray-600 hover:bear-bg-gray-400 dark:hover:bear-bg-gray-500"
|
|
256
|
+
),
|
|
257
|
+
style: e === a ? { background: h } : void 0,
|
|
258
|
+
"aria-label": `Go to slide ${e + 1}`
|
|
259
|
+
},
|
|
260
|
+
e
|
|
261
|
+
))
|
|
262
|
+
) })
|
|
116
263
|
]
|
|
117
264
|
}
|
|
118
265
|
);
|
|
119
266
|
};
|
|
120
267
|
export {
|
|
121
|
-
|
|
268
|
+
we as Carousel
|
|
122
269
|
};
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Carousel transition effect
|
|
4
|
+
*/
|
|
5
|
+
export type CarouselTransition = 'slide' | 'fade' | 'zoom' | 'flip';
|
|
6
|
+
/**
|
|
7
|
+
* Carousel indicator style
|
|
8
|
+
*/
|
|
9
|
+
export type CarouselIndicator = 'dots' | 'numbers' | 'thumbnails' | 'bars' | 'none';
|
|
2
10
|
export interface CarouselProps {
|
|
3
11
|
/** Carousel slides */
|
|
4
12
|
children: ReactNode;
|
|
5
13
|
/** Auto-play interval in ms (0 to disable) */
|
|
6
14
|
autoPlay?: number;
|
|
7
|
-
/** Show navigation dots */
|
|
15
|
+
/** Show navigation dots/indicators */
|
|
8
16
|
showDots?: boolean;
|
|
9
17
|
/** Show arrow buttons */
|
|
10
18
|
showArrows?: boolean;
|
|
@@ -18,8 +26,30 @@ export interface CarouselProps {
|
|
|
18
26
|
pauseOnHover?: boolean;
|
|
19
27
|
/** Called when slide changes */
|
|
20
28
|
onSlideChange?: (index: number) => void;
|
|
29
|
+
/** Transition effect */
|
|
30
|
+
transition?: CarouselTransition;
|
|
31
|
+
/** Transition duration in ms */
|
|
32
|
+
transitionDuration?: number;
|
|
33
|
+
/** Indicator style */
|
|
34
|
+
indicator?: CarouselIndicator;
|
|
35
|
+
/** Thumbnail images for 'thumbnails' indicator */
|
|
36
|
+
thumbnails?: string[];
|
|
37
|
+
/** Thumbnail size in px */
|
|
38
|
+
thumbnailSize?: number;
|
|
39
|
+
/** Enable keyboard navigation */
|
|
40
|
+
keyboard?: boolean;
|
|
41
|
+
/** Enable drag/swipe to navigate */
|
|
42
|
+
draggable?: boolean;
|
|
43
|
+
/** Show progress bar */
|
|
44
|
+
showProgress?: boolean;
|
|
45
|
+
/** Show slide counter */
|
|
46
|
+
showCounter?: boolean;
|
|
47
|
+
/** Active dot/indicator color */
|
|
48
|
+
activeColor?: string;
|
|
21
49
|
/** Custom class name */
|
|
22
50
|
className?: string;
|
|
51
|
+
/** Custom styles */
|
|
52
|
+
style?: CSSProperties;
|
|
23
53
|
/** Test ID */
|
|
24
54
|
testId?: string;
|
|
25
55
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Carousel } from './Carousel';
|
|
2
|
-
export type { CarouselProps } from './Carousel.types';
|
|
2
|
+
export type { CarouselProps, CarouselTransition, CarouselIndicator } from './Carousel.types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),d=require("../../utils/cn.cjs"),D=require("../../context/BearProvider.cjs"),I=require("../Button/Button.cjs"),q=require("../Input/Input.cjs"),B=require("../Avatar/Avatar.cjs"),u=require("../Typography/Typography.cjs"),_=require("../Icon/index.cjs"),x=require("./Chat.const.cjs"),R=({message:r,showTimestamp:n=!0,showStatus:s=!0,showAvatar:b=!0,userAvatar:y,botAvatar:m})=>{var c;const a=r.sender==="user",f=r.sender==="system",l=x.SENDER_COLORS[r.sender];if(f)return e.jsx("div",{className:"flex justify-center my-2",children:e.jsx(u.Typography,{variant:"caption",className:"px-3 py-1 rounded-full bg-gray-100 dark:bg-gray-800",style:{color:l.text},children:r.content})});const v=a?y:m,p=r.status?x.MESSAGE_STATUS_ICONS[r.status]:null;return e.jsxs("div",{className:d.cn("flex gap-2 mb-3",a?"flex-row-reverse":"flex-row"),children:[b&&e.jsx(B.Avatar,{src:v,initials:((c=r.name)==null?void 0:c[0])||(a?"U":"B"),size:"sm",className:"flex-shrink-0"}),e.jsxs("div",{className:d.cn("flex flex-col max-w-[70%]",a?"items-end":"items-start"),children:[r.name&&e.jsx(u.Typography,{variant:"caption",className:"mb-1 opacity-60",children:r.name}),e.jsx("div",{className:d.cn("px-4 py-2 rounded-2xl",a?"rounded-br-sm":"rounded-bl-sm"),style:{backgroundColor:l.bg,color:l.text},children:typeof r.content=="string"?e.jsx(u.Typography,{variant:"body2",children:r.content}):r.content}),e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[n&&r.timestamp&&e.jsx(u.Typography,{variant:"caption",className:"opacity-50 text-xs",children:r.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),s&&p&&a&&e.jsx("span",{className:d.cn("text-xs",r.status==="read"?"text-blue-500":"opacity-50",r.status==="error"&&"text-red-500"),children:p})]})]})]})},H=({text:r=x.CHAT_DEFAULTS.TYPING_TEXT})=>e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsxs("div",{className:"flex gap-1 px-4 py-3 bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-sm",children:[e.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),e.jsx(u.Typography,{variant:"caption",className:"opacity-50",children:r})]}),U=({messages:r,onSend:n,isLoading:s=!1,placeholder:b=x.CHAT_DEFAULTS.PLACEHOLDER,header:y,footer:m,showTimestamps:a=!0,showStatus:f=!0,showAvatars:l=!0,userAvatar:v,botAvatar:p,isTyping:c=!1,typingText:C,className:S,height:j=x.CHAT_DEFAULTS.HEIGHT,testId:w,disabled:h=!1})=>{const{mode:E}=D.useBear(),k=E==="dark",[o,g]=i.useState(""),T=i.useRef(null);i.useEffect(()=>{var t;(t=T.current)==null||t.scrollIntoView({behavior:"smooth"})},[r,c]);const N=i.useCallback(()=>{o.trim()&&n&&!h&&!s&&(n(o.trim()),g(""))},[o,n,h,s]),A=i.useCallback(t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),N())},[N]);return e.jsxs("div",{className:d.cn("Bear-Chat","flex flex-col rounded-xl overflow-hidden border",k?"bg-gray-900 border-gray-700":"bg-white border-gray-200",S),style:{height:typeof j=="number"?`${j}px`:j},"data-testid":w,children:[y&&e.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:y}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[r.map(t=>e.jsx(R,{message:t,showTimestamp:a,showStatus:f,showAvatar:l,userAvatar:v,botAvatar:p},t.id)),c&&e.jsx(H,{text:C}),e.jsx("div",{ref:T})]}),e.jsxs("div",{className:"p-3 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(q.Input,{value:o,onChange:t=>g(t.target.value),onKeyDown:A,placeholder:b,disabled:h||s,className:"flex-1"}),e.jsx(I.Button,{variant:"primary",onClick:N,disabled:!o.trim()||h||s,children:e.jsx(_.BearIcons.SendIcon,{size:18})})]}),m&&e.jsx("div",{className:"mt-2",children:m})]})]})};exports.Chat=U;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={PLACEHOLDER:"Type a message...",HEIGHT:400,TYPING_TEXT:"is typing..."},t={sending:"○",sent:"✓",delivered:"✓✓",read:"✓✓",error:"!"},r={user:{bg:"var(--bear-primary-500)",text:"white"},bot:{bg:"var(--bear-bg-secondary)",text:"var(--bear-text-primary)"},system:{bg:"transparent",text:"var(--bear-text-tertiary)"}};exports.CHAT_DEFAULTS=e;exports.MESSAGE_STATUS_ICONS=t;exports.SENDER_COLORS=r;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const CHAT_DEFAULTS: {
|
|
2
|
+
readonly PLACEHOLDER: "Type a message...";
|
|
3
|
+
readonly HEIGHT: 400;
|
|
4
|
+
readonly TYPING_TEXT: "is typing...";
|
|
5
|
+
};
|
|
6
|
+
export declare const MESSAGE_STATUS_ICONS: {
|
|
7
|
+
readonly sending: "○";
|
|
8
|
+
readonly sent: "✓";
|
|
9
|
+
readonly delivered: "✓✓";
|
|
10
|
+
readonly read: "✓✓";
|
|
11
|
+
readonly error: "!";
|
|
12
|
+
};
|
|
13
|
+
export declare const SENDER_COLORS: {
|
|
14
|
+
readonly user: {
|
|
15
|
+
readonly bg: "var(--bear-primary-500)";
|
|
16
|
+
readonly text: "white";
|
|
17
|
+
};
|
|
18
|
+
readonly bot: {
|
|
19
|
+
readonly bg: "var(--bear-bg-secondary)";
|
|
20
|
+
readonly text: "var(--bear-text-primary)";
|
|
21
|
+
};
|
|
22
|
+
readonly system: {
|
|
23
|
+
readonly bg: "transparent";
|
|
24
|
+
readonly text: "var(--bear-text-tertiary)";
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
PLACEHOLDER: "Type a message...",
|
|
3
|
+
HEIGHT: 400,
|
|
4
|
+
TYPING_TEXT: "is typing..."
|
|
5
|
+
}, r = {
|
|
6
|
+
sending: "○",
|
|
7
|
+
sent: "✓",
|
|
8
|
+
delivered: "✓✓",
|
|
9
|
+
read: "✓✓",
|
|
10
|
+
error: "!"
|
|
11
|
+
}, t = {
|
|
12
|
+
user: {
|
|
13
|
+
bg: "var(--bear-primary-500)",
|
|
14
|
+
text: "white"
|
|
15
|
+
},
|
|
16
|
+
bot: {
|
|
17
|
+
bg: "var(--bear-bg-secondary)",
|
|
18
|
+
text: "var(--bear-text-primary)"
|
|
19
|
+
},
|
|
20
|
+
system: {
|
|
21
|
+
bg: "transparent",
|
|
22
|
+
text: "var(--bear-text-tertiary)"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
e as CHAT_DEFAULTS,
|
|
27
|
+
r as MESSAGE_STATUS_ICONS,
|
|
28
|
+
t as SENDER_COLORS
|
|
29
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ChatProps } from './Chat.types';
|
|
3
|
+
/**
|
|
4
|
+
* Chat - Chat interface component
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const [messages, setMessages] = useState<ChatMessage[]>([
|
|
9
|
+
* { id: '1', content: 'Hello!', sender: 'bot', timestamp: new Date() },
|
|
10
|
+
* ]);
|
|
11
|
+
*
|
|
12
|
+
* <Chat
|
|
13
|
+
* messages={messages}
|
|
14
|
+
* onSend={(msg) => setMessages([...messages, { id: Date.now().toString(), content: msg, sender: 'user' }])}
|
|
15
|
+
* isTyping={false}
|
|
16
|
+
* showAvatars
|
|
17
|
+
* />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const Chat: FC<ChatProps>;
|
|
21
|
+
export default Chat;
|