@forgedevstack/bear 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/components/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/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/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/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/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 +3 -2
- package/dist/components/Stepper/Stepper.const.js +15 -14
- package/dist/components/Stepper/Stepper.d.ts +0 -7
- package/dist/components/Stepper/Stepper.js +164 -117
- package/dist/components/Stepper/Stepper.types.d.ts +3 -0
- 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/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/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 +5 -3
- package/dist/components/index.js +292 -286
- 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 +386 -379
- package/dist/styles/_effects.css +17 -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
package/dist/components/TimePicker/components/TimePickerDialDropdown/TimePickerDialDropdown.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useState as R, useCallback as v } from "react";
|
|
3
|
-
import { cn as
|
|
3
|
+
import { cn as n } from "../../../../utils/cn.js";
|
|
4
4
|
import { TIMEPICKER_DEFAULT_TRANSLATIONS as B, CLOCK_HOURS_12 as L, TIMEPICKER_FOOTER_CLASSES as D, TIMEPICKER_CLEAR_BUTTON_CLASSES as K, TIMEPICKER_CONFIRM_BUTTON_CLASSES as z, TIMEPICKER_DROPDOWN_CLASSES as w } from "../../TimePicker.constants.js";
|
|
5
5
|
import { ClockFaceSvg as F } from "../../helpers/ClockFaceSvg.js";
|
|
6
|
-
const
|
|
7
|
-
selectedHour:
|
|
6
|
+
const k = "bear-text-pink-600 dark:bear-text-pink-400 bear-font-bold bear-bg-pink-50 dark:bear-bg-pink-900/30 bear-rounded bear-px-1", x = "bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-300 bear-cursor-pointer bear-px-1", G = ({
|
|
7
|
+
selectedHour: b,
|
|
8
8
|
setSelectedHour: s,
|
|
9
9
|
selectedMinute: d,
|
|
10
10
|
setSelectedMinute: m,
|
|
11
|
-
period:
|
|
12
|
-
setPeriod:
|
|
11
|
+
period: _,
|
|
12
|
+
setPeriod: p,
|
|
13
13
|
format: a,
|
|
14
|
-
hours:
|
|
14
|
+
hours: u,
|
|
15
15
|
minutes: h,
|
|
16
16
|
timeValue: T,
|
|
17
17
|
clearable: S,
|
|
18
|
-
onChange:
|
|
18
|
+
onChange: o,
|
|
19
19
|
onConfirm: E,
|
|
20
20
|
onClose: C,
|
|
21
21
|
translations: N
|
|
22
22
|
}) => {
|
|
23
|
-
const [I, c] = R("hour"),
|
|
23
|
+
const [I, c] = R("hour"), i = { ...B, ...N }, P = a === "12h" ? b === 12 ? 12 : b % 12 : b, y = d, A = P.toString().padStart(2, "0"), M = y.toString().padStart(2, "0"), O = a === "12h" ? [...L] : u, t = I === "hour", f = t ? O : h, g = v((r) => {
|
|
24
24
|
t ? (s(a === "12h" && r === 0 ? 12 : r), c("minute")) : m(r);
|
|
25
25
|
}, [t, a, s, m]);
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */ e("div", { className: "Bear-TimePicker__dial-title bear-text-center bear-uppercase bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 bear-mb-2", children:
|
|
28
|
-
/* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ l("div", { className: n(w, "Bear-TimePicker__dial bear-w-72"), children: [
|
|
27
|
+
/* @__PURE__ */ e("div", { className: "Bear-TimePicker__dial-title bear-text-center bear-uppercase bear-text-xs bear-text-gray-500 dark:bear-text-zinc-400 bear-mb-2", children: i.selectTime }),
|
|
28
|
+
/* @__PURE__ */ l("div", { className: "Bear-TimePicker__dial-display bear-flex bear-items-center bear-justify-center bear-gap-1 bear-mb-4", children: [
|
|
29
29
|
/* @__PURE__ */ e(
|
|
30
30
|
"button",
|
|
31
31
|
{
|
|
32
32
|
type: "button",
|
|
33
33
|
onClick: () => c("hour"),
|
|
34
|
-
className:
|
|
34
|
+
className: n(
|
|
35
35
|
"Bear-TimePicker__dial-hour-btn bear-text-2xl bear-font-bold bear-transition-colors bear-border-none bear-bg-transparent",
|
|
36
|
-
t ?
|
|
36
|
+
t ? k : x
|
|
37
37
|
),
|
|
38
|
-
"aria-label":
|
|
38
|
+
"aria-label": i.hour,
|
|
39
39
|
children: A
|
|
40
40
|
}
|
|
41
41
|
),
|
|
@@ -45,21 +45,21 @@ const x = "bear-text-blue-600 dark:bear-text-blue-400 bear-font-bold bear-bg-blu
|
|
|
45
45
|
{
|
|
46
46
|
type: "button",
|
|
47
47
|
onClick: () => c("minute"),
|
|
48
|
-
className:
|
|
48
|
+
className: n(
|
|
49
49
|
"Bear-TimePicker__dial-minute-btn bear-text-2xl bear-font-bold bear-transition-colors bear-border-none bear-bg-transparent",
|
|
50
|
-
t ?
|
|
50
|
+
t ? x : k
|
|
51
51
|
),
|
|
52
|
-
"aria-label":
|
|
52
|
+
"aria-label": i.minute,
|
|
53
53
|
children: M
|
|
54
54
|
}
|
|
55
55
|
),
|
|
56
56
|
a === "12h" && /* @__PURE__ */ e("div", { className: "Bear-TimePicker__dial-period bear-flex bear-flex-col bear-gap-0.5 bear-ml-2", children: ["AM", "PM"].map((r) => /* @__PURE__ */ e(
|
|
57
57
|
"button",
|
|
58
58
|
{
|
|
59
|
-
onClick: () =>
|
|
60
|
-
className:
|
|
59
|
+
onClick: () => p(r),
|
|
60
|
+
className: n(
|
|
61
61
|
"Bear-TimePicker__dial-period-btn bear-px-2 bear-py-0.5 bear-rounded bear-text-sm bear-transition-colors",
|
|
62
|
-
|
|
62
|
+
_ === r ? "bear-text-pink-600 dark:bear-text-pink-400 bear-font-medium" : "bear-text-gray-400 dark:bear-text-zinc-500 hover:bear-text-gray-600 dark:hover:bear-text-zinc-400"
|
|
63
63
|
),
|
|
64
64
|
children: r
|
|
65
65
|
},
|
|
@@ -72,16 +72,16 @@ const x = "bear-text-blue-600 dark:bear-text-blue-400 bear-font-bold bear-bg-blu
|
|
|
72
72
|
values: f,
|
|
73
73
|
isHourMode: t,
|
|
74
74
|
format: a,
|
|
75
|
-
selectedHour:
|
|
75
|
+
selectedHour: b,
|
|
76
76
|
selectedMinute: d,
|
|
77
77
|
onSelect: g
|
|
78
78
|
}
|
|
79
79
|
) }),
|
|
80
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ l("div", { className: D, children: [
|
|
81
81
|
S && T && /* @__PURE__ */ e("button", { onClick: () => {
|
|
82
|
-
|
|
83
|
-
}, className: K, children:
|
|
84
|
-
/* @__PURE__ */ e("button", { onClick: E, className: z, children:
|
|
82
|
+
o == null || o(null), C();
|
|
83
|
+
}, className: K, children: i.cancel }),
|
|
84
|
+
/* @__PURE__ */ e("button", { onClick: E, className: z, children: i.ok })
|
|
85
85
|
] })
|
|
86
86
|
] });
|
|
87
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("../../../utils/cn.cjs");require("react");const e=require("../TimePicker.constants.cjs"),x=16,S=14,O=.85,R=.6,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),m=require("../../../utils/cn.cjs");require("react");const e=require("../TimePicker.constants.cjs"),x=16,S=14,O=.85,R=.6,A=30,a=90,l=Math.PI/180,f=({values:o,isHourMode:t,format:_,selectedHour:n,selectedMinute:C,onSelect:L,className:N})=>{const b=c=>t?(c*A-a)*l:(c*(360/o.length)-a)*l,E=(t?(_==="12h"?n===12?0:n%12:n)*A-a:C*6-a)*l;return r.jsxs("svg",{viewBox:"0 0 200 200",className:m.cn("Bear-TimePicker__clock-face bear-w-full bear-h-full",N),children:[r.jsx("circle",{cx:e.CLOCK_CENTER,cy:e.CLOCK_CENTER,r:e.CLOCK_RADIUS,className:"Bear-TimePicker__clock-face-circle bear-fill-none bear-stroke-gray-200 dark:bear-stroke-zinc-700 bear-stroke-2"}),o.map((c,h)=>{const T=b(h),i=e.CLOCK_CENTER+e.CLOCK_RADIUS*O*Math.cos(T),s=e.CLOCK_CENTER+e.CLOCK_RADIUS*O*Math.sin(T),k=t?_==="12h"?c===12?n===12:n%12===c:n===c:C===c;return r.jsxs("g",{onClick:()=>L(c),className:"Bear-TimePicker__clock-face-item bear-cursor-pointer",children:[r.jsx("circle",{cx:i,cy:s,r:x,fill:"transparent"}),k&&r.jsx("circle",{cx:i,cy:s,r:S,className:"Bear-TimePicker__clock-face-dot bear-fill-pink-500"}),r.jsx("text",{x:i,y:s,textAnchor:"middle",dominantBaseline:"middle",className:m.cn("Bear-TimePicker__clock-face-text bear-text-sm bear-font-medium bear-pointer-events-none",k?"bear-fill-white":"bear-fill-gray-700 dark:bear-fill-zinc-300"),children:typeof c=="number"?c.toString().padStart(2,"0"):c})]},c)}),r.jsx("line",{x1:e.CLOCK_CENTER,y1:e.CLOCK_CENTER,x2:e.CLOCK_CENTER+e.CLOCK_RADIUS*R*Math.cos(E),y2:e.CLOCK_CENTER+e.CLOCK_RADIUS*R*Math.sin(E),className:"Bear-TimePicker__clock-face-hand bear-stroke-pink-500 bear-stroke-2",strokeLinecap:"round"})]})};exports.ClockFaceSvg=f;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as b, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { cn as A } from "../../../utils/cn.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import { CLOCK_RADIUS as n, CLOCK_CENTER as c } from "../TimePicker.constants.js";
|
|
5
|
-
const I = 16, O = 14,
|
|
5
|
+
const I = 16, O = 14, p = 0.85, E = 0.6, x = 30, t = 90, s = Math.PI / 180, C = ({
|
|
6
6
|
values: _,
|
|
7
7
|
isHourMode: i,
|
|
8
8
|
format: m,
|
|
9
9
|
selectedHour: r,
|
|
10
10
|
selectedMinute: k,
|
|
11
|
-
onSelect:
|
|
12
|
-
className:
|
|
11
|
+
onSelect: N,
|
|
12
|
+
className: g
|
|
13
13
|
}) => {
|
|
14
|
-
const d = (e) => i ? (e *
|
|
15
|
-
return /* @__PURE__ */
|
|
14
|
+
const d = (e) => i ? (e * x - t) * s : (e * (360 / _.length) - t) * s, f = (i ? (m === "12h" ? r === 12 ? 0 : r % 12 : r) * x - t : k * 6 - t) * s;
|
|
15
|
+
return /* @__PURE__ */ b("svg", { viewBox: "0 0 200 200", className: A("Bear-TimePicker__clock-face bear-w-full bear-h-full", g), children: [
|
|
16
16
|
/* @__PURE__ */ a(
|
|
17
17
|
"circle",
|
|
18
18
|
{
|
|
@@ -23,25 +23,25 @@ const I = 16, O = 14, E = 0.85, x = 0.6, N = 30, t = 90, s = Math.PI / 180, C =
|
|
|
23
23
|
}
|
|
24
24
|
),
|
|
25
25
|
_.map((e, S) => {
|
|
26
|
-
const
|
|
27
|
-
return /* @__PURE__ */
|
|
26
|
+
const h = d(S), o = c + n * p * Math.cos(h), l = c + n * p * Math.sin(h), T = i ? m === "12h" ? e === 12 ? r === 12 : r % 12 === e : r === e : k === e;
|
|
27
|
+
return /* @__PURE__ */ b(
|
|
28
28
|
"g",
|
|
29
29
|
{
|
|
30
|
-
onClick: () =>
|
|
30
|
+
onClick: () => N(e),
|
|
31
31
|
className: "Bear-TimePicker__clock-face-item bear-cursor-pointer",
|
|
32
32
|
children: [
|
|
33
|
-
/* @__PURE__ */ a("circle", { cx:
|
|
34
|
-
|
|
33
|
+
/* @__PURE__ */ a("circle", { cx: o, cy: l, r: I, fill: "transparent" }),
|
|
34
|
+
T && /* @__PURE__ */ a("circle", { cx: o, cy: l, r: O, className: "Bear-TimePicker__clock-face-dot bear-fill-pink-500" }),
|
|
35
35
|
/* @__PURE__ */ a(
|
|
36
36
|
"text",
|
|
37
37
|
{
|
|
38
|
-
x:
|
|
39
|
-
y:
|
|
38
|
+
x: o,
|
|
39
|
+
y: l,
|
|
40
40
|
textAnchor: "middle",
|
|
41
41
|
dominantBaseline: "middle",
|
|
42
42
|
className: A(
|
|
43
43
|
"Bear-TimePicker__clock-face-text bear-text-sm bear-font-medium bear-pointer-events-none",
|
|
44
|
-
|
|
44
|
+
T ? "bear-fill-white" : "bear-fill-gray-700 dark:bear-fill-zinc-300"
|
|
45
45
|
),
|
|
46
46
|
children: typeof e == "number" ? e.toString().padStart(2, "0") : e
|
|
47
47
|
}
|
|
@@ -56,9 +56,9 @@ const I = 16, O = 14, E = 0.85, x = 0.6, N = 30, t = 90, s = Math.PI / 180, C =
|
|
|
56
56
|
{
|
|
57
57
|
x1: c,
|
|
58
58
|
y1: c,
|
|
59
|
-
x2: c + n *
|
|
60
|
-
y2: c + n *
|
|
61
|
-
className: "Bear-TimePicker__clock-face-hand bear-stroke-
|
|
59
|
+
x2: c + n * E * Math.cos(f),
|
|
60
|
+
y2: c + n * E * Math.sin(f),
|
|
61
|
+
className: "Bear-TimePicker__clock-face-hand bear-stroke-pink-500 bear-stroke-2",
|
|
62
62
|
strokeLinecap: "round"
|
|
63
63
|
}
|
|
64
64
|
)
|
|
@@ -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"),r=require("react"),y=require("../../utils/cn.cjs"),T=require("./Toast.utils.cjs"),p={success:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),info:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),warning:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),error:e.jsxs("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})},k=()=>e.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),C={success:"bear-bg-green-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white",warning:"bear-bg-amber-500 bear-text-white",error:"bear-bg-red-500 bear-text-white"},I={"top-left":"bear-top-4 bear-left-4","top-center":"bear-top-4 bear-left-1/2 bear-transform bear--translate-x-1/2","top-right":"bear-top-4 bear-right-4","bottom-left":"bear-bottom-4 bear-left-4","bottom-center":"bear-bottom-4 bear-left-1/2 bear-transform bear--translate-x-1/2","bottom-right":"bear-bottom-4 bear-right-4"},v=r.createContext(null),E=()=>{const i=r.useContext(v);if(!i)throw new Error("useToast must be used within a ToastProvider");return i},N=({message:i,title:c,severity:b="info",duration:n=5e3,closable:l=!0,icon:s,action:x,onClose:o,onRemove:u,className:g,autoScroll:f=!1})=>{const[j,m]=r.useState(!1),d=r.useRef(null);r.useEffect(()=>{f&&d.current&&d.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},[f]),r.useEffect(()=>{if(n>0){const h=setTimeout(()=>{m(!0),setTimeout(()=>{u(),o==null||o()},200)},n);return()=>clearTimeout(h)}},[n,u,o]);const t=()=>{m(!0),setTimeout(()=>{u(),o==null||o()},200)},a=()=>s===!1?null:s||p[b];return e.jsxs("div",{ref:d,role:"alert",className:y.cn("bear-flex bear-items-start bear-gap-3 bear-p-4 bear-rounded-lg bear-shadow-lg bear-min-w-[300px] bear-max-w-[400px]","bear-transition-all bear-duration-200",j?"bear-opacity-0 bear-translate-x-2":"bear-opacity-100 bear-translate-x-0",C[b],g),children:[a()&&e.jsx("span",{className:"bear-flex-shrink-0 bear-mt-0.5",children:a()}),e.jsxs("div",{className:"bear-flex-1 bear-min-w-0",children:[c&&e.jsx("div",{className:"bear-font-semibold bear-mb-0.5",children:c}),e.jsx("div",{className:"bear-text-sm bear-opacity-90",children:i})]}),x&&e.jsx("div",{className:"bear-flex-shrink-0",children:x}),l&&e.jsx("button",{type:"button",onClick:t,className:"bear-flex-shrink-0 bear-p-1 bear-rounded hover:bear-bg-white/20 bear-transition-colors bear-bg-transparent bear-border-none bear-cursor-pointer","aria-label":"Close",children:e.jsx(k,{})})]})},w=({position:i="top-right",maxToasts:c=5,className:b})=>{const n=r.useContext(v);if(!n)return null;const{_toasts:l,_removeToast:s}=n,x=l.slice(0,c);return e.jsx("div",{className:y.cn("bear-fixed bear-z-[11000] bear-flex bear-flex-col bear-gap-2",I[i],b),children:x.map(o=>e.jsx(N,{...o,onRemove:()=>s(o.id)},o.id))})},S=({children:i,position:c="top-right"})=>{const[b,n]=r.useState([]),l=r.useCallback(t=>{n(a=>a.filter(h=>h.id!==t))},[]),s=r.useCallback(t=>{const a=t.id||T.generateId();return n(h=>[...h,{...t,id:a}]),a},[]),x=r.useCallback(t=>s(t),[s]),o=r.useCallback((t,a)=>s({message:t,severity:"success",...a}),[s]),u=r.useCallback((t,a)=>s({message:t,severity:"info",...a}),[s]),g=r.useCallback((t,a)=>s({message:t,severity:"warning",...a}),[s]),f=r.useCallback((t,a)=>s({message:t,severity:"error",...a}),[s]),j=r.useCallback(t=>l(t),[l]),m=r.useCallback(()=>n([]),[]),d={toast:x,success:o,info:u,warning:g,error:f,dismiss:j,dismissAll:m,_toasts:b,_removeToast:l};return e.jsxs(v.Provider,{value:d,children:[i,e.jsx(w,{position:c})]})};exports.ToastContainer=w;exports.ToastProvider=S;exports.useToast=E;
|
|
@@ -1,159 +1,163 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { generateId as
|
|
5
|
-
const
|
|
6
|
-
success: /* @__PURE__ */
|
|
1
|
+
import { jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as N, useContext as T, useState as k, useCallback as n, useRef as E, useEffect as y } from "react";
|
|
3
|
+
import { cn as I } from "../../utils/cn.js";
|
|
4
|
+
import { generateId as S } from "./Toast.utils.js";
|
|
5
|
+
const _ = {
|
|
6
|
+
success: /* @__PURE__ */ l("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
7
7
|
/* @__PURE__ */ e("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
|
|
8
8
|
/* @__PURE__ */ e("polyline", { points: "22 4 12 14.01 9 11.01" })
|
|
9
9
|
] }),
|
|
10
|
-
info: /* @__PURE__ */
|
|
10
|
+
info: /* @__PURE__ */ l("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
11
11
|
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
|
|
12
12
|
/* @__PURE__ */ e("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
|
|
13
13
|
/* @__PURE__ */ e("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
|
|
14
14
|
] }),
|
|
15
|
-
warning: /* @__PURE__ */
|
|
15
|
+
warning: /* @__PURE__ */ l("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
16
16
|
/* @__PURE__ */ e("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }),
|
|
17
17
|
/* @__PURE__ */ e("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
18
18
|
/* @__PURE__ */ e("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
19
19
|
] }),
|
|
20
|
-
error: /* @__PURE__ */
|
|
20
|
+
error: /* @__PURE__ */ l("svg", { width: 20, height: 20, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
21
21
|
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
|
|
22
22
|
/* @__PURE__ */ e("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
|
|
23
23
|
/* @__PURE__ */ e("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
24
24
|
] })
|
|
25
|
-
},
|
|
25
|
+
}, B = () => /* @__PURE__ */ l("svg", { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, children: [
|
|
26
26
|
/* @__PURE__ */ e("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
27
27
|
/* @__PURE__ */ e("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
28
|
-
] }),
|
|
28
|
+
] }), W = {
|
|
29
29
|
success: "bear-bg-green-500 bear-text-white",
|
|
30
30
|
info: "bear-bg-blue-500 bear-text-white",
|
|
31
31
|
warning: "bear-bg-amber-500 bear-text-white",
|
|
32
32
|
error: "bear-bg-red-500 bear-text-white"
|
|
33
|
-
},
|
|
33
|
+
}, C = {
|
|
34
34
|
"top-left": "bear-top-4 bear-left-4",
|
|
35
35
|
"top-center": "bear-top-4 bear-left-1/2 bear-transform bear--translate-x-1/2",
|
|
36
36
|
"top-right": "bear-top-4 bear-right-4",
|
|
37
37
|
"bottom-left": "bear-bottom-4 bear-left-4",
|
|
38
38
|
"bottom-center": "bear-bottom-4 bear-left-1/2 bear-transform bear--translate-x-1/2",
|
|
39
39
|
"bottom-right": "bear-bottom-4 bear-right-4"
|
|
40
|
-
}, w =
|
|
41
|
-
const
|
|
42
|
-
if (!
|
|
40
|
+
}, w = N(null), M = () => {
|
|
41
|
+
const i = T(w);
|
|
42
|
+
if (!i)
|
|
43
43
|
throw new Error("useToast must be used within a ToastProvider");
|
|
44
|
-
return
|
|
45
|
-
},
|
|
46
|
-
message:
|
|
44
|
+
return i;
|
|
45
|
+
}, L = ({
|
|
46
|
+
message: i,
|
|
47
47
|
title: b,
|
|
48
|
-
severity:
|
|
48
|
+
severity: h = "info",
|
|
49
49
|
duration: o = 5e3,
|
|
50
|
-
closable:
|
|
50
|
+
closable: c = !0,
|
|
51
51
|
icon: t,
|
|
52
|
-
action:
|
|
53
|
-
onClose:
|
|
52
|
+
action: d,
|
|
53
|
+
onClose: s,
|
|
54
54
|
onRemove: x,
|
|
55
|
-
className:
|
|
55
|
+
className: p,
|
|
56
|
+
autoScroll: m = !1
|
|
56
57
|
}) => {
|
|
57
|
-
const [
|
|
58
|
-
|
|
58
|
+
const [v, g] = k(!1), u = E(null);
|
|
59
|
+
y(() => {
|
|
60
|
+
m && u.current && u.current.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
61
|
+
}, [m]), y(() => {
|
|
59
62
|
if (o > 0) {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
x(),
|
|
63
|
+
const f = setTimeout(() => {
|
|
64
|
+
g(!0), setTimeout(() => {
|
|
65
|
+
x(), s == null || s();
|
|
63
66
|
}, 200);
|
|
64
67
|
}, o);
|
|
65
|
-
return () => clearTimeout(
|
|
68
|
+
return () => clearTimeout(f);
|
|
66
69
|
}
|
|
67
|
-
}, [o, x,
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
x(),
|
|
70
|
+
}, [o, x, s]);
|
|
71
|
+
const r = () => {
|
|
72
|
+
g(!0), setTimeout(() => {
|
|
73
|
+
x(), s == null || s();
|
|
71
74
|
}, 200);
|
|
72
|
-
},
|
|
73
|
-
return /* @__PURE__ */
|
|
75
|
+
}, a = () => t === !1 ? null : t || _[h];
|
|
76
|
+
return /* @__PURE__ */ l(
|
|
74
77
|
"div",
|
|
75
78
|
{
|
|
79
|
+
ref: u,
|
|
76
80
|
role: "alert",
|
|
77
|
-
className:
|
|
81
|
+
className: I(
|
|
78
82
|
"bear-flex bear-items-start bear-gap-3 bear-p-4 bear-rounded-lg bear-shadow-lg bear-min-w-[300px] bear-max-w-[400px]",
|
|
79
83
|
"bear-transition-all bear-duration-200",
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
v ? "bear-opacity-0 bear-translate-x-2" : "bear-opacity-100 bear-translate-x-0",
|
|
85
|
+
W[h],
|
|
86
|
+
p
|
|
83
87
|
),
|
|
84
88
|
children: [
|
|
85
|
-
|
|
86
|
-
/* @__PURE__ */
|
|
89
|
+
a() && /* @__PURE__ */ e("span", { className: "bear-flex-shrink-0 bear-mt-0.5", children: a() }),
|
|
90
|
+
/* @__PURE__ */ l("div", { className: "bear-flex-1 bear-min-w-0", children: [
|
|
87
91
|
b && /* @__PURE__ */ e("div", { className: "bear-font-semibold bear-mb-0.5", children: b }),
|
|
88
|
-
/* @__PURE__ */ e("div", { className: "bear-text-sm bear-opacity-90", children:
|
|
92
|
+
/* @__PURE__ */ e("div", { className: "bear-text-sm bear-opacity-90", children: i })
|
|
89
93
|
] }),
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
d && /* @__PURE__ */ e("div", { className: "bear-flex-shrink-0", children: d }),
|
|
95
|
+
c && /* @__PURE__ */ e(
|
|
92
96
|
"button",
|
|
93
97
|
{
|
|
94
98
|
type: "button",
|
|
95
|
-
onClick:
|
|
99
|
+
onClick: r,
|
|
96
100
|
className: "bear-flex-shrink-0 bear-p-1 bear-rounded hover:bear-bg-white/20 bear-transition-colors bear-bg-transparent bear-border-none bear-cursor-pointer",
|
|
97
101
|
"aria-label": "Close",
|
|
98
|
-
children: /* @__PURE__ */ e(
|
|
102
|
+
children: /* @__PURE__ */ e(B, {})
|
|
99
103
|
}
|
|
100
104
|
)
|
|
101
105
|
]
|
|
102
106
|
}
|
|
103
107
|
);
|
|
104
|
-
},
|
|
105
|
-
position:
|
|
108
|
+
}, P = ({
|
|
109
|
+
position: i = "top-right",
|
|
106
110
|
maxToasts: b = 5,
|
|
107
|
-
className:
|
|
111
|
+
className: h
|
|
108
112
|
}) => {
|
|
109
|
-
const o =
|
|
113
|
+
const o = T(w);
|
|
110
114
|
if (!o) return null;
|
|
111
|
-
const { _toasts:
|
|
115
|
+
const { _toasts: c, _removeToast: t } = o, d = c.slice(0, b);
|
|
112
116
|
return /* @__PURE__ */ e(
|
|
113
117
|
"div",
|
|
114
118
|
{
|
|
115
|
-
className:
|
|
116
|
-
"bear-fixed bear-z-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
+
className: I(
|
|
120
|
+
"bear-fixed bear-z-[11000] bear-flex bear-flex-col bear-gap-2",
|
|
121
|
+
C[i],
|
|
122
|
+
h
|
|
119
123
|
),
|
|
120
|
-
children:
|
|
121
|
-
|
|
124
|
+
children: d.map((s) => /* @__PURE__ */ e(
|
|
125
|
+
L,
|
|
122
126
|
{
|
|
123
|
-
...
|
|
124
|
-
onRemove: () => t(
|
|
127
|
+
...s,
|
|
128
|
+
onRemove: () => t(s.id)
|
|
125
129
|
},
|
|
126
|
-
|
|
130
|
+
s.id
|
|
127
131
|
))
|
|
128
132
|
}
|
|
129
133
|
);
|
|
130
|
-
},
|
|
131
|
-
children:
|
|
134
|
+
}, O = ({
|
|
135
|
+
children: i,
|
|
132
136
|
position: b = "top-right"
|
|
133
137
|
}) => {
|
|
134
|
-
const [
|
|
135
|
-
o((
|
|
136
|
-
}, []), t =
|
|
137
|
-
const
|
|
138
|
-
return o((
|
|
139
|
-
}, []),
|
|
140
|
-
toast:
|
|
141
|
-
success:
|
|
138
|
+
const [h, o] = k([]), c = n((r) => {
|
|
139
|
+
o((a) => a.filter((f) => f.id !== r));
|
|
140
|
+
}, []), t = n((r) => {
|
|
141
|
+
const a = r.id || S();
|
|
142
|
+
return o((f) => [...f, { ...r, id: a }]), a;
|
|
143
|
+
}, []), d = n((r) => t(r), [t]), s = n((r, a) => t({ message: r, severity: "success", ...a }), [t]), x = n((r, a) => t({ message: r, severity: "info", ...a }), [t]), p = n((r, a) => t({ message: r, severity: "warning", ...a }), [t]), m = n((r, a) => t({ message: r, severity: "error", ...a }), [t]), v = n((r) => c(r), [c]), g = n(() => o([]), []), u = {
|
|
144
|
+
toast: d,
|
|
145
|
+
success: s,
|
|
142
146
|
info: x,
|
|
143
|
-
warning:
|
|
144
|
-
error:
|
|
145
|
-
dismiss:
|
|
146
|
-
dismissAll:
|
|
147
|
-
_toasts:
|
|
148
|
-
_removeToast:
|
|
147
|
+
warning: p,
|
|
148
|
+
error: m,
|
|
149
|
+
dismiss: v,
|
|
150
|
+
dismissAll: g,
|
|
151
|
+
_toasts: h,
|
|
152
|
+
_removeToast: c
|
|
149
153
|
};
|
|
150
|
-
return /* @__PURE__ */
|
|
151
|
-
|
|
152
|
-
/* @__PURE__ */ e(
|
|
154
|
+
return /* @__PURE__ */ l(w.Provider, { value: u, children: [
|
|
155
|
+
i,
|
|
156
|
+
/* @__PURE__ */ e(P, { position: b })
|
|
153
157
|
] });
|
|
154
158
|
};
|
|
155
159
|
export {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
160
|
+
P as ToastContainer,
|
|
161
|
+
O as ToastProvider,
|
|
162
|
+
M as useToast
|
|
159
163
|
};
|
|
@@ -22,6 +22,8 @@ export interface ToastProps {
|
|
|
22
22
|
onClose?: () => void;
|
|
23
23
|
/** Additional CSS class */
|
|
24
24
|
className?: string;
|
|
25
|
+
/** Scroll the toast into view when it appears */
|
|
26
|
+
autoScroll?: boolean;
|
|
25
27
|
}
|
|
26
28
|
export interface ToastContainerProps {
|
|
27
29
|
/** Position of toast container */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),t=require("react"),M=require("react-dom"),B=require("../../utils/cn.cjs"),j=({content:p,children:w,position:x,placement:R,delay:v=200,className:y,disabled:T=!1})=>{const u=R||x||"top",[i,b]=t.useState(!1),[f,E]=t.useState({x:0,y:0}),d=t.useRef(null),h=t.useRef(null),s=t.useRef(),c=t.useCallback(()=>{if(!d.current||!h.current)return;const e=d.current.getBoundingClientRect(),r=h.current.getBoundingClientRect(),l=8;let o=0,n=0;switch(u){case"top":o=e.left+(e.width-r.width)/2,n=e.top-r.height-l;break;case"bottom":o=e.left+(e.width-r.width)/2,n=e.bottom+l;break;case"left":o=e.left-r.width-l,n=e.top+(e.height-r.height)/2;break;case"right":o=e.right+l,n=e.top+(e.height-r.height)/2;break}o=Math.max(8,Math.min(o,window.innerWidth-r.width-8)),n=Math.max(8,Math.min(n,window.innerHeight-r.height-8)),E({x:o,y:n})},[u]),g=()=>{T||(s.current=setTimeout(()=>{b(!0)},v))},m=()=>{s.current&&clearTimeout(s.current),b(!1)};return t.useEffect(()=>{i&&c()},[i,c]),t.useEffect(()=>{if(!i)return;const e=()=>{requestAnimationFrame(()=>c())};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[i,c]),t.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]),a.jsxs(a.Fragment,{children:[a.jsx("div",{ref:d,onMouseEnter:g,onMouseLeave:m,onFocus:g,onBlur:m,className:"Bear-Tooltip__trigger bear-inline-block",children:w}),i&&M.createPortal(a.jsx("div",{ref:h,role:"tooltip",style:{left:f.x,top:f.y},className:B.cn("bear-fixed bear-z-[11000]","Bear-Tooltip",`Bear-Tooltip--${u}`,"bear-px-3 bear-py-2 bear-rounded-lg","bear-bg-gray-800 bear-text-white bear-text-sm","bear-border bear-border-gray-700","bear-shadow-lg","bear-animate-in bear-fade-in bear-duration-150",y),children:a.jsx("span",{className:"Bear-Tooltip__content",children:p})}),document.body)]})};exports.Tooltip=j;
|