@forgedevstack/bear 1.1.4 → 1.1.9
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 +21 -2
- package/dist/components/Anchor/Anchor.cjs +1 -1
- package/dist/components/Anchor/Anchor.js +37 -45
- package/dist/components/Anchor/Anchor.utils.cjs +1 -0
- package/dist/components/Anchor/Anchor.utils.d.ts +2 -0
- package/dist/components/Anchor/Anchor.utils.js +12 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
- package/dist/components/Autocomplete/Autocomplete.js +60 -67
- package/dist/components/Autocomplete/Autocomplete.utils.cjs +1 -0
- package/dist/components/Autocomplete/Autocomplete.utils.d.ts +2 -0
- package/dist/components/Autocomplete/Autocomplete.utils.js +12 -0
- package/dist/components/BackTop/BackTop.cjs +1 -1
- package/dist/components/BackTop/BackTop.js +10 -11
- package/dist/components/BearLogo/BearLogo.d.ts +2 -7
- package/dist/components/BearLogo/BearLogo.types.d.ts +15 -0
- package/dist/components/BearLogo/EmberLogo.d.ts +1 -8
- package/dist/components/BearLogo/index.d.ts +1 -2
- package/dist/components/Biometric/Biometric.cjs +1 -0
- package/dist/components/Biometric/Biometric.d.ts +3 -0
- package/dist/components/Biometric/Biometric.js +123 -0
- package/dist/components/Biometric/Biometric.types.d.ts +35 -0
- package/dist/components/Biometric/BiometricIcon.cjs +1 -0
- package/dist/components/Biometric/BiometricIcon.d.ts +3 -0
- package/dist/components/Biometric/BiometricIcon.js +45 -0
- package/dist/components/Biometric/index.d.ts +3 -0
- package/dist/components/Biometric/useBiometric.cjs +1 -0
- package/dist/components/Biometric/useBiometric.d.ts +2 -0
- package/dist/components/Biometric/useBiometric.js +21 -0
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.constants.cjs +2 -2
- package/dist/components/Button/Button.constants.d.ts +1 -0
- package/dist/components/Button/Button.constants.js +12 -5
- package/dist/components/Button/Button.d.ts +0 -27
- package/dist/components/Button/Button.js +93 -105
- package/dist/components/Button/Button.types.d.ts +1 -0
- package/dist/components/Button/Button.utils.cjs +1 -0
- package/dist/components/Button/Button.utils.d.ts +2 -0
- package/dist/components/Button/Button.utils.js +5 -0
- package/dist/components/Button/useSpotlight.cjs +1 -0
- package/dist/components/Button/useSpotlight.d.ts +21 -0
- package/dist/components/Button/useSpotlight.js +28 -0
- package/dist/components/Chart/Chart.cjs +1 -1
- package/dist/components/Chart/Chart.const.cjs +1 -0
- package/dist/components/Chart/Chart.const.js +21 -0
- package/dist/components/Chart/Chart.js +55 -71
- package/dist/components/Chart/Chart.utils.cjs +1 -0
- package/dist/components/Chart/Chart.utils.js +5 -0
- package/dist/components/Confetti/Confetti.cjs +1 -1
- package/dist/components/Confetti/Confetti.js +37 -34
- package/dist/components/ContextMenu/ContextMenu.cjs +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +31 -30
- package/dist/components/ContextMenu/ContextMenu.utils.cjs +1 -0
- package/dist/components/ContextMenu/ContextMenu.utils.d.ts +5 -0
- package/dist/components/ContextMenu/ContextMenu.utils.js +4 -0
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
- package/dist/components/CountdownTimer/CountdownTimer.js +62 -71
- package/dist/components/CountdownTimer/CountdownTimer.utils.cjs +1 -0
- package/dist/components/CountdownTimer/CountdownTimer.utils.d.ts +3 -0
- package/dist/components/CountdownTimer/CountdownTimer.utils.js +16 -0
- package/dist/components/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.const.cjs +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.const.js +12 -13
- package/dist/components/DateRangePicker/DateRangePicker.js +107 -81
- package/dist/components/Dock/Dock.cjs +1 -1
- package/dist/components/Dock/Dock.js +38 -43
- package/dist/components/Dock/Dock.utils.cjs +1 -0
- package/dist/components/Dock/Dock.utils.d.ts +1 -0
- package/dist/components/Dock/Dock.utils.js +10 -0
- package/dist/components/Dropdown/Dropdown.cjs +1 -1
- package/dist/components/Dropdown/Dropdown.js +77 -74
- package/dist/components/FileTree/FileTree.cjs +1 -1
- package/dist/components/FileTree/FileTree.js +20 -32
- package/dist/components/FileTree/FileTree.utils.cjs +1 -0
- package/dist/components/FileTree/FileTree.utils.d.ts +4 -0
- package/dist/components/FileTree/FileTree.utils.js +15 -0
- package/dist/components/GradientText/GradientText.cjs +1 -1
- package/dist/components/GradientText/GradientText.js +27 -29
- package/dist/components/Icon/icons/bear.cjs +1 -0
- package/dist/components/Icon/icons/bear.d.ts +12 -0
- package/dist/components/Icon/icons/bear.js +47 -0
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.d.ts +18 -0
- package/dist/components/Icon/index.js +17 -15
- package/dist/components/InfiniteScroll/InfiniteScroll.cjs +1 -1
- package/dist/components/InfiniteScroll/InfiniteScroll.const.cjs +1 -1
- package/dist/components/InfiniteScroll/InfiniteScroll.const.js +6 -7
- package/dist/components/InfiniteScroll/InfiniteScroll.js +41 -41
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.js +153 -101
- package/dist/components/Input/Input.types.d.ts +8 -2
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
- package/dist/components/MentionsInput/MentionsInput.js +64 -68
- package/dist/components/MentionsInput/MentionsInput.utils.cjs +1 -0
- package/dist/components/MentionsInput/MentionsInput.utils.d.ts +2 -0
- package/dist/components/MentionsInput/MentionsInput.utils.js +9 -0
- package/dist/components/PageNav/PageNav.cjs +1 -0
- package/dist/components/PageNav/PageNav.const.cjs +1 -0
- package/dist/components/PageNav/PageNav.const.d.ts +22 -0
- package/dist/components/PageNav/PageNav.const.js +42 -0
- package/dist/components/PageNav/PageNav.d.ts +3 -0
- package/dist/components/PageNav/PageNav.js +81 -0
- package/dist/components/PageNav/PageNav.types.d.ts +17 -0
- package/dist/components/PageNav/index.d.ts +2 -0
- package/dist/components/Popover/Popover.cjs +1 -1
- package/dist/components/Popover/Popover.js +76 -76
- package/dist/components/Progress/Progress.cjs +1 -1
- package/dist/components/Progress/Progress.js +6 -6
- package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.d.ts +11 -0
- package/dist/components/PropsPlayground/PropsPlayground.const.js +23 -0
- package/dist/components/PropsPlayground/PropsPlayground.d.ts +3 -0
- package/dist/components/PropsPlayground/PropsPlayground.js +221 -0
- package/dist/components/PropsPlayground/PropsPlayground.types.d.ts +29 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.cjs +1 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.d.ts +2 -0
- package/dist/components/PropsPlayground/PropsPlayground.utils.js +9 -0
- package/dist/components/PropsPlayground/index.d.ts +2 -0
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +54 -53
- package/dist/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/SignPad/SignPad.js +24 -24
- package/dist/components/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/Skeleton/Skeleton.js +89 -94
- package/dist/components/Skeleton/Skeleton.utils.cjs +1 -0
- package/dist/components/Skeleton/Skeleton.utils.d.ts +1 -0
- package/dist/components/Skeleton/Skeleton.utils.js +10 -0
- package/dist/components/SliderRange/SliderRange.cjs +1 -1
- package/dist/components/SliderRange/SliderRange.js +61 -63
- package/dist/components/SliderRange/SliderRange.utils.cjs +1 -0
- package/dist/components/SliderRange/SliderRange.utils.d.ts +1 -0
- package/dist/components/SliderRange/SliderRange.utils.js +7 -0
- package/dist/components/Spotlight/Spotlight.cjs +1 -1
- package/dist/components/Spotlight/Spotlight.js +62 -73
- package/dist/components/Spotlight/Spotlight.utils.cjs +1 -0
- package/dist/components/Spotlight/Spotlight.utils.d.ts +3 -0
- package/dist/components/Spotlight/Spotlight.utils.js +18 -0
- package/dist/components/Tabs/TabList.cjs +1 -0
- package/dist/components/Tabs/TabList.d.ts +3 -0
- package/dist/components/Tabs/TabList.js +69 -0
- package/dist/components/Tabs/TabPanel.cjs +1 -0
- package/dist/components/Tabs/TabPanel.d.ts +3 -0
- package/dist/components/Tabs/TabPanel.js +13 -0
- package/dist/components/Tabs/Tabs.cjs +1 -1
- package/dist/components/Tabs/Tabs.d.ts +2 -27
- package/dist/components/Tabs/Tabs.js +43 -61
- package/dist/components/Tabs/Tabs.types.d.ts +7 -1
- package/dist/components/Tabs/index.d.ts +3 -1
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +18 -17
- package/dist/components/Toast/Toast.utils.cjs +1 -0
- package/dist/components/Toast/Toast.utils.d.ts +1 -0
- package/dist/components/Toast/Toast.utils.js +4 -0
- package/dist/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/components/Tooltip/Tooltip.js +10 -11
- package/dist/components/Tour/Tour.cjs +1 -1
- package/dist/components/Tour/Tour.js +1 -2
- package/dist/components/VirtualList/VirtualList.cjs +1 -1
- package/dist/components/VirtualList/VirtualList.js +38 -43
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +9 -2
- package/dist/components/index.js +311 -300
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +60 -58
- package/dist/hooks/useResizeObserver/index.d.ts +2 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.cjs +1 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.d.ts +3 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.js +20 -0
- package/dist/hooks/useResizeObserver/useResizeObserver.types.d.ts +8 -0
- package/dist/icons.cjs +1 -0
- package/dist/icons.d.ts +2 -0
- package/dist/icons.js +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +397 -384
- package/dist/styles/_base.css +7 -3
- package/dist/styles.css +1 -1
- package/package.json +6 -1
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
|
|
1
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as u, useRef as P, useEffect as T, useCallback as v } from "react";
|
|
3
|
+
import { createPortal as se } from "react-dom";
|
|
4
|
+
import { cn as p } from "../../utils/cn.js";
|
|
5
|
+
import { getDefaultPresets as oe, LABEL_CLASSES as le, SIZE_CLASSES as ce, TRIGGER_CLASSES as ie, PRESET_BTN_CLASSES as $, ERROR_CLASSES as de, HELPER_CLASSES as be, ROOT_CLASSES as me, CALENDAR_HEADER_CLASSES as ue, NAV_BTN_CLASSES as G, MONTH_LABELS as pe, DAY_LABELS as he, DAY_TODAY_CLASSES as Se, DAY_IN_RANGE_CLASSES as fe, DAY_SELECTED_CLASSES as ge, DAY_DISABLED_CLASSES as Ee, DAY_HOVER_CLASSES as Le, DAY_BASE_CLASSES as ke } from "./DateRangePicker.const.js";
|
|
6
|
+
import { formatDate as W, getCalendarDays as Ae, isSameDay as Y, isInRange as Ne } from "./DateRangePicker.utils.js";
|
|
7
|
+
const F = ({ year: E, month: c, range: r, onDayClick: L, onNav: k, minDate: d, maxDate: A }) => {
|
|
8
|
+
const N = Ae(E, c), h = /* @__PURE__ */ new Date();
|
|
9
|
+
return h.setHours(0, 0, 0, 0), /* @__PURE__ */ i("div", { className: "bear-w-64", children: [
|
|
10
|
+
/* @__PURE__ */ i("div", { className: ue, children: [
|
|
11
|
+
/* @__PURE__ */ t("button", { type: "button", onClick: () => k(-1), className: G, "aria-label": "Previous month", children: /* @__PURE__ */ t("svg", { className: "bear-w-4 bear-h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) }) }),
|
|
12
|
+
/* @__PURE__ */ i("span", { className: "bear-text-sm bear-font-semibold bear-text-gray-900 dark:bear-text-white", children: [
|
|
13
|
+
pe[c],
|
|
13
14
|
" ",
|
|
14
|
-
|
|
15
|
+
E
|
|
15
16
|
] }),
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
+
/* @__PURE__ */ t("button", { type: "button", onClick: () => k(1), className: G, "aria-label": "Next month", children: /* @__PURE__ */ t("svg", { className: "bear-w-4 bear-h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) }) })
|
|
17
18
|
] }),
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
if (!a) return /* @__PURE__ */
|
|
21
|
-
const S =
|
|
22
|
-
return /* @__PURE__ */
|
|
19
|
+
/* @__PURE__ */ t("div", { className: "bear-grid bear-grid-cols-7 bear-gap-0.5 bear-mb-1", children: he.map((a) => /* @__PURE__ */ t("div", { className: "bear-text-xs bear-text-center bear-font-medium bear-text-gray-400 dark:bear-text-zinc-500 bear-py-1", children: a }, a)) }),
|
|
20
|
+
/* @__PURE__ */ t("div", { className: "bear-grid bear-grid-cols-7 bear-gap-0.5", children: N.map((a, x) => {
|
|
21
|
+
if (!a) return /* @__PURE__ */ t("div", {}, `e-${x}`);
|
|
22
|
+
const S = d && a < d || A && a > A, l = Y(a, r.start) || Y(a, r.end), b = Ne(a, r.start, r.end), _ = Y(a, h);
|
|
23
|
+
return /* @__PURE__ */ t(
|
|
23
24
|
"button",
|
|
24
25
|
{
|
|
25
26
|
type: "button",
|
|
26
27
|
disabled: !!S,
|
|
27
|
-
onClick: () =>
|
|
28
|
-
className:
|
|
29
|
-
|
|
30
|
-
S ?
|
|
31
|
-
l &&
|
|
32
|
-
!l &&
|
|
33
|
-
!l && !
|
|
34
|
-
!l && !
|
|
28
|
+
onClick: () => L(a),
|
|
29
|
+
className: p(
|
|
30
|
+
ke,
|
|
31
|
+
S ? Ee : Le,
|
|
32
|
+
l && ge,
|
|
33
|
+
!l && b && fe,
|
|
34
|
+
!l && !b && _ && Se,
|
|
35
|
+
!l && !b && !S && "bear-text-gray-700 dark:bear-text-zinc-300"
|
|
35
36
|
),
|
|
36
37
|
children: a.getDate()
|
|
37
38
|
},
|
|
@@ -39,77 +40,102 @@ const H = ({ year: L, month: o, range: r, onDayClick: A, onNav: N, minDate: i, m
|
|
|
39
40
|
);
|
|
40
41
|
}) })
|
|
41
42
|
] });
|
|
42
|
-
},
|
|
43
|
+
}, Re = (E) => {
|
|
43
44
|
const {
|
|
44
|
-
value:
|
|
45
|
+
value: c,
|
|
45
46
|
onChange: r,
|
|
46
|
-
label:
|
|
47
|
-
placeholder:
|
|
48
|
-
disabled:
|
|
49
|
-
clearable:
|
|
50
|
-
minDate:
|
|
51
|
-
maxDate:
|
|
47
|
+
label: L,
|
|
48
|
+
placeholder: k = "Select date range",
|
|
49
|
+
disabled: d = !1,
|
|
50
|
+
clearable: A = !0,
|
|
51
|
+
minDate: N,
|
|
52
|
+
maxDate: h,
|
|
52
53
|
presets: a,
|
|
53
|
-
showPresets:
|
|
54
|
+
showPresets: x = !0,
|
|
54
55
|
size: S = "md",
|
|
55
56
|
error: l,
|
|
56
|
-
helperText:
|
|
57
|
-
className:
|
|
58
|
-
testId:
|
|
59
|
-
...
|
|
60
|
-
} =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, [
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
helperText: b,
|
|
58
|
+
className: _,
|
|
59
|
+
testId: Z,
|
|
60
|
+
...q
|
|
61
|
+
} = E, [w, D] = u(!1), [H, J] = u({ top: 0, left: 0 }), [s, f] = u(c ?? { start: null, end: null }), [M, C] = u("start"), z = P(null), R = P(null), O = P(null), I = /* @__PURE__ */ new Date(), [m, K] = u(I.getMonth()), [g, Q] = u(I.getFullYear()), U = m === 11 ? 0 : m + 1, X = m === 11 ? g + 1 : g;
|
|
62
|
+
T(() => {
|
|
63
|
+
c && f(c);
|
|
64
|
+
}, [c]), T(() => {
|
|
65
|
+
if (w && R.current) {
|
|
66
|
+
const e = R.current.getBoundingClientRect(), n = 8, o = 400, ne = window.innerHeight - e.bottom < o && e.top > o;
|
|
67
|
+
J({
|
|
68
|
+
top: ne ? e.top - o - n : e.bottom + n,
|
|
69
|
+
left: e.left
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}, [w]), T(() => {
|
|
73
|
+
const e = (n) => {
|
|
74
|
+
var y, B;
|
|
75
|
+
const o = n.target;
|
|
76
|
+
(y = z.current) != null && y.contains(o) || (B = O.current) != null && B.contains(o) || D(!1);
|
|
66
77
|
};
|
|
67
|
-
return document.addEventListener("mousedown",
|
|
78
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
68
79
|
}, []);
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
-
|
|
80
|
+
const j = v((e) => {
|
|
81
|
+
if (M === "start")
|
|
82
|
+
f({ start: e, end: null }), C("end");
|
|
72
83
|
else {
|
|
73
|
-
const n =
|
|
74
|
-
|
|
84
|
+
const n = e >= (s.start ?? e) ? { start: s.start, end: e } : { start: e, end: s.start };
|
|
85
|
+
f(n), C("start"), r == null || r(n);
|
|
75
86
|
}
|
|
76
|
-
}, [
|
|
77
|
-
|
|
78
|
-
}, [r]),
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
}, [r]),
|
|
82
|
-
let n =
|
|
83
|
-
n < 0 && (n = 11,
|
|
84
|
-
}, [
|
|
85
|
-
return /* @__PURE__ */
|
|
86
|
-
|
|
87
|
-
/* @__PURE__ */
|
|
87
|
+
}, [M, s.start, r]), ee = v((e) => {
|
|
88
|
+
f(e), r == null || r(e), D(!1), C("start");
|
|
89
|
+
}, [r]), te = v(() => {
|
|
90
|
+
const e = { start: null, end: null };
|
|
91
|
+
f(e), r == null || r(e), C("start");
|
|
92
|
+
}, [r]), re = v((e) => {
|
|
93
|
+
let n = m + e, o = g;
|
|
94
|
+
n < 0 && (n = 11, o--), n > 11 && (n = 0, o++), K(n), Q(o);
|
|
95
|
+
}, [m, g]), V = a ?? (x ? oe() : []), ae = s.start ? `${W(s.start)}${s.end ? ` – ${W(s.end)}` : ""}` : k;
|
|
96
|
+
return /* @__PURE__ */ i("div", { ref: z, className: p(me, _), "data-testid": Z, ...q, children: [
|
|
97
|
+
L && /* @__PURE__ */ t("label", { className: le, children: L }),
|
|
98
|
+
/* @__PURE__ */ i(
|
|
88
99
|
"button",
|
|
89
100
|
{
|
|
101
|
+
ref: R,
|
|
90
102
|
type: "button",
|
|
91
|
-
disabled:
|
|
92
|
-
onClick: () => !
|
|
93
|
-
className:
|
|
103
|
+
disabled: d,
|
|
104
|
+
onClick: () => !d && D(!w),
|
|
105
|
+
className: p(ie, ce[S], d && "bear-opacity-50 bear-cursor-not-allowed"),
|
|
94
106
|
children: [
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ t("span", { className: p(!s.start && "bear-text-gray-400 dark:bear-text-zinc-500"), children: ae }),
|
|
108
|
+
/* @__PURE__ */ t("svg", { className: "bear-w-4 bear-h-4 bear-ml-2 bear-text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" }) })
|
|
97
109
|
]
|
|
98
110
|
}
|
|
99
111
|
),
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
112
|
+
w && typeof document < "u" && se(
|
|
113
|
+
/* @__PURE__ */ t(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
ref: O,
|
|
117
|
+
"data-bear-daterangepicker-dropdown": !0,
|
|
118
|
+
className: p(
|
|
119
|
+
"bear-fixed bear-z-[9999] bear-bg-white dark:bear-bg-zinc-800 bear-border bear-border-gray-200 dark:bear-border-zinc-700 bear-rounded-xl bear-shadow-xl bear-p-4"
|
|
120
|
+
),
|
|
121
|
+
style: { top: H.top, left: H.left },
|
|
122
|
+
children: /* @__PURE__ */ i("div", { className: "bear-flex bear-gap-4", children: [
|
|
123
|
+
V.length > 0 && /* @__PURE__ */ i("div", { className: "bear-border-r bear-border-gray-200 dark:bear-border-zinc-700 bear-pr-3 bear-space-y-1 bear-min-w-[120px]", children: [
|
|
124
|
+
V.map((e) => /* @__PURE__ */ t("button", { type: "button", onClick: () => ee(e.range()), className: $, children: e.label }, e.label)),
|
|
125
|
+
A && s.start && /* @__PURE__ */ t("button", { type: "button", onClick: te, className: p($, "bear-text-red-500"), children: "Clear" })
|
|
126
|
+
] }),
|
|
127
|
+
/* @__PURE__ */ t(F, { year: g, month: m, range: s, onDayClick: j, onNav: re, minDate: N, maxDate: h }),
|
|
128
|
+
/* @__PURE__ */ t(F, { year: X, month: U, range: s, onDayClick: j, onNav: () => {
|
|
129
|
+
}, minDate: N, maxDate: h })
|
|
130
|
+
] })
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
document.body
|
|
134
|
+
),
|
|
135
|
+
l && /* @__PURE__ */ t("p", { className: de, children: l }),
|
|
136
|
+
!l && b && /* @__PURE__ */ t("p", { className: be, children: b })
|
|
111
137
|
] });
|
|
112
138
|
};
|
|
113
139
|
export {
|
|
114
|
-
|
|
140
|
+
Re as DateRangePicker
|
|
115
141
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("react"),t=require("../../utils/cn.cjs"),a=require("./Dock.const.cjs"),N=require("./Dock.utils.cjs"),O=u=>{const{items:g,position:b="bottom",iconSize:i=a.DEFAULT_ICON_SIZE,magnifiedSize:x=a.DEFAULT_MAGNIFIED_SIZE,magnification:_=!0,magnificationDistance:f=a.DEFAULT_MAGNIFICATION_DISTANCE,showLabels:p=!0,className:h,style:D,testId:I}=u,[l,c]=n.useState(-1),[k,d]=n.useState(""),m=n.useRef(null),y=b==="left"||b==="right",S=n.useCallback((e,o)=>{c(e),d(o.label)},[]),v=n.useCallback(()=>{c(-1),d("")},[]);return r.jsx("div",{ref:m,className:t.cn("Bear-Dock","bear-flex bear-items-end bear-gap-1","bear-rounded-2xl bear-px-2 bear-py-1.5","bear-bg-white/80 dark:bear-bg-gray-900/80","bear-backdrop-blur-xl","bear-border bear-border-gray-200/50 dark:bear-border-gray-700/50","bear-shadow-lg",a.DOCK_POSITION_CLASSES[b],y&&"bear-items-center",h),style:{padding:a.DOCK_PADDING,zIndex:a.DOCK_Z_INDEX,...D},"data-testid":I,role:"toolbar","aria-label":"Dock",onMouseLeave:v,children:g.map((e,o)=>{const s=_?N.getScale(o,l,f,i,x):i;return r.jsxs("div",{className:"Bear-Dock__item bear-relative bear-flex bear-flex-col bear-items-center",children:[p&&l===o&&k&&r.jsx("div",{className:t.cn("Bear-Dock__tooltip","bear-absolute bear-whitespace-nowrap","bear-px-2 bear-py-1 bear-rounded-lg","bear-bg-gray-900 dark:bear-bg-gray-100","bear-text-white dark:bear-text-gray-900","bear-text-xs bear-font-medium","bear-shadow-md bear-pointer-events-none",a.TOOLTIP_POSITION_CLASSES[b]),role:"tooltip",children:e.label}),r.jsx("button",{className:t.cn("Bear-Dock__button","bear-flex bear-items-center bear-justify-center bear-rounded-xl","bear-transition-all bear-origin-bottom","hover:bear-cursor-pointer",e.active&&"bear-ring-2 bear-ring-offset-1",e.disabled&&"bear-opacity-40 bear-cursor-not-allowed"),style:{width:s,height:s,transitionDuration:`${a.SPRING_DURATION}ms`,transitionTimingFunction:"cubic-bezier(0.25, 0.1, 0.25, 1)"},onClick:e.disabled?void 0:e.onClick,onMouseEnter:()=>S(o,e),disabled:e.disabled,"aria-label":e.label,children:r.jsx("span",{className:t.cn("Bear-Dock__icon","bear-flex bear-items-center bear-justify-center","bear-w-full bear-h-full bear-rounded-xl","bear-transition-transform",e.active?"bear-bg-[var(--bear-primary-500)] bear-text-white":"bear-bg-gray-100 dark:bear-bg-gray-800"),style:{fontSize:s*a.ICON_SCALE_RATIO},children:e.icon})}),e.badge!==void 0&&r.jsx("span",{className:t.cn("Bear-Dock__badge","bear-absolute bear--top-1 bear--right-1","bear-min-w-[18px] bear-h-[18px]","bear-flex bear-items-center bear-justify-center","bear-rounded-full bear-text-[10px] bear-font-bold","bear-text-white bear-leading-none bear-px-1","bear-bg-[var(--bear-danger-500,#ef4444)]"),children:e.badge}),e.active&&b==="bottom"&&r.jsx("div",{className:t.cn("Bear-Dock__dot","bear-w-1 bear-h-1 bear-rounded-full bear-mt-0.5","bear-bg-[var(--bear-primary-500)]"),"aria-hidden":"true"})]},e.id)})})};exports.Dock=O;
|
|
@@ -1,35 +1,30 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { DEFAULT_ICON_SIZE as O, DEFAULT_MAGNIFIED_SIZE as A, DEFAULT_MAGNIFICATION_DISTANCE as C, DOCK_Z_INDEX as E, DOCK_PADDING as T, TOOLTIP_POSITION_CLASSES as L, SPRING_DURATION as B, ICON_SCALE_RATIO as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const i = Math.abs(l - n);
|
|
8
|
-
if (i > r) return a;
|
|
9
|
-
const c = 1 - i / (r + 1);
|
|
10
|
-
return a + (s - a) * c;
|
|
11
|
-
}, z = (l) => {
|
|
1
|
+
import { jsx as r, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d, useRef as w, useCallback as c } from "react";
|
|
3
|
+
import { cn as a } from "../../utils/cn.js";
|
|
4
|
+
import { DEFAULT_ICON_SIZE as O, DEFAULT_MAGNIFIED_SIZE as A, DEFAULT_MAGNIFICATION_DISTANCE as C, DOCK_Z_INDEX as E, DOCK_PADDING as T, TOOLTIP_POSITION_CLASSES as L, SPRING_DURATION as B, ICON_SCALE_RATIO as z, DOCK_POSITION_CLASSES as F } from "./Dock.const.js";
|
|
5
|
+
import { getScale as M } from "./Dock.utils.js";
|
|
6
|
+
const K = (g) => {
|
|
12
7
|
const {
|
|
13
|
-
items:
|
|
14
|
-
position:
|
|
15
|
-
iconSize:
|
|
16
|
-
magnifiedSize:
|
|
17
|
-
magnification:
|
|
18
|
-
magnificationDistance:
|
|
8
|
+
items: u,
|
|
9
|
+
position: b = "bottom",
|
|
10
|
+
iconSize: n = O,
|
|
11
|
+
magnifiedSize: p = A,
|
|
12
|
+
magnification: f = !0,
|
|
13
|
+
magnificationDistance: m = C,
|
|
19
14
|
showLabels: _ = !0,
|
|
20
15
|
className: h,
|
|
21
16
|
style: x,
|
|
22
|
-
testId:
|
|
23
|
-
} =
|
|
24
|
-
|
|
25
|
-
}, []), v =
|
|
26
|
-
|
|
17
|
+
testId: I
|
|
18
|
+
} = g, [i, l] = d(-1), [D, s] = d(""), y = w(null), N = b === "left" || b === "right", k = c((e, t) => {
|
|
19
|
+
l(e), s(t.label);
|
|
20
|
+
}, []), v = c(() => {
|
|
21
|
+
l(-1), s("");
|
|
27
22
|
}, []);
|
|
28
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ r(
|
|
29
24
|
"div",
|
|
30
25
|
{
|
|
31
26
|
ref: y,
|
|
32
|
-
className:
|
|
27
|
+
className: a(
|
|
33
28
|
"Bear-Dock",
|
|
34
29
|
"bear-flex bear-items-end bear-gap-1",
|
|
35
30
|
"bear-rounded-2xl bear-px-2 bear-py-1.5",
|
|
@@ -37,7 +32,7 @@ const j = (l, n, r, a, s) => {
|
|
|
37
32
|
"bear-backdrop-blur-xl",
|
|
38
33
|
"bear-border bear-border-gray-200/50 dark:bear-border-gray-700/50",
|
|
39
34
|
"bear-shadow-lg",
|
|
40
|
-
F[
|
|
35
|
+
F[b],
|
|
41
36
|
N && "bear-items-center",
|
|
42
37
|
h
|
|
43
38
|
),
|
|
@@ -46,21 +41,21 @@ const j = (l, n, r, a, s) => {
|
|
|
46
41
|
zIndex: E,
|
|
47
42
|
...x
|
|
48
43
|
},
|
|
49
|
-
"data-testid":
|
|
44
|
+
"data-testid": I,
|
|
50
45
|
role: "toolbar",
|
|
51
46
|
"aria-label": "Dock",
|
|
52
47
|
onMouseLeave: v,
|
|
53
|
-
children:
|
|
54
|
-
const
|
|
48
|
+
children: u.map((e, t) => {
|
|
49
|
+
const o = f ? M(t, i, m, n, p) : n;
|
|
55
50
|
return /* @__PURE__ */ S(
|
|
56
51
|
"div",
|
|
57
52
|
{
|
|
58
53
|
className: "Bear-Dock__item bear-relative bear-flex bear-flex-col bear-items-center",
|
|
59
54
|
children: [
|
|
60
|
-
_ &&
|
|
55
|
+
_ && i === t && D && /* @__PURE__ */ r(
|
|
61
56
|
"div",
|
|
62
57
|
{
|
|
63
|
-
className:
|
|
58
|
+
className: a(
|
|
64
59
|
"Bear-Dock__tooltip",
|
|
65
60
|
"bear-absolute bear-whitespace-nowrap",
|
|
66
61
|
"bear-px-2 bear-py-1 bear-rounded-lg",
|
|
@@ -68,16 +63,16 @@ const j = (l, n, r, a, s) => {
|
|
|
68
63
|
"bear-text-white dark:bear-text-gray-900",
|
|
69
64
|
"bear-text-xs bear-font-medium",
|
|
70
65
|
"bear-shadow-md bear-pointer-events-none",
|
|
71
|
-
L[
|
|
66
|
+
L[b]
|
|
72
67
|
),
|
|
73
68
|
role: "tooltip",
|
|
74
69
|
children: e.label
|
|
75
70
|
}
|
|
76
71
|
),
|
|
77
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ r(
|
|
78
73
|
"button",
|
|
79
74
|
{
|
|
80
|
-
className:
|
|
75
|
+
className: a(
|
|
81
76
|
"Bear-Dock__button",
|
|
82
77
|
"bear-flex bear-items-center bear-justify-center bear-rounded-xl",
|
|
83
78
|
"bear-transition-all bear-origin-bottom",
|
|
@@ -86,32 +81,32 @@ const j = (l, n, r, a, s) => {
|
|
|
86
81
|
e.disabled && "bear-opacity-40 bear-cursor-not-allowed"
|
|
87
82
|
),
|
|
88
83
|
style: {
|
|
89
|
-
width:
|
|
90
|
-
height:
|
|
84
|
+
width: o,
|
|
85
|
+
height: o,
|
|
91
86
|
transitionDuration: `${B}ms`,
|
|
92
87
|
transitionTimingFunction: "cubic-bezier(0.25, 0.1, 0.25, 1)"
|
|
93
88
|
},
|
|
94
89
|
onClick: e.disabled ? void 0 : e.onClick,
|
|
95
|
-
onMouseEnter: () => k(
|
|
90
|
+
onMouseEnter: () => k(t, e),
|
|
96
91
|
disabled: e.disabled,
|
|
97
92
|
"aria-label": e.label,
|
|
98
|
-
children: /* @__PURE__ */
|
|
93
|
+
children: /* @__PURE__ */ r(
|
|
99
94
|
"span",
|
|
100
95
|
{
|
|
101
|
-
className:
|
|
96
|
+
className: a(
|
|
102
97
|
"Bear-Dock__icon",
|
|
103
98
|
"bear-flex bear-items-center bear-justify-center",
|
|
104
99
|
"bear-w-full bear-h-full bear-rounded-xl",
|
|
105
100
|
"bear-transition-transform",
|
|
106
101
|
e.active ? "bear-bg-[var(--bear-primary-500)] bear-text-white" : "bear-bg-gray-100 dark:bear-bg-gray-800"
|
|
107
102
|
),
|
|
108
|
-
style: { fontSize:
|
|
103
|
+
style: { fontSize: o * z },
|
|
109
104
|
children: e.icon
|
|
110
105
|
}
|
|
111
106
|
)
|
|
112
107
|
}
|
|
113
108
|
),
|
|
114
|
-
e.badge !== void 0 && /* @__PURE__ */
|
|
109
|
+
e.badge !== void 0 && /* @__PURE__ */ r("span", { className: a(
|
|
115
110
|
"Bear-Dock__badge",
|
|
116
111
|
"bear-absolute bear--top-1 bear--right-1",
|
|
117
112
|
"bear-min-w-[18px] bear-h-[18px]",
|
|
@@ -120,10 +115,10 @@ const j = (l, n, r, a, s) => {
|
|
|
120
115
|
"bear-text-white bear-leading-none bear-px-1",
|
|
121
116
|
"bear-bg-[var(--bear-danger-500,#ef4444)]"
|
|
122
117
|
), children: e.badge }),
|
|
123
|
-
e.active &&
|
|
118
|
+
e.active && b === "bottom" && /* @__PURE__ */ r(
|
|
124
119
|
"div",
|
|
125
120
|
{
|
|
126
|
-
className:
|
|
121
|
+
className: a(
|
|
127
122
|
"Bear-Dock__dot",
|
|
128
123
|
"bear-w-1 bear-h-1 bear-rounded-full bear-mt-0.5",
|
|
129
124
|
"bear-bg-[var(--bear-primary-500)]"
|
|
@@ -140,5 +135,5 @@ const j = (l, n, r, a, s) => {
|
|
|
140
135
|
);
|
|
141
136
|
};
|
|
142
137
|
export {
|
|
143
|
-
|
|
138
|
+
K as Dock
|
|
144
139
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=(n,r,o,t,u)=>{if(r<0)return t;const c=Math.abs(n-r);if(c>o)return t;const e=1-c/(o+1);return t+(u-t)*e};exports.getScale=f;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getScale: (index: number, hoverIndex: number, distance: number, baseSize: number, maxSize: number) => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),r=require("react"),h=require("../../utils/cn.cjs"),B=require("../../hooks/useClickOutside.cjs");require("../../context/BearProvider.cjs");require("../../hooks/useBearComponent/useBearComponent.cjs");const K={xs:"bear-text-xs bear-py-1 bear-px-2",sm:"bear-text-sm bear-py-1.5 bear-px-3",md:"bear-text-sm bear-py-2 bear-px-3",lg:"bear-text-base bear-py-2.5 bear-px-4",xl:"bear-text-lg bear-py-3 bear-px-5"},U={"bottom-start":"bear-top-full bear-left-0 bear-mt-1","bottom-end":"bear-top-full bear-right-0 bear-mt-1",bottom:"bear-top-full bear-left-1/2 -bear-translate-x-1/2 bear-mt-1","top-start":"bear-bottom-full bear-left-0 bear-mb-1","top-end":"bear-bottom-full bear-right-0 bear-mb-1",top:"bear-bottom-full bear-left-1/2 -bear-translate-x-1/2 bear-mb-1",left:"bear-right-full bear-top-0 bear-mr-1",right:"bear-left-full bear-top-0 bear-ml-1"},V=({trigger:x,items:i,open:k,defaultOpen:j=!1,placement:N="bottom-start",offset:Z=4,matchWidth:S=!1,minWidth:D=150,maxHeight:I=300,size:R="md",closeOnSelect:y=!0,closeOnClickOutside:g=!0,disabled:m=!1,onOpenChange:u,className:q,testId:A,...L})=>{var C;const[M,W]=r.useState(j),[o,d]=r.useState(-1),w=r.useRef(null),z=r.useRef(null),E=r.useRef(null),p=k!==void 0,t=p?k:M,f=r.useCallback(e=>{p||W(e),u==null||u(e)},[p,u]),F=r.useCallback(()=>{m||f(!t)},[m,t,f]),n=r.useCallback(()=>{f(!1),d(-1)},[f]),v=r.useCallback(e=>{var b;e.disabled||e.divider||e.header||((b=e.onClick)==null||b.call(e),y&&!e.items&&n())},[y,n]),P=r.useCallback(()=>{t&&g&&n()},[t,g,n]);B.useClickOutside(w,P),r.useEffect(()=>{if(!t)return;const e=i.filter(a=>!a.disabled&&!a.divider&&!a.header),b=a=>{switch(a.key){case"Escape":a.preventDefault(),n();break;case"ArrowDown":a.preventDefault(),d(c=>{const l=c+1;return l>=e.length?0:l});break;case"ArrowUp":a.preventDefault(),d(c=>{const l=c-1;return l<0?e.length-1:l});break;case"Enter":case" ":a.preventDefault(),o>=0&&o<e.length&&v(e[o]);break}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[t,i,o,n,v]),r.useEffect(()=>{t||d(-1)},[t]);const T=(e,b)=>{if(e.divider)return s.jsx("div",{className:"bear-my-1 bear-mx-2 bear-h-px",style:{backgroundColor:"var(--bear-border-default)"},role:"separator"},e.key);if(e.header)return s.jsx("div",{className:"bear-px-3 bear-py-1.5 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider",style:{color:"var(--bear-text-muted)"},children:e.label},e.key);const a=i.slice(0,b).filter(l=>!l.disabled&&!l.divider&&!l.header).length,c=o===a;return s.jsxs("button",{type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>v(e),onMouseEnter:()=>d(a),className:h.cn("bear-w-full bear-flex bear-items-center bear-gap-2 bear-text-left bear-border-none bear-bg-transparent",K[R],"bear-transition-colors bear-cursor-pointer",c&&!e.danger&&"bear-bg-[var(--bear-bg-tertiary)]",e.danger&&"bear-text-red-600 dark:bear-text-red-400 hover:bear-bg-red-50 dark:hover:bear-bg-red-900/20",!e.danger&&!e.disabled&&"hover:bear-bg-[var(--bear-bg-tertiary)]",e.disabled&&"bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none"),style:e.disabled?{color:"var(--bear-text-muted)"}:e.danger?void 0:{color:"var(--bear-text-secondary)"},children:[e.icon&&s.jsx("span",{className:"bear-flex-shrink-0 bear-w-5 bear-h-5 bear-flex bear-items-center bear-justify-center",children:e.icon}),s.jsx("span",{className:"bear-flex-1",children:e.label}),e.trailing&&s.jsx("span",{className:"bear-flex-shrink-0",style:{color:"var(--bear-text-muted)"},children:e.trailing}),e.items&&s.jsx("svg",{className:"bear-w-4 bear-h-4 bear-flex-shrink-0",style:{color:"var(--bear-text-muted)"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("polyline",{points:"9 18 15 12 9 6"})})]},e.key)},_=r.isValidElement(x)?r.cloneElement(x,{onClick:F,ref:E,"aria-expanded":t,"aria-haspopup":!0}):x;return s.jsxs("div",{ref:w,className:h.cn("bear-relative bear-inline-block",q),"data-testid":A,...L,children:[_,t&&s.jsx("div",{ref:z,role:"menu",className:h.cn("bear-absolute bear-z-50","bear-border bear-rounded-lg bear-shadow-lg","bear-py-1 bear-overflow-y-auto","bear-animate-in bear-fade-in-0 bear-zoom-in-95 bear-duration-100",U[N]),style:{backgroundColor:"var(--bear-bg-primary)",borderColor:"var(--bear-border-default)",minWidth:S?(C=E.current)==null?void 0:C.offsetWidth:D,maxHeight:I},children:i.map((e,b)=>T(e,b))})]})};exports.Dropdown=V;
|