@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,139 +1,157 @@
|
|
|
1
|
-
import { jsxs as l, jsx as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as _, useRef as S, useMemo as j, useEffect as W, useCallback as m } from "react";
|
|
3
3
|
import { cn as s } from "../../utils/cn.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { Portal as xe } from "../Portal/Portal.js";
|
|
5
|
+
import { DEFAULT_PLACEHOLDER as ye, DEFAULT_MAX_VISIBLE as he, DEFAULT_EMPTY_TEXT as ve, SCROLL_BLOCK as ke, TAG_SIZE_CLASSES as we, ICON_SIZE as Ne, TRIGGER_SIZE_CLASSES as _e, DROPDOWN_Z_INDEX as Se, OPTION_SIZE_CLASSES as Ee, OPTION_HEIGHT as Be } from "./NavigableSelect.const.js";
|
|
6
|
+
const Te = ($) => {
|
|
6
7
|
const {
|
|
7
|
-
options:
|
|
8
|
-
value:
|
|
9
|
-
defaultValue:
|
|
8
|
+
options: E,
|
|
9
|
+
value: H,
|
|
10
|
+
defaultValue: J,
|
|
10
11
|
onChange: o,
|
|
11
|
-
multiple:
|
|
12
|
-
searchable:
|
|
13
|
-
placeholder:
|
|
14
|
-
label:
|
|
15
|
-
helperText:
|
|
16
|
-
error:
|
|
17
|
-
disabled:
|
|
18
|
-
size:
|
|
19
|
-
fullWidth:
|
|
20
|
-
maxVisible:
|
|
21
|
-
maxSelections:
|
|
22
|
-
emptyText:
|
|
23
|
-
className:
|
|
24
|
-
style:
|
|
25
|
-
testId:
|
|
26
|
-
} =
|
|
27
|
-
if (!
|
|
28
|
-
const e =
|
|
29
|
-
return
|
|
12
|
+
multiple: b = !1,
|
|
13
|
+
searchable: Q = !0,
|
|
14
|
+
placeholder: ee = ye,
|
|
15
|
+
label: z,
|
|
16
|
+
helperText: F,
|
|
17
|
+
error: B,
|
|
18
|
+
disabled: x = !1,
|
|
19
|
+
size: y = "md",
|
|
20
|
+
fullWidth: re = !1,
|
|
21
|
+
maxVisible: ae = he,
|
|
22
|
+
maxSelections: L,
|
|
23
|
+
emptyText: te = ve,
|
|
24
|
+
className: le,
|
|
25
|
+
style: ne,
|
|
26
|
+
testId: be
|
|
27
|
+
} = $, h = H !== void 0, U = (e) => e === void 0 ? [] : Array.isArray(e) ? e : [e], [se, Z] = _(U(J)), [i, C] = _(!1), [g, c] = _(-1), [f, I] = _(""), G = S(null), K = S(null), D = S(null), X = S(null), A = S(null), [T, ie] = _({ top: 0, left: 0, width: 0 }), n = h ? U(H) : se, v = j(() => {
|
|
28
|
+
if (!f) return E;
|
|
29
|
+
const e = f.toLowerCase();
|
|
30
|
+
return E.filter(
|
|
30
31
|
(r) => {
|
|
31
|
-
var
|
|
32
|
-
return r.label.toLowerCase().includes(e) || ((
|
|
32
|
+
var a;
|
|
33
|
+
return r.label.toLowerCase().includes(e) || ((a = r.description) == null ? void 0 : a.toLowerCase().includes(e));
|
|
33
34
|
}
|
|
34
35
|
);
|
|
35
|
-
}, [
|
|
36
|
+
}, [E, f]), oe = j(() => {
|
|
36
37
|
const e = /* @__PURE__ */ new Map();
|
|
37
|
-
return
|
|
38
|
-
const
|
|
39
|
-
e.has(
|
|
38
|
+
return v.forEach((r) => {
|
|
39
|
+
const a = r.group || "";
|
|
40
|
+
e.has(a) || e.set(a, []), e.get(a).push(r);
|
|
40
41
|
}), e;
|
|
41
|
-
}, [
|
|
42
|
-
|
|
42
|
+
}, [v]), k = j(() => v.filter((e) => !e.disabled), [v]);
|
|
43
|
+
W(() => {
|
|
44
|
+
if (!i) return;
|
|
45
|
+
const e = () => {
|
|
46
|
+
var a;
|
|
47
|
+
const r = (a = A.current) == null ? void 0 : a.getBoundingClientRect();
|
|
48
|
+
r && ie({
|
|
49
|
+
top: r.bottom + 4,
|
|
50
|
+
left: Math.max(8, Math.min(r.left, window.innerWidth - r.width - 8)),
|
|
51
|
+
width: r.width
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
55
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
56
|
+
};
|
|
57
|
+
}, [i]), W(() => {
|
|
58
|
+
if (!i) return;
|
|
43
59
|
const e = (r) => {
|
|
44
|
-
|
|
60
|
+
var d, N;
|
|
61
|
+
const a = r.target;
|
|
62
|
+
(d = G.current) != null && d.contains(a) || (N = K.current) != null && N.contains(a) || (C(!1), I(""));
|
|
45
63
|
};
|
|
46
64
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
47
|
-
}, []),
|
|
48
|
-
if (!D.current ||
|
|
65
|
+
}, [i]), W(() => {
|
|
66
|
+
if (!D.current || g < 0) return;
|
|
49
67
|
const e = D.current.querySelector('[data-active="true"]');
|
|
50
|
-
e == null || e.scrollIntoView({ block:
|
|
51
|
-
}, [
|
|
52
|
-
const
|
|
53
|
-
|
|
68
|
+
e == null || e.scrollIntoView({ block: ke });
|
|
69
|
+
}, [g]);
|
|
70
|
+
const O = m(() => {
|
|
71
|
+
x || (C(!0), c(0), setTimeout(() => {
|
|
54
72
|
var e;
|
|
55
|
-
return (e =
|
|
73
|
+
return (e = X.current) == null ? void 0 : e.focus();
|
|
56
74
|
}, 0));
|
|
57
|
-
}, [
|
|
75
|
+
}, [x]), w = m(() => {
|
|
58
76
|
var e;
|
|
59
|
-
|
|
60
|
-
}, []),
|
|
77
|
+
C(!1), I(""), c(-1), (e = A.current) == null || e.focus();
|
|
78
|
+
}, []), M = m(
|
|
61
79
|
(e) => {
|
|
62
80
|
let r;
|
|
63
|
-
if (
|
|
64
|
-
if (
|
|
65
|
-
r =
|
|
81
|
+
if (b)
|
|
82
|
+
if (n.includes(e))
|
|
83
|
+
r = n.filter((a) => a !== e);
|
|
66
84
|
else {
|
|
67
|
-
if (
|
|
68
|
-
r = [...
|
|
85
|
+
if (L && n.length >= L) return;
|
|
86
|
+
r = [...n, e];
|
|
69
87
|
}
|
|
70
88
|
else
|
|
71
|
-
r = [e],
|
|
72
|
-
|
|
89
|
+
r = [e], w();
|
|
90
|
+
h || Z(r), o == null || o(b ? r : r[0] ?? "");
|
|
73
91
|
},
|
|
74
|
-
[
|
|
75
|
-
),
|
|
92
|
+
[n, b, h, L, o, w]
|
|
93
|
+
), R = m(
|
|
76
94
|
(e) => {
|
|
77
|
-
const r =
|
|
78
|
-
|
|
95
|
+
const r = n.filter((a) => a !== e);
|
|
96
|
+
h || Z(r), o == null || o(b ? r : r[0] ?? "");
|
|
79
97
|
},
|
|
80
|
-
[
|
|
81
|
-
),
|
|
98
|
+
[n, b, h, o]
|
|
99
|
+
), q = m(
|
|
82
100
|
(e) => {
|
|
83
|
-
if (!
|
|
84
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
101
|
+
if (!i) {
|
|
102
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), O());
|
|
85
103
|
return;
|
|
86
104
|
}
|
|
87
105
|
switch (e.key) {
|
|
88
106
|
case "ArrowDown":
|
|
89
|
-
e.preventDefault(),
|
|
107
|
+
e.preventDefault(), c((r) => Math.min(r + 1, k.length - 1));
|
|
90
108
|
break;
|
|
91
109
|
case "ArrowUp":
|
|
92
|
-
e.preventDefault(),
|
|
110
|
+
e.preventDefault(), c((r) => Math.max(r - 1, 0));
|
|
93
111
|
break;
|
|
94
112
|
case "Enter":
|
|
95
113
|
case " ":
|
|
96
|
-
e.preventDefault(),
|
|
114
|
+
e.preventDefault(), g >= 0 && k[g] && M(k[g].value);
|
|
97
115
|
break;
|
|
98
116
|
case "Escape":
|
|
99
|
-
e.preventDefault(),
|
|
117
|
+
e.preventDefault(), w();
|
|
100
118
|
break;
|
|
101
119
|
case "Backspace":
|
|
102
|
-
|
|
120
|
+
f === "" && b && n.length > 0 && R(n[n.length - 1]);
|
|
103
121
|
break;
|
|
104
122
|
case "Home":
|
|
105
|
-
e.preventDefault(),
|
|
123
|
+
e.preventDefault(), c(0);
|
|
106
124
|
break;
|
|
107
125
|
case "End":
|
|
108
|
-
e.preventDefault(),
|
|
126
|
+
e.preventDefault(), c(k.length - 1);
|
|
109
127
|
break;
|
|
110
128
|
}
|
|
111
129
|
},
|
|
112
|
-
[g,
|
|
113
|
-
),
|
|
114
|
-
let
|
|
130
|
+
[i, g, k, M, w, O, f, b, n, R]
|
|
131
|
+
), ce = m((e) => n.includes(e), [n]), u = n.map((e) => E.find((r) => r.value === e)).filter(Boolean), de = !!B, ge = _e[y], ue = Ee[y], fe = we[y], Y = Ne[y], pe = ae * Be[y];
|
|
132
|
+
let P = -1;
|
|
115
133
|
return /* @__PURE__ */ l(
|
|
116
134
|
"div",
|
|
117
135
|
{
|
|
118
|
-
ref:
|
|
136
|
+
ref: G,
|
|
119
137
|
className: s(
|
|
120
138
|
"Bear-NavigableSelect",
|
|
121
139
|
"bear-relative bear-flex bear-flex-col bear-gap-1.5",
|
|
122
|
-
|
|
123
|
-
|
|
140
|
+
re && "bear-w-full",
|
|
141
|
+
le
|
|
124
142
|
),
|
|
125
|
-
style:
|
|
126
|
-
"data-testid":
|
|
143
|
+
style: ne,
|
|
144
|
+
"data-testid": be,
|
|
127
145
|
children: [
|
|
128
|
-
|
|
146
|
+
z && /* @__PURE__ */ t("label", { className: "Bear-NavigableSelect__label bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-300", children: z }),
|
|
129
147
|
/* @__PURE__ */ l(
|
|
130
148
|
"button",
|
|
131
149
|
{
|
|
132
|
-
ref:
|
|
150
|
+
ref: A,
|
|
133
151
|
type: "button",
|
|
134
|
-
disabled:
|
|
135
|
-
onClick: () =>
|
|
136
|
-
onKeyDown:
|
|
152
|
+
disabled: x,
|
|
153
|
+
onClick: () => i ? w() : O(),
|
|
154
|
+
onKeyDown: q,
|
|
137
155
|
className: s(
|
|
138
156
|
"Bear-NavigableSelect__trigger",
|
|
139
157
|
"bear-flex bear-items-center bear-justify-between bear-w-full",
|
|
@@ -141,15 +159,15 @@ const Le = (q) => {
|
|
|
141
159
|
"bear-transition-all bear-duration-200",
|
|
142
160
|
"bear-bg-white dark:bear-bg-gray-900",
|
|
143
161
|
"bear-text-gray-900 dark:bear-text-white",
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
162
|
+
de ? "bear-border-red-500 focus:bear-ring-2 focus:bear-ring-red-500/20" : "bear-border-gray-300 dark:bear-border-gray-600 focus:bear-border-[var(--bear-primary-500)] focus:bear-ring-2 focus:bear-ring-[var(--bear-primary-500)]/20",
|
|
163
|
+
x && "bear-opacity-50 bear-cursor-not-allowed",
|
|
164
|
+
ge
|
|
147
165
|
),
|
|
148
166
|
"aria-haspopup": "listbox",
|
|
149
|
-
"aria-expanded":
|
|
167
|
+
"aria-expanded": i,
|
|
150
168
|
children: [
|
|
151
169
|
/* @__PURE__ */ l("span", { className: "Bear-NavigableSelect__value bear-flex bear-items-center bear-gap-1.5 bear-flex-wrap bear-flex-1 bear-min-w-0 bear-overflow-hidden", children: [
|
|
152
|
-
|
|
170
|
+
b && u.length > 0 && u.map((e) => /* @__PURE__ */ l(
|
|
153
171
|
"span",
|
|
154
172
|
{
|
|
155
173
|
className: s(
|
|
@@ -157,16 +175,16 @@ const Le = (q) => {
|
|
|
157
175
|
"bear-inline-flex bear-items-center bear-gap-1 bear-rounded-md",
|
|
158
176
|
"bear-bg-[var(--bear-primary-100,#fce7f3)] dark:bear-bg-[var(--bear-primary-900,#831843)]/30",
|
|
159
177
|
"bear-text-[var(--bear-primary-700,#be185d)] dark:bear-text-[var(--bear-primary-300,#f9a8d4)]",
|
|
160
|
-
|
|
178
|
+
fe
|
|
161
179
|
),
|
|
162
180
|
children: [
|
|
163
181
|
e.label,
|
|
164
|
-
!
|
|
182
|
+
!x && /* @__PURE__ */ t(
|
|
165
183
|
"button",
|
|
166
184
|
{
|
|
167
185
|
type: "button",
|
|
168
186
|
onClick: (r) => {
|
|
169
|
-
r.stopPropagation(),
|
|
187
|
+
r.stopPropagation(), R(e.value);
|
|
170
188
|
},
|
|
171
189
|
className: "bear-ml-0.5 hover:bear-opacity-70",
|
|
172
190
|
"aria-label": `Remove ${e.label}`,
|
|
@@ -177,43 +195,49 @@ const Le = (q) => {
|
|
|
177
195
|
},
|
|
178
196
|
e.value
|
|
179
197
|
)),
|
|
180
|
-
!
|
|
181
|
-
|
|
182
|
-
|
|
198
|
+
!b && u.length > 0 && /* @__PURE__ */ l("span", { className: "bear-truncate", children: [
|
|
199
|
+
u[0].icon && /* @__PURE__ */ t("span", { className: "bear-mr-1.5", children: u[0].icon }),
|
|
200
|
+
u[0].label
|
|
183
201
|
] }),
|
|
184
|
-
|
|
202
|
+
u.length === 0 && /* @__PURE__ */ t("span", { className: "bear-text-gray-400 dark:bear-text-gray-500", children: ee })
|
|
185
203
|
] }),
|
|
186
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ t(
|
|
187
205
|
"svg",
|
|
188
206
|
{
|
|
189
207
|
className: s(
|
|
190
|
-
|
|
208
|
+
Y,
|
|
191
209
|
"bear-text-gray-400 dark:bear-text-gray-500 bear-transition-transform bear-shrink-0 bear-ml-2",
|
|
192
|
-
|
|
210
|
+
i && "bear-rotate-180"
|
|
193
211
|
),
|
|
194
212
|
fill: "none",
|
|
195
213
|
viewBox: "0 0 24 24",
|
|
196
214
|
stroke: "currentColor",
|
|
197
215
|
strokeWidth: 2,
|
|
198
|
-
children: /* @__PURE__ */
|
|
216
|
+
children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
199
217
|
}
|
|
200
218
|
)
|
|
201
219
|
]
|
|
202
220
|
}
|
|
203
221
|
),
|
|
204
|
-
|
|
222
|
+
i && /* @__PURE__ */ t(xe, { children: /* @__PURE__ */ l(
|
|
205
223
|
"div",
|
|
206
224
|
{
|
|
225
|
+
ref: K,
|
|
207
226
|
className: s(
|
|
208
227
|
"Bear-NavigableSelect__dropdown",
|
|
209
|
-
"bear-
|
|
228
|
+
"bear-fixed",
|
|
210
229
|
"bear-bg-white dark:bear-bg-gray-900",
|
|
211
230
|
"bear-border bear-border-gray-200 dark:bear-border-gray-700",
|
|
212
231
|
"bear-rounded-lg bear-shadow-lg bear-overflow-hidden"
|
|
213
232
|
),
|
|
214
|
-
style: {
|
|
233
|
+
style: {
|
|
234
|
+
zIndex: Se,
|
|
235
|
+
top: T.top,
|
|
236
|
+
left: T.left,
|
|
237
|
+
width: T.width
|
|
238
|
+
},
|
|
215
239
|
children: [
|
|
216
|
-
|
|
240
|
+
Q && /* @__PURE__ */ l("div", { className: "Bear-NavigableSelect__search bear-flex bear-items-center bear-gap-2 bear-px-3 bear-py-2 bear-border-b bear-border-gray-200 dark:bear-border-gray-700", children: [
|
|
217
241
|
/* @__PURE__ */ l(
|
|
218
242
|
"svg",
|
|
219
243
|
{
|
|
@@ -223,21 +247,21 @@ const Le = (q) => {
|
|
|
223
247
|
stroke: "currentColor",
|
|
224
248
|
strokeWidth: 2,
|
|
225
249
|
children: [
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ t("circle", { cx: "11", cy: "11", r: "8" }),
|
|
251
|
+
/* @__PURE__ */ t("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
228
252
|
]
|
|
229
253
|
}
|
|
230
254
|
),
|
|
231
|
-
/* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ t(
|
|
232
256
|
"input",
|
|
233
257
|
{
|
|
234
|
-
ref:
|
|
258
|
+
ref: X,
|
|
235
259
|
type: "text",
|
|
236
|
-
value:
|
|
260
|
+
value: f,
|
|
237
261
|
onChange: (e) => {
|
|
238
|
-
|
|
262
|
+
I(e.target.value), c(0);
|
|
239
263
|
},
|
|
240
|
-
onKeyDown:
|
|
264
|
+
onKeyDown: q,
|
|
241
265
|
placeholder: "Type to search...",
|
|
242
266
|
className: s(
|
|
243
267
|
"Bear-NavigableSelect__input",
|
|
@@ -255,43 +279,43 @@ const Le = (q) => {
|
|
|
255
279
|
{
|
|
256
280
|
ref: D,
|
|
257
281
|
className: "Bear-NavigableSelect__list bear-overflow-y-auto bear-py-1",
|
|
258
|
-
style: { maxHeight:
|
|
282
|
+
style: { maxHeight: pe },
|
|
259
283
|
role: "listbox",
|
|
260
|
-
"aria-multiselectable":
|
|
284
|
+
"aria-multiselectable": b,
|
|
261
285
|
children: [
|
|
262
|
-
|
|
263
|
-
Array.from(
|
|
264
|
-
e && /* @__PURE__ */
|
|
265
|
-
r.map((
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
const
|
|
286
|
+
v.length === 0 && /* @__PURE__ */ t("div", { className: "Bear-NavigableSelect__empty bear-px-3 bear-py-4 bear-text-center bear-text-sm bear-text-gray-500 dark:bear-text-gray-400", children: te }),
|
|
287
|
+
Array.from(oe.entries()).map(([e, r]) => /* @__PURE__ */ l("div", { className: "Bear-NavigableSelect__group", children: [
|
|
288
|
+
e && /* @__PURE__ */ t("div", { className: "Bear-NavigableSelect__group-title bear-px-3 bear-py-1 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-gray-400 dark:bear-text-gray-500", children: e }),
|
|
289
|
+
r.map((a) => {
|
|
290
|
+
const d = a.disabled, N = !d;
|
|
291
|
+
N && P++;
|
|
292
|
+
const V = P === g, p = ce(a.value), me = P;
|
|
269
293
|
return /* @__PURE__ */ l(
|
|
270
294
|
"button",
|
|
271
295
|
{
|
|
272
296
|
type: "button",
|
|
273
|
-
disabled:
|
|
297
|
+
disabled: d,
|
|
274
298
|
className: s(
|
|
275
299
|
"Bear-NavigableSelect__option",
|
|
276
300
|
"bear-w-full bear-flex bear-items-center bear-gap-2.5 bear-text-left bear-cursor-pointer",
|
|
277
301
|
"bear-transition-colors bear-duration-100",
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
p && !
|
|
281
|
-
|
|
302
|
+
ue,
|
|
303
|
+
V && "bear-bg-gray-100 dark:bear-bg-gray-800",
|
|
304
|
+
p && !V && "bear-bg-[var(--bear-primary-50,#fdf2f8)] dark:bear-bg-[var(--bear-primary-950,#500724)]/20",
|
|
305
|
+
d && "bear-opacity-40 bear-cursor-not-allowed"
|
|
282
306
|
),
|
|
283
|
-
"data-active":
|
|
307
|
+
"data-active": V,
|
|
284
308
|
onMouseEnter: () => {
|
|
285
|
-
|
|
309
|
+
N && c(me);
|
|
286
310
|
},
|
|
287
311
|
onClick: () => {
|
|
288
|
-
|
|
312
|
+
d || M(a.value);
|
|
289
313
|
},
|
|
290
314
|
role: "option",
|
|
291
315
|
"aria-selected": p,
|
|
292
|
-
"aria-disabled":
|
|
316
|
+
"aria-disabled": d,
|
|
293
317
|
children: [
|
|
294
|
-
|
|
318
|
+
b && /* @__PURE__ */ t(
|
|
295
319
|
"span",
|
|
296
320
|
{
|
|
297
321
|
className: s(
|
|
@@ -300,31 +324,31 @@ const Le = (q) => {
|
|
|
300
324
|
"bear-transition-colors",
|
|
301
325
|
p ? "bear-bg-[var(--bear-primary-500)] bear-border-[var(--bear-primary-500)] bear-text-white" : "bear-border-gray-300 dark:bear-border-gray-600"
|
|
302
326
|
),
|
|
303
|
-
children: p && /* @__PURE__ */
|
|
327
|
+
children: p && /* @__PURE__ */ t("svg", { className: "bear-w-3 bear-h-3", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 3, children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" }) })
|
|
304
328
|
}
|
|
305
329
|
),
|
|
306
|
-
|
|
330
|
+
a.icon && /* @__PURE__ */ t("span", { className: "Bear-NavigableSelect__option-icon bear-shrink-0 bear-text-gray-500 dark:bear-text-gray-400", children: a.icon }),
|
|
307
331
|
/* @__PURE__ */ l("div", { className: "Bear-NavigableSelect__option-body bear-flex-1 bear-min-w-0", children: [
|
|
308
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ t("div", { className: s(
|
|
309
333
|
"Bear-NavigableSelect__option-label bear-truncate",
|
|
310
334
|
p ? "bear-text-[var(--bear-primary-700,#be185d)] dark:bear-text-[var(--bear-primary-300,#f9a8d4)] bear-font-medium" : "bear-text-gray-900 dark:bear-text-white"
|
|
311
|
-
), children:
|
|
312
|
-
|
|
335
|
+
), children: a.label }),
|
|
336
|
+
a.description && /* @__PURE__ */ t("div", { className: "Bear-NavigableSelect__option-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate", children: a.description })
|
|
313
337
|
] }),
|
|
314
|
-
!
|
|
338
|
+
!b && p && /* @__PURE__ */ t(
|
|
315
339
|
"svg",
|
|
316
340
|
{
|
|
317
|
-
className: s(
|
|
341
|
+
className: s(Y, "bear-text-[var(--bear-primary-500)] bear-shrink-0"),
|
|
318
342
|
fill: "none",
|
|
319
343
|
viewBox: "0 0 24 24",
|
|
320
344
|
stroke: "currentColor",
|
|
321
345
|
strokeWidth: 2,
|
|
322
|
-
children: /* @__PURE__ */
|
|
346
|
+
children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" })
|
|
323
347
|
}
|
|
324
348
|
)
|
|
325
349
|
]
|
|
326
350
|
},
|
|
327
|
-
|
|
351
|
+
a.value
|
|
328
352
|
);
|
|
329
353
|
})
|
|
330
354
|
] }, e))
|
|
@@ -333,29 +357,29 @@ const Le = (q) => {
|
|
|
333
357
|
),
|
|
334
358
|
/* @__PURE__ */ l("div", { className: "Bear-NavigableSelect__footer bear-flex bear-items-center bear-gap-3 bear-px-3 bear-py-1.5 bear-border-t bear-border-gray-200 dark:bear-border-gray-700 bear-text-[11px] bear-text-gray-400 dark:bear-text-gray-500", children: [
|
|
335
359
|
/* @__PURE__ */ l("span", { className: "bear-flex bear-items-center bear-gap-1", children: [
|
|
336
|
-
/* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ t("kbd", { className: "bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700", children: "↑↓" }),
|
|
337
361
|
"navigate"
|
|
338
362
|
] }),
|
|
339
363
|
/* @__PURE__ */ l("span", { className: "bear-flex bear-items-center bear-gap-1", children: [
|
|
340
|
-
/* @__PURE__ */
|
|
364
|
+
/* @__PURE__ */ t("kbd", { className: "bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700", children: "↵" }),
|
|
341
365
|
"select"
|
|
342
366
|
] }),
|
|
343
367
|
/* @__PURE__ */ l("span", { className: "bear-flex bear-items-center bear-gap-1", children: [
|
|
344
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ t("kbd", { className: "bear-px-1 bear-rounded bear-bg-gray-100 dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700", children: "esc" }),
|
|
345
369
|
"close"
|
|
346
370
|
] })
|
|
347
371
|
] })
|
|
348
372
|
]
|
|
349
373
|
}
|
|
350
|
-
),
|
|
351
|
-
(
|
|
374
|
+
) }),
|
|
375
|
+
(F || B) && /* @__PURE__ */ t("p", { className: s(
|
|
352
376
|
"Bear-NavigableSelect__helper bear-text-xs",
|
|
353
|
-
|
|
354
|
-
), children:
|
|
377
|
+
B ? "bear-text-red-500" : "bear-text-gray-500 dark:bear-text-gray-400"
|
|
378
|
+
), children: B || F })
|
|
355
379
|
]
|
|
356
380
|
}
|
|
357
381
|
);
|
|
358
382
|
};
|
|
359
383
|
export {
|
|
360
|
-
|
|
384
|
+
Te as NavigableSelect
|
|
361
385
|
};
|
|
@@ -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"),t=require("react"),F=require("react-dom"),d=require("../../utils/cn.cjs"),u=require("./NotificationCenter.const.cjs"),D=require("./NotificationCenter.utils.cjs"),H=({notification:r,onRead:x,onDismiss:m,onClick:c,translations:k})=>{const g=()=>{r.read||x==null||x(r.id),c==null||c(r)};return e.jsxs("div",{onClick:g,className:d.cn("Bear-NotificationCenter__item bear-flex bear-gap-3 bear-p-3 bear-border-b bear-border-gray-200 dark:bear-border-zinc-700 last:bear-border-b-0 bear-cursor-pointer bear-transition-colors hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700/50",!r.read&&"bear-bg-gray-50 dark:bear-bg-zinc-800/50"),children:[e.jsx("div",{className:"Bear-NotificationCenter__item-icon bear-shrink-0",children:r.avatar?e.jsx("img",{src:r.avatar,alt:"",className:"bear-w-10 bear-h-10 bear-rounded-full bear-object-cover"}):r.icon?e.jsx("div",{className:d.cn("bear-w-10 bear-h-10 bear-rounded-full bear-flex bear-items-center bear-justify-center",u.NOTIFICATION_TYPE_COLORS[r.type]),children:r.icon}):e.jsxs("div",{className:d.cn("bear-w-10 bear-h-10 bear-rounded-full bear-flex bear-items-center bear-justify-center",u.NOTIFICATION_TYPE_COLORS[r.type]),children:[r.type==="success"&&e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),r.type==="error"&&e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),r.type==="warning"&&e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),r.type==="info"&&e.jsx("svg",{className:"bear-w-5 bear-h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})]})}),e.jsxs("div",{className:"Bear-NotificationCenter__item-content bear-flex-1 bear-min-w-0",children:[e.jsxs("div",{className:"bear-flex bear-items-start bear-justify-between bear-gap-2",children:[e.jsx("p",{className:d.cn("Bear-NotificationCenter__item-title bear-text-sm bear-font-medium bear-truncate",r.read?"bear-text-gray-600 dark:bear-text-zinc-300":"bear-text-gray-900 dark:bear-text-white"),children:r.title}),!r.read&&e.jsx("span",{className:"Bear-NotificationCenter__item-badge bear-w-2 bear-h-2 bear-rounded-full bear-bg-pink-500 bear-shrink-0 bear-mt-1.5"})]}),r.description&&e.jsx("p",{className:"Bear-NotificationCenter__item-description bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 bear-mt-0.5 bear-line-clamp-2",children:r.description}),e.jsx("p",{className:"Bear-NotificationCenter__item-time bear-text-xs bear-text-gray-400 dark:bear-text-zinc-500 bear-mt-1",children:D.formatRelativeTime(r.timestamp,k)}),r.actions&&r.actions.length>0&&e.jsx("div",{className:"Bear-NotificationCenter__item-actions bear-flex bear-gap-2 bear-mt-2",children:r.actions.map((a,C)=>e.jsx("button",{type:"button",onClick:p=>{p.stopPropagation(),a.onClick()},className:d.cn("bear-px-2 bear-py-1 bear-text-xs bear-rounded bear-transition-colors",a.variant==="primary"&&"bear-bg-pink-500 bear-text-white hover:bear-bg-pink-600",a.variant==="secondary"&&"bear-bg-gray-200 dark:bear-bg-zinc-600 bear-text-gray-900 dark:bear-text-white hover:bear-bg-gray-300 dark:hover:bear-bg-zinc-500",a.variant==="danger"&&"bear-bg-red-500 bear-text-white hover:bear-bg-red-600",!a.variant&&"bear-bg-gray-100 dark:bear-bg-zinc-700 bear-text-gray-700 dark:bear-text-zinc-300 hover:bear-bg-gray-200 dark:hover:bear-bg-zinc-600"),children:a.label},C))})]}),m&&e.jsx("button",{type:"button",onClick:a=>{a.stopPropagation(),m(r.id)},className:"Bear-NotificationCenter__item-dismiss bear-p-1 bear-rounded bear-text-gray-500 dark:bear-text-zinc-500 hover:bear-text-gray-700 dark:hover:bear-text-zinc-300 hover:bear-bg-gray-200 dark:hover:bear-bg-zinc-700 bear-transition-colors bear-shrink-0",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:"M6 18L18 6M6 6l12 12"})})})]})},X=({notifications:r,onNotificationClick:x,onMarkAsRead:m,onMarkAllAsRead:c,onDismiss:k,onClearAll:g,maxVisible:a=u.NOTIFICATION_CENTER_MAX_VISIBLE,groupByCategory:C=!1,position:p="top-right",trigger:_,open:T,onOpenChange:E,className:M,testId:A,translations:z,icon:R})=>{const[S,P]=t.useState(!1),[B,W]=t.useState({top:0,left:0}),[f,q]=t.useState(!1),L=t.useRef(null),y=t.useRef(null),h=T??S,v=E??P,o=t.useMemo(()=>({...u.NOTIFICATION_CENTER_DEFAULT_TRANSLATIONS,...z}),[z]),l=t.useMemo(()=>r.filter(n=>!n.read).length,[r]),I=t.useMemo(()=>f?r:r.slice(0,a),[r,a,f]);t.useEffect(()=>{if(!h||!y.current)return;const n=360,N=400,b=8,s=()=>{const i=y.current.getBoundingClientRect();let j=p.includes("left")?i.left:i.right-n;j=Math.max(8,Math.min(j,window.innerWidth-n-8));let w=i.bottom+b;w+N>window.innerHeight-8&&(w=Math.max(8,i.top-N-b)),W({top:w,left:j})};return s(),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[h,p]),t.useEffect(()=>{const n=N=>{var s,i;const b=N.target;(s=L.current)!=null&&s.contains(b)||(i=b.closest)!=null&&i.call(b,"[data-bear-notification-center]")||v(!1)};return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[v]);const O=t.useCallback(()=>{v(!h)},[h,v]);return e.jsxs("div",{ref:L,className:d.cn("Bear-NotificationCenter bear-relative bear-inline-block",M),"data-testid":A,children:[_?e.jsx("div",{onClick:O,children:_}):e.jsxs("button",{ref:y,type:"button",onClick:O,className:"Bear-NotificationCenter__trigger bear-relative bear-p-2 bear-rounded-lg bear-text-gray-500 dark:bear-text-zinc-400 hover:bear-text-gray-900 dark:hover:bear-text-white hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-800 bear-transition-colors",children:[R??e.jsx("svg",{className:"bear-w-6 bear-h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"})}),l>0&&e.jsx("span",{className:"Bear-NotificationCenter__badge bear-absolute bear-top-0 bear-right-0 bear-w-5 bear-h-5 bear-flex bear-items-center bear-justify-center bear-text-xs bear-font-medium bear-text-white bear-bg-pink-500 bear-rounded-full",children:l>99?"99+":l})]}),h&&typeof document<"u"&&F.createPortal(e.jsxs("div",{"data-bear-notification-center":!0,className:"Bear-NotificationCenter__dropdown bear-fixed bear-w-[360px] bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-lg bear-shadow-xl bear-overflow-hidden",style:{top:B.top,left:B.left,zIndex:u.NOTIFICATION_CENTER_Z_INDEX},children:[e.jsxs("div",{className:"Bear-NotificationCenter__header bear-flex bear-items-center bear-justify-between bear-px-4 bear-py-3 bear-border-b bear-border-gray-200 dark:bear-border-zinc-700",children:[e.jsxs("h3",{className:"Bear-NotificationCenter__title bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white",children:[o.title,l>0&&e.jsxs("span",{className:"bear-ml-2 bear-text-xs bear-font-normal bear-text-gray-500 dark:bear-text-zinc-400",children:["(",l," ",o.new.toLowerCase(),")"]})]}),e.jsxs("div",{className:"bear-flex bear-gap-2",children:[c&&l>0&&e.jsx("button",{type:"button",onClick:c,className:"Bear-NotificationCenter__mark-all bear-text-xs bear-text-pink-400 hover:bear-text-pink-300 bear-transition-colors",children:o.markAllRead}),g&&r.length>0&&e.jsx("button",{type:"button",onClick:g,className:"Bear-NotificationCenter__clear-all bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 hover:bear-text-gray-700 dark:hover:bear-text-zinc-300 bear-transition-colors",children:o.clearAll})]})]}),e.jsx("div",{className:"Bear-NotificationCenter__list bear-max-h-[400px] bear-overflow-y-auto",children:I.length===0?e.jsx("div",{className:"Bear-NotificationCenter__empty bear-py-8 bear-text-center bear-text-sm bear-text-gray-500 dark:bear-text-zinc-500",children:o.noNotifications}):I.map(n=>e.jsx(H,{notification:n,onRead:m,onDismiss:k,onClick:x,translations:o},n.id))}),!f&&r.length>a&&e.jsx("div",{className:"Bear-NotificationCenter__footer bear-border-t bear-border-gray-200 dark:bear-border-zinc-700",children:e.jsxs("button",{type:"button",onClick:()=>q(!0),className:"bear-w-full bear-py-2 bear-text-sm bear-text-pink-500 dark:bear-text-pink-400 hover:bear-bg-gray-100 dark:hover:bear-bg-zinc-700/50 bear-transition-colors",children:[o.showMore," (",r.length-a," more)"]})})]}),document.body)]})};exports.NotificationCenter=X;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={title:"Notifications",noNotifications:"No notifications",markAllRead:"Mark all as read",clearAll:"Clear all",showMore:"Show more",justNow:"Just now",minutesAgo:"{count}m ago",hoursAgo:"{count}h ago",daysAgo:"{count}d ago",new:"New"},T=5,o=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={title:"Notifications",noNotifications:"No notifications",markAllRead:"Mark all as read",clearAll:"Clear all",showMore:"Show more",justNow:"Just now",minutesAgo:"{count}m ago",hoursAgo:"{count}h ago",daysAgo:"{count}d ago",new:"New"},T=5,o=1e4,I={info:"bear-text-blue-400 bear-bg-blue-500/20",success:"bear-text-green-400 bear-bg-green-500/20",warning:"bear-text-amber-400 bear-bg-amber-500/20",error:"bear-text-red-400 bear-bg-red-500/20"},N={MINUTE:60*1e3,HOUR:3600*1e3,DAY:1440*60*1e3};exports.NOTIFICATION_CENTER_DEFAULT_TRANSLATIONS=e;exports.NOTIFICATION_CENTER_MAX_VISIBLE=T;exports.NOTIFICATION_CENTER_Z_INDEX=o;exports.NOTIFICATION_TYPE_COLORS=I;exports.TIME_THRESHOLDS=N;
|
|
@@ -9,7 +9,7 @@ const e = {
|
|
|
9
9
|
hoursAgo: "{count}h ago",
|
|
10
10
|
daysAgo: "{count}d ago",
|
|
11
11
|
new: "New"
|
|
12
|
-
}, o = 5, t =
|
|
12
|
+
}, o = 5, t = 1e4, a = {
|
|
13
13
|
info: "bear-text-blue-400 bear-bg-blue-500/20",
|
|
14
14
|
success: "bear-text-green-400 bear-bg-green-500/20",
|
|
15
15
|
warning: "bear-text-amber-400 bear-bg-amber-500/20",
|