@forgedevstack/bear 1.0.8 → 1.0.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/dist/components/ActivityItem/ActivityItem.cjs +1 -1
- package/dist/components/ActivityItem/ActivityItem.js +1 -0
- package/dist/components/Alert/Alert.const.cjs +1 -1
- package/dist/components/Alert/Alert.const.js +3 -2
- package/dist/components/AppBar/AppBar.cjs +1 -1
- package/dist/components/AppBar/AppBar.js +3 -2
- package/dist/components/Badge/Badge.cjs +1 -1
- package/dist/components/Badge/Badge.js +15 -14
- package/dist/components/BearLogo/EmberLogo.cjs +1 -1
- package/dist/components/BearLogo/EmberLogo.js +3 -2
- package/dist/components/BottomNavigation/BottomNavigation.cjs +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.js +3 -2
- package/dist/components/Carousel/Carousel.cjs +1 -1
- package/dist/components/Carousel/Carousel.const.cjs +1 -0
- package/dist/components/Carousel/Carousel.const.d.ts +12 -0
- package/dist/components/Carousel/Carousel.const.js +9 -0
- package/dist/components/Carousel/Carousel.d.ts +14 -3
- package/dist/components/Carousel/Carousel.js +222 -75
- package/dist/components/Carousel/Carousel.types.d.ts +32 -2
- package/dist/components/Carousel/index.d.ts +1 -1
- package/dist/components/Chip/Chip.cjs +1 -1
- package/dist/components/Chip/Chip.js +3 -2
- package/dist/components/CodeEditor/CodeEditor.cjs +5 -0
- package/dist/components/CodeEditor/CodeEditor.const.cjs +1 -0
- package/dist/components/CodeEditor/CodeEditor.const.d.ts +21 -0
- package/dist/components/CodeEditor/CodeEditor.const.js +119 -0
- package/dist/components/CodeEditor/CodeEditor.d.ts +22 -0
- package/dist/components/CodeEditor/CodeEditor.js +250 -0
- package/dist/components/CodeEditor/CodeEditor.types.d.ts +80 -0
- package/dist/components/CodeEditor/CodeEditor.utils.cjs +1 -0
- package/dist/components/CodeEditor/CodeEditor.utils.d.ts +6 -0
- package/dist/components/CodeEditor/CodeEditor.utils.js +75 -0
- package/dist/components/CodeEditor/index.d.ts +2 -0
- package/dist/components/Columns/Columns.cjs +1 -1
- package/dist/components/Columns/Columns.js +9 -8
- package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +27 -0
- package/dist/components/CountdownTimer/CountdownTimer.const.js +35 -0
- package/dist/components/CountdownTimer/CountdownTimer.d.ts +7 -0
- package/dist/components/CountdownTimer/CountdownTimer.js +115 -0
- package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +56 -0
- package/dist/components/CountdownTimer/index.d.ts +2 -0
- package/dist/components/Cropper/Cropper.cjs +1 -0
- package/dist/components/Cropper/Cropper.const.cjs +1 -0
- package/dist/components/Cropper/Cropper.const.d.ts +31 -0
- package/dist/components/Cropper/Cropper.const.js +33 -0
- package/dist/components/Cropper/Cropper.d.ts +21 -0
- package/dist/components/Cropper/Cropper.js +362 -0
- package/dist/components/Cropper/Cropper.types.d.ts +72 -0
- package/dist/components/Cropper/index.d.ts +2 -0
- package/dist/components/DataTable/DataTable.cjs +1 -1
- package/dist/components/DataTable/DataTable.js +5 -4
- package/dist/components/Divider/Divider.cjs +1 -1
- package/dist/components/Divider/Divider.js +15 -14
- package/dist/components/Dock/Dock.cjs +1 -0
- package/dist/components/Dock/Dock.const.cjs +1 -0
- package/dist/components/Dock/Dock.const.d.ts +25 -0
- package/dist/components/Dock/Dock.const.js +22 -0
- package/dist/components/Dock/Dock.d.ts +7 -0
- package/dist/components/Dock/Dock.js +144 -0
- package/dist/components/Dock/Dock.types.d.ts +42 -0
- package/dist/components/Dock/index.d.ts +2 -0
- package/dist/components/EmptyState/EmptyState.cjs +1 -1
- package/dist/components/EmptyState/EmptyState.js +7 -6
- package/dist/components/GradientText/GradientText.cjs +1 -0
- package/dist/components/GradientText/GradientText.const.cjs +1 -0
- package/dist/components/GradientText/GradientText.const.d.ts +15 -0
- package/dist/components/GradientText/GradientText.const.js +36 -0
- package/dist/components/GradientText/GradientText.d.ts +7 -0
- package/dist/components/GradientText/GradientText.js +52 -0
- package/dist/components/GradientText/GradientText.types.d.ts +27 -0
- package/dist/components/GradientText/index.d.ts +2 -0
- package/dist/components/Highlight/Highlight.cjs +1 -1
- package/dist/components/Highlight/Highlight.const.cjs +1 -0
- package/dist/components/Highlight/Highlight.const.d.ts +8 -0
- package/dist/components/Highlight/Highlight.const.js +15 -0
- package/dist/components/Highlight/Highlight.d.ts +4 -0
- package/dist/components/Highlight/Highlight.js +32 -24
- package/dist/components/Highlight/Highlight.types.d.ts +9 -1
- package/dist/components/Highlight/index.d.ts +1 -1
- package/dist/components/Icon/Icon.cjs +1 -1
- package/dist/components/Icon/Icon.js +17 -16
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.js +12 -11
- package/dist/components/Kbd/Kbd.cjs +1 -1
- package/dist/components/Kbd/Kbd.js +17 -16
- package/dist/components/Map/Map.cjs +1 -0
- package/dist/components/Map/Map.const.cjs +1 -0
- package/dist/components/Map/Map.const.d.ts +20 -0
- package/dist/components/Map/Map.const.js +26 -0
- package/dist/components/Map/Map.d.ts +20 -0
- package/dist/components/Map/Map.js +259 -0
- package/dist/components/Map/Map.types.d.ts +81 -0
- package/dist/components/Map/index.d.ts +2 -0
- package/dist/components/Marquee/Marquee.cjs +1 -0
- package/dist/components/Marquee/Marquee.const.cjs +1 -0
- package/dist/components/Marquee/Marquee.const.d.ts +11 -0
- package/dist/components/Marquee/Marquee.const.js +12 -0
- package/dist/components/Marquee/Marquee.d.ts +7 -0
- package/dist/components/Marquee/Marquee.js +106 -0
- package/dist/components/Marquee/Marquee.types.d.ts +32 -0
- package/dist/components/Marquee/index.d.ts +2 -0
- package/dist/components/Masonry/Masonry.cjs +1 -0
- package/dist/components/Masonry/Masonry.const.cjs +1 -0
- package/dist/components/Masonry/Masonry.const.d.ts +9 -0
- package/dist/components/Masonry/Masonry.const.js +9 -0
- package/dist/components/Masonry/Masonry.d.ts +7 -0
- package/dist/components/Masonry/Masonry.js +51 -0
- package/dist/components/Masonry/Masonry.types.d.ts +21 -0
- package/dist/components/Masonry/index.d.ts +2 -0
- package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -0
- package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -0
- package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +23 -0
- package/dist/components/NavigableSelect/NavigableSelect.const.js +33 -0
- package/dist/components/NavigableSelect/NavigableSelect.d.ts +7 -0
- package/dist/components/NavigableSelect/NavigableSelect.js +361 -0
- package/dist/components/NavigableSelect/NavigableSelect.types.d.ts +56 -0
- package/dist/components/NavigableSelect/index.d.ts +2 -0
- package/dist/components/Progress/Progress.cjs +1 -1
- package/dist/components/Progress/Progress.js +3 -2
- package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
- package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.js +3 -2
- package/dist/components/ScrollArea/ScrollArea.cjs +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +3 -2
- package/dist/components/Sidebar/Sidebar.cjs +1 -1
- package/dist/components/Sidebar/Sidebar.js +13 -12
- package/dist/components/Spinner/Spinner.cjs +1 -1
- package/dist/components/Spinner/Spinner.js +3 -2
- package/dist/components/Spotlight/Spotlight.cjs +1 -0
- package/dist/components/Spotlight/Spotlight.const.cjs +1 -0
- package/dist/components/Spotlight/Spotlight.const.d.ts +18 -0
- package/dist/components/Spotlight/Spotlight.const.js +9 -0
- package/dist/components/Spotlight/Spotlight.d.ts +7 -0
- package/dist/components/Spotlight/Spotlight.js +220 -0
- package/dist/components/Spotlight/Spotlight.types.d.ts +51 -0
- package/dist/components/Spotlight/index.d.ts +2 -0
- package/dist/components/StatCard/StatCard.cjs +1 -1
- package/dist/components/StatCard/StatCard.js +9 -8
- package/dist/components/Statistic/Statistic.cjs +1 -1
- package/dist/components/Statistic/Statistic.js +7 -6
- package/dist/components/Switch/Switch.cjs +1 -1
- package/dist/components/Switch/Switch.js +11 -10
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.cjs +1 -1
- package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.js +16 -15
- package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
- package/dist/components/TimePicker/helpers/ClockFaceSvg.js +13 -12
- package/dist/components/Transition/Transition.cjs +1 -0
- package/dist/components/Transition/Transition.const.cjs +1 -0
- package/dist/components/Transition/Transition.const.d.ts +15 -0
- package/dist/components/Transition/Transition.const.js +73 -0
- package/dist/components/Transition/Transition.d.ts +37 -0
- package/dist/components/Transition/Transition.js +107 -0
- package/dist/components/Transition/Transition.types.d.ts +69 -0
- package/dist/components/Transition/index.d.ts +2 -0
- package/dist/components/Typewriter/Typewriter.cjs +1 -0
- package/dist/components/Typewriter/Typewriter.const.cjs +1 -0
- package/dist/components/Typewriter/Typewriter.const.d.ts +22 -0
- package/dist/components/Typewriter/Typewriter.const.js +11 -0
- package/dist/components/Typewriter/Typewriter.d.ts +7 -0
- package/dist/components/Typewriter/Typewriter.js +88 -0
- package/dist/components/Typewriter/Typewriter.types.d.ts +32 -0
- package/dist/components/Typewriter/index.d.ts +2 -0
- package/dist/components/Watermark/Watermark.cjs +1 -0
- package/dist/components/Watermark/Watermark.const.cjs +1 -0
- package/dist/components/Watermark/Watermark.const.d.ts +30 -0
- package/dist/components/Watermark/Watermark.const.js +18 -0
- package/dist/components/Watermark/Watermark.d.ts +7 -0
- package/dist/components/Watermark/Watermark.js +96 -0
- package/dist/components/Watermark/Watermark.types.d.ts +35 -0
- package/dist/components/Watermark/index.d.ts +2 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +27 -1
- package/dist/components/index.js +231 -204
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.js +24 -19
- package/dist/hooks/useAnimate.cjs +1 -0
- package/dist/hooks/useAnimate.d.ts +61 -0
- package/dist/hooks/useAnimate.js +125 -0
- package/dist/hooks/useResponsive.cjs +1 -0
- package/dist/hooks/useResponsive.d.ts +35 -0
- package/dist/hooks/useResponsive.js +74 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +324 -290
- package/dist/styles.css +1 -1
- package/dist/utils/createSlots.cjs +1 -0
- package/dist/utils/createSlots.d.ts +70 -0
- package/dist/utils/createSlots.js +65 -0
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +4 -2
- package/package.json +1 -1
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import { jsxs as d, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as U, useState as f, useMemo as ve, useCallback as o, useEffect as Me } from "react";
|
|
3
|
+
import { cn as F } from "../../utils/cn.js";
|
|
4
|
+
import { DEFAULT_CROP as pe, DEFAULT_ZOOM as ke, ASPECT_RATIO_VALUES as Ne, MIN_ZOOM as Oe, MAX_ZOOM as Ie, MIN_CROP_SIZE as K, ZOOM_STEP as P, OVERLAY_COLOR as _e, BORDER_WIDTH as De, BORDER_COLOR as Le, DEFAULT_GRID_OPACITY as Ae, GRID_LINES as y, HANDLE_SIZE as _, ROTATION_STEP as Te, MAX_ROTATION as Q, MIN_ROTATION as S } from "./Cropper.const.js";
|
|
5
|
+
const Re = ({
|
|
6
|
+
src: D,
|
|
7
|
+
crop: L,
|
|
8
|
+
onCropChange: M,
|
|
9
|
+
onCropComplete: p,
|
|
10
|
+
aspectRatio: k = "free",
|
|
11
|
+
shape: N = "rectangle",
|
|
12
|
+
zoom: A,
|
|
13
|
+
onZoomChange: O,
|
|
14
|
+
minZoom: T = Oe,
|
|
15
|
+
maxZoom: E = Ie,
|
|
16
|
+
rotation: $,
|
|
17
|
+
onRotationChange: I,
|
|
18
|
+
showZoomSlider: g = !1,
|
|
19
|
+
showRotationSlider: m = !1,
|
|
20
|
+
showGrid: Z = !1,
|
|
21
|
+
gridOpacity: C = Ae,
|
|
22
|
+
overlayColor: ee = _e,
|
|
23
|
+
borderColor: te = Le,
|
|
24
|
+
borderWidth: ae = De,
|
|
25
|
+
width: re = "100%",
|
|
26
|
+
height: ie = 400,
|
|
27
|
+
className: ne,
|
|
28
|
+
style: se,
|
|
29
|
+
testId: he
|
|
30
|
+
}) => {
|
|
31
|
+
const H = U(null), Y = U(null), j = U(null), [ce, le] = f(pe), [de, be] = f(ke), [oe, ue] = f(0), [w, X] = f("none"), [v, B] = f(null), [ge, me] = f(!1), [, xe] = f({ w: 0, h: 0 }), a = L ?? ce, u = A ?? de, W = $ ?? oe, h = ve(() => typeof k == "number" ? k : Ne[k] ?? null, [k]), G = o(
|
|
32
|
+
(e) => {
|
|
33
|
+
L || le(e), M == null || M(e);
|
|
34
|
+
},
|
|
35
|
+
[L, M]
|
|
36
|
+
), R = o(
|
|
37
|
+
(e) => {
|
|
38
|
+
const t = Math.max(T, Math.min(E, e));
|
|
39
|
+
A || be(t), O == null || O(t);
|
|
40
|
+
},
|
|
41
|
+
[A, O, T, E]
|
|
42
|
+
), fe = o(
|
|
43
|
+
(e) => {
|
|
44
|
+
const t = Math.max(S, Math.min(Q, e));
|
|
45
|
+
$ || ue(t), I == null || I(t);
|
|
46
|
+
},
|
|
47
|
+
[$, I]
|
|
48
|
+
);
|
|
49
|
+
Me(() => {
|
|
50
|
+
const e = new Image();
|
|
51
|
+
e.crossOrigin = "anonymous", e.onload = () => {
|
|
52
|
+
j.current = e, xe({ w: e.naturalWidth, h: e.naturalHeight }), me(!0);
|
|
53
|
+
}, e.src = D;
|
|
54
|
+
}, [D]);
|
|
55
|
+
const l = o(
|
|
56
|
+
(e) => {
|
|
57
|
+
const t = H.current;
|
|
58
|
+
if (!t) return e;
|
|
59
|
+
const i = t.clientWidth, r = t.clientHeight - (g || m ? 60 : 0);
|
|
60
|
+
let { x: s, y: x, width: b, height: c } = e;
|
|
61
|
+
return b = Math.max(K, b), c = Math.max(K, c), h && (c = b / h), s = Math.max(0, Math.min(i - b, s)), x = Math.max(0, Math.min(r - c, x)), { x: s, y: x, width: b, height: c };
|
|
62
|
+
},
|
|
63
|
+
[h, g, m]
|
|
64
|
+
), V = o(() => {
|
|
65
|
+
const e = Y.current, t = j.current, i = H.current;
|
|
66
|
+
if (!e || !t || !i) return "";
|
|
67
|
+
const r = i.clientWidth, s = i.clientHeight - (g || m ? 60 : 0), x = t.naturalWidth / (r * u), b = t.naturalHeight / (s * u);
|
|
68
|
+
e.width = a.width * x, e.height = a.height * b;
|
|
69
|
+
const c = e.getContext("2d");
|
|
70
|
+
return c ? (N === "circle" && (c.beginPath(), c.arc(e.width / 2, e.height / 2, Math.min(e.width, e.height) / 2, 0, Math.PI * 2), c.clip()), c.drawImage(
|
|
71
|
+
t,
|
|
72
|
+
a.x * x,
|
|
73
|
+
a.y * b,
|
|
74
|
+
a.width * x,
|
|
75
|
+
a.height * b,
|
|
76
|
+
0,
|
|
77
|
+
0,
|
|
78
|
+
e.width,
|
|
79
|
+
e.height
|
|
80
|
+
), e.toDataURL("image/png")) : "";
|
|
81
|
+
}, [a, u, N, g, m]), z = o(
|
|
82
|
+
(e) => (t) => {
|
|
83
|
+
t.preventDefault(), t.stopPropagation(), X(e), B({ x: t.clientX, y: t.clientY, crop: { ...a } });
|
|
84
|
+
},
|
|
85
|
+
[a]
|
|
86
|
+
), we = o(
|
|
87
|
+
(e) => {
|
|
88
|
+
if (w === "none" || !v) return;
|
|
89
|
+
const t = e.clientX - v.x, i = e.clientY - v.y, { crop: r } = v;
|
|
90
|
+
let s;
|
|
91
|
+
switch (w) {
|
|
92
|
+
case "move":
|
|
93
|
+
s = l({
|
|
94
|
+
...r,
|
|
95
|
+
x: r.x + t,
|
|
96
|
+
y: r.y + i
|
|
97
|
+
});
|
|
98
|
+
break;
|
|
99
|
+
case "se":
|
|
100
|
+
s = l({
|
|
101
|
+
...r,
|
|
102
|
+
width: r.width + t,
|
|
103
|
+
height: h ? (r.width + t) / h : r.height + i
|
|
104
|
+
});
|
|
105
|
+
break;
|
|
106
|
+
case "sw":
|
|
107
|
+
s = l({
|
|
108
|
+
...r,
|
|
109
|
+
x: r.x + t,
|
|
110
|
+
width: r.width - t,
|
|
111
|
+
height: h ? (r.width - t) / h : r.height + i
|
|
112
|
+
});
|
|
113
|
+
break;
|
|
114
|
+
case "ne":
|
|
115
|
+
s = l({
|
|
116
|
+
...r,
|
|
117
|
+
y: h ? r.y : r.y + i,
|
|
118
|
+
width: r.width + t,
|
|
119
|
+
height: h ? (r.width + t) / h : r.height - i
|
|
120
|
+
});
|
|
121
|
+
break;
|
|
122
|
+
case "nw":
|
|
123
|
+
s = l({
|
|
124
|
+
x: r.x + t,
|
|
125
|
+
y: r.y + i,
|
|
126
|
+
width: r.width - t,
|
|
127
|
+
height: h ? (r.width - t) / h : r.height - i
|
|
128
|
+
});
|
|
129
|
+
break;
|
|
130
|
+
case "n":
|
|
131
|
+
s = l({ ...r, y: r.y + i, height: r.height - i });
|
|
132
|
+
break;
|
|
133
|
+
case "s":
|
|
134
|
+
s = l({ ...r, height: r.height + i });
|
|
135
|
+
break;
|
|
136
|
+
case "e":
|
|
137
|
+
s = l({ ...r, width: r.width + t });
|
|
138
|
+
break;
|
|
139
|
+
case "w":
|
|
140
|
+
s = l({ ...r, x: r.x + t, width: r.width - t });
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
G(s);
|
|
146
|
+
},
|
|
147
|
+
[w, v, l, G, h]
|
|
148
|
+
), q = o(() => {
|
|
149
|
+
if (w !== "none") {
|
|
150
|
+
const e = V();
|
|
151
|
+
p == null || p(a, e);
|
|
152
|
+
}
|
|
153
|
+
X("none"), B(null);
|
|
154
|
+
}, [w, a, V, p]), ye = o(
|
|
155
|
+
(e) => {
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
const t = e.deltaY > 0 ? -P : P;
|
|
158
|
+
R(u + t);
|
|
159
|
+
},
|
|
160
|
+
[u, R]
|
|
161
|
+
), J = g || m ? 60 : 0;
|
|
162
|
+
return /* @__PURE__ */ d(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
className: F(
|
|
166
|
+
"bear-relative bear-overflow-hidden bear-rounded-lg",
|
|
167
|
+
"bear-bg-gray-900 bear-select-none",
|
|
168
|
+
ne
|
|
169
|
+
),
|
|
170
|
+
style: { width: re, height: ie, ...se },
|
|
171
|
+
"data-testid": he,
|
|
172
|
+
children: [
|
|
173
|
+
/* @__PURE__ */ n("canvas", { ref: Y, className: "bear-hidden" }),
|
|
174
|
+
/* @__PURE__ */ d(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
ref: H,
|
|
178
|
+
className: "bear-relative bear-overflow-hidden bear-cursor-crosshair",
|
|
179
|
+
style: { height: `calc(100% - ${J}px)` },
|
|
180
|
+
onMouseMove: we,
|
|
181
|
+
onMouseUp: q,
|
|
182
|
+
onMouseLeave: q,
|
|
183
|
+
onWheel: ye,
|
|
184
|
+
children: [
|
|
185
|
+
ge && /* @__PURE__ */ n(
|
|
186
|
+
"img",
|
|
187
|
+
{
|
|
188
|
+
src: D,
|
|
189
|
+
alt: "",
|
|
190
|
+
className: "bear-absolute bear-inset-0 bear-w-full bear-h-full bear-object-contain bear-pointer-events-none",
|
|
191
|
+
style: {
|
|
192
|
+
transform: `scale(${u}) rotate(${W}deg)`,
|
|
193
|
+
transition: w !== "none" ? "none" : "transform 0.2s ease"
|
|
194
|
+
},
|
|
195
|
+
draggable: !1
|
|
196
|
+
}
|
|
197
|
+
),
|
|
198
|
+
/* @__PURE__ */ d("svg", { className: "bear-absolute bear-inset-0 bear-w-full bear-h-full bear-pointer-events-none", children: [
|
|
199
|
+
/* @__PURE__ */ n("defs", { children: /* @__PURE__ */ d("mask", { id: "crop-mask", children: [
|
|
200
|
+
/* @__PURE__ */ n("rect", { width: "100%", height: "100%", fill: "white" }),
|
|
201
|
+
N === "circle" ? /* @__PURE__ */ n(
|
|
202
|
+
"ellipse",
|
|
203
|
+
{
|
|
204
|
+
cx: a.x + a.width / 2,
|
|
205
|
+
cy: a.y + a.height / 2,
|
|
206
|
+
rx: a.width / 2,
|
|
207
|
+
ry: a.height / 2,
|
|
208
|
+
fill: "black"
|
|
209
|
+
}
|
|
210
|
+
) : /* @__PURE__ */ n("rect", { x: a.x, y: a.y, width: a.width, height: a.height, fill: "black" })
|
|
211
|
+
] }) }),
|
|
212
|
+
/* @__PURE__ */ n("rect", { width: "100%", height: "100%", fill: ee, mask: "url(#crop-mask)" })
|
|
213
|
+
] }),
|
|
214
|
+
/* @__PURE__ */ n(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
className: "bear-absolute bear-pointer-events-none",
|
|
218
|
+
style: {
|
|
219
|
+
left: a.x,
|
|
220
|
+
top: a.y,
|
|
221
|
+
width: a.width,
|
|
222
|
+
height: a.height,
|
|
223
|
+
border: `${ae}px solid ${te}`,
|
|
224
|
+
borderRadius: N === "circle" ? "50%" : 0,
|
|
225
|
+
boxShadow: "0 0 0 9999px transparent"
|
|
226
|
+
},
|
|
227
|
+
children: Z && /* @__PURE__ */ d("svg", { className: "bear-absolute bear-inset-0 bear-w-full bear-h-full", style: { opacity: C }, children: [
|
|
228
|
+
Array.from({ length: y - 1 }).map((e, t) => /* @__PURE__ */ n(
|
|
229
|
+
"line",
|
|
230
|
+
{
|
|
231
|
+
x1: `${(t + 1) / y * 100}%`,
|
|
232
|
+
y1: "0",
|
|
233
|
+
x2: `${(t + 1) / y * 100}%`,
|
|
234
|
+
y2: "100%",
|
|
235
|
+
stroke: "white",
|
|
236
|
+
strokeWidth: "0.5"
|
|
237
|
+
},
|
|
238
|
+
`v-${t}`
|
|
239
|
+
)),
|
|
240
|
+
Array.from({ length: y - 1 }).map((e, t) => /* @__PURE__ */ n(
|
|
241
|
+
"line",
|
|
242
|
+
{
|
|
243
|
+
x1: "0",
|
|
244
|
+
y1: `${(t + 1) / y * 100}%`,
|
|
245
|
+
x2: "100%",
|
|
246
|
+
y2: `${(t + 1) / y * 100}%`,
|
|
247
|
+
stroke: "white",
|
|
248
|
+
strokeWidth: "0.5"
|
|
249
|
+
},
|
|
250
|
+
`h-${t}`
|
|
251
|
+
))
|
|
252
|
+
] })
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
/* @__PURE__ */ n(
|
|
256
|
+
"div",
|
|
257
|
+
{
|
|
258
|
+
className: "bear-absolute bear-cursor-move",
|
|
259
|
+
style: { left: a.x, top: a.y, width: a.width, height: a.height },
|
|
260
|
+
onMouseDown: z("move")
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
["nw", "ne", "sw", "se"].map((e) => {
|
|
264
|
+
const t = e.includes("w"), i = e.includes("n");
|
|
265
|
+
return /* @__PURE__ */ n(
|
|
266
|
+
"div",
|
|
267
|
+
{
|
|
268
|
+
className: F(
|
|
269
|
+
"bear-absolute bear-bg-white bear-border-2 bear-rounded-sm",
|
|
270
|
+
"bear-shadow-md bear-z-10"
|
|
271
|
+
),
|
|
272
|
+
style: {
|
|
273
|
+
width: _,
|
|
274
|
+
height: _,
|
|
275
|
+
left: (t ? a.x : a.x + a.width) - _ / 2,
|
|
276
|
+
top: (i ? a.y : a.y + a.height) - _ / 2,
|
|
277
|
+
borderColor: "var(--bear-primary-500)",
|
|
278
|
+
cursor: `${e}-resize`
|
|
279
|
+
},
|
|
280
|
+
onMouseDown: z(e)
|
|
281
|
+
},
|
|
282
|
+
e
|
|
283
|
+
);
|
|
284
|
+
}),
|
|
285
|
+
["n", "s", "e", "w"].map((e) => {
|
|
286
|
+
const t = e === "n" || e === "s";
|
|
287
|
+
return /* @__PURE__ */ n(
|
|
288
|
+
"div",
|
|
289
|
+
{
|
|
290
|
+
className: "bear-absolute bear-z-10",
|
|
291
|
+
style: {
|
|
292
|
+
left: e === "w" ? a.x - 4 : e === "e" ? a.x + a.width - 4 : a.x + a.width / 2 - 12,
|
|
293
|
+
top: e === "n" ? a.y - 4 : e === "s" ? a.y + a.height - 4 : a.y + a.height / 2 - 12,
|
|
294
|
+
width: t ? 24 : 8,
|
|
295
|
+
height: t ? 8 : 24,
|
|
296
|
+
cursor: t ? `${e}-resize` : `${e}-resize`
|
|
297
|
+
},
|
|
298
|
+
onMouseDown: z(e)
|
|
299
|
+
},
|
|
300
|
+
e
|
|
301
|
+
);
|
|
302
|
+
})
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
(g || m) && /* @__PURE__ */ d(
|
|
307
|
+
"div",
|
|
308
|
+
{
|
|
309
|
+
className: F(
|
|
310
|
+
"bear-flex bear-items-center bear-gap-4 bear-px-4",
|
|
311
|
+
"bear-bg-gray-800/90 bear-backdrop-blur-sm"
|
|
312
|
+
),
|
|
313
|
+
style: { height: J },
|
|
314
|
+
children: [
|
|
315
|
+
g && /* @__PURE__ */ d("div", { className: "bear-flex bear-items-center bear-gap-2 bear-flex-1", children: [
|
|
316
|
+
/* @__PURE__ */ n("svg", { className: "bear-w-4 bear-h-4 bear-text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0zM10 7v3m0 0v3m0-3h3m-3 0H7" }) }),
|
|
317
|
+
/* @__PURE__ */ n(
|
|
318
|
+
"input",
|
|
319
|
+
{
|
|
320
|
+
type: "range",
|
|
321
|
+
min: T,
|
|
322
|
+
max: E,
|
|
323
|
+
step: P,
|
|
324
|
+
value: u,
|
|
325
|
+
onChange: (e) => R(parseFloat(e.target.value)),
|
|
326
|
+
className: "bear-flex-1 bear-h-1 bear-accent-pink-500"
|
|
327
|
+
}
|
|
328
|
+
),
|
|
329
|
+
/* @__PURE__ */ d("span", { className: "bear-text-xs bear-text-gray-400 bear-w-10 bear-text-right", children: [
|
|
330
|
+
(u * 100).toFixed(0),
|
|
331
|
+
"%"
|
|
332
|
+
] })
|
|
333
|
+
] }),
|
|
334
|
+
m && /* @__PURE__ */ d("div", { className: "bear-flex bear-items-center bear-gap-2 bear-flex-1", children: [
|
|
335
|
+
/* @__PURE__ */ n("svg", { className: "bear-w-4 bear-h-4 bear-text-gray-400", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" }) }),
|
|
336
|
+
/* @__PURE__ */ n(
|
|
337
|
+
"input",
|
|
338
|
+
{
|
|
339
|
+
type: "range",
|
|
340
|
+
min: S,
|
|
341
|
+
max: Q,
|
|
342
|
+
step: Te,
|
|
343
|
+
value: W,
|
|
344
|
+
onChange: (e) => fe(parseFloat(e.target.value)),
|
|
345
|
+
className: "bear-flex-1 bear-h-1 bear-accent-pink-500"
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
/* @__PURE__ */ d("span", { className: "bear-text-xs bear-text-gray-400 bear-w-10 bear-text-right", children: [
|
|
349
|
+
W,
|
|
350
|
+
"°"
|
|
351
|
+
] })
|
|
352
|
+
] })
|
|
353
|
+
]
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
);
|
|
359
|
+
};
|
|
360
|
+
export {
|
|
361
|
+
Re as Cropper
|
|
362
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Crop area coordinates
|
|
4
|
+
*/
|
|
5
|
+
export interface CropArea {
|
|
6
|
+
/** X position (px) */
|
|
7
|
+
x: number;
|
|
8
|
+
/** Y position (px) */
|
|
9
|
+
y: number;
|
|
10
|
+
/** Width (px) */
|
|
11
|
+
width: number;
|
|
12
|
+
/** Height (px) */
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Aspect ratio presets
|
|
17
|
+
*/
|
|
18
|
+
export type AspectRatioPreset = 'free' | '1:1' | '4:3' | '3:2' | '16:9' | '2:3' | '3:4' | '9:16';
|
|
19
|
+
/**
|
|
20
|
+
* Crop shape
|
|
21
|
+
*/
|
|
22
|
+
export type CropShape = 'rectangle' | 'circle';
|
|
23
|
+
export interface CropperProps {
|
|
24
|
+
/** Image source URL or data URL */
|
|
25
|
+
src: string;
|
|
26
|
+
/** Controlled crop area */
|
|
27
|
+
crop?: CropArea;
|
|
28
|
+
/** Called when crop area changes */
|
|
29
|
+
onCropChange?: (crop: CropArea) => void;
|
|
30
|
+
/** Called when crop is complete (on mouse up) */
|
|
31
|
+
onCropComplete?: (crop: CropArea, croppedImageUrl: string) => void;
|
|
32
|
+
/** Aspect ratio (number or preset) */
|
|
33
|
+
aspectRatio?: number | AspectRatioPreset;
|
|
34
|
+
/** Crop shape */
|
|
35
|
+
shape?: CropShape;
|
|
36
|
+
/** Zoom level (1 = original) */
|
|
37
|
+
zoom?: number;
|
|
38
|
+
/** Called when zoom changes */
|
|
39
|
+
onZoomChange?: (zoom: number) => void;
|
|
40
|
+
/** Min zoom level */
|
|
41
|
+
minZoom?: number;
|
|
42
|
+
/** Max zoom level */
|
|
43
|
+
maxZoom?: number;
|
|
44
|
+
/** Rotation angle in degrees */
|
|
45
|
+
rotation?: number;
|
|
46
|
+
/** Called when rotation changes */
|
|
47
|
+
onRotationChange?: (rotation: number) => void;
|
|
48
|
+
/** Show zoom slider */
|
|
49
|
+
showZoomSlider?: boolean;
|
|
50
|
+
/** Show rotation slider */
|
|
51
|
+
showRotationSlider?: boolean;
|
|
52
|
+
/** Show grid overlay */
|
|
53
|
+
showGrid?: boolean;
|
|
54
|
+
/** Grid opacity (0-1) */
|
|
55
|
+
gridOpacity?: number;
|
|
56
|
+
/** Overlay color (the dark area outside crop) */
|
|
57
|
+
overlayColor?: string;
|
|
58
|
+
/** Border color of crop area */
|
|
59
|
+
borderColor?: string;
|
|
60
|
+
/** Border width in px */
|
|
61
|
+
borderWidth?: number;
|
|
62
|
+
/** Width of the cropper */
|
|
63
|
+
width?: string | number;
|
|
64
|
+
/** Height of the cropper */
|
|
65
|
+
height?: string | number;
|
|
66
|
+
/** Custom class name */
|
|
67
|
+
className?: string;
|
|
68
|
+
/** Custom styles */
|
|
69
|
+
style?: CSSProperties;
|
|
70
|
+
/** Test ID */
|
|
71
|
+
testId?: string;
|
|
72
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("../../utils/cn.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("../../utils/cn.cjs");require("react");const S=({columns:t,data:i,rowKey:h,variant:l="simple",loading:o=!1,emptyContent:x="No data available",onRowClick:d,clickable:c=!1,sortColumn:y,sortDirection:p="asc",onSort:n,compact:g=!1,stickyHeader:j=!1,maxHeight:f,className:k,testId:N})=>{const v=e=>{const b=t.find(a=>a.key===e);b!=null&&b.sortable&&n&&n(e)},m=g?"bear-px-3 bear-py-2":"bear-px-4 bear-py-3",M=g?"bear-px-3 bear-py-2":"bear-px-4 bear-py-3";return r.jsx("div",{className:s.cn("bear-w-full bear-overflow-hidden bear-rounded-lg bear-border bear-border-gray-200 dark:bear-border-gray-700",k),"data-testid":N,children:r.jsx("div",{className:"bear-overflow-auto",style:{maxHeight:f},children:r.jsxs("table",{className:"bear-w-full bear-border-collapse bear-text-sm",children:[r.jsx("thead",{className:s.cn("bear-bg-gray-50 dark:bear-bg-gray-800",j&&"bear-sticky bear-top-0 bear-z-10"),children:r.jsx("tr",{children:t.map(e=>r.jsx("th",{className:s.cn(M,"bear-text-left bear-font-semibold bear-text-gray-700 dark:bear-text-gray-200","bear-border-b bear-border-gray-200 dark:bear-border-gray-700",e.align==="center"&&"bear-text-center",e.align==="right"&&"bear-text-right",e.sortable&&"bear-cursor-pointer hover:bear-bg-gray-100 dark:hover:bear-bg-gray-700",e.hideOnMobile&&"bear-hidden md:bear-table-cell"),style:{width:e.width},onClick:()=>e.sortable&&v(e.key),children:r.jsxs("div",{className:"bear-flex bear-items-center bear-gap-1",children:[e.header,e.sortable&&y===e.key&&r.jsx("svg",{className:s.cn("bear-w-4 bear-h-4 bear-transition-transform",p==="desc"&&"bear-rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15l7-7 7 7"})})]})},e.key))})}),r.jsx("tbody",{className:"bear-bg-white dark:bear-bg-gray-900",children:o?r.jsx("tr",{children:r.jsx("td",{colSpan:t.length,className:"bear-py-12 bear-text-center",children:r.jsx("div",{className:"bear-flex bear-justify-center",children:r.jsxs("svg",{className:"bear-animate-spin bear-w-6 bear-h-6 bear-text-amber-500",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{className:"bear-opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),r.jsx("path",{className:"bear-opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})})}):i.length===0?r.jsx("tr",{children:r.jsx("td",{colSpan:t.length,className:"bear-py-12 bear-text-center bear-text-gray-500 dark:bear-text-gray-400",children:x})}):i.map((e,b)=>r.jsx("tr",{onClick:()=>(c||d)&&(d==null?void 0:d(e,b)),className:s.cn(l==="striped"&&b%2===1&&"bear-bg-gray-50 dark:bear-bg-gray-800/50",l==="bordered"&&"bear-border-b bear-border-gray-200 dark:bear-border-gray-700",(c||d)&&"bear-cursor-pointer hover:bear-bg-amber-50 dark:hover:bear-bg-amber-900/10",l!=="bordered"&&"bear-border-b bear-border-gray-100 dark:bear-border-gray-800"),children:t.map(a=>r.jsx("td",{className:s.cn(m,"bear-text-gray-900 dark:bear-text-white",a.align==="center"&&"bear-text-center",a.align==="right"&&"bear-text-right",a.hideOnMobile&&"bear-hidden md:bear-table-cell"),children:a.cell?a.cell(e,b):a.accessor?a.accessor(e):String(e[a.key]??"")},a.key))},h(e,b)))})]})})})},q=t=>t;exports.DataTable=S;exports.createColumns=q;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import { cn as d } from "../../utils/cn.js";
|
|
3
|
-
|
|
3
|
+
import "react";
|
|
4
|
+
const L = ({
|
|
4
5
|
columns: t,
|
|
5
6
|
data: h,
|
|
6
7
|
rowKey: n,
|
|
@@ -113,8 +114,8 @@ const B = ({
|
|
|
113
114
|
)
|
|
114
115
|
}
|
|
115
116
|
);
|
|
116
|
-
},
|
|
117
|
+
}, O = (t) => t;
|
|
117
118
|
export {
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
L as DataTable,
|
|
120
|
+
O as createColumns
|
|
120
121
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("../../utils/cn.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("../../utils/cn.cjs");require("react");const l={solid:"bear-border-solid",dashed:"bear-border-dashed",dotted:"bear-border-dotted"},u={left:"before:bear-w-4 after:bear-flex-1",center:"before:bear-flex-1 after:bear-flex-1",right:"before:bear-flex-1 after:bear-w-4"},c=({children:i,orientation:n="horizontal",variant:b="solid",color:d,textAlign:x="center",thickness:r=1,spacing:a=4,className:s,testId:f,style:m,...h})=>{const e=n==="horizontal";return i?o.jsxs("div",{className:t.cn("bear-flex bear-items-center bear-gap-4",e?"bear-w-full":"bear-flex-col bear-h-full",u[x],s),role:"separator",style:{marginTop:e?`${a*.25}rem`:0,marginBottom:e?`${a*.25}rem`:0,...m},"data-testid":f,children:[o.jsx("span",{className:t.cn("bear-flex-shrink-0",l[b]),style:{borderTopWidth:e?r:0,borderLeftWidth:e?0:r,borderColor:d||"#e5e7eb"}}),o.jsx("span",{className:"bear-text-sm bear-text-gray-500 bear-whitespace-nowrap bear-px-2",children:i}),o.jsx("span",{className:t.cn("bear-flex-shrink-0",l[b]),style:{borderTopWidth:e?r:0,borderLeftWidth:e?0:r,borderColor:d||"#e5e7eb"}})]}):o.jsx("hr",{className:t.cn("bear-border-0",e?"bear-w-full":"bear-h-full bear-w-px",l[b],s),style:{borderTopWidth:e?r:0,borderLeftWidth:e?0:r,borderColor:d||"#e5e7eb",marginTop:e?`${a*.25}rem`:0,marginBottom:e?`${a*.25}rem`:0,marginLeft:e?0:`${a*.25}rem`,marginRight:e?0:`${a*.25}rem`,...m},"data-testid":f,...h})};exports.Divider=c;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a, jsxs as p } from "react/jsx-runtime";
|
|
2
2
|
import { cn as t } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
3
4
|
const l = {
|
|
4
5
|
solid: "bear-border-solid",
|
|
5
6
|
dashed: "bear-border-dashed",
|
|
@@ -8,14 +9,14 @@ const l = {
|
|
|
8
9
|
left: "before:bear-w-4 after:bear-flex-1",
|
|
9
10
|
center: "before:bear-flex-1 after:bear-flex-1",
|
|
10
11
|
right: "before:bear-flex-1 after:bear-w-4"
|
|
11
|
-
},
|
|
12
|
+
}, N = ({
|
|
12
13
|
children: f,
|
|
13
14
|
orientation: x = "horizontal",
|
|
14
15
|
variant: b = "solid",
|
|
15
16
|
color: d,
|
|
16
17
|
textAlign: h = "center",
|
|
17
18
|
thickness: r = 1,
|
|
18
|
-
spacing:
|
|
19
|
+
spacing: o = 4,
|
|
19
20
|
className: m,
|
|
20
21
|
testId: i,
|
|
21
22
|
style: s,
|
|
@@ -33,13 +34,13 @@ const l = {
|
|
|
33
34
|
),
|
|
34
35
|
role: "separator",
|
|
35
36
|
style: {
|
|
36
|
-
marginTop: e ? `${
|
|
37
|
-
marginBottom: e ? `${
|
|
37
|
+
marginTop: e ? `${o * 0.25}rem` : 0,
|
|
38
|
+
marginBottom: e ? `${o * 0.25}rem` : 0,
|
|
38
39
|
...s
|
|
39
40
|
},
|
|
40
41
|
"data-testid": i,
|
|
41
42
|
children: [
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ a(
|
|
43
44
|
"span",
|
|
44
45
|
{
|
|
45
46
|
className: t(
|
|
@@ -53,8 +54,8 @@ const l = {
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ a("span", { className: "bear-text-sm bear-text-gray-500 bear-whitespace-nowrap bear-px-2", children: f }),
|
|
58
|
+
/* @__PURE__ */ a(
|
|
58
59
|
"span",
|
|
59
60
|
{
|
|
60
61
|
className: t(
|
|
@@ -70,7 +71,7 @@ const l = {
|
|
|
70
71
|
)
|
|
71
72
|
]
|
|
72
73
|
}
|
|
73
|
-
) : /* @__PURE__ */
|
|
74
|
+
) : /* @__PURE__ */ a(
|
|
74
75
|
"hr",
|
|
75
76
|
{
|
|
76
77
|
className: t(
|
|
@@ -83,10 +84,10 @@ const l = {
|
|
|
83
84
|
borderTopWidth: e ? r : 0,
|
|
84
85
|
borderLeftWidth: e ? 0 : r,
|
|
85
86
|
borderColor: d || "#e5e7eb",
|
|
86
|
-
marginTop: e ? `${
|
|
87
|
-
marginBottom: e ? `${
|
|
88
|
-
marginLeft: e ? 0 : `${
|
|
89
|
-
marginRight: e ? 0 : `${
|
|
87
|
+
marginTop: e ? `${o * 0.25}rem` : 0,
|
|
88
|
+
marginBottom: e ? `${o * 0.25}rem` : 0,
|
|
89
|
+
marginLeft: e ? 0 : `${o * 0.25}rem`,
|
|
90
|
+
marginRight: e ? 0 : `${o * 0.25}rem`,
|
|
90
91
|
...s
|
|
91
92
|
},
|
|
92
93
|
"data-testid": i,
|
|
@@ -95,5 +96,5 @@ const l = {
|
|
|
95
96
|
);
|
|
96
97
|
};
|
|
97
98
|
export {
|
|
98
|
-
|
|
99
|
+
N as Divider
|
|
99
100
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),s=require("react"),o=require("../../utils/cn.cjs"),r=require("./Dock.const.cjs"),S=(c,i,a,t,d)=>{if(i<0)return t;const l=Math.abs(c-i);if(l>a)return t;const u=1-l/(a+1);return t+(d-t)*u},O=c=>{const{items:i,position:a="bottom",iconSize:t=r.DEFAULT_ICON_SIZE,magnifiedSize:d=r.DEFAULT_MAGNIFIED_SIZE,magnification:l=!0,magnificationDistance:u=r.DEFAULT_MAGNIFICATION_DISTANCE,showLabels:p=!0,className:h,style:D,testId:I}=c,[f,x]=s.useState(-1),[k,_]=s.useState(""),m=s.useRef(null),y=a==="left"||a==="right",N=s.useCallback((e,n)=>{x(e),_(n.label)},[]),v=s.useCallback(()=>{x(-1),_("")},[]);return b.jsx("div",{ref:m,className:o.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",r.DOCK_POSITION_CLASSES[a],y&&"bear-items-center",h),style:{padding:r.DOCK_PADDING,zIndex:r.DOCK_Z_INDEX,...D},"data-testid":I,role:"toolbar","aria-label":"Dock",onMouseLeave:v,children:i.map((e,n)=>{const g=l?S(n,f,u,t,d):t;return b.jsxs("div",{className:"Bear-Dock__item bear-relative bear-flex bear-flex-col bear-items-center",children:[p&&f===n&&k&&b.jsx("div",{className:o.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",r.TOOLTIP_POSITION_CLASSES[a]),role:"tooltip",children:e.label}),b.jsx("button",{className:o.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:g,height:g,transitionDuration:`${r.SPRING_DURATION}ms`,transitionTimingFunction:"cubic-bezier(0.25, 0.1, 0.25, 1)"},onClick:e.disabled?void 0:e.onClick,onMouseEnter:()=>N(n,e),disabled:e.disabled,"aria-label":e.label,children:b.jsx("span",{className:o.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:g*r.ICON_SCALE_RATIO},children:e.icon})}),e.badge!==void 0&&b.jsx("span",{className:o.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&&a==="bottom"&&b.jsx("div",{className:o.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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=48,t=72,r=2,I=8,a=150,b=.5,_={top:"bear-fixed bear-top-2 bear-left-1/2 bear--translate-x-1/2 bear-flex-row",bottom:"bear-fixed bear-bottom-2 bear-left-1/2 bear--translate-x-1/2 bear-flex-row",left:"bear-fixed bear-left-2 bear-top-1/2 bear--translate-y-1/2 bear-flex-col",right:"bear-fixed bear-right-2 bear-top-1/2 bear--translate-y-1/2 bear-flex-col"},o={bottom:"bear-bottom-full bear-mb-2",top:"bear-top-full bear-mt-2",left:"bear-left-full bear-ml-2",right:"bear-right-full bear-mr-2"},O=9998;exports.DEFAULT_ICON_SIZE=e;exports.DEFAULT_MAGNIFICATION_DISTANCE=r;exports.DEFAULT_MAGNIFIED_SIZE=t;exports.DOCK_PADDING=I;exports.DOCK_POSITION_CLASSES=_;exports.DOCK_Z_INDEX=O;exports.ICON_SCALE_RATIO=b;exports.SPRING_DURATION=a;exports.TOOLTIP_POSITION_CLASSES=o;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DockPosition } from './Dock.types';
|
|
2
|
+
/** Default icon size in pixels */
|
|
3
|
+
export declare const DEFAULT_ICON_SIZE = 48;
|
|
4
|
+
/** Default magnified size in pixels */
|
|
5
|
+
export declare const DEFAULT_MAGNIFIED_SIZE = 72;
|
|
6
|
+
/** Default magnification distance (neighbor count) */
|
|
7
|
+
export declare const DEFAULT_MAGNIFICATION_DISTANCE = 2;
|
|
8
|
+
/** Dock padding in pixels */
|
|
9
|
+
export declare const DOCK_PADDING = 8;
|
|
10
|
+
/** Animation spring duration in ms */
|
|
11
|
+
export declare const SPRING_DURATION = 150;
|
|
12
|
+
/** Badge min width in pixels */
|
|
13
|
+
export declare const BADGE_MIN_SIZE = 18;
|
|
14
|
+
/** Badge font size in pixels */
|
|
15
|
+
export declare const BADGE_FONT_SIZE = 10;
|
|
16
|
+
/** Active dot size in pixels */
|
|
17
|
+
export declare const ACTIVE_DOT_SIZE = 4;
|
|
18
|
+
/** Icon scale ratio (icon content vs container) */
|
|
19
|
+
export declare const ICON_SCALE_RATIO = 0.5;
|
|
20
|
+
/** Position classes */
|
|
21
|
+
export declare const DOCK_POSITION_CLASSES: Record<DockPosition, string>;
|
|
22
|
+
/** Tooltip position classes */
|
|
23
|
+
export declare const TOOLTIP_POSITION_CLASSES: Record<DockPosition, string>;
|
|
24
|
+
/** Z-index for dock */
|
|
25
|
+
export declare const DOCK_Z_INDEX = 9998;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const e = 48, t = 72, r = 2, a = 8, b = 150, o = 0.5, l = {
|
|
2
|
+
top: "bear-fixed bear-top-2 bear-left-1/2 bear--translate-x-1/2 bear-flex-row",
|
|
3
|
+
bottom: "bear-fixed bear-bottom-2 bear-left-1/2 bear--translate-x-1/2 bear-flex-row",
|
|
4
|
+
left: "bear-fixed bear-left-2 bear-top-1/2 bear--translate-y-1/2 bear-flex-col",
|
|
5
|
+
right: "bear-fixed bear-right-2 bear-top-1/2 bear--translate-y-1/2 bear-flex-col"
|
|
6
|
+
}, I = {
|
|
7
|
+
bottom: "bear-bottom-full bear-mb-2",
|
|
8
|
+
top: "bear-top-full bear-mt-2",
|
|
9
|
+
left: "bear-left-full bear-ml-2",
|
|
10
|
+
right: "bear-right-full bear-mr-2"
|
|
11
|
+
}, f = 9998;
|
|
12
|
+
export {
|
|
13
|
+
e as DEFAULT_ICON_SIZE,
|
|
14
|
+
r as DEFAULT_MAGNIFICATION_DISTANCE,
|
|
15
|
+
t as DEFAULT_MAGNIFIED_SIZE,
|
|
16
|
+
a as DOCK_PADDING,
|
|
17
|
+
l as DOCK_POSITION_CLASSES,
|
|
18
|
+
f as DOCK_Z_INDEX,
|
|
19
|
+
o as ICON_SCALE_RATIO,
|
|
20
|
+
b as SPRING_DURATION,
|
|
21
|
+
I as TOOLTIP_POSITION_CLASSES
|
|
22
|
+
};
|