@forgedevstack/bear 1.0.8 → 1.1.0
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 +11 -1
- 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/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.js +56 -55
- package/dist/components/Button/Button.types.d.ts +7 -0
- 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/FileTree/FileTree.cjs +1 -0
- package/dist/components/FileTree/FileTree.d.ts +3 -0
- package/dist/components/FileTree/FileTree.js +46 -0
- package/dist/components/FileTree/FileTree.types.d.ts +30 -0
- package/dist/components/FileTree/index.d.ts +2 -0
- 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/ResizablePanel/ResizablePanel.cjs +1 -0
- package/dist/components/ResizablePanel/ResizablePanel.const.cjs +1 -0
- package/dist/components/ResizablePanel/ResizablePanel.const.d.ts +11 -0
- package/dist/components/ResizablePanel/ResizablePanel.const.js +11 -0
- package/dist/components/ResizablePanel/ResizablePanel.d.ts +17 -0
- package/dist/components/ResizablePanel/ResizablePanel.js +70 -0
- package/dist/components/ResizablePanel/ResizablePanel.types.d.ts +21 -0
- package/dist/components/ResizablePanel/ResizablePanel.utils.cjs +1 -0
- package/dist/components/ResizablePanel/ResizablePanel.utils.d.ts +10 -0
- package/dist/components/ResizablePanel/ResizablePanel.utils.js +11 -0
- package/dist/components/ResizablePanel/index.d.ts +2 -0
- package/dist/components/ResizableTextarea/ResizableTextarea.cjs +1 -0
- package/dist/components/ResizableTextarea/ResizableTextarea.const.cjs +1 -0
- package/dist/components/ResizableTextarea/ResizableTextarea.const.d.ts +2 -0
- package/dist/components/ResizableTextarea/ResizableTextarea.const.js +5 -0
- package/dist/components/ResizableTextarea/ResizableTextarea.d.ts +3 -0
- package/dist/components/ResizableTextarea/ResizableTextarea.js +60 -0
- package/dist/components/ResizableTextarea/ResizableTextarea.types.d.ts +15 -0
- package/dist/components/ResizableTextarea/index.d.ts +2 -0
- 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/Typography/Typography.cjs +1 -1
- package/dist/components/Typography/Typography.const.cjs +1 -0
- package/dist/components/Typography/Typography.const.d.ts +22 -0
- package/dist/components/Typography/Typography.const.js +91 -0
- package/dist/components/Typography/Typography.js +75 -138
- package/dist/components/Typography/Typography.types.d.ts +17 -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 +33 -1
- package/dist/components/index.js +270 -237
- 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 +335 -295
- 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
|
@@ -1,122 +1,269 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as M, jsx as t, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
+
import { useState as n, useRef as X, Children as de, useCallback as c, useEffect as ue } from "react";
|
|
3
3
|
import { cn as b } from "../../utils/cn.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
import { DEFAULT_TRANSITION_DURATION as he, MIN_SWIPE_DISTANCE as w, PROGRESS_BAR_HEIGHT as fe, DEFAULT_ACTIVE_COLOR as ge, ARROW_BUTTON_SIZE as N, DEFAULT_THUMBNAIL_SIZE as me } from "./Carousel.const.js";
|
|
5
|
+
const we = ({
|
|
6
|
+
children: F,
|
|
7
|
+
autoPlay: m = 0,
|
|
8
|
+
showDots: P = !0,
|
|
9
|
+
showArrows: H = !0,
|
|
10
|
+
loop: y = !0,
|
|
11
|
+
slidesToShow: d = 1,
|
|
12
|
+
gap: I = 16,
|
|
13
|
+
pauseOnHover: _ = !0,
|
|
14
|
+
onSlideChange: p,
|
|
15
|
+
transition: v = "slide",
|
|
16
|
+
transitionDuration: u = he,
|
|
17
|
+
indicator: k = "dots",
|
|
18
|
+
thumbnails: L,
|
|
19
|
+
thumbnailSize: R = me,
|
|
20
|
+
keyboard: T = !0,
|
|
21
|
+
draggable: j = !0,
|
|
22
|
+
showProgress: K = !1,
|
|
23
|
+
showCounter: V = !1,
|
|
24
|
+
activeColor: h = ge,
|
|
25
|
+
className: Y,
|
|
26
|
+
style: Z,
|
|
27
|
+
testId: q
|
|
16
28
|
}) => {
|
|
17
|
-
const [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
const [a, J] = n(0), [z, C] = n(!1), [U, Q] = n(null), [D, S] = n(null), [G, O] = n(!1), ee = X(null), $ = X(null), x = de.toArray(F), f = x.length, s = Math.max(0, f - d), o = c(
|
|
30
|
+
(r) => {
|
|
31
|
+
if (G) return;
|
|
32
|
+
let e = r;
|
|
33
|
+
y ? r < 0 ? e = s : r > s && (e = 0) : e = Math.max(0, Math.min(s, r)), O(!0), J(e), p == null || p(e), setTimeout(() => O(!1), u);
|
|
34
|
+
},
|
|
35
|
+
[G, y, s, p, u]
|
|
36
|
+
), l = c(() => o(a + 1), [o, a]), i = c(() => o(a - 1), [o, a]);
|
|
37
|
+
ue(() => {
|
|
38
|
+
if (m > 0 && !z)
|
|
39
|
+
return $.current = setInterval(l, m), () => {
|
|
40
|
+
$.current && clearInterval($.current);
|
|
41
|
+
};
|
|
42
|
+
}, [m, z, l]);
|
|
43
|
+
const re = c(
|
|
44
|
+
(r) => {
|
|
45
|
+
T && (r.key === "ArrowLeft" ? i() : r.key === "ArrowRight" && l());
|
|
46
|
+
},
|
|
47
|
+
[T, i, l]
|
|
48
|
+
), ae = (r) => {
|
|
49
|
+
S(null), Q(r.targetTouches[0].clientX);
|
|
50
|
+
}, te = (r) => {
|
|
51
|
+
S(r.targetTouches[0].clientX);
|
|
52
|
+
}, se = () => {
|
|
53
|
+
if (!U || !D) return;
|
|
54
|
+
const r = U - D;
|
|
55
|
+
r > w ? l() : r < -w && i();
|
|
56
|
+
}, [E, A] = n(!1), [B, oe] = n(0), le = c(
|
|
57
|
+
(r) => {
|
|
58
|
+
j && (A(!0), oe(r.clientX));
|
|
59
|
+
},
|
|
60
|
+
[j]
|
|
61
|
+
), ne = c(
|
|
62
|
+
(r) => {
|
|
63
|
+
if (!E) return;
|
|
64
|
+
A(!1);
|
|
65
|
+
const e = B - r.clientX;
|
|
66
|
+
e > w ? l() : e < -w && i();
|
|
67
|
+
},
|
|
68
|
+
[E, B, l, i]
|
|
69
|
+
), W = `calc((100% - ${I * (d - 1)}px) / ${d})`, be = (r) => {
|
|
70
|
+
const e = r === a, g = `${u}ms`;
|
|
71
|
+
switch (v) {
|
|
72
|
+
case "fade":
|
|
73
|
+
return {
|
|
74
|
+
position: "absolute",
|
|
75
|
+
inset: 0,
|
|
76
|
+
opacity: e ? 1 : 0,
|
|
77
|
+
transition: `opacity ${g} ease-in-out`,
|
|
78
|
+
zIndex: e ? 1 : 0,
|
|
79
|
+
pointerEvents: e ? "auto" : "none"
|
|
80
|
+
};
|
|
81
|
+
case "zoom":
|
|
82
|
+
return {
|
|
83
|
+
position: "absolute",
|
|
84
|
+
inset: 0,
|
|
85
|
+
opacity: e ? 1 : 0,
|
|
86
|
+
transform: e ? "scale(1)" : "scale(0.85)",
|
|
87
|
+
transition: `opacity ${g} ease, transform ${g} ease`,
|
|
88
|
+
zIndex: e ? 1 : 0,
|
|
89
|
+
pointerEvents: e ? "auto" : "none"
|
|
90
|
+
};
|
|
91
|
+
case "flip":
|
|
92
|
+
return {
|
|
93
|
+
position: "absolute",
|
|
94
|
+
inset: 0,
|
|
95
|
+
opacity: e ? 1 : 0,
|
|
96
|
+
transform: e ? "rotateY(0deg)" : "rotateY(90deg)",
|
|
97
|
+
transition: `opacity ${g} ease, transform ${g} ease`,
|
|
98
|
+
zIndex: e ? 1 : 0,
|
|
99
|
+
pointerEvents: e ? "auto" : "none",
|
|
100
|
+
backfaceVisibility: "hidden"
|
|
101
|
+
};
|
|
102
|
+
case "slide":
|
|
103
|
+
default:
|
|
104
|
+
return {};
|
|
24
105
|
}
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
let r = e;
|
|
28
|
-
i ? e < 0 ? r = s : e > s && (r = 0) : r = Math.max(0, Math.min(s, e)), C(r), d == null || d(r);
|
|
29
|
-
}, f = () => h(t + 1), w = () => h(t - 1), N = 50, X = (e) => {
|
|
30
|
-
x(null), R(e.targetTouches[0].clientX);
|
|
31
|
-
}, z = (e) => {
|
|
32
|
-
x(e.targetTouches[0].clientX);
|
|
33
|
-
}, A = () => {
|
|
34
|
-
if (!v || !y) return;
|
|
35
|
-
const e = v - y, r = e > N, B = e < -N;
|
|
36
|
-
r ? f() : B && w();
|
|
37
|
-
}, M = `calc((100% - ${c * (n - 1)}px) / ${n})`;
|
|
38
|
-
return /* @__PURE__ */ j(
|
|
106
|
+
}, ie = v === "fade" || v === "zoom" || v === "flip";
|
|
107
|
+
return /* @__PURE__ */ M(
|
|
39
108
|
"div",
|
|
40
109
|
{
|
|
41
|
-
ref:
|
|
42
|
-
className: b("bear-relative bear-overflow-hidden",
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
110
|
+
ref: ee,
|
|
111
|
+
className: b("bear-relative bear-overflow-hidden bear-outline-none", Y),
|
|
112
|
+
style: Z,
|
|
113
|
+
onMouseEnter: () => _ && C(!0),
|
|
114
|
+
onMouseLeave: () => {
|
|
115
|
+
_ && C(!1), E && A(!1);
|
|
116
|
+
},
|
|
117
|
+
onTouchStart: ae,
|
|
118
|
+
onTouchMove: te,
|
|
119
|
+
onTouchEnd: se,
|
|
120
|
+
onMouseDown: le,
|
|
121
|
+
onMouseUp: ne,
|
|
122
|
+
onKeyDown: re,
|
|
123
|
+
tabIndex: T ? 0 : void 0,
|
|
124
|
+
"data-testid": q,
|
|
125
|
+
role: "region",
|
|
126
|
+
"aria-label": "Carousel",
|
|
127
|
+
"aria-roledescription": "carousel",
|
|
49
128
|
children: [
|
|
50
|
-
/* @__PURE__ */
|
|
129
|
+
K && m > 0 && /* @__PURE__ */ t(
|
|
51
130
|
"div",
|
|
52
131
|
{
|
|
53
|
-
className: "bear-
|
|
54
|
-
style: {
|
|
55
|
-
|
|
56
|
-
transform: `translateX(calc(-${t} * (${M} + ${c}px)))`
|
|
57
|
-
},
|
|
58
|
-
children: p.map((e, r) => /* @__PURE__ */ a(
|
|
132
|
+
className: "bear-absolute bear-top-0 bear-left-0 bear-right-0 bear-z-20",
|
|
133
|
+
style: { height: fe },
|
|
134
|
+
children: /* @__PURE__ */ t(
|
|
59
135
|
"div",
|
|
60
136
|
{
|
|
61
|
-
className: "bear-
|
|
62
|
-
style: {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
137
|
+
className: "bear-h-full bear-transition-all bear-ease-linear",
|
|
138
|
+
style: {
|
|
139
|
+
width: `${(a + 1) / f * 100}%`,
|
|
140
|
+
background: h,
|
|
141
|
+
transition: `width ${u}ms ease`
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
)
|
|
67
145
|
}
|
|
68
146
|
),
|
|
69
|
-
|
|
70
|
-
|
|
147
|
+
ie ? /* @__PURE__ */ t("div", { className: "bear-relative", style: { minHeight: 200 }, children: x.map((r, e) => /* @__PURE__ */ t("div", { style: be(e), children: r }, e)) }) : /* @__PURE__ */ t(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
className: "bear-flex",
|
|
151
|
+
style: {
|
|
152
|
+
gap: `${I}px`,
|
|
153
|
+
transform: `translateX(calc(-${a} * (${W} + ${I}px)))`,
|
|
154
|
+
transition: `transform ${u}ms cubic-bezier(0.25, 0.1, 0.25, 1)`
|
|
155
|
+
},
|
|
156
|
+
children: x.map((r, e) => /* @__PURE__ */ t("div", { className: "bear-shrink-0", style: { width: W }, children: r }, e))
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
H && f > d && /* @__PURE__ */ M(ce, { children: [
|
|
160
|
+
/* @__PURE__ */ t(
|
|
71
161
|
"button",
|
|
72
162
|
{
|
|
73
|
-
onClick:
|
|
74
|
-
disabled: !
|
|
163
|
+
onClick: i,
|
|
164
|
+
disabled: !y && a === 0,
|
|
75
165
|
className: b(
|
|
76
166
|
"bear-absolute bear-left-2 bear-top-1/2 bear--translate-y-1/2",
|
|
77
|
-
"bear-
|
|
167
|
+
"bear-rounded-full bear-flex bear-items-center bear-justify-center",
|
|
78
168
|
"bear-bg-white/90 dark:bear-bg-gray-800/90 bear-shadow-lg",
|
|
79
169
|
"bear-text-gray-700 dark:bear-text-gray-200",
|
|
80
170
|
"hover:bear-bg-white dark:hover:bear-bg-gray-700",
|
|
81
171
|
"bear-transition-all bear-z-10",
|
|
82
172
|
"disabled:bear-opacity-50 disabled:bear-cursor-not-allowed"
|
|
83
173
|
),
|
|
84
|
-
|
|
174
|
+
style: { width: N, height: N },
|
|
175
|
+
"aria-label": "Previous slide",
|
|
176
|
+
children: /* @__PURE__ */ t("svg", { className: "bear-w-5 bear-h-5", 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" }) })
|
|
85
177
|
}
|
|
86
178
|
),
|
|
87
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ t(
|
|
88
180
|
"button",
|
|
89
181
|
{
|
|
90
|
-
onClick:
|
|
91
|
-
disabled: !
|
|
182
|
+
onClick: l,
|
|
183
|
+
disabled: !y && a === s,
|
|
92
184
|
className: b(
|
|
93
185
|
"bear-absolute bear-right-2 bear-top-1/2 bear--translate-y-1/2",
|
|
94
|
-
"bear-
|
|
186
|
+
"bear-rounded-full bear-flex bear-items-center bear-justify-center",
|
|
95
187
|
"bear-bg-white/90 dark:bear-bg-gray-800/90 bear-shadow-lg",
|
|
96
188
|
"bear-text-gray-700 dark:bear-text-gray-200",
|
|
97
189
|
"hover:bear-bg-white dark:hover:bear-bg-gray-700",
|
|
98
190
|
"bear-transition-all bear-z-10",
|
|
99
191
|
"disabled:bear-opacity-50 disabled:bear-cursor-not-allowed"
|
|
100
192
|
),
|
|
101
|
-
|
|
193
|
+
style: { width: N, height: N },
|
|
194
|
+
"aria-label": "Next slide",
|
|
195
|
+
children: /* @__PURE__ */ t("svg", { className: "bear-w-5 bear-h-5", 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" }) })
|
|
102
196
|
}
|
|
103
197
|
)
|
|
104
198
|
] }),
|
|
105
|
-
|
|
199
|
+
V && /* @__PURE__ */ M("div", { className: "bear-absolute bear-top-3 bear-right-3 bear-z-10 bear-bg-black/50 bear-text-white bear-text-xs bear-font-medium bear-px-2.5 bear-py-1 bear-rounded-full", children: [
|
|
200
|
+
a + 1,
|
|
201
|
+
" / ",
|
|
202
|
+
f
|
|
203
|
+
] }),
|
|
204
|
+
P && k !== "none" && f > d && /* @__PURE__ */ t("div", { className: "bear-flex bear-justify-center bear-gap-2 bear-mt-4", children: k === "thumbnails" && L ? L.map((r, e) => /* @__PURE__ */ t(
|
|
106
205
|
"button",
|
|
107
206
|
{
|
|
108
|
-
onClick: () =>
|
|
207
|
+
onClick: () => o(e),
|
|
109
208
|
className: b(
|
|
110
|
-
"bear-
|
|
111
|
-
|
|
112
|
-
)
|
|
209
|
+
"bear-rounded bear-overflow-hidden bear-border-2 bear-transition-all",
|
|
210
|
+
e === a ? "bear-opacity-100 bear-scale-110" : "bear-opacity-60 hover:bear-opacity-80"
|
|
211
|
+
),
|
|
212
|
+
style: {
|
|
213
|
+
width: R,
|
|
214
|
+
height: R,
|
|
215
|
+
borderColor: e === a ? h : "transparent"
|
|
216
|
+
},
|
|
217
|
+
"aria-label": `Go to slide ${e + 1}`,
|
|
218
|
+
children: /* @__PURE__ */ t("img", { src: r, alt: "", className: "bear-w-full bear-h-full bear-object-cover" })
|
|
113
219
|
},
|
|
114
|
-
|
|
115
|
-
)) })
|
|
220
|
+
e
|
|
221
|
+
)) : k === "numbers" ? Array.from({ length: s + 1 }).map((r, e) => /* @__PURE__ */ t(
|
|
222
|
+
"button",
|
|
223
|
+
{
|
|
224
|
+
onClick: () => o(e),
|
|
225
|
+
className: b(
|
|
226
|
+
"bear-w-7 bear-h-7 bear-rounded-full bear-text-xs bear-font-medium bear-transition-all",
|
|
227
|
+
"bear-flex bear-items-center bear-justify-center",
|
|
228
|
+
e === a ? "bear-text-white bear-shadow-md" : "bear-bg-gray-200 dark:bear-bg-gray-600 bear-text-gray-600 dark:bear-text-gray-300 hover:bear-bg-gray-300 dark:hover:bear-bg-gray-500"
|
|
229
|
+
),
|
|
230
|
+
style: e === a ? { background: h } : void 0,
|
|
231
|
+
"aria-label": `Go to slide ${e + 1}`,
|
|
232
|
+
children: e + 1
|
|
233
|
+
},
|
|
234
|
+
e
|
|
235
|
+
)) : k === "bars" ? Array.from({ length: s + 1 }).map((r, e) => /* @__PURE__ */ t(
|
|
236
|
+
"button",
|
|
237
|
+
{
|
|
238
|
+
onClick: () => o(e),
|
|
239
|
+
className: b(
|
|
240
|
+
"bear-h-1 bear-rounded-full bear-transition-all",
|
|
241
|
+
e === a ? "bear-w-8" : "bear-w-4 bear-bg-gray-300 dark:bear-bg-gray-600 hover:bear-bg-gray-400 dark:hover:bear-bg-gray-500"
|
|
242
|
+
),
|
|
243
|
+
style: e === a ? { background: h } : void 0,
|
|
244
|
+
"aria-label": `Go to slide ${e + 1}`
|
|
245
|
+
},
|
|
246
|
+
e
|
|
247
|
+
)) : (
|
|
248
|
+
/* Default dots */
|
|
249
|
+
Array.from({ length: s + 1 }).map((r, e) => /* @__PURE__ */ t(
|
|
250
|
+
"button",
|
|
251
|
+
{
|
|
252
|
+
onClick: () => o(e),
|
|
253
|
+
className: b(
|
|
254
|
+
"bear-h-2.5 bear-rounded-full bear-transition-all",
|
|
255
|
+
e === a ? "bear-w-6" : "bear-w-2.5 bear-bg-gray-300 dark:bear-bg-gray-600 hover:bear-bg-gray-400 dark:hover:bear-bg-gray-500"
|
|
256
|
+
),
|
|
257
|
+
style: e === a ? { background: h } : void 0,
|
|
258
|
+
"aria-label": `Go to slide ${e + 1}`
|
|
259
|
+
},
|
|
260
|
+
e
|
|
261
|
+
))
|
|
262
|
+
) })
|
|
116
263
|
]
|
|
117
264
|
}
|
|
118
265
|
);
|
|
119
266
|
};
|
|
120
267
|
export {
|
|
121
|
-
|
|
268
|
+
we as Carousel
|
|
122
269
|
};
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Carousel transition effect
|
|
4
|
+
*/
|
|
5
|
+
export type CarouselTransition = 'slide' | 'fade' | 'zoom' | 'flip';
|
|
6
|
+
/**
|
|
7
|
+
* Carousel indicator style
|
|
8
|
+
*/
|
|
9
|
+
export type CarouselIndicator = 'dots' | 'numbers' | 'thumbnails' | 'bars' | 'none';
|
|
2
10
|
export interface CarouselProps {
|
|
3
11
|
/** Carousel slides */
|
|
4
12
|
children: ReactNode;
|
|
5
13
|
/** Auto-play interval in ms (0 to disable) */
|
|
6
14
|
autoPlay?: number;
|
|
7
|
-
/** Show navigation dots */
|
|
15
|
+
/** Show navigation dots/indicators */
|
|
8
16
|
showDots?: boolean;
|
|
9
17
|
/** Show arrow buttons */
|
|
10
18
|
showArrows?: boolean;
|
|
@@ -18,8 +26,30 @@ export interface CarouselProps {
|
|
|
18
26
|
pauseOnHover?: boolean;
|
|
19
27
|
/** Called when slide changes */
|
|
20
28
|
onSlideChange?: (index: number) => void;
|
|
29
|
+
/** Transition effect */
|
|
30
|
+
transition?: CarouselTransition;
|
|
31
|
+
/** Transition duration in ms */
|
|
32
|
+
transitionDuration?: number;
|
|
33
|
+
/** Indicator style */
|
|
34
|
+
indicator?: CarouselIndicator;
|
|
35
|
+
/** Thumbnail images for 'thumbnails' indicator */
|
|
36
|
+
thumbnails?: string[];
|
|
37
|
+
/** Thumbnail size in px */
|
|
38
|
+
thumbnailSize?: number;
|
|
39
|
+
/** Enable keyboard navigation */
|
|
40
|
+
keyboard?: boolean;
|
|
41
|
+
/** Enable drag/swipe to navigate */
|
|
42
|
+
draggable?: boolean;
|
|
43
|
+
/** Show progress bar */
|
|
44
|
+
showProgress?: boolean;
|
|
45
|
+
/** Show slide counter */
|
|
46
|
+
showCounter?: boolean;
|
|
47
|
+
/** Active dot/indicator color */
|
|
48
|
+
activeColor?: string;
|
|
21
49
|
/** Custom class name */
|
|
22
50
|
className?: string;
|
|
51
|
+
/** Custom styles */
|
|
52
|
+
style?: CSSProperties;
|
|
23
53
|
/** Test ID */
|
|
24
54
|
testId?: string;
|
|
25
55
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Carousel } from './Carousel';
|
|
2
|
-
export type { CarouselProps } from './Carousel.types';
|
|
2
|
+
export type { CarouselProps, CarouselTransition, CarouselIndicator } from './Carousel.types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../../utils/cn.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../../utils/cn.cjs");require("react");const m=({children:l,variant:i="filled",color:c="default",size:b="md",icon:t,avatar:o,onDelete:n,onClick:a,disabled:r=!1,className:d})=>{const p={filled:{default:"bear-bg-zinc-600 bear-text-white",primary:"bear-bg-pink-500 bear-text-white",secondary:"bear-bg-purple-500 bear-text-white",success:"bear-bg-green-500 bear-text-white",warning:"bear-bg-yellow-500 bear-text-black",error:"bear-bg-red-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white"},outlined:{default:"bear-border bear-border-zinc-500 bear-text-zinc-300",primary:"bear-border bear-border-pink-500 bear-text-pink-400",secondary:"bear-border bear-border-purple-500 bear-text-purple-400",success:"bear-border bear-border-green-500 bear-text-green-400",warning:"bear-border bear-border-yellow-500 bear-text-yellow-400",error:"bear-border bear-border-red-500 bear-text-red-400",info:"bear-border bear-border-blue-500 bear-text-blue-400"},soft:{default:"bear-bg-zinc-500/20 bear-text-zinc-300",primary:"bear-bg-pink-500/20 bear-text-pink-400",secondary:"bear-bg-purple-500/20 bear-text-purple-400",success:"bear-bg-green-500/20 bear-text-green-400",warning:"bear-bg-yellow-500/20 bear-text-yellow-400",error:"bear-bg-red-500/20 bear-text-red-400",info:"bear-bg-blue-500/20 bear-text-blue-400"}},u={sm:"bear-h-6 bear-text-xs bear-px-2 bear-gap-1",md:"bear-h-8 bear-text-sm bear-px-3 bear-gap-1.5",lg:"bear-h-10 bear-text-base bear-px-4 bear-gap-2"},x={sm:"bear-w-3 bear-h-3",md:"bear-w-4 bear-h-4",lg:"bear-w-5 bear-h-5"},g=a?"button":"span";return e.jsxs(g,{onClick:a,disabled:r,className:s.cn("bear-inline-flex bear-items-center bear-rounded-full bear-font-medium bear-transition-all",u[b],p[i][c],a&&!r&&"bear-cursor-pointer hover:bear-opacity-80",r&&"bear-opacity-50 bear-cursor-not-allowed",d),children:[o&&e.jsx("span",{className:"bear--ml-1",children:o}),t&&e.jsx("span",{children:t}),e.jsx("span",{children:l}),n&&e.jsx("button",{onClick:h=>{h.stopPropagation(),n()},disabled:r,className:s.cn("bear-ml-1 bear-rounded-full bear-p-0.5 hover:bear-bg-black/20 bear-transition-colors",r&&"bear-cursor-not-allowed"),children:e.jsx("svg",{className:x[b],fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};exports.Chip=m;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { cn as l } from "../../utils/cn.js";
|
|
3
|
-
|
|
3
|
+
import "react";
|
|
4
|
+
const k = ({
|
|
4
5
|
children: s,
|
|
5
6
|
variant: i = "filled",
|
|
6
7
|
color: p = "default",
|
|
@@ -81,5 +82,5 @@ const y = ({
|
|
|
81
82
|
);
|
|
82
83
|
};
|
|
83
84
|
export {
|
|
84
|
-
|
|
85
|
+
k as Chip
|
|
85
86
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),s=require("react"),ie=require("../../utils/cn.cjs"),l=require("./CodeEditor.const.cjs"),le=require("./CodeEditor.utils.cjs"),oe=({value:n,onChange:r,language:S="typescript",theme:I="dark",customTheme:f,placeholder:B="Start typing...",showLineNumbers:T=!0,showGutter:_=!0,highlightActiveLine:G=!0,readOnly:p=!1,fontSize:v=l.DEFAULT_FONT_SIZE,fontFamily:N=l.DEFAULT_FONT_FAMILY,tabSize:k=l.DEFAULT_TAB_SIZE,autoIndent:j=!0,autoCloseBrackets:H=!0,wordWrap:x=!1,minHeight:w,maxHeight:D,height:q,className:O,style:Y,testId:Z,onFocus:g,onBlur:L})=>{const y=s.useRef(null),[R,F]=s.useState(!1),[A,J]=s.useState(0),[M,Q]=s.useState(0),[X,W]=s.useState(0),U=I==="dark"?l.DARK_THEME:l.LIGHT_THEME,a=s.useMemo(()=>({...U,...f,tokens:{...U.tokens,...f==null?void 0:f.tokens}}),[I,f]),h=s.useMemo(()=>n.split(`
|
|
2
|
+
`),[n]),z=s.useMemo(()=>h.map(e=>le.tokenizeLine(e,S)),[h,S]),K=s.useCallback(()=>{const e=y.current;if(!e)return;const t=e.value.substring(0,e.selectionStart);J(t.split(`
|
|
3
|
+
`).length-1)},[]),C=s.useCallback(e=>{var V;if(p)return;const t=y.current;if(!t)return;const{selectionStart:i,selectionEnd:d}=t;if(e.key==="Tab"){e.preventDefault();const c=" ".repeat(k),b=n.substring(0,i),E=n.substring(d),u=b+c+E;r==null||r(u),requestAnimationFrame(()=>{t.selectionStart=t.selectionEnd=i+k});return}if(e.key==="Enter"&&j){e.preventDefault();const c=n.substring(0,i),b=n.substring(d),u=((V=(c.split(`
|
|
4
|
+
`).pop()??"").match(/^\s*/))==null?void 0:V[0])??"",m=c.trim().slice(-1),$=["{","(","[",":"].includes(m)?" ".repeat(k):"",ne=c+`
|
|
5
|
+
`+u+$+b;r==null||r(ne),requestAnimationFrame(()=>{const ae=i+1+u.length+$.length;t.selectionStart=t.selectionEnd=ae});return}if(H&&l.AUTO_CLOSE_PAIRS[e.key]){e.preventDefault();const c=l.AUTO_CLOSE_PAIRS[e.key],b=n.substring(0,i),E=n.substring(i,d),u=n.substring(d);if(E){const m=b+e.key+E+c+u;r==null||r(m),requestAnimationFrame(()=>{t.selectionStart=i+1,t.selectionEnd=d+1})}else{const m=b+e.key+c+u;r==null||r(m),requestAnimationFrame(()=>{t.selectionStart=t.selectionEnd=i+1})}return}},[n,r,p,k,j,H]),ee=s.useCallback(e=>{p||r==null||r(e.target.value)},[r,p]),te=s.useCallback(()=>{const e=y.current;e&&(Q(e.scrollTop),W(e.scrollLeft))},[]),re=s.useCallback(()=>{F(!0),g==null||g()},[g]),se=s.useCallback(()=>{F(!1),L==null||L()},[L]),P=v*l.LINE_HEIGHT;return o.jsxs("div",{className:ie.cn("bear-relative bear-overflow-hidden bear-rounded-lg bear-font-mono","bear-border",R?"bear-ring-2 bear-ring-offset-1":"",O),style:{background:a.background,borderColor:a.gutterBorder,fontFamily:N,fontSize:v,lineHeight:l.LINE_HEIGHT,minHeight:w,maxHeight:D,height:q,"--bear-editor-ring":"var(--bear-primary-500)",...Y},"data-testid":Z,children:[o.jsxs("div",{className:"bear-relative bear-flex bear-h-full",children:[_&&T&&o.jsx("div",{className:"bear-flex-shrink-0 bear-select-none bear-text-right bear-pr-3 bear-overflow-hidden",style:{width:l.GUTTER_WIDTH,background:a.gutterBackground,borderRight:`1px solid ${a.gutterBorder}`,paddingTop:12,transform:`translateY(-${M}px)`},"aria-hidden":"true",children:h.map((e,t)=>o.jsx("div",{style:{height:P,color:t===A?a.lineNumberActive:a.lineNumber,fontWeight:t===A?600:400},children:t+1},t))}),o.jsxs("div",{className:"bear-relative bear-flex-1 bear-overflow-hidden",children:[o.jsx("div",{className:"bear-absolute bear-inset-0 bear-pointer-events-none bear-overflow-hidden",style:{padding:12,paddingLeft:_&&!T?12:16,transform:`translate(-${X}px, -${M}px)`,whiteSpace:x?"pre-wrap":"pre",wordBreak:x?"break-all":"normal"},"aria-hidden":"true",children:z.map((e,t)=>o.jsxs("div",{style:{height:P,background:G&&t===A&&R?a.selection:"transparent"},children:[e.map((i,d)=>o.jsx("span",{style:{color:a.tokens[i.type]??a.foreground},children:i.value},d)),e.length===0&&" "]},t))}),o.jsx("textarea",{ref:y,value:n,onChange:ee,onKeyDown:C,onScroll:te,onFocus:re,onBlur:se,onClick:K,onKeyUp:K,readOnly:p,placeholder:n?void 0:B,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",className:"bear-w-full bear-h-full bear-resize-none bear-outline-none",style:{padding:12,paddingLeft:_&&!T?12:16,background:"transparent",color:"transparent",caretColor:a.cursor,fontFamily:N,fontSize:v,lineHeight:l.LINE_HEIGHT,tabSize:k,whiteSpace:x?"pre-wrap":"pre",wordBreak:x?"break-all":"normal",minHeight:w??100,maxHeight:D,height:q??"auto"}})]})]}),o.jsx("div",{className:"bear-absolute bear-bottom-2 bear-right-3 bear-text-xs bear-font-medium bear-px-2 bear-py-0.5 bear-rounded bear-select-none",style:{color:a.lineNumber,background:a.gutterBackground},children:S})]})};exports.CodeEditor=oe;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=14,t="'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace",a=2,n=56,r=1.6,o={background:"#1e1e2e",foreground:"#cdd6f4",cursor:"#f5e0dc",selection:"rgba(137, 180, 250, 0.2)",lineNumber:"#585b70",lineNumberActive:"#a6adc8",gutterBackground:"#181825",gutterBorder:"#313244",tokens:{keyword:"#cba6f7",string:"#a6e3a1",number:"#fab387",comment:"#6c7086",operator:"#89dceb",punctuation:"#a6adc8",function:"#89b4fa",variable:"#f5e0dc",tag:"#f38ba8",attribute:"#f9e2af",property:"#89b4fa",builtin:"#f5c2e7",regex:"#a6e3a1",boolean:"#fab387",null:"#f38ba8",type:"#f9e2af",default:"#cdd6f4"}},i={background:"#eff1f5",foreground:"#4c4f69",cursor:"#dc8a78",selection:"rgba(114, 135, 253, 0.15)",lineNumber:"#9ca0b0",lineNumberActive:"#4c4f69",gutterBackground:"#e6e9ef",gutterBorder:"#ccd0da",tokens:{keyword:"#8839ef",string:"#40a02b",number:"#fe640b",comment:"#9ca0b0",operator:"#04a5e5",punctuation:"#6c6f85",function:"#1e66f5",variable:"#dc8a78",tag:"#d20f39",attribute:"#df8e1d",property:"#1e66f5",builtin:"#ea76cb",regex:"#40a02b",boolean:"#fe640b",null:"#d20f39",type:"#df8e1d",default:"#4c4f69"}},s={"(":")","[":"]","{":"}",'"':'"',"'":"'","`":"`"},c={javascript:["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","new","delete","typeof","instanceof","in","of","class","extends","super","this","import","export","from","default","async","await","try","catch","finally","throw","yield","void","null","undefined","true","false","NaN","Infinity"],typescript:["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","new","delete","typeof","instanceof","in","of","class","extends","super","this","import","export","from","default","async","await","try","catch","finally","throw","yield","void","null","undefined","true","false","interface","type","enum","implements","abstract","private","protected","public","readonly","static","as","is","keyof","never","unknown","any","string","number","boolean","object","symbol","bigint"],jsx:["const","let","var","function","return","if","else","for","while","class","extends","import","export","from","default","async","await","try","catch","throw","new","this","super","null","undefined","true","false"],tsx:["const","let","var","function","return","if","else","for","while","class","extends","import","export","from","default","async","await","try","catch","throw","new","this","super","null","undefined","true","false","interface","type","enum","as","is","keyof"],python:["def","class","return","if","elif","else","for","while","break","continue","pass","import","from","as","try","except","finally","raise","with","yield","lambda","global","nonlocal","assert","del","in","not","and","or","is","True","False","None","async","await","self"],html:["html","head","body","div","span","p","a","img","input","button","form","table","tr","td","th","ul","ol","li","h1","h2","h3","h4","h5","h6","section","header","footer","nav","main","article","aside","script","style","link","meta"],css:["color","background","margin","padding","border","display","position","width","height","font","text","flex","grid","align","justify","overflow","transition","animation","transform","opacity","z-index","box-shadow","cursor"],sql:["SELECT","FROM","WHERE","INSERT","INTO","UPDATE","DELETE","CREATE","DROP","ALTER","TABLE","INDEX","JOIN","LEFT","RIGHT","INNER","OUTER","ON","AND","OR","NOT","NULL","IS","IN","BETWEEN","LIKE","ORDER","BY","GROUP","HAVING","LIMIT","OFFSET","AS","SET","VALUES","DISTINCT","COUNT","SUM","AVG","MAX","MIN"],json:[],markdown:[],shell:["echo","cd","ls","mkdir","rm","cp","mv","cat","grep","sed","awk","find","chmod","chown","export","source","alias","if","then","else","fi","for","do","done","while","case","esac","function","return","exit","sudo","apt","npm","yarn","git"]},l=["console","Math","JSON","Array","Object","String","Number","Boolean","Date","RegExp","Error","Map","Set","Promise","setTimeout","setInterval","clearTimeout","clearInterval","parseInt","parseFloat","isNaN","isFinite","fetch","require","document","window","navigator","alert","confirm","prompt"];exports.AUTO_CLOSE_PAIRS=s;exports.BUILTIN_FUNCTIONS=l;exports.DARK_THEME=o;exports.DEFAULT_FONT_FAMILY=t;exports.DEFAULT_FONT_SIZE=e;exports.DEFAULT_TAB_SIZE=a;exports.GUTTER_WIDTH=n;exports.LANGUAGE_KEYWORDS=c;exports.LIGHT_THEME=i;exports.LINE_HEIGHT=r;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CodeEditorTheme, CodeEditorLanguage } from './CodeEditor.types';
|
|
2
|
+
/** Default font size */
|
|
3
|
+
export declare const DEFAULT_FONT_SIZE = 14;
|
|
4
|
+
/** Default font family */
|
|
5
|
+
export declare const DEFAULT_FONT_FAMILY = "'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace";
|
|
6
|
+
/** Default tab size */
|
|
7
|
+
export declare const DEFAULT_TAB_SIZE = 2;
|
|
8
|
+
/** Gutter width */
|
|
9
|
+
export declare const GUTTER_WIDTH = 56;
|
|
10
|
+
/** Line height multiplier */
|
|
11
|
+
export declare const LINE_HEIGHT = 1.6;
|
|
12
|
+
/** Dark theme */
|
|
13
|
+
export declare const DARK_THEME: CodeEditorTheme;
|
|
14
|
+
/** Light theme */
|
|
15
|
+
export declare const LIGHT_THEME: CodeEditorTheme;
|
|
16
|
+
/** Auto-close pairs */
|
|
17
|
+
export declare const AUTO_CLOSE_PAIRS: Record<string, string>;
|
|
18
|
+
/** Keywords per language */
|
|
19
|
+
export declare const LANGUAGE_KEYWORDS: Partial<Record<CodeEditorLanguage, string[]>>;
|
|
20
|
+
/** Builtin functions */
|
|
21
|
+
export declare const BUILTIN_FUNCTIONS: string[];
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
const e = 14, t = "'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace", a = 2, n = 56, r = 1.6, o = {
|
|
2
|
+
background: "#1e1e2e",
|
|
3
|
+
foreground: "#cdd6f4",
|
|
4
|
+
cursor: "#f5e0dc",
|
|
5
|
+
selection: "rgba(137, 180, 250, 0.2)",
|
|
6
|
+
lineNumber: "#585b70",
|
|
7
|
+
lineNumberActive: "#a6adc8",
|
|
8
|
+
gutterBackground: "#181825",
|
|
9
|
+
gutterBorder: "#313244",
|
|
10
|
+
tokens: {
|
|
11
|
+
keyword: "#cba6f7",
|
|
12
|
+
string: "#a6e3a1",
|
|
13
|
+
number: "#fab387",
|
|
14
|
+
comment: "#6c7086",
|
|
15
|
+
operator: "#89dceb",
|
|
16
|
+
punctuation: "#a6adc8",
|
|
17
|
+
function: "#89b4fa",
|
|
18
|
+
variable: "#f5e0dc",
|
|
19
|
+
tag: "#f38ba8",
|
|
20
|
+
attribute: "#f9e2af",
|
|
21
|
+
property: "#89b4fa",
|
|
22
|
+
builtin: "#f5c2e7",
|
|
23
|
+
regex: "#a6e3a1",
|
|
24
|
+
boolean: "#fab387",
|
|
25
|
+
null: "#f38ba8",
|
|
26
|
+
type: "#f9e2af",
|
|
27
|
+
default: "#cdd6f4"
|
|
28
|
+
}
|
|
29
|
+
}, i = {
|
|
30
|
+
background: "#eff1f5",
|
|
31
|
+
foreground: "#4c4f69",
|
|
32
|
+
cursor: "#dc8a78",
|
|
33
|
+
selection: "rgba(114, 135, 253, 0.15)",
|
|
34
|
+
lineNumber: "#9ca0b0",
|
|
35
|
+
lineNumberActive: "#4c4f69",
|
|
36
|
+
gutterBackground: "#e6e9ef",
|
|
37
|
+
gutterBorder: "#ccd0da",
|
|
38
|
+
tokens: {
|
|
39
|
+
keyword: "#8839ef",
|
|
40
|
+
string: "#40a02b",
|
|
41
|
+
number: "#fe640b",
|
|
42
|
+
comment: "#9ca0b0",
|
|
43
|
+
operator: "#04a5e5",
|
|
44
|
+
punctuation: "#6c6f85",
|
|
45
|
+
function: "#1e66f5",
|
|
46
|
+
variable: "#dc8a78",
|
|
47
|
+
tag: "#d20f39",
|
|
48
|
+
attribute: "#df8e1d",
|
|
49
|
+
property: "#1e66f5",
|
|
50
|
+
builtin: "#ea76cb",
|
|
51
|
+
regex: "#40a02b",
|
|
52
|
+
boolean: "#fe640b",
|
|
53
|
+
null: "#d20f39",
|
|
54
|
+
type: "#df8e1d",
|
|
55
|
+
default: "#4c4f69"
|
|
56
|
+
}
|
|
57
|
+
}, s = {
|
|
58
|
+
"(": ")",
|
|
59
|
+
"[": "]",
|
|
60
|
+
"{": "}",
|
|
61
|
+
'"': '"',
|
|
62
|
+
"'": "'",
|
|
63
|
+
"`": "`"
|
|
64
|
+
}, c = {
|
|
65
|
+
javascript: ["const", "let", "var", "function", "return", "if", "else", "for", "while", "do", "switch", "case", "break", "continue", "new", "delete", "typeof", "instanceof", "in", "of", "class", "extends", "super", "this", "import", "export", "from", "default", "async", "await", "try", "catch", "finally", "throw", "yield", "void", "null", "undefined", "true", "false", "NaN", "Infinity"],
|
|
66
|
+
typescript: ["const", "let", "var", "function", "return", "if", "else", "for", "while", "do", "switch", "case", "break", "continue", "new", "delete", "typeof", "instanceof", "in", "of", "class", "extends", "super", "this", "import", "export", "from", "default", "async", "await", "try", "catch", "finally", "throw", "yield", "void", "null", "undefined", "true", "false", "interface", "type", "enum", "implements", "abstract", "private", "protected", "public", "readonly", "static", "as", "is", "keyof", "never", "unknown", "any", "string", "number", "boolean", "object", "symbol", "bigint"],
|
|
67
|
+
jsx: ["const", "let", "var", "function", "return", "if", "else", "for", "while", "class", "extends", "import", "export", "from", "default", "async", "await", "try", "catch", "throw", "new", "this", "super", "null", "undefined", "true", "false"],
|
|
68
|
+
tsx: ["const", "let", "var", "function", "return", "if", "else", "for", "while", "class", "extends", "import", "export", "from", "default", "async", "await", "try", "catch", "throw", "new", "this", "super", "null", "undefined", "true", "false", "interface", "type", "enum", "as", "is", "keyof"],
|
|
69
|
+
python: ["def", "class", "return", "if", "elif", "else", "for", "while", "break", "continue", "pass", "import", "from", "as", "try", "except", "finally", "raise", "with", "yield", "lambda", "global", "nonlocal", "assert", "del", "in", "not", "and", "or", "is", "True", "False", "None", "async", "await", "self"],
|
|
70
|
+
html: ["html", "head", "body", "div", "span", "p", "a", "img", "input", "button", "form", "table", "tr", "td", "th", "ul", "ol", "li", "h1", "h2", "h3", "h4", "h5", "h6", "section", "header", "footer", "nav", "main", "article", "aside", "script", "style", "link", "meta"],
|
|
71
|
+
css: ["color", "background", "margin", "padding", "border", "display", "position", "width", "height", "font", "text", "flex", "grid", "align", "justify", "overflow", "transition", "animation", "transform", "opacity", "z-index", "box-shadow", "cursor"],
|
|
72
|
+
sql: ["SELECT", "FROM", "WHERE", "INSERT", "INTO", "UPDATE", "DELETE", "CREATE", "DROP", "ALTER", "TABLE", "INDEX", "JOIN", "LEFT", "RIGHT", "INNER", "OUTER", "ON", "AND", "OR", "NOT", "NULL", "IS", "IN", "BETWEEN", "LIKE", "ORDER", "BY", "GROUP", "HAVING", "LIMIT", "OFFSET", "AS", "SET", "VALUES", "DISTINCT", "COUNT", "SUM", "AVG", "MAX", "MIN"],
|
|
73
|
+
json: [],
|
|
74
|
+
markdown: [],
|
|
75
|
+
shell: ["echo", "cd", "ls", "mkdir", "rm", "cp", "mv", "cat", "grep", "sed", "awk", "find", "chmod", "chown", "export", "source", "alias", "if", "then", "else", "fi", "for", "do", "done", "while", "case", "esac", "function", "return", "exit", "sudo", "apt", "npm", "yarn", "git"]
|
|
76
|
+
}, l = [
|
|
77
|
+
"console",
|
|
78
|
+
"Math",
|
|
79
|
+
"JSON",
|
|
80
|
+
"Array",
|
|
81
|
+
"Object",
|
|
82
|
+
"String",
|
|
83
|
+
"Number",
|
|
84
|
+
"Boolean",
|
|
85
|
+
"Date",
|
|
86
|
+
"RegExp",
|
|
87
|
+
"Error",
|
|
88
|
+
"Map",
|
|
89
|
+
"Set",
|
|
90
|
+
"Promise",
|
|
91
|
+
"setTimeout",
|
|
92
|
+
"setInterval",
|
|
93
|
+
"clearTimeout",
|
|
94
|
+
"clearInterval",
|
|
95
|
+
"parseInt",
|
|
96
|
+
"parseFloat",
|
|
97
|
+
"isNaN",
|
|
98
|
+
"isFinite",
|
|
99
|
+
"fetch",
|
|
100
|
+
"require",
|
|
101
|
+
"document",
|
|
102
|
+
"window",
|
|
103
|
+
"navigator",
|
|
104
|
+
"alert",
|
|
105
|
+
"confirm",
|
|
106
|
+
"prompt"
|
|
107
|
+
];
|
|
108
|
+
export {
|
|
109
|
+
s as AUTO_CLOSE_PAIRS,
|
|
110
|
+
l as BUILTIN_FUNCTIONS,
|
|
111
|
+
o as DARK_THEME,
|
|
112
|
+
t as DEFAULT_FONT_FAMILY,
|
|
113
|
+
e as DEFAULT_FONT_SIZE,
|
|
114
|
+
a as DEFAULT_TAB_SIZE,
|
|
115
|
+
n as GUTTER_WIDTH,
|
|
116
|
+
c as LANGUAGE_KEYWORDS,
|
|
117
|
+
i as LIGHT_THEME,
|
|
118
|
+
r as LINE_HEIGHT
|
|
119
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { CodeEditorProps } from './CodeEditor.types';
|
|
3
|
+
/**
|
|
4
|
+
* CodeEditor - Syntax-highlighted code editor with line numbers
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Zero-dependency code editor with syntax highlighting for multiple
|
|
8
|
+
* languages, line numbers, auto-indent, bracket pairing, and theming.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <CodeEditor
|
|
13
|
+
* value={code}
|
|
14
|
+
* onChange={setCode}
|
|
15
|
+
* language="typescript"
|
|
16
|
+
* theme="dark"
|
|
17
|
+
* showLineNumbers
|
|
18
|
+
* height={400}
|
|
19
|
+
* />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const CodeEditor: FC<CodeEditorProps>;
|