@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
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { jsxs as L, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as de, useState as x, useMemo as N, useCallback as b } from "react";
|
|
3
|
+
import { cn as be } from "../../utils/cn.js";
|
|
4
|
+
import { DARK_THEME as pe, LIGHT_THEME as fe, DEFAULT_TAB_SIZE as ue, AUTO_CLOSE_PAIRS as G, LINE_HEIGHT as D, DEFAULT_FONT_SIZE as me, DEFAULT_FONT_FAMILY as ke, GUTTER_WIDTH as Ee } from "./CodeEditor.const.js";
|
|
5
|
+
import { tokenizeLine as ge } from "./CodeEditor.utils.js";
|
|
6
|
+
const Te = ({
|
|
7
|
+
value: s,
|
|
8
|
+
onChange: r,
|
|
9
|
+
language: A = "typescript",
|
|
10
|
+
theme: F = "dark",
|
|
11
|
+
customTheme: p,
|
|
12
|
+
placeholder: J = "Start typing...",
|
|
13
|
+
showLineNumbers: T = !0,
|
|
14
|
+
showGutter: h = !0,
|
|
15
|
+
highlightActiveLine: O = !0,
|
|
16
|
+
readOnly: f = !1,
|
|
17
|
+
fontSize: _ = me,
|
|
18
|
+
fontFamily: H = ke,
|
|
19
|
+
tabSize: u = ue,
|
|
20
|
+
autoIndent: I = !0,
|
|
21
|
+
autoCloseBrackets: R = !0,
|
|
22
|
+
wordWrap: E = !1,
|
|
23
|
+
minHeight: U,
|
|
24
|
+
maxHeight: q,
|
|
25
|
+
height: K,
|
|
26
|
+
className: Q,
|
|
27
|
+
style: X,
|
|
28
|
+
testId: W,
|
|
29
|
+
onFocus: g,
|
|
30
|
+
onBlur: v
|
|
31
|
+
}) => {
|
|
32
|
+
const y = de(null), [M, V] = x(!1), [S, z] = x(0), [$, C] = x(0), [ee, te] = x(0), B = F === "dark" ? pe : fe, n = N(
|
|
33
|
+
() => ({
|
|
34
|
+
...B,
|
|
35
|
+
...p,
|
|
36
|
+
tokens: { ...B.tokens, ...p == null ? void 0 : p.tokens }
|
|
37
|
+
}),
|
|
38
|
+
[F, p]
|
|
39
|
+
), w = N(() => s.split(`
|
|
40
|
+
`), [s]), re = N(
|
|
41
|
+
() => w.map((e) => ge(e, A)),
|
|
42
|
+
[w, A]
|
|
43
|
+
), j = b(() => {
|
|
44
|
+
const e = y.current;
|
|
45
|
+
if (!e) return;
|
|
46
|
+
const t = e.value.substring(0, e.selectionStart);
|
|
47
|
+
z(t.split(`
|
|
48
|
+
`).length - 1);
|
|
49
|
+
}, []), se = b(
|
|
50
|
+
(e) => {
|
|
51
|
+
var Y;
|
|
52
|
+
if (f) return;
|
|
53
|
+
const t = y.current;
|
|
54
|
+
if (!t) return;
|
|
55
|
+
const { selectionStart: i, selectionEnd: o } = t;
|
|
56
|
+
if (e.key === "Tab") {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
const a = " ".repeat(u), c = s.substring(0, i), m = s.substring(o), l = c + a + m;
|
|
59
|
+
r == null || r(l), requestAnimationFrame(() => {
|
|
60
|
+
t.selectionStart = t.selectionEnd = i + u;
|
|
61
|
+
});
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (e.key === "Enter" && I) {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
const a = s.substring(0, i), c = s.substring(o), l = ((Y = (a.split(`
|
|
67
|
+
`).pop() ?? "").match(/^\s*/)) == null ? void 0 : Y[0]) ?? "", k = a.trim().slice(-1), Z = ["{", "(", "[", ":"].includes(k) ? " ".repeat(u) : "", le = a + `
|
|
68
|
+
` + l + Z + c;
|
|
69
|
+
r == null || r(le), requestAnimationFrame(() => {
|
|
70
|
+
const ce = i + 1 + l.length + Z.length;
|
|
71
|
+
t.selectionStart = t.selectionEnd = ce;
|
|
72
|
+
});
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (R && G[e.key]) {
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
const a = G[e.key], c = s.substring(0, i), m = s.substring(i, o), l = s.substring(o);
|
|
78
|
+
if (m) {
|
|
79
|
+
const k = c + e.key + m + a + l;
|
|
80
|
+
r == null || r(k), requestAnimationFrame(() => {
|
|
81
|
+
t.selectionStart = i + 1, t.selectionEnd = o + 1;
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
const k = c + e.key + a + l;
|
|
85
|
+
r == null || r(k), requestAnimationFrame(() => {
|
|
86
|
+
t.selectionStart = t.selectionEnd = i + 1;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
[s, r, f, u, I, R]
|
|
93
|
+
), ne = b(
|
|
94
|
+
(e) => {
|
|
95
|
+
f || r == null || r(e.target.value);
|
|
96
|
+
},
|
|
97
|
+
[r, f]
|
|
98
|
+
), ie = b(() => {
|
|
99
|
+
const e = y.current;
|
|
100
|
+
e && (C(e.scrollTop), te(e.scrollLeft));
|
|
101
|
+
}, []), ae = b(() => {
|
|
102
|
+
V(!0), g == null || g();
|
|
103
|
+
}, [g]), oe = b(() => {
|
|
104
|
+
V(!1), v == null || v();
|
|
105
|
+
}, [v]), P = _ * D;
|
|
106
|
+
return /* @__PURE__ */ L(
|
|
107
|
+
"div",
|
|
108
|
+
{
|
|
109
|
+
className: be(
|
|
110
|
+
"bear-relative bear-overflow-hidden bear-rounded-lg bear-font-mono",
|
|
111
|
+
"bear-border",
|
|
112
|
+
M ? "bear-ring-2 bear-ring-offset-1" : "",
|
|
113
|
+
Q
|
|
114
|
+
),
|
|
115
|
+
style: {
|
|
116
|
+
background: n.background,
|
|
117
|
+
borderColor: n.gutterBorder,
|
|
118
|
+
fontFamily: H,
|
|
119
|
+
fontSize: _,
|
|
120
|
+
lineHeight: D,
|
|
121
|
+
minHeight: U,
|
|
122
|
+
maxHeight: q,
|
|
123
|
+
height: K,
|
|
124
|
+
"--bear-editor-ring": "var(--bear-primary-500)",
|
|
125
|
+
...X
|
|
126
|
+
},
|
|
127
|
+
"data-testid": W,
|
|
128
|
+
children: [
|
|
129
|
+
/* @__PURE__ */ L("div", { className: "bear-relative bear-flex bear-h-full", children: [
|
|
130
|
+
h && T && /* @__PURE__ */ d(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
className: "bear-flex-shrink-0 bear-select-none bear-text-right bear-pr-3 bear-overflow-hidden",
|
|
134
|
+
style: {
|
|
135
|
+
width: Ee,
|
|
136
|
+
background: n.gutterBackground,
|
|
137
|
+
borderRight: `1px solid ${n.gutterBorder}`,
|
|
138
|
+
paddingTop: 12,
|
|
139
|
+
transform: `translateY(-${$}px)`
|
|
140
|
+
},
|
|
141
|
+
"aria-hidden": "true",
|
|
142
|
+
children: w.map((e, t) => /* @__PURE__ */ d(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
style: {
|
|
146
|
+
height: P,
|
|
147
|
+
color: t === S ? n.lineNumberActive : n.lineNumber,
|
|
148
|
+
fontWeight: t === S ? 600 : 400
|
|
149
|
+
},
|
|
150
|
+
children: t + 1
|
|
151
|
+
},
|
|
152
|
+
t
|
|
153
|
+
))
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
/* @__PURE__ */ L("div", { className: "bear-relative bear-flex-1 bear-overflow-hidden", children: [
|
|
157
|
+
/* @__PURE__ */ d(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
className: "bear-absolute bear-inset-0 bear-pointer-events-none bear-overflow-hidden",
|
|
161
|
+
style: {
|
|
162
|
+
padding: 12,
|
|
163
|
+
paddingLeft: h && !T ? 12 : 16,
|
|
164
|
+
transform: `translate(-${ee}px, -${$}px)`,
|
|
165
|
+
whiteSpace: E ? "pre-wrap" : "pre",
|
|
166
|
+
wordBreak: E ? "break-all" : "normal"
|
|
167
|
+
},
|
|
168
|
+
"aria-hidden": "true",
|
|
169
|
+
children: re.map((e, t) => /* @__PURE__ */ L(
|
|
170
|
+
"div",
|
|
171
|
+
{
|
|
172
|
+
style: {
|
|
173
|
+
height: P,
|
|
174
|
+
background: O && t === S && M ? n.selection : "transparent"
|
|
175
|
+
},
|
|
176
|
+
children: [
|
|
177
|
+
e.map((i, o) => /* @__PURE__ */ d(
|
|
178
|
+
"span",
|
|
179
|
+
{
|
|
180
|
+
style: {
|
|
181
|
+
color: n.tokens[i.type] ?? n.foreground
|
|
182
|
+
},
|
|
183
|
+
children: i.value
|
|
184
|
+
},
|
|
185
|
+
o
|
|
186
|
+
)),
|
|
187
|
+
e.length === 0 && " "
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
t
|
|
191
|
+
))
|
|
192
|
+
}
|
|
193
|
+
),
|
|
194
|
+
/* @__PURE__ */ d(
|
|
195
|
+
"textarea",
|
|
196
|
+
{
|
|
197
|
+
ref: y,
|
|
198
|
+
value: s,
|
|
199
|
+
onChange: ne,
|
|
200
|
+
onKeyDown: se,
|
|
201
|
+
onScroll: ie,
|
|
202
|
+
onFocus: ae,
|
|
203
|
+
onBlur: oe,
|
|
204
|
+
onClick: j,
|
|
205
|
+
onKeyUp: j,
|
|
206
|
+
readOnly: f,
|
|
207
|
+
placeholder: s ? void 0 : J,
|
|
208
|
+
spellCheck: !1,
|
|
209
|
+
autoComplete: "off",
|
|
210
|
+
autoCorrect: "off",
|
|
211
|
+
autoCapitalize: "off",
|
|
212
|
+
className: "bear-w-full bear-h-full bear-resize-none bear-outline-none",
|
|
213
|
+
style: {
|
|
214
|
+
padding: 12,
|
|
215
|
+
paddingLeft: h && !T ? 12 : 16,
|
|
216
|
+
background: "transparent",
|
|
217
|
+
color: "transparent",
|
|
218
|
+
caretColor: n.cursor,
|
|
219
|
+
fontFamily: H,
|
|
220
|
+
fontSize: _,
|
|
221
|
+
lineHeight: D,
|
|
222
|
+
tabSize: u,
|
|
223
|
+
whiteSpace: E ? "pre-wrap" : "pre",
|
|
224
|
+
wordBreak: E ? "break-all" : "normal",
|
|
225
|
+
minHeight: U ?? 100,
|
|
226
|
+
maxHeight: q,
|
|
227
|
+
height: K ?? "auto"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
] })
|
|
232
|
+
] }),
|
|
233
|
+
/* @__PURE__ */ d(
|
|
234
|
+
"div",
|
|
235
|
+
{
|
|
236
|
+
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",
|
|
237
|
+
style: {
|
|
238
|
+
color: n.lineNumber,
|
|
239
|
+
background: n.gutterBackground
|
|
240
|
+
},
|
|
241
|
+
children: A
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
};
|
|
248
|
+
export {
|
|
249
|
+
Te as CodeEditor
|
|
250
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Supported programming languages
|
|
4
|
+
*/
|
|
5
|
+
export type CodeEditorLanguage = 'javascript' | 'typescript' | 'jsx' | 'tsx' | 'html' | 'css' | 'json' | 'python' | 'markdown' | 'sql' | 'shell' | 'yaml' | 'xml' | 'plaintext';
|
|
6
|
+
/**
|
|
7
|
+
* Syntax token type for highlighting
|
|
8
|
+
*/
|
|
9
|
+
export type TokenType = 'keyword' | 'string' | 'number' | 'comment' | 'operator' | 'punctuation' | 'function' | 'variable' | 'tag' | 'attribute' | 'property' | 'builtin' | 'regex' | 'boolean' | 'null' | 'type' | 'default';
|
|
10
|
+
/**
|
|
11
|
+
* Token from syntax analysis
|
|
12
|
+
*/
|
|
13
|
+
export interface SyntaxToken {
|
|
14
|
+
type: TokenType;
|
|
15
|
+
value: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Theme colors for the editor
|
|
19
|
+
*/
|
|
20
|
+
export interface CodeEditorTheme {
|
|
21
|
+
background: string;
|
|
22
|
+
foreground: string;
|
|
23
|
+
cursor: string;
|
|
24
|
+
selection: string;
|
|
25
|
+
lineNumber: string;
|
|
26
|
+
lineNumberActive: string;
|
|
27
|
+
gutterBackground: string;
|
|
28
|
+
gutterBorder: string;
|
|
29
|
+
tokens: Partial<Record<TokenType, string>>;
|
|
30
|
+
}
|
|
31
|
+
export interface CodeEditorProps {
|
|
32
|
+
/** Current value */
|
|
33
|
+
value: string;
|
|
34
|
+
/** Called on value change */
|
|
35
|
+
onChange?: (value: string) => void;
|
|
36
|
+
/** Programming language for syntax highlighting */
|
|
37
|
+
language?: CodeEditorLanguage;
|
|
38
|
+
/** Editor theme ('dark' | 'light') */
|
|
39
|
+
theme?: 'dark' | 'light';
|
|
40
|
+
/** Custom theme overrides */
|
|
41
|
+
customTheme?: Partial<CodeEditorTheme>;
|
|
42
|
+
/** Placeholder text */
|
|
43
|
+
placeholder?: string;
|
|
44
|
+
/** Show line numbers */
|
|
45
|
+
showLineNumbers?: boolean;
|
|
46
|
+
/** Show gutter (line number area) */
|
|
47
|
+
showGutter?: boolean;
|
|
48
|
+
/** Highlight active line */
|
|
49
|
+
highlightActiveLine?: boolean;
|
|
50
|
+
/** Read-only mode */
|
|
51
|
+
readOnly?: boolean;
|
|
52
|
+
/** Font size in px */
|
|
53
|
+
fontSize?: number;
|
|
54
|
+
/** Font family */
|
|
55
|
+
fontFamily?: string;
|
|
56
|
+
/** Tab size (spaces) */
|
|
57
|
+
tabSize?: number;
|
|
58
|
+
/** Auto-indent on new line */
|
|
59
|
+
autoIndent?: boolean;
|
|
60
|
+
/** Auto-close brackets */
|
|
61
|
+
autoCloseBrackets?: boolean;
|
|
62
|
+
/** Word wrap */
|
|
63
|
+
wordWrap?: boolean;
|
|
64
|
+
/** Min height */
|
|
65
|
+
minHeight?: string | number;
|
|
66
|
+
/** Max height */
|
|
67
|
+
maxHeight?: string | number;
|
|
68
|
+
/** Height */
|
|
69
|
+
height?: string | number;
|
|
70
|
+
/** Custom class name */
|
|
71
|
+
className?: string;
|
|
72
|
+
/** Custom styles */
|
|
73
|
+
style?: CSSProperties;
|
|
74
|
+
/** Test ID */
|
|
75
|
+
testId?: string;
|
|
76
|
+
/** Called on focus */
|
|
77
|
+
onFocus?: () => void;
|
|
78
|
+
/** Called on blur */
|
|
79
|
+
onBlur?: () => void;
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./CodeEditor.const.cjs"),u=(e,f)=>{if(f==="plaintext"||f==="markdown")return[{type:"default",value:e}];const r=[],h=i.LANGUAGE_KEYWORDS[f]??[];let t=0;const c=(s,o)=>{o&&r.push({type:s,value:o})};for(;t<e.length;){if(e[t]==="/"&&e[t+1]==="/"){c("comment",e.slice(t));break}if(e[t]==="/"&&e[t+1]==="*"){const s=e.indexOf("*/",t+2),o=s===-1?e.slice(t):e.slice(t,s+2);c("comment",o),t+=o.length;continue}if(e[t]==="#"&&(f==="python"||f==="shell"||f==="yaml")){c("comment",e.slice(t));break}if(e[t]==='"'||e[t]==="'"||e[t]==="`"){const s=e[t];let o=t+1;for(;o<e.length&&e[o]!==s;)e[o]==="\\"&&o++,o++;c("string",e.slice(t,o+1)),t=o+1;continue}if(/[0-9]/.test(e[t])&&(t===0||/[^a-zA-Z_$]/.test(e[t-1]))){let s=t;for(;s<e.length&&/[0-9.xXa-fA-F_eEn]/.test(e[s]);)s++;c("number",e.slice(t,s)),t=s;continue}if(/[a-zA-Z_$]/.test(e[t])){let s=t;for(;s<e.length&&/[a-zA-Z0-9_$]/.test(e[s]);)s++;const o=e.slice(t,s);o==="true"||o==="false"?c("boolean",o):o==="null"||o==="undefined"||o==="None"||o==="NaN"?c("null",o):h.includes(o)?c("keyword",o):i.BUILTIN_FUNCTIONS.includes(o)?c("builtin",o):s<e.length&&e[s]==="("?c("function",o):t>0&&e[t-1]==="."?c("property",o):c("variable",o),t=s;continue}if(e[t]==="<"&&(f==="html"||f==="jsx"||f==="tsx"||f==="xml")){e[t+1]==="/"?(c("tag","</"),t+=2):(c("tag","<"),t+=1);continue}if(e[t]===">"&&(f==="html"||f==="jsx"||f==="tsx"||f==="xml")){c("tag",">"),t+=1;continue}if(/[+\-*/%=!<>&|^~?:]/.test(e[t])){let s=t;for(;s<e.length&&/[+\-*/%=!<>&|^~?:]/.test(e[s]);)s++;c("operator",e.slice(t,s)),t=s;continue}if(/[(){}[\],;.]/.test(e[t])){c("punctuation",e[t]),t++;continue}if(/\s/.test(e[t])){let s=t;for(;s<e.length&&/\s/.test(e[s]);)s++;c("default",e.slice(t,s)),t=s;continue}c("default",e[t]),t++}return r};exports.tokenizeLine=u;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CodeEditorLanguage, SyntaxToken } from './CodeEditor.types';
|
|
2
|
+
/**
|
|
3
|
+
* Simple tokenizer for syntax highlighting
|
|
4
|
+
* Produces tokens for a single line of code
|
|
5
|
+
*/
|
|
6
|
+
export declare const tokenizeLine: (line: string, language: CodeEditorLanguage) => SyntaxToken[];
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { LANGUAGE_KEYWORDS as i, BUILTIN_FUNCTIONS as m } from "./CodeEditor.const.js";
|
|
2
|
+
const d = (s, f) => {
|
|
3
|
+
if (f === "plaintext" || f === "markdown")
|
|
4
|
+
return [{ type: "default", value: s }];
|
|
5
|
+
const r = [], h = i[f] ?? [];
|
|
6
|
+
let t = 0;
|
|
7
|
+
const c = (e, o) => {
|
|
8
|
+
o && r.push({ type: e, value: o });
|
|
9
|
+
};
|
|
10
|
+
for (; t < s.length; ) {
|
|
11
|
+
if (s[t] === "/" && s[t + 1] === "/") {
|
|
12
|
+
c("comment", s.slice(t));
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
if (s[t] === "/" && s[t + 1] === "*") {
|
|
16
|
+
const e = s.indexOf("*/", t + 2), o = e === -1 ? s.slice(t) : s.slice(t, e + 2);
|
|
17
|
+
c("comment", o), t += o.length;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (s[t] === "#" && (f === "python" || f === "shell" || f === "yaml")) {
|
|
21
|
+
c("comment", s.slice(t));
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
if (s[t] === '"' || s[t] === "'" || s[t] === "`") {
|
|
25
|
+
const e = s[t];
|
|
26
|
+
let o = t + 1;
|
|
27
|
+
for (; o < s.length && s[o] !== e; )
|
|
28
|
+
s[o] === "\\" && o++, o++;
|
|
29
|
+
c("string", s.slice(t, o + 1)), t = o + 1;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (/[0-9]/.test(s[t]) && (t === 0 || /[^a-zA-Z_$]/.test(s[t - 1]))) {
|
|
33
|
+
let e = t;
|
|
34
|
+
for (; e < s.length && /[0-9.xXa-fA-F_eEn]/.test(s[e]); ) e++;
|
|
35
|
+
c("number", s.slice(t, e)), t = e;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (/[a-zA-Z_$]/.test(s[t])) {
|
|
39
|
+
let e = t;
|
|
40
|
+
for (; e < s.length && /[a-zA-Z0-9_$]/.test(s[e]); ) e++;
|
|
41
|
+
const o = s.slice(t, e);
|
|
42
|
+
o === "true" || o === "false" ? c("boolean", o) : o === "null" || o === "undefined" || o === "None" || o === "NaN" ? c("null", o) : h.includes(o) ? c("keyword", o) : m.includes(o) ? c("builtin", o) : e < s.length && s[e] === "(" ? c("function", o) : t > 0 && s[t - 1] === "." ? c("property", o) : c("variable", o), t = e;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (s[t] === "<" && (f === "html" || f === "jsx" || f === "tsx" || f === "xml")) {
|
|
46
|
+
s[t + 1] === "/" ? (c("tag", "</"), t += 2) : (c("tag", "<"), t += 1);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (s[t] === ">" && (f === "html" || f === "jsx" || f === "tsx" || f === "xml")) {
|
|
50
|
+
c("tag", ">"), t += 1;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (/[+\-*/%=!<>&|^~?:]/.test(s[t])) {
|
|
54
|
+
let e = t;
|
|
55
|
+
for (; e < s.length && /[+\-*/%=!<>&|^~?:]/.test(s[e]); ) e++;
|
|
56
|
+
c("operator", s.slice(t, e)), t = e;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (/[(){}[\],;.]/.test(s[t])) {
|
|
60
|
+
c("punctuation", s[t]), t++;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (/\s/.test(s[t])) {
|
|
64
|
+
let e = t;
|
|
65
|
+
for (; e < s.length && /\s/.test(s[e]); ) e++;
|
|
66
|
+
c("default", s.slice(t, e)), t = e;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
c("default", s[t]), t++;
|
|
70
|
+
}
|
|
71
|
+
return r;
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
d as tokenizeLine
|
|
75
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),a=require("../../utils/cn.cjs")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),a=require("../../utils/cn.cjs");require("react");const c={none:"0",xs:"0.5rem",sm:"1rem",md:"1.5rem",lg:"2rem",xl:"3rem"},b=({children:l,count:e="auto",gap:n="md",fill:r=!1,minWidth:o,className:s,style:m})=>{const t={columnCount:e==="auto"?"auto":e,columnGap:c[n],columnFill:r?"balance":"auto",...o&&{columnWidth:typeof o=="number"?`${o}px`:o},...m};return u.jsx("div",{className:a.cn("bear-w-full",s),style:t,children:l})},i=({children:l,span:e="avoid",className:n,style:r})=>u.jsx("div",{className:a.cn("bear-inline-block bear-w-full bear-mb-4",e==="avoid"&&"bear-break-inside-avoid",n),style:r,children:l});exports.Column=i;exports.Columns=b;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import { cn as n } from "../../utils/cn.js";
|
|
3
|
+
import "react";
|
|
3
4
|
const c = {
|
|
4
5
|
none: "0",
|
|
5
6
|
xs: "0.5rem",
|
|
@@ -10,16 +11,16 @@ const c = {
|
|
|
10
11
|
}, d = ({
|
|
11
12
|
children: l,
|
|
12
13
|
count: o = "auto",
|
|
13
|
-
gap:
|
|
14
|
-
fill:
|
|
14
|
+
gap: r = "md",
|
|
15
|
+
fill: a = !1,
|
|
15
16
|
minWidth: e,
|
|
16
17
|
className: u,
|
|
17
18
|
style: s
|
|
18
19
|
}) => {
|
|
19
20
|
const t = {
|
|
20
21
|
columnCount: o === "auto" ? "auto" : o,
|
|
21
|
-
columnGap: c[
|
|
22
|
-
columnFill:
|
|
22
|
+
columnGap: c[r],
|
|
23
|
+
columnFill: a ? "balance" : "auto",
|
|
23
24
|
...e && { columnWidth: typeof e == "number" ? `${e}px` : e },
|
|
24
25
|
...s
|
|
25
26
|
};
|
|
@@ -34,17 +35,17 @@ const c = {
|
|
|
34
35
|
}, f = ({
|
|
35
36
|
children: l,
|
|
36
37
|
span: o = "avoid",
|
|
37
|
-
className:
|
|
38
|
-
style:
|
|
38
|
+
className: r,
|
|
39
|
+
style: a
|
|
39
40
|
}) => /* @__PURE__ */ m(
|
|
40
41
|
"div",
|
|
41
42
|
{
|
|
42
43
|
className: n(
|
|
43
44
|
"bear-inline-block bear-w-full bear-mb-4",
|
|
44
45
|
o === "avoid" && "bear-break-inside-avoid",
|
|
45
|
-
|
|
46
|
+
r
|
|
46
47
|
),
|
|
47
|
-
style:
|
|
48
|
+
style: a,
|
|
48
49
|
children: l
|
|
49
50
|
}
|
|
50
51
|
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),s=require("react"),b=require("../../utils/cn.cjs"),e=require("./CountdownTimer.const.cjs"),S=n=>String(n).padStart(e.PAD_LENGTH,"0"),y=(n,o)=>{const r=Math.max(0,n-o);return{days:Math.floor(r/e.MS_PER_DAY),hours:Math.floor(r%e.MS_PER_DAY/e.MS_PER_HOUR),minutes:Math.floor(r%e.MS_PER_HOUR/e.MS_PER_MINUTE),seconds:Math.floor(r%e.MS_PER_MINUTE/e.MS_PER_SECOND),totalSeconds:Math.floor(r/e.MS_PER_SECOND),isComplete:r<=0}},Z=n=>{const{targetDate:o,duration:r,variant:f="default",size:m="md",showDays:M=!0,showHours:R=!0,showMinutes:D=!0,showSeconds:I=!0,showLabels:L=!0,showSeparator:P=!0,separator:v=e.DEFAULT_SEPARATOR,labels:p,onComplete:d,onTick:u,paused:w=!1,render:C,className:N,style:j,testId:k}=n,c=s.useMemo(()=>({...e.DEFAULT_LABELS,...p}),[p]),x=s.useRef(!1),B=s.useCallback(()=>o?new Date(o).getTime():r?Date.now()+r*e.MS_PER_SECOND:Date.now(),[o,r]),[_]=s.useState(B),[i,O]=s.useState(()=>y(_,Date.now()));if(s.useEffect(()=>{if(w)return;const t=()=>{const h=y(_,Date.now());O(h),u==null||u(h),h.isComplete&&!x.current&&(x.current=!0,d==null||d())};t();const g=setInterval(t,e.UPDATE_INTERVAL);return()=>clearInterval(g)},[_,w,d,u]),C)return a.jsx(a.Fragment,{children:C(i)});const A=e.SIZE_DIGIT_CLASSES[m]??e.SIZE_DIGIT_CLASSES.md,U=e.SIZE_LABEL_CLASSES[m]??e.SIZE_LABEL_CLASSES.md,G=e.SIZE_GAP_CLASSES[m]??e.SIZE_GAP_CLASSES.md,l=[];M&&l.push({value:S(i.days),label:c.days}),R&&l.push({value:S(i.hours),label:c.hours}),D&&l.push({value:S(i.minutes),label:c.minutes}),I&&l.push({value:S(i.seconds),label:c.seconds});const E=f==="card",T=f==="flip";return a.jsx("div",{className:b.cn("Bear-CountdownTimer","bear-flex bear-items-center",G,N),style:j,"data-testid":k,role:"timer","aria-label":"Countdown timer",children:l.map((t,g)=>a.jsxs("div",{className:"Bear-CountdownTimer__segment bear-flex bear-items-center",children:[g>0&&P&&!E&&a.jsx("span",{className:b.cn("Bear-CountdownTimer__separator",A,e.SEPARATOR_MARGIN,"bear-text-gray-400 dark:bear-text-gray-500"),"aria-hidden":"true",children:v}),a.jsxs("div",{className:"Bear-CountdownTimer__unit bear-flex bear-flex-col bear-items-center",children:[a.jsx("div",{className:b.cn("Bear-CountdownTimer__digit",A,"bear-tabular-nums bear-tracking-wider",E&&["bear-px-3 bear-py-2 bear-rounded-lg","bear-bg-gray-100 dark:bear-bg-gray-800","bear-border bear-border-gray-200 dark:bear-border-gray-700"],T&&["bear-px-3 bear-py-2 bear-rounded-lg","bear-bg-gray-900 dark:bear-bg-gray-100","bear-text-white dark:bear-text-gray-900","bear-shadow-lg"],!E&&!T&&"bear-text-[var(--bear-text-primary)]"),children:t.value}),L&&a.jsx("span",{className:b.cn("Bear-CountdownTimer__label",U,"bear-mt-1 bear-uppercase bear-tracking-widest","bear-text-gray-500 dark:bear-text-gray-400"),children:t.label})]})]},t.label))})};exports.CountdownTimer=Z;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=1e3,E=60*S,t=60*E,e=24*t,_={days:"Days",hours:"Hours",minutes:"Minutes",seconds:"Seconds"},A=":",s=2,o={sm:"bear-text-lg bear-font-bold",md:"bear-text-3xl bear-font-bold",lg:"bear-text-5xl bear-font-bold",xl:"bear-text-7xl bear-font-bold"},a={sm:"bear-text-[10px]",md:"bear-text-xs",lg:"bear-text-sm",xl:"bear-text-base"},b={sm:"bear-gap-2",md:"bear-gap-3",lg:"bear-gap-4",xl:"bear-gap-5"},r="bear-mx-1",n=1e3;exports.DEFAULT_LABELS=_;exports.DEFAULT_SEPARATOR=A;exports.MS_PER_DAY=e;exports.MS_PER_HOUR=t;exports.MS_PER_MINUTE=E;exports.MS_PER_SECOND=S;exports.PAD_LENGTH=s;exports.SEPARATOR_MARGIN=r;exports.SIZE_DIGIT_CLASSES=o;exports.SIZE_GAP_CLASSES=b;exports.SIZE_LABEL_CLASSES=a;exports.UPDATE_INTERVAL=n;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CountdownTimerSize } from './CountdownTimer.types';
|
|
2
|
+
/** Milliseconds in time units */
|
|
3
|
+
export declare const MS_PER_SECOND = 1000;
|
|
4
|
+
export declare const MS_PER_MINUTE: number;
|
|
5
|
+
export declare const MS_PER_HOUR: number;
|
|
6
|
+
export declare const MS_PER_DAY: number;
|
|
7
|
+
/** Default labels */
|
|
8
|
+
export declare const DEFAULT_LABELS: {
|
|
9
|
+
readonly days: "Days";
|
|
10
|
+
readonly hours: "Hours";
|
|
11
|
+
readonly minutes: "Minutes";
|
|
12
|
+
readonly seconds: "Seconds";
|
|
13
|
+
};
|
|
14
|
+
/** Default separator */
|
|
15
|
+
export declare const DEFAULT_SEPARATOR = ":";
|
|
16
|
+
/** Pad length for digits */
|
|
17
|
+
export declare const PAD_LENGTH = 2;
|
|
18
|
+
/** Digit classes per size */
|
|
19
|
+
export declare const SIZE_DIGIT_CLASSES: Record<CountdownTimerSize, string>;
|
|
20
|
+
/** Label classes per size */
|
|
21
|
+
export declare const SIZE_LABEL_CLASSES: Record<CountdownTimerSize, string>;
|
|
22
|
+
/** Gap classes per size */
|
|
23
|
+
export declare const SIZE_GAP_CLASSES: Record<CountdownTimerSize, string>;
|
|
24
|
+
/** Separator horizontal margin */
|
|
25
|
+
export declare const SEPARATOR_MARGIN = "bear-mx-1";
|
|
26
|
+
/** Update interval in ms */
|
|
27
|
+
export declare const UPDATE_INTERVAL = 1000;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const t = 1e3, e = 6e4, s = 36e5, E = 864e5, o = {
|
|
2
|
+
days: "Days",
|
|
3
|
+
hours: "Hours",
|
|
4
|
+
minutes: "Minutes",
|
|
5
|
+
seconds: "Seconds"
|
|
6
|
+
}, S = ":", _ = 2, a = {
|
|
7
|
+
sm: "bear-text-lg bear-font-bold",
|
|
8
|
+
md: "bear-text-3xl bear-font-bold",
|
|
9
|
+
lg: "bear-text-5xl bear-font-bold",
|
|
10
|
+
xl: "bear-text-7xl bear-font-bold"
|
|
11
|
+
}, b = {
|
|
12
|
+
sm: "bear-text-[10px]",
|
|
13
|
+
md: "bear-text-xs",
|
|
14
|
+
lg: "bear-text-sm",
|
|
15
|
+
xl: "bear-text-base"
|
|
16
|
+
}, n = {
|
|
17
|
+
sm: "bear-gap-2",
|
|
18
|
+
md: "bear-gap-3",
|
|
19
|
+
lg: "bear-gap-4",
|
|
20
|
+
xl: "bear-gap-5"
|
|
21
|
+
}, r = "bear-mx-1", x = 1e3;
|
|
22
|
+
export {
|
|
23
|
+
o as DEFAULT_LABELS,
|
|
24
|
+
S as DEFAULT_SEPARATOR,
|
|
25
|
+
E as MS_PER_DAY,
|
|
26
|
+
s as MS_PER_HOUR,
|
|
27
|
+
e as MS_PER_MINUTE,
|
|
28
|
+
t as MS_PER_SECOND,
|
|
29
|
+
_ as PAD_LENGTH,
|
|
30
|
+
r as SEPARATOR_MARGIN,
|
|
31
|
+
a as SIZE_DIGIT_CLASSES,
|
|
32
|
+
n as SIZE_GAP_CLASSES,
|
|
33
|
+
b as SIZE_LABEL_CLASSES,
|
|
34
|
+
x as UPDATE_INTERVAL
|
|
35
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { CountdownTimerProps } from './CountdownTimer.types';
|
|
3
|
+
/**
|
|
4
|
+
* CountdownTimer - Visual countdown with days/hours/minutes/seconds.
|
|
5
|
+
* Multiple variants, sizes, and theming via BearProvider CSS variables.
|
|
6
|
+
*/
|
|
7
|
+
export declare const CountdownTimer: FC<CountdownTimerProps>;
|