@forgedevstack/bear 1.2.1 → 1.2.2

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 (107) hide show
  1. package/README.md +0 -4
  2. package/dist/components/AnimatedCounter/AnimatedCounter.cjs +1 -0
  3. package/dist/components/AnimatedCounter/AnimatedCounter.const.cjs +1 -0
  4. package/dist/components/AnimatedCounter/AnimatedCounter.const.d.ts +5 -0
  5. package/dist/components/AnimatedCounter/AnimatedCounter.const.js +7 -0
  6. package/dist/components/AnimatedCounter/AnimatedCounter.d.ts +3 -0
  7. package/dist/components/AnimatedCounter/AnimatedCounter.js +59 -0
  8. package/dist/components/AnimatedCounter/AnimatedCounter.types.d.ts +26 -0
  9. package/dist/components/AnimatedCounter/AnimatedCounter.utils.cjs +1 -0
  10. package/dist/components/AnimatedCounter/AnimatedCounter.utils.d.ts +6 -0
  11. package/dist/components/AnimatedCounter/AnimatedCounter.utils.js +13 -0
  12. package/dist/components/AnimatedCounter/index.d.ts +2 -0
  13. package/dist/components/CurrencyInput/CurrencyInput.cjs +1 -0
  14. package/dist/components/CurrencyInput/CurrencyInput.const.cjs +1 -0
  15. package/dist/components/CurrencyInput/CurrencyInput.const.d.ts +4 -0
  16. package/dist/components/CurrencyInput/CurrencyInput.const.js +19 -0
  17. package/dist/components/CurrencyInput/CurrencyInput.d.ts +3 -0
  18. package/dist/components/CurrencyInput/CurrencyInput.js +60 -0
  19. package/dist/components/CurrencyInput/CurrencyInput.types.d.ts +22 -0
  20. package/dist/components/CurrencyInput/CurrencyInput.utils.cjs +1 -0
  21. package/dist/components/CurrencyInput/CurrencyInput.utils.d.ts +2 -0
  22. package/dist/components/CurrencyInput/CurrencyInput.utils.js +14 -0
  23. package/dist/components/CurrencyInput/index.d.ts +2 -0
  24. package/dist/components/DiffViewer/DiffViewer.cjs +1 -1
  25. package/dist/components/DiffViewer/DiffViewer.const.cjs +1 -1
  26. package/dist/components/DiffViewer/DiffViewer.const.d.ts +6 -0
  27. package/dist/components/DiffViewer/DiffViewer.const.js +17 -4
  28. package/dist/components/DiffViewer/DiffViewer.d.ts +0 -14
  29. package/dist/components/DiffViewer/DiffViewer.js +97 -105
  30. package/dist/components/DiffViewer/DiffViewer.types.d.ts +5 -0
  31. package/dist/components/DiffViewer/index.d.ts +1 -1
  32. package/dist/components/GlowCard/GlowCard.cjs +1 -0
  33. package/dist/components/GlowCard/GlowCard.const.cjs +1 -0
  34. package/dist/components/GlowCard/GlowCard.const.d.ts +11 -0
  35. package/dist/components/GlowCard/GlowCard.const.js +13 -0
  36. package/dist/components/GlowCard/GlowCard.d.ts +3 -0
  37. package/dist/components/GlowCard/GlowCard.js +185 -0
  38. package/dist/components/GlowCard/GlowCard.types.d.ts +21 -0
  39. package/dist/components/GlowCard/index.d.ts +2 -0
  40. package/dist/components/Heatmap/Heatmap.cjs +1 -0
  41. package/dist/components/Heatmap/Heatmap.const.cjs +1 -0
  42. package/dist/components/Heatmap/Heatmap.const.d.ts +8 -0
  43. package/dist/components/Heatmap/Heatmap.const.js +11 -0
  44. package/dist/components/Heatmap/Heatmap.d.ts +3 -0
  45. package/dist/components/Heatmap/Heatmap.js +103 -0
  46. package/dist/components/Heatmap/Heatmap.types.d.ts +34 -0
  47. package/dist/components/Heatmap/Heatmap.utils.cjs +1 -0
  48. package/dist/components/Heatmap/Heatmap.utils.d.ts +2 -0
  49. package/dist/components/Heatmap/Heatmap.utils.js +18 -0
  50. package/dist/components/Heatmap/index.d.ts +2 -0
  51. package/dist/components/ImageAnnotation/ImageAnnotation.cjs +1 -0
  52. package/dist/components/ImageAnnotation/ImageAnnotation.const.cjs +1 -0
  53. package/dist/components/ImageAnnotation/ImageAnnotation.const.d.ts +3 -0
  54. package/dist/components/ImageAnnotation/ImageAnnotation.const.js +6 -0
  55. package/dist/components/ImageAnnotation/ImageAnnotation.d.ts +3 -0
  56. package/dist/components/ImageAnnotation/ImageAnnotation.js +113 -0
  57. package/dist/components/ImageAnnotation/ImageAnnotation.types.d.ts +28 -0
  58. package/dist/components/ImageAnnotation/index.d.ts +2 -0
  59. package/dist/components/MediaPlayer/MediaPlayer.cjs +1 -0
  60. package/dist/components/MediaPlayer/MediaPlayer.const.cjs +1 -0
  61. package/dist/components/MediaPlayer/MediaPlayer.const.d.ts +36 -0
  62. package/dist/components/MediaPlayer/MediaPlayer.const.js +11 -0
  63. package/dist/components/MediaPlayer/MediaPlayer.d.ts +3 -0
  64. package/dist/components/MediaPlayer/MediaPlayer.js +279 -0
  65. package/dist/components/MediaPlayer/MediaPlayer.types.d.ts +69 -0
  66. package/dist/components/MediaPlayer/MediaPlayer.utils.cjs +1 -0
  67. package/dist/components/MediaPlayer/MediaPlayer.utils.d.ts +1 -0
  68. package/dist/components/MediaPlayer/MediaPlayer.utils.js +7 -0
  69. package/dist/components/MediaPlayer/index.d.ts +2 -0
  70. package/dist/components/Stepper/Stepper.cjs +1 -1
  71. package/dist/components/Stepper/Stepper.const.cjs +1 -1
  72. package/dist/components/Stepper/Stepper.const.d.ts +25 -4
  73. package/dist/components/Stepper/Stepper.const.js +39 -21
  74. package/dist/components/Stepper/Stepper.d.ts +3 -3
  75. package/dist/components/Stepper/Stepper.js +168 -156
  76. package/dist/components/Stepper/Stepper.types.d.ts +12 -1
  77. package/dist/components/Stepper/Stepper.utils.cjs +1 -0
  78. package/dist/components/Stepper/Stepper.utils.d.ts +12 -0
  79. package/dist/components/Stepper/Stepper.utils.js +19 -0
  80. package/dist/components/Stepper/components/StepperControls.cjs +1 -0
  81. package/dist/components/Stepper/components/StepperControls.d.ts +2 -0
  82. package/dist/components/Stepper/components/StepperControls.js +32 -0
  83. package/dist/components/Stepper/index.d.ts +2 -1
  84. package/dist/components/TagCloud/TagCloud.cjs +1 -0
  85. package/dist/components/TagCloud/TagCloud.const.cjs +1 -0
  86. package/dist/components/TagCloud/TagCloud.const.d.ts +5 -0
  87. package/dist/components/TagCloud/TagCloud.const.js +8 -0
  88. package/dist/components/TagCloud/TagCloud.d.ts +3 -0
  89. package/dist/components/TagCloud/TagCloud.js +76 -0
  90. package/dist/components/TagCloud/TagCloud.types.d.ts +26 -0
  91. package/dist/components/TagCloud/index.d.ts +2 -0
  92. package/dist/components/TimelineChart/TimelineChart.cjs +1 -0
  93. package/dist/components/TimelineChart/TimelineChart.const.cjs +1 -0
  94. package/dist/components/TimelineChart/TimelineChart.const.d.ts +6 -0
  95. package/dist/components/TimelineChart/TimelineChart.const.js +9 -0
  96. package/dist/components/TimelineChart/TimelineChart.d.ts +3 -0
  97. package/dist/components/TimelineChart/TimelineChart.js +65 -0
  98. package/dist/components/TimelineChart/TimelineChart.types.d.ts +31 -0
  99. package/dist/components/TimelineChart/index.d.ts +2 -0
  100. package/dist/components/index.cjs +1 -1
  101. package/dist/components/index.d.ts +17 -1
  102. package/dist/components/index.js +286 -269
  103. package/dist/index.cjs +1 -1
  104. package/dist/index.js +361 -344
  105. package/dist/styles/_effects.css +15 -0
  106. package/dist/styles.css +1 -1
  107. package/package.json +1 -1
