@forgedevstack/bear 1.2.0 → 1.2.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/dist/components/AnimatedCounter/AnimatedCounter.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.d.ts +5 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.const.js +7 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.d.ts +3 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.js +59 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.types.d.ts +26 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.cjs +1 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.d.ts +6 -0
- package/dist/components/AnimatedCounter/AnimatedCounter.utils.js +13 -0
- package/dist/components/AnimatedCounter/index.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.const.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.d.ts +1 -0
- package/dist/components/Autocomplete/Autocomplete.const.js +4 -0
- package/dist/components/Autocomplete/Autocomplete.js +110 -72
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +74 -53
- package/dist/components/BottomSheet/BottomSheet.types.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +126 -46
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +11 -4
- package/dist/components/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/Cascader/Cascader.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.cjs +1 -1
- package/dist/components/Cascader/Cascader.const.d.ts +1 -1
- package/dist/components/Cascader/Cascader.const.js +1 -1
- package/dist/components/Cascader/Cascader.js +109 -146
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.cjs +1 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.d.ts +3 -0
- package/dist/components/Cascader/components/CascaderPanel/CascaderPanel.js +50 -0
- package/dist/components/Cascader/components/CascaderPanel/index.d.ts +1 -0
- package/dist/components/Chart/BarChart.cjs +1 -0
- package/dist/components/Chart/BarChart.d.ts +3 -0
- package/dist/components/Chart/BarChart.js +65 -0
- 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 +7 -0
- package/dist/components/Chart/Chart.const.js +12 -2
- package/dist/components/Chart/Chart.d.ts +1 -13
- package/dist/components/Chart/Chart.js +18 -204
- package/dist/components/Chart/Chart.types.d.ts +7 -1
- package/dist/components/Chart/LineChart.cjs +1 -0
- package/dist/components/Chart/LineChart.d.ts +3 -0
- package/dist/components/Chart/LineChart.js +73 -0
- package/dist/components/Chart/PieChart.cjs +1 -0
- package/dist/components/Chart/PieChart.d.ts +3 -0
- package/dist/components/Chart/PieChart.js +110 -0
- package/dist/components/Chart/index.d.ts +4 -1
- package/dist/components/ColorPicker/ColorPicker.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.cjs +1 -1
- package/dist/components/ColorPicker/ColorPicker.const.d.ts +4 -2
- package/dist/components/ColorPicker/ColorPicker.const.js +8 -6
- package/dist/components/ColorPicker/ColorPicker.js +135 -73
- package/dist/components/ColorPicker/ColorPicker.utils.cjs +1 -0
- package/dist/components/ColorPicker/ColorPicker.utils.d.ts +17 -0
- package/dist/components/ColorPicker/ColorPicker.utils.js +43 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +2 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.js +29 -17
- package/dist/components/CountdownTimer/CountdownTimer.js +91 -61
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +11 -2
- package/dist/components/CreditInput/CreditInput.cjs +1 -1
- package/dist/components/CreditInput/CreditInput.js +80 -78
- package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.d.ts +4 -0
- package/dist/components/CurrencyInput/CurrencyInput.const.js +19 -0
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +3 -0
- package/dist/components/CurrencyInput/CurrencyInput.js +60 -0
- package/dist/components/CurrencyInput/CurrencyInput.types.d.ts +22 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.cjs +1 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.d.ts +2 -0
- package/dist/components/CurrencyInput/CurrencyInput.utils.js +14 -0
- package/dist/components/CurrencyInput/index.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +89 -84
- package/dist/components/DiffSquares/DiffSquares.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.const.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.const.js +6 -0
- package/dist/components/DiffSquares/DiffSquares.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.js +70 -0
- package/dist/components/DiffSquares/DiffSquares.types.d.ts +23 -0
- package/dist/components/DiffSquares/DiffSquares.utils.cjs +1 -0
- package/dist/components/DiffSquares/DiffSquares.utils.d.ts +3 -0
- package/dist/components/DiffSquares/DiffSquares.utils.js +12 -0
- package/dist/components/DiffSquares/index.d.ts +2 -0
- package/dist/components/DiffViewer/DiffViewer.cjs +1 -1
- package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -1
- package/dist/components/DiffViewer/DiffViewer.const.d.ts +6 -0
- package/dist/components/DiffViewer/DiffViewer.const.js +17 -4
- package/dist/components/DiffViewer/DiffViewer.d.ts +0 -14
- package/dist/components/DiffViewer/DiffViewer.js +97 -105
- package/dist/components/DiffViewer/DiffViewer.types.d.ts +5 -0
- package/dist/components/DiffViewer/index.d.ts +1 -1
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +41 -41
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.const.cjs +1 -0
- package/dist/components/Dropdown/Dropdown.const.d.ts +7 -0
- package/dist/components/Dropdown/Dropdown.const.js +10 -0
- package/dist/components/Dropdown/Dropdown.d.ts +0 -1
- package/dist/components/Dropdown/Dropdown.js +102 -92
- package/dist/components/Dropdown/Dropdown.types.d.ts +2 -0
- package/dist/components/Gauge/Gauge.cjs +1 -1
- package/dist/components/Gauge/Gauge.js +61 -50
- package/dist/components/Gauge/Gauge.types.d.ts +2 -0
- package/dist/components/GlowCard/GlowCard.cjs +1 -0
- package/dist/components/GlowCard/GlowCard.const.cjs +1 -0
- package/dist/components/GlowCard/GlowCard.const.d.ts +11 -0
- package/dist/components/GlowCard/GlowCard.const.js +13 -0
- package/dist/components/GlowCard/GlowCard.d.ts +3 -0
- package/dist/components/GlowCard/GlowCard.js +185 -0
- package/dist/components/GlowCard/GlowCard.types.d.ts +21 -0
- package/dist/components/GlowCard/index.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.const.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.const.d.ts +8 -0
- package/dist/components/Heatmap/Heatmap.const.js +11 -0
- package/dist/components/Heatmap/Heatmap.d.ts +3 -0
- package/dist/components/Heatmap/Heatmap.js +103 -0
- package/dist/components/Heatmap/Heatmap.types.d.ts +34 -0
- package/dist/components/Heatmap/Heatmap.utils.cjs +1 -0
- package/dist/components/Heatmap/Heatmap.utils.d.ts +2 -0
- package/dist/components/Heatmap/Heatmap.utils.js +18 -0
- package/dist/components/Heatmap/index.d.ts +2 -0
- package/dist/components/HoverCard/HoverCard.cjs +6 -6
- package/dist/components/HoverCard/HoverCard.js +72 -54
- package/dist/components/Icon/icons/status.js +1 -1
- package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.cjs +1 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.d.ts +3 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.const.js +6 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.d.ts +3 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.js +113 -0
- package/dist/components/ImageAnnotation/ImageAnnotation.types.d.ts +28 -0
- package/dist/components/ImageAnnotation/index.d.ts +2 -0
- package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.d.ts +36 -0
- package/dist/components/MediaPlayer/MediaPlayer.const.js +11 -0
- package/dist/components/MediaPlayer/MediaPlayer.d.ts +3 -0
- package/dist/components/MediaPlayer/MediaPlayer.js +279 -0
- package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +69 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.cjs +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.d.ts +1 -0
- package/dist/components/MediaPlayer/MediaPlayer.utils.js +7 -0
- package/dist/components/MediaPlayer/index.d.ts +2 -0
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +106 -83
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +91 -80
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.const.cjs +1 -1
- package/dist/components/Modal/Modal.const.d.ts +1 -1
- package/dist/components/Modal/Modal.const.js +1 -1
- package/dist/components/Modal/Modal.js +50 -44
- package/dist/components/Modal/Modal.types.d.ts +6 -0
- package/dist/components/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +123 -78
- package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.const.js +1 -1
- package/dist/components/NavigableSelect/NavigableSelect.js +167 -143
- package/dist/components/NotificationCenter/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.cjs +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.d.ts +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.const.js +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.js +87 -81
- package/dist/components/OTPInput/OTPInput.cjs +1 -1
- package/dist/components/OTPInput/OTPInput.const.cjs +1 -0
- package/dist/components/OTPInput/OTPInput.const.d.ts +6 -0
- package/dist/components/OTPInput/OTPInput.const.js +14 -0
- package/dist/components/OTPInput/OTPInput.js +99 -65
- package/dist/components/OTPInput/OTPInput.types.d.ts +7 -0
- package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.cjs +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.d.ts +1 -1
- package/dist/components/PhoneInput/PhoneInput.const.js +1 -1
- package/dist/components/PhoneInput/PhoneInput.js +88 -83
- package/dist/components/Popconfirm/Popconfirm.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.cjs +1 -1
- package/dist/components/Popconfirm/Popconfirm.const.d.ts +1 -3
- package/dist/components/Popconfirm/Popconfirm.const.js +12 -18
- package/dist/components/Popconfirm/Popconfirm.js +71 -51
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.js +36 -31
- package/dist/components/Portal/Portal.cjs +1 -1
- package/dist/components/Portal/Portal.d.ts +0 -3
- package/dist/components/Portal/Portal.js +4 -10
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +71 -51
- package/dist/components/Stepper/Stepper.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.cjs +1 -1
- package/dist/components/Stepper/Stepper.const.d.ts +26 -4
- package/dist/components/Stepper/Stepper.const.js +39 -20
- package/dist/components/Stepper/Stepper.d.ts +3 -10
- package/dist/components/Stepper/Stepper.js +189 -130
- package/dist/components/Stepper/Stepper.types.d.ts +14 -0
- package/dist/components/Stepper/Stepper.utils.cjs +1 -0
- package/dist/components/Stepper/Stepper.utils.d.ts +12 -0
- package/dist/components/Stepper/Stepper.utils.js +19 -0
- package/dist/components/Stepper/components/StepperControls.cjs +1 -0
- package/dist/components/Stepper/components/StepperControls.d.ts +2 -0
- package/dist/components/Stepper/components/StepperControls.js +32 -0
- package/dist/components/Stepper/index.d.ts +2 -1
- package/dist/components/Tabs/TabList.cjs +1 -1
- package/dist/components/Tabs/TabList.js +72 -57
- package/dist/components/Tabs/Tabs.types.d.ts +4 -2
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/TagCloud/TagCloud.cjs +1 -0
- package/dist/components/TagCloud/TagCloud.const.cjs +1 -0
- package/dist/components/TagCloud/TagCloud.const.d.ts +5 -0
- package/dist/components/TagCloud/TagCloud.const.js +8 -0
- package/dist/components/TagCloud/TagCloud.d.ts +3 -0
- package/dist/components/TagCloud/TagCloud.js +76 -0
- package/dist/components/TagCloud/TagCloud.types.d.ts +26 -0
- package/dist/components/TagCloud/index.d.ts +2 -0
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js +26 -26
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +17 -17
- package/dist/components/TimelineChart/TimelineChart.cjs +1 -0
- package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -0
- package/dist/components/TimelineChart/TimelineChart.const.d.ts +6 -0
- package/dist/components/TimelineChart/TimelineChart.const.js +9 -0
- package/dist/components/TimelineChart/TimelineChart.d.ts +3 -0
- package/dist/components/TimelineChart/TimelineChart.js +65 -0
- package/dist/components/TimelineChart/TimelineChart.types.d.ts +31 -0
- package/dist/components/TimelineChart/index.d.ts +2 -0
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +86 -82
- package/dist/components/Toast/Toast.types.d.ts +2 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +52 -44
- package/dist/components/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.cjs +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.const.js +3 -3
- package/dist/components/TreeSelect/TreeSelect.js +120 -88
- package/dist/components/Watermark/Watermark.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.cjs +1 -1
- package/dist/components/Watermark/Watermark.const.d.ts +6 -3
- package/dist/components/Watermark/Watermark.const.js +13 -11
- package/dist/components/Watermark/Watermark.js +87 -61
- package/dist/components/Watermark/Watermark.types.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +22 -4
- package/dist/components/index.js +319 -296
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +55 -54
- package/dist/hooks/useClickOutside.cjs +1 -1
- package/dist/hooks/useClickOutside.d.ts +4 -11
- package/dist/hooks/useClickOutside.js +26 -7
- package/dist/index.cjs +1 -1
- package/dist/index.js +412 -388
- package/dist/styles/_effects.css +32 -0
- package/dist/styles.css +1 -1
- package/dist/utils/maxVisible.utils.cjs +1 -0
- package/dist/utils/maxVisible.utils.d.ts +12 -0
- package/dist/utils/maxVisible.utils.js +15 -0
- package/package.json +1 -1
- package/dist/components/HoverCard/HoverCard.utils.cjs +0 -1
- package/dist/components/HoverCard/HoverCard.utils.js +0 -23
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createPortal as
|
|
1
|
+
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h, useRef as P, useEffect as T, useCallback as _ } from "react";
|
|
3
|
+
import { createPortal as le } from "react-dom";
|
|
4
4
|
import { cn as p } from "../../utils/cn.js";
|
|
5
|
-
import { getDefaultPresets as
|
|
6
|
-
import { formatDate as
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */ t("button", { type: "button", onClick: () =>
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
|
|
5
|
+
import { getDefaultPresets as ie, LABEL_CLASSES as ce, SIZE_CLASSES as de, TRIGGER_CLASSES as be, PRESET_BTN_CLASSES as $, ERROR_CLASSES as me, HELPER_CLASSES as ue, ROOT_CLASSES as he, CALENDAR_HEADER_CLASSES as pe, NAV_BTN_CLASSES as G, MONTH_LABELS as Se, DAY_LABELS as fe, DAY_TODAY_CLASSES as we, DAY_IN_RANGE_CLASSES as Ee, DAY_SELECTED_CLASSES as ge, DAY_DISABLED_CLASSES as Le, DAY_HOVER_CLASSES as ve, DAY_BASE_CLASSES as Ae } from "./DateRangePicker.const.js";
|
|
6
|
+
import { formatDate as F, getCalendarDays as ke, isSameDay as Y, isInRange as xe } from "./DateRangePicker.utils.js";
|
|
7
|
+
const Z = ({ year: L, month: c, range: r, onDayClick: v, onNav: A, minDate: b, maxDate: k }) => {
|
|
8
|
+
const x = ke(L, c), S = /* @__PURE__ */ new Date();
|
|
9
|
+
return S.setHours(0, 0, 0, 0), /* @__PURE__ */ d("div", { className: "bear-w-64", children: [
|
|
10
|
+
/* @__PURE__ */ d("div", { className: pe, children: [
|
|
11
|
+
/* @__PURE__ */ t("button", { type: "button", onClick: () => A(-1), className: G, "aria-label": "Previous month", children: /* @__PURE__ */ t("svg", { className: "bear-w-4 bear-h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }) }),
|
|
12
|
+
/* @__PURE__ */ d("span", { className: "bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white", children: [
|
|
13
|
+
Se[c],
|
|
14
14
|
" ",
|
|
15
|
-
|
|
15
|
+
L
|
|
16
16
|
] }),
|
|
17
|
-
/* @__PURE__ */ t("button", { type: "button", onClick: () =>
|
|
17
|
+
/* @__PURE__ */ t("button", { type: "button", onClick: () => A(1), className: G, "aria-label": "Next month", children: /* @__PURE__ */ t("svg", { className: "bear-w-4 bear-h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) }) })
|
|
18
18
|
] }),
|
|
19
|
-
/* @__PURE__ */ t("div", { className: "bear-grid bear-grid-cols-7 bear-gap-0.5 bear-mb-1", children:
|
|
20
|
-
/* @__PURE__ */ t("div", { className: "bear-grid bear-grid-cols-7 bear-gap-0.5", children:
|
|
21
|
-
if (!a) return /* @__PURE__ */ t("div", {}, `e-${
|
|
22
|
-
const
|
|
19
|
+
/* @__PURE__ */ t("div", { className: "bear-grid bear-grid-cols-7 bear-gap-0.5 bear-mb-1", children: fe.map((a) => /* @__PURE__ */ t("div", { className: "bear-text-xs bear-text-center bear-font-medium bear-text-gray-400 dark:bear-text-zinc-500 bear-py-1", children: a }, a)) }),
|
|
20
|
+
/* @__PURE__ */ t("div", { className: "bear-grid bear-grid-cols-7 bear-gap-0.5", children: x.map((a, D) => {
|
|
21
|
+
if (!a) return /* @__PURE__ */ t("div", {}, `e-${D}`);
|
|
22
|
+
const f = b && a < b || k && a > k, l = Y(a, r.start) || Y(a, r.end), m = xe(a, r.start, r.end), R = Y(a, S);
|
|
23
23
|
return /* @__PURE__ */ t(
|
|
24
24
|
"button",
|
|
25
25
|
{
|
|
26
26
|
type: "button",
|
|
27
|
-
disabled: !!
|
|
28
|
-
onClick: () =>
|
|
27
|
+
disabled: !!f,
|
|
28
|
+
onClick: () => v(a),
|
|
29
29
|
className: p(
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
Ae,
|
|
31
|
+
f ? Le : ve,
|
|
32
32
|
l && ge,
|
|
33
|
-
!l &&
|
|
34
|
-
!l && !
|
|
35
|
-
!l && !
|
|
33
|
+
!l && m && Ee,
|
|
34
|
+
!l && !m && R && we,
|
|
35
|
+
!l && !m && !f && "bear-text-gray-700 dark:bear-text-zinc-300"
|
|
36
36
|
),
|
|
37
37
|
children: a.getDate()
|
|
38
38
|
},
|
|
@@ -40,102 +40,107 @@ const F = ({ year: E, month: c, range: r, onDayClick: L, onNav: k, minDate: d, m
|
|
|
40
40
|
);
|
|
41
41
|
}) })
|
|
42
42
|
] });
|
|
43
|
-
},
|
|
43
|
+
}, Pe = (L) => {
|
|
44
44
|
const {
|
|
45
45
|
value: c,
|
|
46
46
|
onChange: r,
|
|
47
|
-
label:
|
|
48
|
-
placeholder:
|
|
49
|
-
disabled:
|
|
50
|
-
clearable:
|
|
51
|
-
minDate:
|
|
52
|
-
maxDate:
|
|
47
|
+
label: v,
|
|
48
|
+
placeholder: A = "Select date range",
|
|
49
|
+
disabled: b = !1,
|
|
50
|
+
clearable: k = !0,
|
|
51
|
+
minDate: x,
|
|
52
|
+
maxDate: S,
|
|
53
53
|
presets: a,
|
|
54
|
-
showPresets:
|
|
55
|
-
size:
|
|
54
|
+
showPresets: D = !0,
|
|
55
|
+
size: f = "md",
|
|
56
56
|
error: l,
|
|
57
|
-
helperText:
|
|
58
|
-
className:
|
|
59
|
-
testId:
|
|
60
|
-
...
|
|
61
|
-
} =
|
|
57
|
+
helperText: m,
|
|
58
|
+
className: R,
|
|
59
|
+
testId: q,
|
|
60
|
+
...J
|
|
61
|
+
} = L, [N, y] = h(!1), [z, K] = h({ top: 0, left: 0 }), [s, w] = h(c ?? { start: null, end: null }), [H, C] = h("start"), O = P(null), M = P(null), I = P(null), W = /* @__PURE__ */ new Date(), [u, Q] = h(W.getMonth()), [E, U] = h(W.getFullYear()), X = u === 11 ? 0 : u + 1, ee = u === 11 ? E + 1 : E;
|
|
62
62
|
T(() => {
|
|
63
|
-
c &&
|
|
63
|
+
c && w(c);
|
|
64
64
|
}, [c]), T(() => {
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
if (!N || !M.current) return;
|
|
66
|
+
const e = 8, n = 420, o = () => {
|
|
67
|
+
const i = M.current.getBoundingClientRect(), g = window.innerHeight;
|
|
68
|
+
let B = g - i.bottom < n && i.top > n ? i.top - n - e : i.bottom + e;
|
|
69
|
+
B = Math.max(8, Math.min(B, g - n - 8));
|
|
70
|
+
const se = Math.min(640, window.innerWidth - 16);
|
|
71
|
+
let oe = Math.max(8, Math.min(i.left, window.innerWidth - se - 8));
|
|
72
|
+
K({ top: B, left: oe });
|
|
73
|
+
};
|
|
74
|
+
return o(), window.addEventListener("resize", o), window.addEventListener("scroll", o, !0), () => {
|
|
75
|
+
window.removeEventListener("resize", o), window.removeEventListener("scroll", o, !0);
|
|
76
|
+
};
|
|
77
|
+
}, [N]), T(() => {
|
|
73
78
|
const e = (n) => {
|
|
74
|
-
var
|
|
79
|
+
var i, g;
|
|
75
80
|
const o = n.target;
|
|
76
|
-
(
|
|
81
|
+
(i = O.current) != null && i.contains(o) || (g = I.current) != null && g.contains(o) || y(!1);
|
|
77
82
|
};
|
|
78
83
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
79
84
|
}, []);
|
|
80
|
-
const j =
|
|
81
|
-
if (
|
|
82
|
-
|
|
85
|
+
const j = _((e) => {
|
|
86
|
+
if (H === "start")
|
|
87
|
+
w({ start: e, end: null }), C("end");
|
|
83
88
|
else {
|
|
84
89
|
const n = e >= (s.start ?? e) ? { start: s.start, end: e } : { start: e, end: s.start };
|
|
85
|
-
|
|
90
|
+
w(n), C("start"), r == null || r(n);
|
|
86
91
|
}
|
|
87
|
-
}, [
|
|
88
|
-
|
|
89
|
-
}, [r]),
|
|
92
|
+
}, [H, s.start, r]), te = _((e) => {
|
|
93
|
+
w(e), r == null || r(e), y(!1), C("start");
|
|
94
|
+
}, [r]), re = _(() => {
|
|
90
95
|
const e = { start: null, end: null };
|
|
91
|
-
|
|
92
|
-
}, [r]),
|
|
93
|
-
let n =
|
|
94
|
-
n < 0 && (n = 11, o--), n > 11 && (n = 0, o++),
|
|
95
|
-
}, [
|
|
96
|
-
return /* @__PURE__ */
|
|
97
|
-
|
|
98
|
-
/* @__PURE__ */
|
|
96
|
+
w(e), r == null || r(e), C("start");
|
|
97
|
+
}, [r]), ae = _((e) => {
|
|
98
|
+
let n = u + e, o = E;
|
|
99
|
+
n < 0 && (n = 11, o--), n > 11 && (n = 0, o++), Q(n), U(o);
|
|
100
|
+
}, [u, E]), V = a ?? (D ? ie() : []), ne = s.start ? `${F(s.start)}${s.end ? ` – ${F(s.end)}` : ""}` : A;
|
|
101
|
+
return /* @__PURE__ */ d("div", { ref: O, className: p(he, R), "data-testid": q, ...J, children: [
|
|
102
|
+
v && /* @__PURE__ */ t("label", { className: ce, children: v }),
|
|
103
|
+
/* @__PURE__ */ d(
|
|
99
104
|
"button",
|
|
100
105
|
{
|
|
101
|
-
ref:
|
|
106
|
+
ref: M,
|
|
102
107
|
type: "button",
|
|
103
|
-
disabled:
|
|
104
|
-
onClick: () => !
|
|
105
|
-
className: p(
|
|
108
|
+
disabled: b,
|
|
109
|
+
onClick: () => !b && y(!N),
|
|
110
|
+
className: p(be, de[f], b && "bear-opacity-50 bear-cursor-not-allowed"),
|
|
106
111
|
children: [
|
|
107
|
-
/* @__PURE__ */ t("span", { className: p(!s.start && "bear-text-gray-400 dark:bear-text-zinc-500"), children:
|
|
112
|
+
/* @__PURE__ */ t("span", { className: p(!s.start && "bear-text-gray-400 dark:bear-text-zinc-500"), children: ne }),
|
|
108
113
|
/* @__PURE__ */ t("svg", { className: "bear-w-4 bear-h-4 bear-ml-2 bear-text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) })
|
|
109
114
|
]
|
|
110
115
|
}
|
|
111
116
|
),
|
|
112
|
-
|
|
117
|
+
N && typeof document < "u" && le(
|
|
113
118
|
/* @__PURE__ */ t(
|
|
114
119
|
"div",
|
|
115
120
|
{
|
|
116
|
-
ref:
|
|
121
|
+
ref: I,
|
|
117
122
|
"data-bear-daterangepicker-dropdown": !0,
|
|
118
123
|
className: p(
|
|
119
|
-
"bear-fixed bear-z-[
|
|
124
|
+
"bear-fixed bear-z-[10000] 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"
|
|
120
125
|
),
|
|
121
|
-
style: { top:
|
|
122
|
-
children: /* @__PURE__ */
|
|
123
|
-
V.length > 0 && /* @__PURE__ */
|
|
124
|
-
V.map((e) => /* @__PURE__ */ t("button", { type: "button", onClick: () =>
|
|
125
|
-
|
|
126
|
+
style: { top: z.top, left: z.left },
|
|
127
|
+
children: /* @__PURE__ */ d("div", { className: "bear-flex bear-gap-4", children: [
|
|
128
|
+
V.length > 0 && /* @__PURE__ */ d("div", { className: "bear-border-r bear-border-gray-200 dark:bear-border-zinc-700 bear-pr-3 bear-space-y-1 bear-min-w-[120px]", children: [
|
|
129
|
+
V.map((e) => /* @__PURE__ */ t("button", { type: "button", onClick: () => te(e.range()), className: $, children: e.label }, e.label)),
|
|
130
|
+
k && s.start && /* @__PURE__ */ t("button", { type: "button", onClick: re, className: p($, "bear-text-red-500"), children: "Clear" })
|
|
126
131
|
] }),
|
|
127
|
-
/* @__PURE__ */ t(
|
|
128
|
-
/* @__PURE__ */ t(
|
|
129
|
-
}, minDate:
|
|
132
|
+
/* @__PURE__ */ t(Z, { year: E, month: u, range: s, onDayClick: j, onNav: ae, minDate: x, maxDate: S }),
|
|
133
|
+
/* @__PURE__ */ t(Z, { year: ee, month: X, range: s, onDayClick: j, onNav: () => {
|
|
134
|
+
}, minDate: x, maxDate: S })
|
|
130
135
|
] })
|
|
131
136
|
}
|
|
132
137
|
),
|
|
133
138
|
document.body
|
|
134
139
|
),
|
|
135
|
-
l && /* @__PURE__ */ t("p", { className:
|
|
136
|
-
!l &&
|
|
140
|
+
l && /* @__PURE__ */ t("p", { className: me, children: l }),
|
|
141
|
+
!l && m && /* @__PURE__ */ t("p", { className: ue, children: m })
|
|
137
142
|
] });
|
|
138
143
|
};
|
|
139
144
|
export {
|
|
140
|
-
|
|
145
|
+
Pe as DateRangePicker
|
|
141
146
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),A=require("react"),D=require("../../utils/cn.cjs"),F=require("../Typography/Typography.cjs"),S=require("./DiffSquares.const.cjs"),E=require("./DiffSquares.utils.cjs"),N=({additionsText:n,deletionsText:t,cubeCount:c=S.DIFF_SQUARES_DEFAULT_COUNT,cubes:r,additionColor:m="var(--bear-colors-success-500, #22c55e)",deletionColor:q="var(--bear-colors-danger-500, #ef4444)",gap:_=S.DIFF_SQUARES_GAP,summaryTypographyProps:s,onCubeClick:i,onCubeHover:e,className:h,testId:j,...x})=>{const d=A.useMemo(()=>r!=null&&r.length?r:Array.from({length:c},()=>({fill:"full"})),[r,c]),g={variant:"body2",component:"span",...s,className:D.cn("bear-flex bear-shrink-0 bear-items-baseline bear-gap-1.5 bear-font-mono bear-font-semibold",s==null?void 0:s.className)};return l.jsxs("div",{className:D.cn("Bear-DiffSquares bear-inline-flex bear-min-w-0 bear-max-w-full bear-items-center bear-gap-2",h),"data-testid":j,...x,children:[(n!=null||t!=null)&&l.jsxs(F.Typography,{...g,children:[n!=null&&l.jsx("span",{style:{color:m},children:n}),t!=null&&l.jsx("span",{style:{color:q},children:t})]}),l.jsx("span",{className:"bear-inline-flex bear-items-center bear-flex-shrink-0",style:{gap:_},role:"img","aria-label":"Change density",children:d.map((a,f)=>l.jsx("span",{className:S.DIFF_SQUARES_CUBE_CLASS,style:E.getDiffCubeStyle(a,m,q),"aria-hidden":!(a!=null&&a.ariaLabel),title:a==null?void 0:a.ariaLabel,onMouseEnter:()=>e==null?void 0:e(a,f),onMouseLeave:()=>e==null?void 0:e(null,null),onClick:()=>i==null?void 0:i(a,f)},f))})]})};exports.DiffSquares=N;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=5,r="Bear-DiffSquares__cube bear-inline-block bear-w-2.5 bear-h-2.5 sm:bear-w-3 sm:bear-h-3 bear-rounded bear-shrink-0 bear-ring-1 bear-ring-inset bear-ring-black/18 dark:bear-ring-white/22 motion-reduce:bear-animate-none",a=4;exports.DIFF_SQUARES_CUBE_CLASS=r;exports.DIFF_SQUARES_DEFAULT_COUNT=e;exports.DIFF_SQUARES_GAP=a;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const DIFF_SQUARES_DEFAULT_COUNT = 5;
|
|
2
|
+
export declare const DIFF_SQUARES_CUBE_CLASS = "Bear-DiffSquares__cube bear-inline-block bear-w-2.5 bear-h-2.5 sm:bear-w-3 sm:bear-h-3 bear-rounded bear-shrink-0 bear-ring-1 bear-ring-inset bear-ring-black/18 dark:bear-ring-white/22 motion-reduce:bear-animate-none";
|
|
3
|
+
export declare const DIFF_SQUARES_GAP = 4;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const e = 5, r = "Bear-DiffSquares__cube bear-inline-block bear-w-2.5 bear-h-2.5 sm:bear-w-3 sm:bear-h-3 bear-rounded bear-shrink-0 bear-ring-1 bear-ring-inset bear-ring-black/18 dark:bear-ring-white/22 motion-reduce:bear-animate-none", a = 4;
|
|
2
|
+
export {
|
|
3
|
+
r as DIFF_SQUARES_CUBE_CLASS,
|
|
4
|
+
e as DIFF_SQUARES_DEFAULT_COUNT,
|
|
5
|
+
a as DIFF_SQUARES_GAP
|
|
6
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsxs as h, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as L } from "react";
|
|
3
|
+
import { cn as A } from "../../utils/cn.js";
|
|
4
|
+
import { Typography as g } from "../Typography/Typography.js";
|
|
5
|
+
import { DIFF_SQUARES_DEFAULT_COUNT as p, DIFF_SQUARES_GAP as x, DIFF_SQUARES_CUBE_CLASS as I } from "./DiffSquares.const.js";
|
|
6
|
+
import { getDiffCubeStyle as M } from "./DiffSquares.utils.js";
|
|
7
|
+
const B = ({
|
|
8
|
+
additionsText: s,
|
|
9
|
+
deletionsText: t,
|
|
10
|
+
cubeCount: m = p,
|
|
11
|
+
cubes: r,
|
|
12
|
+
additionColor: S = "var(--bear-colors-success-500, #22c55e)",
|
|
13
|
+
deletionColor: _ = "var(--bear-colors-danger-500, #ef4444)",
|
|
14
|
+
gap: D = x,
|
|
15
|
+
summaryTypographyProps: n,
|
|
16
|
+
onCubeClick: i,
|
|
17
|
+
onCubeHover: l,
|
|
18
|
+
className: F,
|
|
19
|
+
testId: E,
|
|
20
|
+
...N
|
|
21
|
+
}) => {
|
|
22
|
+
const U = L(() => r != null && r.length ? r : Array.from({ length: m }, () => ({ fill: "full" })), [r, m]), d = {
|
|
23
|
+
variant: "body2",
|
|
24
|
+
component: "span",
|
|
25
|
+
...n,
|
|
26
|
+
className: A(
|
|
27
|
+
"bear-flex bear-shrink-0 bear-items-baseline bear-gap-1.5 bear-font-mono bear-font-semibold",
|
|
28
|
+
n == null ? void 0 : n.className
|
|
29
|
+
)
|
|
30
|
+
};
|
|
31
|
+
return /* @__PURE__ */ h(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
className: A("Bear-DiffSquares bear-inline-flex bear-min-w-0 bear-max-w-full bear-items-center bear-gap-2", F),
|
|
35
|
+
"data-testid": E,
|
|
36
|
+
...N,
|
|
37
|
+
children: [
|
|
38
|
+
(s != null || t != null) && /* @__PURE__ */ h(g, { ...d, children: [
|
|
39
|
+
s != null && /* @__PURE__ */ e("span", { style: { color: S }, children: s }),
|
|
40
|
+
t != null && /* @__PURE__ */ e("span", { style: { color: _ }, children: t })
|
|
41
|
+
] }),
|
|
42
|
+
/* @__PURE__ */ e(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
className: "bear-inline-flex bear-items-center bear-flex-shrink-0",
|
|
46
|
+
style: { gap: D },
|
|
47
|
+
role: "img",
|
|
48
|
+
"aria-label": "Change density",
|
|
49
|
+
children: U.map((a, f) => /* @__PURE__ */ e(
|
|
50
|
+
"span",
|
|
51
|
+
{
|
|
52
|
+
className: I,
|
|
53
|
+
style: M(a, S, _),
|
|
54
|
+
"aria-hidden": !(a != null && a.ariaLabel),
|
|
55
|
+
title: a == null ? void 0 : a.ariaLabel,
|
|
56
|
+
onMouseEnter: () => l == null ? void 0 : l(a, f),
|
|
57
|
+
onMouseLeave: () => l == null ? void 0 : l(null, null),
|
|
58
|
+
onClick: () => i == null ? void 0 : i(a, f)
|
|
59
|
+
},
|
|
60
|
+
f
|
|
61
|
+
))
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
B as DiffSquares
|
|
70
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { TypographyProps } from '../Typography/Typography.types';
|
|
3
|
+
export type DiffCubeFill = 'full' | 'empty' | 'half' | 'striped';
|
|
4
|
+
export interface DiffCube {
|
|
5
|
+
fill?: DiffCubeFill;
|
|
6
|
+
color?: string;
|
|
7
|
+
secondaryColor?: string;
|
|
8
|
+
gradient?: string;
|
|
9
|
+
ariaLabel?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DiffSquaresProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
12
|
+
additionsText?: ReactNode;
|
|
13
|
+
deletionsText?: ReactNode;
|
|
14
|
+
cubeCount?: number;
|
|
15
|
+
cubes?: DiffCube[];
|
|
16
|
+
additionColor?: string;
|
|
17
|
+
deletionColor?: string;
|
|
18
|
+
gap?: number;
|
|
19
|
+
summaryTypographyProps?: Partial<TypographyProps>;
|
|
20
|
+
onCubeClick?: (cube: DiffCube, index: number) => void;
|
|
21
|
+
onCubeHover?: (cube: DiffCube | null, index: number | null) => void;
|
|
22
|
+
testId?: string;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(r,i,a){const t=(r==null?void 0:r.fill)??"full",n=(r==null?void 0:r.color)??i,o=(r==null?void 0:r.secondaryColor)??a;return r!=null&&r.gradient?{background:r.gradient}:t==="empty"?{backgroundColor:"transparent",boxShadow:`inset 0 0 0 1px ${n}55`}:t==="half"?{background:`linear-gradient(90deg, ${n} 50%, ${o} 50%)`}:t==="striped"?{background:`repeating-linear-gradient(135deg, ${n}, ${n} 2px, ${o} 2px, ${o} 4px)`}:{backgroundColor:n}}exports.getDiffCubeStyle=l;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function d(r, a, i) {
|
|
2
|
+
const o = (r == null ? void 0 : r.fill) ?? "full", n = (r == null ? void 0 : r.color) ?? a, t = (r == null ? void 0 : r.secondaryColor) ?? i;
|
|
3
|
+
return r != null && r.gradient ? { background: r.gradient } : o === "empty" ? {
|
|
4
|
+
backgroundColor: "transparent",
|
|
5
|
+
boxShadow: `inset 0 0 0 1px ${n}55`
|
|
6
|
+
} : o === "half" ? { background: `linear-gradient(90deg, ${n} 50%, ${t} 50%)` } : o === "striped" ? {
|
|
7
|
+
background: `repeating-linear-gradient(135deg, ${n}, ${n} 2px, ${t} 2px, ${t} 4px)`
|
|
8
|
+
} : { backgroundColor: n };
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
d as getDiffCubeStyle
|
|
12
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),o=require("../../utils/cn.cjs"),R=require("../../context/BearProvider.cjs"),d=require("../Typography/Typography.cjs"),a=require("./DiffViewer.const.cjs"),N=require("./DiffViewer.utils.cjs"),P=({oldValue:m,newValue:p,viewMode:j="split",showLineNumbers:L=!0,oldTitle:T=a.DEFAULT_OLD_TITLE,newTitle:k=a.DEFAULT_NEW_TITLE,showStats:E=!0,spacing:D=a.DEFAULT_SPACING,showLineHoverInfo:c=!1,className:_,testId:h})=>{const{mode:w}=R.useBear(),S=w==="dark",[C,b]=n.useState(null),t=n.useMemo(()=>N.computeDiff(m,p),[m,p]),l=n.useMemo(()=>N.computeStats(t),[t]),f=a.LINE_SPACING[D],q=n.useCallback(r=>{c&&b(r)},[c]),A=n.useCallback(()=>{b(null)},[]),x=r=>L?e.jsx("span",{className:o.cn("select-none text-gray-400 dark:text-gray-600 text-right pr-3",f),style:{minWidth:a.LINE_NUMBER_WIDTH},children:r??""}):null,u=(r,s,i)=>{const g=a.DIFF_COLORS[s],F=s==="add"?"+":s==="remove"?"-":" ",O=i!=null&&C===i;return e.jsxs("div",{className:o.cn("flex font-mono text-sm relative group",f),style:{backgroundColor:g.bg,borderLeft:`3px solid ${g.border}`},onMouseEnter:()=>i!=null&&q(i),onMouseLeave:A,children:[e.jsx("span",{className:"px-2 select-none font-bold",style:{color:g.text},children:F}),e.jsx("span",{className:"flex-1 whitespace-pre",children:r}),c&&O&&s!=="context"&&e.jsx("span",{className:o.cn("absolute right-2 top-1/2 -translate-y-1/2 text-xs px-2 py-0.5 rounded",s==="add"?"bg-green-500/20 text-green-600 dark:text-green-400":"bg-red-500/20 text-red-600 dark:text-red-400"),children:a.LINE_HOVER_LABELS[s]})]})},v=()=>E?e.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs(d.Typography,{variant:"caption",className:"text-green-600",children:["+",l.additions," additions"]}),e.jsxs(d.Typography,{variant:"caption",className:"text-red-600",children:["-",l.deletions," deletions"]}),e.jsxs(d.Typography,{variant:"caption",className:"text-gray-500",children:[l.unchanged," unchanged"]})]}):null,y=o.cn("Bear-DiffViewer","rounded-lg overflow-hidden border",S?"bg-gray-900 border-gray-700":"bg-white border-gray-200",_);if(j==="unified")return e.jsxs("div",{className:y,"data-testid":h,children:[v(),e.jsx("div",{className:"overflow-x-auto",children:t.map((r,s)=>e.jsxs("div",{className:"flex",children:[x(r.oldLineNumber||r.newLineNumber),e.jsx("div",{className:"flex-1",children:u(r.content,r.type,s)})]},s))})]});const B=t.filter(r=>r.type!=="add"),M=t.filter(r=>r.type!=="remove");return e.jsxs("div",{className:y,"data-testid":h,children:[v(),e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-gray-200 dark:divide-gray-700",children:[e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:e.jsx(d.Typography,{variant:"caption",className:"font-semibold",children:T})}),e.jsx("div",{className:"overflow-x-auto",children:B.map((r,s)=>e.jsxs("div",{className:"flex",children:[x(r.oldLineNumber),e.jsx("div",{className:"flex-1",children:u(r.content,r.type==="remove"?"remove":"context",s)})]},s))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:e.jsx(d.Typography,{variant:"caption",className:"font-semibold",children:k})}),e.jsx("div",{className:"overflow-x-auto",children:M.map((r,s)=>e.jsxs("div",{className:"flex",children:[x(r.newLineNumber),e.jsx("div",{className:"flex-1",children:u(r.content,r.type==="add"?"add":"context",s)})]},s))})]})]})]})};exports.DiffViewer=P;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={add:{bg:"rgba(34, 197, 94, 0.15)",border:"rgba(34, 197, 94, 0.4)",text:"#22c55e"},remove:{bg:"rgba(239, 68, 68, 0.15)",border:"rgba(239, 68, 68, 0.4)",text:"#ef4444"},context:{bg:"transparent",border:"transparent",text:"inherit"}},t=50;exports.DIFF_COLORS=e;exports.LINE_NUMBER_WIDTH=t;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={add:{bg:"rgba(34, 197, 94, 0.15)",border:"rgba(34, 197, 94, 0.4)",text:"#22c55e"},remove:{bg:"rgba(239, 68, 68, 0.15)",border:"rgba(239, 68, 68, 0.4)",text:"#ef4444"},context:{bg:"transparent",border:"transparent",text:"inherit"}},t=50,o={compact:"py-0",comfortable:"py-1",spacious:"py-2"},r={add:"Added",remove:"Removed",context:"Unchanged"},E="Original",L="Modified",_="comfortable";exports.DEFAULT_NEW_TITLE=L;exports.DEFAULT_OLD_TITLE=E;exports.DEFAULT_SPACING=_;exports.DIFF_COLORS=e;exports.LINE_HOVER_LABELS=r;exports.LINE_NUMBER_WIDTH=t;exports.LINE_SPACING=o;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DiffSpacing } from './DiffViewer.types';
|
|
1
2
|
export declare const DIFF_COLORS: {
|
|
2
3
|
readonly add: {
|
|
3
4
|
readonly bg: "rgba(34, 197, 94, 0.15)";
|
|
@@ -16,3 +17,8 @@ export declare const DIFF_COLORS: {
|
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
export declare const LINE_NUMBER_WIDTH = 50;
|
|
20
|
+
export declare const LINE_SPACING: Record<DiffSpacing, string>;
|
|
21
|
+
export declare const LINE_HOVER_LABELS: Record<string, string>;
|
|
22
|
+
export declare const DEFAULT_OLD_TITLE = "Original";
|
|
23
|
+
export declare const DEFAULT_NEW_TITLE = "Modified";
|
|
24
|
+
export declare const DEFAULT_SPACING: DiffSpacing;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t = {
|
|
2
2
|
add: {
|
|
3
3
|
bg: "rgba(34, 197, 94, 0.15)",
|
|
4
4
|
border: "rgba(34, 197, 94, 0.4)",
|
|
@@ -14,8 +14,21 @@ const r = {
|
|
|
14
14
|
border: "transparent",
|
|
15
15
|
text: "inherit"
|
|
16
16
|
}
|
|
17
|
-
},
|
|
17
|
+
}, e = 50, o = {
|
|
18
|
+
compact: "py-0",
|
|
19
|
+
comfortable: "py-1",
|
|
20
|
+
spacious: "py-2"
|
|
21
|
+
}, r = {
|
|
22
|
+
add: "Added",
|
|
23
|
+
remove: "Removed",
|
|
24
|
+
context: "Unchanged"
|
|
25
|
+
}, n = "Original", a = "Modified", c = "comfortable";
|
|
18
26
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
a as DEFAULT_NEW_TITLE,
|
|
28
|
+
n as DEFAULT_OLD_TITLE,
|
|
29
|
+
c as DEFAULT_SPACING,
|
|
30
|
+
t as DIFF_COLORS,
|
|
31
|
+
r as LINE_HOVER_LABELS,
|
|
32
|
+
e as LINE_NUMBER_WIDTH,
|
|
33
|
+
o as LINE_SPACING
|
|
21
34
|
};
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { DiffViewerProps } from './DiffViewer.types';
|
|
3
|
-
/**
|
|
4
|
-
* DiffViewer - Compare and visualize text/code differences
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* <DiffViewer
|
|
9
|
-
* oldValue="const x = 1;"
|
|
10
|
-
* newValue="const x = 2;"
|
|
11
|
-
* viewMode="split"
|
|
12
|
-
* showLineNumbers
|
|
13
|
-
* showStats
|
|
14
|
-
* />
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
3
|
export declare const DiffViewer: FC<DiffViewerProps>;
|
|
18
4
|
export default DiffViewer;
|