@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,48 +1,54 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import { createPortal as
|
|
1
|
+
import { jsxs as t, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as h, useEffect as p } from "react";
|
|
3
|
+
import { createPortal as v } from "react-dom";
|
|
4
4
|
import { cn as e } from "../../utils/cn.js";
|
|
5
|
-
import { CloseIcon as
|
|
6
|
-
import { MODAL_BACKDROP_CLASSES as
|
|
7
|
-
const
|
|
5
|
+
import { CloseIcon as k } from "../Icon/icons/navigation.js";
|
|
6
|
+
import { MODAL_BACKDROP_CLASSES as y, MODAL_TITLE_CLASSES as N, MODAL_CLOSE_CLASSES as D, MODAL_HEADER_CLASSES as w, MODAL_BODY_CLASSES as x, MODAL_FOOTER_CLASSES as I, MODAL_SIZE_CLASSES as R, MODAL_CONTAINER_CLASSES as T } from "./Modal.const.js";
|
|
7
|
+
const K = (_) => {
|
|
8
8
|
const {
|
|
9
9
|
isOpen: l,
|
|
10
|
-
onClose:
|
|
10
|
+
onClose: a,
|
|
11
11
|
title: r,
|
|
12
|
-
children:
|
|
13
|
-
size:
|
|
14
|
-
showCloseButton:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
children: S,
|
|
13
|
+
size: u = "md",
|
|
14
|
+
showCloseButton: c = !0,
|
|
15
|
+
closeOnEscape: s = !0,
|
|
16
|
+
lockBodyScroll: C = !0,
|
|
17
|
+
cancelPreventScroll: E = !1,
|
|
18
|
+
closeOnBackdrop: L = !0,
|
|
19
|
+
isCancelBackgroundClick: i,
|
|
20
|
+
className: f,
|
|
18
21
|
footer: n,
|
|
19
|
-
testId:
|
|
20
|
-
id:
|
|
21
|
-
} =
|
|
22
|
-
(
|
|
23
|
-
|
|
22
|
+
testId: b,
|
|
23
|
+
id: A
|
|
24
|
+
} = _, m = C && !E, M = i !== void 0 ? i : L, d = h(
|
|
25
|
+
(B) => {
|
|
26
|
+
s && B.key === "Escape" && a();
|
|
24
27
|
},
|
|
25
|
-
[
|
|
28
|
+
[s, a]
|
|
26
29
|
);
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
if (p(() => {
|
|
31
|
+
if (l)
|
|
32
|
+
return document.addEventListener("keydown", d), m && (document.body.style.overflow = "hidden"), () => {
|
|
33
|
+
document.removeEventListener("keydown", d), document.body.style.overflow = "";
|
|
34
|
+
};
|
|
35
|
+
}, [l, d, m]), !l) return null;
|
|
36
|
+
const O = /* @__PURE__ */ t(
|
|
31
37
|
"div",
|
|
32
38
|
{
|
|
33
|
-
className: "Bear-Modal bear-fixed bear-inset-0 bear-z-
|
|
34
|
-
id:
|
|
35
|
-
"data-testid":
|
|
39
|
+
className: "Bear-Modal bear-fixed bear-inset-0 bear-z-[11000] bear-flex bear-items-center bear-justify-center bear-p-4",
|
|
40
|
+
id: A,
|
|
41
|
+
"data-testid": b,
|
|
36
42
|
children: [
|
|
37
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ o(
|
|
38
44
|
"div",
|
|
39
45
|
{
|
|
40
|
-
className: e("Bear-Modal__backdrop",
|
|
41
|
-
onClick:
|
|
46
|
+
className: e("Bear-Modal__backdrop", y),
|
|
47
|
+
onClick: M ? a : void 0,
|
|
42
48
|
"aria-hidden": "true"
|
|
43
49
|
}
|
|
44
50
|
),
|
|
45
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ t(
|
|
46
52
|
"div",
|
|
47
53
|
{
|
|
48
54
|
role: "dialog",
|
|
@@ -50,40 +56,40 @@ const z = (c) => {
|
|
|
50
56
|
"aria-labelledby": r ? "modal-title" : void 0,
|
|
51
57
|
className: e(
|
|
52
58
|
"Bear-Modal__container",
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
T,
|
|
60
|
+
R[u],
|
|
61
|
+
f
|
|
56
62
|
),
|
|
57
63
|
children: [
|
|
58
|
-
(r ||
|
|
59
|
-
r && /* @__PURE__ */
|
|
64
|
+
(r || c) && /* @__PURE__ */ t("div", { className: e("Bear-Modal__header", w), children: [
|
|
65
|
+
r && /* @__PURE__ */ o(
|
|
60
66
|
"h2",
|
|
61
67
|
{
|
|
62
68
|
id: "modal-title",
|
|
63
|
-
className: e("Bear-Modal__title",
|
|
69
|
+
className: e("Bear-Modal__title", N),
|
|
64
70
|
children: r
|
|
65
71
|
}
|
|
66
72
|
),
|
|
67
|
-
|
|
73
|
+
c && /* @__PURE__ */ o(
|
|
68
74
|
"button",
|
|
69
75
|
{
|
|
70
|
-
onClick:
|
|
71
|
-
className: e("Bear-Modal__close",
|
|
76
|
+
onClick: a,
|
|
77
|
+
className: e("Bear-Modal__close", D),
|
|
72
78
|
"aria-label": "Close modal",
|
|
73
|
-
children: /* @__PURE__ */
|
|
79
|
+
children: /* @__PURE__ */ o(k, { className: "bear-w-5 bear-h-5" })
|
|
74
80
|
}
|
|
75
81
|
)
|
|
76
82
|
] }),
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
n && /* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ o("div", { className: e("Bear-Modal__body", x), children: S }),
|
|
84
|
+
n && /* @__PURE__ */ o("div", { className: e("Bear-Modal__footer", I), children: n })
|
|
79
85
|
]
|
|
80
86
|
}
|
|
81
87
|
)
|
|
82
88
|
]
|
|
83
89
|
}
|
|
84
90
|
);
|
|
85
|
-
return
|
|
91
|
+
return v(O, document.body);
|
|
86
92
|
};
|
|
87
93
|
export {
|
|
88
|
-
|
|
94
|
+
K as Modal
|
|
89
95
|
};
|
|
@@ -17,6 +17,12 @@ export interface ModalProps {
|
|
|
17
17
|
closeOnBackdrop?: boolean;
|
|
18
18
|
/** Whether pressing Escape closes modal */
|
|
19
19
|
closeOnEscape?: boolean;
|
|
20
|
+
/** When false, the document body scroll is not locked while open */
|
|
21
|
+
lockBodyScroll?: boolean;
|
|
22
|
+
/** When true, the page behind the modal stays scrollable (same as lockBodyScroll: false) */
|
|
23
|
+
cancelPreventScroll?: boolean;
|
|
24
|
+
/** When provided, sets whether clicking the backdrop closes the modal (overrides closeOnBackdrop) */
|
|
25
|
+
isCancelBackgroundClick?: boolean;
|
|
20
26
|
/** Additional class names for content */
|
|
21
27
|
className?: string;
|
|
22
28
|
/** Footer content */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),s=require("react"),u=require("../../utils/cn.cjs"),q=require("../Portal/Portal.cjs"),z=1e4,F=({options:k,value:j,defaultValue:B=[],onChange:o,placeholder:V="Select options...",label:E,helperText:L,error:f,disabled:b=!1,maxSelections:m,searchable:D=!0,className:_,testId:C})=>{const[i,c]=s.useState(!1),[x,h]=s.useState(""),[K,N]=s.useState(B),R=s.useRef(null),P=s.useRef(null),g=s.useRef(null),w=s.useRef(null),[l,T]=s.useState({top:0,left:0,width:0}),p=j!==void 0,n=p?j:K,d=k.filter(e=>e.label.toLowerCase().includes(x.toLowerCase())&&!n.includes(e.value)),y=i&&!b&&d.length>0,v=i&&!b&&d.length===0&&!!x;s.useEffect(()=>{if(!y&&!v)return;const e=()=>{var t;const r=(t=P.current)==null?void 0:t.getBoundingClientRect();r&&T({top:r.bottom+4,left:Math.max(8,Math.min(r.left,window.innerWidth-r.width-8)),width:Math.max(r.width,160)})};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[y,v]),s.useEffect(()=>{if(!i)return;const e=r=>{var O,I;const t=r.target;(O=R.current)!=null&&O.contains(t)||(I=g.current)!=null&&I.contains(t)||(c(!1),h(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);const M=e=>{var t;if(b||m&&n.length>=m)return;const r=[...n,e];p||N(r),o==null||o(r),h(""),(t=w.current)==null||t.focus()},S=e=>{if(b)return;const r=n.filter(t=>t!==e);p||N(r),o==null||o(r)},W=e=>{e.key==="Backspace"&&x===""&&n.length>0&&S(n[n.length-1]),e.key==="Escape"&&(c(!1),h("")),e.key==="Enter"&&d.length>0&&(e.preventDefault(),M(d[0].value))},A=n.map(e=>{var r;return((r=k.find(t=>t.value===e))==null?void 0:r.label)||e});return a.jsxs("div",{className:u.cn("bear-w-full",_),ref:R,"data-testid":C,children:[E&&a.jsx("label",{className:"bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200 bear-mb-1.5",children:E}),a.jsxs("div",{ref:P,className:u.cn("bear-relative bear-flex bear-flex-wrap bear-items-center bear-gap-1.5 bear-min-h-[42px] bear-px-3 bear-py-2","bear-rounded-lg bear-border bear-bg-white dark:bear-bg-gray-900","bear-transition-colors bear-cursor-text",f?"bear-border-red-500 focus-within:bear-ring-2 focus-within:bear-ring-red-500/20":"bear-border-gray-300 dark:bear-border-gray-600 focus-within:bear-border-amber-500 focus-within:bear-ring-2 focus-within:bear-ring-amber-500/20",b&&"bear-opacity-50 bear-cursor-not-allowed bear-bg-gray-100 dark:bear-bg-gray-800"),onClick:()=>{var e;b||(c(!0),(e=w.current)==null||e.focus())},children:[A.map((e,r)=>a.jsxs("span",{className:"bear-inline-flex bear-items-center bear-gap-1 bear-px-2 bear-py-0.5 bear-text-sm bear-rounded-md bear-bg-amber-100 dark:bear-bg-amber-900/30 bear-text-amber-800 dark:bear-text-amber-200",children:[e,!b&&a.jsx("button",{type:"button",onClick:t=>{t.stopPropagation(),S(n[r])},className:"bear-ml-0.5 bear-text-amber-600 hover:bear-text-amber-800 dark:bear-text-amber-400 dark:hover:bear-text-amber-200",children:"×"})]},n[r])),D&&!b&&a.jsx("input",{ref:w,type:"text",value:x,onChange:e=>{h(e.target.value),c(!0)},onFocus:()=>c(!0),onKeyDown:W,placeholder:n.length===0?V:"",disabled:b||m!==void 0&&n.length>=m,className:"bear-flex-1 bear-min-w-[80px] bear-bg-transparent bear-outline-none bear-text-sm bear-text-gray-900 dark:bear-text-white placeholder:bear-text-gray-400"}),a.jsx("svg",{className:u.cn("bear-w-4 bear-h-4 bear-text-gray-400 bear-transition-transform bear-ml-auto",i&&"bear-rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),y&&a.jsx(q.Portal,{children:a.jsx("div",{ref:g,className:"bear-fixed bear-py-1 bear-bg-white dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-rounded-lg bear-shadow-lg bear-max-h-60 bear-overflow-auto",style:{top:l.top,left:l.left,width:l.width,zIndex:z},children:d.map(e=>a.jsx("button",{type:"button",disabled:e.disabled,onClick:()=>M(e.value),className:u.cn("bear-w-full bear-px-3 bear-py-2 bear-text-left bear-text-sm","hover:bear-bg-amber-50 dark:hover:bear-bg-amber-900/20","bear-text-gray-900 dark:bear-text-white",e.disabled&&"bear-opacity-50 bear-cursor-not-allowed"),children:e.label},e.value))})}),v&&a.jsx(q.Portal,{children:a.jsx("div",{ref:g,className:"bear-fixed bear-py-3 bear-px-4 bear-bg-white dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-rounded-lg bear-shadow-lg bear-text-sm bear-text-gray-500",style:{top:l.top,left:l.left,width:l.width,zIndex:z},children:"No options found"})}),(L||f)&&a.jsx("p",{className:u.cn("bear-mt-1.5 bear-text-xs",f?"bear-text-red-500":"bear-text-gray-500 dark:bear-text-gray-400"),children:f||L})]})};exports.MultiSelect=F;
|
|
@@ -1,76 +1,95 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { jsxs as L, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useRef as p, useEffect as D } from "react";
|
|
3
|
+
import { cn as c } from "../../utils/cn.js";
|
|
4
|
+
import { Portal as S } from "../Portal/Portal.js";
|
|
5
|
+
const _ = 1e4, X = ({
|
|
6
|
+
options: E,
|
|
7
|
+
value: N,
|
|
8
|
+
defaultValue: C = [],
|
|
9
|
+
onChange: b,
|
|
10
|
+
placeholder: K = "Select options...",
|
|
11
|
+
label: P,
|
|
12
|
+
helperText: M,
|
|
13
|
+
error: u,
|
|
14
|
+
disabled: o = !1,
|
|
15
|
+
maxSelections: f,
|
|
16
|
+
searchable: W = !0,
|
|
17
|
+
className: A,
|
|
18
|
+
testId: F
|
|
18
19
|
}) => {
|
|
19
|
-
const [
|
|
20
|
-
|
|
20
|
+
const [s, i] = g(!1), [m, h] = g(""), [T, R] = g(C), I = p(null), O = p(null), w = p(null), x = p(null), [l, U] = g({ top: 0, left: 0, width: 0 }), y = N !== void 0, a = y ? N : T, d = E.filter(
|
|
21
|
+
(e) => e.label.toLowerCase().includes(m.toLowerCase()) && !a.includes(e.value)
|
|
22
|
+
), v = s && !o && d.length > 0, k = s && !o && d.length === 0 && !!m;
|
|
23
|
+
D(() => {
|
|
24
|
+
if (!v && !k) return;
|
|
25
|
+
const e = () => {
|
|
26
|
+
var t;
|
|
27
|
+
const r = (t = O.current) == null ? void 0 : t.getBoundingClientRect();
|
|
28
|
+
r && U({
|
|
29
|
+
top: r.bottom + 4,
|
|
30
|
+
left: Math.max(8, Math.min(r.left, window.innerWidth - r.width - 8)),
|
|
31
|
+
width: Math.max(r.width, 160)
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
35
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
36
|
+
};
|
|
37
|
+
}, [v, k]), D(() => {
|
|
38
|
+
if (!s) return;
|
|
21
39
|
const e = (r) => {
|
|
22
|
-
|
|
40
|
+
var V, j;
|
|
41
|
+
const t = r.target;
|
|
42
|
+
(V = I.current) != null && V.contains(t) || (j = w.current) != null && j.contains(t) || (i(!1), h(""));
|
|
23
43
|
};
|
|
24
44
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
25
|
-
}, []);
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var n;
|
|
30
|
-
if (t || d && a.length >= d) return;
|
|
45
|
+
}, [s]);
|
|
46
|
+
const z = (e) => {
|
|
47
|
+
var t;
|
|
48
|
+
if (o || f && a.length >= f) return;
|
|
31
49
|
const r = [...a, e];
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
if (
|
|
35
|
-
const r = a.filter((
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
e.key === "Backspace" &&
|
|
39
|
-
},
|
|
50
|
+
y || R(r), b == null || b(r), h(""), (t = x.current) == null || t.focus();
|
|
51
|
+
}, B = (e) => {
|
|
52
|
+
if (o) return;
|
|
53
|
+
const r = a.filter((t) => t !== e);
|
|
54
|
+
y || R(r), b == null || b(r);
|
|
55
|
+
}, Z = (e) => {
|
|
56
|
+
e.key === "Backspace" && m === "" && a.length > 0 && B(a[a.length - 1]), e.key === "Escape" && (i(!1), h("")), e.key === "Enter" && d.length > 0 && (e.preventDefault(), z(d[0].value));
|
|
57
|
+
}, q = a.map(
|
|
40
58
|
(e) => {
|
|
41
59
|
var r;
|
|
42
|
-
return ((r =
|
|
60
|
+
return ((r = E.find((t) => t.value === e)) == null ? void 0 : r.label) || e;
|
|
43
61
|
}
|
|
44
62
|
);
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
|
|
47
|
-
/* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ L("div", { className: c("bear-w-full", A), ref: I, "data-testid": F, children: [
|
|
64
|
+
P && /* @__PURE__ */ n("label", { className: "bear-block bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-200 bear-mb-1.5", children: P }),
|
|
65
|
+
/* @__PURE__ */ L(
|
|
48
66
|
"div",
|
|
49
67
|
{
|
|
50
|
-
|
|
68
|
+
ref: O,
|
|
69
|
+
className: c(
|
|
51
70
|
"bear-relative bear-flex bear-flex-wrap bear-items-center bear-gap-1.5 bear-min-h-[42px] bear-px-3 bear-py-2",
|
|
52
71
|
"bear-rounded-lg bear-border bear-bg-white dark:bear-bg-gray-900",
|
|
53
72
|
"bear-transition-colors bear-cursor-text",
|
|
54
|
-
|
|
55
|
-
|
|
73
|
+
u ? "bear-border-red-500 focus-within:bear-ring-2 focus-within:bear-ring-red-500/20" : "bear-border-gray-300 dark:bear-border-gray-600 focus-within:bear-border-amber-500 focus-within:bear-ring-2 focus-within:bear-ring-amber-500/20",
|
|
74
|
+
o && "bear-opacity-50 bear-cursor-not-allowed bear-bg-gray-100 dark:bear-bg-gray-800"
|
|
56
75
|
),
|
|
57
76
|
onClick: () => {
|
|
58
77
|
var e;
|
|
59
|
-
|
|
78
|
+
o || (i(!0), (e = x.current) == null || e.focus());
|
|
60
79
|
},
|
|
61
80
|
children: [
|
|
62
|
-
|
|
81
|
+
q.map((e, r) => /* @__PURE__ */ L(
|
|
63
82
|
"span",
|
|
64
83
|
{
|
|
65
84
|
className: "bear-inline-flex bear-items-center bear-gap-1 bear-px-2 bear-py-0.5 bear-text-sm bear-rounded-md bear-bg-amber-100 dark:bear-bg-amber-900/30 bear-text-amber-800 dark:bear-text-amber-200",
|
|
66
85
|
children: [
|
|
67
86
|
e,
|
|
68
|
-
!
|
|
87
|
+
!o && /* @__PURE__ */ n(
|
|
69
88
|
"button",
|
|
70
89
|
{
|
|
71
90
|
type: "button",
|
|
72
|
-
onClick: (
|
|
73
|
-
|
|
91
|
+
onClick: (t) => {
|
|
92
|
+
t.stopPropagation(), B(a[r]);
|
|
74
93
|
},
|
|
75
94
|
className: "bear-ml-0.5 bear-text-amber-600 hover:bear-text-amber-800 dark:bear-text-amber-400 dark:hover:bear-text-amber-200",
|
|
76
95
|
children: "×"
|
|
@@ -80,61 +99,87 @@ const q = ({
|
|
|
80
99
|
},
|
|
81
100
|
a[r]
|
|
82
101
|
)),
|
|
83
|
-
|
|
102
|
+
W && !o && /* @__PURE__ */ n(
|
|
84
103
|
"input",
|
|
85
104
|
{
|
|
86
|
-
ref:
|
|
105
|
+
ref: x,
|
|
87
106
|
type: "text",
|
|
88
|
-
value:
|
|
107
|
+
value: m,
|
|
89
108
|
onChange: (e) => {
|
|
90
|
-
|
|
109
|
+
h(e.target.value), i(!0);
|
|
91
110
|
},
|
|
92
|
-
onFocus: () =>
|
|
93
|
-
onKeyDown:
|
|
94
|
-
placeholder: a.length === 0 ?
|
|
95
|
-
disabled:
|
|
111
|
+
onFocus: () => i(!0),
|
|
112
|
+
onKeyDown: Z,
|
|
113
|
+
placeholder: a.length === 0 ? K : "",
|
|
114
|
+
disabled: o || f !== void 0 && a.length >= f,
|
|
96
115
|
className: "bear-flex-1 bear-min-w-[80px] bear-bg-transparent bear-outline-none bear-text-sm bear-text-gray-900 dark:bear-text-white placeholder:bear-text-gray-400"
|
|
97
116
|
}
|
|
98
117
|
),
|
|
99
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ n(
|
|
100
119
|
"svg",
|
|
101
120
|
{
|
|
102
|
-
className:
|
|
121
|
+
className: c(
|
|
103
122
|
"bear-w-4 bear-h-4 bear-text-gray-400 bear-transition-transform bear-ml-auto",
|
|
104
|
-
|
|
123
|
+
s && "bear-rotate-180"
|
|
105
124
|
),
|
|
106
125
|
fill: "none",
|
|
107
126
|
viewBox: "0 0 24 24",
|
|
108
127
|
stroke: "currentColor",
|
|
109
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
|
|
110
129
|
}
|
|
111
130
|
)
|
|
112
131
|
]
|
|
113
132
|
}
|
|
114
133
|
),
|
|
115
|
-
|
|
116
|
-
"
|
|
134
|
+
v && /* @__PURE__ */ n(S, { children: /* @__PURE__ */ n(
|
|
135
|
+
"div",
|
|
117
136
|
{
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
137
|
+
ref: w,
|
|
138
|
+
className: "bear-fixed bear-py-1 bear-bg-white dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-rounded-lg bear-shadow-lg bear-max-h-60 bear-overflow-auto",
|
|
139
|
+
style: {
|
|
140
|
+
top: l.top,
|
|
141
|
+
left: l.left,
|
|
142
|
+
width: l.width,
|
|
143
|
+
zIndex: _
|
|
144
|
+
},
|
|
145
|
+
children: d.map((e) => /* @__PURE__ */ n(
|
|
146
|
+
"button",
|
|
147
|
+
{
|
|
148
|
+
type: "button",
|
|
149
|
+
disabled: e.disabled,
|
|
150
|
+
onClick: () => z(e.value),
|
|
151
|
+
className: c(
|
|
152
|
+
"bear-w-full bear-px-3 bear-py-2 bear-text-left bear-text-sm",
|
|
153
|
+
"hover:bear-bg-amber-50 dark:hover:bear-bg-amber-900/20",
|
|
154
|
+
"bear-text-gray-900 dark:bear-text-white",
|
|
155
|
+
e.disabled && "bear-opacity-50 bear-cursor-not-allowed"
|
|
156
|
+
),
|
|
157
|
+
children: e.label
|
|
158
|
+
},
|
|
159
|
+
e.value
|
|
160
|
+
))
|
|
161
|
+
}
|
|
162
|
+
) }),
|
|
163
|
+
k && /* @__PURE__ */ n(S, { children: /* @__PURE__ */ n(
|
|
164
|
+
"div",
|
|
165
|
+
{
|
|
166
|
+
ref: w,
|
|
167
|
+
className: "bear-fixed bear-py-3 bear-px-4 bear-bg-white dark:bear-bg-gray-800 bear-border bear-border-gray-200 dark:bear-border-gray-700 bear-rounded-lg bear-shadow-lg bear-text-sm bear-text-gray-500",
|
|
168
|
+
style: {
|
|
169
|
+
top: l.top,
|
|
170
|
+
left: l.left,
|
|
171
|
+
width: l.width,
|
|
172
|
+
zIndex: _
|
|
173
|
+
},
|
|
174
|
+
children: "No options found"
|
|
175
|
+
}
|
|
176
|
+
) }),
|
|
177
|
+
(M || u) && /* @__PURE__ */ n("p", { className: c(
|
|
133
178
|
"bear-mt-1.5 bear-text-xs",
|
|
134
|
-
|
|
135
|
-
), children:
|
|
179
|
+
u ? "bear-text-red-500" : "bear-text-gray-500 dark:bear-text-gray-400"
|
|
180
|
+
), children: u || M })
|
|
136
181
|
] });
|
|
137
182
|
};
|
|
138
183
|
export {
|
|
139
|
-
|
|
184
|
+
X as MultiSelect
|
|
140
185
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react"),n=require("../../utils/cn.cjs"),c=require("./NavigableSelect.const.cjs"),oe=Z=>{const{options:_,value:R,defaultValue:G,onChange:i,multiple:b=!1,searchable:K=!0,placeholder:z=c.DEFAULT_PLACEHOLDER,label:O,helperText:M,error:S,disabled:p=!1,size:m="md",fullWidth:X=!1,maxVisible:Y=c.DEFAULT_MAX_VISIBLE,maxSelections:j,emptyText:$=c.DEFAULT_EMPTY_TEXT,className:J,style:Q,testId:ee}=Z,y=R!==void 0,V=e=>e===void 0?[]:Array.isArray(e)?e:[e],[re,P]=s.useState(V(G)),[g,w]=s.useState(!1),[d,o]=s.useState(-1),[x,B]=s.useState(""),E=s.useRef(null),C=s.useRef(null),q=s.useRef(null),H=s.useRef(null),l=y?V(R):re,h=s.useMemo(()=>{if(!x)return _;const e=x.toLowerCase();return _.filter(a=>{var t;return a.label.toLowerCase().includes(e)||((t=a.description)==null?void 0:t.toLowerCase().includes(e))})},[_,x]),ae=s.useMemo(()=>{const e=new Map;return h.forEach(a=>{const t=a.group||"";e.has(t)||e.set(t,[]),e.get(t).push(a)}),e},[h]),v=s.useMemo(()=>h.filter(e=>!e.disabled),[h]);s.useEffect(()=>{const e=a=>{E.current&&!E.current.contains(a.target)&&(w(!1),B(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),s.useEffect(()=>{if(!C.current||d<0)return;const e=C.current.querySelector('[data-active="true"]');e==null||e.scrollIntoView({block:c.SCROLL_BLOCK})},[d]);const L=s.useCallback(()=>{p||(w(!0),o(0),setTimeout(()=>{var e;return(e=q.current)==null?void 0:e.focus()},0))},[p]),k=s.useCallback(()=>{var e;w(!1),B(""),o(-1),(e=H.current)==null||e.focus()},[]),I=s.useCallback(e=>{let a;if(b)if(l.includes(e))a=l.filter(t=>t!==e);else{if(j&&l.length>=j)return;a=[...l,e]}else a=[e],k();y||P(a),i==null||i(b?a:a[0]??"")},[l,b,y,j,i,k]),D=s.useCallback(e=>{const a=l.filter(t=>t!==e);y||P(a),i==null||i(b?a:a[0]??"")},[l,b,y,i]),W=s.useCallback(e=>{if(!g){(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="Enter"||e.key===" ")&&(e.preventDefault(),L());return}switch(e.key){case"ArrowDown":e.preventDefault(),o(a=>Math.min(a+1,v.length-1));break;case"ArrowUp":e.preventDefault(),o(a=>Math.max(a-1,0));break;case"Enter":case" ":e.preventDefault(),d>=0&&v[d]&&I(v[d].value);break;case"Escape":e.preventDefault(),k();break;case"Backspace":x===""&&b&&l.length>0&&D(l[l.length-1]);break;case"Home":e.preventDefault(),o(0);break;case"End":e.preventDefault(),o(v.length-1);break}},[g,d,v,I,k,L,x,b,l,D]),te=s.useCallback(e=>l.includes(e),[l]),u=l.map(e=>_.find(a=>a.value===e)).filter(Boolean),se=!!S,le=c.TRIGGER_SIZE_CLASSES[m],be=c.OPTION_SIZE_CLASSES[m],ne=c.TAG_SIZE_CLASSES[m],F=c.ICON_SIZE[m],ce=Y*c.OPTION_HEIGHT[m];let A=-1;return r.jsxs("div",{ref:E,className:n.cn("Bear-NavigableSelect","bear-relative bear-flex bear-flex-col bear-gap-1.5",X&&"bear-w-full",J),style:Q,"data-testid":ee,children:[O&&r.jsx("label",{className:"Bear-NavigableSelect__label bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-300",children:O}),r.jsxs("button",{ref:H,type:"button",disabled:p,onClick:()=>g?k():L(),onKeyDown:W,className:n.cn("Bear-NavigableSelect__trigger","bear-flex bear-items-center bear-justify-between bear-w-full","bear-rounded-lg bear-border bear-text-left bear-outline-none","bear-transition-all bear-duration-200","bear-bg-white dark:bear-bg-gray-900","bear-text-gray-900 dark:bear-text-white",se?"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",p&&"bear-opacity-50 bear-cursor-not-allowed",le),"aria-haspopup":"listbox","aria-expanded":g,children:[r.jsxs("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:[b&&u.length>0&&u.map(e=>r.jsxs("span",{className:n.cn("Bear-NavigableSelect__tag","bear-inline-flex bear-items-center bear-gap-1 bear-rounded-md","bear-bg-[var(--bear-primary-100,#fce7f3)] dark:bear-bg-[var(--bear-primary-900,#831843)]/30","bear-text-[var(--bear-primary-700,#be185d)] dark:bear-text-[var(--bear-primary-300,#f9a8d4)]",ne),children:[e.label,!p&&r.jsx("button",{type:"button",onClick:a=>{a.stopPropagation(),D(e.value)},className:"bear-ml-0.5 hover:bear-opacity-70","aria-label":`Remove ${e.label}`,children:"×"})]},e.value)),!b&&u.length>0&&r.jsxs("span",{className:"bear-truncate",children:[u[0].icon&&r.jsx("span",{className:"bear-mr-1.5",children:u[0].icon}),u[0].label]}),u.length===0&&r.jsx("span",{className:"bear-text-gray-400 dark:bear-text-gray-500",children:z})]}),r.jsx("svg",{className:n.cn(F,"bear-text-gray-400 dark:bear-text-gray-500 bear-transition-transform bear-shrink-0 bear-ml-2",g&&"bear-rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),g&&r.jsxs("div",{className:n.cn("Bear-NavigableSelect__dropdown","bear-absolute bear-top-full bear-left-0 bear-w-full bear-mt-1","bear-bg-white dark:bear-bg-gray-900","bear-border bear-border-gray-200 dark:bear-border-gray-700","bear-rounded-lg bear-shadow-lg bear-overflow-hidden"),style:{zIndex:c.DROPDOWN_Z_INDEX},children:[K&&r.jsxs("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:[r.jsxs("svg",{className:"bear-w-4 bear-h-4 bear-text-gray-400 dark:bear-text-gray-500 bear-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),r.jsx("input",{ref:q,type:"text",value:x,onChange:e=>{B(e.target.value),o(0)},onKeyDown:W,placeholder:"Type to search...",className:n.cn("Bear-NavigableSelect__input","bear-flex-1 bear-bg-transparent bear-outline-none bear-text-sm","bear-text-gray-900 dark:bear-text-white","placeholder:bear-text-gray-400 dark:placeholder:bear-text-gray-500"),autoComplete:"off",spellCheck:!1})]}),r.jsxs("div",{ref:C,className:"Bear-NavigableSelect__list bear-overflow-y-auto bear-py-1",style:{maxHeight:ce},role:"listbox","aria-multiselectable":b,children:[h.length===0&&r.jsx("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:$}),Array.from(ae.entries()).map(([e,a])=>r.jsxs("div",{className:"Bear-NavigableSelect__group",children:[e&&r.jsx("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}),a.map(t=>{const N=t.disabled,U=!N;U&&A++;const T=A===d,f=te(t.value),ie=A;return r.jsxs("button",{type:"button",disabled:N,className:n.cn("Bear-NavigableSelect__option","bear-w-full bear-flex bear-items-center bear-gap-2.5 bear-text-left bear-cursor-pointer","bear-transition-colors bear-duration-100",be,T&&"bear-bg-gray-100 dark:bear-bg-gray-800",f&&!T&&"bear-bg-[var(--bear-primary-50,#fdf2f8)] dark:bear-bg-[var(--bear-primary-950,#500724)]/20",N&&"bear-opacity-40 bear-cursor-not-allowed"),"data-active":T,onMouseEnter:()=>{U&&o(ie)},onClick:()=>{N||I(t.value)},role:"option","aria-selected":f,"aria-disabled":N,children:[b&&r.jsx("span",{className:n.cn("Bear-NavigableSelect__checkbox","bear-flex bear-items-center bear-justify-center bear-w-4 bear-h-4 bear-rounded bear-border bear-shrink-0","bear-transition-colors",f?"bear-bg-[var(--bear-primary-500)] bear-border-[var(--bear-primary-500)] bear-text-white":"bear-border-gray-300 dark:bear-border-gray-600"),children:f&&r.jsx("svg",{className:"bear-w-3 bear-h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),t.icon&&r.jsx("span",{className:"Bear-NavigableSelect__option-icon bear-shrink-0 bear-text-gray-500 dark:bear-text-gray-400",children:t.icon}),r.jsxs("div",{className:"Bear-NavigableSelect__option-body bear-flex-1 bear-min-w-0",children:[r.jsx("div",{className:n.cn("Bear-NavigableSelect__option-label bear-truncate",f?"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"),children:t.label}),t.description&&r.jsx("div",{className:"Bear-NavigableSelect__option-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate",children:t.description})]}),!b&&f&&r.jsx("svg",{className:n.cn(F,"bear-text-[var(--bear-primary-500)] bear-shrink-0"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]},t.value)})]},e))]}),r.jsxs("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:[r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("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:"↑↓"}),"navigate"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("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:"↵"}),"select"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("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"}),"close"]})]})]}),(M||S)&&r.jsx("p",{className:n.cn("Bear-NavigableSelect__helper bear-text-xs",S?"bear-text-red-500":"bear-text-gray-500 dark:bear-text-gray-400"),children:S||M})]})};exports.NavigableSelect=oe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react"),b=require("../../utils/cn.cjs"),ge=require("../Portal/Portal.cjs"),o=require("./NavigableSelect.const.cjs"),xe=G=>{const{options:_,value:O,defaultValue:K,onChange:c,multiple:n=!1,searchable:X=!0,placeholder:Y=o.DEFAULT_PLACEHOLDER,label:P,helperText:V,error:S,disabled:m=!1,size:y="md",fullWidth:$=!1,maxVisible:J=o.DEFAULT_MAX_VISIBLE,maxSelections:j,emptyText:Q=o.DEFAULT_EMPTY_TEXT,className:ee,style:re,testId:ae}=G,h=O!==void 0,q=e=>e===void 0?[]:Array.isArray(e)?e:[e],[te,W]=s.useState(q(K)),[i,E]=s.useState(!1),[g,d]=s.useState(-1),[f,B]=s.useState(""),H=s.useRef(null),z=s.useRef(null),L=s.useRef(null),F=s.useRef(null),C=s.useRef(null),[I,se]=s.useState({top:0,left:0,width:0}),l=h?q(O):te,v=s.useMemo(()=>{if(!f)return _;const e=f.toLowerCase();return _.filter(a=>{var t;return a.label.toLowerCase().includes(e)||((t=a.description)==null?void 0:t.toLowerCase().includes(e))})},[_,f]),le=s.useMemo(()=>{const e=new Map;return v.forEach(a=>{const t=a.group||"";e.has(t)||e.set(t,[]),e.get(t).push(a)}),e},[v]),k=s.useMemo(()=>v.filter(e=>!e.disabled),[v]);s.useEffect(()=>{if(!i)return;const e=()=>{var t;const a=(t=C.current)==null?void 0:t.getBoundingClientRect();a&&se({top:a.bottom+4,left:Math.max(8,Math.min(a.left,window.innerWidth-a.width-8)),width:a.width})};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[i]),s.useEffect(()=>{if(!i)return;const e=a=>{var u,w;const t=a.target;(u=H.current)!=null&&u.contains(t)||(w=z.current)!=null&&w.contains(t)||(E(!1),B(""))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]),s.useEffect(()=>{if(!L.current||g<0)return;const e=L.current.querySelector('[data-active="true"]');e==null||e.scrollIntoView({block:o.SCROLL_BLOCK})},[g]);const D=s.useCallback(()=>{m||(E(!0),d(0),setTimeout(()=>{var e;return(e=F.current)==null?void 0:e.focus()},0))},[m]),N=s.useCallback(()=>{var e;E(!1),B(""),d(-1),(e=C.current)==null||e.focus()},[]),R=s.useCallback(e=>{let a;if(n)if(l.includes(e))a=l.filter(t=>t!==e);else{if(j&&l.length>=j)return;a=[...l,e]}else a=[e],N();h||W(a),c==null||c(n?a:a[0]??"")},[l,n,h,j,c,N]),A=s.useCallback(e=>{const a=l.filter(t=>t!==e);h||W(a),c==null||c(n?a:a[0]??"")},[l,n,h,c]),U=s.useCallback(e=>{if(!i){(e.key==="ArrowDown"||e.key==="ArrowUp"||e.key==="Enter"||e.key===" ")&&(e.preventDefault(),D());return}switch(e.key){case"ArrowDown":e.preventDefault(),d(a=>Math.min(a+1,k.length-1));break;case"ArrowUp":e.preventDefault(),d(a=>Math.max(a-1,0));break;case"Enter":case" ":e.preventDefault(),g>=0&&k[g]&&R(k[g].value);break;case"Escape":e.preventDefault(),N();break;case"Backspace":f===""&&n&&l.length>0&&A(l[l.length-1]);break;case"Home":e.preventDefault(),d(0);break;case"End":e.preventDefault(),d(k.length-1);break}},[i,g,k,R,N,D,f,n,l,A]),ne=s.useCallback(e=>l.includes(e),[l]),x=l.map(e=>_.find(a=>a.value===e)).filter(Boolean),be=!!S,ie=o.TRIGGER_SIZE_CLASSES[y],oe=o.OPTION_SIZE_CLASSES[y],ce=o.TAG_SIZE_CLASSES[y],Z=o.ICON_SIZE[y],de=J*o.OPTION_HEIGHT[y];let T=-1;return r.jsxs("div",{ref:H,className:b.cn("Bear-NavigableSelect","bear-relative bear-flex bear-flex-col bear-gap-1.5",$&&"bear-w-full",ee),style:re,"data-testid":ae,children:[P&&r.jsx("label",{className:"Bear-NavigableSelect__label bear-text-sm bear-font-medium bear-text-gray-700 dark:bear-text-gray-300",children:P}),r.jsxs("button",{ref:C,type:"button",disabled:m,onClick:()=>i?N():D(),onKeyDown:U,className:b.cn("Bear-NavigableSelect__trigger","bear-flex bear-items-center bear-justify-between bear-w-full","bear-rounded-lg bear-border bear-text-left bear-outline-none","bear-transition-all bear-duration-200","bear-bg-white dark:bear-bg-gray-900","bear-text-gray-900 dark:bear-text-white",be?"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",m&&"bear-opacity-50 bear-cursor-not-allowed",ie),"aria-haspopup":"listbox","aria-expanded":i,children:[r.jsxs("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:[n&&x.length>0&&x.map(e=>r.jsxs("span",{className:b.cn("Bear-NavigableSelect__tag","bear-inline-flex bear-items-center bear-gap-1 bear-rounded-md","bear-bg-[var(--bear-primary-100,#fce7f3)] dark:bear-bg-[var(--bear-primary-900,#831843)]/30","bear-text-[var(--bear-primary-700,#be185d)] dark:bear-text-[var(--bear-primary-300,#f9a8d4)]",ce),children:[e.label,!m&&r.jsx("button",{type:"button",onClick:a=>{a.stopPropagation(),A(e.value)},className:"bear-ml-0.5 hover:bear-opacity-70","aria-label":`Remove ${e.label}`,children:"×"})]},e.value)),!n&&x.length>0&&r.jsxs("span",{className:"bear-truncate",children:[x[0].icon&&r.jsx("span",{className:"bear-mr-1.5",children:x[0].icon}),x[0].label]}),x.length===0&&r.jsx("span",{className:"bear-text-gray-400 dark:bear-text-gray-500",children:Y})]}),r.jsx("svg",{className:b.cn(Z,"bear-text-gray-400 dark:bear-text-gray-500 bear-transition-transform bear-shrink-0 bear-ml-2",i&&"bear-rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),i&&r.jsx(ge.Portal,{children:r.jsxs("div",{ref:z,className:b.cn("Bear-NavigableSelect__dropdown","bear-fixed","bear-bg-white dark:bear-bg-gray-900","bear-border bear-border-gray-200 dark:bear-border-gray-700","bear-rounded-lg bear-shadow-lg bear-overflow-hidden"),style:{zIndex:o.DROPDOWN_Z_INDEX,top:I.top,left:I.left,width:I.width},children:[X&&r.jsxs("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:[r.jsxs("svg",{className:"bear-w-4 bear-h-4 bear-text-gray-400 dark:bear-text-gray-500 bear-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[r.jsx("circle",{cx:"11",cy:"11",r:"8"}),r.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),r.jsx("input",{ref:F,type:"text",value:f,onChange:e=>{B(e.target.value),d(0)},onKeyDown:U,placeholder:"Type to search...",className:b.cn("Bear-NavigableSelect__input","bear-flex-1 bear-bg-transparent bear-outline-none bear-text-sm","bear-text-gray-900 dark:bear-text-white","placeholder:bear-text-gray-400 dark:placeholder:bear-text-gray-500"),autoComplete:"off",spellCheck:!1})]}),r.jsxs("div",{ref:L,className:"Bear-NavigableSelect__list bear-overflow-y-auto bear-py-1",style:{maxHeight:de},role:"listbox","aria-multiselectable":n,children:[v.length===0&&r.jsx("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:Q}),Array.from(le.entries()).map(([e,a])=>r.jsxs("div",{className:"Bear-NavigableSelect__group",children:[e&&r.jsx("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}),a.map(t=>{const u=t.disabled,w=!u;w&&T++;const M=T===g,p=ne(t.value),ue=T;return r.jsxs("button",{type:"button",disabled:u,className:b.cn("Bear-NavigableSelect__option","bear-w-full bear-flex bear-items-center bear-gap-2.5 bear-text-left bear-cursor-pointer","bear-transition-colors bear-duration-100",oe,M&&"bear-bg-gray-100 dark:bear-bg-gray-800",p&&!M&&"bear-bg-[var(--bear-primary-50,#fdf2f8)] dark:bear-bg-[var(--bear-primary-950,#500724)]/20",u&&"bear-opacity-40 bear-cursor-not-allowed"),"data-active":M,onMouseEnter:()=>{w&&d(ue)},onClick:()=>{u||R(t.value)},role:"option","aria-selected":p,"aria-disabled":u,children:[n&&r.jsx("span",{className:b.cn("Bear-NavigableSelect__checkbox","bear-flex bear-items-center bear-justify-center bear-w-4 bear-h-4 bear-rounded bear-border bear-shrink-0","bear-transition-colors",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"),children:p&&r.jsx("svg",{className:"bear-w-3 bear-h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),t.icon&&r.jsx("span",{className:"Bear-NavigableSelect__option-icon bear-shrink-0 bear-text-gray-500 dark:bear-text-gray-400",children:t.icon}),r.jsxs("div",{className:"Bear-NavigableSelect__option-body bear-flex-1 bear-min-w-0",children:[r.jsx("div",{className:b.cn("Bear-NavigableSelect__option-label bear-truncate",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"),children:t.label}),t.description&&r.jsx("div",{className:"Bear-NavigableSelect__option-desc bear-text-xs bear-text-gray-500 dark:bear-text-gray-400 bear-truncate",children:t.description})]}),!n&&p&&r.jsx("svg",{className:b.cn(Z,"bear-text-[var(--bear-primary-500)] bear-shrink-0"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})]},t.value)})]},e))]}),r.jsxs("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:[r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("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:"↑↓"}),"navigate"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("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:"↵"}),"select"]}),r.jsxs("span",{className:"bear-flex bear-items-center bear-gap-1",children:[r.jsx("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"}),"close"]})]})]})}),(V||S)&&r.jsx("p",{className:b.cn("Bear-NavigableSelect__helper bear-text-xs",S?"bear-text-red-500":"bear-text-gray-500 dark:bear-text-gray-400"),children:S||V})]})};exports.NavigableSelect=xe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Select an option...",a="No options found",r=8,t={sm:32,md:40,lg:48},b={sm:"bear-h-8 bear-text-sm bear-px-2.5",md:"bear-h-10 bear-text-sm bear-px-3",lg:"bear-h-12 bear-text-base bear-px-4"},E={sm:"bear-px-2.5 bear-py-1.5 bear-text-sm",md:"bear-px-3 bear-py-2 bear-text-sm",lg:"bear-px-4 bear-py-2.5 bear-text-base"},S={sm:"bear-text-xs bear-px-1.5 bear-py-0.5",md:"bear-text-xs bear-px-2 bear-py-0.5",lg:"bear-text-sm bear-px-2 bear-py-1"},_=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="Select an option...",a="No options found",r=8,t={sm:32,md:40,lg:48},b={sm:"bear-h-8 bear-text-sm bear-px-2.5",md:"bear-h-10 bear-text-sm bear-px-3",lg:"bear-h-12 bear-text-base bear-px-4"},E={sm:"bear-px-2.5 bear-py-1.5 bear-text-sm",md:"bear-px-3 bear-py-2 bear-text-sm",lg:"bear-px-4 bear-py-2.5 bear-text-base"},S={sm:"bear-text-xs bear-px-1.5 bear-py-0.5",md:"bear-text-xs bear-px-2 bear-py-0.5",lg:"bear-text-sm bear-px-2 bear-py-1"},_=1e4,s="nearest",I={sm:"bear-w-3.5 bear-h-3.5",md:"bear-w-4 bear-h-4",lg:"bear-w-5 bear-h-5"};exports.DEFAULT_EMPTY_TEXT=a;exports.DEFAULT_MAX_VISIBLE=r;exports.DEFAULT_PLACEHOLDER=e;exports.DROPDOWN_Z_INDEX=_;exports.ICON_SIZE=I;exports.OPTION_HEIGHT=t;exports.OPTION_SIZE_CLASSES=E;exports.SCROLL_BLOCK=s;exports.TAG_SIZE_CLASSES=S;exports.TRIGGER_SIZE_CLASSES=b;
|
|
@@ -14,7 +14,7 @@ export declare const OPTION_SIZE_CLASSES: Record<NavigableSelectSize, string>;
|
|
|
14
14
|
/** Tag size classes (multi-select chips) */
|
|
15
15
|
export declare const TAG_SIZE_CLASSES: Record<NavigableSelectSize, string>;
|
|
16
16
|
/** Dropdown z-index */
|
|
17
|
-
export declare const DROPDOWN_Z_INDEX =
|
|
17
|
+
export declare const DROPDOWN_Z_INDEX = 10000;
|
|
18
18
|
/** Search input debounce delay */
|
|
19
19
|
export declare const SEARCH_DEBOUNCE = 0;
|
|
20
20
|
/** Scroll into view block setting */
|
|
@@ -14,7 +14,7 @@ const e = "Select an option...", a = "No options found", b = 8, r = {
|
|
|
14
14
|
sm: "bear-text-xs bear-px-1.5 bear-py-0.5",
|
|
15
15
|
md: "bear-text-xs bear-px-2 bear-py-0.5",
|
|
16
16
|
lg: "bear-text-sm bear-px-2 bear-py-1"
|
|
17
|
-
}, p =
|
|
17
|
+
}, p = 1e4, E = "nearest", o = {
|
|
18
18
|
sm: "bear-w-3.5 bear-h-3.5",
|
|
19
19
|
md: "bear-w-4 bear-h-4",
|
|
20
20
|
lg: "bear-w-5 bear-h-5"
|