@forgedevstack/bear 1.1.4 → 1.1.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 (146) hide show
  1. package/README.md +19 -0
  2. package/dist/components/Anchor/Anchor.cjs +1 -1
  3. package/dist/components/Anchor/Anchor.js +37 -45
  4. package/dist/components/Anchor/Anchor.utils.cjs +1 -0
  5. package/dist/components/Anchor/Anchor.utils.d.ts +2 -0
  6. package/dist/components/Anchor/Anchor.utils.js +12 -0
  7. package/dist/components/Autocomplete/Autocomplete.cjs +1 -1
  8. package/dist/components/Autocomplete/Autocomplete.js +60 -67
  9. package/dist/components/Autocomplete/Autocomplete.utils.cjs +1 -0
  10. package/dist/components/Autocomplete/Autocomplete.utils.d.ts +2 -0
  11. package/dist/components/Autocomplete/Autocomplete.utils.js +12 -0
  12. package/dist/components/BackTop/BackTop.cjs +1 -1
  13. package/dist/components/BackTop/BackTop.js +10 -11
  14. package/dist/components/Button/Button.cjs +1 -1
  15. package/dist/components/Button/Button.constants.cjs +2 -2
  16. package/dist/components/Button/Button.constants.d.ts +1 -0
  17. package/dist/components/Button/Button.constants.js +12 -5
  18. package/dist/components/Button/Button.d.ts +0 -27
  19. package/dist/components/Button/Button.js +93 -105
  20. package/dist/components/Button/Button.types.d.ts +1 -0
  21. package/dist/components/Button/Button.utils.cjs +1 -0
  22. package/dist/components/Button/Button.utils.d.ts +2 -0
  23. package/dist/components/Button/Button.utils.js +5 -0
  24. package/dist/components/Button/useSpotlight.cjs +1 -0
  25. package/dist/components/Button/useSpotlight.d.ts +21 -0
  26. package/dist/components/Button/useSpotlight.js +28 -0
  27. package/dist/components/Chart/Chart.cjs +1 -1
  28. package/dist/components/Chart/Chart.const.cjs +1 -0
  29. package/dist/components/Chart/Chart.const.js +21 -0
  30. package/dist/components/Chart/Chart.js +55 -71
  31. package/dist/components/Chart/Chart.utils.cjs +1 -0
  32. package/dist/components/Chart/Chart.utils.js +5 -0
  33. package/dist/components/Confetti/Confetti.cjs +1 -1
  34. package/dist/components/Confetti/Confetti.js +37 -34
  35. package/dist/components/ContextMenu/ContextMenu.cjs +1 -1
  36. package/dist/components/ContextMenu/ContextMenu.js +31 -30
  37. package/dist/components/ContextMenu/ContextMenu.utils.cjs +1 -0
  38. package/dist/components/ContextMenu/ContextMenu.utils.d.ts +5 -0
  39. package/dist/components/ContextMenu/ContextMenu.utils.js +4 -0
  40. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -1
  41. package/dist/components/CountdownTimer/CountdownTimer.js +62 -71
  42. package/dist/components/CountdownTimer/CountdownTimer.utils.cjs +1 -0
  43. package/dist/components/CountdownTimer/CountdownTimer.utils.d.ts +3 -0
  44. package/dist/components/CountdownTimer/CountdownTimer.utils.js +16 -0
  45. package/dist/components/Dock/Dock.cjs +1 -1
  46. package/dist/components/Dock/Dock.js +38 -43
  47. package/dist/components/Dock/Dock.utils.cjs +1 -0
  48. package/dist/components/Dock/Dock.utils.d.ts +1 -0
  49. package/dist/components/Dock/Dock.utils.js +10 -0
  50. package/dist/components/Dropdown/Dropdown.cjs +1 -1
  51. package/dist/components/Dropdown/Dropdown.js +59 -60
  52. package/dist/components/FileTree/FileTree.cjs +1 -1
  53. package/dist/components/FileTree/FileTree.js +20 -32
  54. package/dist/components/FileTree/FileTree.utils.cjs +1 -0
  55. package/dist/components/FileTree/FileTree.utils.d.ts +4 -0
  56. package/dist/components/FileTree/FileTree.utils.js +15 -0
  57. package/dist/components/GradientText/GradientText.cjs +1 -1
  58. package/dist/components/GradientText/GradientText.js +27 -29
  59. package/dist/components/Icon/icons/bear.cjs +1 -0
  60. package/dist/components/Icon/icons/bear.d.ts +12 -0
  61. package/dist/components/Icon/icons/bear.js +47 -0
  62. package/dist/components/Icon/index.cjs +1 -1
  63. package/dist/components/Icon/index.d.ts +18 -0
  64. package/dist/components/Icon/index.js +17 -15
  65. package/dist/components/InfiniteScroll/InfiniteScroll.cjs +1 -1
  66. package/dist/components/InfiniteScroll/InfiniteScroll.const.cjs +1 -1
  67. package/dist/components/InfiniteScroll/InfiniteScroll.const.js +6 -7
  68. package/dist/components/InfiniteScroll/InfiniteScroll.js +41 -41
  69. package/dist/components/MentionsInput/MentionsInput.cjs +1 -1
  70. package/dist/components/MentionsInput/MentionsInput.js +64 -68
  71. package/dist/components/MentionsInput/MentionsInput.utils.cjs +1 -0
  72. package/dist/components/MentionsInput/MentionsInput.utils.d.ts +2 -0
  73. package/dist/components/MentionsInput/MentionsInput.utils.js +9 -0
  74. package/dist/components/PageNav/PageNav.cjs +1 -0
  75. package/dist/components/PageNav/PageNav.const.cjs +1 -0
  76. package/dist/components/PageNav/PageNav.const.d.ts +22 -0
  77. package/dist/components/PageNav/PageNav.const.js +42 -0
  78. package/dist/components/PageNav/PageNav.d.ts +3 -0
  79. package/dist/components/PageNav/PageNav.js +81 -0
  80. package/dist/components/PageNav/PageNav.types.d.ts +17 -0
  81. package/dist/components/PageNav/index.d.ts +2 -0
  82. package/dist/components/Progress/Progress.cjs +1 -1
  83. package/dist/components/Progress/Progress.js +6 -6
  84. package/dist/components/PropsPlayground/PropsPlayground.cjs +1 -0
  85. package/dist/components/PropsPlayground/PropsPlayground.const.cjs +1 -0
  86. package/dist/components/PropsPlayground/PropsPlayground.const.d.ts +11 -0
  87. package/dist/components/PropsPlayground/PropsPlayground.const.js +23 -0
  88. package/dist/components/PropsPlayground/PropsPlayground.d.ts +3 -0
  89. package/dist/components/PropsPlayground/PropsPlayground.js +221 -0
  90. package/dist/components/PropsPlayground/PropsPlayground.types.d.ts +29 -0
  91. package/dist/components/PropsPlayground/PropsPlayground.utils.cjs +1 -0
  92. package/dist/components/PropsPlayground/PropsPlayground.utils.d.ts +2 -0
  93. package/dist/components/PropsPlayground/PropsPlayground.utils.js +9 -0
  94. package/dist/components/PropsPlayground/index.d.ts +2 -0
  95. package/dist/components/Select/Select.cjs +1 -1
  96. package/dist/components/Select/Select.js +28 -30
  97. package/dist/components/SignPad/SignPad.cjs +1 -1
  98. package/dist/components/SignPad/SignPad.js +24 -24
  99. package/dist/components/Skeleton/Skeleton.cjs +1 -1
  100. package/dist/components/Skeleton/Skeleton.js +89 -94
  101. package/dist/components/Skeleton/Skeleton.utils.cjs +1 -0
  102. package/dist/components/Skeleton/Skeleton.utils.d.ts +1 -0
  103. package/dist/components/Skeleton/Skeleton.utils.js +10 -0
  104. package/dist/components/SliderRange/SliderRange.cjs +1 -1
  105. package/dist/components/SliderRange/SliderRange.js +61 -63
  106. package/dist/components/SliderRange/SliderRange.utils.cjs +1 -0
  107. package/dist/components/SliderRange/SliderRange.utils.d.ts +1 -0
  108. package/dist/components/SliderRange/SliderRange.utils.js +7 -0
  109. package/dist/components/Spotlight/Spotlight.cjs +1 -1
  110. package/dist/components/Spotlight/Spotlight.js +62 -73
  111. package/dist/components/Spotlight/Spotlight.utils.cjs +1 -0
  112. package/dist/components/Spotlight/Spotlight.utils.d.ts +3 -0
  113. package/dist/components/Spotlight/Spotlight.utils.js +18 -0
  114. package/dist/components/Tabs/Tabs.cjs +1 -1
  115. package/dist/components/Tabs/Tabs.js +39 -38
  116. package/dist/components/Tabs/Tabs.types.d.ts +3 -1
  117. package/dist/components/Toast/Toast.cjs +1 -1
  118. package/dist/components/Toast/Toast.js +18 -17
  119. package/dist/components/Toast/Toast.utils.cjs +1 -0
  120. package/dist/components/Toast/Toast.utils.d.ts +1 -0
  121. package/dist/components/Toast/Toast.utils.js +4 -0
  122. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  123. package/dist/components/Tooltip/Tooltip.js +10 -11
  124. package/dist/components/Tour/Tour.cjs +1 -1
  125. package/dist/components/Tour/Tour.js +1 -2
  126. package/dist/components/VirtualList/VirtualList.cjs +1 -1
  127. package/dist/components/VirtualList/VirtualList.js +38 -43
  128. package/dist/components/index.cjs +1 -1
  129. package/dist/components/index.d.ts +4 -0
  130. package/dist/components/index.js +66 -62
  131. package/dist/hooks/index.cjs +1 -1
  132. package/dist/hooks/index.d.ts +2 -0
  133. package/dist/hooks/index.js +60 -58
  134. package/dist/hooks/useResizeObserver/index.d.ts +2 -0
  135. package/dist/hooks/useResizeObserver/useResizeObserver.cjs +1 -0
  136. package/dist/hooks/useResizeObserver/useResizeObserver.d.ts +3 -0
  137. package/dist/hooks/useResizeObserver/useResizeObserver.js +20 -0
  138. package/dist/hooks/useResizeObserver/useResizeObserver.types.d.ts +8 -0
  139. package/dist/icons.cjs +1 -0
  140. package/dist/icons.d.ts +2 -0
  141. package/dist/icons.js +6 -0
  142. package/dist/index.cjs +1 -1
  143. package/dist/index.js +175 -169
  144. package/dist/styles/_base.css +7 -3
  145. package/dist/styles.css +1 -1
  146. package/package.json +6 -1
