@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
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { jsxs as a, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as B, useRef as R, useEffect as _, useCallback as k } from "react";
|
|
3
|
+
import { cn as d } from "../../utils/cn.js";
|
|
4
|
+
import { useBear as H } from "../../context/BearProvider.js";
|
|
5
|
+
import { Button as O } from "../Button/Button.js";
|
|
6
|
+
import { Input as U } from "../Input/Input.js";
|
|
7
|
+
import { Avatar as j } from "../Avatar/Avatar.js";
|
|
8
|
+
import { Typography as m } from "../Typography/Typography.js";
|
|
9
|
+
import { BearIcons as G } from "../Icon/index.js";
|
|
10
|
+
import { CHAT_DEFAULTS as g, SENDER_COLORS as K, MESSAGE_STATUS_ICONS as V } from "./Chat.const.js";
|
|
11
|
+
const z = ({
|
|
12
|
+
message: e,
|
|
13
|
+
showTimestamp: o = !0,
|
|
14
|
+
showStatus: l = !0,
|
|
15
|
+
showAvatar: b = !0,
|
|
16
|
+
userAvatar: u,
|
|
17
|
+
botAvatar: p
|
|
18
|
+
}) => {
|
|
19
|
+
var s;
|
|
20
|
+
const n = e.sender === "user", h = e.sender === "system", i = K[e.sender];
|
|
21
|
+
if (h)
|
|
22
|
+
return /* @__PURE__ */ r("div", { className: "flex justify-center my-2", children: /* @__PURE__ */ r(
|
|
23
|
+
m,
|
|
24
|
+
{
|
|
25
|
+
variant: "caption",
|
|
26
|
+
className: "px-3 py-1 rounded-full bg-gray-100 dark:bg-gray-800",
|
|
27
|
+
style: { color: i.text },
|
|
28
|
+
children: e.content
|
|
29
|
+
}
|
|
30
|
+
) });
|
|
31
|
+
const x = n ? u : p, f = e.status ? V[e.status] : null;
|
|
32
|
+
return /* @__PURE__ */ a(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: d(
|
|
36
|
+
"flex gap-2 mb-3",
|
|
37
|
+
n ? "flex-row-reverse" : "flex-row"
|
|
38
|
+
),
|
|
39
|
+
children: [
|
|
40
|
+
b && /* @__PURE__ */ r(
|
|
41
|
+
j,
|
|
42
|
+
{
|
|
43
|
+
src: x,
|
|
44
|
+
initials: ((s = e.name) == null ? void 0 : s[0]) || (n ? "U" : "B"),
|
|
45
|
+
size: "sm",
|
|
46
|
+
className: "flex-shrink-0"
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ a("div", { className: d("flex flex-col max-w-[70%]", n ? "items-end" : "items-start"), children: [
|
|
50
|
+
e.name && /* @__PURE__ */ r(m, { variant: "caption", className: "mb-1 opacity-60", children: e.name }),
|
|
51
|
+
/* @__PURE__ */ r(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
className: d(
|
|
55
|
+
"px-4 py-2 rounded-2xl",
|
|
56
|
+
n ? "rounded-br-sm" : "rounded-bl-sm"
|
|
57
|
+
),
|
|
58
|
+
style: {
|
|
59
|
+
backgroundColor: i.bg,
|
|
60
|
+
color: i.text
|
|
61
|
+
},
|
|
62
|
+
children: typeof e.content == "string" ? /* @__PURE__ */ r(m, { variant: "body2", children: e.content }) : e.content
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-1 mt-1", children: [
|
|
66
|
+
o && e.timestamp && /* @__PURE__ */ r(m, { variant: "caption", className: "opacity-50 text-xs", children: e.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) }),
|
|
67
|
+
l && f && n && /* @__PURE__ */ r(
|
|
68
|
+
"span",
|
|
69
|
+
{
|
|
70
|
+
className: d(
|
|
71
|
+
"text-xs",
|
|
72
|
+
e.status === "read" ? "text-blue-500" : "opacity-50",
|
|
73
|
+
e.status === "error" && "text-red-500"
|
|
74
|
+
),
|
|
75
|
+
children: f
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] })
|
|
79
|
+
] })
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}, L = ({ text: e = g.TYPING_TEXT }) => /* @__PURE__ */ a("div", { className: "flex items-center gap-2 mb-3", children: [
|
|
84
|
+
/* @__PURE__ */ a("div", { className: "flex gap-1 px-4 py-3 bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-sm", children: [
|
|
85
|
+
/* @__PURE__ */ r("span", { className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: "0ms" } }),
|
|
86
|
+
/* @__PURE__ */ r("span", { className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: "150ms" } }),
|
|
87
|
+
/* @__PURE__ */ r("span", { className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: "300ms" } })
|
|
88
|
+
] }),
|
|
89
|
+
/* @__PURE__ */ r(m, { variant: "caption", className: "opacity-50", children: e })
|
|
90
|
+
] }), Z = ({
|
|
91
|
+
messages: e,
|
|
92
|
+
onSend: o,
|
|
93
|
+
isLoading: l = !1,
|
|
94
|
+
placeholder: b = g.PLACEHOLDER,
|
|
95
|
+
header: u,
|
|
96
|
+
footer: p,
|
|
97
|
+
showTimestamps: n = !0,
|
|
98
|
+
showStatus: h = !0,
|
|
99
|
+
showAvatars: i = !0,
|
|
100
|
+
userAvatar: x,
|
|
101
|
+
botAvatar: f,
|
|
102
|
+
isTyping: s = !1,
|
|
103
|
+
typingText: C,
|
|
104
|
+
className: S,
|
|
105
|
+
height: v = g.HEIGHT,
|
|
106
|
+
testId: T,
|
|
107
|
+
disabled: y = !1
|
|
108
|
+
}) => {
|
|
109
|
+
const { mode: D } = H(), I = D === "dark", [c, w] = B(""), E = R(null);
|
|
110
|
+
_(() => {
|
|
111
|
+
var t;
|
|
112
|
+
(t = E.current) == null || t.scrollIntoView({ behavior: "smooth" });
|
|
113
|
+
}, [e, s]);
|
|
114
|
+
const N = k(() => {
|
|
115
|
+
c.trim() && o && !y && !l && (o(c.trim()), w(""));
|
|
116
|
+
}, [c, o, y, l]), A = k((t) => {
|
|
117
|
+
t.key === "Enter" && !t.shiftKey && (t.preventDefault(), N());
|
|
118
|
+
}, [N]);
|
|
119
|
+
return /* @__PURE__ */ a(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
className: d(
|
|
123
|
+
"Bear-Chat",
|
|
124
|
+
"flex flex-col rounded-xl overflow-hidden border",
|
|
125
|
+
I ? "bg-gray-900 border-gray-700" : "bg-white border-gray-200",
|
|
126
|
+
S
|
|
127
|
+
),
|
|
128
|
+
style: { height: typeof v == "number" ? `${v}px` : v },
|
|
129
|
+
"data-testid": T,
|
|
130
|
+
children: [
|
|
131
|
+
u && /* @__PURE__ */ r("div", { className: "px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: u }),
|
|
132
|
+
/* @__PURE__ */ a("div", { className: "flex-1 overflow-y-auto p-4", children: [
|
|
133
|
+
e.map((t) => /* @__PURE__ */ r(
|
|
134
|
+
z,
|
|
135
|
+
{
|
|
136
|
+
message: t,
|
|
137
|
+
showTimestamp: n,
|
|
138
|
+
showStatus: h,
|
|
139
|
+
showAvatar: i,
|
|
140
|
+
userAvatar: x,
|
|
141
|
+
botAvatar: f
|
|
142
|
+
},
|
|
143
|
+
t.id
|
|
144
|
+
)),
|
|
145
|
+
s && /* @__PURE__ */ r(L, { text: C }),
|
|
146
|
+
/* @__PURE__ */ r("div", { ref: E })
|
|
147
|
+
] }),
|
|
148
|
+
/* @__PURE__ */ a("div", { className: "p-3 border-t border-gray-200 dark:border-gray-700", children: [
|
|
149
|
+
/* @__PURE__ */ a("div", { className: "flex gap-2", children: [
|
|
150
|
+
/* @__PURE__ */ r(
|
|
151
|
+
U,
|
|
152
|
+
{
|
|
153
|
+
value: c,
|
|
154
|
+
onChange: (t) => w(t.target.value),
|
|
155
|
+
onKeyDown: A,
|
|
156
|
+
placeholder: b,
|
|
157
|
+
disabled: y || l,
|
|
158
|
+
className: "flex-1"
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
/* @__PURE__ */ r(
|
|
162
|
+
O,
|
|
163
|
+
{
|
|
164
|
+
variant: "primary",
|
|
165
|
+
onClick: N,
|
|
166
|
+
disabled: !c.trim() || y || l,
|
|
167
|
+
children: /* @__PURE__ */ r(G.SendIcon, { size: 18 })
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
] }),
|
|
171
|
+
p && /* @__PURE__ */ r("div", { className: "mt-2", children: p })
|
|
172
|
+
] })
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
export {
|
|
178
|
+
Z as Chat
|
|
179
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ChatMessage {
|
|
3
|
+
id: string;
|
|
4
|
+
content: string | ReactNode;
|
|
5
|
+
sender: 'user' | 'bot' | 'system';
|
|
6
|
+
timestamp?: Date;
|
|
7
|
+
avatar?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
status?: 'sending' | 'sent' | 'delivered' | 'read' | 'error';
|
|
10
|
+
metadata?: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export interface ChatProps {
|
|
13
|
+
/** Array of messages */
|
|
14
|
+
messages: ChatMessage[];
|
|
15
|
+
/** Callback when user sends a message */
|
|
16
|
+
onSend?: (message: string) => void;
|
|
17
|
+
/** Loading state (e.g., waiting for bot response) */
|
|
18
|
+
isLoading?: boolean;
|
|
19
|
+
/** Placeholder text for input */
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
/** Chat header content */
|
|
22
|
+
header?: ReactNode;
|
|
23
|
+
/** Chat footer content (below input) */
|
|
24
|
+
footer?: ReactNode;
|
|
25
|
+
/** Show timestamps */
|
|
26
|
+
showTimestamps?: boolean;
|
|
27
|
+
/** Show message status */
|
|
28
|
+
showStatus?: boolean;
|
|
29
|
+
/** Show avatars */
|
|
30
|
+
showAvatars?: boolean;
|
|
31
|
+
/** User avatar URL */
|
|
32
|
+
userAvatar?: string;
|
|
33
|
+
/** Bot avatar URL */
|
|
34
|
+
botAvatar?: string;
|
|
35
|
+
/** Typing indicator */
|
|
36
|
+
isTyping?: boolean;
|
|
37
|
+
/** Typing indicator text */
|
|
38
|
+
typingText?: string;
|
|
39
|
+
/** Custom class name */
|
|
40
|
+
className?: string;
|
|
41
|
+
/** Height of the chat container */
|
|
42
|
+
height?: number | string;
|
|
43
|
+
/** Test ID */
|
|
44
|
+
testId?: string;
|
|
45
|
+
/** Disable input */
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface ChatBubbleProps {
|
|
49
|
+
message: ChatMessage;
|
|
50
|
+
showTimestamp?: boolean;
|
|
51
|
+
showStatus?: boolean;
|
|
52
|
+
showAvatar?: boolean;
|
|
53
|
+
userAvatar?: string;
|
|
54
|
+
botAvatar?: string;
|
|
55
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../../utils/cn.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../../utils/cn.cjs");require("react");const m=({children:l,variant:i="filled",color:c="default",size:b="md",icon:t,avatar:o,onDelete:n,onClick:a,disabled:r=!1,className:d})=>{const p={filled:{default:"bear-bg-zinc-600 bear-text-white",primary:"bear-bg-pink-500 bear-text-white",secondary:"bear-bg-purple-500 bear-text-white",success:"bear-bg-green-500 bear-text-white",warning:"bear-bg-yellow-500 bear-text-black",error:"bear-bg-red-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white"},outlined:{default:"bear-border bear-border-zinc-500 bear-text-zinc-300",primary:"bear-border bear-border-pink-500 bear-text-pink-400",secondary:"bear-border bear-border-purple-500 bear-text-purple-400",success:"bear-border bear-border-green-500 bear-text-green-400",warning:"bear-border bear-border-yellow-500 bear-text-yellow-400",error:"bear-border bear-border-red-500 bear-text-red-400",info:"bear-border bear-border-blue-500 bear-text-blue-400"},soft:{default:"bear-bg-zinc-500/20 bear-text-zinc-300",primary:"bear-bg-pink-500/20 bear-text-pink-400",secondary:"bear-bg-purple-500/20 bear-text-purple-400",success:"bear-bg-green-500/20 bear-text-green-400",warning:"bear-bg-yellow-500/20 bear-text-yellow-400",error:"bear-bg-red-500/20 bear-text-red-400",info:"bear-bg-blue-500/20 bear-text-blue-400"}},u={sm:"bear-h-6 bear-text-xs bear-px-2 bear-gap-1",md:"bear-h-8 bear-text-sm bear-px-3 bear-gap-1.5",lg:"bear-h-10 bear-text-base bear-px-4 bear-gap-2"},x={sm:"bear-w-3 bear-h-3",md:"bear-w-4 bear-h-4",lg:"bear-w-5 bear-h-5"},g=a?"button":"span";return e.jsxs(g,{onClick:a,disabled:r,className:s.cn("bear-inline-flex bear-items-center bear-rounded-full bear-font-medium bear-transition-all",u[b],p[i][c],a&&!r&&"bear-cursor-pointer hover:bear-opacity-80",r&&"bear-opacity-50 bear-cursor-not-allowed",d),children:[o&&e.jsx("span",{className:"bear--ml-1",children:o}),t&&e.jsx("span",{children:t}),e.jsx("span",{children:l}),n&&e.jsx("button",{onClick:h=>{h.stopPropagation(),n()},disabled:r,className:s.cn("bear-ml-1 bear-rounded-full bear-p-0.5 hover:bear-bg-black/20 bear-transition-colors",r&&"bear-cursor-not-allowed"),children:e.jsx("svg",{className:x[b],fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};exports.Chip=m;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { cn as l } from "../../utils/cn.js";
|
|
3
|
-
|
|
3
|
+
import "react";
|
|
4
|
+
const k = ({
|
|
4
5
|
children: s,
|
|
5
6
|
variant: i = "filled",
|
|
6
7
|
color: p = "default",
|
|
@@ -81,5 +82,5 @@ const y = ({
|
|
|
81
82
|
);
|
|
82
83
|
};
|
|
83
84
|
export {
|
|
84
|
-
|
|
85
|
+
k as Chip
|
|
85
86
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),s=require("react"),ie=require("../../utils/cn.cjs"),l=require("./CodeEditor.const.cjs"),le=require("./CodeEditor.utils.cjs"),oe=({value:n,onChange:r,language:S="typescript",theme:I="dark",customTheme:f,placeholder:B="Start typing...",showLineNumbers:T=!0,showGutter:_=!0,highlightActiveLine:G=!0,readOnly:p=!1,fontSize:v=l.DEFAULT_FONT_SIZE,fontFamily:N=l.DEFAULT_FONT_FAMILY,tabSize:k=l.DEFAULT_TAB_SIZE,autoIndent:j=!0,autoCloseBrackets:H=!0,wordWrap:x=!1,minHeight:w,maxHeight:D,height:q,className:O,style:Y,testId:Z,onFocus:g,onBlur:L})=>{const y=s.useRef(null),[R,F]=s.useState(!1),[A,J]=s.useState(0),[M,Q]=s.useState(0),[X,W]=s.useState(0),U=I==="dark"?l.DARK_THEME:l.LIGHT_THEME,a=s.useMemo(()=>({...U,...f,tokens:{...U.tokens,...f==null?void 0:f.tokens}}),[I,f]),h=s.useMemo(()=>n.split(`
|
|
2
|
+
`),[n]),z=s.useMemo(()=>h.map(e=>le.tokenizeLine(e,S)),[h,S]),K=s.useCallback(()=>{const e=y.current;if(!e)return;const t=e.value.substring(0,e.selectionStart);J(t.split(`
|
|
3
|
+
`).length-1)},[]),C=s.useCallback(e=>{var V;if(p)return;const t=y.current;if(!t)return;const{selectionStart:i,selectionEnd:d}=t;if(e.key==="Tab"){e.preventDefault();const c=" ".repeat(k),b=n.substring(0,i),E=n.substring(d),u=b+c+E;r==null||r(u),requestAnimationFrame(()=>{t.selectionStart=t.selectionEnd=i+k});return}if(e.key==="Enter"&&j){e.preventDefault();const c=n.substring(0,i),b=n.substring(d),u=((V=(c.split(`
|
|
4
|
+
`).pop()??"").match(/^\s*/))==null?void 0:V[0])??"",m=c.trim().slice(-1),$=["{","(","[",":"].includes(m)?" ".repeat(k):"",ne=c+`
|
|
5
|
+
`+u+$+b;r==null||r(ne),requestAnimationFrame(()=>{const ae=i+1+u.length+$.length;t.selectionStart=t.selectionEnd=ae});return}if(H&&l.AUTO_CLOSE_PAIRS[e.key]){e.preventDefault();const c=l.AUTO_CLOSE_PAIRS[e.key],b=n.substring(0,i),E=n.substring(i,d),u=n.substring(d);if(E){const m=b+e.key+E+c+u;r==null||r(m),requestAnimationFrame(()=>{t.selectionStart=i+1,t.selectionEnd=d+1})}else{const m=b+e.key+c+u;r==null||r(m),requestAnimationFrame(()=>{t.selectionStart=t.selectionEnd=i+1})}return}},[n,r,p,k,j,H]),ee=s.useCallback(e=>{p||r==null||r(e.target.value)},[r,p]),te=s.useCallback(()=>{const e=y.current;e&&(Q(e.scrollTop),W(e.scrollLeft))},[]),re=s.useCallback(()=>{F(!0),g==null||g()},[g]),se=s.useCallback(()=>{F(!1),L==null||L()},[L]),P=v*l.LINE_HEIGHT;return o.jsxs("div",{className:ie.cn("bear-relative bear-overflow-hidden bear-rounded-lg bear-font-mono","bear-border",R?"bear-ring-2 bear-ring-offset-1":"",O),style:{background:a.background,borderColor:a.gutterBorder,fontFamily:N,fontSize:v,lineHeight:l.LINE_HEIGHT,minHeight:w,maxHeight:D,height:q,"--bear-editor-ring":"var(--bear-primary-500)",...Y},"data-testid":Z,children:[o.jsxs("div",{className:"bear-relative bear-flex bear-h-full",children:[_&&T&&o.jsx("div",{className:"bear-flex-shrink-0 bear-select-none bear-text-right bear-pr-3 bear-overflow-hidden",style:{width:l.GUTTER_WIDTH,background:a.gutterBackground,borderRight:`1px solid ${a.gutterBorder}`,paddingTop:12,transform:`translateY(-${M}px)`},"aria-hidden":"true",children:h.map((e,t)=>o.jsx("div",{style:{height:P,color:t===A?a.lineNumberActive:a.lineNumber,fontWeight:t===A?600:400},children:t+1},t))}),o.jsxs("div",{className:"bear-relative bear-flex-1 bear-overflow-hidden",children:[o.jsx("div",{className:"bear-absolute bear-inset-0 bear-pointer-events-none bear-overflow-hidden",style:{padding:12,paddingLeft:_&&!T?12:16,transform:`translate(-${X}px, -${M}px)`,whiteSpace:x?"pre-wrap":"pre",wordBreak:x?"break-all":"normal"},"aria-hidden":"true",children:z.map((e,t)=>o.jsxs("div",{style:{height:P,background:G&&t===A&&R?a.selection:"transparent"},children:[e.map((i,d)=>o.jsx("span",{style:{color:a.tokens[i.type]??a.foreground},children:i.value},d)),e.length===0&&" "]},t))}),o.jsx("textarea",{ref:y,value:n,onChange:ee,onKeyDown:C,onScroll:te,onFocus:re,onBlur:se,onClick:K,onKeyUp:K,readOnly:p,placeholder:n?void 0:B,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",className:"bear-w-full bear-h-full bear-resize-none bear-outline-none",style:{padding:12,paddingLeft:_&&!T?12:16,background:"transparent",color:"transparent",caretColor:a.cursor,fontFamily:N,fontSize:v,lineHeight:l.LINE_HEIGHT,tabSize:k,whiteSpace:x?"pre-wrap":"pre",wordBreak:x?"break-all":"normal",minHeight:w??100,maxHeight:D,height:q??"auto"}})]})]}),o.jsx("div",{className:"bear-absolute bear-bottom-2 bear-right-3 bear-text-xs bear-font-medium bear-px-2 bear-py-0.5 bear-rounded bear-select-none",style:{color:a.lineNumber,background:a.gutterBackground},children:S})]})};exports.CodeEditor=oe;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=14,t="'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace",a=2,n=56,r=1.6,o={background:"#1e1e2e",foreground:"#cdd6f4",cursor:"#f5e0dc",selection:"rgba(137, 180, 250, 0.2)",lineNumber:"#585b70",lineNumberActive:"#a6adc8",gutterBackground:"#181825",gutterBorder:"#313244",tokens:{keyword:"#cba6f7",string:"#a6e3a1",number:"#fab387",comment:"#6c7086",operator:"#89dceb",punctuation:"#a6adc8",function:"#89b4fa",variable:"#f5e0dc",tag:"#f38ba8",attribute:"#f9e2af",property:"#89b4fa",builtin:"#f5c2e7",regex:"#a6e3a1",boolean:"#fab387",null:"#f38ba8",type:"#f9e2af",default:"#cdd6f4"}},i={background:"#eff1f5",foreground:"#4c4f69",cursor:"#dc8a78",selection:"rgba(114, 135, 253, 0.15)",lineNumber:"#9ca0b0",lineNumberActive:"#4c4f69",gutterBackground:"#e6e9ef",gutterBorder:"#ccd0da",tokens:{keyword:"#8839ef",string:"#40a02b",number:"#fe640b",comment:"#9ca0b0",operator:"#04a5e5",punctuation:"#6c6f85",function:"#1e66f5",variable:"#dc8a78",tag:"#d20f39",attribute:"#df8e1d",property:"#1e66f5",builtin:"#ea76cb",regex:"#40a02b",boolean:"#fe640b",null:"#d20f39",type:"#df8e1d",default:"#4c4f69"}},s={"(":")","[":"]","{":"}",'"':'"',"'":"'","`":"`"},c={javascript:["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","new","delete","typeof","instanceof","in","of","class","extends","super","this","import","export","from","default","async","await","try","catch","finally","throw","yield","void","null","undefined","true","false","NaN","Infinity"],typescript:["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","new","delete","typeof","instanceof","in","of","class","extends","super","this","import","export","from","default","async","await","try","catch","finally","throw","yield","void","null","undefined","true","false","interface","type","enum","implements","abstract","private","protected","public","readonly","static","as","is","keyof","never","unknown","any","string","number","boolean","object","symbol","bigint"],jsx:["const","let","var","function","return","if","else","for","while","class","extends","import","export","from","default","async","await","try","catch","throw","new","this","super","null","undefined","true","false"],tsx:["const","let","var","function","return","if","else","for","while","class","extends","import","export","from","default","async","await","try","catch","throw","new","this","super","null","undefined","true","false","interface","type","enum","as","is","keyof"],python:["def","class","return","if","elif","else","for","while","break","continue","pass","import","from","as","try","except","finally","raise","with","yield","lambda","global","nonlocal","assert","del","in","not","and","or","is","True","False","None","async","await","self"],html:["html","head","body","div","span","p","a","img","input","button","form","table","tr","td","th","ul","ol","li","h1","h2","h3","h4","h5","h6","section","header","footer","nav","main","article","aside","script","style","link","meta"],css:["color","background","margin","padding","border","display","position","width","height","font","text","flex","grid","align","justify","overflow","transition","animation","transform","opacity","z-index","box-shadow","cursor"],sql:["SELECT","FROM","WHERE","INSERT","INTO","UPDATE","DELETE","CREATE","DROP","ALTER","TABLE","INDEX","JOIN","LEFT","RIGHT","INNER","OUTER","ON","AND","OR","NOT","NULL","IS","IN","BETWEEN","LIKE","ORDER","BY","GROUP","HAVING","LIMIT","OFFSET","AS","SET","VALUES","DISTINCT","COUNT","SUM","AVG","MAX","MIN"],json:[],markdown:[],shell:["echo","cd","ls","mkdir","rm","cp","mv","cat","grep","sed","awk","find","chmod","chown","export","source","alias","if","then","else","fi","for","do","done","while","case","esac","function","return","exit","sudo","apt","npm","yarn","git"]},l=["console","Math","JSON","Array","Object","String","Number","Boolean","Date","RegExp","Error","Map","Set","Promise","setTimeout","setInterval","clearTimeout","clearInterval","parseInt","parseFloat","isNaN","isFinite","fetch","require","document","window","navigator","alert","confirm","prompt"];exports.AUTO_CLOSE_PAIRS=s;exports.BUILTIN_FUNCTIONS=l;exports.DARK_THEME=o;exports.DEFAULT_FONT_FAMILY=t;exports.DEFAULT_FONT_SIZE=e;exports.DEFAULT_TAB_SIZE=a;exports.GUTTER_WIDTH=n;exports.LANGUAGE_KEYWORDS=c;exports.LIGHT_THEME=i;exports.LINE_HEIGHT=r;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CodeEditorTheme, CodeEditorLanguage } from './CodeEditor.types';
|
|
2
|
+
/** Default font size */
|
|
3
|
+
export declare const DEFAULT_FONT_SIZE = 14;
|
|
4
|
+
/** Default font family */
|
|
5
|
+
export declare const DEFAULT_FONT_FAMILY = "'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace";
|
|
6
|
+
/** Default tab size */
|
|
7
|
+
export declare const DEFAULT_TAB_SIZE = 2;
|
|
8
|
+
/** Gutter width */
|
|
9
|
+
export declare const GUTTER_WIDTH = 56;
|
|
10
|
+
/** Line height multiplier */
|
|
11
|
+
export declare const LINE_HEIGHT = 1.6;
|
|
12
|
+
/** Dark theme */
|
|
13
|
+
export declare const DARK_THEME: CodeEditorTheme;
|
|
14
|
+
/** Light theme */
|
|
15
|
+
export declare const LIGHT_THEME: CodeEditorTheme;
|
|
16
|
+
/** Auto-close pairs */
|
|
17
|
+
export declare const AUTO_CLOSE_PAIRS: Record<string, string>;
|
|
18
|
+
/** Keywords per language */
|
|
19
|
+
export declare const LANGUAGE_KEYWORDS: Partial<Record<CodeEditorLanguage, string[]>>;
|
|
20
|
+
/** Builtin functions */
|
|
21
|
+
export declare const BUILTIN_FUNCTIONS: string[];
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
const e = 14, t = "'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace", a = 2, n = 56, r = 1.6, o = {
|
|
2
|
+
background: "#1e1e2e",
|
|
3
|
+
foreground: "#cdd6f4",
|
|
4
|
+
cursor: "#f5e0dc",
|
|
5
|
+
selection: "rgba(137, 180, 250, 0.2)",
|
|
6
|
+
lineNumber: "#585b70",
|
|
7
|
+
lineNumberActive: "#a6adc8",
|
|
8
|
+
gutterBackground: "#181825",
|
|
9
|
+
gutterBorder: "#313244",
|
|
10
|
+
tokens: {
|
|
11
|
+
keyword: "#cba6f7",
|
|
12
|
+
string: "#a6e3a1",
|
|
13
|
+
number: "#fab387",
|
|
14
|
+
comment: "#6c7086",
|
|
15
|
+
operator: "#89dceb",
|
|
16
|
+
punctuation: "#a6adc8",
|
|
17
|
+
function: "#89b4fa",
|
|
18
|
+
variable: "#f5e0dc",
|
|
19
|
+
tag: "#f38ba8",
|
|
20
|
+
attribute: "#f9e2af",
|
|
21
|
+
property: "#89b4fa",
|
|
22
|
+
builtin: "#f5c2e7",
|
|
23
|
+
regex: "#a6e3a1",
|
|
24
|
+
boolean: "#fab387",
|
|
25
|
+
null: "#f38ba8",
|
|
26
|
+
type: "#f9e2af",
|
|
27
|
+
default: "#cdd6f4"
|
|
28
|
+
}
|
|
29
|
+
}, i = {
|
|
30
|
+
background: "#eff1f5",
|
|
31
|
+
foreground: "#4c4f69",
|
|
32
|
+
cursor: "#dc8a78",
|
|
33
|
+
selection: "rgba(114, 135, 253, 0.15)",
|
|
34
|
+
lineNumber: "#9ca0b0",
|
|
35
|
+
lineNumberActive: "#4c4f69",
|
|
36
|
+
gutterBackground: "#e6e9ef",
|
|
37
|
+
gutterBorder: "#ccd0da",
|
|
38
|
+
tokens: {
|
|
39
|
+
keyword: "#8839ef",
|
|
40
|
+
string: "#40a02b",
|
|
41
|
+
number: "#fe640b",
|
|
42
|
+
comment: "#9ca0b0",
|
|
43
|
+
operator: "#04a5e5",
|
|
44
|
+
punctuation: "#6c6f85",
|
|
45
|
+
function: "#1e66f5",
|
|
46
|
+
variable: "#dc8a78",
|
|
47
|
+
tag: "#d20f39",
|
|
48
|
+
attribute: "#df8e1d",
|
|
49
|
+
property: "#1e66f5",
|
|
50
|
+
builtin: "#ea76cb",
|
|
51
|
+
regex: "#40a02b",
|
|
52
|
+
boolean: "#fe640b",
|
|
53
|
+
null: "#d20f39",
|
|
54
|
+
type: "#df8e1d",
|
|
55
|
+
default: "#4c4f69"
|
|
56
|
+
}
|
|
57
|
+
}, s = {
|
|
58
|
+
"(": ")",
|
|
59
|
+
"[": "]",
|
|
60
|
+
"{": "}",
|
|
61
|
+
'"': '"',
|
|
62
|
+
"'": "'",
|
|
63
|
+
"`": "`"
|
|
64
|
+
}, c = {
|
|
65
|
+
javascript: ["const", "let", "var", "function", "return", "if", "else", "for", "while", "do", "switch", "case", "break", "continue", "new", "delete", "typeof", "instanceof", "in", "of", "class", "extends", "super", "this", "import", "export", "from", "default", "async", "await", "try", "catch", "finally", "throw", "yield", "void", "null", "undefined", "true", "false", "NaN", "Infinity"],
|
|
66
|
+
typescript: ["const", "let", "var", "function", "return", "if", "else", "for", "while", "do", "switch", "case", "break", "continue", "new", "delete", "typeof", "instanceof", "in", "of", "class", "extends", "super", "this", "import", "export", "from", "default", "async", "await", "try", "catch", "finally", "throw", "yield", "void", "null", "undefined", "true", "false", "interface", "type", "enum", "implements", "abstract", "private", "protected", "public", "readonly", "static", "as", "is", "keyof", "never", "unknown", "any", "string", "number", "boolean", "object", "symbol", "bigint"],
|
|
67
|
+
jsx: ["const", "let", "var", "function", "return", "if", "else", "for", "while", "class", "extends", "import", "export", "from", "default", "async", "await", "try", "catch", "throw", "new", "this", "super", "null", "undefined", "true", "false"],
|
|
68
|
+
tsx: ["const", "let", "var", "function", "return", "if", "else", "for", "while", "class", "extends", "import", "export", "from", "default", "async", "await", "try", "catch", "throw", "new", "this", "super", "null", "undefined", "true", "false", "interface", "type", "enum", "as", "is", "keyof"],
|
|
69
|
+
python: ["def", "class", "return", "if", "elif", "else", "for", "while", "break", "continue", "pass", "import", "from", "as", "try", "except", "finally", "raise", "with", "yield", "lambda", "global", "nonlocal", "assert", "del", "in", "not", "and", "or", "is", "True", "False", "None", "async", "await", "self"],
|
|
70
|
+
html: ["html", "head", "body", "div", "span", "p", "a", "img", "input", "button", "form", "table", "tr", "td", "th", "ul", "ol", "li", "h1", "h2", "h3", "h4", "h5", "h6", "section", "header", "footer", "nav", "main", "article", "aside", "script", "style", "link", "meta"],
|
|
71
|
+
css: ["color", "background", "margin", "padding", "border", "display", "position", "width", "height", "font", "text", "flex", "grid", "align", "justify", "overflow", "transition", "animation", "transform", "opacity", "z-index", "box-shadow", "cursor"],
|
|
72
|
+
sql: ["SELECT", "FROM", "WHERE", "INSERT", "INTO", "UPDATE", "DELETE", "CREATE", "DROP", "ALTER", "TABLE", "INDEX", "JOIN", "LEFT", "RIGHT", "INNER", "OUTER", "ON", "AND", "OR", "NOT", "NULL", "IS", "IN", "BETWEEN", "LIKE", "ORDER", "BY", "GROUP", "HAVING", "LIMIT", "OFFSET", "AS", "SET", "VALUES", "DISTINCT", "COUNT", "SUM", "AVG", "MAX", "MIN"],
|
|
73
|
+
json: [],
|
|
74
|
+
markdown: [],
|
|
75
|
+
shell: ["echo", "cd", "ls", "mkdir", "rm", "cp", "mv", "cat", "grep", "sed", "awk", "find", "chmod", "chown", "export", "source", "alias", "if", "then", "else", "fi", "for", "do", "done", "while", "case", "esac", "function", "return", "exit", "sudo", "apt", "npm", "yarn", "git"]
|
|
76
|
+
}, l = [
|
|
77
|
+
"console",
|
|
78
|
+
"Math",
|
|
79
|
+
"JSON",
|
|
80
|
+
"Array",
|
|
81
|
+
"Object",
|
|
82
|
+
"String",
|
|
83
|
+
"Number",
|
|
84
|
+
"Boolean",
|
|
85
|
+
"Date",
|
|
86
|
+
"RegExp",
|
|
87
|
+
"Error",
|
|
88
|
+
"Map",
|
|
89
|
+
"Set",
|
|
90
|
+
"Promise",
|
|
91
|
+
"setTimeout",
|
|
92
|
+
"setInterval",
|
|
93
|
+
"clearTimeout",
|
|
94
|
+
"clearInterval",
|
|
95
|
+
"parseInt",
|
|
96
|
+
"parseFloat",
|
|
97
|
+
"isNaN",
|
|
98
|
+
"isFinite",
|
|
99
|
+
"fetch",
|
|
100
|
+
"require",
|
|
101
|
+
"document",
|
|
102
|
+
"window",
|
|
103
|
+
"navigator",
|
|
104
|
+
"alert",
|
|
105
|
+
"confirm",
|
|
106
|
+
"prompt"
|
|
107
|
+
];
|
|
108
|
+
export {
|
|
109
|
+
s as AUTO_CLOSE_PAIRS,
|
|
110
|
+
l as BUILTIN_FUNCTIONS,
|
|
111
|
+
o as DARK_THEME,
|
|
112
|
+
t as DEFAULT_FONT_FAMILY,
|
|
113
|
+
e as DEFAULT_FONT_SIZE,
|
|
114
|
+
a as DEFAULT_TAB_SIZE,
|
|
115
|
+
n as GUTTER_WIDTH,
|
|
116
|
+
c as LANGUAGE_KEYWORDS,
|
|
117
|
+
i as LIGHT_THEME,
|
|
118
|
+
r as LINE_HEIGHT
|
|
119
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { CodeEditorProps } from './CodeEditor.types';
|
|
3
|
+
/**
|
|
4
|
+
* CodeEditor - Syntax-highlighted code editor with line numbers
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Zero-dependency code editor with syntax highlighting for multiple
|
|
8
|
+
* languages, line numbers, auto-indent, bracket pairing, and theming.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <CodeEditor
|
|
13
|
+
* value={code}
|
|
14
|
+
* onChange={setCode}
|
|
15
|
+
* language="typescript"
|
|
16
|
+
* theme="dark"
|
|
17
|
+
* showLineNumbers
|
|
18
|
+
* height={400}
|
|
19
|
+
* />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const CodeEditor: FC<CodeEditorProps>;
|