package/README.md CHANGED
@@ -6,10 +6,6 @@ Strong, reliable React UI components. Tailwind-powered, zero config required. Th
6
6
 
7
7
  Visit the [Bear UI Portal](https://bearui.com/) to explore all components, view live examples, and browse the documentation.
8
8
 
9
- ## Changelog
10
-
11
- **Current release: 1.2.1** — Portaled overlays (Dropdown, Select, NavigableSelect, Menu, Autocomplete, MultiSelect, MentionsInput, TreeSelect, Popconfirm) use fixed positioning tied to the trigger, **z-index 10000**, and scroll/resize updates where applicable so panels are not clipped by parent `overflow` or stacking contexts. **Popover** and **Tooltip** also reposition on scroll/resize. **`useClickOutsideMultiple`** is available from `@forgedevstack/bear/hooks` for trigger + floating-root outside detection. Details: [CHANGELOG.md](./CHANGELOG.md).
12
-
13
9
  ## Features
14
10
 
15
11
  - **Tailwind-Powered**: Built with Tailwind CSS, zero config required
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react/jsx-runtime"),e=require("react"),v=require("../../utils/cn.cjs"),x=require("../Typography/Typography.cjs"),a=require("./AnimatedCounter.const.cjs"),T=require("./AnimatedCounter.utils.cjs"),M=({value:o,from:t=0,duration:l=a.DEFAULT_DURATION,decimals:b=a.DEFAULT_DECIMALS,prefix:E="",suffix:q="",separator:C=a.DEFAULT_SEPARATOR,easing:F=a.DEFAULT_EASING,animateOnView:u=!0,typographyProps:n,testId:N,className:D,...I})=>{const[_,R]=e.useState(t),[d,U]=e.useState(!u),A=e.useRef(null),m=T.EASING_FUNCTIONS[F],i=e.useCallback(()=>{const s=performance.now(),r=o-t,c=h=>{const j=h-s,f=Math.min(j/l,1);R(t+r*m(f)),f<1&&requestAnimationFrame(c)};requestAnimationFrame(c)},[o,t,l,m]);e.useEffect(()=>{if(!u){i();return}const s=A.current;if(!s)return;const r=new IntersectionObserver(([c])=>{c.isIntersecting&&!d&&(U(!0),i())},{threshold:.1});return r.observe(s),()=>r.disconnect()},[u,i,d]);const L=`${E}${T.formatNumber(_,b,C)}${q}`;return S.jsx(x.Typography,{variant:"h3",component:"span",...n,className:v.cn("Bear-AnimatedCounter bear-tabular-nums",n==null?void 0:n.className,D),"data-testid":N,children:S.jsx("span",{ref:A,...I,children:L})})};exports.AnimatedCounter=M;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=2e3,E=0,T=",",D="easeOut";exports.DEFAULT_DECIMALS=E;exports.DEFAULT_DURATION=A;exports.DEFAULT_EASING=D;exports.DEFAULT_SEPARATOR=T;
@@ -0,0 +1,5 @@
1
+ export declare const DEFAULT_DURATION = 2000;
2
+ export declare const DEFAULT_DECIMALS = 0;
3
+ export declare const DEFAULT_SEPARATOR = ",";
4
+ export declare const DEFAULT_EASING: "easeOut";
5
+ export declare const FRAME_INTERVAL = 16;
@@ -0,0 +1,7 @@
1
+ const A = 2e3, E = 0, t = ",", D = "easeOut";
2
+ export {
3
+ E as DEFAULT_DECIMALS,
4
+ A as DEFAULT_DURATION,
5
+ D as DEFAULT_EASING,
6
+ t as DEFAULT_SEPARATOR
7
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { AnimatedCounterProps } from './AnimatedCounter.types';
3
+ export declare const AnimatedCounter: FC<AnimatedCounterProps>;
@@ -0,0 +1,59 @@
1
+ import { jsx as A } from "react/jsx-runtime";
2
+ import { useState as d, useRef as v, useCallback as $, useEffect as k } from "react";
3
+ import { cn as p } from "../../utils/cn.js";
4
+ import { Typography as q } from "../Typography/Typography.js";
5
+ import { DEFAULT_DURATION as x, DEFAULT_DECIMALS as G, DEFAULT_SEPARATOR as M, DEFAULT_EASING as O } from "./AnimatedCounter.const.js";
6
+ import { EASING_FUNCTIONS as j, formatNumber as B } from "./AnimatedCounter.utils.js";
7
+ const V = ({
8
+ value: c,
9
+ from: e = 0,
10
+ duration: i = x,
11
+ decimals: E = G,
12
+ prefix: F = "",
13
+ suffix: N = "",
14
+ separator: S = M,
15
+ easing: T = O,
16
+ animateOnView: a = !0,
17
+ typographyProps: t,
18
+ testId: b,
19
+ className: D,
20
+ ...I
21
+ }) => {
22
+ const [U, C] = d(e), [m, L] = d(!a), u = v(null), f = j[T], o = $(() => {
23
+ const n = performance.now(), r = c - e, s = (R) => {
24
+ const h = R - n, l = Math.min(h / i, 1);
25
+ C(e + r * f(l)), l < 1 && requestAnimationFrame(s);
26
+ };
27
+ requestAnimationFrame(s);
28
+ }, [c, e, i, f]);
29
+ k(() => {
30
+ if (!a) {
31
+ o();
32
+ return;
33
+ }
34
+ const n = u.current;
35
+ if (!n) return;
36
+ const r = new IntersectionObserver(
37
+ ([s]) => {
38
+ s.isIntersecting && !m && (L(!0), o());
39
+ },
40
+ { threshold: 0.1 }
41
+ );
42
+ return r.observe(n), () => r.disconnect();
43
+ }, [a, o, m]);
44
+ const _ = `${F}${B(U, E, S)}${N}`;
45
+ return /* @__PURE__ */ A(
46
+ q,
47
+ {
48
+ variant: "h3",
49
+ component: "span",
50
+ ...t,
51
+ className: p("Bear-AnimatedCounter bear-tabular-nums", t == null ? void 0 : t.className, D),
52
+ "data-testid": b,
53
+ children: /* @__PURE__ */ A("span", { ref: u, ...I, children: _ })
54
+ }
55
+ );
56
+ };
57
+ export {
58
+ V as AnimatedCounter
59
+ };
@@ -0,0 +1,26 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { TypographyProps } from '../Typography/Typography.types';
3
+ export interface AnimatedCounterProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
4
+ /** Target value to count to */
5
+ value: number;
6
+ /** Starting value */
7
+ from?: number;
8
+ /** Animation duration in ms */
9
+ duration?: number;
10
+ /** Decimal places */
11
+ decimals?: number;
12
+ /** Prefix string (e.g. '$') */
13
+ prefix?: string;
14
+ /** Suffix string (e.g. '%') */
15
+ suffix?: string;
16
+ /** Thousand separator */
17
+ separator?: string;
18
+ /** Easing function */
19
+ easing?: 'linear' | 'easeOut' | 'easeInOut';
20
+ /** Start animation when element enters viewport */
21
+ animateOnView?: boolean;
22
+ /** Typography props for the number */
23
+ typographyProps?: Partial<TypographyProps>;
24
+ /** Test ID */
25
+ testId?: string;
26
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c={linear:e=>e,easeOut:e=>1-Math.pow(1-e,3),easeInOut:e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2};function s(e,r,a){const n=e.toFixed(r),[i,t]=n.split("."),o=i.replace(/\B(?=(\d{3})+(?!\d))/g,a);return t?`${o}.${t}`:o}exports.EASING_FUNCTIONS=c;exports.formatNumber=s;
@@ -0,0 +1,6 @@
1
+ export declare const EASING_FUNCTIONS: {
2
+ readonly linear: (t: number) => number;
3
+ readonly easeOut: (t: number) => number;
4
+ readonly easeInOut: (t: number) => number;
5
+ };
6
+ export declare function formatNumber(num: number, decimals: number, separator: string): string;
@@ -0,0 +1,13 @@
1
+ const i = {
2
+ linear: (e) => e,
3
+ easeOut: (e) => 1 - Math.pow(1 - e, 3),
4
+ easeInOut: (e) => e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2
5
+ };
6
+ function s(e, o, a) {
7
+ const r = e.toFixed(o), [c, t] = r.split("."), n = c.replace(/\B(?=(\d{3})+(?!\d))/g, a);
8
+ return t ? `${n}.${t}` : n;
9
+ }
10
+ export {
11
+ i as EASING_FUNCTIONS,
12
+ s as formatNumber
13
+ };
@@ -0,0 +1,2 @@
1
+ export { AnimatedCounter } from './AnimatedCounter';
2
+ export type { AnimatedCounterProps } from './AnimatedCounter.types';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),n=require("react"),U=require("../Input/Input.cjs"),B=require("../Icon/index.cjs"),l=require("./CurrencyInput.const.cjs"),c=require("./CurrencyInput.utils.cjs"),M=({value:p,onChange:u,currency:r=l.DEFAULT_CURRENCY,locale:s=l.DEFAULT_LOCALE,decimals:e=l.DEFAULT_DECIMALS,placeholder:S="0.00",size:f="md",disabled:A=!1,error:F,allowNegative:C=!1,max:o,min:a,testId:L,className:q,...x})=>{const[i,d]=n.useState(()=>c.formatCurrency(p,s,e)),[I,g]=n.useState(!1);n.useEffect(()=>{I||d(c.formatCurrency(p,s,e))},[p,s,e,I]);const D=n.useCallback(t=>{const j=t.target.value,m=C?/[^0-9.,-]/g:/[^0-9.,]/g;d(j.replace(m,""))},[C]),R=n.useCallback(()=>{g(!1);let t=c.parseCurrency(i);t!=null&&(o!=null&&t>o&&(t=o),a!=null&&t<a&&(t=a),t=parseFloat(t.toFixed(e))),u==null||u(t),d(c.formatCurrency(t,s,e))},[i,s,e,o,a,u]),E=typeof r=="string"?l.CURRENCY_SYMBOLS[r]??r:null,_=typeof r!="string"?r:y.jsx(B.BearIcons.DollarSignIcon,{size:f==="sm"?14:f==="lg"?20:16,className:"text-gray-400"}),b=E?y.jsx("span",{className:"text-gray-500 dark:text-gray-400 font-medium select-none",children:E}):_;return y.jsx(U.Input,{...x,size:f,disabled:A,error:F,placeholder:S,value:i,onChange:D,onFocus:()=>g(!0),onBlur:R,inputMode:"decimal",className:q,"data-testid":L,InputProps:{startAdornment:b}})};exports.CurrencyInput=M;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L="USD",C="en-US",E=2,U={USD:"$",EUR:"€",GBP:"£",JPY:"¥",ILS:"₪",INR:"₹",KRW:"₩",CNY:"¥",BRL:"R$",CAD:"CA$",AUD:"A$"};exports.CURRENCY_SYMBOLS=U;exports.DEFAULT_CURRENCY=L;exports.DEFAULT_DECIMALS=E;exports.DEFAULT_LOCALE=C;
@@ -0,0 +1,4 @@
1
+ export declare const DEFAULT_CURRENCY = "USD";
2
+ export declare const DEFAULT_LOCALE = "en-US";
3
+ export declare const DEFAULT_DECIMALS = 2;
4
+ export declare const CURRENCY_SYMBOLS: Record<string, string>;
@@ -0,0 +1,19 @@
1
+ const U = "USD", A = "en-US", C = 2, L = {
2
+ USD: "$",
3
+ EUR: "€",
4
+ GBP: "£",
5
+ JPY: "¥",
6
+ ILS: "₪",
7
+ INR: "₹",
8
+ KRW: "₩",
9
+ CNY: "¥",
10
+ BRL: "R$",
11
+ CAD: "CA$",
12
+ AUD: "A$"
13
+ };
14
+ export {
15
+ L as CURRENCY_SYMBOLS,
16
+ U as DEFAULT_CURRENCY,
17
+ C as DEFAULT_DECIMALS,
18
+ A as DEFAULT_LOCALE
19
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { CurrencyInputProps } from './CurrencyInput.types';
3
+ export declare const CurrencyInput: FC<CurrencyInputProps>;
@@ -0,0 +1,60 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import { useState as E, useEffect as M, useCallback as C } from "react";
3
+ import { Input as N } from "../Input/Input.js";
4
+ import { BearIcons as T } from "../Icon/index.js";
5
+ import { DEFAULT_LOCALE as Y, DEFAULT_DECIMALS as b, DEFAULT_CURRENCY as k, CURRENCY_SYMBOLS as O } from "./CurrencyInput.const.js";
6
+ import { formatCurrency as m, parseCurrency as V } from "./CurrencyInput.utils.js";
7
+ const J = ({
8
+ value: a,
9
+ onChange: e,
10
+ currency: s = k,
11
+ locale: o = Y,
12
+ decimals: r = b,
13
+ placeholder: F = "0.00",
14
+ size: f = "md",
15
+ disabled: L = !1,
16
+ error: g,
17
+ allowNegative: i = !1,
18
+ max: n,
19
+ min: p,
20
+ testId: D,
21
+ className: I,
22
+ ...S
23
+ }) => {
24
+ const [l, u] = E(() => m(a, o, r)), [c, y] = E(!1);
25
+ M(() => {
26
+ c || u(m(a, o, r));
27
+ }, [a, o, r, c]);
28
+ const U = C(
29
+ (t) => {
30
+ const _ = t.target.value, x = i ? /[^0-9.,-]/g : /[^0-9.,]/g;
31
+ u(_.replace(x, ""));
32
+ },
33
+ [i]
34
+ ), B = C(() => {
35
+ y(!1);
36
+ let t = V(l);
37
+ t != null && (n != null && t > n && (t = n), p != null && t < p && (t = p), t = parseFloat(t.toFixed(r))), e == null || e(t), u(m(t, o, r));
38
+ }, [l, o, r, n, p, e]), A = typeof s == "string" ? O[s] ?? s : null, R = typeof s != "string" ? s : /* @__PURE__ */ d(T.DollarSignIcon, { size: f === "sm" ? 14 : f === "lg" ? 20 : 16, className: "text-gray-400" });
39
+ return /* @__PURE__ */ d(
40
+ N,
41
+ {
42
+ ...S,
43
+ size: f,
44
+ disabled: L,
45
+ error: g,
46
+ placeholder: F,
47
+ value: l,
48
+ onChange: U,
49
+ onFocus: () => y(!0),
50
+ onBlur: B,
51
+ inputMode: "decimal",
52
+ className: I,
53
+ "data-testid": D,
54
+ InputProps: { startAdornment: A ? /* @__PURE__ */ d("span", { className: "text-gray-500 dark:text-gray-400 font-medium select-none", children: A }) : R }
55
+ }
56
+ );
57
+ };
58
+ export {
59
+ J as CurrencyInput
60
+ };
@@ -0,0 +1,22 @@
1
+ import { ReactNode } from 'react';
2
+ import { InputProps } from '../Input/Input.types';
3
+ export interface CurrencyInputProps extends Omit<InputProps, 'onChange' | 'value' | 'type'> {
4
+ /** Current numeric value */
5
+ value?: number;
6
+ /** Change handler receiving the numeric value */
7
+ onChange?: (value: number | undefined) => void;
8
+ /** Currency code (e.g. 'USD', 'EUR', 'GBP') or a custom ReactNode for the symbol */
9
+ currency?: string | ReactNode;
10
+ /** Locale for formatting */
11
+ locale?: string;
12
+ /** Maximum decimals */
13
+ decimals?: number;
14
+ /** Allow negative values */
15
+ allowNegative?: boolean;
16
+ /** Maximum value */
17
+ max?: number;
18
+ /** Minimum value */
19
+ min?: number;
20
+ /** Test ID */
21
+ testId?: string;
22
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(e,n,r){return e==null?"":new Intl.NumberFormat(n,{minimumFractionDigits:r,maximumFractionDigits:r}).format(e)}function i(e){const n=e.replace(/[^\d.,-]/g,"").replace(/,/g,""),r=parseFloat(n);return isNaN(r)?void 0:r}exports.formatCurrency=t;exports.parseCurrency=i;
@@ -0,0 +1,2 @@
1
+ export declare function formatCurrency(value: number | undefined, locale: string, decimals: number): string;
2
+ export declare function parseCurrency(raw: string): number | undefined;
@@ -0,0 +1,14 @@
1
+ function e(n, t, r) {
2
+ return n == null ? "" : new Intl.NumberFormat(t, {
3
+ minimumFractionDigits: r,
4
+ maximumFractionDigits: r
5
+ }).format(n);
6
+ }
7
+ function i(n) {
8
+ const t = n.replace(/[^\d.,-]/g, "").replace(/,/g, ""), r = parseFloat(t);
9
+ return isNaN(r) ? void 0 : r;
10
+ }
11
+ export {
12
+ e as formatCurrency,
13
+ i as parseCurrency
14
+ };
@@ -0,0 +1,2 @@
1
+ export { CurrencyInput } from './CurrencyInput';
2
+ export type { CurrencyInputProps } from './CurrencyInput.types';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),y=require("react"),b=require("../../utils/cn.cjs"),T=require("../../context/BearProvider.cjs"),a=require("../Typography/Typography.cjs"),f=require("./DiffViewer.const.cjs"),h=require("./DiffViewer.utils.cjs"),q=({oldValue:c,newValue:l,viewMode:v="split",showLineNumbers:u=!0,oldTitle:N="Original",newTitle:j="Modified",showStats:x=!0,className:g,testId:m})=>{const{mode:w}=T.useBear(),p=w==="dark",d=y.useMemo(()=>h.computeDiff(c,l),[c,l]),i=y.useMemo(()=>h.computeStats(d),[d]),t=r=>u?e.jsx("span",{className:"select-none text-gray-400 dark:text-gray-600 text-right pr-3",style:{minWidth:f.LINE_NUMBER_WIDTH},children:r??""}):null,n=(r,s)=>{const o=f.DIFF_COLORS[s],D=s==="add"?"+":s==="remove"?"-":" ";return e.jsxs("div",{className:"flex font-mono text-sm",style:{backgroundColor:o.bg,borderLeft:`3px solid ${o.border}`},children:[e.jsx("span",{className:"px-2 select-none font-bold",style:{color:o.text},children:D}),e.jsx("span",{className:"flex-1 whitespace-pre",children:r})]})};if(v==="unified")return e.jsxs("div",{className:b.cn("Bear-DiffViewer","rounded-lg overflow-hidden border",p?"bg-gray-900 border-gray-700":"bg-white border-gray-200",g),"data-testid":m,children:[x&&e.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs(a.Typography,{variant:"caption",className:"text-green-600",children:["+",i.additions," additions"]}),e.jsxs(a.Typography,{variant:"caption",className:"text-red-600",children:["-",i.deletions," deletions"]})]}),e.jsx("div",{className:"overflow-x-auto",children:d.map((r,s)=>e.jsxs("div",{className:"flex",children:[t(r.oldLineNumber||r.newLineNumber),e.jsx("div",{className:"flex-1",children:n(r.content,r.type)})]},s))})]});const k=d.filter(r=>r.type!=="add"),L=d.filter(r=>r.type!=="remove");return e.jsxs("div",{className:b.cn("Bear-DiffViewer","rounded-lg overflow-hidden border",p?"bg-gray-900 border-gray-700":"bg-white border-gray-200",g),"data-testid":m,children:[x&&e.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs(a.Typography,{variant:"caption",className:"text-green-600",children:["+",i.additions," additions"]}),e.jsxs(a.Typography,{variant:"caption",className:"text-red-600",children:["-",i.deletions," deletions"]})]}),e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-gray-200 dark:divide-gray-700",children:[e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:e.jsx(a.Typography,{variant:"caption",className:"font-semibold",children:N})}),e.jsx("div",{className:"overflow-x-auto",children:k.map((r,s)=>e.jsxs("div",{className:"flex",children:[t(r.oldLineNumber),e.jsx("div",{className:"flex-1",children:n(r.content,r.type==="remove"?"remove":"context")})]},s))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:e.jsx(a.Typography,{variant:"caption",className:"font-semibold",children:j})}),e.jsx("div",{className:"overflow-x-auto",children:L.map((r,s)=>e.jsxs("div",{className:"flex",children:[t(r.newLineNumber),e.jsx("div",{className:"flex-1",children:n(r.content,r.type==="add"?"add":"context")})]},s))})]})]})]})};exports.DiffViewer=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),o=require("../../utils/cn.cjs"),R=require("../../context/BearProvider.cjs"),d=require("../Typography/Typography.cjs"),a=require("./DiffViewer.const.cjs"),N=require("./DiffViewer.utils.cjs"),P=({oldValue:m,newValue:p,viewMode:j="split",showLineNumbers:L=!0,oldTitle:T=a.DEFAULT_OLD_TITLE,newTitle:k=a.DEFAULT_NEW_TITLE,showStats:E=!0,spacing:D=a.DEFAULT_SPACING,showLineHoverInfo:c=!1,className:_,testId:h})=>{const{mode:w}=R.useBear(),S=w==="dark",[C,b]=n.useState(null),t=n.useMemo(()=>N.computeDiff(m,p),[m,p]),l=n.useMemo(()=>N.computeStats(t),[t]),f=a.LINE_SPACING[D],q=n.useCallback(r=>{c&&b(r)},[c]),A=n.useCallback(()=>{b(null)},[]),x=r=>L?e.jsx("span",{className:o.cn("select-none text-gray-400 dark:text-gray-600 text-right pr-3",f),style:{minWidth:a.LINE_NUMBER_WIDTH},children:r??""}):null,u=(r,s,i)=>{const g=a.DIFF_COLORS[s],F=s==="add"?"+":s==="remove"?"-":" ",O=i!=null&&C===i;return e.jsxs("div",{className:o.cn("flex font-mono text-sm relative group",f),style:{backgroundColor:g.bg,borderLeft:`3px solid ${g.border}`},onMouseEnter:()=>i!=null&&q(i),onMouseLeave:A,children:[e.jsx("span",{className:"px-2 select-none font-bold",style:{color:g.text},children:F}),e.jsx("span",{className:"flex-1 whitespace-pre",children:r}),c&&O&&s!=="context"&&e.jsx("span",{className:o.cn("absolute right-2 top-1/2 -translate-y-1/2 text-xs px-2 py-0.5 rounded",s==="add"?"bg-green-500/20 text-green-600 dark:text-green-400":"bg-red-500/20 text-red-600 dark:text-red-400"),children:a.LINE_HOVER_LABELS[s]})]})},v=()=>E?e.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs(d.Typography,{variant:"caption",className:"text-green-600",children:["+",l.additions," additions"]}),e.jsxs(d.Typography,{variant:"caption",className:"text-red-600",children:["-",l.deletions," deletions"]}),e.jsxs(d.Typography,{variant:"caption",className:"text-gray-500",children:[l.unchanged," unchanged"]})]}):null,y=o.cn("Bear-DiffViewer","rounded-lg overflow-hidden border",S?"bg-gray-900 border-gray-700":"bg-white border-gray-200",_);if(j==="unified")return e.jsxs("div",{className:y,"data-testid":h,children:[v(),e.jsx("div",{className:"overflow-x-auto",children:t.map((r,s)=>e.jsxs("div",{className:"flex",children:[x(r.oldLineNumber||r.newLineNumber),e.jsx("div",{className:"flex-1",children:u(r.content,r.type,s)})]},s))})]});const B=t.filter(r=>r.type!=="add"),M=t.filter(r=>r.type!=="remove");return e.jsxs("div",{className:y,"data-testid":h,children:[v(),e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-gray-200 dark:divide-gray-700",children:[e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:e.jsx(d.Typography,{variant:"caption",className:"font-semibold",children:T})}),e.jsx("div",{className:"overflow-x-auto",children:B.map((r,s)=>e.jsxs("div",{className:"flex",children:[x(r.oldLineNumber),e.jsx("div",{className:"flex-1",children:u(r.content,r.type==="remove"?"remove":"context",s)})]},s))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:e.jsx(d.Typography,{variant:"caption",className:"font-semibold",children:k})}),e.jsx("div",{className:"overflow-x-auto",children:M.map((r,s)=>e.jsxs("div",{className:"flex",children:[x(r.newLineNumber),e.jsx("div",{className:"flex-1",children:u(r.content,r.type==="add"?"add":"context",s)})]},s))})]})]})]})};exports.DiffViewer=P;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={add:{bg:"rgba(34, 197, 94, 0.15)",border:"rgba(34, 197, 94, 0.4)",text:"#22c55e"},remove:{bg:"rgba(239, 68, 68, 0.15)",border:"rgba(239, 68, 68, 0.4)",text:"#ef4444"},context:{bg:"transparent",border:"transparent",text:"inherit"}},t=50;exports.DIFF_COLORS=e;exports.LINE_NUMBER_WIDTH=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={add:{bg:"rgba(34, 197, 94, 0.15)",border:"rgba(34, 197, 94, 0.4)",text:"#22c55e"},remove:{bg:"rgba(239, 68, 68, 0.15)",border:"rgba(239, 68, 68, 0.4)",text:"#ef4444"},context:{bg:"transparent",border:"transparent",text:"inherit"}},t=50,o={compact:"py-0",comfortable:"py-1",spacious:"py-2"},r={add:"Added",remove:"Removed",context:"Unchanged"},E="Original",L="Modified",_="comfortable";exports.DEFAULT_NEW_TITLE=L;exports.DEFAULT_OLD_TITLE=E;exports.DEFAULT_SPACING=_;exports.DIFF_COLORS=e;exports.LINE_HOVER_LABELS=r;exports.LINE_NUMBER_WIDTH=t;exports.LINE_SPACING=o;
@@ -1,3 +1,4 @@
1
+ import { DiffSpacing } from './DiffViewer.types';
1
2
  export declare const DIFF_COLORS: {
2
3
  readonly add: {
3
4
  readonly bg: "rgba(34, 197, 94, 0.15)";
@@ -16,3 +17,8 @@ export declare const DIFF_COLORS: {
16
17
  };
17
18
  };
18
19
  export declare const LINE_NUMBER_WIDTH = 50;
20
+ export declare const LINE_SPACING: Record<DiffSpacing, string>;
21
+ export declare const LINE_HOVER_LABELS: Record<string, string>;
22
+ export declare const DEFAULT_OLD_TITLE = "Original";
23
+ export declare const DEFAULT_NEW_TITLE = "Modified";
24
+ export declare const DEFAULT_SPACING: DiffSpacing;
@@ -1,4 +1,4 @@
1
- const r = {
1
+ const t = {
2
2
  add: {
3
3
  bg: "rgba(34, 197, 94, 0.15)",
4
4
  border: "rgba(34, 197, 94, 0.4)",
@@ -14,8 +14,21 @@ const r = {
14
14
  border: "transparent",
15
15
  text: "inherit"
16
16
  }
17
- }, t = 50;
17
+ }, e = 50, o = {
18
+ compact: "py-0",
19
+ comfortable: "py-1",
20
+ spacious: "py-2"
21
+ }, r = {
22
+ add: "Added",
23
+ remove: "Removed",
24
+ context: "Unchanged"
25
+ }, n = "Original", a = "Modified", c = "comfortable";
18
26
  export {
19
- r as DIFF_COLORS,
20
- t as LINE_NUMBER_WIDTH
27
+ a as DEFAULT_NEW_TITLE,
28
+ n as DEFAULT_OLD_TITLE,
29
+ c as DEFAULT_SPACING,
30
+ t as DIFF_COLORS,
31
+ r as LINE_HOVER_LABELS,
32
+ e as LINE_NUMBER_WIDTH,
33
+ o as LINE_SPACING
21
34
  };
@@ -1,18 +1,4 @@
1
1
  import { FC } from 'react';
2
2
  import { DiffViewerProps } from './DiffViewer.types';
3
- /**
4
- * DiffViewer - Compare and visualize text/code differences
5
- *
6
- * @example
7
- * ```tsx
8
- * <DiffViewer
9
- * oldValue="const x = 1;"
10
- * newValue="const x = 2;"
11
- * viewMode="split"
12
- * showLineNumbers
13
- * showStats
14
- * />
15
- * ```
16
- */
17
3
  export declare const DiffViewer: FC<DiffViewerProps>;
18
4
  export default DiffViewer;