@@ -1,29 +1,2 @@
1
1
  import { ButtonProps } from './Button.types';
2
- /**
3
- * Button component with multiple variants, sizes, states, and effects.
4
- *
5
- * Features:
6
- * - Fully themeable via BearProvider
7
- * - Mouse-follow spotlight hover effect
8
- * - CSS variable-based colors for easy customization
9
- * - Component overrides via useBearComponent
10
- *
11
- * @example
12
- * ```tsx
13
- * // Basic usage
14
- * <Button variant="primary" size="md">
15
- * Click me
16
- * </Button>
17
- *
18
- * // With spotlight hover effect
19
- * <Button variant="primary" spotlight>
20
- * Hover me
21
- * </Button>
22
- *
23
- * // With icons
24
- * <Button variant="outline" leftIcon={<Icon />}>
25
- * With Icon
26
- * </Button>
27
- * ```
28
- */
29
2
  export declare const Button: import('react').ForwardRefExoticComponent<ButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -1,136 +1,124 @@
1
- import { jsxs as C, jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as se, useContext as le, useRef as ce, useState as A, useCallback as B, useMemo as be } from "react";
3
- import { cn as u } from "../../utils/cn.js";
4
- import { Spinner as ue } from "../Spinner/Spinner.js";
5
- import { Typography as E } from "../Typography/Typography.js";
6
- import { useBearStyles as de } from "../../hooks/useBearStyles.js";
1
+ import { jsxs as h, jsx as o } from "react/jsx-runtime";
2
+ import { forwardRef as Q, useContext as X, useMemo as ee, useCallback as re } from "react";
3
+ import { cn as n } from "../../utils/cn.js";
4
+ import { Spinner as te } from "../Spinner/Spinner.js";
5
+ import { Typography as S } from "../Typography/Typography.js";
6
+ import { useBearStyles as ae } from "../../hooks/useBearStyles.js";
7
7
  import "../../hooks/useBearComponent/useBearComponent.js";
