@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.
Files changed (169) hide show
  1. package/dist/components/Alert/Alert.cjs +1 -1
  2. package/dist/components/Alert/Alert.const.cjs +1 -1
  3. package/dist/components/Alert/Alert.const.d.ts +4 -0
  4. package/dist/components/Alert/Alert.const.js +9 -15
  5. package/dist/components/Alert/Alert.js +43 -38
  6. package/dist/components/AppBar/AppBar.cjs +1 -1
  7. package/dist/components/AppBar/AppBar.js +20 -16
  8. package/dist/components/BackTop/BackTop.cjs +1 -0
  9. package/dist/components/BackTop/BackTop.const.cjs +1 -0
  10. package/dist/components/BackTop/BackTop.const.d.ts +34 -0
  11. package/dist/components/BackTop/BackTop.const.js +29 -0
  12. package/dist/components/BackTop/BackTop.d.ts +21 -0
  13. package/dist/components/BackTop/BackTop.js +87 -0
  14. package/dist/components/BackTop/BackTop.types.d.ts +28 -0
  15. package/dist/components/BackTop/index.d.ts +3 -0
  16. package/dist/components/Badge/Badge.constants.d.ts +4 -4
  17. package/dist/components/Badge/Badge.types.d.ts +3 -3
  18. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  19. package/dist/components/BottomSheet/BottomSheet.js +39 -38
  20. package/dist/components/Button/Button.cjs +1 -1
  21. package/dist/components/Button/Button.constants.cjs +38 -48
  22. package/dist/components/Button/Button.constants.d.ts +22 -3
  23. package/dist/components/Button/Button.constants.js +51 -50
  24. package/dist/components/Button/Button.d.ts +14 -7
  25. package/dist/components/Button/Button.js +123 -45
  26. package/dist/components/Button/Button.types.d.ts +22 -4
  27. package/dist/components/Calendar/Calendar.cjs +1 -1
  28. package/dist/components/Calendar/Calendar.js +3 -2
  29. package/dist/components/Card/Card.const.d.ts +2 -2
  30. package/dist/components/Card/Card.types.d.ts +2 -2
  31. package/dist/components/Chat/Chat.cjs +1 -0
  32. package/dist/components/Chat/Chat.const.cjs +1 -0
  33. package/dist/components/Chat/Chat.const.d.ts +26 -0
  34. package/dist/components/Chat/Chat.const.js +29 -0
  35. package/dist/components/Chat/Chat.d.ts +21 -0
  36. package/dist/components/Chat/Chat.js +179 -0
  37. package/dist/components/Chat/Chat.types.d.ts +55 -0
  38. package/dist/components/Chat/index.d.ts +2 -0
  39. package/dist/components/Confetti/Confetti.cjs +1 -0
  40. package/dist/components/Confetti/Confetti.const.cjs +1 -0
  41. package/dist/components/Confetti/Confetti.const.d.ts +16 -0
  42. package/dist/components/Confetti/Confetti.const.js +36 -0
  43. package/dist/components/Confetti/Confetti.d.ts +23 -0
  44. package/dist/components/Confetti/Confetti.js +94 -0
  45. package/dist/components/Confetti/Confetti.types.d.ts +50 -0
  46. package/dist/components/Confetti/index.d.ts +4 -0
  47. package/dist/components/Confetti/useConfetti.cjs +1 -0
  48. package/dist/components/Confetti/useConfetti.d.ts +13 -0
  49. package/dist/components/Confetti/useConfetti.js +12 -0
  50. package/dist/components/DatePicker/DatePicker.cjs +1 -1
  51. package/dist/components/DatePicker/DatePicker.js +3 -2
  52. package/dist/components/DiffViewer/DiffViewer.cjs +1 -0
  53. package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -0
  54. package/dist/components/DiffViewer/DiffViewer.const.d.ts +18 -0
  55. package/dist/components/DiffViewer/DiffViewer.const.js +21 -0
  56. package/dist/components/DiffViewer/DiffViewer.d.ts +18 -0
  57. package/dist/components/DiffViewer/DiffViewer.js +127 -0
  58. package/dist/components/DiffViewer/DiffViewer.types.d.ts +40 -0
  59. package/dist/components/DiffViewer/DiffViewer.utils.cjs +3 -0
  60. package/dist/components/DiffViewer/DiffViewer.utils.d.ts +9 -0
  61. package/dist/components/DiffViewer/DiffViewer.utils.js +39 -0
  62. package/dist/components/DiffViewer/index.d.ts +2 -0
  63. package/dist/components/Drawer/Drawer.cjs +1 -1
  64. package/dist/components/Drawer/Drawer.js +35 -35
  65. package/dist/components/FloatingChat/FloatingChat.cjs +1 -0
  66. package/dist/components/FloatingChat/FloatingChat.const.cjs +1 -0
  67. package/dist/components/FloatingChat/FloatingChat.const.d.ts +12 -0
  68. package/dist/components/FloatingChat/FloatingChat.const.js +15 -0
  69. package/dist/components/FloatingChat/FloatingChat.d.ts +19 -0
  70. package/dist/components/FloatingChat/FloatingChat.js +144 -0
  71. package/dist/components/FloatingChat/FloatingChat.types.d.ts +44 -0
  72. package/dist/components/FloatingChat/index.d.ts +2 -0
  73. package/dist/components/JsonViewer/JsonViewer.cjs +1 -0
  74. package/dist/components/JsonViewer/JsonViewer.const.cjs +1 -0
  75. package/dist/components/JsonViewer/JsonViewer.const.d.ts +4 -0
  76. package/dist/components/JsonViewer/JsonViewer.const.js +24 -0
  77. package/dist/components/JsonViewer/JsonViewer.d.ts +17 -0
  78. package/dist/components/JsonViewer/JsonViewer.js +195 -0
  79. package/dist/components/JsonViewer/JsonViewer.types.d.ts +54 -0
  80. package/dist/components/JsonViewer/index.d.ts +2 -0
  81. package/dist/components/Kanban/Kanban.cjs +1 -1
  82. package/dist/components/Kanban/Kanban.js +18 -17
  83. package/dist/components/QRCode/QRCode.cjs +1 -0
  84. package/dist/components/QRCode/QRCode.const.cjs +1 -0
  85. package/dist/components/QRCode/QRCode.const.d.ts +21 -0
  86. package/dist/components/QRCode/QRCode.const.js +11 -0
  87. package/dist/components/QRCode/QRCode.d.ts +29 -0
  88. package/dist/components/QRCode/QRCode.js +68 -0
  89. package/dist/components/QRCode/QRCode.types.d.ts +32 -0
  90. package/dist/components/QRCode/QRCode.utils.cjs +1 -0
  91. package/dist/components/QRCode/QRCode.utils.d.ts +12 -0
  92. package/dist/components/QRCode/QRCode.utils.js +74 -0
  93. package/dist/components/QRCode/index.d.ts +3 -0
  94. package/dist/components/Spinner/Spinner.types.d.ts +2 -2
  95. package/dist/components/Terminal/Terminal.cjs +1 -0
  96. package/dist/components/Terminal/Terminal.const.cjs +1 -0
  97. package/dist/components/Terminal/Terminal.const.d.ts +32 -0
  98. package/dist/components/Terminal/Terminal.const.js +42 -0
  99. package/dist/components/Terminal/Terminal.d.ts +27 -0
  100. package/dist/components/Terminal/Terminal.js +155 -0
  101. package/dist/components/Terminal/Terminal.types.d.ts +49 -0
  102. package/dist/components/Terminal/index.d.ts +2 -0
  103. package/dist/components/Tour/Tour.cjs +1 -0
  104. package/dist/components/Tour/Tour.const.cjs +1 -0
  105. package/dist/components/Tour/Tour.const.d.ts +25 -0
  106. package/dist/components/Tour/Tour.const.js +38 -0
  107. package/dist/components/Tour/Tour.d.ts +17 -0
  108. package/dist/components/Tour/Tour.js +179 -0
  109. package/dist/components/Tour/Tour.types.d.ts +80 -0
  110. package/dist/components/Tour/index.d.ts +4 -0
  111. package/dist/components/Tour/useTour.cjs +1 -0
  112. package/dist/components/Tour/useTour.d.ts +14 -0
  113. package/dist/components/Tour/useTour.js +27 -0
  114. package/dist/components/Typography/Typography.cjs +1 -1
  115. package/dist/components/Typography/Typography.d.ts +5 -1
  116. package/dist/components/Typography/Typography.js +93 -57
  117. package/dist/components/Typography/Typography.types.d.ts +29 -2
  118. package/dist/components/index.cjs +1 -1
  119. package/dist/components/index.d.ts +19 -1
  120. package/dist/components/index.js +242 -218
  121. package/dist/context/BearProvider.cjs +1 -1
  122. package/dist/context/BearProvider.d.ts +110 -5
  123. package/dist/context/BearProvider.js +198 -53
  124. package/dist/context/defaultTheme.cjs +1 -1
  125. package/dist/context/defaultTheme.js +11 -11
  126. package/dist/hooks/index.cjs +1 -1
  127. package/dist/hooks/index.d.ts +14 -0
  128. package/dist/hooks/index.js +56 -39
  129. package/dist/hooks/useBearComponent/index.d.ts +2 -0
  130. package/dist/hooks/useBearComponent/useBearComponent.cjs +1 -0
  131. package/dist/hooks/useBearComponent/useBearComponent.d.ts +71 -0
  132. package/dist/hooks/useBearComponent/useBearComponent.js +54 -0
  133. package/dist/hooks/useBearComponent/useBearComponent.types.d.ts +40 -0
  134. package/dist/hooks/useIdle/index.d.ts +2 -0
  135. package/dist/hooks/useIdle/useIdle.cjs +1 -0
  136. package/dist/hooks/useIdle/useIdle.d.ts +22 -0
  137. package/dist/hooks/useIdle/useIdle.js +66 -0
  138. package/dist/hooks/useIdle/useIdle.types.d.ts +29 -0
  139. package/dist/hooks/useLongPress/index.d.ts +2 -0
  140. package/dist/hooks/useLongPress/useLongPress.cjs +1 -0
  141. package/dist/hooks/useLongPress/useLongPress.d.ts +17 -0
  142. package/dist/hooks/useLongPress/useLongPress.js +44 -0
  143. package/dist/hooks/useLongPress/useLongPress.types.d.ts +26 -0
  144. package/dist/hooks/useOnline/index.d.ts +2 -0
  145. package/dist/hooks/useOnline/useOnline.cjs +1 -0
  146. package/dist/hooks/useOnline/useOnline.d.ts +16 -0
  147. package/dist/hooks/useOnline/useOnline.js +25 -0
  148. package/dist/hooks/useOnline/useOnline.types.d.ts +15 -0
  149. package/dist/hooks/usePageVisibility/index.d.ts +2 -0
  150. package/dist/hooks/usePageVisibility/usePageVisibility.cjs +1 -0
  151. package/dist/hooks/usePageVisibility/usePageVisibility.d.ts +19 -0
  152. package/dist/hooks/usePageVisibility/usePageVisibility.js +26 -0
  153. package/dist/hooks/usePageVisibility/usePageVisibility.types.d.ts +15 -0
  154. package/dist/hooks/useSpotlight/index.d.ts +2 -0
  155. package/dist/hooks/useSpotlight/useSpotlight.cjs +1 -0
  156. package/dist/hooks/useSpotlight/useSpotlight.d.ts +24 -0
  157. package/dist/hooks/useSpotlight/useSpotlight.js +49 -0
  158. package/dist/hooks/useSpotlight/useSpotlight.types.d.ts +23 -0
  159. package/dist/hooks/useWebSocket/index.d.ts +2 -0
  160. package/dist/hooks/useWebSocket/useWebSocket.cjs +1 -0
  161. package/dist/hooks/useWebSocket/useWebSocket.d.ts +22 -0
  162. package/dist/hooks/useWebSocket/useWebSocket.js +75 -0
  163. package/dist/hooks/useWebSocket/useWebSocket.types.d.ts +44 -0
  164. package/dist/index.cjs +1 -1
  165. package/dist/index.js +324 -283
  166. package/dist/styles.css +1 -1
  167. package/dist/types/component.types.d.ts +125 -42
  168. package/dist/types/theme.types.d.ts +82 -0
  169. 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,4 @@
