@forgedevstack/bear 1.3.1 → 1.3.2
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 +26 -0
- package/dist/components/Accordion/components/AccordionItem/AccordionItem.cjs +1 -1
- package/dist/components/Accordion/components/AccordionItem/AccordionItem.js +1 -1
- package/dist/components/Alert/Alert.cjs +1 -1
- package/dist/components/Alert/Alert.js +1 -1
- package/dist/components/Avatar/Avatar.cjs +1 -1
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/BackTop/BackTop.cjs +1 -1
- package/dist/components/BackTop/BackTop.js +1 -1
- package/dist/components/Banner/Banner.const.cjs +1 -1
- package/dist/components/Banner/Banner.const.js +1 -1
- package/dist/components/Blockquote/Blockquote.cjs +1 -1
- package/dist/components/Blockquote/Blockquote.js +1 -1
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.js +1 -1
- package/dist/components/Chart/BarChart.cjs +1 -1
- package/dist/components/Chart/BarChart.d.ts +1 -2
- package/dist/components/Chart/BarChart.js +81 -61
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -1
- package/dist/components/Chart/Chart.const.d.ts +24 -3
- package/dist/components/Chart/Chart.const.js +39 -16
- package/dist/components/Chart/Chart.d.ts +1 -5
- package/dist/components/Chart/Chart.js +19 -23
- package/dist/components/Chart/Chart.types.d.ts +11 -19
- package/dist/components/Chart/Chart.utils.cjs +1 -1
- package/dist/components/Chart/Chart.utils.d.ts +8 -18
- package/dist/components/Chart/Chart.utils.js +39 -3
- package/dist/components/Chart/FunnelChart.cjs +1 -0
- package/dist/components/Chart/FunnelChart.d.ts +2 -0
- package/dist/components/Chart/FunnelChart.js +59 -0
- package/dist/components/Chart/LineChart.cjs +1 -1
- package/dist/components/Chart/LineChart.d.ts +1 -2
- package/dist/components/Chart/LineChart.js +51 -55
- package/dist/components/Chart/PieChart.cjs +1 -1
- package/dist/components/Chart/PieChart.d.ts +1 -2
- package/dist/components/Chart/PieChart.js +121 -106
- package/dist/components/Chart/PieChart.types.d.ts +8 -0
- package/dist/components/Chart/RadarChart.cjs +1 -0
- package/dist/components/Chart/RadarChart.d.ts +2 -0
- package/dist/components/Chart/RadarChart.js +100 -0
- package/dist/components/Chart/index.d.ts +3 -1
- package/dist/components/Chat/Chat.cjs +1 -1
- package/dist/components/Chat/Chat.js +1 -1
- package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -1
- package/dist/components/CurrencyInput/CurrencyInput.js +1 -1
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.js +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +1 -1
- 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 -11
- package/dist/components/Drawer/Drawer.const.js +6 -55
- package/dist/components/Drawer/Drawer.d.ts +1 -2
- package/dist/components/Drawer/Drawer.js +87 -131
- package/dist/components/Drawer/Drawer.types.d.ts +16 -3
- package/dist/components/Drawer/Drawer.utils.d.ts +0 -4
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeader.cjs +1 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeader.d.ts +2 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeader.js +26 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeader.types.d.ts +20 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderClose.cjs +1 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderClose.d.ts +2 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderClose.js +17 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderTitle.cjs +1 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderTitle.d.ts +2 -0
- package/dist/components/Drawer/components/DrawerHeader/DrawerHeaderTitle.js +9 -0
- package/dist/components/Drawer/components/DrawerHeader/index.d.ts +2 -0
- package/dist/components/Drawer/components/index.d.ts +1 -0
- package/dist/components/Drawer/helpers/DrawerOptionalHeader.cjs +1 -0
- package/dist/components/Drawer/helpers/DrawerOptionalHeader.d.ts +2 -0
- package/dist/components/Drawer/helpers/DrawerOptionalHeader.js +9 -0
- package/dist/components/Drawer/helpers/index.d.ts +1 -0
- package/dist/components/Drawer/hooks/index.d.ts +1 -0
- package/dist/components/Drawer/hooks/useDrawer.cjs +1 -0
- package/dist/components/Drawer/hooks/useDrawer.d.ts +2 -0
- package/dist/components/Drawer/hooks/useDrawer.js +51 -0
- package/dist/components/Editable/Editable.cjs +1 -1
- package/dist/components/Editable/Editable.js +1 -1
- package/dist/components/FileTree/FileTree.cjs +1 -1
- package/dist/components/FileTree/FileTree.js +1 -1
- package/dist/components/FloatingChat/FloatingChat.cjs +1 -1
- package/dist/components/FloatingChat/FloatingChat.js +1 -1
- package/dist/components/Gauge/Gauge.cjs +1 -1
- package/dist/components/Gauge/Gauge.const.cjs +1 -1
- package/dist/components/Gauge/Gauge.const.d.ts +5 -0
- package/dist/components/Gauge/Gauge.const.js +11 -6
- package/dist/components/Gauge/Gauge.d.ts +1 -2
- package/dist/components/Gauge/Gauge.js +69 -45
- package/dist/components/Gauge/Gauge.types.d.ts +11 -2
- package/dist/components/Gauge/helpers/GaugeLinearBar.cjs +1 -0
- package/dist/components/Gauge/helpers/GaugeLinearBar.d.ts +2 -0
- package/dist/components/Gauge/helpers/GaugeLinearBar.js +40 -0
- package/dist/components/Heatmap/Heatmap.cjs +1 -1
- package/dist/components/Heatmap/Heatmap.const.cjs +1 -1
- package/dist/components/Heatmap/Heatmap.const.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.const.js +8 -6
- package/dist/components/Heatmap/Heatmap.js +51 -47
- package/dist/components/Heatmap/Heatmap.types.d.ts +1 -1
- package/dist/components/Icon/Icon.d.ts +2 -39
- package/dist/components/Icon/Icon.types.d.ts +1 -17
- package/dist/components/Icon/icons/action.d.ts +1 -85
- package/dist/components/Icon/icons/bear.d.ts +1 -12
- package/dist/components/Icon/icons/charts.d.ts +1 -0
- package/dist/components/Icon/icons/commerce.d.ts +1 -25
- package/dist/components/Icon/icons/communication.d.ts +1 -48
- package/dist/components/Icon/icons/content.d.ts +1 -53
- package/dist/components/Icon/icons/device.d.ts +1 -27
- package/dist/components/Icon/icons/editor.d.ts +1 -54
- package/dist/components/Icon/icons/file.d.ts +1 -25
- package/dist/components/Icon/icons/index.d.ts +1 -9
- package/dist/components/Icon/icons/media.d.ts +1 -64
- package/dist/components/Icon/icons/misc.d.ts +1 -96
- package/dist/components/Icon/icons/navigation.d.ts +1 -56
- package/dist/components/Icon/icons/social.d.ts +1 -24
- package/dist/components/Icon/icons/status.d.ts +1 -61
- package/dist/components/Icon/index.d.ts +2 -605
- package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -1
- package/dist/components/ImageAnnotation/ImageAnnotation.js +1 -1
- package/dist/components/JsonViewer/JsonViewer.cjs +1 -1
- package/dist/components/JsonViewer/JsonViewer.js +1 -1
- package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -1
- package/dist/components/MediaPlayer/MediaPlayer.js +1 -1
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/PageNav/PageNav.cjs +1 -1
- package/dist/components/PageNav/PageNav.js +1 -1
- package/dist/components/PasswordInput/PasswordInput.cjs +1 -1
- package/dist/components/PasswordInput/PasswordInput.js +5 -5
- package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -1
- package/dist/components/PropsPlayground/PropsPlayground.js +1 -1
- package/dist/components/Rating/components/StarIcon/StarIcon.cjs +1 -1
- package/dist/components/Rating/components/StarIcon/StarIcon.js +1 -1
- package/dist/components/Result/Result.utils.cjs +1 -1
- package/dist/components/Result/Result.utils.js +1 -1
- package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -1
- package/dist/components/RichEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +1 -1
- package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -1
- package/dist/components/RichEditor/components/ToolbarDropdown/ToolbarDropdown.js +1 -1
- package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.cjs +1 -1
- package/dist/components/RichEditor/components/ToolbarMore/ToolbarMore.js +1 -1
- package/dist/components/RichEditor/components/ToolbarSignature/ToolbarSignature.cjs +1 -1
- package/dist/components/RichEditor/components/ToolbarSignature/ToolbarSignature.js +1 -1
- 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/RingProgress/RingProgress.cjs +1 -1
- package/dist/components/RingProgress/RingProgress.const.cjs +1 -1
- package/dist/components/RingProgress/RingProgress.const.d.ts +3 -0
- package/dist/components/RingProgress/RingProgress.const.js +7 -4
- package/dist/components/RingProgress/RingProgress.js +38 -37
- package/dist/components/RingProgress/RingProgress.types.d.ts +1 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.js +16 -15
- package/dist/components/Sidebar/Sidebar.types.d.ts +1 -1
- package/dist/components/Sidebar/Sidebar.utils.cjs +1 -0
- package/dist/components/Sidebar/Sidebar.utils.d.ts +2 -0
- package/dist/components/Sidebar/Sidebar.utils.js +11 -0
- package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.cjs +1 -1
- package/dist/components/Sidebar/components/SidebarGroup/SidebarGroup.js +1 -1
- package/dist/components/Sidebar/components/SidebarItem/SidebarItem.cjs +1 -1
- package/dist/components/Sidebar/components/SidebarItem/SidebarItem.js +55 -51
- package/dist/components/Sidebar/index.d.ts +1 -0
- package/dist/components/SliderRange/SliderRange.cjs +1 -1
- package/dist/components/SliderRange/SliderRange.js +19 -19
- package/dist/components/Sparkline/Sparkline.cjs +1 -1
- package/dist/components/Sparkline/Sparkline.const.cjs +1 -1
- package/dist/components/Sparkline/Sparkline.const.d.ts +5 -0
- package/dist/components/Sparkline/Sparkline.const.js +9 -4
- package/dist/components/Sparkline/Sparkline.d.ts +1 -2
- package/dist/components/Sparkline/Sparkline.js +75 -53
- package/dist/components/Sparkline/Sparkline.types.d.ts +2 -0
- package/dist/components/Sparkline/Sparkline.utils.cjs +1 -1
- package/dist/components/Sparkline/Sparkline.utils.d.ts +7 -12
- package/dist/components/Sparkline/Sparkline.utils.js +33 -20
- package/dist/components/Sparkline/index.d.ts +2 -2
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.js +1 -1
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +1 -1
- package/dist/components/TimePicker/TimePicker.cjs +1 -1
- package/dist/components/TimePicker/TimePicker.js +1 -1
- package/dist/components/TimelineChart/TimelineChart.cjs +1 -1
- package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -1
- package/dist/components/TimelineChart/TimelineChart.const.d.ts +3 -0
- package/dist/components/TimelineChart/TimelineChart.const.js +7 -4
- package/dist/components/TimelineChart/TimelineChart.js +56 -42
- package/dist/components/TimelineChart/TimelineChart.types.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.js +1 -1
- package/dist/components/TreeSelect/components/TreeSelectExpandControl/TreeSelectExpandControl.cjs +1 -1
- package/dist/components/TreeSelect/components/TreeSelectExpandControl/TreeSelectExpandControl.js +1 -1
- package/dist/components/TreeView/TreeView.cjs +1 -1
- package/dist/components/TreeView/TreeView.js +3 -2
- package/dist/components/TreeView/components/TreeViewExpandControl/TreeViewExpandControl.cjs +1 -1
- package/dist/components/TreeView/components/TreeViewExpandControl/TreeViewExpandControl.js +1 -1
- package/dist/components/TreeView/components/TreeViewNodeIcon/TreeViewNodeIcon.cjs +1 -1
- package/dist/components/TreeView/components/TreeViewNodeIcon/TreeViewNodeIcon.js +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +409 -406
- package/dist/constants/generals.const.cjs +1 -1
- package/dist/constants/generals.const.d.ts +4 -0
- package/dist/constants/generals.const.js +50 -47
- package/dist/icons.cjs +1 -1
- package/dist/icons.d.ts +2 -2
- package/dist/icons.js +1 -6
- package/dist/index.cjs +1 -1
- package/dist/index.js +551 -548
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.js +14 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.js +35 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/action.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/action.js +26 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.js +4 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.js +130 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.js +12 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.js +18 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/status.cjs +1 -0
- package/dist/node_modules/@forgedevstack/bear-icons/dist/status.js +6 -0
- package/dist/styles/_drawer.css +213 -0
- package/dist/styles/_overlays.css +0 -1
- package/dist/styles/main.css +1 -0
- package/dist/styles.css +226 -25
- package/package.json +5 -1
- package/dist/components/Icon/Icon.cjs +0 -1
- package/dist/components/Icon/Icon.const.d.ts +0 -1
- package/dist/components/Icon/Icon.js +0 -45
- package/dist/components/Icon/icons/action.cjs +0 -1
- package/dist/components/Icon/icons/action.js +0 -351
- package/dist/components/Icon/icons/bear.cjs +0 -1
- package/dist/components/Icon/icons/bear.js +0 -47
- package/dist/components/Icon/icons/commerce.cjs +0 -1
- package/dist/components/Icon/icons/commerce.js +0 -124
- package/dist/components/Icon/icons/communication.cjs +0 -1
- package/dist/components/Icon/icons/communication.js +0 -184
- package/dist/components/Icon/icons/content.cjs +0 -1
- package/dist/components/Icon/icons/content.js +0 -231
- package/dist/components/Icon/icons/device.cjs +0 -1
- package/dist/components/Icon/icons/device.js +0 -122
- package/dist/components/Icon/icons/editor.cjs +0 -1
- package/dist/components/Icon/icons/editor.js +0 -285
- package/dist/components/Icon/icons/file.cjs +0 -1
- package/dist/components/Icon/icons/file.js +0 -120
- package/dist/components/Icon/icons/media.cjs +0 -1
- package/dist/components/Icon/icons/media.js +0 -306
- package/dist/components/Icon/icons/misc.cjs +0 -1
- package/dist/components/Icon/icons/misc.js +0 -450
- package/dist/components/Icon/icons/navigation.cjs +0 -1
- package/dist/components/Icon/icons/navigation.js +0 -215
- package/dist/components/Icon/icons/social.cjs +0 -1
- package/dist/components/Icon/icons/social.js +0 -89
- package/dist/components/Icon/icons/status.cjs +0 -1
- package/dist/components/Icon/icons/status.js +0 -271
- package/dist/components/Icon/index.cjs +0 -1
- package/dist/components/Icon/index.js +0 -79
|
@@ -1,110 +1,125 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
color: B(a, r.color),
|
|
41
|
-
...r
|
|
42
|
-
};
|
|
43
|
-
return e += s + b, m;
|
|
44
|
-
});
|
|
45
|
-
}, [t, $, w, b]), c = (e, r) => {
|
|
46
|
-
const a = e * Math.PI / 180;
|
|
47
|
-
return { x: 50 + r * Math.cos(a), y: 50 + r * Math.sin(a) };
|
|
48
|
-
}, z = (e, r) => {
|
|
49
|
-
const a = g * l, s = c(e, l), m = c(r, l), P = c(e, a), A = c(r, a), p = r - e > 180 ? 1 : 0;
|
|
50
|
-
return g > 0 ? `M ${s.x},${s.y} A ${l},${l} 0 ${p},1 ${m.x},${m.y} L ${A.x},${A.y} A ${a},${a} 0 ${p},0 ${P.x},${P.y} Z` : `M 50,50 L ${s.x},${s.y} A ${l},${l} 0 ${p},1 ${m.x},${m.y} Z`;
|
|
1
|
+
import { jsxs as u, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as z } from "react";
|
|
3
|
+
import { ZERO as h, ONE as K } from "../../constants/numbers.const.js";
|
|
4
|
+
import { cn as N } from "../../utils/cn.js";
|
|
5
|
+
import { Portal as Z } from "../Portal/Portal.js";
|
|
6
|
+
import { Card as q, CardHeader as J, CardBody as Q } from "../Card/Card.js";
|
|
7
|
+
import { Flex as _ } from "../Flex/Flex.js";
|
|
8
|
+
import { Box as T } from "../Box/Box.js";
|
|
9
|
+
import { Typography as D } from "../Typography/Typography.js";
|
|
10
|
+
import { CHART as r, PIE_VIEW_FULL as ee, PIE_VIEW_ROSE as ae, CHART_LEGEND_NONE as re, CHART_LEGEND_BOTTOM as te, PIE_VIEW_HALF as le } from "./Chart.const.js";
|
|
11
|
+
import { getChartColor as B, createArcPath as ne, polarOffset as oe } from "./Chart.utils.js";
|
|
12
|
+
const ge = (M) => {
|
|
13
|
+
const {
|
|
14
|
+
data: t,
|
|
15
|
+
height: f = r.DEFAULT_HEIGHT,
|
|
16
|
+
showLabels: P = !0,
|
|
17
|
+
innerRadius: S = h,
|
|
18
|
+
startAngle: F,
|
|
19
|
+
padAngle: A = r.DEFAULT_PAD_ANGLE,
|
|
20
|
+
animated: U = !0,
|
|
21
|
+
pieView: I = ee,
|
|
22
|
+
explodeIndex: C,
|
|
23
|
+
legendPosition: y = "right",
|
|
24
|
+
onSliceClick: d,
|
|
25
|
+
onSliceHover: i,
|
|
26
|
+
showSliceTooltip: L = !0,
|
|
27
|
+
sliceTooltipTitle: m,
|
|
28
|
+
sliceTooltipDescription: p,
|
|
29
|
+
sliceTooltipContent: b,
|
|
30
|
+
className: V,
|
|
31
|
+
...W
|
|
32
|
+
} = M, E = t.reduce((e, a) => e + a.value, h), [n, x] = z(null), R = I === le, v = I === ae, w = R ? r.HALF_SWEEP : r.FULL_SWEEP, X = F ?? (R ? r.HALF_PIE_START : r.DEFAULT_START_ANGLE), H = Math.max(...t.map((e) => e.value), K), $ = y === re || !P, G = y === te, O = (e, a, c) => {
|
|
33
|
+
const s = t[c];
|
|
34
|
+
if (i == null || i(s, c), !L)
|
|
35
|
+
return;
|
|
36
|
+
const l = Math.round(s.value / E * r.VIEWBOX);
|
|
37
|
+
x({ x: e, y: a, index: c, label: s.label, value: s.value, pct: l });
|
|
38
|
+
}, k = () => {
|
|
39
|
+
x(null), i == null || i(null, null);
|
|
51
40
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
" (",
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
41
|
+
let g = X;
|
|
42
|
+
const Y = t.map((e, a) => {
|
|
43
|
+
const c = v ? w / t.length - A : e.value / E * w - A, s = g, l = g + c;
|
|
44
|
+
g += c + A;
|
|
45
|
+
const j = v ? r.ROSE_MIN_RADIUS + e.value / H * (r.OUTER_RADIUS - r.ROSE_MIN_RADIUS) : r.OUTER_RADIUS;
|
|
46
|
+
return {
|
|
47
|
+
startAngle: s,
|
|
48
|
+
endAngle: l,
|
|
49
|
+
color: B(a, e.color),
|
|
50
|
+
outerRadius: j,
|
|
51
|
+
...e
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
return /* @__PURE__ */ u(
|
|
55
|
+
_,
|
|
56
|
+
{
|
|
57
|
+
direction: G ? "column" : "row",
|
|
58
|
+
align: "center",
|
|
59
|
+
gap: 4,
|
|
60
|
+
wrap: "wrap",
|
|
61
|
+
className: N("Bear-Chart Bear-Chart--pie bear-relative bear-max-w-full", V),
|
|
62
|
+
...W,
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ o(T, { style: { width: f, height: f }, className: "bear-min-w-0 bear-shrink-0", children: /* @__PURE__ */ o("svg", { viewBox: `0 0 ${r.VIEWBOX} ${r.VIEWBOX}`, className: "bear-h-full bear-w-full", children: Y.map((e, a) => {
|
|
65
|
+
const c = (e.startAngle + e.endAngle) / 2, s = C === a ? oe(c, r.EXPLODE_OFFSET) : { x: h, y: h };
|
|
66
|
+
return /* @__PURE__ */ o("g", { transform: `translate(${s.x} ${s.y})`, children: /* @__PURE__ */ o(
|
|
67
|
+
"path",
|
|
68
|
+
{
|
|
69
|
+
d: ne(e.startAngle, e.endAngle, S, e.outerRadius),
|
|
70
|
+
fill: e.color,
|
|
71
|
+
className: N(
|
|
72
|
+
d && "bear-cursor-pointer",
|
|
73
|
+
"bear-transition-opacity hover:bear-opacity-80",
|
|
74
|
+
U && "animate-scale-in"
|
|
75
|
+
),
|
|
76
|
+
style: { animationDelay: `${a * r.SLICE_DELAY_MS}ms` },
|
|
77
|
+
onClick: () => d == null ? void 0 : d(t[a], a),
|
|
78
|
+
tabIndex: 0,
|
|
79
|
+
role: "button",
|
|
80
|
+
"aria-label": `${t[a].label} ${Math.round(t[a].value / E * r.VIEWBOX)}%`,
|
|
81
|
+
onKeyDown: (l) => {
|
|
82
|
+
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), d == null || d(t[a], a));
|
|
83
|
+
},
|
|
84
|
+
onMouseEnter: (l) => O(l.clientX, l.clientY, a),
|
|
85
|
+
onMouseMove: (l) => O(l.clientX, l.clientY, a),
|
|
86
|
+
onMouseLeave: k
|
|
87
|
+
}
|
|
88
|
+
) }, e.label);
|
|
89
|
+
}) }) }),
|
|
90
|
+
!$ && /* @__PURE__ */ o(_, { direction: "column", gap: 2, children: t.map((e, a) => /* @__PURE__ */ u(_, { align: "center", gap: 2, children: [
|
|
91
|
+
/* @__PURE__ */ o(
|
|
92
|
+
T,
|
|
93
|
+
{
|
|
94
|
+
className: "bear-h-3 bear-w-3 bear-rounded-full",
|
|
95
|
+
style: { backgroundColor: B(a, e.color) }
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ o(D, { variant: "body2", color: "muted", children: e.label }),
|
|
99
|
+
/* @__PURE__ */ u(D, { variant: "body2", color: "muted", children: [
|
|
100
|
+
Math.round(e.value / E * r.VIEWBOX),
|
|
101
|
+
"%"
|
|
102
|
+
] })
|
|
103
|
+
] }, e.label)) }),
|
|
104
|
+
n && L && /* @__PURE__ */ o(Z, { children: /* @__PURE__ */ o("div", { className: "pointer-events-none fixed z-[11500] w-56 max-w-[calc(100vw-24px)]", style: { left: n.x + 12, top: n.y + 12 }, children: /* @__PURE__ */ u(q, { variant: "elevated", padding: "none", children: [
|
|
105
|
+
(m || p) && /* @__PURE__ */ o(
|
|
106
|
+
J,
|
|
107
|
+
{
|
|
108
|
+
title: (m == null ? void 0 : m(t[n.index], n.index)) ?? n.label,
|
|
109
|
+
subtitle: p == null ? void 0 : p(t[n.index], n.index)
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ o(Q, { className: "bear-text-xs bear-text-gray-500 dark:bear-text-slate-400", children: (b == null ? void 0 : b(t[n.index], n.index)) ?? /* @__PURE__ */ u("span", { children: [
|
|
113
|
+
n.value,
|
|
114
|
+
" (",
|
|
115
|
+
n.pct,
|
|
116
|
+
"%)"
|
|
117
|
+
] }) })
|
|
118
|
+
] }) }) })
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
);
|
|
107
122
|
};
|
|
108
123
|
export {
|
|
109
|
-
|
|
124
|
+
ge as PieChart
|
|
110
125
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),c=require("../../constants/numbers.const.cjs"),C=require("../../utils/cn.cjs");require("react");const r=require("./Chart.const.cjs"),o=require("./Chart.utils.cjs"),f=u=>{const{data:s,height:E=r.CHART.DEFAULT_HEIGHT,showLabels:d=!0,showValues:h=!1,animated:_=!0,color:A,className:m,...x}=u,i=s.length;if(i===c.ZERO)return null;const b=Math.max(...s.map(e=>e.value),c.ONE),R=r.CHART.FULL_SWEEP/i,T=s.map((e,a)=>{const t=r.CHART.DEFAULT_START_ANGLE+a*R,l=e.value/b*r.CHART.OUTER_RADIUS;return o.polarToCartesian(t,l)}),g=T.map(e=>`${e.x},${e.y}`).join(" "),H=Array.from({length:r.CHART.RADAR_RINGS},(e,a)=>{const t=(a+c.ONE)/r.CHART.RADAR_RINGS*r.CHART.OUTER_RADIUS;return Array.from({length:i},(l,y)=>{const p=r.CHART.DEFAULT_START_ANGLE+y*R;return o.polarToCartesian(p,t)})});return n.jsx("div",{className:C.cn("Bear-Chart Bear-Chart--radar bear-flex bear-flex-col bear-items-center",m),style:{height:E},...x,children:n.jsxs("svg",{viewBox:`0 0 ${r.CHART.VIEWBOX} ${r.CHART.VIEWBOX}`,className:"bear-h-full bear-w-full",children:[H.map((e,a)=>n.jsx("polygon",{points:e.map(t=>`${t.x},${t.y}`).join(" "),fill:"none",stroke:"var(--bear-border-default, #e5e5e5)",strokeWidth:.4},a)),s.map((e,a)=>{const t=r.CHART.DEFAULT_START_ANGLE+a*R,l=o.polarToCartesian(t,r.CHART.OUTER_RADIUS);return n.jsx("line",{x1:r.CHART.CENTER,y1:r.CHART.CENTER,x2:l.x,y2:l.y,stroke:"var(--bear-border-default, #e5e5e5)",strokeWidth:.4},e.label)}),n.jsx("polygon",{points:g,fill:o.getChartColor(c.ZERO,A),fillOpacity:.25,stroke:o.getChartColor(c.ZERO,A),strokeWidth:.8,className:C.cn(_&&"animate-scale-in")}),T.map((e,a)=>n.jsx("circle",{cx:e.x,cy:e.y,r:r.CHART.DOT_RADIUS,fill:o.getChartColor(a,s[a].color||A)},s[a].label)),d&&s.map((e,a)=>{const t=r.CHART.DEFAULT_START_ANGLE+a*R,l=o.polarToCartesian(t,r.CHART.OUTER_RADIUS+r.CHART.RADAR_LABEL_OFFSET);return n.jsxs("text",{x:l.x,y:l.y,textAnchor:"middle",dominantBaseline:"middle",className:"bear-fill-[var(--bear-text-secondary)]",fontSize:4,children:[e.label,h?` ${e.value}`:""]},`${e.label}-label`)})]})})};exports.RadarChart=f;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as n, jsxs as T } from "react/jsx-runtime";
|
|
2
|
+
import { ZERO as A, ONE as d } from "../../constants/numbers.const.js";
|
|
3
|
+
import { cn as u } from "../../utils/cn.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { CHART as r } from "./Chart.const.js";
|
|
6
|
+
import { polarToCartesian as c, getChartColor as R } from "./Chart.utils.js";
|
|
7
|
+
const $ = (_) => {
|
|
8
|
+
const {
|
|
9
|
+
data: o,
|
|
10
|
+
height: f = r.DEFAULT_HEIGHT,
|
|
11
|
+
showLabels: p = !0,
|
|
12
|
+
showValues: h = !1,
|
|
13
|
+
animated: b = !0,
|
|
14
|
+
color: i,
|
|
15
|
+
className: x,
|
|
16
|
+
...y
|
|
17
|
+
} = _, m = o.length;
|
|
18
|
+
if (m === A)
|
|
19
|
+
return null;
|
|
20
|
+
const g = Math.max(...o.map((e) => e.value), d), s = r.FULL_SWEEP / m, E = o.map((e, a) => {
|
|
21
|
+
const t = r.DEFAULT_START_ANGLE + a * s, l = e.value / g * r.OUTER_RADIUS;
|
|
22
|
+
return c(t, l);
|
|
23
|
+
}), S = E.map((e) => `${e.x},${e.y}`).join(" "), U = Array.from({ length: r.RADAR_RINGS }, (e, a) => {
|
|
24
|
+
const t = (a + d) / r.RADAR_RINGS * r.OUTER_RADIUS;
|
|
25
|
+
return Array.from({ length: m }, (l, D) => {
|
|
26
|
+
const L = r.DEFAULT_START_ANGLE + D * s;
|
|
27
|
+
return c(L, t);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
return /* @__PURE__ */ n("div", { className: u("Bear-Chart Bear-Chart--radar bear-flex bear-flex-col bear-items-center", x), style: { height: f }, ...y, children: /* @__PURE__ */ T("svg", { viewBox: `0 0 ${r.VIEWBOX} ${r.VIEWBOX}`, className: "bear-h-full bear-w-full", children: [
|
|
31
|
+
U.map((e, a) => /* @__PURE__ */ n(
|
|
32
|
+
"polygon",
|
|
33
|
+
{
|
|
34
|
+
points: e.map((t) => `${t.x},${t.y}`).join(" "),
|
|
35
|
+
fill: "none",
|
|
36
|
+
stroke: "var(--bear-border-default, #e5e5e5)",
|
|
37
|
+
strokeWidth: 0.4
|
|
38
|
+
},
|
|
39
|
+
a
|
|
40
|
+
)),
|
|
41
|
+
o.map((e, a) => {
|
|
42
|
+
const t = r.DEFAULT_START_ANGLE + a * s, l = c(t, r.OUTER_RADIUS);
|
|
43
|
+
return /* @__PURE__ */ n(
|
|
44
|
+
"line",
|
|
45
|
+
{
|
|
46
|
+
x1: r.CENTER,
|
|
47
|
+
y1: r.CENTER,
|
|
48
|
+
x2: l.x,
|
|
49
|
+
y2: l.y,
|
|
50
|
+
stroke: "var(--bear-border-default, #e5e5e5)",
|
|
51
|
+
strokeWidth: 0.4
|
|
52
|
+
},
|
|
53
|
+
e.label
|
|
54
|
+
);
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ n(
|
|
57
|
+
"polygon",
|
|
58
|
+
{
|
|
59
|
+
points: S,
|
|
60
|
+
fill: R(A, i),
|
|
61
|
+
fillOpacity: 0.25,
|
|
62
|
+
stroke: R(A, i),
|
|
63
|
+
strokeWidth: 0.8,
|
|
64
|
+
className: u(b && "animate-scale-in")
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
E.map((e, a) => /* @__PURE__ */ n(
|
|
68
|
+
"circle",
|
|
69
|
+
{
|
|
70
|
+
cx: e.x,
|
|
71
|
+
cy: e.y,
|
|
72
|
+
r: r.DOT_RADIUS,
|
|
73
|
+
fill: R(a, o[a].color || i)
|
|
74
|
+
},
|
|
75
|
+
o[a].label
|
|
76
|
+
)),
|
|
77
|
+
p && o.map((e, a) => {
|
|
78
|
+
const t = r.DEFAULT_START_ANGLE + a * s, l = c(t, r.OUTER_RADIUS + r.RADAR_LABEL_OFFSET);
|
|
79
|
+
return /* @__PURE__ */ T(
|
|
80
|
+
"text",
|
|
81
|
+
{
|
|
82
|
+
x: l.x,
|
|
83
|
+
y: l.y,
|
|
84
|
+
textAnchor: "middle",
|
|
85
|
+
dominantBaseline: "middle",
|
|
86
|
+
className: "bear-fill-[var(--bear-text-secondary)]",
|
|
87
|
+
fontSize: 4,
|
|
88
|
+
children: [
|
|
89
|
+
e.label,
|
|
90
|
+
h ? ` ${e.value}` : ""
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
`${e.label}-label`
|
|
94
|
+
);
|
|
95
|
+
})
|
|
96
|
+
] }) });
|
|
97
|
+
};
|
|
98
|
+
export {
|
|
99
|
+
$ as RadarChart
|
|
100
|
+
};
|
|
@@ -2,4 +2,6 @@ export { Chart } from './Chart';
|
|
|
2
2
|
export { BarChart } from './BarChart';
|
|
3
3
|
export { LineChart } from './LineChart';
|
|
4
4
|
export { PieChart } from './PieChart';
|
|
5
|
-
export
|
|
5
|
+
export { RadarChart } from './RadarChart';
|
|
6
|
+
export { FunnelChart } from './FunnelChart';
|
|
7
|
+
export type { ChartProps, BarChartProps, LineChartProps, PieChartProps, RadarChartProps, FunnelChartProps, ChartDataPoint, ChartType, PieView, ChartLegendPosition, } from './Chart.types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),d=require("../../utils/cn.cjs"),D=require("../../context/BearProvider.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),d=require("../../utils/cn.cjs"),D=require("../../context/BearProvider.cjs"),I=require("../Button/Button.cjs"),q=require("../Input/Input.cjs"),B=require("../Avatar/Avatar.cjs");require("../Box/Box.cjs");const u=require("../Typography/Typography.cjs"),_=require("@forgedevstack/bear-icons"),x=require("./Chat.const.cjs"),R=({message:r,showTimestamp:n=!0,showStatus:s=!0,showAvatar:b=!0,userAvatar:y,botAvatar:m})=>{var c;const a=r.sender==="user",f=r.sender==="system",l=x.SENDER_COLORS[r.sender];if(f)return e.jsx("div",{className:"flex justify-center my-2",children:e.jsx(u.Typography,{variant:"caption",className:"px-3 py-1 rounded-full bg-gray-100 dark:bg-gray-800",style:{color:l.text},children:r.content})});const v=a?y:m,p=r.status?x.MESSAGE_STATUS_ICONS[r.status]:null;return e.jsxs("div",{className:d.cn("flex gap-2 mb-3",a?"flex-row-reverse":"flex-row"),children:[b&&e.jsx(B.Avatar,{src:v,initials:((c=r.name)==null?void 0:c[0])||(a?"U":"B"),size:"sm",className:"flex-shrink-0"}),e.jsxs("div",{className:d.cn("flex flex-col max-w-[70%]",a?"items-end":"items-start"),children:[r.name&&e.jsx(u.Typography,{variant:"caption",className:"mb-1 opacity-60",children:r.name}),e.jsx("div",{className:d.cn("px-4 py-2 rounded-2xl",a?"rounded-br-sm":"rounded-bl-sm"),style:{backgroundColor:l.bg,color:l.text},children:typeof r.content=="string"?e.jsx(u.Typography,{variant:"body2",children:r.content}):r.content}),e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[n&&r.timestamp&&e.jsx(u.Typography,{variant:"caption",className:"opacity-50 text-xs",children:r.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),s&&p&&a&&e.jsx("span",{className:d.cn("text-xs",r.status==="read"?"text-blue-500":"opacity-50",r.status==="error"&&"text-red-500"),children:p})]})]})]})},H=({text:r=x.CHAT_DEFAULTS.TYPING_TEXT})=>e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsxs("div",{className:"flex gap-1 px-4 py-3 bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-sm",children:[e.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),e.jsx(u.Typography,{variant:"caption",className:"opacity-50",children:r})]}),U=({messages:r,onSend:n,isLoading:s=!1,placeholder:b=x.CHAT_DEFAULTS.PLACEHOLDER,header:y,footer:m,showTimestamps:a=!0,showStatus:f=!0,showAvatars:l=!0,userAvatar:v,botAvatar:p,isTyping:c=!1,typingText:C,className:S,height:j=x.CHAT_DEFAULTS.HEIGHT,testId:w,disabled:h=!1})=>{const{mode:E}=D.useBear(),k=E==="dark",[o,g]=i.useState(""),T=i.useRef(null);i.useEffect(()=>{var t;(t=T.current)==null||t.scrollIntoView({behavior:"smooth"})},[r,c]);const N=i.useCallback(()=>{o.trim()&&n&&!h&&!s&&(n(o.trim()),g(""))},[o,n,h,s]),A=i.useCallback(t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),N())},[N]);return e.jsxs("div",{className:d.cn("Bear-Chat","flex flex-col rounded-xl overflow-hidden border",k?"bg-gray-900 border-gray-700":"bg-white border-gray-200",S),style:{height:typeof j=="number"?`${j}px`:j},"data-testid":w,children:[y&&e.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:y}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[r.map(t=>e.jsx(R,{message:t,showTimestamp:a,showStatus:f,showAvatar:l,userAvatar:v,botAvatar:p},t.id)),c&&e.jsx(H,{text:C}),e.jsx("div",{ref:T})]}),e.jsxs("div",{className:"p-3 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(q.Input,{value:o,onChange:t=>g(t.target.value),onKeyDown:A,placeholder:b,disabled:h||s,className:"flex-1"}),e.jsx(I.Button,{variant:"primary",onClick:N,disabled:!o.trim()||h||s,children:e.jsx(_.BearIcons.SendIcon,{size:18})})]}),m&&e.jsx("div",{className:"mt-2",children:m})]})]})};exports.Chat=U;
|
|
@@ -7,7 +7,7 @@ import { Input as U } from "../Input/Input.js";
|
|
|
7
7
|
import { Avatar as j } from "../Avatar/Avatar.js";
|
|
8
8
|
import "../Box/Box.js";
|
|
9
9
|
import { Typography as m } from "../Typography/Typography.js";
|
|
10
|
-
import { BearIcons as G } from "
|
|
10
|
+
import { BearIcons as G } from "@forgedevstack/bear-icons";
|
|
11
11
|
import { CHAT_DEFAULTS as g, SENDER_COLORS as K, MESSAGE_STATUS_ICONS as V } from "./Chat.const.js";
|
|
12
12
|
const z = ({
|
|
13
13
|
message: e,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),n=require("react"),U=require("../Input/Input.cjs"),B=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),n=require("react"),U=require("../Input/Input.cjs"),B=require("@forgedevstack/bear-icons"),c=require("./CurrencyInput.const.cjs"),l=require("./CurrencyInput.utils.cjs"),M=({value:p,onChange:u,currency:r=c.DEFAULT_CURRENCY,locale:s=c.DEFAULT_LOCALE,decimals:e=c.DEFAULT_DECIMALS,placeholder:S="0.00",size:f="md",disabled:A=!1,error:F,allowNegative:C=!1,max:o,min:a,testId:L,className:b,...q})=>{const[i,d]=n.useState(()=>l.formatCurrency(p,s,e)),[I,g]=n.useState(!1);n.useEffect(()=>{I||d(l.formatCurrency(p,s,e))},[p,s,e,I]);const D=n.useCallback(t=>{const m=t.target.value,x=C?/[^0-9.,-]/g:/[^0-9.,]/g;d(m.replace(x,""))},[C]),R=n.useCallback(()=>{g(!1);let t=l.parseCurrency(i);t!=null&&(o!=null&&t>o&&(t=o),a!=null&&t<a&&(t=a),t=parseFloat(t.toFixed(e))),u==null||u(t),d(l.formatCurrency(t,s,e))},[i,s,e,o,a,u]),E=typeof r=="string"?c.CURRENCY_SYMBOLS[r]??r:null,_=typeof r!="string"?r:y.jsx(B.BearIcons.DollarSignIcon,{size:f==="sm"?14:f==="lg"?20:16,className:"text-gray-400"}),j=E?y.jsx("span",{className:"text-gray-500 dark:text-gray-400 font-medium select-none",children:E}):_;return y.jsx(U.Input,{...q,size:f,disabled:A,error:F,placeholder:S,value:i,onChange:D,onFocus:()=>g(!0),onBlur:R,inputMode:"decimal",className:b,"data-testid":L,InputProps:{startAdornment:j}})};exports.CurrencyInput=M;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import { useState as E, useEffect as M, useCallback as C } from "react";
|
|
3
3
|
import { Input as N } from "../Input/Input.js";
|
|
4
|
-
import { BearIcons as T } from "
|
|
4
|
+
import { BearIcons as T } from "@forgedevstack/bear-icons";
|
|
5
5
|
import { DEFAULT_LOCALE as Y, DEFAULT_DECIMALS as b, DEFAULT_CURRENCY as k, CURRENCY_SYMBOLS as O } from "./CurrencyInput.const.js";
|
|
6
6
|
import { formatCurrency as m, parseCurrency as V } from "./CurrencyInput.utils.js";
|
|
7
7
|
const J = ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("react"),M=require("../Calendar/Calendar.cjs"),U=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("react"),M=require("../Calendar/Calendar.cjs"),U=require("@forgedevstack/bear-icons"),X=require("../OverlayPortal/OverlayPortal.cjs"),A=require("../../utils/cn.cjs"),Z=require("../../hooks/useClickOutside.cjs"),G=require("../../hooks/useBearStyles.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");require("../../context/BearProvider.cjs");const Y=require("../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.cjs"),J=require("../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.cjs");require("../FormControl/FormControl.context.cjs");const Q=require("./DatePicker.utils.cjs"),e=require("./DatePicker.const.cjs"),ee=o=>{const{value:s,onChange:t,minDate:C,maxDate:T,disabled:c=!1,placeholder:f=e.DATEPICKER_DEFAULT_PLACEHOLDER,label:u,error:l,helperText:b,format:S=e.DATEPICKER_DEFAULT_FORMAT,clearable:x=!0,className:O,style:P,bis:m,showWeekNumbers:I=!1,disabledDates:h=[],highlightedDates:y=[],slots:k,weekdayLabels:p,firstDayOfWeek:L=e.DATEPICKER_DEFAULT_FIRST_DAY,size:w="md",variant:K="default",icon:N,testId:q}=o,{openEffect:j,closeEffect:v}=J.resolveOverlayEffects(o),[n,_]=a.useState(!1),[z,F]=a.useState(s??new Date),d=a.useRef(null),E=a.useRef(null),R=a.useRef(null),D=G.useBearStyles(m,P),{style:g,ready:$}=Y.useFixedAnchorPosition({anchorRef:E,open:n,estimatedHeightPx:e.DATEPICKER_DROPDOWN_HEIGHT_PX}),H=a.useCallback(()=>_(!1),[]);Z.useClickOutsideMultiple([d,R],H,{enabled:n});const V=a.useCallback(i=>{t==null||t(i),_(!1)},[t]),W=a.useCallback(()=>{t==null||t(null),_(!1)},[t]),B=a.useCallback(i=>{F(i)},[]);return r.jsxs("div",{ref:d,className:A.cn(e.D_A_T_E_P_I_C_K_E_R_ROOT_CLASS,"bear-relative",O),style:Object.keys(D).length?D:void 0,"data-testid":q,children:[u&&r.jsx("label",{className:`${e.D_A_T_E_P_I_C_K_E_R_ROOT_CLASS}__label bear-block bear-text-sm bear-font-medium bear-text-zinc-700 dark:bear-text-zinc-300 bear-mb-1.5`,children:u}),r.jsxs("button",{ref:E,type:"button",onClick:()=>!c&&_(!n),disabled:c,className:A.cn(`${e.D_A_T_E_P_I_C_K_E_R_ROOT_CLASS}__trigger bear-w-full bear-flex bear-items-center bear-justify-between bear-rounded-lg bear-border bear-text-left bear-transition-colors`,e.DATEPICKER_SIZE_CLASSES[w],e.DATEPICKER_VARIANT_CLASSES[K],l?"bear-border-red-500":"focus:bear-border-primary-500",c&&"bear-opacity-50 bear-cursor-not-allowed",s?"bear-text-zinc-900 dark:bear-text-white":"bear-text-zinc-500"),children:[r.jsx("span",{className:`${e.D_A_T_E_P_I_C_K_E_R_ROOT_CLASS}__value`,children:s?Q.formatDate(s,S):f}),r.jsx("span",{className:`${e.D_A_T_E_P_I_C_K_E_R_ROOT_CLASS}__icon`,children:N??r.jsx(U.CalendarIcon,{className:"bear-w-5 bear-h-5 bear-text-zinc-400 bear-shrink-0"})})]}),l&&r.jsx("p",{className:`${e.D_A_T_E_P_I_C_K_E_R_ROOT_CLASS}__error bear-mt-1 bear-text-xs bear-text-red-400`,children:l}),b&&!l&&r.jsx("p",{className:`${e.D_A_T_E_P_I_C_K_E_R_ROOT_CLASS}__helper bear-mt-1 bear-text-xs bear-text-zinc-500`,children:b}),r.jsx(X.OverlayPortal,{open:n,ready:$,style:g,zIndex:e.DATEPICKER_DROPDOWN_Z_INDEX,openEffect:j,closeEffect:v,className:`${e.D_A_T_E_P_I_C_K_E_R_ROOT_CLASS}__dropdown`,panelRef:R,attributes:{[e.DATEPICKER_CALENDAR_ATTR]:""},children:r.jsx(M.Calendar,{viewDate:z,onViewChange:B,value:s??null,onSelect:V,minDate:C,maxDate:T,disabledDates:h,highlightedDates:y,slots:k,weekdayLabels:p,firstDayOfWeek:L,showWeekNumbers:I,clearable:x,onClear:W,showTodayButton:!0,onToday:()=>{t==null||t(new Date),_(!1)}})})]})};exports.DatePicker=ee;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as D, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { useState as A, useRef as b, useCallback as n } from "react";
|
|
3
3
|
import { Calendar as G } from "../Calendar/Calendar.js";
|
|
4
|
-
import { CalendarIcon as Y } from "
|
|
4
|
+
import { CalendarIcon as Y } from "@forgedevstack/bear-icons";
|
|
5
5
|
import { OverlayPortal as q } from "../OverlayPortal/OverlayPortal.js";
|
|
6
6
|
import { cn as R } from "../../utils/cn.js";
|
|
7
7
|
import { useClickOutsideMultiple as J } from "../../hooks/useClickOutside.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),O=require("../../utils/cn.cjs"),ae=require("../../hooks/useClickOutside.cjs");require("../../context/BearProvider.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");const n=require("../../constants/numbers.const.cjs"),c=require("../../constants/generals.const.cjs"),te=require("../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.cjs"),se=require("../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.cjs");require("../FormControl/FormControl.context.cjs");const ne=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),O=require("../../utils/cn.cjs"),ae=require("../../hooks/useClickOutside.cjs");require("../../context/BearProvider.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");const n=require("../../constants/numbers.const.cjs"),c=require("../../constants/generals.const.cjs"),te=require("../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.cjs"),se=require("../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.cjs");require("../FormControl/FormControl.context.cjs");const ne=require("@forgedevstack/bear-icons"),be=require("../OverlayPortal/OverlayPortal.cjs"),m=require("./DateRangePicker.const.cjs"),o=require("./DateRangePicker.utils.cjs"),q=({year:g,month:d,range:r,onDayClick:p,onNav:y,minDate:u,maxDate:N})=>{const E=o.getCalendarDays(g,d),h=new Date;return h.setHours(n.HOURS_MIDNIGHT,n.HOURS_MIDNIGHT,n.HOURS_MIDNIGHT,n.HOURS_MIDNIGHT),e.jsxs("div",{className:"bear-w-64",children:[e.jsxs("div",{className:"bear-flex bear-items-center bear-justify-between bear-mb-2",children:[e.jsx("button",{type:"button",onClick:()=>y(n.NEGATIVE_ONE),className:"bear-p-1 bear-rounded hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700 bear-text-gray-500 dark:bear-text-zinc-400","aria-label":"Previous month",children:e.jsx("svg",{className:"bear-w-4 bear-h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),e.jsxs("span",{className:"bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white",children:[m.MONTH_LABELS[d]," ",g]}),e.jsx("button",{type:"button",onClick:()=>y(n.ONE),className:"bear-p-1 bear-rounded hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700 bear-text-gray-500 dark:bear-text-zinc-400","aria-label":"Next month",children:e.jsx("svg",{className:"bear-w-4 bear-h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]}),e.jsx("div",{className:"bear-grid bear-grid-cols-7 bear-gap-0.5 bear-mb-1",children:m.DAY_LABELS.map(t=>e.jsx("div",{className:"bear-text-xs bear-text-center bear-font-medium bear-text-gray-400 dark:bear-text-zinc-500 bear-py-1",children:t},t))}),e.jsx("div",{className:"bear-grid bear-grid-cols-7 bear-gap-0.5",children:E.map((t,j)=>{if(!t)return e.jsx("div",{},`e-${j}`);const f=u&&t<u||N&&t>N,l=o.isSameDay(t,r.start)||o.isSameDay(t,r.end),x=o.isInRange(t,r.start,r.end),T=o.isSameDay(t,h);return e.jsx("button",{type:"button",disabled:!!f,onClick:()=>p(t),className:O.cn("bear-w-8 bear-h-8 bear-text-sm bear-rounded-full bear-transition-colors bear-cursor-pointer",f?"bear-text-gray-300 dark:bear-text-zinc-600 bear-cursor-not-allowed":"hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700",l&&"bear-bg-primary-500 bear-text-white",!l&&x&&"bear-bg-primary-100 dark:bear-bg-primary-900/30 bear-text-primary-800 dark:bear-text-primary-200",!l&&!x&&T&&"bear-ring-1 bear-ring-primary-400",!l&&!x&&!f&&"bear-text-gray-700 dark:bear-text-zinc-300"),children:t.getDate()},t.getTime())})})]})},oe=g=>{const{value:d,onChange:r,label:p,placeholder:y=c.PLACEHOLDER_SELECT_DATE_RANGE,disabled:u=c.BOOLEAN_FALSE,clearable:N=c.BOOLEAN_TRUE,minDate:E,maxDate:h,presets:t,showPresets:j=c.BOOLEAN_TRUE,size:f=c.SIZE_MD,error:l,helperText:x,className:T,testId:G,openEffect:le,closeEffect:ie,effect:ce,...B}=g,{openEffect:W,closeEffect:U}=se.resolveOverlayEffects(g),[R,w]=s.useState(!1),[b,k]=s.useState(d??{start:null,end:null}),[A,_]=s.useState(c.PICKING_START),P=s.useRef(null),I=s.useRef(null),L=s.useRef(null),{style:Y,ready:Z}=te.useFixedAnchorPosition({anchorRef:I,open:R,estimatedHeightPx:m.DATERANGE_DROPDOWN_HEIGHT_PX}),C=new Date,[D,F]=s.useState(C.getMonth()),[v,X]=s.useState(C.getFullYear()),M=o.resolveRightMonth(D),$=M.month,V=v+M.yearDelta;s.useEffect(()=>{d&&k(d)},[d]);const K=s.useCallback(()=>w(!1),[]);ae.useClickOutsideMultiple([P,L],K,{enabled:R});const z=s.useCallback(a=>{if(A==="start")k({start:a,end:null}),_("end");else{const i=a>=(b.start??a)?{start:b.start,end:a}:{start:a,end:b.start};k(i),_("start"),r==null||r(i)}},[A,b.start,r]),J=s.useCallback(a=>{k(a),r==null||r(a),w(!1),_("start")},[r]),Q=s.useCallback(()=>{const a={start:null,end:null};k(a),r==null||r(a),_("start")},[r]),ee=s.useCallback(a=>{let i=D+a,S=v;i<n.ZERO&&(i=n.LAST_MONTH_INDEX,S-=n.ONE),i>n.LAST_MONTH_INDEX&&(i=n.ZERO,S+=n.ONE),F(i),X(S)},[D,v]),H=t??(j?o.getDefaultPresets():[]),re=b.start?`${o.formatDate(b.start)}${b.end?` – ${o.formatDate(b.end)}`:""}`:y;return e.jsxs("div",{ref:P,className:O.cn("Bear-DateRangePicker bear-relative bear-inline-block",T),"data-testid":G,...B,children:[p&&e.jsx("label",{className:"Bear-DateRangePicker__label bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-zinc-300 bear-mb-1.5",children:p}),e.jsxs("button",{ref:I,type:"button",disabled:u,onClick:()=>!u&&w(!R),className:O.cn("bear-w-full bear-flex bear-items-center bear-justify-between bear-rounded-lg bear-border bear-border-gray-300 dark:bear-border-zinc-600 bear-bg-white dark:bear-bg-zinc-800 bear-text-gray-900 dark:bear-text-white bear-transition-colors focus:bear-ring-2 focus:bear-ring-primary-500 bear-outline-none",m.SIZE_CLASSES[f],u&&"bear-opacity-50 bear-cursor-not-allowed"),children:[e.jsx("span",{className:O.cn(!b.start&&"bear-text-gray-400 dark:bear-text-zinc-500"),children:re}),e.jsx(ne.CalendarIcon,{className:"bear-w-4 bear-h-4 bear-ml-2 bear-text-gray-400"})]}),e.jsx(be.OverlayPortal,{open:R,ready:Z,style:Y,zIndex:m.DATERANGE_DROPDOWN_Z_INDEX,openEffect:W,closeEffect:U,panelRef:L,className:"bear-max-w-[calc(100vw-16px)] bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-p-4 bear-overflow-x-auto",attributes:{[m.DATERANGE_DROPDOWN_ATTR]:c.EMPTY_STRING},children:e.jsxs("div",{className:"bear-flex bear-gap-4",children:[H.length>n.ZERO&&e.jsxs("div",{className:"bear-border-r bear-border-gray-200 dark:bear-border-zinc-700 bear-pr-3 bear-space-y-1",style:{minWidth:n.PRESET_SIDEBAR_MIN_WIDTH_PX},children:[H.map(a=>e.jsx("button",{type:"button",onClick:()=>J(a.range()),className:"bear-w-full bear-text-left bear-px-3 bear-py-1.5 bear-text-sm bear-rounded bear-transition-colors hover:bear-bg-primary-50 dark:hover:bear-bg-primary-900/20 bear-text-gray-700 dark:bear-text-zinc-300",children:a.label},a.label)),N&&b.start&&e.jsx("button",{type:"button",onClick:Q,className:"bear-w-full bear-text-left bear-px-3 bear-py-1.5 bear-text-sm bear-rounded bear-transition-colors hover:bear-bg-primary-50 dark:hover:bear-bg-primary-900/20 bear-text-red-500",children:c.LABEL_CLEAR})]}),e.jsx(q,{year:v,month:D,range:b,onDayClick:z,onNav:ee,minDate:E,maxDate:h}),e.jsx(q,{year:V,month:$,range:b,onDayClick:z,onNav:()=>{},minDate:E,maxDate:h})]})}),l&&e.jsx("p",{className:"bear-mt-1 bear-text-xs bear-text-red-500",children:l}),!l&&x&&e.jsx("p",{className:"bear-mt-1 bear-text-xs bear-text-gray-500 dark:bear-text-zinc-500",children:x})]})};exports.DateRangePicker=oe;
|
|
@@ -9,7 +9,7 @@ import { PLACEHOLDER_SELECT_DATE_RANGE as me, BOOLEAN_FALSE as fe, BOOLEAN_TRUE
|
|
|
9
9
|
import { useFixedAnchorPosition as xe } from "../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.js";
|
|
10
10
|
import { resolveOverlayEffects as ye } from "../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.js";
|
|
11
11
|
import "../FormControl/FormControl.context.js";
|
|
12
|
-
import { CalendarIcon as ke } from "
|
|
12
|
+
import { CalendarIcon as ke } from "@forgedevstack/bear-icons";
|
|
13
13
|
import { OverlayPortal as Ne } from "../OverlayPortal/OverlayPortal.js";
|
|
14
14
|
import { DATERANGE_DROPDOWN_HEIGHT_PX as Ee, SIZE_CLASSES as ve, DATERANGE_DROPDOWN_Z_INDEX as _e, DATERANGE_DROPDOWN_ATTR as De, MONTH_LABELS as Re, DAY_LABELS as we } from "./DateRangePicker.const.js";
|
|
15
15
|
import { getDefaultPresets as Ae, formatDate as Z, resolveRightMonth as Te, getCalendarDays as Le, isSameDay as z, isInRange as Oe } from "./DateRangePicker.utils.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),L=require("react-dom"),P=require("../../context/BearProvider.cjs"),j=require("../../utils/cn.cjs");require("react");const C=require("../../utils/generateBearId.utils.cjs"),F=require("../../utils/useBearId.cjs"),r=require("../../constants/generals.const.cjs"),M=require("../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.cjs"),U=require("../../hooks/useFixedAnchorPosition/useFixedAnchorPosition.utils.cjs"),g=require("../Backdrop/Backdrop.cjs"),t=require("../Box/Box.cjs"),s=require("./Drawer.const.cjs"),S=require("./helpers/DrawerOptionalHeader.cjs"),W=require("./hooks/useDrawer.cjs"),$=c=>{const{isOpen:E,onClose:o,title:a,children:D,side:O=s.DRAWER_DEFAULT_SIDE,anchor:p,variant:H="temporary",size:w=s.DRAWER_DEFAULT_SIZE,showCloseButton:i=r.BOOLEAN_TRUE,closeOnBackdrop:A=r.BOOLEAN_TRUE,closeOnEscape:q=r.BOOLEAN_TRUE,className:N,container:R,id:f,testId:m}=c,{openEffect:l,closeEffect:d}=U.resolveOverlayEffects(c,M.OVERLAY_OPEN_EFFECT_DEFAULT),x=F.useBearId(r.COMPONENT_NAME_DRAWER),u=C.resolveBearId(f,x),{direction:I}=P.useBearDirectionOptional(),_=p??O,{isMounted:v,isPanelOpen:n}=W.useDrawer({isOpen:E,onClose:o,closeOnEscape:q,openEffect:l,closeEffect:d}),T=n?l:d;if(!v)return null;const b=!!a||i,B=`${u}-title`,h=A?()=>o():void 0,k=a?B:void 0,y=e.jsxs(t.Box,{id:u,testId:m,className:"Bear-Drawer",children:[e.jsx(g.Backdrop,{open:n,keepMounted:!0,blur:!0,nested:!0,transitionDuration:s.DRAWER_ANIMATION_MS,className:"Bear-Drawer__backdrop",onClick:h}),e.jsxs(t.Box,{role:"dialog","aria-modal":r.BOOLEAN_TRUE,"aria-labelledby":k,className:j.cn("Bear-Drawer__panel",`Bear-Drawer__panel--${_}`,`Bear-Drawer__panel--${w}`,`Bear-Drawer__panel--effect-${T}`,n&&"Bear-Drawer__panel--open",N),children:[e.jsx(S.DrawerOptionalHeader,{showHeader:b,side:_,title:a,titleId:B,showCloseButton:i,onClose:o,direction:I}),e.jsx(t.Box,{className:"Bear-Drawer__body",children:D})]})]});return L.createPortal(y,R??document.body)};exports.Drawer=$;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../constants/numbers.const.cjs"),E=require("../../constants/generals.const.cjs"),D=_.THREE_HUNDRED,R=E.POSITION_RIGHT,e=E.SIZE_MD;exports.DRAWER_ANIMATION_MS=D;exports.DRAWER_DEFAULT_SIDE=R;exports.DRAWER_DEFAULT_SIZE=e;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import { DrawerProps } from './Drawer.types';
|
|
2
|
-
type DrawerSide = NonNullable<DrawerProps['side']>;
|
|
3
|
-
type DrawerSize = NonNullable<DrawerProps['size']>;
|
|
4
2
|
export declare const DRAWER_ANIMATION_MS = 300;
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const DRAWER_ROOT_CLASSES = "Bear-Drawer bear-fixed bear-inset-0";
|
|
8
|
-
export declare const SIZE_CLASSES: Record<DrawerSide, Record<DrawerSize, string>>;
|
|
9
|
-
export declare const POSITION_CLASSES: Record<DrawerSide, string>;
|
|
10
|
-
export declare const TRANSFORM_OPEN: Record<DrawerSide, string>;
|
|
11
|
-
export declare const TRANSFORM_CLOSED: Record<DrawerSide, string>;
|
|
12
|
-
export declare const BORDER_SIDE_MAP: Record<DrawerSide, string>;
|
|
13
|
-
export {};
|
|
3
|
+
export declare const DRAWER_DEFAULT_SIDE: NonNullable<DrawerProps['side']>;
|
|
4
|
+
export declare const DRAWER_DEFAULT_SIZE: NonNullable<DrawerProps['size']>;
|