@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,362 @@
|
|
|
1
|
+
import { jsxs as d, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as U, useState as f, useMemo as ve, useCallback as o, useEffect as Me } from "react";
|
|
3
|
+
import { cn as F } from "../../utils/cn.js";
|
|
4
|
+
import { DEFAULT_CROP as pe, DEFAULT_ZOOM as ke, ASPECT_RATIO_VALUES as Ne, MIN_ZOOM as Oe, MAX_ZOOM as Ie, MIN_CROP_SIZE as K, ZOOM_STEP as P, OVERLAY_COLOR as _e, BORDER_WIDTH as De, BORDER_COLOR as Le, DEFAULT_GRID_OPACITY as Ae, GRID_LINES as y, HANDLE_SIZE as _, ROTATION_STEP as Te, MAX_ROTATION as Q, MIN_ROTATION as S } from "./Cropper.const.js";
|
|
5
|
+
const Re = ({
|
|
6
|
+
src: D,
|
|
7
|
+
crop: L,
|
|
8
|
+
onCropChange: M,
|
|
9
|
+
onCropComplete: p,
|
|
10
|
+
aspectRatio: k = "free",
|
|
11
|
+
shape: N = "rectangle",
|
|
12
|
+
zoom: A,
|
|
13
|
+
onZoomChange: O,
|
|
14
|
+
minZoom: T = Oe,
|
|
15
|
+
maxZoom: E = Ie,
|
|
16
|
+
rotation: $,
|
|
17
|
+
onRotationChange: I,
|
|
18
|
+
showZoomSlider: g = !1,
|
|
19
|
+
showRotationSlider: m = !1,
|
|
20
|
+
showGrid: Z = !1,
|
|
21
|
+
gridOpacity: C = Ae,
|
|
22
|
+
overlayColor: ee = _e,
|
|
23
|
+
borderColor: te = Le,
|
|
24
|
+
borderWidth: ae = De,
|
|
25
|
+
width: re = "100%",
|
|
26
|
+
height: ie = 400,
|
|
27
|
+
className: ne,
|
|
28
|
+
style: se,
|
|
29
|
+
testId: he
|
|
30
|
+
}) => {
|
|
31
|
+
const H = U(null), Y = U(null), j = U(null), [ce, le] = f(pe), [de, be] = f(ke), [oe, ue] = f(0), [w, X] = f("none"), [v, B] = f(null), [ge, me] = f(!1), [, xe] = f({ w: 0, h: 0 }), a = L ?? ce, u = A ?? de, W = $ ?? oe, h = ve(() => typeof k == "number" ? k : Ne[k] ?? null, [k]), G = o(
|
|
32
|
+
(e) => {
|
|
33
|
+
L || le(e), M == null || M(e);
|
|
34
|
+
},
|
|
35
|
+
[L, M]
|
|
36
|
+
), R = o(
|
|
37
|
+
(e) => {
|
|
38
|
+
const t = Math.max(T, Math.min(E, e));
|
|
39
|
+
A || be(t), O == null || O(t);
|
|
40
|
+
},
|
|
41
|
+
[A, O, T, E]
|
|
42
|
+
), fe = o(
|
|
43
|
+
(e) => {
|
|
44
|
+
const t = Math.max(S, Math.min(Q, e));
|
|
45
|
+
$ || ue(t), I == null || I(t);
|
|
46
|
+
},
|
|
47
|
+
[$, I]
|
|
48
|
+
);
|
|
49
|
+
Me(() => {
|
|
50
|
+
const e = new Image();
|
|
51
|
+
e.crossOrigin = "anonymous", e.onload = () => {
|
|
52
|
+
j.current = e, xe({ w: e.naturalWidth, h: e.naturalHeight }), me(!0);
|
|
53
|
+
}, e.src = D;
|
|
54
|
+
}, [D]);
|
|
55
|
+
const l = o(
|
|
56
|
+
(e) => {
|
|
57
|
+
const t = H.current;
|
|
58
|
+
if (!t) return e;
|
|
59
|
+
const i = t.clientWidth, r = t.clientHeight - (g || m ? 60 : 0);
|
|
60
|
+
let { x: s, y: x, width: b, height: c } = e;
|
|
61
|
+
return b = Math.max(K, b), c = Math.max(K, c), h && (c = b / h), s = Math.max(0, Math.min(i - b, s)), x = Math.max(0, Math.min(r - c, x)), { x: s, y: x, width: b, height: c };
|
|
62
|
+
},
|
|
63
|
+
[h, g, m]
|
|
64
|
+
), V = o(() => {
|
|
65
|
+
const e = Y.current, t = j.current, i = H.current;
|
|
66
|
+
if (!e || !t || !i) return "";
|
|
67
|
+
const r = i.clientWidth, s = i.clientHeight - (g || m ? 60 : 0), x = t.naturalWidth / (r * u), b = t.naturalHeight / (s * u);
|
|
68
|
+
e.width = a.width * x, e.height = a.height * b;
|
|
69
|
+
const c = e.getContext("2d");
|
|
70
|
+
return c ? (N === "circle" && (c.beginPath(), c.arc(e.width / 2, e.height / 2, Math.min(e.width, e.height) / 2, 0, Math.PI * 2), c.clip()), c.drawImage(
|
|
71
|
+
t,
|
|
72
|
+
a.x * x,
|
|
73
|
+
a.y * b,
|
|
74
|
+
a.width * x,
|
|
75
|
+
a.height * b,
|
|
76
|
+
0,
|
|
77
|
+
0,
|
|
78
|
+
e.width,
|
|
79
|
+
e.height
|
|
80
|
+
), e.toDataURL("image/png")) : "";
|
|
81
|
+
}, [a, u, N, g, m]), z = o(
|
|
82
|
+
(e) => (t) => {
|
|
83
|
+
t.preventDefault(), t.stopPropagation(), X(e), B({ x: t.clientX, y: t.clientY, crop: { ...a } });
|
|
84
|
+
},
|
|
85
|
+
[a]
|
|
86
|
+
), we = o(
|
|
87
|
+
(e) => {
|
|
88
|
+
if (w === "none" || !v) return;
|
|
89
|
+
const t = e.clientX - v.x, i = e.clientY - v.y, { crop: r } = v;
|
|
90
|
+
let s;
|
|
91
|
+
switch (w) {
|
|
92
|
+
case "move":
|
|
93
|
+
s = l({
|
|
94
|
+
...r,
|
|
95
|
+
x: r.x + t,
|
|
96
|
+
y: r.y + i
|
|
97
|
+
});
|
|
98
|
+
break;
|
|
99
|
+
case "se":
|
|
100
|
+
s = l({
|
|
101
|
+
...r,
|
|
102
|
+
width: r.width + t,
|
|
103
|
+
height: h ? (r.width + t) / h : r.height + i
|
|
104
|
+
});
|
|
105
|
+
break;
|
|
106
|
+
case "sw":
|
|
107
|
+
s = l({
|
|
108
|
+
...r,
|
|
109
|
+
x: r.x + t,
|
|
110
|
+
width: r.width - t,
|
|
111
|
+
height: h ? (r.width - t) / h : r.height + i
|
|
112
|
+
});
|
|
113
|
+
break;
|
|
114
|
+
case "ne":
|
|
115
|
+
s = l({
|
|
116
|
+
...r,
|
|
117
|
+
y: h ? r.y : r.y + i,
|
|
118
|
+
width: r.width + t,
|
|
119
|
+
height: h ? (r.width + t) / h : r.height - i
|
|
120
|
+
});
|
|
121
|
+
break;
|
|
122
|
+
case "nw":
|
|
123
|
+
s = l({
|
|
124
|
+
x: r.x + t,
|
|
125
|
+
y: r.y + i,
|
|
126
|
+
width: r.width - t,
|
|
127
|
+
height: h ? (r.width - t) / h : r.height - i
|
|
128
|
+
});
|
|
129
|
+
break;
|
|
130
|
+
case "n":
|
|
131
|
+
s = l({ ...r, y: r.y + i, height: r.height - i });
|
|
132
|
+
break;
|
|
133
|
+
case "s":
|
|
134
|
+
s = l({ ...r, height: r.height + i });
|
|
135
|
+
break;
|
|
136
|
+
case "e":
|
|
137
|
+
s = l({ ...r, width: r.width + t });
|
|
138
|
+
break;
|
|
139
|
+
case "w":
|
|
140
|
+
s = l({ ...r, x: r.x + t, width: r.width - t });
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
G(s);
|
|
146
|
+
},
|
|
147
|
+
[w, v, l, G, h]
|
|
148
|
+
), q = o(() => {
|
|
149
|
+
if (w !== "none") {
|
|
150
|
+
const e = V();
|
|
151
|
+
p == null || p(a, e);
|
|
152
|
+
}
|
|
153
|
+
X("none"), B(null);
|
|
154
|
+
}, [w, a, V, p]), ye = o(
|
|
155
|
+
(e) => {
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
const t = e.deltaY > 0 ? -P : P;
|
|
158
|
+
R(u + t);
|
|
159
|
+
},
|
|
160
|
+
[u, R]
|
|
161
|
+
), J = g || m ? 60 : 0;
|
|
162
|
+
return /* @__PURE__ */ d(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
className: F(
|
|
166
|
+
"bear-relative bear-overflow-hidden bear-rounded-lg",
|
|
167
|
+
"bear-bg-gray-900 bear-select-none",
|
|
168
|
+
ne
|
|
169
|
+
),
|
|
170
|
+
style: { width: re, height: ie, ...se },
|
|
171
|
+
"data-testid": he,
|
|
172
|
+
children: [
|
|
173
|
+
/* @__PURE__ */ n("canvas", { ref: Y, className: "bear-hidden" }),
|
|
174
|
+
/* @__PURE__ */ d(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
ref: H,
|
|
178
|
+
className: "bear-relative bear-overflow-hidden bear-cursor-crosshair",
|
|
179
|
+
style: { height: `calc(100% - ${J}px)` },
|
|
180
|
+
onMouseMove: we,
|
|
181
|
+
onMouseUp: q,
|
|
182
|
+
onMouseLeave: q,
|
|
183
|
+
onWheel: ye,
|
|
184
|
+
children: [
|
|
185
|
+
ge && /* @__PURE__ */ n(
|
|
186
|
+
"img",
|
|
187
|
+
{
|
|
188
|
+
src: D,
|
|
189
|
+
alt: "",
|
|
190
|
+
className: "bear-absolute bear-inset-0 bear-w-full bear-h-full bear-object-contain bear-pointer-events-none",
|
|
191
|
+
style: {
|
|
192
|
+
transform: `scale(${u}) rotate(${W}deg)`,
|
|
193
|
+
transition: w !== "none" ? "none" : "transform 0.2s ease"
|
|
194
|
+
},
|
|
195
|
+
draggable: !1
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ d("svg", { className: "bear-absolute bear-inset-0 bear-w-full bear-h-full bear-pointer-events-none", children: [
|
|
199
|
+
/* @__PURE__ */ n("defs", { children: /* @__PURE__ */ d("mask", { id: "crop-mask", children: [
|
|
200
|
+
/* @__PURE__ */ n("rect", { width: "100%", height: "100%", fill: "white" }),
|
|
201
|
+
N === "circle" ? /* @__PURE__ */ n(
|
|
202
|
+
"ellipse",
|
|
203
|
+
{
|
|
204
|
+
cx: a.x + a.width / 2,
|
|
205
|
+
cy: a.y + a.height / 2,
|
|
206
|
+
rx: a.width / 2,
|
|
207
|
+
ry: a.height / 2,
|
|
208
|
+
fill: "black"
|
|
209
|
+
}
|
|
210
|
+
) : /* @__PURE__ */ n("rect", { x: a.x, y: a.y, width: a.width, height: a.height, fill: "black" })
|
|
211
|
+
] }) }),
|
|
212
|
+
/* @__PURE__ */ n("rect", { width: "100%", height: "100%", fill: ee, mask: "url(#crop-mask)" })
|
|
213
|
+
] }),
|
|
214
|
+
/* @__PURE__ */ n(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
className: "bear-absolute bear-pointer-events-none",
|
|
218
|
+
style: {
|
|
219
|
+
left: a.x,
|
|
220
|
+
top: a.y,
|
|
221
|
+
width: a.width,
|
|
222
|
+
height: a.height,
|
|
223
|
+
border: `${ae}px solid ${te}`,
|
|
224
|
+
borderRadius: N === "circle" ? "50%" : 0,
|
|
225
|
+
boxShadow: "0 0 0 9999px transparent"
|
|
226
|
+
},
|
|
227
|
+
children: Z && /* @__PURE__ */ d("svg", { className: "bear-absolute bear-inset-0 bear-w-full bear-h-full", style: { opacity: C }, children: [
|
|
228
|
+
Array.from({ length: y - 1 }).map((e, t) => /* @__PURE__ */ n(
|
|
229
|
+
"line",
|
|
230
|
+
{
|
|
231
|
+
x1: `${(t + 1) / y * 100}%`,
|
|
232
|
+
y1: "0",
|
|
233
|
+
x2: `${(t + 1) / y * 100}%`,
|
|
234
|
+
y2: "100%",
|
|
235
|
+
stroke: "white",
|
|
236
|
+
strokeWidth: "0.5"
|
|
237
|
+
},
|
|
238
|
+
`v-${t}`
|
|
239
|
+
)),
|
|
240
|
+
Array.from({ length: y - 1 }).map((e, t) => /* @__PURE__ */ n(
|
|
241
|
+
"line",
|
|
242
|
+
{
|
|
243
|
+
x1: "0",
|
|
244
|
+
y1: `${(t + 1) / y * 100}%`,
|
|
245
|
+
x2: "100%",
|
|
246
|
+
y2: `${(t + 1) / y * 100}%`,
|
|
247
|
+
stroke: "white",
|
|
248
|
+
strokeWidth: "0.5"
|
|
249
|
+
},
|
|
250
|
+
`h-${t}`
|
|
251
|
+
))
|
|
252
|
+
] })
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
/* @__PURE__ */ n(
|
|
256
|
+
"div",
|
|
257
|
+
{
|
|
258
|
+
className: "bear-absolute bear-cursor-move",
|
|
259
|
+
style: { left: a.x, top: a.y, width: a.width, height: a.height },
|
|
260
|
+
onMouseDown: z("move")
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
["nw", "ne", "sw", "se"].map((e) => {
|
|
264
|
+
const t = e.includes("w"), i = e.includes("n");
|
|
265
|
+
return /* @__PURE__ */ n(
|
|
266
|
+
"div",
|
|
267
|
+
{
|
|
268
|
+
className: F(
|
|
269
|
+
"bear-absolute bear-bg-white bear-border-2 bear-rounded-sm",
|
|
270
|
+
"bear-shadow-md bear-z-10"
|
|
271
|
+
),
|
|
272
|
+
style: {
|
|
273
|
+
width: _,
|
|
274
|
+
height: _,
|
|
275
|
+
left: (t ? a.x : a.x + a.width) - _ / 2,
|
|
276
|
+
top: (i ? a.y : a.y + a.height) - _ / 2,
|
|
277
|
+
borderColor: "var(--bear-primary-500)",
|
|
278
|
+
cursor: `${e}-resize`
|
|
279
|
+
},
|
|
280
|
+
onMouseDown: z(e)
|
|
281
|
+
},
|
|
282
|
+
e
|
|
283
|
+
);
|
|
284
|
+
}),
|
|
285
|
+
["n", "s", "e", "w"].map((e) => {
|
|
286
|
+
const t = e === "n" || e === "s";
|
|
287
|
+
return /* @__PURE__ */ n(
|
|
288
|
+
"div",
|
|
289
|
+
{
|
|
290
|
+
className: "bear-absolute bear-z-10",
|
|
291
|
+
style: {
|
|
292
|
+
left: e === "w" ? a.x - 4 : e === "e" ? a.x + a.width - 4 : a.x + a.width / 2 - 12,
|
|
293
|
+
top: e === "n" ? a.y - 4 : e === "s" ? a.y + a.height - 4 : a.y + a.height / 2 - 12,
|
|
294
|
+
width: t ? 24 : 8,
|
|
295
|
+
height: t ? 8 : 24,
|
|
296
|
+
cursor: t ? `${e}-resize` : `${e}-resize`
|
|
297
|
+
},
|
|
298
|
+
onMouseDown: z(e)
|
|
299
|
+
},
|
|
300
|
+
e
|
|
301
|
+
);
|
|
302
|
+
})
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
(g || m) && /* @__PURE__ */ d(
|
|
307
|
+
"div",
|
|
308
|
+
{
|
|
309
|
+
className: F(
|
|
310
|
+
"bear-flex bear-items-center bear-gap-4 bear-px-4",
|
|
311
|
+
"bear-bg-gray-800/90 bear-backdrop-blur-sm"
|
|
312
|
+
),
|
|
313
|
+
style: { height: J },
|
|
314
|
+
children: [
|
|
315
|
+
g && /* @__PURE__ */ d("div", { className: "bear-flex bear-items-center bear-gap-2 bear-flex-1", children: [
|
|
316
|
+
/* @__PURE__ */ n("svg", { className: "bear-w-4 bear-h-4 bear-text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7" }) }),
|
|
317
|
+
/* @__PURE__ */ n(
|
|
318
|
+
"input",
|
|
319
|
+
{
|
|
320
|
+
type: "range",
|
|
321
|
+
min: T,
|
|
322
|
+
max: E,
|
|
323
|
+
step: P,
|
|
324
|
+
value: u,
|
|
325
|
+
onChange: (e) => R(parseFloat(e.target.value)),
|
|
326
|
+
className: "bear-flex-1 bear-h-1 bear-accent-pink-500"
|
|
327
|
+
}
|
|
328
|
+
),
|
|
329
|
+
/* @__PURE__ */ d("span", { className: "bear-text-xs bear-text-gray-400 bear-w-10 bear-text-right", children: [
|
|
330
|
+
(u * 100).toFixed(0),
|
|
331
|
+
"%"
|
|
332
|
+
] })
|
|
333
|
+
] }),
|
|
334
|
+
m && /* @__PURE__ */ d("div", { className: "bear-flex bear-items-center bear-gap-2 bear-flex-1", children: [
|
|
335
|
+
/* @__PURE__ */ n("svg", { className: "bear-w-4 bear-h-4 bear-text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }) }),
|
|
336
|
+
/* @__PURE__ */ n(
|
|
337
|
+
"input",
|
|
338
|
+
{
|
|
339
|
+
type: "range",
|
|
340
|
+
min: S,
|
|
341
|
+
max: Q,
|
|
342
|
+
step: Te,
|
|
343
|
+
value: W,
|
|
344
|
+
onChange: (e) => fe(parseFloat(e.target.value)),
|
|
345
|
+
className: "bear-flex-1 bear-h-1 bear-accent-pink-500"
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
/* @__PURE__ */ d("span", { className: "bear-text-xs bear-text-gray-400 bear-w-10 bear-text-right", children: [
|
|
349
|
+
W,
|
|
350
|
+
"°"
|
|
351
|
+
] })
|
|
352
|
+
] })
|
|
353
|
+
]
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
);
|
|
359
|
+
};
|
|
360
|
+
export {
|
|
361
|
+
Re as Cropper
|
|
362
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Crop area coordinates
|
|
4
|
+
*/
|
|
5
|
+
export interface CropArea {
|
|
6
|
+
/** X position (px) */
|
|
7
|
+
x: number;
|
|
8
|
+
/** Y position (px) */
|
|
9
|
+
y: number;
|
|
10
|
+
/** Width (px) */
|
|
11
|
+
width: number;
|
|
12
|
+
/** Height (px) */
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Aspect ratio presets
|
|
17
|
+
*/
|
|
18
|
+
export type AspectRatioPreset = 'free' | '1:1' | '4:3' | '3:2' | '16:9' | '2:3' | '3:4' | '9:16';
|
|
19
|
+
/**
|
|
20
|
+
* Crop shape
|
|
21
|
+
*/
|
|
22
|
+
export type CropShape = 'rectangle' | 'circle';
|
|
23
|
+
export interface CropperProps {
|
|
24
|
+
/** Image source URL or data URL */
|
|
25
|
+
src: string;
|
|
26
|
+
/** Controlled crop area */
|
|
27
|
+
crop?: CropArea;
|
|
28
|
+
/** Called when crop area changes */
|
|
29
|
+
onCropChange?: (crop: CropArea) => void;
|
|
30
|
+
/** Called when crop is complete (on mouse up) */
|
|
31
|
+
onCropComplete?: (crop: CropArea, croppedImageUrl: string) => void;
|
|
32
|
+
/** Aspect ratio (number or preset) */
|
|
33
|
+
aspectRatio?: number | AspectRatioPreset;
|
|
34
|
+
/** Crop shape */
|
|
35
|
+
shape?: CropShape;
|
|
36
|
+
/** Zoom level (1 = original) */
|
|
37
|
+
zoom?: number;
|
|
38
|
+
/** Called when zoom changes */
|
|
39
|
+
onZoomChange?: (zoom: number) => void;
|
|
40
|
+
/** Min zoom level */
|
|
41
|
+
minZoom?: number;
|
|
42
|
+
/** Max zoom level */
|
|
43
|
+
maxZoom?: number;
|
|
44
|
+
/** Rotation angle in degrees */
|
|
45
|
+
rotation?: number;
|
|
46
|
+
/** Called when rotation changes */
|
|
47
|
+
onRotationChange?: (rotation: number) => void;
|
|
48
|
+
/** Show zoom slider */
|
|
49
|
+
showZoomSlider?: boolean;
|
|
50
|
+
/** Show rotation slider */
|
|
51
|
+
showRotationSlider?: boolean;
|
|
52
|
+
/** Show grid overlay */
|
|
53
|
+
showGrid?: boolean;
|
|
54
|
+
/** Grid opacity (0-1) */
|
|
55
|
+
gridOpacity?: number;
|
|
56
|
+
/** Overlay color (the dark area outside crop) */
|
|
57
|
+
overlayColor?: string;
|
|
58
|
+
/** Border color of crop area */
|
|
59
|
+
borderColor?: string;
|
|
60
|
+
/** Border width in px */
|
|
61
|
+
borderWidth?: number;
|
|
62
|
+
/** Width of the cropper */
|
|
63
|
+
width?: string | number;
|
|
64
|
+
/** Height of the cropper */
|
|
65
|
+
height?: string | number;
|
|
66
|
+
/** Custom class name */
|
|
67
|
+
className?: string;
|
|
68
|
+
/** Custom styles */
|
|
69
|
+
style?: CSSProperties;
|
|
70
|
+
/** Test ID */
|
|
71
|
+
testId?: string;
|
|
72
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("../../utils/cn.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("../../utils/cn.cjs");require("react");const S=({columns:t,data:i,rowKey:h,variant:l="simple",loading:o=!1,emptyContent:x="No data available",onRowClick:d,clickable:c=!1,sortColumn:y,sortDirection:p="asc",onSort:n,compact:g=!1,stickyHeader:j=!1,maxHeight:f,className:k,testId:N})=>{const v=e=>{const b=t.find(a=>a.key===e);b!=null&&b.sortable&&n&&n(e)},m=g?"bear-px-3 bear-py-2":"bear-px-4 bear-py-3",M=g?"bear-px-3 bear-py-2":"bear-px-4 bear-py-3";return r.jsx("div",{className:s.cn("bear-w-full bear-overflow-hidden bear-rounded-lg bear-border bear-border-gray-200 dark:bear-border-gray-700",k),"data-testid":N,children:r.jsx("div",{className:"bear-overflow-auto",style:{maxHeight:f},children:r.jsxs("table",{className:"bear-w-full bear-border-collapse bear-text-sm",children:[r.jsx("thead",{className:s.cn("bear-bg-gray-50 dark:bear-bg-gray-800",j&&"bear-sticky bear-top-0 bear-z-10"),children:r.jsx("tr",{children:t.map(e=>r.jsx("th",{className:s.cn(M,"bear-text-left bear-font-semibold bear-text-gray-700 dark:bear-text-gray-200","bear-border-b bear-border-gray-200 dark:bear-border-gray-700",e.align==="center"&&"bear-text-center",e.align==="right"&&"bear-text-right",e.sortable&&"bear-cursor-pointer hover:bear-bg-gray-100 dark:hover:bear-bg-gray-700",e.hideOnMobile&&"bear-hidden md:bear-table-cell"),style:{width:e.width},onClick:()=>e.sortable&&v(e.key),children:r.jsxs("div",{className:"bear-flex bear-items-center bear-gap-1",children:[e.header,e.sortable&&y===e.key&&r.jsx("svg",{className:s.cn("bear-w-4 bear-h-4 bear-transition-transform",p==="desc"&&"bear-rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})]})},e.key))})}),r.jsx("tbody",{className:"bear-bg-white dark:bear-bg-gray-900",children:o?r.jsx("tr",{children:r.jsx("td",{colSpan:t.length,className:"bear-py-12 bear-text-center",children:r.jsx("div",{className:"bear-flex bear-justify-center",children:r.jsxs("svg",{className:"bear-animate-spin bear-w-6 bear-h-6 bear-text-amber-500",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{className:"bear-opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"bear-opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})})}):i.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:t.length,className:"bear-py-12 bear-text-center bear-text-gray-500 dark:bear-text-gray-400",children:x})}):i.map((e,b)=>r.jsx("tr",{onClick:()=>(c||d)&&(d==null?void 0:d(e,b)),className:s.cn(l==="striped"&&b%2===1&&"bear-bg-gray-50 dark:bear-bg-gray-800/50",l==="bordered"&&"bear-border-b bear-border-gray-200 dark:bear-border-gray-700",(c||d)&&"bear-cursor-pointer hover:bear-bg-amber-50 dark:hover:bear-bg-amber-900/10",l!=="bordered"&&"bear-border-b bear-border-gray-100 dark:bear-border-gray-800"),children:t.map(a=>r.jsx("td",{className:s.cn(m,"bear-text-gray-900 dark:bear-text-white",a.align==="center"&&"bear-text-center",a.align==="right"&&"bear-text-right",a.hideOnMobile&&"bear-hidden md:bear-table-cell"),children:a.cell?a.cell(e,b):a.accessor?a.accessor(e):String(e[a.key]??"")},a.key))},h(e,b)))})]})})})},q=t=>t;exports.DataTable=S;exports.createColumns=q;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import { cn as d } from "../../utils/cn.js";
|
|
3
|
-
|
|
3
|
+
import "react";
|
|
4
|
+
const L = ({
|
|
4
5
|
columns: t,
|
|
5
6
|
data: h,
|
|
6
7
|
rowKey: n,
|
|
@@ -113,8 +114,8 @@ const B = ({
|
|
|
113
114
|
)
|
|
114
115
|
}
|
|
115
116
|
);
|
|
116
|
-
},
|
|
117
|
+
}, O = (t) => t;
|
|
117
118
|
export {
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
L as DataTable,
|
|
120
|
+
O as createColumns
|
|
120
121
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("react"),J=require("react-dom"),K=require("../Calendar/Calendar.cjs"),D=require("../../utils/cn.cjs"),Q=require("../../hooks/useBearStyles.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("react"),J=require("react-dom"),K=require("../Calendar/Calendar.cjs"),D=require("../../utils/cn.cjs"),Q=require("../../hooks/useBearStyles.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");const U=require("./DatePicker.utils.cjs"),X=({value:c,onChange:t,minDate:y,maxDate:j,disabled:b=!1,placeholder:z="Select date",label:p,error:o,helperText:m,format:B="MM/DD/YYYY",clearable:P=!0,className:_,style:h,bis:v,showWeekNumbers:S=!1,disabledDates:N=[],highlightedDates:g=[],slots:q,weekdayLabels:R,firstDayOfWeek:V=0,size:H="md",variant:M="default",icon:O})=>{const[i,n]=a.useState(!1),[E,L]=a.useState(c??new Date),[x,Y]=a.useState({top:0,left:0}),k=a.useRef(null),d=a.useRef(null),w=Q.useBearStyles(v,h);a.useEffect(()=>{if(i&&d.current){const e=d.current.getBoundingClientRect(),l=8,s=360,G=window.innerHeight-e.bottom<s&&e.top>s;Y({top:G?e.top-s-l:e.bottom+l,left:e.left})}},[i]),a.useEffect(()=>{const e=l=>{var u,f;const s=l.target;(u=k.current)!=null&&u.contains(s)||(f=s.closest)!=null&&f.call(s,"[data-bear-datepicker-calendar]")||n(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const T=a.useCallback(e=>{t==null||t(e),n(!1)},[t]),A=a.useCallback(()=>{t==null||t(null),n(!1)},[t]),I=a.useCallback(e=>{L(e)},[]),W={sm:"bear-py-1.5 bear-px-3 bear-text-sm",md:"bear-py-2 bear-px-4",lg:"bear-py-2.5 bear-px-5 bear-text-lg"},F={default:"bear-bg-white dark:bear-bg-zinc-800 bear-border-zinc-300 dark:bear-border-zinc-600",filled:"bear-bg-zinc-100 dark:bear-bg-zinc-700 bear-border-transparent",outline:"bear-bg-transparent bear-border-zinc-400 dark:bear-border-zinc-500"};return r.jsxs("div",{ref:k,className:D.cn("Bear-DatePicker bear-relative",_),style:Object.keys(w).length?w:void 0,children:[p&&r.jsx("label",{className:"Bear-DatePicker__label bear-block bear-text-sm bear-font-medium bear-text-zinc-700 dark:bear-text-zinc-300 bear-mb-1.5",children:p}),r.jsxs("button",{ref:d,type:"button",onClick:()=>!b&&n(!i),disabled:b,className:D.cn("Bear-DatePicker__trigger bear-w-full bear-flex bear-items-center bear-justify-between bear-rounded-lg bear-border bear-text-left bear-transition-colors",W[H],F[M],o?"bear-border-red-500":"focus:bear-border-pink-500",b&&"bear-opacity-50 bear-cursor-not-allowed",c?"bear-text-zinc-900 dark:bear-text-white":"bear-text-zinc-500"),children:[r.jsx("span",{className:"Bear-DatePicker__value",children:c?U.formatDate(c,B):z}),r.jsx("span",{className:"Bear-DatePicker__icon",children:O??r.jsx("svg",{className:"bear-w-5 bear-h-5 bear-text-zinc-400 bear-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})})]}),o&&r.jsx("p",{className:"Bear-DatePicker__error bear-mt-1 bear-text-xs bear-text-red-400",children:o}),m&&!o&&r.jsx("p",{className:"Bear-DatePicker__helper bear-mt-1 bear-text-xs bear-text-zinc-500",children:m}),i&&typeof document<"u"&&J.createPortal(r.jsx("div",{"data-bear-datepicker-calendar":!0,className:"Bear-DatePicker__dropdown bear-fixed bear-z-[9999]",style:{top:x.top,left:x.left},children:r.jsx(K.Calendar,{viewDate:E,onViewChange:I,value:c??null,onSelect:T,minDate:y,maxDate:j,disabledDates:N,highlightedDates:g,slots:q,weekdayLabels:R,firstDayOfWeek:V,showWeekNumbers:S,clearable:P,onClear:A,showTodayButton:!0,onToday:()=>{t==null||t(new Date),n(!1)}})}),document.body)]})};exports.DatePicker=X;
|
|
@@ -4,8 +4,9 @@ import { createPortal as X } from "react-dom";
|
|
|
4
4
|
import { Calendar as Z } from "../Calendar/Calendar.js";
|
|
5
5
|
import { cn as B } from "../../utils/cn.js";
|
|
6
6
|
import { useBearStyles as $ } from "../../hooks/useBearStyles.js";
|
|
7
|
+
import "../../hooks/useBearComponent/useBearComponent.js";
|
|
7
8
|
import { formatDate as C } from "./DatePicker.utils.js";
|
|
8
|
-
const
|
|
9
|
+
const ie = ({
|
|
9
10
|
value: o,
|
|
10
11
|
onChange: t,
|
|
11
12
|
minDate: _,
|
|
@@ -123,5 +124,5 @@ const ce = ({
|
|
|
123
124
|
] });
|
|
124
125
|
};
|
|
125
126
|
export {
|
|
126
|
-
|
|
127
|
+
ie as DatePicker
|
|
127
128
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),y=require("react"),b=require("../../utils/cn.cjs"),T=require("../../context/BearProvider.cjs"),a=require("../Typography/Typography.cjs"),f=require("./DiffViewer.const.cjs"),h=require("./DiffViewer.utils.cjs"),q=({oldValue:c,newValue:l,viewMode:v="split",showLineNumbers:u=!0,oldTitle:N="Original",newTitle:j="Modified",showStats:x=!0,className:g,testId:m})=>{const{mode:w}=T.useBear(),p=w==="dark",d=y.useMemo(()=>h.computeDiff(c,l),[c,l]),i=y.useMemo(()=>h.computeStats(d),[d]),t=r=>u?e.jsx("span",{className:"select-none text-gray-400 dark:text-gray-600 text-right pr-3",style:{minWidth:f.LINE_NUMBER_WIDTH},children:r??""}):null,n=(r,s)=>{const o=f.DIFF_COLORS[s],D=s==="add"?"+":s==="remove"?"-":" ";return e.jsxs("div",{className:"flex font-mono text-sm",style:{backgroundColor:o.bg,borderLeft:`3px solid ${o.border}`},children:[e.jsx("span",{className:"px-2 select-none font-bold",style:{color:o.text},children:D}),e.jsx("span",{className:"flex-1 whitespace-pre",children:r})]})};if(v==="unified")return e.jsxs("div",{className:b.cn("Bear-DiffViewer","rounded-lg overflow-hidden border",p?"bg-gray-900 border-gray-700":"bg-white border-gray-200",g),"data-testid":m,children:[x&&e.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs(a.Typography,{variant:"caption",className:"text-green-600",children:["+",i.additions," additions"]}),e.jsxs(a.Typography,{variant:"caption",className:"text-red-600",children:["-",i.deletions," deletions"]})]}),e.jsx("div",{className:"overflow-x-auto",children:d.map((r,s)=>e.jsxs("div",{className:"flex",children:[t(r.oldLineNumber||r.newLineNumber),e.jsx("div",{className:"flex-1",children:n(r.content,r.type)})]},s))})]});const k=d.filter(r=>r.type!=="add"),L=d.filter(r=>r.type!=="remove");return e.jsxs("div",{className:b.cn("Bear-DiffViewer","rounded-lg overflow-hidden border",p?"bg-gray-900 border-gray-700":"bg-white border-gray-200",g),"data-testid":m,children:[x&&e.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs(a.Typography,{variant:"caption",className:"text-green-600",children:["+",i.additions," additions"]}),e.jsxs(a.Typography,{variant:"caption",className:"text-red-600",children:["-",i.deletions," deletions"]})]}),e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-gray-200 dark:divide-gray-700",children:[e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:e.jsx(a.Typography,{variant:"caption",className:"font-semibold",children:N})}),e.jsx("div",{className:"overflow-x-auto",children:k.map((r,s)=>e.jsxs("div",{className:"flex",children:[t(r.oldLineNumber),e.jsx("div",{className:"flex-1",children:n(r.content,r.type==="remove"?"remove":"context")})]},s))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:e.jsx(a.Typography,{variant:"caption",className:"font-semibold",children:j})}),e.jsx("div",{className:"overflow-x-auto",children:L.map((r,s)=>e.jsxs("div",{className:"flex",children:[t(r.newLineNumber),e.jsx("div",{className:"flex-1",children:n(r.content,r.type==="add"?"add":"context")})]},s))})]})]})]})};exports.DiffViewer=q;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={add:{bg:"rgba(34, 197, 94, 0.15)",border:"rgba(34, 197, 94, 0.4)",text:"#22c55e"},remove:{bg:"rgba(239, 68, 68, 0.15)",border:"rgba(239, 68, 68, 0.4)",text:"#ef4444"},context:{bg:"transparent",border:"transparent",text:"inherit"}},t=50;exports.DIFF_COLORS=e;exports.LINE_NUMBER_WIDTH=t;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const DIFF_COLORS: {
|
|
2
|
+
readonly add: {
|
|
3
|
+
readonly bg: "rgba(34, 197, 94, 0.15)";
|
|
4
|
+
readonly border: "rgba(34, 197, 94, 0.4)";
|
|
5
|
+
readonly text: "#22c55e";
|
|
6
|
+
};
|
|
7
|
+
readonly remove: {
|
|
8
|
+
readonly bg: "rgba(239, 68, 68, 0.15)";
|
|
9
|
+
readonly border: "rgba(239, 68, 68, 0.4)";
|
|
10
|
+
readonly text: "#ef4444";
|
|
11
|
+
};
|
|
12
|
+
readonly context: {
|
|
13
|
+
readonly bg: "transparent";
|
|
14
|
+
readonly border: "transparent";
|
|
15
|
+
readonly text: "inherit";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare const LINE_NUMBER_WIDTH = 50;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const r = {
|
|
2
|
+
add: {
|
|
3
|
+
bg: "rgba(34, 197, 94, 0.15)",
|
|
4
|
+
border: "rgba(34, 197, 94, 0.4)",
|
|
5
|
+
text: "#22c55e"
|
|
6
|
+
},
|
|
7
|
+
remove: {
|
|
8
|
+
bg: "rgba(239, 68, 68, 0.15)",
|
|
9
|
+
border: "rgba(239, 68, 68, 0.4)",
|
|
10
|
+
text: "#ef4444"
|
|
11
|
+
},
|
|
12
|
+
context: {
|
|
13
|
+
bg: "transparent",
|
|
14
|
+
border: "transparent",
|
|
15
|
+
text: "inherit"
|
|
16
|
+
}
|
|
17
|
+
}, t = 50;
|
|
18
|
+
export {
|
|
19
|
+
r as DIFF_COLORS,
|
|
20
|
+
t as LINE_NUMBER_WIDTH
|
|
21
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DiffViewerProps } from './DiffViewer.types';
|
|
3
|
+
/**
|
|
4
|
+
* DiffViewer - Compare and visualize text/code differences
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <DiffViewer
|
|
9
|
+
* oldValue="const x = 1;"
|
|
10
|
+
* newValue="const x = 2;"
|
|
11
|
+
* viewMode="split"
|
|
12
|
+
* showLineNumbers
|
|
13
|
+
* showStats
|
|
14
|
+
* />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare const DiffViewer: FC<DiffViewerProps>;
|
|
18
|
+
export default DiffViewer;
|