@forgedevstack/bear 1.3.2 → 1.3.3
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/README.md +4 -0
- package/dist/components/ApprovalCard/ApprovalCard.cjs +1 -0
- package/dist/components/ApprovalCard/ApprovalCard.const.cjs +1 -0
- package/dist/components/ApprovalCard/ApprovalCard.const.d.ts +2 -0
- package/dist/components/ApprovalCard/ApprovalCard.const.js +8 -0
- package/dist/components/ApprovalCard/ApprovalCard.d.ts +2 -0
- package/dist/components/ApprovalCard/ApprovalCard.js +25 -0
- package/dist/components/ApprovalCard/ApprovalCard.types.d.ts +15 -0
- package/dist/components/ApprovalCard/index.d.ts +2 -0
- package/dist/components/ArtifactCard/ArtifactCard.cjs +1 -0
- package/dist/components/ArtifactCard/ArtifactCard.const.cjs +1 -0
- package/dist/components/ArtifactCard/ArtifactCard.const.d.ts +3 -0
- package/dist/components/ArtifactCard/ArtifactCard.const.js +8 -0
- package/dist/components/ArtifactCard/ArtifactCard.d.ts +2 -0
- package/dist/components/ArtifactCard/ArtifactCard.js +43 -0
- package/dist/components/ArtifactCard/ArtifactCard.types.d.ts +15 -0
- package/dist/components/ArtifactCard/index.d.ts +2 -0
- package/dist/components/Banner/Banner.const.cjs +1 -1
- package/dist/components/Banner/Banner.const.js +9 -8
- package/dist/components/Chart/BarChart.cjs +1 -1
- package/dist/components/Chart/BarChart.js +65 -72
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.js +21 -18
- package/dist/components/Chart/Chart.types.d.ts +1 -1
- package/dist/components/Chart/FunnelChart.cjs +1 -1
- package/dist/components/Chart/FunnelChart.js +38 -36
- package/dist/components/Chart/LineChart.cjs +1 -1
- package/dist/components/Chart/LineChart.js +74 -60
- package/dist/components/Chart/PieChart.cjs +1 -1
- package/dist/components/Chart/PieChart.js +102 -82
- package/dist/components/Chart/RadarChart.cjs +1 -1
- package/dist/components/Chart/RadarChart.d.ts +1 -1
- package/dist/components/Chart/RadarChart.js +116 -93
- package/dist/components/Chat/Chat.cjs +1 -1
- package/dist/components/Chat/Chat.const.cjs +1 -1
- package/dist/components/Chat/Chat.const.d.ts +9 -22
- package/dist/components/Chat/Chat.const.js +18 -26
- package/dist/components/Chat/Chat.d.ts +1 -20
- package/dist/components/Chat/Chat.js +107 -162
- package/dist/components/Chat/Chat.types.d.ts +20 -27
- package/dist/components/Chat/Chat.utils.cjs +1 -0
- package/dist/components/Chat/Chat.utils.d.ts +2 -0
- package/dist/components/Chat/Chat.utils.js +10 -0
- package/dist/components/Chat/helpers/ChatTypingIndicator.cjs +1 -0
- package/dist/components/Chat/helpers/ChatTypingIndicator.d.ts +3 -0
- package/dist/components/Chat/helpers/ChatTypingIndicator.js +14 -0
- package/dist/components/Chat/index.d.ts +2 -1
- package/dist/components/ChatBubble/ChatBubble.cjs +1 -0
- package/dist/components/ChatBubble/ChatBubble.const.cjs +1 -0
- package/dist/components/ChatBubble/ChatBubble.const.d.ts +13 -0
- package/dist/components/ChatBubble/ChatBubble.const.js +17 -0
- package/dist/components/ChatBubble/ChatBubble.d.ts +2 -0
- package/dist/components/ChatBubble/ChatBubble.js +32 -0
- package/dist/components/ChatBubble/ChatBubble.types.d.ts +12 -0
- package/dist/components/ChatBubble/ChatBubble.utils.cjs +1 -0
- package/dist/components/ChatBubble/ChatBubble.utils.d.ts +6 -0
- package/dist/components/ChatBubble/ChatBubble.utils.js +15 -0
- package/dist/components/ChatBubble/helpers/ChatBubbleSystem.cjs +1 -0
- package/dist/components/ChatBubble/helpers/ChatBubbleSystem.d.ts +2 -0
- package/dist/components/ChatBubble/helpers/ChatBubbleSystem.js +21 -0
- package/dist/components/ChatBubble/helpers/ChatBubbleThread.cjs +1 -0
- package/dist/components/ChatBubble/helpers/ChatBubbleThread.d.ts +4 -0
- package/dist/components/ChatBubble/helpers/ChatBubbleThread.js +63 -0
- package/dist/components/ChatBubble/index.d.ts +2 -0
- package/dist/components/ChatError/ChatError.cjs +1 -0
- package/dist/components/ChatError/ChatError.const.cjs +1 -0
- package/dist/components/ChatError/ChatError.const.d.ts +2 -0
- package/dist/components/ChatError/ChatError.const.js +8 -0
- package/dist/components/ChatError/ChatError.d.ts +2 -0
- package/dist/components/ChatError/ChatError.js +32 -0
- package/dist/components/ChatError/ChatError.types.d.ts +14 -0
- package/dist/components/ChatError/index.d.ts +2 -0
- package/dist/components/CitationList/CitationList.cjs +1 -0
- package/dist/components/CitationList/CitationList.d.ts +2 -0
- package/dist/components/CitationList/CitationList.js +30 -0
- package/dist/components/CitationList/CitationList.types.d.ts +15 -0
- package/dist/components/CitationList/helpers/CitationListTitle.cjs +1 -0
- package/dist/components/CitationList/helpers/CitationListTitle.d.ts +2 -0
- package/dist/components/CitationList/helpers/CitationListTitle.js +10 -0
- package/dist/components/CitationList/helpers/index.d.ts +1 -0
- package/dist/components/CitationList/index.d.ts +2 -0
- package/dist/components/ContextMeter/ContextMeter.cjs +1 -0
- package/dist/components/ContextMeter/ContextMeter.const.cjs +1 -0
- package/dist/components/ContextMeter/ContextMeter.const.d.ts +6 -0
- package/dist/components/ContextMeter/ContextMeter.const.js +11 -0
- package/dist/components/ContextMeter/ContextMeter.d.ts +2 -0
- package/dist/components/ContextMeter/ContextMeter.js +49 -0
- package/dist/components/ContextMeter/ContextMeter.types.d.ts +11 -0
- package/dist/components/ContextMeter/ContextMeter.utils.cjs +1 -0
- package/dist/components/ContextMeter/ContextMeter.utils.d.ts +2 -0
- package/dist/components/ContextMeter/ContextMeter.utils.js +12 -0
- package/dist/components/ContextMeter/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.const.cjs +1 -1
- package/dist/components/Drawer/Drawer.const.d.ts +2 -1
- package/dist/components/Drawer/Drawer.const.js +7 -6
- package/dist/components/Drawer/Drawer.d.ts +1 -1
- package/dist/components/Drawer/Drawer.js +93 -83
- package/dist/components/Drawer/Drawer.types.d.ts +4 -1
- package/dist/components/Drawer/hooks/useDrawer.cjs +1 -1
- package/dist/components/Drawer/hooks/useDrawer.js +33 -34
- package/dist/components/Drawer/index.d.ts +1 -1
- package/dist/components/EmptyState/EmptyState.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.const.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.const.d.ts +8 -6
- package/dist/components/EmptyState/EmptyState.const.js +15 -8
- package/dist/components/EmptyState/EmptyState.d.ts +1 -2
- package/dist/components/EmptyState/EmptyState.js +39 -43
- package/dist/components/EmptyState/EmptyState.types.d.ts +2 -0
- package/dist/components/EmptyState/helpers/EmptyStateErrorSvg.cjs +1 -0
- package/dist/components/EmptyState/helpers/EmptyStateErrorSvg.d.ts +3 -0
- package/dist/components/EmptyState/helpers/EmptyStateErrorSvg.js +8 -0
- package/dist/components/EmptyState/helpers/EmptyStateInboxSvg.cjs +1 -0
- package/dist/components/EmptyState/helpers/EmptyStateInboxSvg.d.ts +3 -0
- package/dist/components/EmptyState/helpers/EmptyStateInboxSvg.js +8 -0
- package/dist/components/EmptyState/helpers/EmptyStateSearchSvg.cjs +1 -0
- package/dist/components/EmptyState/helpers/EmptyStateSearchSvg.d.ts +3 -0
- package/dist/components/EmptyState/helpers/EmptyStateSearchSvg.js +8 -0
- package/dist/components/EmptyState/helpers/index.d.ts +3 -0
- package/dist/components/EmptyState/index.d.ts +1 -1
- package/dist/components/FloatingChat/FloatingChat.cjs +1 -1
- package/dist/components/FloatingChat/FloatingChat.const.cjs +1 -1
- package/dist/components/FloatingChat/FloatingChat.const.d.ts +12 -1
- package/dist/components/FloatingChat/FloatingChat.const.js +25 -7
- package/dist/components/FloatingChat/FloatingChat.d.ts +1 -18
- package/dist/components/FloatingChat/FloatingChat.js +93 -124
- package/dist/components/FloatingChat/FloatingChat.types.d.ts +11 -22
- package/dist/components/FloatingChat/FloatingChat.utils.cjs +1 -0
- package/dist/components/FloatingChat/FloatingChat.utils.d.ts +2 -0
- package/dist/components/FloatingChat/FloatingChat.utils.js +12 -0
- package/dist/components/FloatingChat/helpers/FloatingChatHeader.cjs +1 -0
- package/dist/components/FloatingChat/helpers/FloatingChatHeader.d.ts +9 -0
- package/dist/components/FloatingChat/helpers/FloatingChatHeader.js +21 -0
- package/dist/components/FloatingChat/helpers/FloatingChatTrigger.cjs +1 -0
- package/dist/components/FloatingChat/helpers/FloatingChatTrigger.d.ts +9 -0
- package/dist/components/FloatingChat/helpers/FloatingChatTrigger.js +17 -0
- package/dist/components/FloatingChat/index.d.ts +1 -1
- package/dist/components/FormSkeleton/FormSkeleton.cjs +1 -1
- package/dist/components/FormSkeleton/FormSkeleton.d.ts +1 -1
- package/dist/components/FormSkeleton/FormSkeleton.js +35 -24
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/Icon/productIcons.cjs +1 -0
- package/dist/components/Icon/productIcons.d.ts +7 -0
- package/dist/components/Icon/productIcons.js +25 -0
- package/dist/components/MessageActions/MessageActions.cjs +1 -0
- package/dist/components/MessageActions/MessageActions.const.cjs +1 -0
- package/dist/components/MessageActions/MessageActions.const.d.ts +2 -0
- package/dist/components/MessageActions/MessageActions.const.js +10 -0
- package/dist/components/MessageActions/MessageActions.d.ts +2 -0
- package/dist/components/MessageActions/MessageActions.js +31 -0
- package/dist/components/MessageActions/MessageActions.types.d.ts +16 -0
- package/dist/components/MessageActions/index.d.ts +2 -0
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/ModelSelect/ModelSelect.cjs +1 -0
- package/dist/components/ModelSelect/ModelSelect.const.cjs +1 -0
- package/dist/components/ModelSelect/ModelSelect.const.d.ts +1 -0
- package/dist/components/ModelSelect/ModelSelect.const.js +4 -0
- package/dist/components/ModelSelect/ModelSelect.d.ts +2 -0
- package/dist/components/ModelSelect/ModelSelect.js +41 -0
- package/dist/components/ModelSelect/ModelSelect.types.d.ts +16 -0
- package/dist/components/ModelSelect/index.d.ts +2 -0
- package/dist/components/OverlayPortal/OverlayPortal.const.cjs +1 -1
- package/dist/components/OverlayPortal/OverlayPortal.const.js +6 -5
- package/dist/components/PasswordInput/PasswordInput.cjs +1 -1
- package/dist/components/PasswordInput/PasswordInput.js +5 -5
- package/dist/components/PromptComposer/PromptComposer.cjs +1 -0
- package/dist/components/PromptComposer/PromptComposer.const.cjs +1 -0
- package/dist/components/PromptComposer/PromptComposer.const.d.ts +6 -0
- package/dist/components/PromptComposer/PromptComposer.const.js +14 -0
- package/dist/components/PromptComposer/PromptComposer.d.ts +2 -0
- package/dist/components/PromptComposer/PromptComposer.js +132 -0
- package/dist/components/PromptComposer/PromptComposer.types.d.ts +45 -0
- package/dist/components/PromptComposer/PromptComposer.utils.cjs +1 -0
- package/dist/components/PromptComposer/PromptComposer.utils.d.ts +5 -0
- package/dist/components/PromptComposer/PromptComposer.utils.js +16 -0
- package/dist/components/PromptComposer/helpers/PromptComposerAttachSvg.cjs +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerAttachSvg.d.ts +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerAttachSvg.js +6 -0
- package/dist/components/PromptComposer/helpers/PromptComposerFileChip.cjs +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerFileChip.d.ts +2 -0
- package/dist/components/PromptComposer/helpers/PromptComposerFileChip.js +18 -0
- package/dist/components/PromptComposer/helpers/PromptComposerSendSvg.cjs +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerSendSvg.d.ts +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerSendSvg.js +9 -0
- package/dist/components/PromptComposer/helpers/PromptComposerStopSvg.cjs +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerStopSvg.d.ts +1 -0
- package/dist/components/PromptComposer/helpers/PromptComposerStopSvg.js +6 -0
- package/dist/components/PromptComposer/helpers/index.d.ts +4 -0
- package/dist/components/PromptComposer/index.d.ts +2 -0
- package/dist/components/PromptSuggestions/PromptSuggestions.cjs +1 -0
- package/dist/components/PromptSuggestions/PromptSuggestions.d.ts +2 -0
- package/dist/components/PromptSuggestions/PromptSuggestions.js +39 -0
- package/dist/components/PromptSuggestions/PromptSuggestions.types.d.ts +13 -0
- package/dist/components/PromptSuggestions/index.d.ts +2 -0
- package/dist/components/RichEditor/helpers/IconRender.cjs +1 -1
- package/dist/components/RichEditor/helpers/IconRender.js +16 -16
- package/dist/components/RichEditor/helpers/toolbarItemRender.cjs +1 -1
- package/dist/components/RichEditor/helpers/toolbarItemRender.js +23 -23
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +23 -23
- package/dist/components/Select/helpers/SelectCheckSvg.cjs +1 -0
- package/dist/components/Select/helpers/SelectCheckSvg.d.ts +3 -0
- package/dist/components/Select/helpers/SelectCheckSvg.js +8 -0
- package/dist/components/Select/helpers/SelectChevronDownSvg.cjs +1 -0
- package/dist/components/Select/helpers/SelectChevronDownSvg.d.ts +3 -0
- package/dist/components/Select/helpers/SelectChevronDownSvg.js +8 -0
- package/dist/components/Select/helpers/index.d.ts +2 -0
- package/dist/components/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/Skeleton/Skeleton.const.cjs +2 -2
- package/dist/components/Skeleton/Skeleton.const.js +5 -6
- package/dist/components/Skeleton/Skeleton.js +59 -59
- package/dist/components/StatCard/StatCard.cjs +1 -1
- package/dist/components/StatCard/StatCard.const.cjs +1 -1
- package/dist/components/StatCard/StatCard.const.d.ts +0 -7
- package/dist/components/StatCard/StatCard.const.js +5 -12
- package/dist/components/StatCard/StatCard.d.ts +1 -2
- package/dist/components/StatCard/StatCard.js +48 -37
- package/dist/components/StatCard/StatCard.utils.cjs +1 -0
- package/dist/components/StatCard/StatCard.utils.d.ts +2 -0
- package/dist/components/StatCard/StatCard.utils.js +7 -0
- package/dist/components/StreamingMessage/StreamingMessage.cjs +1 -0
- package/dist/components/StreamingMessage/StreamingMessage.const.cjs +1 -0
- package/dist/components/StreamingMessage/StreamingMessage.const.d.ts +5 -0
- package/dist/components/StreamingMessage/StreamingMessage.const.js +10 -0
- package/dist/components/StreamingMessage/StreamingMessage.d.ts +2 -0
- package/dist/components/StreamingMessage/StreamingMessage.js +48 -0
- package/dist/components/StreamingMessage/StreamingMessage.types.d.ts +15 -0
- package/dist/components/StreamingMessage/index.d.ts +2 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.cjs +1 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.const.cjs +1 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.const.d.ts +7 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.const.js +14 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.d.ts +2 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.js +39 -0
- package/dist/components/ThemeSwitcher/ThemeSwitcher.types.d.ts +14 -0
- package/dist/components/ThemeSwitcher/index.d.ts +2 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.cjs +1 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.const.cjs +1 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.const.d.ts +4 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.const.js +9 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.d.ts +2 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.js +45 -0
- package/dist/components/ThinkingBlock/ThinkingBlock.types.d.ts +16 -0
- package/dist/components/ThinkingBlock/index.d.ts +2 -0
- package/dist/components/ToolCall/ToolCall.cjs +1 -0
- package/dist/components/ToolCall/ToolCall.const.cjs +1 -0
- package/dist/components/ToolCall/ToolCall.const.d.ts +5 -0
- package/dist/components/ToolCall/ToolCall.const.js +17 -0
- package/dist/components/ToolCall/ToolCall.d.ts +2 -0
- package/dist/components/ToolCall/ToolCall.js +43 -0
- package/dist/components/ToolCall/ToolCall.types.d.ts +20 -0
- package/dist/components/ToolCall/index.d.ts +2 -0
- package/dist/components/Transition/Transition.const.cjs +1 -1
- package/dist/components/Transition/Transition.const.js +12 -6
- package/dist/components/Transition/Transition.types.d.ts +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +37 -9
- package/dist/components/index.js +455 -423
- package/dist/constants/generals.const.cjs +1 -1
- package/dist/constants/generals.const.d.ts +46 -0
- package/dist/constants/generals.const.js +158 -115
- package/dist/constants/keys.const.cjs +1 -1
- package/dist/constants/keys.const.js +2 -1
- package/dist/constants/numbers.const.cjs +1 -1
- package/dist/constants/numbers.const.d.ts +7 -0
- package/dist/constants/numbers.const.js +60 -52
- package/dist/context/BearProvider.cjs +1 -1
- package/dist/context/BearProvider.d.ts +19 -44
- package/dist/context/BearProvider.js +223 -208
- package/dist/context/bearProvider.types.d.ts +4 -0
- package/dist/context/index.d.ts +1 -1
- package/dist/hooks/useFixedAnchorPosition/index.d.ts +1 -1
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.cjs +1 -1
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.d.ts +2 -1
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.js +12 -11
- package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.types.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +595 -563
- package/dist/styles/_ai-chat.css +487 -0
- package/dist/styles/_base.css +2 -0
- package/dist/styles/_chart.css +144 -0
- package/dist/styles/_effects.css +8 -4
- package/dist/styles/_skeleton.css +90 -0
- package/dist/styles/main.css +3 -0
- package/dist/styles.css +734 -32
- package/package.json +1 -1
- package/dist/components/FormSkeleton/FormSkeleton.const.cjs +0 -1
- package/dist/components/FormSkeleton/FormSkeleton.const.d.ts +0 -5
- package/dist/components/FormSkeleton/FormSkeleton.const.js +0 -8
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.js +0 -14
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.js +0 -35
- package/dist/node_modules/@forgedevstack/bear-icons/dist/action.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/action.js +0 -26
- package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.js +0 -4
- package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.js +0 -130
- package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.js +0 -12
- package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.js +0 -18
- package/dist/node_modules/@forgedevstack/bear-icons/dist/status.cjs +0 -1
- package/dist/node_modules/@forgedevstack/bear-icons/dist/status.js +0 -6
|
@@ -1,69 +1,83 @@
|
|
|
1
1
|
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { ZERO as
|
|
2
|
+
import { ZERO as v, TEN as W, FIFTY as b } from "../../constants/numbers.const.js";
|
|
3
3
|
import { cn as s } from "../../utils/cn.js";
|
|
4
4
|
import "react";
|
|
5
|
+
import { resolveBearId as x } from "../../utils/generateBearId.utils.js";
|
|
6
|
+
import { useBearId as k } from "../../utils/useBearId.js";
|
|
5
7
|
import { CHART as a } from "./Chart.const.js";
|
|
6
|
-
import { calculateLinePoints as
|
|
7
|
-
const
|
|
8
|
+
import { calculateLinePoints as A, generateLinePath as R } from "./Chart.utils.js";
|
|
9
|
+
const G = (I) => {
|
|
8
10
|
const {
|
|
9
|
-
data:
|
|
10
|
-
height:
|
|
11
|
-
showLabels:
|
|
12
|
-
showDots:
|
|
13
|
-
smooth:
|
|
14
|
-
fill:
|
|
15
|
-
stepped:
|
|
16
|
-
strokeWidth:
|
|
11
|
+
data: o,
|
|
12
|
+
height: B = a.DEFAULT_HEIGHT,
|
|
13
|
+
showLabels: y = !0,
|
|
14
|
+
showDots: C = !0,
|
|
15
|
+
smooth: E = !0,
|
|
16
|
+
fill: L = !1,
|
|
17
|
+
stepped: d = !1,
|
|
18
|
+
strokeWidth: u = a.DEFAULT_STROKE_WIDTH,
|
|
17
19
|
color: r = "var(--bear-primary-500, #ec4899)",
|
|
18
|
-
animated:
|
|
19
|
-
className:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
20
|
+
animated: i = !0,
|
|
21
|
+
className: O,
|
|
22
|
+
id: _,
|
|
23
|
+
testId: $,
|
|
24
|
+
...g
|
|
25
|
+
} = I, D = k("LineChart"), m = x(_, D), p = `${m}-gradient`, l = A(o), h = R(l, E && !d, d), N = l.length === v ? "" : `${h} L ${a.VIEWBOX},${a.VIEWBOX} L 0,${a.VIEWBOX} Z`, T = { "--Bear-Chart-height": `${B}px` };
|
|
26
|
+
return /* @__PURE__ */ c(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
id: m,
|
|
30
|
+
"data-testid": $,
|
|
31
|
+
className: s("Bear-Chart Bear-Chart--line", O),
|
|
32
|
+
style: T,
|
|
33
|
+
...g,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ c("svg", { viewBox: `0 0 ${a.VIEWBOX} ${a.VIEWBOX}`, preserveAspectRatio: "none", className: "Bear-Chart__svg", children: [
|
|
36
|
+
/* @__PURE__ */ e("defs", { children: /* @__PURE__ */ c("linearGradient", { id: p, x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
|
|
37
|
+
/* @__PURE__ */ e("stop", { offset: "0%", stopColor: r, stopOpacity: "0.3" }),
|
|
38
|
+
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: r, stopOpacity: "0" })
|
|
39
|
+
] }) }),
|
|
40
|
+
L && /* @__PURE__ */ e(
|
|
41
|
+
"path",
|
|
42
|
+
{
|
|
43
|
+
d: N,
|
|
44
|
+
fill: `url(#${p})`,
|
|
45
|
+
className: s(i && "animate-fade-in")
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ e(
|
|
49
|
+
"path",
|
|
50
|
+
{
|
|
51
|
+
d: h,
|
|
52
|
+
fill: "none",
|
|
53
|
+
stroke: r,
|
|
54
|
+
strokeWidth: u / W,
|
|
55
|
+
strokeLinecap: "round",
|
|
56
|
+
strokeLinejoin: "round",
|
|
57
|
+
className: s(i && "animate-draw-line")
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
C && l.map((t, n) => {
|
|
61
|
+
var f;
|
|
62
|
+
return /* @__PURE__ */ e(
|
|
63
|
+
"circle",
|
|
64
|
+
{
|
|
65
|
+
cx: t.x,
|
|
66
|
+
cy: t.y,
|
|
67
|
+
r: a.DOT_RADIUS,
|
|
68
|
+
fill: r,
|
|
69
|
+
className: s(i && "animate-scale-in"),
|
|
70
|
+
style: { animationDelay: `${n * b}ms` }
|
|
71
|
+
},
|
|
72
|
+
((f = o[n]) == null ? void 0 : f.label) ?? n
|
|
73
|
+
);
|
|
74
|
+
})
|
|
75
|
+
] }),
|
|
76
|
+
y && /* @__PURE__ */ e("div", { className: "Bear-Chart__labels", children: o.map((t) => /* @__PURE__ */ e("span", { className: "Bear-Chart__label", children: t.label }, t.label)) })
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
);
|
|
66
80
|
};
|
|
67
81
|
export {
|
|
68
|
-
|
|
82
|
+
G as LineChart
|
|
69
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),J=require("react"),d=require("../../constants/numbers.const.cjs"),_=require("../../utils/cn.cjs"),Q=require("../../utils/generateBearId.utils.cjs"),ee=require("../../utils/useBearId.cjs"),te=require("../Portal/Portal.cjs"),T=require("../Card/Card.cjs"),p=require("../Flex/Flex.cjs"),w=require("../Box/Box.cjs"),D=require("../Typography/Typography.cjs"),t=require("./Chart.const.cjs"),R=require("./Chart.utils.cjs"),ae=S=>{const{data:s,height:y=t.CHART.DEFAULT_HEIGHT,showLabels:f=!0,innerRadius:q=d.ZERO,startAngle:M,padAngle:x=t.CHART.DEFAULT_PAD_ANGLE,animated:U=!0,pieView:I=t.PIE_VIEW_FULL,explodeIndex:V,legendPosition:B="right",onSliceClick:i,onSliceHover:u,showSliceTooltip:m=!0,sliceTooltipTitle:A,sliceTooltipDescription:E,sliceTooltipContent:C,className:O,id:W,testId:b,...H}=S,$=ee.useBearId("PieChart"),v=Q.resolveBearId(W,$),h=s.reduce((e,a)=>e+a.value,d.ZERO),[l,j]=J.useState(null),L=I===t.PIE_VIEW_HALF,N=I===t.PIE_VIEW_ROSE,P=L?t.CHART.HALF_SWEEP:t.CHART.FULL_SWEEP,X=M??(L?t.CHART.HALF_PIE_START:t.CHART.DEFAULT_START_ANGLE),Z=Math.max(...s.map(e=>e.value),d.ONE),G=B===t.CHART_LEGEND_NONE||!f,Y=B===t.CHART_LEGEND_BOTTOM,F=(e,a,c)=>{const o=s[c];if(u==null||u(o,c),!m)return;const n=Math.round(o.value/h*t.CHART.VIEWBOX);j({x:e,y:a,index:c,label:o.label,value:o.value,pct:n})},k=()=>{j(null),u==null||u(null,null)};if(s.length===d.ZERO||h===d.ZERO)return r.jsx(p.Flex,{id:v,"data-testid":b,align:"center",justify:"center",className:_.cn("Bear-Chart Bear-Chart--pie Bear-Chart--empty",O),style:{"--Bear-Chart-height":`${y}px`},...H});let g=X;const z=s.map((e,a)=>{const c=N?P/s.length-x:e.value/h*P-x,o=g,n=g+c;g+=c+x;const K=N?t.CHART.ROSE_MIN_RADIUS+e.value/Z*(t.CHART.OUTER_RADIUS-t.CHART.ROSE_MIN_RADIUS):t.CHART.OUTER_RADIUS;return{startAngle:o,endAngle:n,color:R.getChartColor(a,e.color),outerRadius:K,...e}});return r.jsxs(p.Flex,{id:v,"data-testid":b,direction:Y?"column":"row",align:"center",gap:4,wrap:"wrap",className:_.cn("Bear-Chart Bear-Chart--pie",O),style:{"--Bear-Chart-height":`${y}px`},...H,children:[r.jsx(w.Box,{className:"Bear-Chart__pie-canvas",children:r.jsx("svg",{viewBox:`0 0 ${t.CHART.VIEWBOX} ${t.CHART.VIEWBOX}`,className:"Bear-Chart__svg",children:z.map((e,a)=>{const c=(e.startAngle+e.endAngle)/2,o=V===a?R.polarOffset(c,t.CHART.EXPLODE_OFFSET):{x:d.ZERO,y:d.ZERO};return r.jsx("g",{transform:`translate(${o.x} ${o.y})`,children:r.jsx("path",{d:R.createArcPath(e.startAngle,e.endAngle,q,e.outerRadius),fill:e.color,className:_.cn(i&&"bear-cursor-pointer","bear-transition-opacity hover:bear-opacity-80",U&&"animate-scale-in"),style:{animationDelay:`${a*t.CHART.SLICE_DELAY_MS}ms`},onClick:()=>i==null?void 0:i(s[a],a),tabIndex:0,role:"button","aria-label":`${s[a].label} ${Math.round(s[a].value/h*t.CHART.VIEWBOX)}%`,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),i==null||i(s[a],a))},onMouseEnter:n=>F(n.clientX,n.clientY,a),onMouseMove:n=>F(n.clientX,n.clientY,a),onMouseLeave:k})},e.label)})})}),!G&&r.jsx(p.Flex,{direction:"column",gap:2,children:s.map((e,a)=>r.jsxs(p.Flex,{align:"center",gap:2,children:[r.jsx(w.Box,{className:"Bear-Chart__swatch",style:{"--Bear-Chart-color":R.getChartColor(a,e.color)}}),r.jsx(D.Typography,{variant:"body2",color:"muted",children:e.label}),r.jsxs(D.Typography,{variant:"body2",color:"muted",children:[Math.round(e.value/h*t.CHART.VIEWBOX),"%"]})]},e.label))}),l&&m&&r.jsx(te.Portal,{children:r.jsx("div",{className:"pointer-events-none fixed z-[11500] w-56 max-w-[calc(100vw-24px)]",style:{left:l.x+12,top:l.y+12},children:r.jsxs(T.Card,{variant:"elevated",padding:"none",children:[(A||E)&&r.jsx(T.CardHeader,{title:(A==null?void 0:A(s[l.index],l.index))??l.label,subtitle:E==null?void 0:E(s[l.index],l.index)}),r.jsx(T.CardBody,{className:"bear-text-xs bear-text-gray-500 dark:bear-text-slate-400",children:(C==null?void 0:C(s[l.index],l.index))??r.jsxs("span",{children:[l.value," (",l.pct,"%)"]})})]})})})]})};exports.PieChart=ae;
|
|
@@ -1,118 +1,138 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState as
|
|
3
|
-
import { ZERO as
|
|
4
|
-
import { cn as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
1
|
+
import { jsx as l, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { useState as J } from "react";
|
|
3
|
+
import { ZERO as p, ONE as Q } from "../../constants/numbers.const.js";
|
|
4
|
+
import { cn as f } from "../../utils/cn.js";
|
|
5
|
+
import { resolveBearId as ee } from "../../utils/generateBearId.utils.js";
|
|
6
|
+
import { useBearId as ae } from "../../utils/useBearId.js";
|
|
7
|
+
import { Portal as te } from "../Portal/Portal.js";
|
|
8
|
+
import { Card as re, CardHeader as ne, CardBody as oe } from "../Card/Card.js";
|
|
9
|
+
import { Flex as g } from "../Flex/Flex.js";
|
|
10
|
+
import { Box as P } from "../Box/Box.js";
|
|
11
|
+
import { Typography as M } from "../Typography/Typography.js";
|
|
12
|
+
import { CHART as t, PIE_VIEW_FULL as le, PIE_VIEW_ROSE as se, CHART_LEGEND_NONE as ce, CHART_LEGEND_BOTTOM as ie, PIE_VIEW_HALF as de } from "./Chart.const.js";
|
|
13
|
+
import { getChartColor as S, createArcPath as pe, polarOffset as me } from "./Chart.utils.js";
|
|
14
|
+
const Le = (F) => {
|
|
13
15
|
const {
|
|
14
|
-
data:
|
|
15
|
-
height:
|
|
16
|
-
showLabels:
|
|
17
|
-
innerRadius:
|
|
18
|
-
startAngle:
|
|
19
|
-
padAngle:
|
|
20
|
-
animated:
|
|
21
|
-
pieView:
|
|
22
|
-
explodeIndex:
|
|
23
|
-
legendPosition:
|
|
24
|
-
onSliceClick:
|
|
25
|
-
onSliceHover:
|
|
26
|
-
showSliceTooltip:
|
|
27
|
-
sliceTooltipTitle:
|
|
28
|
-
sliceTooltipDescription:
|
|
29
|
-
sliceTooltipContent:
|
|
30
|
-
className:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
data: r,
|
|
17
|
+
height: y = t.DEFAULT_HEIGHT,
|
|
18
|
+
showLabels: U = !0,
|
|
19
|
+
innerRadius: V = p,
|
|
20
|
+
startAngle: W,
|
|
21
|
+
padAngle: _ = t.DEFAULT_PAD_ANGLE,
|
|
22
|
+
animated: $ = !0,
|
|
23
|
+
pieView: B = le,
|
|
24
|
+
explodeIndex: X,
|
|
25
|
+
legendPosition: b = "right",
|
|
26
|
+
onSliceClick: i,
|
|
27
|
+
onSliceHover: d,
|
|
28
|
+
showSliceTooltip: v = !0,
|
|
29
|
+
sliceTooltipTitle: u,
|
|
30
|
+
sliceTooltipDescription: E,
|
|
31
|
+
sliceTooltipContent: A,
|
|
32
|
+
className: x,
|
|
33
|
+
id: H,
|
|
34
|
+
testId: L,
|
|
35
|
+
...C
|
|
36
|
+
} = F, G = ae("PieChart"), R = ee(H, G), m = r.reduce((e, a) => e + a.value, p), [o, N] = J(null), O = B === de, T = B === se, w = O ? t.HALF_SWEEP : t.FULL_SWEEP, j = W ?? (O ? t.HALF_PIE_START : t.DEFAULT_START_ANGLE), Y = Math.max(...r.map((e) => e.value), Q), k = b === ce || !U, z = b === ie, D = (e, a, c) => {
|
|
37
|
+
const s = r[c];
|
|
38
|
+
if (d == null || d(s, c), !v)
|
|
35
39
|
return;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
+
const n = Math.round(s.value / m * t.VIEWBOX);
|
|
41
|
+
N({ x: e, y: a, index: c, label: s.label, value: s.value, pct: n });
|
|
42
|
+
}, K = () => {
|
|
43
|
+
N(null), d == null || d(null, null);
|
|
40
44
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
if (r.length === p || m === p)
|
|
46
|
+
return /* @__PURE__ */ l(
|
|
47
|
+
g,
|
|
48
|
+
{
|
|
49
|
+
id: R,
|
|
50
|
+
"data-testid": L,
|
|
51
|
+
align: "center",
|
|
52
|
+
justify: "center",
|
|
53
|
+
className: f("Bear-Chart Bear-Chart--pie Bear-Chart--empty", x),
|
|
54
|
+
style: { "--Bear-Chart-height": `${y}px` },
|
|
55
|
+
...C
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
let I = j;
|
|
59
|
+
const Z = r.map((e, a) => {
|
|
60
|
+
const c = T ? w / r.length - _ : e.value / m * w - _, s = I, n = I + c;
|
|
61
|
+
I += c + _;
|
|
62
|
+
const q = T ? t.ROSE_MIN_RADIUS + e.value / Y * (t.OUTER_RADIUS - t.ROSE_MIN_RADIUS) : t.OUTER_RADIUS;
|
|
46
63
|
return {
|
|
47
64
|
startAngle: s,
|
|
48
|
-
endAngle:
|
|
49
|
-
color:
|
|
50
|
-
outerRadius:
|
|
65
|
+
endAngle: n,
|
|
66
|
+
color: S(a, e.color),
|
|
67
|
+
outerRadius: q,
|
|
51
68
|
...e
|
|
52
69
|
};
|
|
53
70
|
});
|
|
54
|
-
return /* @__PURE__ */
|
|
55
|
-
|
|
71
|
+
return /* @__PURE__ */ h(
|
|
72
|
+
g,
|
|
56
73
|
{
|
|
57
|
-
|
|
74
|
+
id: R,
|
|
75
|
+
"data-testid": L,
|
|
76
|
+
direction: z ? "column" : "row",
|
|
58
77
|
align: "center",
|
|
59
78
|
gap: 4,
|
|
60
79
|
wrap: "wrap",
|
|
61
|
-
className:
|
|
62
|
-
|
|
80
|
+
className: f("Bear-Chart Bear-Chart--pie", x),
|
|
81
|
+
style: { "--Bear-Chart-height": `${y}px` },
|
|
82
|
+
...C,
|
|
63
83
|
children: [
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
const c = (e.startAngle + e.endAngle) / 2, s =
|
|
66
|
-
return /* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ l(P, { className: "Bear-Chart__pie-canvas", children: /* @__PURE__ */ l("svg", { viewBox: `0 0 ${t.VIEWBOX} ${t.VIEWBOX}`, className: "Bear-Chart__svg", children: Z.map((e, a) => {
|
|
85
|
+
const c = (e.startAngle + e.endAngle) / 2, s = X === a ? me(c, t.EXPLODE_OFFSET) : { x: p, y: p };
|
|
86
|
+
return /* @__PURE__ */ l("g", { transform: `translate(${s.x} ${s.y})`, children: /* @__PURE__ */ l(
|
|
67
87
|
"path",
|
|
68
88
|
{
|
|
69
|
-
d:
|
|
89
|
+
d: pe(e.startAngle, e.endAngle, V, e.outerRadius),
|
|
70
90
|
fill: e.color,
|
|
71
|
-
className:
|
|
72
|
-
|
|
91
|
+
className: f(
|
|
92
|
+
i && "bear-cursor-pointer",
|
|
73
93
|
"bear-transition-opacity hover:bear-opacity-80",
|
|
74
|
-
|
|
94
|
+
$ && "animate-scale-in"
|
|
75
95
|
),
|
|
76
|
-
style: { animationDelay: `${a *
|
|
77
|
-
onClick: () =>
|
|
96
|
+
style: { animationDelay: `${a * t.SLICE_DELAY_MS}ms` },
|
|
97
|
+
onClick: () => i == null ? void 0 : i(r[a], a),
|
|
78
98
|
tabIndex: 0,
|
|
79
99
|
role: "button",
|
|
80
|
-
"aria-label": `${
|
|
81
|
-
onKeyDown: (
|
|
82
|
-
(
|
|
100
|
+
"aria-label": `${r[a].label} ${Math.round(r[a].value / m * t.VIEWBOX)}%`,
|
|
101
|
+
onKeyDown: (n) => {
|
|
102
|
+
(n.key === "Enter" || n.key === " ") && (n.preventDefault(), i == null || i(r[a], a));
|
|
83
103
|
},
|
|
84
|
-
onMouseEnter: (
|
|
85
|
-
onMouseMove: (
|
|
86
|
-
onMouseLeave:
|
|
104
|
+
onMouseEnter: (n) => D(n.clientX, n.clientY, a),
|
|
105
|
+
onMouseMove: (n) => D(n.clientX, n.clientY, a),
|
|
106
|
+
onMouseLeave: K
|
|
87
107
|
}
|
|
88
108
|
) }, e.label);
|
|
89
109
|
}) }) }),
|
|
90
|
-
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
110
|
+
!k && /* @__PURE__ */ l(g, { direction: "column", gap: 2, children: r.map((e, a) => /* @__PURE__ */ h(g, { align: "center", gap: 2, children: [
|
|
111
|
+
/* @__PURE__ */ l(
|
|
112
|
+
P,
|
|
93
113
|
{
|
|
94
|
-
className: "
|
|
95
|
-
style: {
|
|
114
|
+
className: "Bear-Chart__swatch",
|
|
115
|
+
style: { "--Bear-Chart-color": S(a, e.color) }
|
|
96
116
|
}
|
|
97
117
|
),
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
Math.round(e.value /
|
|
118
|
+
/* @__PURE__ */ l(M, { variant: "body2", color: "muted", children: e.label }),
|
|
119
|
+
/* @__PURE__ */ h(M, { variant: "body2", color: "muted", children: [
|
|
120
|
+
Math.round(e.value / m * t.VIEWBOX),
|
|
101
121
|
"%"
|
|
102
122
|
] })
|
|
103
123
|
] }, e.label)) }),
|
|
104
|
-
|
|
105
|
-
(
|
|
106
|
-
|
|
124
|
+
o && v && /* @__PURE__ */ l(te, { children: /* @__PURE__ */ l("div", { className: "pointer-events-none fixed z-[11500] w-56 max-w-[calc(100vw-24px)]", style: { left: o.x + 12, top: o.y + 12 }, children: /* @__PURE__ */ h(re, { variant: "elevated", padding: "none", children: [
|
|
125
|
+
(u || E) && /* @__PURE__ */ l(
|
|
126
|
+
ne,
|
|
107
127
|
{
|
|
108
|
-
title: (
|
|
109
|
-
subtitle:
|
|
128
|
+
title: (u == null ? void 0 : u(r[o.index], o.index)) ?? o.label,
|
|
129
|
+
subtitle: E == null ? void 0 : E(r[o.index], o.index)
|
|
110
130
|
}
|
|
111
131
|
),
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
|
|
132
|
+
/* @__PURE__ */ l(oe, { className: "bear-text-xs bear-text-gray-500 dark:bear-text-slate-400", children: (A == null ? void 0 : A(r[o.index], o.index)) ?? /* @__PURE__ */ h("span", { children: [
|
|
133
|
+
o.value,
|
|
114
134
|
" (",
|
|
115
|
-
|
|
135
|
+
o.pct,
|
|
116
136
|
"%)"
|
|
117
137
|
] }) })
|
|
118
138
|
] }) }) })
|
|
@@ -121,5 +141,5 @@ const ge = (M) => {
|
|
|
121
141
|
);
|
|
122
142
|
};
|
|
123
143
|
export {
|
|
124
|
-
|
|
144
|
+
Le as PieChart
|
|
125
145
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),c=require("../../constants/numbers.const.cjs"),T=require("../../utils/cn.cjs");require("react");const U=require("../../utils/generateBearId.utils.cjs"),D=require("../../utils/useBearId.cjs"),a=require("./Chart.const.cjs"),l=require("./Chart.utils.cjs"),L=m=>{const{data:n,height:g=a.CHART.DEFAULT_HEIGHT,showLabels:x=!0,showValues:y=!1,animated:p=!0,color:R,className:d,id:H,testId:C,...u}=m,S=D.useBearId("RadarChart"),h=U.resolveBearId(H,S),A=n.length,E={"--Bear-Chart-height":`${g}px`};if(A===c.ZERO)return o.jsx("div",{id:h,"data-testid":C,className:T.cn("Bear-Chart Bear-Chart--radar Bear-Chart--empty",d),style:E,...u});const I=Math.max(...n.map(e=>e.value),c.ONE),i=a.CHART.FULL_SWEEP/A,_=n.map((e,r)=>{const t=a.CHART.DEFAULT_START_ANGLE+r*i,s=e.value/I*a.CHART.OUTER_RADIUS;return l.polarToCartesian(t,s)}),b=_.map(e=>`${e.x},${e.y}`).join(" "),B=Array.from({length:a.CHART.RADAR_RINGS},(e,r)=>{const t=(r+c.ONE)/a.CHART.RADAR_RINGS*a.CHART.OUTER_RADIUS;return Array.from({length:A},(s,N)=>{const O=a.CHART.DEFAULT_START_ANGLE+N*i;return l.polarToCartesian(O,t)})});return o.jsx("div",{id:h,"data-testid":C,className:T.cn("Bear-Chart Bear-Chart--radar",d),style:E,...u,children:o.jsxs("svg",{viewBox:`0 0 ${a.CHART.VIEWBOX} ${a.CHART.VIEWBOX}`,className:"Bear-Chart__svg",children:[B.map((e,r)=>o.jsx("polygon",{points:e.map(t=>`${t.x},${t.y}`).join(" "),fill:"none",stroke:"var(--bear-border-default, #e5e5e5)",strokeWidth:.4},r)),n.map((e,r)=>{const t=a.CHART.DEFAULT_START_ANGLE+r*i,s=l.polarToCartesian(t,a.CHART.OUTER_RADIUS);return o.jsx("line",{x1:a.CHART.CENTER,y1:a.CHART.CENTER,x2:s.x,y2:s.y,stroke:"var(--bear-border-default, #e5e5e5)",strokeWidth:.4},e.label)}),o.jsx("polygon",{points:b,fill:l.getChartColor(c.ZERO,R),fillOpacity:.25,stroke:l.getChartColor(c.ZERO,R),strokeWidth:.8,className:T.cn(p&&"animate-scale-in")}),_.map((e,r)=>o.jsx("circle",{cx:e.x,cy:e.y,r:a.CHART.DOT_RADIUS,fill:l.getChartColor(r,n[r].color||R)},n[r].label)),x&&n.map((e,r)=>{const t=a.CHART.DEFAULT_START_ANGLE+r*i,s=l.polarToCartesian(t,a.CHART.OUTER_RADIUS+a.CHART.RADAR_LABEL_OFFSET);return o.jsxs("text",{x:s.x,y:s.y,textAnchor:"middle",dominantBaseline:"middle",className:"bear-fill-[var(--bear-text-secondary)]",fontSize:4,children:[e.label,y?` ${e.value}`:""]},`${e.label}-label`)})]})})};exports.RadarChart=L;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RadarChartProps } from './Chart.types';
|
|
2
|
-
export declare const RadarChart: (props: RadarChartProps) => import("react/jsx-runtime").JSX.Element
|
|
2
|
+
export declare const RadarChart: (props: RadarChartProps) => import("react/jsx-runtime").JSX.Element;
|