8
- import { BearContext as fe } from "../../context/BearProvider.js";
9
- import { VARIANT_DEFAULTS as P, BUTTON_ICON_SIZE as O, BUTTON_VARIANT as j, BUTTON_SIZE as me } from "./Button.constants.js";
10
- const U = (y) => y in j, ge = se(
11
- (y, i) => {
12
- var z, M;
8
+ import { BearContext as oe } from "../../context/BearProvider.js";
9
+ import { VARIANT_DEFAULTS as w, BUTTON_ICON_SIZE as O, BUTTON_VARIANT as ne, BUTTON_ICON_ONLY_SIZE as ie, BUTTON_SIZE as se } from "./Button.constants.js";
10
+ import { isBuiltInVariant as V } from "./Button.utils.js";
11
+ import { useSpotlight as le } from "./useSpotlight.js";
12
+ const be = Q(
13
+ (E, i) => {
14
+ var T, $;
13
15
  const {
14
16
  variant: e = "primary",
15
- size: d = "md",
16
- loading: s = !1,
17
- loadingText: v,
18
- fullWidth: D = !1,
19
- icon: f,
20
- iconPosition: $ = "left",
21
- leftIcon: H,
22
- rightIcon: L,
23
- textVariant: S = "inherit",
24
- spotlight: l = !1,
25
- spotlightColor: X = "rgba(255, 255, 255, 0.35)",
26
- spotlightSize: m = 150,
27
- disabled: Y,
28
- className: Z,
29
- children: F,
30
- testId: W,
31
- bis: q,
32
- style: G,
33
- onMouseMove: g,
34
- onMouseEnter: p,
35
- onMouseLeave: h,
36
- ...J
37
- } = y, K = Y || s, x = de(q, G), T = H ?? (f && $ === "left" ? f : void 0), R = L ?? (f && $ === "right" ? f : void 0), n = le(fe), _ = ((M = (z = n == null ? void 0 : n.components) == null ? void 0 : z.Button) == null ? void 0 : M.root) || {}, w = (n == null ? void 0 : n.customVariants) || {}, N = !U(e) && e in w, r = N ? w[e] : null, c = ce(null), [V, I] = A({ x: -1e3, y: -1e3 }), [Q, k] = A(!1), ee = B((t) => {
38
- if (l && c.current) {
39
- const b = c.current.getBoundingClientRect(), ae = t.clientX - b.left, ie = t.clientY - b.top;
40
- I({ x: ae, y: ie });
41
- }
42
- g == null || g(t);
43
- }, [l, g]), te = B((t) => {
44
- if (l && (k(!0), c.current)) {
45
- const b = c.current.getBoundingClientRect();
46
- I({
47
- x: t.clientX - b.left,
48
- y: t.clientY - b.top
49
- });
50
- }
51
- p == null || p(t);
52
- }, [l, p]), re = B((t) => {
53
- k(!1), I({ x: -1e3, y: -1e3 }), h == null || h(t);
54
- }, [h]), o = P[e] || P.primary, ne = be(() => N && r ? {
17
+ size: s = "md",
18
+ loading: l = !1,
19
+ loadingText: d,
20
+ fullWidth: k = !1,
21
+ icon: b,
22
+ iconPosition: B = "left",
23
+ leftIcon: z,
24
+ rightIcon: A,
25
+ textVariant: v = "inherit",
26
+ iconOnly: _ = !1,
27
+ spotlight: y = !1,
28
+ spotlightColor: L = "rgba(255, 255, 255, 0.35)",
29
+ spotlightSize: c = 150,
30
+ disabled: R,
31
+ className: U,
32
+ children: j,
33
+ testId: P,
34
+ bis: Z,
35
+ style: D,
36
+ onMouseMove: F,
37
+ onMouseEnter: H,
38
+ onMouseLeave: W,
39
+ ...Y
40
+ } = E, q = R || l, m = ae(Z, D), x = z ?? (b && B === "left" ? b : void 0), N = A ?? (b && B === "right" ? b : void 0), t = X(oe), f = (($ = (T = t == null ? void 0 : t.components) == null ? void 0 : T.Button) == null ? void 0 : $.root) || {}, I = (t == null ? void 0 : t.customVariants) || {}, p = !V(e) && e in I, r = p ? I[e] : null, { spotlightRef: M, position: C, isHovered: G, handlers: g } = le({
41
+ enabled: y,
42
+ onMouseMove: F,
43
+ onMouseEnter: H,
44
+ onMouseLeave: W
45
+ }), a = w[e] || w.primary, J = ee(() => p && r ? {
55
46
  backgroundColor: `var(--bear-${e}-bg, ${r.bg})`,
56
47
  color: r.text || "#ffffff",
57
48
  borderColor: r.border,
58
49
  "--bear-ring-color": r.ring || r.bg,
59
- ..._,
60
- ...x
50
+ ...f,
51
+ ...m
61
52
  } : {
62
- backgroundColor: `var(--bear-btn-${e}-bg, ${o.bg})`,
63
- color: e === "outline" || e === "ghost" ? `var(--bear-btn-${e}-text, ${o.text || "inherit"})` : "white",
64
- borderColor: e === "outline" ? `var(--bear-btn-${e}-border, ${o.border || o.bg})` : void 0,
65
- "--bear-ring-color": `var(--bear-btn-${e}-ring, ${o.ring})`,
66
- ..._,
67
- ...x
68
- }, [e, o, _, x, N, r]), oe = B((t) => {
69
- c.current = t, typeof i == "function" ? i(t) : i && (i.current = t);
70
- }, [i]);
71
- return /* @__PURE__ */ C(
53
+ backgroundColor: `var(--bear-btn-${e}-bg, ${a.bg})`,
54
+ color: e === "outline" || e === "ghost" ? `var(--bear-btn-${e}-text, ${a.text || "inherit"})` : "white",
55
+ borderColor: e === "outline" ? `var(--bear-btn-${e}-border, ${a.border || a.bg})` : void 0,
56
+ "--bear-ring-color": `var(--bear-btn-${e}-ring, ${a.ring})`,
57
+ ...f,
58
+ ...m
59
+ }, [e, a, f, m, p, r]), K = re((u) => {
60
+ M.current = u, typeof i == "function" ? i(u) : i && (i.current = u);
61
+ }, [i, M]);
62
+ return /* @__PURE__ */ h(
72
63
  "button",
73
64
  {
74
- ref: oe,
75
- disabled: K,
76
- "aria-busy": s || void 0,
77
- style: ne,
78
- className: u(
65
+ ref: K,
66
+ disabled: q,
67
+ "aria-busy": l || void 0,
68
+ style: J,
69
+ className: n(
79
70
  "Bear-Button",
80
71
  "bear-inline-flex bear-items-center bear-justify-center bear-font-medium bear-rounded-lg bear-transition-all bear-duration-200 bear-outline-none bear-relative bear-overflow-hidden",
81
- me[d],
82
- // Use built-in variant classes or custom variant base classes
83
- U(e) ? j[e] : "bear-btn-custom bear-text-white focus:bear-ring-2 focus:bear-ring-offset-2 disabled:bear-opacity-50 disabled:bear-cursor-not-allowed hover:bear-brightness-110 active:bear-brightness-95",
84
- D && "bear-w-full",
85
- s && "bear-cursor-wait",
86
- Z
72
+ _ ? ie[s] : se[s],
73
+ _ && "bear-rounded-lg",
74
+ V(e) ? ne[e] : "bear-btn-custom bear-text-white focus:bear-ring-2 focus:bear-ring-offset-2 disabled:bear-opacity-50 disabled:bear-cursor-not-allowed hover:bear-brightness-110 active:bear-brightness-95",
75
+ k && "bear-w-full",
76
+ l && "bear-cursor-wait",
77
+ U
87
78
  ),
88
- "data-testid": W,
89
- onMouseMove: ee,
90
- onMouseEnter: te,
91
- onMouseLeave: re,
92
- ...J,
79
+ "data-testid": P,
80
+ onMouseMove: g.handleMouseMove,
81
+ onMouseEnter: g.handleMouseEnter,
82
+ onMouseLeave: g.handleMouseLeave,
83
+ ...Y,
93
84
  children: [
94
- l && /* @__PURE__ */ a(
85
+ y && /* @__PURE__ */ o(
95
86
  "span",
96
87
  {
97
- className: "Bear-Button__spotlight",
88
+ className: n(
89
+ "Bear-Button__spotlight",
90
+ "bear-absolute bear-left-0 bear-top-0 bear-rounded-full bear-pointer-events-none bear-z-[1]",
91
+ "bear-transition-opacity bear-duration-150 bear-ease-out",
92
+ G ? "bear-opacity-100" : "bear-opacity-0"
93
+ ),
98
94
  "aria-hidden": "true",
99
95
  style: {
100
- position: "absolute",
101
- pointerEvents: "none",
102
- left: 0,
103
- top: 0,
104
- width: m,
105
- height: m,
106
- borderRadius: "50%",
107
- background: `radial-gradient(circle at center, ${X} 0%, transparent 70%)`,
108
- opacity: Q ? 1 : 0,
109
- transform: `translate(${V.x - m / 2}px, ${V.y - m / 2}px)`,
110
- transition: "opacity 0.15s ease-out",
111
- zIndex: 1,
96
+ width: c,
97
+ height: c,
98
+ background: `radial-gradient(circle at center, ${L} 0%, transparent 70%)`,
99
+ transform: `translate(${C.x - c / 2}px, ${C.y - c / 2}px)`,
112
100
  mixBlendMode: "overlay"
113
101
  }
114
102
  }
115
103
  ),
116
- s && /* @__PURE__ */ C("span", { className: u(
104
+ l && /* @__PURE__ */ h("span", { className: n(
117
105
  "Bear-Button__loading bear-inline-flex bear-items-center bear-gap-2 bear-relative bear-z-10",
118
- !v && "bear-absolute"
106
+ !d && "bear-absolute"
119
107
  ), children: [
120
- /* @__PURE__ */ a(ue, { size: d === "xs" ? "xs" : "sm", className: "Bear-Button__spinner" }),
121
- v && /* @__PURE__ */ a(E, { variant: S, className: "Bear-Button__text", children: v })
108
+ /* @__PURE__ */ o(te, { size: s === "xs" ? "xs" : "sm", className: "Bear-Button__spinner" }),
109
+ d && /* @__PURE__ */ o(S, { variant: v, className: "Bear-Button__text", children: d })
122
110
  ] }),
123
- /* @__PURE__ */ C(
111
+ /* @__PURE__ */ h(
124
112
  "span",
125
113
  {
126
- className: u(
114
+ className: n(
127
115
  "Bear-Button__content bear-inline-flex bear-items-center bear-gap-inherit bear-relative bear-z-10",
128
- s && "bear-invisible"
116
+ l && "bear-invisible"
129
117
  ),
130
118
  children: [
131
- T && /* @__PURE__ */ a("span", { className: u("Bear-Button__icon Bear-Button__icon--left bear-inline-flex bear-shrink-0", O[d]), children: T }),
132
- /* @__PURE__ */ a(E, { variant: S, className: "Bear-Button__text", children: F }),
133
- R && /* @__PURE__ */ a("span", { className: u("Bear-Button__icon Bear-Button__icon--right bear-inline-flex bear-shrink-0", O[d]), children: R })
119
+ x && /* @__PURE__ */ o("span", { className: n("Bear-Button__icon Bear-Button__icon--left bear-inline-flex bear-shrink-0", O[s]), children: x }),
120
+ /* @__PURE__ */ o(S, { variant: v, className: "Bear-Button__text", children: j }),
121
+ N && /* @__PURE__ */ o("span", { className: n("Bear-Button__icon Bear-Button__icon--right bear-inline-flex bear-shrink-0", O[s]), children: N })
134
122
  ]
135
123
  }
136
124
  )
@@ -139,7 +127,7 @@ const U = (y) => y in j, ge = se(
139
127
  );
140
128
  }
141
129
  );
142
- ge.displayName = "Button";
130
+ be.displayName = "Button";
143
131
  export {
144
- ge as Button
132
+ be as Button
145
133
  };
@@ -45,6 +45,7 @@ export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement
45
45
  spotlightColor?: string;
46
46
  /** Spotlight size in pixels (default: 120) */
47
47
  spotlightSize?: number;
48
+ iconOnly?: boolean;
48
49
  /** Test ID for testing */
49
50
  testId?: string;
50
51
  /** Bear Inner Style - sx-like overrides */
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./Button.constants.cjs"),i=t=>t in n.BUTTON_VARIANT;exports.isBuiltInVariant=i;
@@ -0,0 +1,2 @@
1
+ import { BearVariant } from '../../types';
2
+ export declare const isBuiltInVariant: (variant: string) => variant is BearVariant;
@@ -0,0 +1,5 @@
1
+ import { BUTTON_VARIANT as t } from "./Button.constants.js";
2
+ const n = (r) => r in t;
3
+ export {
4
+ n as isBuiltInVariant
5
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),f=-1e3;function y({enabled:r,onMouseMove:s,onMouseEnter:e,onMouseLeave:n}){const l=c.useRef(null),[g,a]=c.useState({x:f,y:f}),[d,u]=c.useState(!1),h=c.useCallback(t=>{if(r&&l.current){const i=l.current.getBoundingClientRect();a({x:t.clientX-i.left,y:t.clientY-i.top})}s==null||s(t)},[r,s]),p=c.useCallback(t=>{if(r&&(u(!0),l.current)){const i=l.current.getBoundingClientRect();a({x:t.clientX-i.left,y:t.clientY-i.top})}e==null||e(t)},[r,e]),S=c.useCallback(t=>{u(!1),a({x:f,y:f}),n==null||n(t)},[n]);return{spotlightRef:l,position:g,isHovered:d,handlers:{handleMouseMove:h,handleMouseEnter:p,handleMouseLeave:S}}}exports.useSpotlight=y;
@@ -0,0 +1,21 @@
1
+ interface SpotlightPosition {
2
+ x: number;
3
+ y: number;
4
+ }
5
+ interface UseSpotlightOptions {
6
+ enabled: boolean;
7
+ onMouseMove?: React.MouseEventHandler<HTMLButtonElement>;
8
+ onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;
9
+ onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;
10
+ }
11
+ export declare function useSpotlight({ enabled, onMouseMove, onMouseEnter, onMouseLeave }: UseSpotlightOptions): {
12
+ spotlightRef: import('react').MutableRefObject<HTMLButtonElement | null>;
13
+ position: SpotlightPosition;
14
+ isHovered: boolean;
15
+ handlers: {
16
+ handleMouseMove: (e: React.MouseEvent<HTMLButtonElement>) => void;
17
+ handleMouseEnter: (e: React.MouseEvent<HTMLButtonElement>) => void;
18
+ handleMouseLeave: (e: React.MouseEvent<HTMLButtonElement>) => void;
19
+ };
20
+ };
21
+ export {};
@@ -0,0 +1,28 @@
1
+ import { useRef as S, useState as d, useCallback as g } from "react";
2
+ const s = -1e3;
3
+ function m({ enabled: l, onMouseMove: r, onMouseEnter: f, onMouseLeave: n }) {
4
+ const c = S(null), [x, p] = d({ x: s, y: s }), [R, h] = d(!1), y = g((t) => {
5
+ if (l && c.current) {
6
+ const i = c.current.getBoundingClientRect();
7
+ p({ x: t.clientX - i.left, y: t.clientY - i.top });
8
+ }
9
+ r == null || r(t);
10
+ }, [l, r]), C = g((t) => {
11
+ if (l && (h(!0), c.current)) {
12
+ const i = c.current.getBoundingClientRect();
13
+ p({ x: t.clientX - i.left, y: t.clientY - i.top });
14
+ }
15
+ f == null || f(t);
16
+ }, [l, f]), e = g((t) => {
17
+ h(!1), p({ x: s, y: s }), n == null || n(t);
18
+ }, [n]);
19
+ return {
20
+ spotlightRef: c,
21
+ position: x,
22
+ isHovered: R,
23
+ handlers: { handleMouseMove: y, handleMouseEnter: C, handleMouseLeave: e }
24
+ };
25
+ }
26
+ export {
27
+ m as useSpotlight
28
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),b=require("react"),d=require("../../utils/cn.cjs"),R=["#ec4899","#8b5cf6","#3b82f6","#10b981","#f59e0b","#ef4444","#06b6d4","#84cc16"],w=(r,x)=>x||R[r%R.length],M=({data:r,height:x=200,showLabels:y=!0,showValues:m=!1,animated:h=!0,color:f,orientation:p="vertical",barRadius:o=4,barGap:$=.2,className:j,...v})=>{const n=Math.max(...r.map(l=>l.value));return e.jsx("div",{className:d.cn("w-full",j),style:{height:x},...v,children:p==="vertical"?e.jsx("div",{className:"flex items-end justify-between h-full gap-2",children:r.map((l,a)=>{const s=l.value/n*100,t=w(a,l.color||f);return e.jsxs("div",{className:"flex-1 flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-full flex-1 flex items-end",children:e.jsx("div",{className:d.cn("w-full transition-all duration-500 ease-out",h&&"animate-grow-up"),style:{height:`${s}%`,backgroundColor:t,borderRadius:`${o}px ${o}px 0 0`,opacity:.9}})}),m&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:l.value}),y&&e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300 truncate max-w-full",children:l.label})]},a)})}):e.jsx("div",{className:"flex flex-col justify-between h-full gap-2",children:r.map((l,a)=>{const s=l.value/n*100,t=w(a,l.color||f);return e.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[y&&e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300 w-16 truncate",children:l.label}),e.jsx("div",{className:"flex-1 h-full flex items-center",children:e.jsx("div",{className:d.cn("h-3/4 transition-all duration-500 ease-out",h&&"animate-grow-right"),style:{width:`${s}%`,backgroundColor:t,borderRadius:`0 ${o}px ${o}px 0`,opacity:.9}})}),m&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400 w-10 text-right",children:l.value})]},a)})})})},L=({data:r,height:x=200,showLabels:y=!0,showDots:m=!0,smooth:h=!0,fill:f=!1,strokeWidth:p=2,color:o="#ec4899",animated:$=!0,className:j,...v})=>{const n=b.useMemo(()=>{const s=Math.max(...r.map(c=>c.value)),t=Math.min(...r.map(c=>c.value)),i=s-t||1;return r.map((c,u)=>({x:u/(r.length-1||1)*100,y:100-(c.value-t)/i*80-10,...c}))},[r]),l=b.useMemo(()=>n.length===0?"":h?n.reduce((s,t,i,c)=>{if(i===0)return`M ${t.x},${t.y}`;const u=c[i-1],g=u.x+(t.x-u.x)/3,N=t.x-(t.x-u.x)/3;return`${s} C ${g},${u.y} ${N},${t.y} ${t.x},${t.y}`},""):n.reduce((s,t,i)=>`${s} ${i===0?"M":"L"} ${t.x},${t.y}`,""),[n,h]),a=b.useMemo(()=>n.length===0?"":`${l} L 100,100 L 0,100 Z`,[l,n]);return e.jsxs("div",{className:d.cn("w-full",j),style:{height:x},...v,children:[e.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",className:"w-full h-full",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"line-gradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:o,stopOpacity:"0.3"}),e.jsx("stop",{offset:"100%",stopColor:o,stopOpacity:"0"})]})}),f&&e.jsx("path",{d:a,fill:"url(#line-gradient)",className:d.cn($&&"animate-fade-in")}),e.jsx("path",{d:l,fill:"none",stroke:o,strokeWidth:p/10,strokeLinecap:"round",strokeLinejoin:"round",className:d.cn($&&"animate-draw-line")}),m&&n.map((s,t)=>e.jsx("circle",{cx:s.x,cy:s.y,r:1.5,fill:o,className:d.cn($&&"animate-scale-in"),style:{animationDelay:`${t*50}ms`}},t))]}),y&&e.jsx("div",{className:"flex justify-between mt-2",children:r.map((s,t)=>e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300",children:s.label},t))})]})},k=({data:r,height:x=200,showLabels:y=!0,innerRadius:m=0,startAngle:h=-90,padAngle:f=2,animated:p=!0,className:o,...$})=>{const j=r.reduce((a,s)=>a+s.value,0),v=b.useMemo(()=>{let a=h;return r.map((s,t)=>{const i=s.value/j*360-f,c={startAngle:a,endAngle:a+i,color:w(t,s.color),...s};return a+=i+f,c})},[r,j,h,f]),n=(a,s)=>{const t=a*Math.PI/180;return{x:50+s*Math.cos(t),y:50+s*Math.sin(t)}},l=(a,s)=>{const i=m*45,c=n(a,45),u=n(s,45),g=n(a,i),N=n(s,i),C=s-a>180?1:0;return m>0?`M ${c.x},${c.y} A 45,45 0 ${C},1 ${u.x},${u.y} L ${N.x},${N.y} A ${i},${i} 0 ${C},0 ${g.x},${g.y} Z`:`M 50,50 L ${c.x},${c.y} A 45,45 0 ${C},1 ${u.x},${u.y} Z`};return e.jsxs("div",{className:d.cn("flex items-center gap-4",o),...$,children:[e.jsx("div",{style:{width:x,height:x},children:e.jsx("svg",{viewBox:"0 0 100 100",className:"w-full h-full",children:v.map((a,s)=>e.jsx("path",{d:l(a.startAngle,a.endAngle),fill:a.color,className:d.cn("transition-opacity hover:opacity-80",p&&"animate-scale-in"),style:{animationDelay:`${s*100}ms`}},s))})}),y&&e.jsx("div",{className:"flex flex-col gap-2",children:r.map((a,s)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:w(s,a.color)}}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-slate-300",children:a.label}),e.jsxs("span",{className:"text-sm text-gray-400 dark:text-slate-500",children:[Math.round(a.value/j*100),"%"]})]},s))})]})},A=({type:r,...x})=>{switch(r){case"bar":return e.jsx(M,{...x});case"line":case"area":return e.jsx(L,{...x,fill:r==="area"});case"pie":return e.jsx(k,{...x});case"donut":return e.jsx(k,{...x,innerRadius:.6});default:return e.jsx(M,{...x})}};exports.BarChart=M;exports.Chart=A;exports.LineChart=L;exports.PieChart=k;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),C=require("react"),d=require("../../utils/cn.cjs"),w=require("./Chart.utils.cjs"),M=({data:r,height:o=200,showLabels:y=!0,showValues:f=!1,animated:h=!0,color:m,orientation:p="vertical",barRadius:i=4,barGap:$=.2,className:j,...v})=>{const n=Math.max(...r.map(l=>l.value));return e.jsx("div",{className:d.cn("w-full",j),style:{height:o},...v,children:p==="vertical"?e.jsx("div",{className:"flex items-end justify-between h-full gap-2",children:r.map((l,a)=>{const t=l.value/n*100,s=w.getChartColor(a,l.color||m);return e.jsxs("div",{className:"flex-1 flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-full flex-1 flex items-end",children:e.jsx("div",{className:d.cn("w-full transition-all duration-500 ease-out",h&&"animate-grow-up"),style:{height:`${t}%`,backgroundColor:s,borderRadius:`${i}px ${i}px 0 0`,opacity:.9}})}),f&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:l.value}),y&&e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300 truncate max-w-full",children:l.label})]},a)})}):e.jsx("div",{className:"flex flex-col justify-between h-full gap-2",children:r.map((l,a)=>{const t=l.value/n*100,s=w.getChartColor(a,l.color||m);return e.jsxs("div",{className:"flex-1 flex items-center gap-2",children:[y&&e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300 w-16 truncate",children:l.label}),e.jsx("div",{className:"flex-1 h-full flex items-center",children:e.jsx("div",{className:d.cn("h-3/4 transition-all duration-500 ease-out",h&&"animate-grow-right"),style:{width:`${t}%`,backgroundColor:s,borderRadius:`0 ${i}px ${i}px 0`,opacity:.9}})}),f&&e.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400 w-10 text-right",children:l.value})]},a)})})})},R=({data:r,height:o=200,showLabels:y=!0,showDots:f=!0,smooth:h=!0,fill:m=!1,strokeWidth:p=2,color:i="#ec4899",animated:$=!0,className:j,...v})=>{const n=C.useMemo(()=>{const t=Math.max(...r.map(c=>c.value)),s=Math.min(...r.map(c=>c.value)),x=t-s||1;return r.map((c,u)=>({x:u/(r.length-1||1)*100,y:100-(c.value-s)/x*80-10,...c}))},[r]),l=C.useMemo(()=>n.length===0?"":h?n.reduce((t,s,x,c)=>{if(x===0)return`M ${s.x},${s.y}`;const u=c[x-1],g=u.x+(s.x-u.x)/3,N=s.x-(s.x-u.x)/3;return`${t} C ${g},${u.y} ${N},${s.y} ${s.x},${s.y}`},""):n.reduce((t,s,x)=>`${t} ${x===0?"M":"L"} ${s.x},${s.y}`,""),[n,h]),a=C.useMemo(()=>n.length===0?"":`${l} L 100,100 L 0,100 Z`,[l,n]);return e.jsxs("div",{className:d.cn("w-full",j),style:{height:o},...v,children:[e.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",className:"w-full h-full",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"line-gradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:i,stopOpacity:"0.3"}),e.jsx("stop",{offset:"100%",stopColor:i,stopOpacity:"0"})]})}),m&&e.jsx("path",{d:a,fill:"url(#line-gradient)",className:d.cn($&&"animate-fade-in")}),e.jsx("path",{d:l,fill:"none",stroke:i,strokeWidth:p/10,strokeLinecap:"round",strokeLinejoin:"round",className:d.cn($&&"animate-draw-line")}),f&&n.map((t,s)=>e.jsx("circle",{cx:t.x,cy:t.y,r:1.5,fill:i,className:d.cn($&&"animate-scale-in"),style:{animationDelay:`${s*50}ms`}},s))]}),y&&e.jsx("div",{className:"flex justify-between mt-2",children:r.map((t,s)=>e.jsx("span",{className:"text-xs text-gray-600 dark:text-slate-300",children:t.label},s))})]})},k=({data:r,height:o=200,showLabels:y=!0,innerRadius:f=0,startAngle:h=-90,padAngle:m=2,animated:p=!0,className:i,...$})=>{const j=r.reduce((a,t)=>a+t.value,0),v=C.useMemo(()=>{let a=h;return r.map((t,s)=>{const x=t.value/j*360-m,c={startAngle:a,endAngle:a+x,color:w.getChartColor(s,t.color),...t};return a+=x+m,c})},[r,j,h,m]),n=(a,t)=>{const s=a*Math.PI/180;return{x:50+t*Math.cos(s),y:50+t*Math.sin(s)}},l=(a,t)=>{const x=f*45,c=n(a,45),u=n(t,45),g=n(a,x),N=n(t,x),b=t-a>180?1:0;return f>0?`M ${c.x},${c.y} A 45,45 0 ${b},1 ${u.x},${u.y} L ${N.x},${N.y} A ${x},${x} 0 ${b},0 ${g.x},${g.y} Z`:`M 50,50 L ${c.x},${c.y} A 45,45 0 ${b},1 ${u.x},${u.y} Z`};return e.jsxs("div",{className:d.cn("flex items-center gap-4",i),...$,children:[e.jsx("div",{style:{width:o,height:o},children:e.jsx("svg",{viewBox:"0 0 100 100",className:"w-full h-full",children:v.map((a,t)=>e.jsx("path",{d:l(a.startAngle,a.endAngle),fill:a.color,className:d.cn("transition-opacity hover:opacity-80",p&&"animate-scale-in"),style:{animationDelay:`${t*100}ms`}},t))})}),y&&e.jsx("div",{className:"flex flex-col gap-2",children:r.map((a,t)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:w.getChartColor(t,a.color)}}),e.jsx("span",{className:"text-sm text-gray-600 dark:text-slate-300",children:a.label}),e.jsxs("span",{className:"text-sm text-gray-400 dark:text-slate-500",children:[Math.round(a.value/j*100),"%"]})]},t))})]})},L=({type:r,...o})=>{switch(r){case"bar":return e.jsx(M,{...o});case"line":case"area":return e.jsx(R,{...o,fill:r==="area"});case"pie":return e.jsx(k,{...o});case"donut":return e.jsx(k,{...o,innerRadius:.6});default:return e.jsx(M,{...o})}};exports.BarChart=M;exports.Chart=L;exports.LineChart=R;exports.PieChart=k;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=["#ec4899","#8b5cf6","#3b82f6","#10b981","#f59e0b","#ef4444","#06b6d4","#84cc16"];exports.DEFAULT_COLORS=e;
@@ -0,0 +1,21 @@
1
+ const b = [
2
+ "#ec4899",
3
+ // pink
4
+ "#8b5cf6",
5
+ // purple
6
+ "#3b82f6",
7
+ // blue
8
+ "#10b981",
9
+ // emerald
10
+ "#f59e0b",
11
+ // amber
12
+ "#ef4444",
13
+ // red
14
+ "#06b6d4",
15
+ // cyan
16
+ "#84cc16"
17
+ // lime
18
+ ];
19
+ export {
20
+ b as DEFAULT_COLORS
21
+ };