@forgedevstack/bear 1.1.4 → 1.1.8
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 +19 -0
- 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/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/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 +59 -60
- 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/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/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 +28 -30
- 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/Tabs.cjs +1 -1
- package/dist/components/Tabs/Tabs.js +39 -38
- package/dist/components/Tabs/Tabs.types.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 +4 -0
- package/dist/components/index.js +66 -62
- 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 +175 -169
- package/dist/styles/_base.css +7 -3
- package/dist/styles.css +1 -1
- package/package.json +6 -1
|
@@ -1,115 +1,106 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { DEFAULT_SEPARATOR as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
days: Math.floor(e / N),
|
|
9
|
-
hours: Math.floor(e % N / L),
|
|
10
|
-
minutes: Math.floor(e % L / R),
|
|
11
|
-
seconds: Math.floor(e % R / h),
|
|
12
|
-
totalSeconds: Math.floor(e / h),
|
|
13
|
-
isComplete: e <= 0
|
|
14
|
-
};
|
|
15
|
-
}, ie = (a) => {
|
|
1
|
+
import { jsx as t, Fragment as H, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as V, useRef as q, useCallback as J, useState as E, useEffect as K } from "react";
|
|
3
|
+
import { cn as o } from "../../utils/cn.js";
|
|
4
|
+
import { DEFAULT_SEPARATOR as Q, DEFAULT_LABELS as W, MS_PER_SECOND as X, UPDATE_INTERVAL as Y, SEPARATOR_MARGIN as $, SIZE_DIGIT_CLASSES as T, SIZE_LABEL_CLASSES as A, SIZE_GAP_CLASSES as v } from "./CountdownTimer.const.js";
|
|
5
|
+
import { calcRemaining as D, pad as l } from "./CountdownTimer.utils.js";
|
|
6
|
+
const ne = (L) => {
|
|
16
7
|
const {
|
|
17
|
-
targetDate:
|
|
18
|
-
duration:
|
|
19
|
-
variant:
|
|
20
|
-
size:
|
|
21
|
-
showDays:
|
|
22
|
-
showHours:
|
|
23
|
-
showMinutes:
|
|
24
|
-
showSeconds:
|
|
25
|
-
showLabels:
|
|
26
|
-
showSeparator:
|
|
27
|
-
separator:
|
|
28
|
-
labels:
|
|
29
|
-
onComplete:
|
|
30
|
-
onTick:
|
|
31
|
-
paused:
|
|
32
|
-
render:
|
|
33
|
-
className:
|
|
34
|
-
style:
|
|
35
|
-
testId:
|
|
36
|
-
} =
|
|
37
|
-
if (
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
const p =
|
|
41
|
-
|
|
8
|
+
targetDate: d,
|
|
9
|
+
duration: b,
|
|
10
|
+
variant: f = "default",
|
|
11
|
+
size: u = "md",
|
|
12
|
+
showDays: I = !0,
|
|
13
|
+
showHours: N = !0,
|
|
14
|
+
showMinutes: k = !0,
|
|
15
|
+
showSeconds: R = !0,
|
|
16
|
+
showLabels: B = !0,
|
|
17
|
+
showSeparator: P = !0,
|
|
18
|
+
separator: F = Q,
|
|
19
|
+
labels: w,
|
|
20
|
+
onComplete: s,
|
|
21
|
+
onTick: n,
|
|
22
|
+
paused: h = !1,
|
|
23
|
+
render: _,
|
|
24
|
+
className: M,
|
|
25
|
+
style: G,
|
|
26
|
+
testId: O
|
|
27
|
+
} = L, i = V(() => ({ ...W, ...w }), [w]), S = q(!1), U = J(() => d ? new Date(d).getTime() : b ? Date.now() + b * X : Date.now(), [d, b]), [c] = E(U), [r, Z] = E(() => D(c, Date.now()));
|
|
28
|
+
if (K(() => {
|
|
29
|
+
if (h) return;
|
|
30
|
+
const e = () => {
|
|
31
|
+
const p = D(c, Date.now());
|
|
32
|
+
Z(p), n == null || n(p), p.isComplete && !S.current && (S.current = !0, s == null || s());
|
|
42
33
|
};
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
return () => clearInterval(
|
|
46
|
-
}, [
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
return /* @__PURE__ */
|
|
34
|
+
e();
|
|
35
|
+
const g = setInterval(e, Y);
|
|
36
|
+
return () => clearInterval(g);
|
|
37
|
+
}, [c, h, s, n]), _) return /* @__PURE__ */ t(H, { children: _(r) });
|
|
38
|
+
const y = T[u] ?? T.md, j = A[u] ?? A.md, z = v[u] ?? v.md, a = [];
|
|
39
|
+
I && a.push({ value: l(r.days), label: i.days }), N && a.push({ value: l(r.hours), label: i.hours }), k && a.push({ value: l(r.minutes), label: i.minutes }), R && a.push({ value: l(r.seconds), label: i.seconds });
|
|
40
|
+
const m = f === "card", x = f === "flip";
|
|
41
|
+
return /* @__PURE__ */ t(
|
|
51
42
|
"div",
|
|
52
43
|
{
|
|
53
|
-
className:
|
|
54
|
-
style:
|
|
55
|
-
"data-testid":
|
|
44
|
+
className: o("Bear-CountdownTimer", "bear-flex bear-items-center", z, M),
|
|
45
|
+
style: G,
|
|
46
|
+
"data-testid": O,
|
|
56
47
|
role: "timer",
|
|
57
48
|
"aria-label": "Countdown timer",
|
|
58
|
-
children:
|
|
59
|
-
|
|
49
|
+
children: a.map((e, g) => /* @__PURE__ */ C("div", { className: "Bear-CountdownTimer__segment bear-flex bear-items-center", children: [
|
|
50
|
+
g > 0 && P && !m && /* @__PURE__ */ t(
|
|
60
51
|
"span",
|
|
61
52
|
{
|
|
62
|
-
className:
|
|
53
|
+
className: o(
|
|
63
54
|
"Bear-CountdownTimer__separator",
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
y,
|
|
56
|
+
$,
|
|
66
57
|
"bear-text-gray-400 dark:bear-text-gray-500"
|
|
67
58
|
),
|
|
68
59
|
"aria-hidden": "true",
|
|
69
|
-
children:
|
|
60
|
+
children: F
|
|
70
61
|
}
|
|
71
62
|
),
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ C("div", { className: "Bear-CountdownTimer__unit bear-flex bear-flex-col bear-items-center", children: [
|
|
64
|
+
/* @__PURE__ */ t(
|
|
74
65
|
"div",
|
|
75
66
|
{
|
|
76
|
-
className:
|
|
67
|
+
className: o(
|
|
77
68
|
"Bear-CountdownTimer__digit",
|
|
78
|
-
|
|
69
|
+
y,
|
|
79
70
|
"bear-tabular-nums bear-tracking-wider",
|
|
80
|
-
|
|
71
|
+
m && [
|
|
81
72
|
"bear-px-3 bear-py-2 bear-rounded-lg",
|
|
82
73
|
"bear-bg-gray-100 dark:bear-bg-gray-800",
|
|
83
74
|
"bear-border bear-border-gray-200 dark:bear-border-gray-700"
|
|
84
75
|
],
|
|
85
|
-
|
|
76
|
+
x && [
|
|
86
77
|
"bear-px-3 bear-py-2 bear-rounded-lg",
|
|
87
78
|
"bear-bg-gray-900 dark:bear-bg-gray-100",
|
|
88
79
|
"bear-text-white dark:bear-text-gray-900",
|
|
89
80
|
"bear-shadow-lg"
|
|
90
81
|
],
|
|
91
|
-
!
|
|
82
|
+
!m && !x && "bear-text-[var(--bear-text-primary)]"
|
|
92
83
|
),
|
|
93
|
-
children:
|
|
84
|
+
children: e.value
|
|
94
85
|
}
|
|
95
86
|
),
|
|
96
|
-
|
|
87
|
+
B && /* @__PURE__ */ t(
|
|
97
88
|
"span",
|
|
98
89
|
{
|
|
99
|
-
className:
|
|
90
|
+
className: o(
|
|
100
91
|
"Bear-CountdownTimer__label",
|
|
101
|
-
|
|
92
|
+
j,
|
|
102
93
|
"bear-mt-1 bear-uppercase bear-tracking-widest",
|
|
103
94
|
"bear-text-gray-500 dark:bear-text-gray-400"
|
|
104
95
|
),
|
|
105
|
-
children:
|
|
96
|
+
children: e.label
|
|
106
97
|
}
|
|
107
98
|
)
|
|
108
99
|
] })
|
|
109
|
-
] },
|
|
100
|
+
] }, e.label))
|
|
110
101
|
}
|
|
111
102
|
);
|
|
112
103
|
};
|
|
113
104
|
export {
|
|
114
|
-
|
|
105
|
+
ne as CountdownTimer
|
|
115
106
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./CountdownTimer.const.cjs"),n=a=>String(a).padStart(o.PAD_LENGTH,"0"),_=(a,e)=>{const t=Math.max(0,a-e);return{days:Math.floor(t/o.MS_PER_DAY),hours:Math.floor(t%o.MS_PER_DAY/o.MS_PER_HOUR),minutes:Math.floor(t%o.MS_PER_HOUR/o.MS_PER_MINUTE),seconds:Math.floor(t%o.MS_PER_MINUTE/o.MS_PER_SECOND),totalSeconds:Math.floor(t/o.MS_PER_SECOND),isComplete:t<=0}};exports.calcRemaining=_;exports.pad=n;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MS_PER_SECOND as a, MS_PER_MINUTE as r, MS_PER_HOUR as M, MS_PER_DAY as n, PAD_LENGTH as _ } from "./CountdownTimer.const.js";
|
|
2
|
+
const f = (t) => String(t).padStart(_, "0"), l = (t, s) => {
|
|
3
|
+
const o = Math.max(0, t - s);
|
|
4
|
+
return {
|
|
5
|
+
days: Math.floor(o / n),
|
|
6
|
+
hours: Math.floor(o % n / M),
|
|
7
|
+
minutes: Math.floor(o % M / r),
|
|
8
|
+
seconds: Math.floor(o % r / a),
|
|
9
|
+
totalSeconds: Math.floor(o / a),
|
|
10
|
+
isComplete: o <= 0
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
l as calcRemaining,
|
|
15
|
+
f as pad
|
|
16
|
+
};
|
|
@@ -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 b=require("react/jsx-runtime"),r=require("react"),y=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:C=!1,placement:N="bottom-start",offset:Z=4,matchWidth:S=!1,minWidth:D=150,maxHeight:I=300,size:R="md",closeOnSelect:h=!0,closeOnClickOutside:m=!0,disabled:v=!1,onOpenChange:u,className:q,testId:A,...L})=>{var j;const[M,W]=r.useState(C),[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(()=>{v||f(!t)},[v,t,f]),l=r.useCallback(()=>{f(!1),d(-1)},[f]),g=r.useCallback(e=>{var s;e.disabled||e.divider||e.header||((s=e.onClick)==null||s.call(e),h&&!e.items&&l())},[h,l]),P=r.useCallback(()=>{t&&m&&l()},[t,m,l]);B.useClickOutside(w,P),r.useEffect(()=>{if(!t)return;const e=i.filter(a=>!a.disabled&&!a.divider&&!a.header),s=a=>{switch(a.key){case"Escape":a.preventDefault(),l();break;case"ArrowDown":a.preventDefault(),d(c=>{const n=c+1;return n>=e.length?0:n});break;case"ArrowUp":a.preventDefault(),d(c=>{const n=c-1;return n<0?e.length-1:n});break;case"Enter":case" ":a.preventDefault(),o>=0&&o<e.length&&g(e[o]);break}};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,i,o,l,g]),r.useEffect(()=>{t||d(-1)},[t]);const T=(e,s)=>{if(e.divider)return b.jsx("div",{className:"bear-my-1 bear-mx-2 bear-h-px bear-bg-gray-200 dark:bear-bg-gray-700",role:"separator"},e.key);if(e.header)return b.jsx("div",{className:"bear-px-3 bear-py-1.5 bear-text-xs bear-font-semibold bear-uppercase bear-tracking-wider bear-text-gray-500 dark:bear-text-gray-400",children:e.label},e.key);const a=i.slice(0,s).filter(n=>!n.disabled&&!n.divider&&!n.header).length,c=o===a;return b.jsxs("button",{type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>g(e),onMouseEnter:()=>d(a),className:y.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&&"bear-bg-gray-100 dark:bear-bg-gray-800",e.danger?"bear-text-red-600 dark:bear-text-red-400 hover:bear-bg-red-50 dark:hover:bear-bg-red-900/20":"bear-text-gray-700 dark:bear-text-gray-200 hover:bear-bg-gray-100 dark:hover:bear-bg-gray-800",e.disabled&&"bear-opacity-50 bear-cursor-not-allowed bear-pointer-events-none"),children:[e.icon&&b.jsx("span",{className:"bear-flex-shrink-0 bear-w-5 bear-h-5 bear-flex bear-items-center bear-justify-center",children:e.icon}),b.jsx("span",{className:"bear-flex-1",children:e.label}),e.trailing&&b.jsx("span",{className:"bear-flex-shrink-0 bear-text-gray-400",children:e.trailing}),e.items&&b.jsx("svg",{className:"bear-w-4 bear-h-4 bear-text-gray-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:b.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 b.jsxs("div",{ref:w,className:y.cn("bear-relative bear-inline-block",q),"data-testid":A,...L,children:[_,t&&b.jsx("div",{ref:z,role:"menu",className:y.cn("bear-absolute bear-z-50","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-py-1 bear-overflow-y-auto","bear-animate-in bear-fade-in-0 bear-zoom-in-95 bear-duration-100",U[N]),style:{minWidth:S?(j=E.current)==null?void 0:j.offsetWidth:D,maxHeight:I},children:i.map((e,s)=>T(e,s))})]})};exports.Dropdown=V;
|