1
+ export { Tour, default } from './Tour';
2
+ export { useTour } from './useTour';
3
+ export * from './Tour.types';
4
+ export * from './Tour.const';
@@ -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 T=require("react/jsx-runtime"),A=require("../../utils/cn.cjs"),C={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"},E={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"},B={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"},_={left:"bear-text-left",center:"bear-text-center",right:"bear-text-right",justify:"bear-text-justify"},i={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"},I={tight:"bear-leading-tight",normal:"bear-leading-normal",relaxed:"bear-leading-relaxed",loose:"bear-leading-loose"},L=({variant:t="body1",component:d,align:b,weight:o,color:e="primary",truncate:a=!1,maxLines:r,italic:s=!1,underline:h=!1,strikethrough:x=!1,noWrap:g=!1,inline:y=!1,paragraph:p=!1,lineHeight:n,children:m,className:f,style:c,testId:u,...S})=>{const k=d||C[t],l=e&&!i[e];return T.jsx(k,{className:A.cn("Bear-Typography",`Bear-Typography--${t}`,E[t],o&&B[o],b&&_[b],!l&&e&&i[e],n&&I[n],s&&"Bear-Typography--italic bear-italic",h&&"Bear-Typography--underline bear-underline",x&&"Bear-Typography--strikethrough bear-line-through",g&&"bear-whitespace-nowrap",y&&"bear-inline",p&&"bear-mb-4",a&&!r&&"Bear-Typography--truncate bear-truncate",a&&r&&"bear-overflow-hidden",f),style:{...c,...l&&{color:e},...a&&r&&{display:"-webkit-box",WebkitLineClamp:r,WebkitBoxOrient:"vertical"}},"data-testid":u,...S,children:m})};exports.Typography=L;
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
- * <Typography variant="caption" truncate maxLines={2}>Long text...</Typography>
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 A } from "react/jsx-runtime";
2
- import { cn as T } from "../../utils/cn.js";
3
- const C = {
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
- }, E = {
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
- }, B = {
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
- }, i = {
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
- }, I = {
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
- }, N = ({
57
- variant: a = "body1",
58
- component: d,
59
- align: b,
60
- weight: o,
61
- color: e = "primary",
62
- truncate: t = !1,
63
- maxLines: r,
64
- italic: s = !1,
65
- underline: x = !1,
66
- strikethrough: h = !1,
67
- noWrap: g = !1,
68
- inline: m = !1,
69
- paragraph: y = !1,
70
- lineHeight: n,
71
- children: p,
72
- className: f,
73
- style: c,
74
- testId: u,
75
- ...S
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 k = d || C[a], l = e && !i[e];
78
- return /* @__PURE__ */ A(
79
- k,
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: T(
116
+ className: L(
82
117
  "Bear-Typography",
83
- `Bear-Typography--${a}`,
84
- E[a],
85
- o && B[o],
86
- b && _[b],
87
- !l && e && i[e],
88
- n && I[n],
89
- s && "Bear-Typography--italic bear-italic",
90
- x && "Bear-Typography--underline bear-underline",
91
- h && "Bear-Typography--strikethrough bear-line-through",
92
- g && "bear-whitespace-nowrap",
93
- m && "bear-inline",
94
- y && "bear-mb-4",
95
- t && !r && "Bear-Typography--truncate bear-truncate",
96
- t && r && "bear-overflow-hidden",
97
- f
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
- ...c,
101
- ...l && { color: e },
102
- ...t && r && {
135
+ ...E,
136
+ ...A,
137
+ ...m && { color: o },
138
+ ...l && b && {
103
139
  display: "-webkit-box",
104
- WebkitLineClamp: r,
140
+ WebkitLineClamp: b,
105
141
  WebkitBoxOrient: "vertical"
106
142
  }
107
143
  },
108
- "data-testid": u,
109
- ...S,
110
- children: p
144
+ "data-testid": C,
145
+ ...I,
146
+ children: T
111
147
  }
112
148
  );
113
149
  };
114
150
  export {
115
- N as Typography
151
+ P as Typography
116
152
  };
@@ -1,8 +1,35 @@
1
1
  import { HTMLAttributes, ReactNode, ElementType } from 'react';
2
- export type TypographyVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subtitle1' | 'subtitle2' | 'body1' | 'body2' | 'caption' | 'overline' | 'code';
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;