@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,127 @@
|
|
|
1
|
+
import { jsxs as r, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as v } from "react";
|
|
3
|
+
import { cn as h } from "../../utils/cn.js";
|
|
4
|
+
import { useBear as B } from "../../context/BearProvider.js";
|
|
5
|
+
import { Typography as i } from "../Typography/Typography.js";
|
|
6
|
+
import { LINE_NUMBER_WIDTH as M, DIFF_COLORS as O } from "./DiffViewer.const.js";
|
|
7
|
+
import { computeDiff as _, computeStats as j } from "./DiffViewer.utils.js";
|
|
8
|
+
const H = ({
|
|
9
|
+
oldValue: l,
|
|
10
|
+
newValue: m,
|
|
11
|
+
viewMode: x = "split",
|
|
12
|
+
showLineNumbers: y = !0,
|
|
13
|
+
oldTitle: N = "Original",
|
|
14
|
+
newTitle: u = "Modified",
|
|
15
|
+
showStats: f = !0,
|
|
16
|
+
className: p,
|
|
17
|
+
testId: g
|
|
18
|
+
}) => {
|
|
19
|
+
const { mode: w } = B(), b = w === "dark", o = v(() => _(l, m), [l, m]), t = v(() => j(o), [o]), n = (e) => y ? /* @__PURE__ */ d(
|
|
20
|
+
"span",
|
|
21
|
+
{
|
|
22
|
+
className: "select-none text-gray-400 dark:text-gray-600 text-right pr-3",
|
|
23
|
+
style: { minWidth: M },
|
|
24
|
+
children: e ?? ""
|
|
25
|
+
}
|
|
26
|
+
) : null, s = (e, a) => {
|
|
27
|
+
const c = O[a], D = a === "add" ? "+" : a === "remove" ? "-" : " ";
|
|
28
|
+
return /* @__PURE__ */ r(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
className: "flex font-mono text-sm",
|
|
32
|
+
style: {
|
|
33
|
+
backgroundColor: c.bg,
|
|
34
|
+
borderLeft: `3px solid ${c.border}`
|
|
35
|
+
},
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ d(
|
|
38
|
+
"span",
|
|
39
|
+
{
|
|
40
|
+
className: "px-2 select-none font-bold",
|
|
41
|
+
style: { color: c.text },
|
|
42
|
+
children: D
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ d("span", { className: "flex-1 whitespace-pre", children: e })
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
if (x === "unified")
|
|
51
|
+
return /* @__PURE__ */ r(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
className: h(
|
|
55
|
+
"Bear-DiffViewer",
|
|
56
|
+
"rounded-lg overflow-hidden border",
|
|
57
|
+
b ? "bg-gray-900 border-gray-700" : "bg-white border-gray-200",
|
|
58
|
+
p
|
|
59
|
+
),
|
|
60
|
+
"data-testid": g,
|
|
61
|
+
children: [
|
|
62
|
+
f && /* @__PURE__ */ r("div", { className: "flex items-center gap-4 px-4 py-2 border-b border-gray-200 dark:border-gray-700", children: [
|
|
63
|
+
/* @__PURE__ */ r(i, { variant: "caption", className: "text-green-600", children: [
|
|
64
|
+
"+",
|
|
65
|
+
t.additions,
|
|
66
|
+
" additions"
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ r(i, { variant: "caption", className: "text-red-600", children: [
|
|
69
|
+
"-",
|
|
70
|
+
t.deletions,
|
|
71
|
+
" deletions"
|
|
72
|
+
] })
|
|
73
|
+
] }),
|
|
74
|
+
/* @__PURE__ */ d("div", { className: "overflow-x-auto", children: o.map((e, a) => /* @__PURE__ */ r("div", { className: "flex", children: [
|
|
75
|
+
n(e.oldLineNumber || e.newLineNumber),
|
|
76
|
+
/* @__PURE__ */ d("div", { className: "flex-1", children: s(e.content, e.type) })
|
|
77
|
+
] }, a)) })
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
const k = o.filter((e) => e.type !== "add"), L = o.filter((e) => e.type !== "remove");
|
|
82
|
+
return /* @__PURE__ */ r(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
className: h(
|
|
86
|
+
"Bear-DiffViewer",
|
|
87
|
+
"rounded-lg overflow-hidden border",
|
|
88
|
+
b ? "bg-gray-900 border-gray-700" : "bg-white border-gray-200",
|
|
89
|
+
p
|
|
90
|
+
),
|
|
91
|
+
"data-testid": g,
|
|
92
|
+
children: [
|
|
93
|
+
f && /* @__PURE__ */ r("div", { className: "flex items-center gap-4 px-4 py-2 border-b border-gray-200 dark:border-gray-700", children: [
|
|
94
|
+
/* @__PURE__ */ r(i, { variant: "caption", className: "text-green-600", children: [
|
|
95
|
+
"+",
|
|
96
|
+
t.additions,
|
|
97
|
+
" additions"
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ r(i, { variant: "caption", className: "text-red-600", children: [
|
|
100
|
+
"-",
|
|
101
|
+
t.deletions,
|
|
102
|
+
" deletions"
|
|
103
|
+
] })
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 divide-x divide-gray-200 dark:divide-gray-700", children: [
|
|
106
|
+
/* @__PURE__ */ r("div", { children: [
|
|
107
|
+
/* @__PURE__ */ d("div", { className: "px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ d(i, { variant: "caption", className: "font-semibold", children: N }) }),
|
|
108
|
+
/* @__PURE__ */ d("div", { className: "overflow-x-auto", children: k.map((e, a) => /* @__PURE__ */ r("div", { className: "flex", children: [
|
|
109
|
+
n(e.oldLineNumber),
|
|
110
|
+
/* @__PURE__ */ d("div", { className: "flex-1", children: s(e.content, e.type === "remove" ? "remove" : "context") })
|
|
111
|
+
] }, a)) })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ r("div", { children: [
|
|
114
|
+
/* @__PURE__ */ d("div", { className: "px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ d(i, { variant: "caption", className: "font-semibold", children: u }) }),
|
|
115
|
+
/* @__PURE__ */ d("div", { className: "overflow-x-auto", children: L.map((e, a) => /* @__PURE__ */ r("div", { className: "flex", children: [
|
|
116
|
+
n(e.newLineNumber),
|
|
117
|
+
/* @__PURE__ */ d("div", { className: "flex-1", children: s(e.content, e.type === "add" ? "add" : "context") })
|
|
118
|
+
] }, a)) })
|
|
119
|
+
] })
|
|
120
|
+
] })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
export {
|
|
126
|
+
H as DiffViewer
|
|
127
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DiffViewer component types
|
|
3
|
+
*/
|
|
4
|
+
export type DiffViewMode = 'split' | 'unified';
|
|
5
|
+
export type DiffLineType = 'add' | 'remove' | 'context';
|
|
6
|
+
export interface DiffViewerProps {
|
|
7
|
+
/** Original text (left side) */
|
|
8
|
+
oldValue: string;
|
|
9
|
+
/** New text (right side) */
|
|
10
|
+
newValue: string;
|
|
11
|
+
/** View mode (default: 'split') */
|
|
12
|
+
viewMode?: DiffViewMode;
|
|
13
|
+
/** Show line numbers */
|
|
14
|
+
showLineNumbers?: boolean;
|
|
15
|
+
/** Highlight syntax (for code) */
|
|
16
|
+
syntaxHighlight?: boolean;
|
|
17
|
+
/** Language for syntax highlighting */
|
|
18
|
+
language?: string;
|
|
19
|
+
/** Old value title */
|
|
20
|
+
oldTitle?: string;
|
|
21
|
+
/** New value title */
|
|
22
|
+
newTitle?: string;
|
|
23
|
+
/** Show diff statistics */
|
|
24
|
+
showStats?: boolean;
|
|
25
|
+
/** Custom class name */
|
|
26
|
+
className?: string;
|
|
27
|
+
/** Test ID */
|
|
28
|
+
testId?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface DiffLine {
|
|
31
|
+
type: DiffLineType;
|
|
32
|
+
oldLineNumber?: number;
|
|
33
|
+
newLineNumber?: number;
|
|
34
|
+
content: string;
|
|
35
|
+
}
|
|
36
|
+
export interface DiffStats {
|
|
37
|
+
additions: number;
|
|
38
|
+
deletions: number;
|
|
39
|
+
unchanged: number;
|
|
40
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function m(d,s){const o=d.split(`
|
|
2
|
+
`),u=s.split(`
|
|
3
|
+
`),p=o.length,f=u.length,l=Array(p+1).fill(null).map(()=>Array(f+1).fill(0));for(let t=1;t<=p;t++)for(let i=1;i<=f;i++)o[t-1]===u[i-1]?l[t][i]=l[t-1][i-1]+1:l[t][i]=Math.max(l[t-1][i],l[t][i-1]);const c=[];let e=p,n=f;const r=[];for(;e>0||n>0;)e>0&&n>0&&o[e-1]===u[n-1]?(r.push({type:"context",oldLineNumber:e,newLineNumber:n,content:o[e-1]}),e--,n--):n>0&&(e===0||l[e][n-1]>=l[e-1][n])?(r.push({type:"add",newLineNumber:n,content:u[n-1]}),n--):e>0&&(r.push({type:"remove",oldLineNumber:e,content:o[e-1]}),e--);for(let t=r.length-1;t>=0;t--)c.push(r[t]);return c}function a(d){return d.reduce((s,o)=>(o.type==="add"?s.additions++:o.type==="remove"?s.deletions++:s.unchanged++,s),{additions:0,deletions:0,unchanged:0})}exports.computeDiff=m;exports.computeStats=a;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DiffLine, DiffStats } from './DiffViewer.types';
|
|
2
|
+
/**
|
|
3
|
+
* Simple diff algorithm (Myers-like LCS based)
|
|
4
|
+
*/
|
|
5
|
+
export declare function computeDiff(oldText: string, newText: string): DiffLine[];
|
|
6
|
+
/**
|
|
7
|
+
* Calculate diff statistics
|
|
8
|
+
*/
|
|
9
|
+
export declare function computeStats(diff: DiffLine[]): DiffStats;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function m(d, s) {
|
|
2
|
+
const o = d.split(`
|
|
3
|
+
`), u = s.split(`
|
|
4
|
+
`), p = o.length, f = u.length, l = Array(p + 1).fill(null).map(() => Array(f + 1).fill(0));
|
|
5
|
+
for (let t = 1; t <= p; t++)
|
|
6
|
+
for (let i = 1; i <= f; i++)
|
|
7
|
+
o[t - 1] === u[i - 1] ? l[t][i] = l[t - 1][i - 1] + 1 : l[t][i] = Math.max(l[t - 1][i], l[t][i - 1]);
|
|
8
|
+
const c = [];
|
|
9
|
+
let e = p, n = f;
|
|
10
|
+
const r = [];
|
|
11
|
+
for (; e > 0 || n > 0; )
|
|
12
|
+
e > 0 && n > 0 && o[e - 1] === u[n - 1] ? (r.push({
|
|
13
|
+
type: "context",
|
|
14
|
+
oldLineNumber: e,
|
|
15
|
+
newLineNumber: n,
|
|
16
|
+
content: o[e - 1]
|
|
17
|
+
}), e--, n--) : n > 0 && (e === 0 || l[e][n - 1] >= l[e - 1][n]) ? (r.push({
|
|
18
|
+
type: "add",
|
|
19
|
+
newLineNumber: n,
|
|
20
|
+
content: u[n - 1]
|
|
21
|
+
}), n--) : e > 0 && (r.push({
|
|
22
|
+
type: "remove",
|
|
23
|
+
oldLineNumber: e,
|
|
24
|
+
content: o[e - 1]
|
|
25
|
+
}), e--);
|
|
26
|
+
for (let t = r.length - 1; t >= 0; t--)
|
|
27
|
+
c.push(r[t]);
|
|
28
|
+
return c;
|
|
29
|
+
}
|
|
30
|
+
function h(d) {
|
|
31
|
+
return d.reduce(
|
|
32
|
+
(s, o) => (o.type === "add" ? s.additions++ : o.type === "remove" ? s.deletions++ : s.unchanged++, s),
|
|
33
|
+
{ additions: 0, deletions: 0, unchanged: 0 }
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
m as computeDiff,
|
|
38
|
+
h as computeStats
|
|
39
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("../../utils/cn.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("../../utils/cn.cjs");require("react");const l={solid:"bear-border-solid",dashed:"bear-border-dashed",dotted:"bear-border-dotted"},u={left:"before:bear-w-4 after:bear-flex-1",center:"before:bear-flex-1 after:bear-flex-1",right:"before:bear-flex-1 after:bear-w-4"},c=({children:i,orientation:n="horizontal",variant:b="solid",color:d,textAlign:x="center",thickness:r=1,spacing:a=4,className:s,testId:f,style:m,...h})=>{const e=n==="horizontal";return i?o.jsxs("div",{className:t.cn("bear-flex bear-items-center bear-gap-4",e?"bear-w-full":"bear-flex-col bear-h-full",u[x],s),role:"separator",style:{marginTop:e?`${a*.25}rem`:0,marginBottom:e?`${a*.25}rem`:0,...m},"data-testid":f,children:[o.jsx("span",{className:t.cn("bear-flex-shrink-0",l[b]),style:{borderTopWidth:e?r:0,borderLeftWidth:e?0:r,borderColor:d||"#e5e7eb"}}),o.jsx("span",{className:"bear-text-sm bear-text-gray-500 bear-whitespace-nowrap bear-px-2",children:i}),o.jsx("span",{className:t.cn("bear-flex-shrink-0",l[b]),style:{borderTopWidth:e?r:0,borderLeftWidth:e?0:r,borderColor:d||"#e5e7eb"}})]}):o.jsx("hr",{className:t.cn("bear-border-0",e?"bear-w-full":"bear-h-full bear-w-px",l[b],s),style:{borderTopWidth:e?r:0,borderLeftWidth:e?0:r,borderColor:d||"#e5e7eb",marginTop:e?`${a*.25}rem`:0,marginBottom:e?`${a*.25}rem`:0,marginLeft:e?0:`${a*.25}rem`,marginRight:e?0:`${a*.25}rem`,...m},"data-testid":f,...h})};exports.Divider=c;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a, jsxs as p } from "react/jsx-runtime";
|
|
2
2
|
import { cn as t } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
3
4
|
const l = {
|
|
4
5
|
solid: "bear-border-solid",
|
|
5
6
|
dashed: "bear-border-dashed",
|
|
@@ -8,14 +9,14 @@ const l = {
|
|
|
8
9
|
left: "before:bear-w-4 after:bear-flex-1",
|
|
9
10
|
center: "before:bear-flex-1 after:bear-flex-1",
|
|
10
11
|
right: "before:bear-flex-1 after:bear-w-4"
|
|
11
|
-
},
|
|
12
|
+
}, N = ({
|
|
12
13
|
children: f,
|
|
13
14
|
orientation: x = "horizontal",
|
|
14
15
|
variant: b = "solid",
|
|
15
16
|
color: d,
|
|
16
17
|
textAlign: h = "center",
|
|
17
18
|
thickness: r = 1,
|
|
18
|
-
spacing:
|
|
19
|
+
spacing: o = 4,
|
|
19
20
|
className: m,
|
|
20
21
|
testId: i,
|
|
21
22
|
style: s,
|
|
@@ -33,13 +34,13 @@ const l = {
|
|
|
33
34
|
),
|
|
34
35
|
role: "separator",
|
|
35
36
|
style: {
|
|
36
|
-
marginTop: e ? `${
|
|
37
|
-
marginBottom: e ? `${
|
|
37
|
+
marginTop: e ? `${o * 0.25}rem` : 0,
|
|
38
|
+
marginBottom: e ? `${o * 0.25}rem` : 0,
|
|
38
39
|
...s
|
|
39
40
|
},
|
|
40
41
|
"data-testid": i,
|
|
41
42
|
children: [
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ a(
|
|
43
44
|
"span",
|
|
44
45
|
{
|
|
45
46
|
className: t(
|
|
@@ -53,8 +54,8 @@ const l = {
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ a("span", { className: "bear-text-sm bear-text-gray-500 bear-whitespace-nowrap bear-px-2", children: f }),
|
|
58
|
+
/* @__PURE__ */ a(
|
|
58
59
|
"span",
|
|
59
60
|
{
|
|
60
61
|
className: t(
|
|
@@ -70,7 +71,7 @@ const l = {
|
|
|
70
71
|
)
|
|
71
72
|
]
|
|
72
73
|
}
|
|
73
|
-
) : /* @__PURE__ */
|
|
74
|
+
) : /* @__PURE__ */ a(
|
|
74
75
|
"hr",
|
|
75
76
|
{
|
|
76
77
|
className: t(
|
|
@@ -83,10 +84,10 @@ const l = {
|
|
|
83
84
|
borderTopWidth: e ? r : 0,
|
|
84
85
|
borderLeftWidth: e ? 0 : r,
|
|
85
86
|
borderColor: d || "#e5e7eb",
|
|
86
|
-
marginTop: e ? `${
|
|
87
|
-
marginBottom: e ? `${
|
|
88
|
-
marginLeft: e ? 0 : `${
|
|
89
|
-
marginRight: e ? 0 : `${
|
|
87
|
+
marginTop: e ? `${o * 0.25}rem` : 0,
|
|
88
|
+
marginBottom: e ? `${o * 0.25}rem` : 0,
|
|
89
|
+
marginLeft: e ? 0 : `${o * 0.25}rem`,
|
|
90
|
+
marginRight: e ? 0 : `${o * 0.25}rem`,
|
|
90
91
|
...s
|
|
91
92
|
},
|
|
92
93
|
"data-testid": i,
|
|
@@ -95,5 +96,5 @@ const l = {
|
|
|
95
96
|
);
|
|
96
97
|
};
|
|
97
98
|
export {
|
|
98
|
-
|
|
99
|
+
N as Divider
|
|
99
100
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),s=require("react"),o=require("../../utils/cn.cjs"),r=require("./Dock.const.cjs"),S=(c,i,a,t,d)=>{if(i<0)return t;const l=Math.abs(c-i);if(l>a)return t;const u=1-l/(a+1);return t+(d-t)*u},O=c=>{const{items:i,position:a="bottom",iconSize:t=r.DEFAULT_ICON_SIZE,magnifiedSize:d=r.DEFAULT_MAGNIFIED_SIZE,magnification:l=!0,magnificationDistance:u=r.DEFAULT_MAGNIFICATION_DISTANCE,showLabels:p=!0,className:h,style:D,testId:I}=c,[f,x]=s.useState(-1),[k,_]=s.useState(""),m=s.useRef(null),y=a==="left"||a==="right",N=s.useCallback((e,n)=>{x(e),_(n.label)},[]),v=s.useCallback(()=>{x(-1),_("")},[]);return b.jsx("div",{ref:m,className:o.cn("Bear-Dock","bear-flex bear-items-end bear-gap-1","bear-rounded-2xl bear-px-2 bear-py-1.5","bear-bg-white/80 dark:bear-bg-gray-900/80","bear-backdrop-blur-xl","bear-border bear-border-gray-200/50 dark:bear-border-gray-700/50","bear-shadow-lg",r.DOCK_POSITION_CLASSES[a],y&&"bear-items-center",h),style:{padding:r.DOCK_PADDING,zIndex:r.DOCK_Z_INDEX,...D},"data-testid":I,role:"toolbar","aria-label":"Dock",onMouseLeave:v,children:i.map((e,n)=>{const g=l?S(n,f,u,t,d):t;return b.jsxs("div",{className:"Bear-Dock__item bear-relative bear-flex bear-flex-col bear-items-center",children:[p&&f===n&&k&&b.jsx("div",{className:o.cn("Bear-Dock__tooltip","bear-absolute bear-whitespace-nowrap","bear-px-2 bear-py-1 bear-rounded-lg","bear-bg-gray-900 dark:bear-bg-gray-100","bear-text-white dark:bear-text-gray-900","bear-text-xs bear-font-medium","bear-shadow-md bear-pointer-events-none",r.TOOLTIP_POSITION_CLASSES[a]),role:"tooltip",children:e.label}),b.jsx("button",{className:o.cn("Bear-Dock__button","bear-flex bear-items-center bear-justify-center bear-rounded-xl","bear-transition-all bear-origin-bottom","hover:bear-cursor-pointer",e.active&&"bear-ring-2 bear-ring-offset-1",e.disabled&&"bear-opacity-40 bear-cursor-not-allowed"),style:{width:g,height:g,transitionDuration:`${r.SPRING_DURATION}ms`,transitionTimingFunction:"cubic-bezier(0.25, 0.1, 0.25, 1)"},onClick:e.disabled?void 0:e.onClick,onMouseEnter:()=>N(n,e),disabled:e.disabled,"aria-label":e.label,children:b.jsx("span",{className:o.cn("Bear-Dock__icon","bear-flex bear-items-center bear-justify-center","bear-w-full bear-h-full bear-rounded-xl","bear-transition-transform",e.active?"bear-bg-[var(--bear-primary-500)] bear-text-white":"bear-bg-gray-100 dark:bear-bg-gray-800"),style:{fontSize:g*r.ICON_SCALE_RATIO},children:e.icon})}),e.badge!==void 0&&b.jsx("span",{className:o.cn("Bear-Dock__badge","bear-absolute bear--top-1 bear--right-1","bear-min-w-[18px] bear-h-[18px]","bear-flex bear-items-center bear-justify-center","bear-rounded-full bear-text-[10px] bear-font-bold","bear-text-white bear-leading-none bear-px-1","bear-bg-[var(--bear-danger-500,#ef4444)]"),children:e.badge}),e.active&&a==="bottom"&&b.jsx("div",{className:o.cn("Bear-Dock__dot","bear-w-1 bear-h-1 bear-rounded-full bear-mt-0.5","bear-bg-[var(--bear-primary-500)]"),"aria-hidden":"true"})]},e.id)})})};exports.Dock=O;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=48,t=72,r=2,I=8,a=150,b=.5,_={top:"bear-fixed bear-top-2 bear-left-1/2 bear--translate-x-1/2 bear-flex-row",bottom:"bear-fixed bear-bottom-2 bear-left-1/2 bear--translate-x-1/2 bear-flex-row",left:"bear-fixed bear-left-2 bear-top-1/2 bear--translate-y-1/2 bear-flex-col",right:"bear-fixed bear-right-2 bear-top-1/2 bear--translate-y-1/2 bear-flex-col"},o={bottom:"bear-bottom-full bear-mb-2",top:"bear-top-full bear-mt-2",left:"bear-left-full bear-ml-2",right:"bear-right-full bear-mr-2"},O=9998;exports.DEFAULT_ICON_SIZE=e;exports.DEFAULT_MAGNIFICATION_DISTANCE=r;exports.DEFAULT_MAGNIFIED_SIZE=t;exports.DOCK_PADDING=I;exports.DOCK_POSITION_CLASSES=_;exports.DOCK_Z_INDEX=O;exports.ICON_SCALE_RATIO=b;exports.SPRING_DURATION=a;exports.TOOLTIP_POSITION_CLASSES=o;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DockPosition } from './Dock.types';
|
|
2
|
+
/** Default icon size in pixels */
|
|
3
|
+
export declare const DEFAULT_ICON_SIZE = 48;
|
|
4
|
+
/** Default magnified size in pixels */
|
|
5
|
+
export declare const DEFAULT_MAGNIFIED_SIZE = 72;
|
|
6
|
+
/** Default magnification distance (neighbor count) */
|
|
7
|
+
export declare const DEFAULT_MAGNIFICATION_DISTANCE = 2;
|
|
8
|
+
/** Dock padding in pixels */
|
|
9
|
+
export declare const DOCK_PADDING = 8;
|
|
10
|
+
/** Animation spring duration in ms */
|
|
11
|
+
export declare const SPRING_DURATION = 150;
|
|
12
|
+
/** Badge min width in pixels */
|
|
13
|
+
export declare const BADGE_MIN_SIZE = 18;
|
|
14
|
+
/** Badge font size in pixels */
|
|
15
|
+
export declare const BADGE_FONT_SIZE = 10;
|
|
16
|
+
/** Active dot size in pixels */
|
|
17
|
+
export declare const ACTIVE_DOT_SIZE = 4;
|
|
18
|
+
/** Icon scale ratio (icon content vs container) */
|
|
19
|
+
export declare const ICON_SCALE_RATIO = 0.5;
|
|
20
|
+
/** Position classes */
|
|
21
|
+
export declare const DOCK_POSITION_CLASSES: Record<DockPosition, string>;
|
|
22
|
+
/** Tooltip position classes */
|
|
23
|
+
export declare const TOOLTIP_POSITION_CLASSES: Record<DockPosition, string>;
|
|
24
|
+
/** Z-index for dock */
|
|
25
|
+
export declare const DOCK_Z_INDEX = 9998;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const e = 48, t = 72, r = 2, a = 8, b = 150, o = 0.5, l = {
|
|
2
|
+
top: "bear-fixed bear-top-2 bear-left-1/2 bear--translate-x-1/2 bear-flex-row",
|
|
3
|
+
bottom: "bear-fixed bear-bottom-2 bear-left-1/2 bear--translate-x-1/2 bear-flex-row",
|
|
4
|
+
left: "bear-fixed bear-left-2 bear-top-1/2 bear--translate-y-1/2 bear-flex-col",
|
|
5
|
+
right: "bear-fixed bear-right-2 bear-top-1/2 bear--translate-y-1/2 bear-flex-col"
|
|
6
|
+
}, I = {
|
|
7
|
+
bottom: "bear-bottom-full bear-mb-2",
|
|
8
|
+
top: "bear-top-full bear-mt-2",
|
|
9
|
+
left: "bear-left-full bear-ml-2",
|
|
10
|
+
right: "bear-right-full bear-mr-2"
|
|
11
|
+
}, f = 9998;
|
|
12
|
+
export {
|
|
13
|
+
e as DEFAULT_ICON_SIZE,
|
|
14
|
+
r as DEFAULT_MAGNIFICATION_DISTANCE,
|
|
15
|
+
t as DEFAULT_MAGNIFIED_SIZE,
|
|
16
|
+
a as DOCK_PADDING,
|
|
17
|
+
l as DOCK_POSITION_CLASSES,
|
|
18
|
+
f as DOCK_Z_INDEX,
|
|
19
|
+
o as ICON_SCALE_RATIO,
|
|
20
|
+
b as SPRING_DURATION,
|
|
21
|
+
I as TOOLTIP_POSITION_CLASSES
|
|
22
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { jsx as t, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useRef as w, useCallback as m } from "react";
|
|
3
|
+
import { cn as b } from "../../utils/cn.js";
|
|
4
|
+
import { DEFAULT_ICON_SIZE as O, DEFAULT_MAGNIFIED_SIZE as A, DEFAULT_MAGNIFICATION_DISTANCE as C, DOCK_Z_INDEX as E, DOCK_PADDING as T, TOOLTIP_POSITION_CLASSES as L, SPRING_DURATION as B, ICON_SCALE_RATIO as M, DOCK_POSITION_CLASSES as F } from "./Dock.const.js";
|
|
5
|
+
const j = (l, n, r, a, s) => {
|
|
6
|
+
if (n < 0) return a;
|
|
7
|
+
const i = Math.abs(l - n);
|
|
8
|
+
if (i > r) return a;
|
|
9
|
+
const c = 1 - i / (r + 1);
|
|
10
|
+
return a + (s - a) * c;
|
|
11
|
+
}, z = (l) => {
|
|
12
|
+
const {
|
|
13
|
+
items: n,
|
|
14
|
+
position: r = "bottom",
|
|
15
|
+
iconSize: a = O,
|
|
16
|
+
magnifiedSize: s = A,
|
|
17
|
+
magnification: i = !0,
|
|
18
|
+
magnificationDistance: c = C,
|
|
19
|
+
showLabels: _ = !0,
|
|
20
|
+
className: h,
|
|
21
|
+
style: x,
|
|
22
|
+
testId: D
|
|
23
|
+
} = l, [u, g] = p(-1), [I, f] = p(""), y = w(null), N = r === "left" || r === "right", k = m((e, o) => {
|
|
24
|
+
g(e), f(o.label);
|
|
25
|
+
}, []), v = m(() => {
|
|
26
|
+
g(-1), f("");
|
|
27
|
+
}, []);
|
|
28
|
+
return /* @__PURE__ */ t(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
ref: y,
|
|
32
|
+
className: b(
|
|
33
|
+
"Bear-Dock",
|
|
34
|
+
"bear-flex bear-items-end bear-gap-1",
|
|
35
|
+
"bear-rounded-2xl bear-px-2 bear-py-1.5",
|
|
36
|
+
"bear-bg-white/80 dark:bear-bg-gray-900/80",
|
|
37
|
+
"bear-backdrop-blur-xl",
|
|
38
|
+
"bear-border bear-border-gray-200/50 dark:bear-border-gray-700/50",
|
|
39
|
+
"bear-shadow-lg",
|
|
40
|
+
F[r],
|
|
41
|
+
N && "bear-items-center",
|
|
42
|
+
h
|
|
43
|
+
),
|
|
44
|
+
style: {
|
|
45
|
+
padding: T,
|
|
46
|
+
zIndex: E,
|
|
47
|
+
...x
|
|
48
|
+
},
|
|
49
|
+
"data-testid": D,
|
|
50
|
+
role: "toolbar",
|
|
51
|
+
"aria-label": "Dock",
|
|
52
|
+
onMouseLeave: v,
|
|
53
|
+
children: n.map((e, o) => {
|
|
54
|
+
const d = i ? j(o, u, c, a, s) : a;
|
|
55
|
+
return /* @__PURE__ */ S(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
className: "Bear-Dock__item bear-relative bear-flex bear-flex-col bear-items-center",
|
|
59
|
+
children: [
|
|
60
|
+
_ && u === o && I && /* @__PURE__ */ t(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: b(
|
|
64
|
+
"Bear-Dock__tooltip",
|
|
65
|
+
"bear-absolute bear-whitespace-nowrap",
|
|
66
|
+
"bear-px-2 bear-py-1 bear-rounded-lg",
|
|
67
|
+
"bear-bg-gray-900 dark:bear-bg-gray-100",
|
|
68
|
+
"bear-text-white dark:bear-text-gray-900",
|
|
69
|
+
"bear-text-xs bear-font-medium",
|
|
70
|
+
"bear-shadow-md bear-pointer-events-none",
|
|
71
|
+
L[r]
|
|
72
|
+
),
|
|
73
|
+
role: "tooltip",
|
|
74
|
+
children: e.label
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ t(
|
|
78
|
+
"button",
|
|
79
|
+
{
|
|
80
|
+
className: b(
|
|
81
|
+
"Bear-Dock__button",
|
|
82
|
+
"bear-flex bear-items-center bear-justify-center bear-rounded-xl",
|
|
83
|
+
"bear-transition-all bear-origin-bottom",
|
|
84
|
+
"hover:bear-cursor-pointer",
|
|
85
|
+
e.active && "bear-ring-2 bear-ring-offset-1",
|
|
86
|
+
e.disabled && "bear-opacity-40 bear-cursor-not-allowed"
|
|
87
|
+
),
|
|
88
|
+
style: {
|
|
89
|
+
width: d,
|
|
90
|
+
height: d,
|
|
91
|
+
transitionDuration: `${B}ms`,
|
|
92
|
+
transitionTimingFunction: "cubic-bezier(0.25, 0.1, 0.25, 1)"
|
|
93
|
+
},
|
|
94
|
+
onClick: e.disabled ? void 0 : e.onClick,
|
|
95
|
+
onMouseEnter: () => k(o, e),
|
|
96
|
+
disabled: e.disabled,
|
|
97
|
+
"aria-label": e.label,
|
|
98
|
+
children: /* @__PURE__ */ t(
|
|
99
|
+
"span",
|
|
100
|
+
{
|
|
101
|
+
className: b(
|
|
102
|
+
"Bear-Dock__icon",
|
|
103
|
+
"bear-flex bear-items-center bear-justify-center",
|
|
104
|
+
"bear-w-full bear-h-full bear-rounded-xl",
|
|
105
|
+
"bear-transition-transform",
|
|
106
|
+
e.active ? "bear-bg-[var(--bear-primary-500)] bear-text-white" : "bear-bg-gray-100 dark:bear-bg-gray-800"
|
|
107
|
+
),
|
|
108
|
+
style: { fontSize: d * M },
|
|
109
|
+
children: e.icon
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
e.badge !== void 0 && /* @__PURE__ */ t("span", { className: b(
|
|
115
|
+
"Bear-Dock__badge",
|
|
116
|
+
"bear-absolute bear--top-1 bear--right-1",
|
|
117
|
+
"bear-min-w-[18px] bear-h-[18px]",
|
|
118
|
+
"bear-flex bear-items-center bear-justify-center",
|
|
119
|
+
"bear-rounded-full bear-text-[10px] bear-font-bold",
|
|
120
|
+
"bear-text-white bear-leading-none bear-px-1",
|
|
121
|
+
"bear-bg-[var(--bear-danger-500,#ef4444)]"
|
|
122
|
+
), children: e.badge }),
|
|
123
|
+
e.active && r === "bottom" && /* @__PURE__ */ t(
|
|
124
|
+
"div",
|
|
125
|
+
{
|
|
126
|
+
className: b(
|
|
127
|
+
"Bear-Dock__dot",
|
|
128
|
+
"bear-w-1 bear-h-1 bear-rounded-full bear-mt-0.5",
|
|
129
|
+
"bear-bg-[var(--bear-primary-500)]"
|
|
130
|
+
),
|
|
131
|
+
"aria-hidden": "true"
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
e.id
|
|
137
|
+
);
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
export {
|
|
143
|
+
z as Dock
|
|
144
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type DockPosition = 'bottom' | 'top' | 'left' | 'right';
|
|
3
|
+
export interface DockItem {
|
|
4
|
+
/** Unique ID */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Icon content */
|
|
7
|
+
icon: ReactNode;
|
|
8
|
+
/** Tooltip label */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Click handler */
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
/** Whether item is active */
|
|
13
|
+
active?: boolean;
|
|
14
|
+
/** Badge content */
|
|
15
|
+
badge?: string | number;
|
|
16
|
+
/** Whether item is disabled */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Href for link items */
|
|
19
|
+
href?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface DockProps {
|
|
22
|
+
/** Dock items */
|
|
23
|
+
items: DockItem[];
|
|
24
|
+
/** Position on screen */
|
|
25
|
+
position?: DockPosition;
|
|
26
|
+
/** Base icon size in pixels */
|
|
27
|
+
iconSize?: number;
|
|
28
|
+
/** Maximum magnified size in pixels */
|
|
29
|
+
magnifiedSize?: number;
|
|
30
|
+
/** Enable magnification on hover */
|
|
31
|
+
magnification?: boolean;
|
|
32
|
+
/** Distance for magnification effect (how many neighbors) */
|
|
33
|
+
magnificationDistance?: number;
|
|
34
|
+
/** Whether to show labels on hover */
|
|
35
|
+
showLabels?: boolean;
|
|
36
|
+
/** Custom class name */
|
|
37
|
+
className?: string;
|
|
38
|
+
/** Custom style */
|
|
39
|
+
style?: React.CSSProperties;
|
|
40
|
+
/** Test ID */
|
|
41
|
+
testId?: string;
|
|
42
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("react"),j=require("react-dom"),x=require("../../utils/cn.cjs"),N=require("../Icon/index.cjs"),d=300,q={left:{sm:"bear-w-64",md:"bear-w-80",lg:"bear-w-96",xl:"bear-w-[32rem]"},right:{sm:"bear-w-64",md:"bear-w-80",lg:"bear-w-96",xl:"bear-w-[32rem]"},top:{sm:"bear-h-32",md:"bear-h-48",lg:"bear-h-64",xl:"bear-h-96"},bottom:{sm:"bear-h-32",md:"bear-h-48",lg:"bear-h-64",xl:"bear-h-96"}},C={left:"bear-left-0 bear-top-0 bear-h-full",right:"bear-right-0 bear-top-0 bear-h-full",top:"bear-top-0 bear-left-0 bear-w-full",bottom:"bear-bottom-0 bear-left-0 bear-w-full"},D={left:"bear-translate-x-0",right:"bear-translate-x-0",top:"bear-translate-y-0",bottom:"bear-translate-y-0"},E={left:"-bear-translate-x-full",right:"bear-translate-x-full",top:"-bear-translate-y-full",bottom:"bear-translate-y-full"},S=({isOpen:s,onClose:l,title:o,children:w,side:e="right",size:g="md",showCloseButton:u=!0,closeOnBackdrop:y=!0,closeOnEscape:c=!0,className:p})=>{const[t,m]=a.useState(s),[f,n]=a.useState(!1),[v,h]=a.useState(!1);a.useEffect(()=>{if(s){m(!0),n(!1);const b=requestAnimationFrame(()=>h(!0));return()=>cancelAnimationFrame(b)}if(t){h(!1),n(!0);const b=setTimeout(()=>{m(!1),n(!1)},d);return()=>clearTimeout(b)}},[s,t]);const i=a.useCallback(b=>{c&&b.key==="Escape"&&l()},[c,l]);if(a.useEffect(()=>(t&&(document.addEventListener("keydown",i),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",i),document.body.style.overflow=""}),[t,i]),!t)return null;const k=r.jsxs("div",{className:"bear-fixed bear-inset-0 bear-z-50",children:[r.jsx("div",{className:x.cn("bear-absolute bear-inset-0 bear-bg-black/60 bear-backdrop-blur-sm bear-transition-opacity",f?"bear-opacity-0":"bear-opacity-100"),style:{transitionDuration:`${d}ms`},onClick:y?l:void 0,"aria-hidden":"true"}),r.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":o?"drawer-title":void 0,className:x.cn("bear-absolute bear-bg-white dark:bear-bg-neutral-900 bear-shadow-2xl","bear-border-neutral-200 dark:bear-border-neutral-700 bear-overflow-hidden","bear-transform bear-transition-transform",e==="left"&&"bear-border-r",e==="right"&&"bear-border-l",e==="top"&&"bear-border-b",e==="bottom"&&"bear-border-t",C[e],q[e][g],v&&!f?D[e]:E[e],p),style:{transitionDuration:`${d}ms`},children:[(o||u)&&r.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-neutral-200 dark:bear-border-neutral-700",children:[o&&r.jsx("h2",{id:"drawer-title",className:"bear-text-lg bear-font-semibold bear-text-neutral-900 dark:bear-text-white",children:o}),u&&r.jsx("button",{onClick:l,className:"bear-p-1 bear-rounded-lg bear-text-neutral-500 dark:bear-text-neutral-400 hover:bear-text-neutral-900 dark:hover:bear-text-white hover:bear-bg-neutral-100 dark:hover:bear-bg-neutral-700 bear-transition-colors","aria-label":"Close drawer",children:r.jsx(N.XIcon,{className:"bear-w-5 bear-h-5"})})]}),r.jsx("div",{className:"bear-flex-1 bear-overflow-y-auto bear-p-4 bear-text-neutral-700 dark:bear-text-neutral-300",children:w})]})]});return j.createPortal(k,document.body)};exports.Drawer=S;
|