@forgedevstack/bear 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Alert/Alert.cjs +1 -1
- package/dist/components/Alert/Alert.const.cjs +1 -1
- package/dist/components/Alert/Alert.const.d.ts +4 -0
- package/dist/components/Alert/Alert.const.js +9 -15
- package/dist/components/Alert/Alert.js +43 -38
- package/dist/components/AppBar/AppBar.cjs +1 -1
- package/dist/components/AppBar/AppBar.js +20 -16
- package/dist/components/BackTop/BackTop.cjs +1 -0
- package/dist/components/BackTop/BackTop.const.cjs +1 -0
- package/dist/components/BackTop/BackTop.const.d.ts +34 -0
- package/dist/components/BackTop/BackTop.const.js +29 -0
- package/dist/components/BackTop/BackTop.d.ts +21 -0
- package/dist/components/BackTop/BackTop.js +87 -0
- package/dist/components/BackTop/BackTop.types.d.ts +28 -0
- package/dist/components/BackTop/index.d.ts +3 -0
- package/dist/components/Badge/Badge.constants.d.ts +4 -4
- package/dist/components/Badge/Badge.types.d.ts +3 -3
- package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +39 -38
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.constants.cjs +38 -48
- package/dist/components/Button/Button.constants.d.ts +22 -3
- package/dist/components/Button/Button.constants.js +51 -50
- package/dist/components/Button/Button.d.ts +14 -7
- package/dist/components/Button/Button.js +123 -45
- package/dist/components/Button/Button.types.d.ts +22 -4
- package/dist/components/Calendar/Calendar.cjs +1 -1
- package/dist/components/Calendar/Calendar.js +3 -2
- package/dist/components/Card/Card.const.d.ts +2 -2
- package/dist/components/Card/Card.types.d.ts +2 -2
- package/dist/components/Chat/Chat.cjs +1 -0
- package/dist/components/Chat/Chat.const.cjs +1 -0
- package/dist/components/Chat/Chat.const.d.ts +26 -0
- package/dist/components/Chat/Chat.const.js +29 -0
- package/dist/components/Chat/Chat.d.ts +21 -0
- package/dist/components/Chat/Chat.js +179 -0
- package/dist/components/Chat/Chat.types.d.ts +55 -0
- package/dist/components/Chat/index.d.ts +2 -0
- package/dist/components/Confetti/Confetti.cjs +1 -0
- package/dist/components/Confetti/Confetti.const.cjs +1 -0
- package/dist/components/Confetti/Confetti.const.d.ts +16 -0
- package/dist/components/Confetti/Confetti.const.js +36 -0
- package/dist/components/Confetti/Confetti.d.ts +23 -0
- package/dist/components/Confetti/Confetti.js +94 -0
- package/dist/components/Confetti/Confetti.types.d.ts +50 -0
- package/dist/components/Confetti/index.d.ts +4 -0
- package/dist/components/Confetti/useConfetti.cjs +1 -0
- package/dist/components/Confetti/useConfetti.d.ts +13 -0
- package/dist/components/Confetti/useConfetti.js +12 -0
- package/dist/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/DatePicker/DatePicker.js +3 -2
- package/dist/components/DiffViewer/DiffViewer.cjs +1 -0
- package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -0
- package/dist/components/DiffViewer/DiffViewer.const.d.ts +18 -0
- package/dist/components/DiffViewer/DiffViewer.const.js +21 -0
- package/dist/components/DiffViewer/DiffViewer.d.ts +18 -0
- package/dist/components/DiffViewer/DiffViewer.js +127 -0
- package/dist/components/DiffViewer/DiffViewer.types.d.ts +40 -0
- package/dist/components/DiffViewer/DiffViewer.utils.cjs +3 -0
- package/dist/components/DiffViewer/DiffViewer.utils.d.ts +9 -0
- package/dist/components/DiffViewer/DiffViewer.utils.js +39 -0
- package/dist/components/DiffViewer/index.d.ts +2 -0
- package/dist/components/Drawer/Drawer.cjs +1 -1
- package/dist/components/Drawer/Drawer.js +35 -35
- package/dist/components/FloatingChat/FloatingChat.cjs +1 -0
- package/dist/components/FloatingChat/FloatingChat.const.cjs +1 -0
- package/dist/components/FloatingChat/FloatingChat.const.d.ts +12 -0
- package/dist/components/FloatingChat/FloatingChat.const.js +15 -0
- package/dist/components/FloatingChat/FloatingChat.d.ts +19 -0
- package/dist/components/FloatingChat/FloatingChat.js +144 -0
- package/dist/components/FloatingChat/FloatingChat.types.d.ts +44 -0
- package/dist/components/FloatingChat/index.d.ts +2 -0
- package/dist/components/JsonViewer/JsonViewer.cjs +1 -0
- package/dist/components/JsonViewer/JsonViewer.const.cjs +1 -0
- package/dist/components/JsonViewer/JsonViewer.const.d.ts +4 -0
- package/dist/components/JsonViewer/JsonViewer.const.js +24 -0
- package/dist/components/JsonViewer/JsonViewer.d.ts +17 -0
- package/dist/components/JsonViewer/JsonViewer.js +195 -0
- package/dist/components/JsonViewer/JsonViewer.types.d.ts +54 -0
- package/dist/components/JsonViewer/index.d.ts +2 -0
- package/dist/components/Kanban/Kanban.cjs +1 -1
- package/dist/components/Kanban/Kanban.js +18 -17
- package/dist/components/QRCode/QRCode.cjs +1 -0
- package/dist/components/QRCode/QRCode.const.cjs +1 -0
- package/dist/components/QRCode/QRCode.const.d.ts +21 -0
- package/dist/components/QRCode/QRCode.const.js +11 -0
- package/dist/components/QRCode/QRCode.d.ts +29 -0
- package/dist/components/QRCode/QRCode.js +68 -0
- package/dist/components/QRCode/QRCode.types.d.ts +32 -0
- package/dist/components/QRCode/QRCode.utils.cjs +1 -0
- package/dist/components/QRCode/QRCode.utils.d.ts +12 -0
- package/dist/components/QRCode/QRCode.utils.js +74 -0
- package/dist/components/QRCode/index.d.ts +3 -0
- package/dist/components/Spinner/Spinner.types.d.ts +2 -2
- package/dist/components/Terminal/Terminal.cjs +1 -0
- package/dist/components/Terminal/Terminal.const.cjs +1 -0
- package/dist/components/Terminal/Terminal.const.d.ts +32 -0
- package/dist/components/Terminal/Terminal.const.js +42 -0
- package/dist/components/Terminal/Terminal.d.ts +27 -0
- package/dist/components/Terminal/Terminal.js +155 -0
- package/dist/components/Terminal/Terminal.types.d.ts +49 -0
- package/dist/components/Terminal/index.d.ts +2 -0
- package/dist/components/Tour/Tour.cjs +1 -0
- package/dist/components/Tour/Tour.const.cjs +1 -0
- package/dist/components/Tour/Tour.const.d.ts +25 -0
- package/dist/components/Tour/Tour.const.js +38 -0
- package/dist/components/Tour/Tour.d.ts +17 -0
- package/dist/components/Tour/Tour.js +179 -0
- package/dist/components/Tour/Tour.types.d.ts +80 -0
- package/dist/components/Tour/index.d.ts +4 -0
- package/dist/components/Tour/useTour.cjs +1 -0
- package/dist/components/Tour/useTour.d.ts +14 -0
- package/dist/components/Tour/useTour.js +27 -0
- package/dist/components/Typography/Typography.cjs +1 -1
- package/dist/components/Typography/Typography.d.ts +5 -1
- package/dist/components/Typography/Typography.js +93 -57
- package/dist/components/Typography/Typography.types.d.ts +29 -2
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.d.ts +19 -1
- package/dist/components/index.js +242 -218
- package/dist/context/BearProvider.cjs +1 -1
- package/dist/context/BearProvider.d.ts +110 -5
- package/dist/context/BearProvider.js +198 -53
- package/dist/context/defaultTheme.cjs +1 -1
- package/dist/context/defaultTheme.js +11 -11
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.ts +14 -0
- package/dist/hooks/index.js +56 -39
- package/dist/hooks/useBearComponent/index.d.ts +2 -0
- package/dist/hooks/useBearComponent/useBearComponent.cjs +1 -0
- package/dist/hooks/useBearComponent/useBearComponent.d.ts +71 -0
- package/dist/hooks/useBearComponent/useBearComponent.js +54 -0
- package/dist/hooks/useBearComponent/useBearComponent.types.d.ts +40 -0
- package/dist/hooks/useIdle/index.d.ts +2 -0
- package/dist/hooks/useIdle/useIdle.cjs +1 -0
- package/dist/hooks/useIdle/useIdle.d.ts +22 -0
- package/dist/hooks/useIdle/useIdle.js +66 -0
- package/dist/hooks/useIdle/useIdle.types.d.ts +29 -0
- package/dist/hooks/useLongPress/index.d.ts +2 -0
- package/dist/hooks/useLongPress/useLongPress.cjs +1 -0
- package/dist/hooks/useLongPress/useLongPress.d.ts +17 -0
- package/dist/hooks/useLongPress/useLongPress.js +44 -0
- package/dist/hooks/useLongPress/useLongPress.types.d.ts +26 -0
- package/dist/hooks/useOnline/index.d.ts +2 -0
- package/dist/hooks/useOnline/useOnline.cjs +1 -0
- package/dist/hooks/useOnline/useOnline.d.ts +16 -0
- package/dist/hooks/useOnline/useOnline.js +25 -0
- package/dist/hooks/useOnline/useOnline.types.d.ts +15 -0
- package/dist/hooks/usePageVisibility/index.d.ts +2 -0
- package/dist/hooks/usePageVisibility/usePageVisibility.cjs +1 -0
- package/dist/hooks/usePageVisibility/usePageVisibility.d.ts +19 -0
- package/dist/hooks/usePageVisibility/usePageVisibility.js +26 -0
- package/dist/hooks/usePageVisibility/usePageVisibility.types.d.ts +15 -0
- package/dist/hooks/useSpotlight/index.d.ts +2 -0
- package/dist/hooks/useSpotlight/useSpotlight.cjs +1 -0
- package/dist/hooks/useSpotlight/useSpotlight.d.ts +24 -0
- package/dist/hooks/useSpotlight/useSpotlight.js +49 -0
- package/dist/hooks/useSpotlight/useSpotlight.types.d.ts +23 -0
- package/dist/hooks/useWebSocket/index.d.ts +2 -0
- package/dist/hooks/useWebSocket/useWebSocket.cjs +1 -0
- package/dist/hooks/useWebSocket/useWebSocket.d.ts +22 -0
- package/dist/hooks/useWebSocket/useWebSocket.js +75 -0
- package/dist/hooks/useWebSocket/useWebSocket.types.d.ts +44 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +324 -283
- package/dist/styles.css +1 -1
- package/dist/types/component.types.d.ts +125 -42
- package/dist/types/theme.types.d.ts +82 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { TourProps } from './Tour.types';
|
|
3
|
+
/**
|
|
4
|
+
* Tour - Feature tour/onboarding walkthrough
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const steps = [
|
|
9
|
+
* { target: '#welcome-btn', title: 'Welcome!', description: 'Click here to start' },
|
|
10
|
+
* { target: '#settings', title: 'Settings', description: 'Configure your preferences' },
|
|
11
|
+
* ];
|
|
12
|
+
*
|
|
13
|
+
* <Tour steps={steps} open={showTour} onClose={() => setShowTour(false)} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const Tour: FC<TourProps>;
|
|
17
|
+
export default Tour;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { jsxs as u, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useRef as F, useCallback as T, useEffect as x } from "react";
|
|
3
|
+
import { cn as y } from "../../utils/cn.js";
|
|
4
|
+
import { Button as O } from "../Button/Button.js";
|
|
5
|
+
import { Typography as A } from "../Typography/Typography.js";
|
|
6
|
+
import { TOUR_DEFAULTS as o, TOUR_TOOLTIP_OFFSET as _, TOUR_Z_INDEX as S, TOUR_PLACEMENT_STYLES as J } from "./Tour.const.js";
|
|
7
|
+
const ot = ({
|
|
8
|
+
steps: s,
|
|
9
|
+
open: f = !1,
|
|
10
|
+
current: B,
|
|
11
|
+
onClose: d,
|
|
12
|
+
onStepChange: b,
|
|
13
|
+
onFinish: m,
|
|
14
|
+
showIndicators: R = o.SHOW_INDICATORS,
|
|
15
|
+
showCloseButton: U = o.SHOW_CLOSE_BUTTON,
|
|
16
|
+
showSkipButton: z = o.SHOW_SKIP_BUTTON,
|
|
17
|
+
showPrevButton: D = o.SHOW_PREV_BUTTON,
|
|
18
|
+
finishText: H = o.FINISH_TEXT,
|
|
19
|
+
skipText: M = o.SKIP_TEXT,
|
|
20
|
+
maskOpacity: I = o.MASK_OPACITY,
|
|
21
|
+
maskColor: P = o.MASK_COLOR,
|
|
22
|
+
animated: v = o.ANIMATED,
|
|
23
|
+
className: W,
|
|
24
|
+
testId: X
|
|
25
|
+
}) => {
|
|
26
|
+
const [G, L] = w(0), [r, K] = w(null), [k, V] = w({ top: 0, left: 0 }), j = F(null), c = B ?? G, t = s[c], h = c === s.length - 1, Y = c === 0, p = T(() => t ? typeof t.target == "function" ? t.target() : document.querySelector(t.target) : null, [t]), E = T(() => {
|
|
27
|
+
const e = p();
|
|
28
|
+
if (e) {
|
|
29
|
+
const a = e.getBoundingClientRect();
|
|
30
|
+
K(a);
|
|
31
|
+
}
|
|
32
|
+
}, [p]);
|
|
33
|
+
x(() => {
|
|
34
|
+
if (!r || !t) return;
|
|
35
|
+
const e = t.placement || o.PLACEMENT, a = t.spotlightPadding ?? o.SPOTLIGHT_PADDING;
|
|
36
|
+
let l = 0, i = 0;
|
|
37
|
+
switch (e) {
|
|
38
|
+
case "top":
|
|
39
|
+
case "top-start":
|
|
40
|
+
case "top-end":
|
|
41
|
+
l = r.top - _ - a, i = e === "top" ? r.left + r.width / 2 : e === "top-start" ? r.left : r.right;
|
|
42
|
+
break;
|
|
43
|
+
case "bottom":
|
|
44
|
+
case "bottom-start":
|
|
45
|
+
case "bottom-end":
|
|
46
|
+
l = r.bottom + _ + a, i = e === "bottom" ? r.left + r.width / 2 : e === "bottom-start" ? r.left : r.right;
|
|
47
|
+
break;
|
|
48
|
+
case "left":
|
|
49
|
+
case "left-start":
|
|
50
|
+
case "left-end":
|
|
51
|
+
i = r.left - _ - a, l = e === "left" ? r.top + r.height / 2 : e === "left-start" ? r.top : r.bottom;
|
|
52
|
+
break;
|
|
53
|
+
case "right":
|
|
54
|
+
case "right-start":
|
|
55
|
+
case "right-end":
|
|
56
|
+
i = r.right + _ + a, l = e === "right" ? r.top + r.height / 2 : e === "right-start" ? r.top : r.bottom;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
V({ top: l, left: i });
|
|
60
|
+
}, [r, t]), x(() => {
|
|
61
|
+
if (!f) return;
|
|
62
|
+
E();
|
|
63
|
+
const e = () => E();
|
|
64
|
+
return window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
65
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
66
|
+
};
|
|
67
|
+
}, [f, c, E]), x(() => {
|
|
68
|
+
if (!f) return;
|
|
69
|
+
const e = p();
|
|
70
|
+
e && e.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
71
|
+
}, [f, c, p]);
|
|
72
|
+
const q = T(async () => {
|
|
73
|
+
var e, a, l;
|
|
74
|
+
if (t != null && t.onAfterStep && await t.onAfterStep(), h)
|
|
75
|
+
m == null || m(), d == null || d();
|
|
76
|
+
else {
|
|
77
|
+
const i = c + 1;
|
|
78
|
+
L(i), b == null || b(i), (e = s[i]) != null && e.onBeforeStep && await ((l = (a = s[i]).onBeforeStep) == null ? void 0 : l.call(a));
|
|
79
|
+
}
|
|
80
|
+
}, [c, h, t, s, m, d, b]), Z = T(async () => {
|
|
81
|
+
var a, l, i;
|
|
82
|
+
t != null && t.onAfterStep && await t.onAfterStep();
|
|
83
|
+
const e = c - 1;
|
|
84
|
+
L(e), b == null || b(e), (a = s[e]) != null && a.onBeforeStep && await ((i = (l = s[e]).onBeforeStep) == null ? void 0 : i.call(l));
|
|
85
|
+
}, [c, t, s, b]), N = T(() => {
|
|
86
|
+
d == null || d();
|
|
87
|
+
}, [d]), $ = (t == null ? void 0 : t.placement) || o.PLACEMENT, g = (t == null ? void 0 : t.spotlightPadding) ?? o.SPOTLIGHT_PADDING;
|
|
88
|
+
return !f || !t ? null : /* @__PURE__ */ u(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
className: y("Bear-Tour", W),
|
|
92
|
+
"data-testid": X,
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ n(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
className: "Bear-Tour__overlay bear-fixed bear-inset-0",
|
|
98
|
+
style: {
|
|
99
|
+
zIndex: S.OVERLAY,
|
|
100
|
+
backgroundColor: P,
|
|
101
|
+
opacity: I,
|
|
102
|
+
transition: v ? "opacity 0.3s" : "none"
|
|
103
|
+
},
|
|
104
|
+
onClick: N
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
r && /* @__PURE__ */ n(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
className: "Bear-Tour__spotlight bear-fixed bear-pointer-events-none",
|
|
111
|
+
style: {
|
|
112
|
+
zIndex: S.SPOTLIGHT,
|
|
113
|
+
top: r.top - g,
|
|
114
|
+
left: r.left - g,
|
|
115
|
+
width: r.width + g * 2,
|
|
116
|
+
height: r.height + g * 2,
|
|
117
|
+
borderRadius: 8,
|
|
118
|
+
boxShadow: `0 0 0 9999px ${P}`,
|
|
119
|
+
opacity: I,
|
|
120
|
+
transition: v ? "all 0.3s ease" : "none"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
/* @__PURE__ */ u(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
ref: j,
|
|
128
|
+
className: "Bear-Tour__tooltip bear-fixed bear-bg-white dark:bear-bg-neutral-800 bear-rounded-lg bear-shadow-xl bear-p-4",
|
|
129
|
+
style: {
|
|
130
|
+
zIndex: S.TOOLTIP,
|
|
131
|
+
top: k.top,
|
|
132
|
+
left: k.left,
|
|
133
|
+
minWidth: 280,
|
|
134
|
+
maxWidth: 360,
|
|
135
|
+
...J[$],
|
|
136
|
+
transition: v ? "all 0.3s ease" : "none"
|
|
137
|
+
},
|
|
138
|
+
children: [
|
|
139
|
+
U && /* @__PURE__ */ n(
|
|
140
|
+
"button",
|
|
141
|
+
{
|
|
142
|
+
className: "Bear-Tour__close bear-absolute bear-top-2 bear-right-2 bear-p-1 bear-text-neutral-400 hover:bear-text-neutral-600 dark:hover:bear-text-neutral-300 bear-cursor-pointer bear-bg-transparent bear-border-none",
|
|
143
|
+
onClick: N,
|
|
144
|
+
"aria-label": "Close tour",
|
|
145
|
+
children: /* @__PURE__ */ n("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ n("path", { d: "M18 6L6 18M6 6l12 12" }) })
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
/* @__PURE__ */ u("div", { className: "Bear-Tour__content bear-pr-6", children: [
|
|
149
|
+
t.title && /* @__PURE__ */ n(A, { variant: "h6", className: "bear-mb-2", children: t.title }),
|
|
150
|
+
t.description && /* @__PURE__ */ n(A, { variant: "body2", color: "secondary", className: "bear-mb-4", children: t.description }),
|
|
151
|
+
t.content
|
|
152
|
+
] }),
|
|
153
|
+
/* @__PURE__ */ u("div", { className: "Bear-Tour__footer bear-flex bear-items-center bear-justify-between bear-mt-4 bear-pt-3 bear-border-t bear-border-neutral-200 dark:bear-border-neutral-700", children: [
|
|
154
|
+
R && /* @__PURE__ */ n("div", { className: "bear-flex bear-gap-1.5", children: s.map((e, a) => /* @__PURE__ */ n(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
className: y(
|
|
158
|
+
"bear-w-2 bear-h-2 bear-rounded-full bear-transition-colors",
|
|
159
|
+
a === c ? "bear-bg-[var(--bear-primary-500)]" : "bear-bg-neutral-300 dark:bear-bg-neutral-600"
|
|
160
|
+
)
|
|
161
|
+
},
|
|
162
|
+
a
|
|
163
|
+
)) }),
|
|
164
|
+
/* @__PURE__ */ u("div", { className: "bear-flex bear-gap-2 bear-ml-auto", children: [
|
|
165
|
+
z && !h && /* @__PURE__ */ n(O, { variant: "ghost", size: "sm", onClick: N, children: M }),
|
|
166
|
+
D && !Y && /* @__PURE__ */ n(O, { variant: "outline", size: "sm", onClick: Z, children: t.prevText || o.PREV_TEXT }),
|
|
167
|
+
/* @__PURE__ */ n(O, { variant: "primary", size: "sm", onClick: q, children: h ? H : t.nextText || o.NEXT_TEXT })
|
|
168
|
+
] })
|
|
169
|
+
] })
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
export {
|
|
178
|
+
ot as Tour
|
|
179
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface TourStep {
|
|
3
|
+
/** Target element selector or ref */
|
|
4
|
+
target: string | (() => HTMLElement | null);
|
|
5
|
+
/** Step title */
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
/** Step description */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** Custom content */
|
|
10
|
+
content?: ReactNode;
|
|
11
|
+
/** Placement of the tooltip */
|
|
12
|
+
placement?: TourPlacement;
|
|
13
|
+
/** Disable interaction with target */
|
|
14
|
+
disableInteraction?: boolean;
|
|
15
|
+
/** Show spotlight on target */
|
|
16
|
+
spotlightPadding?: number;
|
|
17
|
+
/** Custom next button text */
|
|
18
|
+
nextText?: string;
|
|
19
|
+
/** Custom prev button text */
|
|
20
|
+
prevText?: string;
|
|
21
|
+
/** Before step callback */
|
|
22
|
+
onBeforeStep?: () => Promise<void> | void;
|
|
23
|
+
/** After step callback */
|
|
24
|
+
onAfterStep?: () => Promise<void> | void;
|
|
25
|
+
}
|
|
26
|
+
export type TourPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
|
|
27
|
+
export interface TourProps {
|
|
28
|
+
/** Array of tour steps */
|
|
29
|
+
steps: TourStep[];
|
|
30
|
+
/** Whether tour is open */
|
|
31
|
+
open?: boolean;
|
|
32
|
+
/** Current step index */
|
|
33
|
+
current?: number;
|
|
34
|
+
/** Called when tour closes */
|
|
35
|
+
onClose?: () => void;
|
|
36
|
+
/** Called when step changes */
|
|
37
|
+
onStepChange?: (current: number) => void;
|
|
38
|
+
/** Called when tour finishes */
|
|
39
|
+
onFinish?: () => void;
|
|
40
|
+
/** Show step indicators */
|
|
41
|
+
showIndicators?: boolean;
|
|
42
|
+
/** Show close button */
|
|
43
|
+
showCloseButton?: boolean;
|
|
44
|
+
/** Show skip button */
|
|
45
|
+
showSkipButton?: boolean;
|
|
46
|
+
/** Show prev button */
|
|
47
|
+
showPrevButton?: boolean;
|
|
48
|
+
/** Finish button text */
|
|
49
|
+
finishText?: string;
|
|
50
|
+
/** Skip button text */
|
|
51
|
+
skipText?: string;
|
|
52
|
+
/** Custom class name */
|
|
53
|
+
className?: string;
|
|
54
|
+
/** Mask/overlay opacity */
|
|
55
|
+
maskOpacity?: number;
|
|
56
|
+
/** Mask color */
|
|
57
|
+
maskColor?: string;
|
|
58
|
+
/** Animation enabled */
|
|
59
|
+
animated?: boolean;
|
|
60
|
+
/** Test ID */
|
|
61
|
+
testId?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface UseTourReturn {
|
|
64
|
+
/** Start the tour */
|
|
65
|
+
start: () => void;
|
|
66
|
+
/** Stop the tour */
|
|
67
|
+
stop: () => void;
|
|
68
|
+
/** Go to next step */
|
|
69
|
+
next: () => void;
|
|
70
|
+
/** Go to previous step */
|
|
71
|
+
prev: () => void;
|
|
72
|
+
/** Go to specific step */
|
|
73
|
+
goTo: (step: number) => void;
|
|
74
|
+
/** Whether tour is active */
|
|
75
|
+
isActive: boolean;
|
|
76
|
+
/** Current step index */
|
|
77
|
+
currentStep: number;
|
|
78
|
+
/** Total steps count */
|
|
79
|
+
totalSteps: number;
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),b=l=>{const[o,a]=t.useState(!1),[c,n]=t.useState(0),u=t.useCallback(()=>{n(0),a(!0)},[]),s=t.useCallback(()=>{a(!1),n(0)},[]),r=t.useCallback(()=>{c<l.length-1?n(e=>e+1):s()},[c,l.length,s]),i=t.useCallback(()=>{c>0&&n(e=>e-1)},[c]),g=t.useCallback(e=>{e>=0&&e<l.length&&n(e)},[l.length]);return{start:u,stop:s,next:r,prev:i,goTo:g,isActive:o,currentStep:c,totalSteps:l.length}};exports.useTour=b;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UseTourReturn, TourStep } from './Tour.types';
|
|
2
|
+
/**
|
|
3
|
+
* useTour - Hook to control tour programmatically
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* const steps = [...];
|
|
8
|
+
* const { start, stop, next, prev, isActive, currentStep } = useTour(steps);
|
|
9
|
+
*
|
|
10
|
+
* <Tour steps={steps} open={isActive} current={currentStep} onClose={stop} />
|
|
11
|
+
* <Button onClick={start}>Start Tour</Button>
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const useTour: (steps: TourStep[]) => UseTourReturn;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useState as s, useCallback as r } from "react";
|
|
2
|
+
const S = (e) => {
|
|
3
|
+
const [u, l] = s(!1), [n, o] = s(0), a = r(() => {
|
|
4
|
+
o(0), l(!0);
|
|
5
|
+
}, []), c = r(() => {
|
|
6
|
+
l(!1), o(0);
|
|
7
|
+
}, []), i = r(() => {
|
|
8
|
+
n < e.length - 1 ? o((t) => t + 1) : c();
|
|
9
|
+
}, [n, e.length, c]), f = r(() => {
|
|
10
|
+
n > 0 && o((t) => t - 1);
|
|
11
|
+
}, [n]), g = r((t) => {
|
|
12
|
+
t >= 0 && t < e.length && o(t);
|
|
13
|
+
}, [e.length]);
|
|
14
|
+
return {
|
|
15
|
+
start: a,
|
|
16
|
+
stop: c,
|
|
17
|
+
next: i,
|
|
18
|
+
prev: f,
|
|
19
|
+
goTo: g,
|
|
20
|
+
isActive: u,
|
|
21
|
+
currentStep: n,
|
|
22
|
+
totalSteps: e.length
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
S as useTour
|
|
27
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react/jsx-runtime"),i=require("react"),W=require("../../utils/cn.cjs"),L=require("../../context/BearProvider.cjs"),N={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",caption:"span",overline:"span",code:"code",inherit:"span"},H={h1:"bear-text-5xl bear-font-bold bear-tracking-tight",h2:"bear-text-4xl bear-font-bold bear-tracking-tight",h3:"bear-text-3xl bear-font-semibold",h4:"bear-text-2xl bear-font-semibold",h5:"bear-text-xl bear-font-medium",h6:"bear-text-lg bear-font-medium",subtitle1:"bear-text-lg bear-font-normal",subtitle2:"bear-text-base bear-font-medium",body1:"bear-text-base bear-font-normal",body2:"bear-text-sm bear-font-normal",caption:"bear-text-xs",overline:"bear-text-xs bear-uppercase bear-tracking-wider",code:"bear-text-sm bear-font-mono bear-bg-gray-100 dark:bear-bg-gray-800 bear-px-1.5 bear-py-0.5 bear-rounded",inherit:""},R={thin:"bear-font-thin",light:"bear-font-light",normal:"bear-font-normal",medium:"bear-font-medium",semibold:"bear-font-semibold",bold:"bear-font-bold",extrabold:"bear-font-extrabold"},j={thin:100,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},w={left:"bear-text-left",center:"bear-text-center",right:"bear-text-right",justify:"bear-text-justify"},y={primary:"bear-text-gray-900 dark:bear-text-gray-100",secondary:"bear-text-gray-600 dark:bear-text-gray-400",muted:"bear-text-gray-400 dark:bear-text-gray-500",success:"bear-text-green-600 dark:bear-text-green-400",danger:"bear-text-red-600 dark:bear-text-red-400",warning:"bear-text-amber-600 dark:bear-text-amber-400"},M={tight:"bear-leading-tight",normal:"bear-leading-normal",relaxed:"bear-leading-relaxed",loose:"bear-leading-loose"},q=["h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","caption","overline","code","inherit"],G=({variant:t="body1",component:s,align:h,weight:d,color:o="primary",truncate:l=!1,maxLines:b,italic:m=!1,underline:u=!1,strikethrough:c=!1,noWrap:p=!1,inline:x=!1,paragraph:S=!1,lineHeight:f,children:T,className:k,style:A,testId:C,...B})=>{const r=i.useContext(L.BearContext),n=q.includes(t),e=i.useMemo(()=>{if(!(n||!(r!=null&&r.customTypography)))return r.customTypography[t]},[n,r==null?void 0:r.customTypography,t]),I=i.useMemo(()=>s||(e!=null&&e.component?e.component:n?N[t]:"span"),[s,e,n,t]),g=o&&!y[o],E=i.useMemo(()=>{if(!e)return{};const a={};return e.fontSize&&(a.fontSize=e.fontSize),e.lineHeight&&(a.lineHeight=e.lineHeight),e.letterSpacing&&(a.letterSpacing=e.letterSpacing),e.textTransform&&(a.textTransform=e.textTransform),e.fontFamily&&(a.fontFamily=e.fontFamily),e.fontWeight&&(a.fontWeight=typeof e.fontWeight=="number"?e.fontWeight:j[e.fontWeight]||400),a},[e]);return _.jsx(I,{className:W.cn("Bear-Typography",`Bear-Typography--${t}`,n&&H[t],d&&R[d],h&&w[h],!g&&o&&y[o],f&&M[f],m&&"Bear-Typography--italic bear-italic",u&&"Bear-Typography--underline bear-underline",c&&"Bear-Typography--strikethrough bear-line-through",p&&"bear-whitespace-nowrap",x&&"bear-inline",S&&"bear-mb-4",l&&!b&&"Bear-Typography--truncate bear-truncate",l&&b&&"bear-overflow-hidden",k),style:{...E,...A,...g&&{color:o},...l&&b&&{display:"-webkit-box",WebkitLineClamp:b,WebkitBoxOrient:"vertical"}},"data-testid":C,...B,children:T})};exports.Typography=G;
|
|
@@ -5,9 +5,13 @@ import { TypographyProps } from './Typography.types';
|
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
7
|
* ```tsx
|
|
8
|
+
* // Built-in variants
|
|
8
9
|
* <Typography variant="h1">Heading 1</Typography>
|
|
9
10
|
* <Typography variant="body1" color="secondary">Body text</Typography>
|
|
10
|
-
*
|
|
11
|
+
*
|
|
12
|
+
* // Custom variants (defined in BearProvider)
|
|
13
|
+
* <Typography variant="b250">Custom 25px text</Typography>
|
|
14
|
+
* <Typography variant="display1">Large display text</Typography>
|
|
11
15
|
* ```
|
|
12
16
|
*/
|
|
13
17
|
export declare const Typography: FC<TypographyProps>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as W, useMemo as s } from "react";
|
|
3
|
+
import { cn as L } from "../../utils/cn.js";
|
|
4
|
+
import { BearContext as N } from "../../context/BearProvider.js";
|
|
5
|
+
const H = {
|
|
4
6
|
h1: "h1",
|
|
5
7
|
h2: "h2",
|
|
6
8
|
h3: "h3",
|
|
@@ -13,8 +15,9 @@ const C = {
|
|
|
13
15
|
body2: "p",
|
|
14
16
|
caption: "span",
|
|
15
17
|
overline: "span",
|
|
16
|
-
code: "code"
|
|
17
|
-
|
|
18
|
+
code: "code",
|
|
19
|
+
inherit: "span"
|
|
20
|
+
}, w = {
|
|
18
21
|
h1: "bear-text-5xl bear-font-bold bear-tracking-tight",
|
|
19
22
|
h2: "bear-text-4xl bear-font-bold bear-tracking-tight",
|
|
20
23
|
h3: "bear-text-3xl bear-font-semibold",
|
|
@@ -27,8 +30,10 @@ const C = {
|
|
|
27
30
|
body2: "bear-text-sm bear-font-normal",
|
|
28
31
|
caption: "bear-text-xs",
|
|
29
32
|
overline: "bear-text-xs bear-uppercase bear-tracking-wider",
|
|
30
|
-
code: "bear-text-sm bear-font-mono bear-bg-gray-100 dark:bear-bg-gray-800 bear-px-1.5 bear-py-0.5 bear-rounded"
|
|
31
|
-
|
|
33
|
+
code: "bear-text-sm bear-font-mono bear-bg-gray-100 dark:bear-bg-gray-800 bear-px-1.5 bear-py-0.5 bear-rounded",
|
|
34
|
+
inherit: ""
|
|
35
|
+
// Inherits all styles from parent
|
|
36
|
+
}, G = {
|
|
32
37
|
thin: "bear-font-thin",
|
|
33
38
|
light: "bear-font-light",
|
|
34
39
|
normal: "bear-font-normal",
|
|
@@ -36,81 +41,112 @@ const C = {
|
|
|
36
41
|
semibold: "bear-font-semibold",
|
|
37
42
|
bold: "bear-font-bold",
|
|
38
43
|
extrabold: "bear-font-extrabold"
|
|
39
|
-
},
|
|
44
|
+
}, R = {
|
|
45
|
+
thin: 100,
|
|
46
|
+
light: 300,
|
|
47
|
+
normal: 400,
|
|
48
|
+
medium: 500,
|
|
49
|
+
semibold: 600,
|
|
50
|
+
bold: 700,
|
|
51
|
+
extrabold: 800
|
|
52
|
+
}, V = {
|
|
40
53
|
left: "bear-text-left",
|
|
41
54
|
center: "bear-text-center",
|
|
42
55
|
right: "bear-text-right",
|
|
43
56
|
justify: "bear-text-justify"
|
|
44
|
-
},
|
|
57
|
+
}, g = {
|
|
45
58
|
primary: "bear-text-gray-900 dark:bear-text-gray-100",
|
|
46
59
|
secondary: "bear-text-gray-600 dark:bear-text-gray-400",
|
|
47
60
|
muted: "bear-text-gray-400 dark:bear-text-gray-500",
|
|
48
61
|
success: "bear-text-green-600 dark:bear-text-green-400",
|
|
49
62
|
danger: "bear-text-red-600 dark:bear-text-red-400",
|
|
50
63
|
warning: "bear-text-amber-600 dark:bear-text-amber-400"
|
|
51
|
-
},
|
|
64
|
+
}, j = {
|
|
52
65
|
tight: "bear-leading-tight",
|
|
53
66
|
normal: "bear-leading-normal",
|
|
54
67
|
relaxed: "bear-leading-relaxed",
|
|
55
68
|
loose: "bear-leading-loose"
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
}, z = [
|
|
70
|
+
"h1",
|
|
71
|
+
"h2",
|
|
72
|
+
"h3",
|
|
73
|
+
"h4",
|
|
74
|
+
"h5",
|
|
75
|
+
"h6",
|
|
76
|
+
"subtitle1",
|
|
77
|
+
"subtitle2",
|
|
78
|
+
"body1",
|
|
79
|
+
"body2",
|
|
80
|
+
"caption",
|
|
81
|
+
"overline",
|
|
82
|
+
"code",
|
|
83
|
+
"inherit"
|
|
84
|
+
], P = ({
|
|
85
|
+
variant: t = "body1",
|
|
86
|
+
component: i,
|
|
87
|
+
align: h,
|
|
88
|
+
weight: d,
|
|
89
|
+
color: o = "primary",
|
|
90
|
+
truncate: l = !1,
|
|
91
|
+
maxLines: b,
|
|
92
|
+
italic: p = !1,
|
|
93
|
+
underline: y = !1,
|
|
94
|
+
strikethrough: x = !1,
|
|
95
|
+
noWrap: u = !1,
|
|
96
|
+
inline: c = !1,
|
|
97
|
+
paragraph: S = !1,
|
|
98
|
+
lineHeight: f,
|
|
99
|
+
children: T,
|
|
100
|
+
className: k,
|
|
101
|
+
style: A,
|
|
102
|
+
testId: C,
|
|
103
|
+
...I
|
|
76
104
|
}) => {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
105
|
+
const r = W(N), n = z.includes(t), e = s(() => {
|
|
106
|
+
if (!(n || !(r != null && r.customTypography)))
|
|
107
|
+
return r.customTypography[t];
|
|
108
|
+
}, [n, r == null ? void 0 : r.customTypography, t]), B = s(() => i || (e != null && e.component ? e.component : n ? H[t] : "span"), [i, e, n, t]), m = o && !g[o], E = s(() => {
|
|
109
|
+
if (!e) return {};
|
|
110
|
+
const a = {};
|
|
111
|
+
return e.fontSize && (a.fontSize = e.fontSize), e.lineHeight && (a.lineHeight = e.lineHeight), e.letterSpacing && (a.letterSpacing = e.letterSpacing), e.textTransform && (a.textTransform = e.textTransform), e.fontFamily && (a.fontFamily = e.fontFamily), e.fontWeight && (a.fontWeight = typeof e.fontWeight == "number" ? e.fontWeight : R[e.fontWeight] || 400), a;
|
|
112
|
+
}, [e]);
|
|
113
|
+
return /* @__PURE__ */ _(
|
|
114
|
+
B,
|
|
80
115
|
{
|
|
81
|
-
className:
|
|
116
|
+
className: L(
|
|
82
117
|
"Bear-Typography",
|
|
83
|
-
`Bear-Typography--${
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
!
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
118
|
+
`Bear-Typography--${t}`,
|
|
119
|
+
n && w[t],
|
|
120
|
+
d && G[d],
|
|
121
|
+
h && V[h],
|
|
122
|
+
!m && o && g[o],
|
|
123
|
+
f && j[f],
|
|
124
|
+
p && "Bear-Typography--italic bear-italic",
|
|
125
|
+
y && "Bear-Typography--underline bear-underline",
|
|
126
|
+
x && "Bear-Typography--strikethrough bear-line-through",
|
|
127
|
+
u && "bear-whitespace-nowrap",
|
|
128
|
+
c && "bear-inline",
|
|
129
|
+
S && "bear-mb-4",
|
|
130
|
+
l && !b && "Bear-Typography--truncate bear-truncate",
|
|
131
|
+
l && b && "bear-overflow-hidden",
|
|
132
|
+
k
|
|
98
133
|
),
|
|
99
134
|
style: {
|
|
100
|
-
...
|
|
101
|
-
...
|
|
102
|
-
...
|
|
135
|
+
...E,
|
|
136
|
+
...A,
|
|
137
|
+
...m && { color: o },
|
|
138
|
+
...l && b && {
|
|
103
139
|
display: "-webkit-box",
|
|
104
|
-
WebkitLineClamp:
|
|
140
|
+
WebkitLineClamp: b,
|
|
105
141
|
WebkitBoxOrient: "vertical"
|
|
106
142
|
}
|
|
107
143
|
},
|
|
108
|
-
"data-testid":
|
|
109
|
-
...
|
|
110
|
-
children:
|
|
144
|
+
"data-testid": C,
|
|
145
|
+
...I,
|
|
146
|
+
children: T
|
|
111
147
|
}
|
|
112
148
|
);
|
|
113
149
|
};
|
|
114
150
|
export {
|
|
115
|
-
|
|
151
|
+
P as Typography
|
|
116
152
|
};
|
|
@@ -1,8 +1,35 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode, ElementType } from 'react';
|
|
2
|
-
|
|
2
|
+
/** Built-in typography variants */
|
|
3
|
+
export type BuiltInTypographyVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subtitle1' | 'subtitle2' | 'body1' | 'body2' | 'caption' | 'overline' | 'code' | 'inherit';
|
|
4
|
+
/** Typography variant - can be built-in or custom (string) */
|
|
5
|
+
export type TypographyVariant = BuiltInTypographyVariant | (string & {});
|
|
3
6
|
export type TypographyAlign = 'left' | 'center' | 'right' | 'justify';
|
|
7
|
+
/**
|
|
8
|
+
* Custom typography variant definition
|
|
9
|
+
* Define your own text styles like "b250", "display1", etc.
|
|
10
|
+
*/
|
|
11
|
+
export interface CustomTypography {
|
|
12
|
+
/** Font size in px, rem, or em (e.g., "25px", "1.5rem") */
|
|
13
|
+
fontSize?: string;
|
|
14
|
+
/** Font weight */
|
|
15
|
+
fontWeight?: 'thin' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | number;
|
|
16
|
+
/** Line height (e.g., "1.2", "1.5", "32px") */
|
|
17
|
+
lineHeight?: string;
|
|
18
|
+
/** Letter spacing (e.g., "0.05em", "1px") */
|
|
19
|
+
letterSpacing?: string;
|
|
20
|
+
/** Text transform */
|
|
21
|
+
textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize';
|
|
22
|
+
/** Font family override */
|
|
23
|
+
fontFamily?: string;
|
|
24
|
+
/** HTML element to render as */
|
|
25
|
+
component?: ElementType;
|
|
26
|
+
}
|
|
27
|
+
/** Map of custom typography variants */
|
|
28
|
+
export type CustomTypographyMap = {
|
|
29
|
+
[key: string]: CustomTypography;
|
|
30
|
+
};
|
|
4
31
|
export interface TypographyProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
-
/** Typography variant */
|
|
32
|
+
/** Typography variant - built-in or custom */
|
|
6
33
|
variant?: TypographyVariant;
|
|
7
34
|
/** HTML element to render as */
|
|
8
35
|
component?: ElementType;
|