@forgedevstack/bear 1.0.9 → 1.1.1

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 (43) hide show
  1. package/README.md +11 -1
  2. package/dist/components/Button/Button.cjs +1 -1
  3. package/dist/components/Button/Button.js +56 -55
  4. package/dist/components/Button/Button.types.d.ts +7 -0
  5. package/dist/components/FileTree/FileTree.cjs +1 -0
  6. package/dist/components/FileTree/FileTree.d.ts +3 -0
  7. package/dist/components/FileTree/FileTree.js +46 -0
  8. package/dist/components/FileTree/FileTree.types.d.ts +30 -0
  9. package/dist/components/FileTree/index.d.ts +2 -0
  10. package/dist/components/ResizablePanel/ResizablePanel.cjs +1 -0
  11. package/dist/components/ResizablePanel/ResizablePanel.const.cjs +1 -0
  12. package/dist/components/ResizablePanel/ResizablePanel.const.d.ts +11 -0
  13. package/dist/components/ResizablePanel/ResizablePanel.const.js +11 -0
  14. package/dist/components/ResizablePanel/ResizablePanel.d.ts +17 -0
  15. package/dist/components/ResizablePanel/ResizablePanel.js +70 -0
  16. package/dist/components/ResizablePanel/ResizablePanel.types.d.ts +21 -0
  17. package/dist/components/ResizablePanel/ResizablePanel.utils.cjs +1 -0
  18. package/dist/components/ResizablePanel/ResizablePanel.utils.d.ts +10 -0
  19. package/dist/components/ResizablePanel/ResizablePanel.utils.js +11 -0
  20. package/dist/components/ResizablePanel/index.d.ts +2 -0
  21. package/dist/components/ResizableTextarea/ResizableTextarea.cjs +1 -0
  22. package/dist/components/ResizableTextarea/ResizableTextarea.const.cjs +1 -0
  23. package/dist/components/ResizableTextarea/ResizableTextarea.const.d.ts +2 -0
  24. package/dist/components/ResizableTextarea/ResizableTextarea.const.js +5 -0
  25. package/dist/components/ResizableTextarea/ResizableTextarea.d.ts +3 -0
  26. package/dist/components/ResizableTextarea/ResizableTextarea.js +60 -0
  27. package/dist/components/ResizableTextarea/ResizableTextarea.types.d.ts +15 -0
  28. package/dist/components/ResizableTextarea/index.d.ts +2 -0
  29. package/dist/components/Typewriter/Typewriter.cjs +1 -1
  30. package/dist/components/Typewriter/Typewriter.js +59 -65
  31. package/dist/components/Typography/Typography.cjs +1 -1
  32. package/dist/components/Typography/Typography.const.cjs +1 -0
  33. package/dist/components/Typography/Typography.const.d.ts +22 -0
  34. package/dist/components/Typography/Typography.const.js +91 -0
  35. package/dist/components/Typography/Typography.js +75 -138
  36. package/dist/components/Typography/Typography.types.d.ts +17 -0
  37. package/dist/components/index.cjs +1 -1
  38. package/dist/components/index.d.ts +6 -0
  39. package/dist/components/index.js +245 -239
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.js +277 -271
  42. package/dist/styles.css +1 -1
  43. package/package.json +1 -1
@@ -0,0 +1,15 @@
1
+ import { TextareaHTMLAttributes } from 'react';
2
+ export interface ResizableTextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'style'> {
3
+ /** Minimum height in pixels */
4
+ minHeight?: number;
5
+ /** Maximum height in pixels (0 = unbounded) */
6
+ maxHeight?: number;
7
+ /** Allow user to resize by dragging the handle */
8
+ resizable?: boolean;
9
+ /** Class name for the wrapper */
10
+ className?: string;
11
+ /** Inline styles */
12
+ style?: React.CSSProperties;
13
+ /** Test ID */
14
+ testId?: string;
15
+ }
@@ -0,0 +1,2 @@
1
+ export { ResizableTextarea } from './ResizableTextarea';
2
+ export type { ResizableTextareaProps } from './ResizableTextarea.types';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),t=require("react"),R=require("../../utils/cn.cjs"),r=require("./Typewriter.const.cjs"),X=b=>{const{text:f,speed:i=r.DEFAULT_SPEED,startDelay:N=r.DEFAULT_START_DELAY,deleteDelay:x=r.DEFAULT_DELETE_DELAY,deleteSpeed:d=r.DEFAULT_DELETE_SPEED,loop:_=!1,cursor:I=!0,cursorChar:h=r.DEFAULT_CURSOR_CHAR,cursorBlinkSpeed:A=r.DEFAULT_CURSOR_BLINK_SPEED,onComplete:n,onWordComplete:o,as:g="span",className:U,style:j,testId:w}=b,u=Array.isArray(f)?f:[f],[F,m]=t.useState(""),[a,p]=t.useState(r.INITIAL_TEXT_INDEX),[l,S]=t.useState(r.INITIAL_CHAR_INDEX),[E,L]=t.useState(!1),[v,B]=t.useState(!0),e=t.useRef(),D=t.useRef(!1);t.useEffect(()=>{if(!I)return;const T=setInterval(()=>B(s=>!s),A);return()=>clearInterval(T)},[I,A]);const c=t.useCallback(()=>{const T=u[a];if(E)if(l>0)S(s=>s-1),m(T.slice(0,l-1)),e.current=setTimeout(c,d);else{L(!1);const s=a+1;s>=u.length?_?(p(r.INITIAL_TEXT_INDEX),e.current=setTimeout(c,i)):n==null||n():(p(s),e.current=setTimeout(c,i))}else if(l<T.length)m(T.slice(0,l+1)),S(s=>s+1),e.current=setTimeout(c,i);else{if(o==null||o(a),u.length===1&&!_){n==null||n();return}e.current=setTimeout(()=>{L(!0),c()},x)}},[u,a,l,E,i,d,x,_,n,o]);return t.useEffect(()=>{if(!D.current)return D.current=!0,e.current=setTimeout(c,N),()=>{e.current&&clearTimeout(e.current)}},[]),t.useEffect(()=>{if(D.current)return e.current&&clearTimeout(e.current),e.current=setTimeout(c,E?d:i),()=>{e.current&&clearTimeout(e.current)}},[E,a]),y.jsxs(g,{className:R.cn("Bear-Typewriter","bear-inline",U),style:j,"data-testid":w,"aria-label":u.join(", "),children:[y.jsx("span",{className:"Bear-Typewriter__text",children:F}),I&&y.jsx("span",{className:R.cn("Bear-Typewriter__cursor","bear-inline-block bear-ml-0.5","bear-text-[var(--bear-primary-500)]"),style:{opacity:v?1:0},"aria-hidden":"true",children:h})]})};exports.Typewriter=X;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react/jsx-runtime"),t=require("react"),X=require("../../utils/cn.cjs"),e=require("./Typewriter.const.cjs"),k=g=>{const{text:I,speed:T=e.DEFAULT_SPEED,startDelay:C=e.DEFAULT_START_DELAY,deleteDelay:N=e.DEFAULT_DELETE_DELAY,deleteSpeed:R=e.DEFAULT_DELETE_SPEED,loop:d=!1,cursor:f=!0,cursorChar:U=e.DEFAULT_CURSOR_CHAR,cursorBlinkSpeed:y=e.DEFAULT_CURSOR_BLINK_SPEED,onComplete:n,onWordComplete:o,as:j="span",className:w,style:F,testId:H}=g,a=t.useMemo(()=>Array.isArray(I)?I:[I],[I]),[v,L]=t.useState(""),[p,S]=t.useState(e.INITIAL_TEXT_INDEX),[m,E]=t.useState(e.INITIAL_CHAR_INDEX),[b,h]=t.useState(!1),[B,q]=t.useState(!0),s=t.useRef(),_=t.useRef(p),c=t.useRef(m),D=t.useRef(b);_.current=p,c.current=m,D.current=b,t.useEffect(()=>{if(!f)return;const l=setInterval(()=>q(i=>!i),y);return()=>clearInterval(l)},[f,y]);const u=t.useCallback(()=>{const l=_.current,i=c.current,P=D.current,A=a[l];if(P)if(i>0){const r=i-1;E(r),c.current=r,L(A.slice(0,r)),s.current=setTimeout(u,R)}else{h(!1),D.current=!1;const r=l+1;r>=a.length?d?(S(e.INITIAL_TEXT_INDEX),_.current=e.INITIAL_TEXT_INDEX,E(e.INITIAL_CHAR_INDEX),c.current=e.INITIAL_CHAR_INDEX,s.current=setTimeout(u,T)):n==null||n():(S(r),_.current=r,E(e.INITIAL_CHAR_INDEX),c.current=e.INITIAL_CHAR_INDEX,s.current=setTimeout(u,T))}else if(i<A.length){const r=i+1;L(A.slice(0,r)),E(r),c.current=r,s.current=setTimeout(u,T)}else{if(o==null||o(l),a.length===1&&!d){n==null||n();return}s.current=setTimeout(()=>{h(!0),D.current=!0,u()},N)}},[a,T,R,N,d,n,o]);return t.useEffect(()=>(s.current=setTimeout(u,C),()=>{s.current&&clearTimeout(s.current)}),[]),x.jsxs(j,{className:X.cn("Bear-Typewriter","bear-inline",w),style:F,"data-testid":H,"aria-label":a.join(", "),children:[x.jsx("span",{className:"Bear-Typewriter__text",children:v}),f&&x.jsx("span",{className:X.cn("Bear-Typewriter__cursor","bear-inline-block bear-ml-0.5","bear-text-[var(--bear-primary-500)]"),style:{opacity:B?1:0},"aria-hidden":"true",children:U})]})};exports.Typewriter=k;
@@ -1,82 +1,76 @@
1
- import { jsxs as P, jsx as b } from "react/jsx-runtime";
2
- import { useState as l, useRef as h, useEffect as _, useCallback as X } from "react";
3
- import { cn as R } from "../../utils/cn.js";
4
- import { DEFAULT_SPEED as H, DEFAULT_START_DELAY as O, DEFAULT_DELETE_DELAY as V, DEFAULT_DELETE_SPEED as Y, DEFAULT_CURSOR_CHAR as K, DEFAULT_CURSOR_BLINK_SPEED as q, INITIAL_TEXT_INDEX as N, INITIAL_CHAR_INDEX as z } from "./Typewriter.const.js";
5
- const Z = (S) => {
1
+ import { jsxs as K, jsx as U } from "react/jsx-runtime";
2
+ import { useMemo as M, useState as u, useRef as D, useEffect as F, useCallback as q } from "react";
3
+ import { cn as B } from "../../utils/cn.js";
4
+ import { DEFAULT_SPEED as z, DEFAULT_START_DELAY as G, DEFAULT_DELETE_DELAY as J, DEFAULT_DELETE_SPEED as Q, DEFAULT_CURSOR_CHAR as Z, DEFAULT_CURSOR_BLINK_SPEED as $, INITIAL_TEXT_INDEX as p, INITIAL_CHAR_INDEX as l } from "./Typewriter.const.js";
5
+ const se = (v) => {
6
6
  const {
7
- text: f,
8
- speed: n = H,
9
- startDelay: U = O,
10
- deleteDelay: I = V,
11
- deleteSpeed: E = Y,
12
- loop: d = !1,
13
- cursor: m = !0,
14
- cursorChar: g = K,
15
- cursorBlinkSpeed: p = q,
16
- onComplete: t,
17
- onWordComplete: o,
18
- as: F = "span",
19
- className: B,
20
- style: v,
21
- testId: w
22
- } = S, i = Array.isArray(f) ? f : [f], [C, x] = l(""), [a, y] = l(N), [c, A] = l(z), [T, L] = l(!1), [j, k] = l(!0), e = h(), D = h(!1);
23
- _(() => {
24
- if (!m) return;
25
- const u = setInterval(() => k((r) => !r), p);
26
- return () => clearInterval(u);
27
- }, [m, p]);
28
- const s = X(() => {
29
- const u = i[a];
30
- if (T)
31
- if (c > 0)
32
- A((r) => r - 1), x(u.slice(0, c - 1)), e.current = setTimeout(s, E);
33
- else {
34
- L(!1);
35
- const r = a + 1;
36
- r >= i.length ? d ? (y(N), e.current = setTimeout(s, n)) : t == null || t() : (y(r), e.current = setTimeout(s, n));
7
+ text: o,
8
+ speed: T = z,
9
+ startDelay: w = G,
10
+ deleteDelay: y = J,
11
+ deleteSpeed: A = Q,
12
+ loop: I = !1,
13
+ cursor: _ = !0,
14
+ cursorChar: C = Z,
15
+ cursorBlinkSpeed: L = $,
16
+ onComplete: r,
17
+ onWordComplete: E,
18
+ as: j = "span",
19
+ className: k,
20
+ style: P,
21
+ testId: X
22
+ } = v, i = M(() => Array.isArray(o) ? o : [o], [o]), [H, R] = u(""), [h, b] = u(p), [N, d] = u(l), [S, g] = u(!1), [O, V] = u(!0), t = D(), f = D(h), s = D(N), x = D(S);
23
+ f.current = h, s.current = N, x.current = S, F(() => {
24
+ if (!_) return;
25
+ const a = setInterval(() => V((c) => !c), L);
26
+ return () => clearInterval(a);
27
+ }, [_, L]);
28
+ const n = q(() => {
29
+ const a = f.current, c = s.current, Y = x.current, m = i[a];
30
+ if (Y)
31
+ if (c > 0) {
32
+ const e = c - 1;
33
+ d(e), s.current = e, R(m.slice(0, e)), t.current = setTimeout(n, A);
34
+ } else {
35
+ g(!1), x.current = !1;
36
+ const e = a + 1;
37
+ e >= i.length ? I ? (b(p), f.current = p, d(l), s.current = l, t.current = setTimeout(n, T)) : r == null || r() : (b(e), f.current = e, d(l), s.current = l, t.current = setTimeout(n, T));
37
38
  }
38
- else if (c < u.length)
39
- x(u.slice(0, c + 1)), A((r) => r + 1), e.current = setTimeout(s, n);
40
- else {
41
- if (o == null || o(a), i.length === 1 && !d) {
42
- t == null || t();
39
+ else if (c < m.length) {
40
+ const e = c + 1;
41
+ R(m.slice(0, e)), d(e), s.current = e, t.current = setTimeout(n, T);
42
+ } else {
43
+ if (E == null || E(a), i.length === 1 && !I) {
44
+ r == null || r();
43
45
  return;
44
46
  }
45
- e.current = setTimeout(() => {
46
- L(!0), s();
47
- }, I);
47
+ t.current = setTimeout(() => {
48
+ g(!0), x.current = !0, n();
49
+ }, y);
48
50
  }
49
- }, [i, a, c, T, n, E, I, d, t, o]);
50
- return _(() => {
51
- if (!D.current)
52
- return D.current = !0, e.current = setTimeout(s, U), () => {
53
- e.current && clearTimeout(e.current);
54
- };
55
- }, []), _(() => {
56
- if (D.current)
57
- return e.current && clearTimeout(e.current), e.current = setTimeout(s, T ? E : n), () => {
58
- e.current && clearTimeout(e.current);
59
- };
60
- }, [T, a]), /* @__PURE__ */ P(
61
- F,
51
+ }, [i, T, A, y, I, r, E]);
52
+ return F(() => (t.current = setTimeout(n, w), () => {
53
+ t.current && clearTimeout(t.current);
54
+ }), []), /* @__PURE__ */ K(
55
+ j,
62
56
  {
63
- className: R("Bear-Typewriter", "bear-inline", B),
64
- style: v,
65
- "data-testid": w,
57
+ className: B("Bear-Typewriter", "bear-inline", k),
58
+ style: P,
59
+ "data-testid": X,
66
60
  "aria-label": i.join(", "),
67
61
  children: [
68
- /* @__PURE__ */ b("span", { className: "Bear-Typewriter__text", children: C }),
69
- m && /* @__PURE__ */ b(
62
+ /* @__PURE__ */ U("span", { className: "Bear-Typewriter__text", children: H }),
63
+ _ && /* @__PURE__ */ U(
70
64
  "span",
71
65
  {
72
- className: R(
66
+ className: B(
73
67
  "Bear-Typewriter__cursor",
74
68
  "bear-inline-block bear-ml-0.5",
75
69
  "bear-text-[var(--bear-primary-500)]"
76
70
  ),
77
- style: { opacity: j ? 1 : 0 },
71
+ style: { opacity: O ? 1 : 0 },
78
72
  "aria-hidden": "true",
79
- children: g
73
+ children: C
80
74
  }
81
75
  )
82
76
  ]
@@ -84,5 +78,5 @@ const Z = (S) => {
84
78
  );
85
79
  };
86
80
  export {
87
- Z as Typewriter
81
+ se as Typewriter
88
82
  };
@@ -1 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),c=require("react"),O=require("../../context/BearProvider.cjs"),q=require("../GradientText/GradientText.cjs"),v=require("../Typewriter/Typewriter.cjs"),r=require("./Typography.const.cjs"),G=require("../../utils/cn.cjs"),j=A=>{const{variant:t=r.DEFAULT_VARIANT,component:u,align:f,weight:g,color:a=r.DEFAULT_COLOR,truncate:y=!1,maxLines:l,italic:C=!1,underline:b=!1,strikethrough:L=!1,noWrap:_=!1,inline:S=!1,paragraph:x=!1,lineHeight:T,gradient:p,typewriter:n,children:E,className:I,style:B,testId:N,...W}=A,i=c.useContext(O.BearContext),s=r.BUILT_IN_VARIANTS.includes(t),e=c.useMemo(()=>{if(!(s||!(i!=null&&i.customTypography)))return i.customTypography[t]},[s,i==null?void 0:i.customTypography,t]),w=c.useMemo(()=>u||(e!=null&&e.component?e.component:s?r.VARIANT_MAP[t]:"span"),[u,e,s,t]),d=a&&!(a in r.COLOR_CLASSES),R=c.useMemo(()=>{if(!e)return{};const o={};return e.fontSize&&(o.fontSize=e.fontSize),e.lineHeight&&(o.lineHeight=e.lineHeight),e.letterSpacing&&(o.letterSpacing=e.letterSpacing),e.textTransform&&(o.textTransform=e.textTransform),e.fontFamily&&(o.fontFamily=e.fontFamily),e.fontWeight&&(o.fontWeight=typeof e.fontWeight=="number"?e.fontWeight:r.WEIGHT_VALUES[e.fontWeight]||400),o},[e]),m=n?h.jsx(v.Typewriter,{text:n.texts,loop:n.loop??!0,speed:n.speed,deleteSpeed:n.deleteSpeed,cursor:n.cursor??!0,cursorChar:n.cursorChar,as:"span"}):E,H=p&&Array.isArray(p)&&p.length>=2?h.jsx(q.GradientText,{colors:p,className:S?"bear-inline":void 0,children:m}):m;return h.jsx(w,{className:G.cn("Bear-Typography",`Bear-Typography--${t}`,s&&r.VARIANT_CLASSES[t],g&&r.WEIGHT_CLASSES[g],f&&r.ALIGN_CLASSES[f],!d&&a&&r.COLOR_CLASSES[a],T&&r.LINE_HEIGHT_CLASSES[T],C&&"Bear-Typography--italic bear-italic",b&&"Bear-Typography--underline bear-underline",L&&"Bear-Typography--strikethrough bear-line-through",_&&"bear-whitespace-nowrap",S&&"bear-inline",x&&"bear-mb-4",y&&!l&&"Bear-Typography--truncate bear-truncate",y&&l&&"bear-overflow-hidden",I),style:{...R,...B,...d&&{color:a},...y&&l&&{display:"-webkit-box",WebkitLineClamp:l,WebkitBoxOrient:"vertical"}},"data-testid":N,...W,children:H})};exports.Typography=j;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="body1",t="primary",r={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"},a={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:""},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"},o={thin:100,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},n={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"},d={tight:"bear-leading-tight",normal:"bear-leading-normal",relaxed:"bear-leading-relaxed",loose:"bear-leading-loose"},l=["h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","caption","overline","code","inherit"];exports.ALIGN_CLASSES=n;exports.BUILT_IN_VARIANTS=l;exports.COLOR_CLASSES=i;exports.DEFAULT_COLOR=t;exports.DEFAULT_VARIANT=e;exports.LINE_HEIGHT_CLASSES=d;exports.VARIANT_CLASSES=a;exports.VARIANT_MAP=r;exports.WEIGHT_CLASSES=b;exports.WEIGHT_VALUES=o;
@@ -0,0 +1,22 @@
1
+ import { ElementType } from 'react';
2
+ import { BuiltInTypographyVariant } from './Typography.types';
3
+ /** Default variant when not specified */
4
+ export declare const DEFAULT_VARIANT: BuiltInTypographyVariant;
5
+ /** Default color when not specified */
6
+ export declare const DEFAULT_COLOR = "primary";
7
+ /** Map from built-in variant to HTML element type */
8
+ export declare const VARIANT_MAP: Record<BuiltInTypographyVariant, ElementType>;
9
+ /** Tailwind classes per built-in variant (supports dark mode) */
10
+ export declare const VARIANT_CLASSES: Record<BuiltInTypographyVariant, string>;
11
+ /** Font weight class names */
12
+ export declare const WEIGHT_CLASSES: Record<string, string>;
13
+ /** Numeric font weight values */
14
+ export declare const WEIGHT_VALUES: Record<string, number>;
15
+ /** Text alignment classes */
16
+ export declare const ALIGN_CLASSES: Record<string, string>;
17
+ /** Text color classes (light and dark mode) */
18
+ export declare const COLOR_CLASSES: Record<string, string>;
19
+ /** Line height classes */
20
+ export declare const LINE_HEIGHT_CLASSES: Record<string, string>;
21
+ /** List of built-in variant names for validation */
22
+ export declare const BUILT_IN_VARIANTS: BuiltInTypographyVariant[];
@@ -0,0 +1,91 @@
1
+ const e = "body1", t = "primary", r = {
2
+ h1: "h1",
3
+ h2: "h2",
4
+ h3: "h3",
5
+ h4: "h4",
6
+ h5: "h5",
7
+ h6: "h6",
8
+ subtitle1: "h6",
9
+ subtitle2: "h6",
10
+ body1: "p",
11
+ body2: "p",
12
+ caption: "span",
13
+ overline: "span",
14
+ code: "code",
15
+ inherit: "span"
16
+ }, a = {
17
+ h1: "bear-text-5xl bear-font-bold bear-tracking-tight",
18
+ h2: "bear-text-4xl bear-font-bold bear-tracking-tight",
19
+ h3: "bear-text-3xl bear-font-semibold",
20
+ h4: "bear-text-2xl bear-font-semibold",
21
+ h5: "bear-text-xl bear-font-medium",
22
+ h6: "bear-text-lg bear-font-medium",
23
+ subtitle1: "bear-text-lg bear-font-normal",
24
+ subtitle2: "bear-text-base bear-font-medium",
25
+ body1: "bear-text-base bear-font-normal",
26
+ body2: "bear-text-sm bear-font-normal",
27
+ caption: "bear-text-xs",
28
+ overline: "bear-text-xs bear-uppercase bear-tracking-wider",
29
+ 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",
30
+ inherit: ""
31
+ }, b = {
32
+ thin: "bear-font-thin",
33
+ light: "bear-font-light",
34
+ normal: "bear-font-normal",
35
+ medium: "bear-font-medium",
36
+ semibold: "bear-font-semibold",
37
+ bold: "bear-font-bold",
38
+ extrabold: "bear-font-extrabold"
39
+ }, o = {
40
+ thin: 100,
41
+ light: 300,
42
+ normal: 400,
43
+ medium: 500,
44
+ semibold: 600,
45
+ bold: 700,
46
+ extrabold: 800
47
+ }, n = {
48
+ left: "bear-text-left",
49
+ center: "bear-text-center",
50
+ right: "bear-text-right",
51
+ justify: "bear-text-justify"
52
+ }, i = {
53
+ primary: "bear-text-gray-900 dark:bear-text-gray-100",
54
+ secondary: "bear-text-gray-600 dark:bear-text-gray-400",
55
+ muted: "bear-text-gray-400 dark:bear-text-gray-500",
56
+ success: "bear-text-green-600 dark:bear-text-green-400",
57
+ danger: "bear-text-red-600 dark:bear-text-red-400",
58
+ warning: "bear-text-amber-600 dark:bear-text-amber-400"
59
+ }, d = {
60
+ tight: "bear-leading-tight",
61
+ normal: "bear-leading-normal",
62
+ relaxed: "bear-leading-relaxed",
63
+ loose: "bear-leading-loose"
64
+ }, l = [
65
+ "h1",
66
+ "h2",
67
+ "h3",
68
+ "h4",
69
+ "h5",
70
+ "h6",
71
+ "subtitle1",
72
+ "subtitle2",
73
+ "body1",
74
+ "body2",
75
+ "caption",
76
+ "overline",
77
+ "code",
78
+ "inherit"
79
+ ];
80
+ export {
81
+ n as ALIGN_CLASSES,
82
+ l as BUILT_IN_VARIANTS,
83
+ i as COLOR_CLASSES,
84
+ t as DEFAULT_COLOR,
85
+ e as DEFAULT_VARIANT,
86
+ d as LINE_HEIGHT_CLASSES,
87
+ a as VARIANT_CLASSES,
88
+ r as VARIANT_MAP,
89
+ b as WEIGHT_CLASSES,
90
+ o as WEIGHT_VALUES
91
+ };
@@ -1,152 +1,89 @@
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 = {
6
- h1: "h1",
7
- h2: "h2",
8
- h3: "h3",
9
- h4: "h4",
10
- h5: "h5",
11
- h6: "h6",
12
- subtitle1: "h6",
13
- subtitle2: "h6",
14
- body1: "p",
15
- body2: "p",
16
- caption: "span",
17
- overline: "span",
18
- code: "code",
19
- inherit: "span"
20
- }, w = {
21
- h1: "bear-text-5xl bear-font-bold bear-tracking-tight",
22
- h2: "bear-text-4xl bear-font-bold bear-tracking-tight",
23
- h3: "bear-text-3xl bear-font-semibold",
24
- h4: "bear-text-2xl bear-font-semibold",
25
- h5: "bear-text-xl bear-font-medium",
26
- h6: "bear-text-lg bear-font-medium",
27
- subtitle1: "bear-text-lg bear-font-normal",
28
- subtitle2: "bear-text-base bear-font-medium",
29
- body1: "bear-text-base bear-font-normal",
30
- body2: "bear-text-sm bear-font-normal",
31
- caption: "bear-text-xs",
32
- overline: "bear-text-xs bear-uppercase bear-tracking-wider",
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 = {
37
- thin: "bear-font-thin",
38
- light: "bear-font-light",
39
- normal: "bear-font-normal",
40
- medium: "bear-font-medium",
41
- semibold: "bear-font-semibold",
42
- bold: "bear-font-bold",
43
- extrabold: "bear-font-extrabold"
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 = {
53
- left: "bear-text-left",
54
- center: "bear-text-center",
55
- right: "bear-text-right",
56
- justify: "bear-text-justify"
57
- }, g = {
58
- primary: "bear-text-gray-900 dark:bear-text-gray-100",
59
- secondary: "bear-text-gray-600 dark:bear-text-gray-400",
60
- muted: "bear-text-gray-400 dark:bear-text-gray-500",
61
- success: "bear-text-green-600 dark:bear-text-green-400",
62
- danger: "bear-text-red-600 dark:bear-text-red-400",
63
- warning: "bear-text-amber-600 dark:bear-text-amber-400"
64
- }, j = {
65
- tight: "bear-leading-tight",
66
- normal: "bear-leading-normal",
67
- relaxed: "bear-leading-relaxed",
68
- loose: "bear-leading-loose"
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
104
- }) => {
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(() => {
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { useContext as k, useMemo as m } from "react";
3
+ import { BearContext as v } from "../../context/BearProvider.js";
4
+ import { GradientText as F } from "../GradientText/GradientText.js";
5
+ import { Typewriter as G } from "../Typewriter/Typewriter.js";
6
+ import { DEFAULT_VARIANT as O, DEFAULT_COLOR as V, VARIANT_MAP as U, WEIGHT_VALUES as z, LINE_HEIGHT_CLASSES as D, COLOR_CLASSES as T, ALIGN_CLASSES as M, WEIGHT_CLASSES as j, VARIANT_CLASSES as P, BUILT_IN_VARIANTS as $ } from "./Typography.const.js";
7
+ import { cn as q } from "../../utils/cn.js";
8
+ const re = (A) => {
9
+ const {
10
+ variant: r = O,
11
+ component: l,
12
+ align: h,
13
+ weight: u,
14
+ color: i = V,
15
+ truncate: f = !1,
16
+ maxLines: s,
17
+ italic: C = !1,
18
+ underline: b = !1,
19
+ strikethrough: L = !1,
20
+ noWrap: I = !1,
21
+ inline: y = !1,
22
+ paragraph: E = !1,
23
+ lineHeight: g,
24
+ gradient: p,
25
+ typewriter: t,
26
+ children: _,
27
+ className: x,
28
+ style: B,
29
+ testId: N,
30
+ ...W
31
+ } = A, n = k(v), a = $.includes(r), e = m(() => {
32
+ if (!(a || !(n != null && n.customTypography)))
33
+ return n.customTypography[r];
34
+ }, [a, n == null ? void 0 : n.customTypography, r]), w = m(() => l || (e != null && e.component ? e.component : a ? U[r] : "span"), [l, e, a, r]), S = i && !(i in T), H = m(() => {
109
35
  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,
36
+ const o = {};
37
+ return e.fontSize && (o.fontSize = e.fontSize), e.lineHeight && (o.lineHeight = e.lineHeight), e.letterSpacing && (o.letterSpacing = e.letterSpacing), e.textTransform && (o.textTransform = e.textTransform), e.fontFamily && (o.fontFamily = e.fontFamily), e.fontWeight && (o.fontWeight = typeof e.fontWeight == "number" ? e.fontWeight : z[e.fontWeight] || 400), o;
38
+ }, [e]), d = t ? /* @__PURE__ */ c(
39
+ G,
115
40
  {
116
- className: L(
41
+ text: t.texts,
42
+ loop: t.loop ?? !0,
43
+ speed: t.speed,
44
+ deleteSpeed: t.deleteSpeed,
45
+ cursor: t.cursor ?? !0,
46
+ cursorChar: t.cursorChar,
47
+ as: "span"
48
+ }
49
+ ) : _, R = p && Array.isArray(p) && p.length >= 2 ? /* @__PURE__ */ c(F, { colors: p, className: y ? "bear-inline" : void 0, children: d }) : d;
50
+ return /* @__PURE__ */ c(
51
+ w,
52
+ {
53
+ className: q(
117
54
  "Bear-Typography",
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
55
+ `Bear-Typography--${r}`,
56
+ a && P[r],
57
+ u && j[u],
58
+ h && M[h],
59
+ !S && i && T[i],
60
+ g && D[g],
61
+ C && "Bear-Typography--italic bear-italic",
62
+ b && "Bear-Typography--underline bear-underline",
63
+ L && "Bear-Typography--strikethrough bear-line-through",
64
+ I && "bear-whitespace-nowrap",
65
+ y && "bear-inline",
66
+ E && "bear-mb-4",
67
+ f && !s && "Bear-Typography--truncate bear-truncate",
68
+ f && s && "bear-overflow-hidden",
69
+ x
133
70
  ),
134
71
  style: {
135
- ...E,
136
- ...A,
137
- ...m && { color: o },
138
- ...l && b && {
72
+ ...H,
73
+ ...B,
74
+ ...S && { color: i },
75
+ ...f && s && {
139
76
  display: "-webkit-box",
140
- WebkitLineClamp: b,
77
+ WebkitLineClamp: s,
141
78
  WebkitBoxOrient: "vertical"
142
79
  }
143
80
  },
144
- "data-testid": C,
145
- ...I,
146
- children: T
81
+ "data-testid": N,
82
+ ...W,
83
+ children: R
147
84
  }
148
85
  );
149
86
  };
150
87
  export {
151
- P as Typography
88
+ re as Typography
152
89
  };
@@ -57,6 +57,23 @@ export interface TypographyProps extends HTMLAttributes<HTMLElement> {
57
57
  paragraph?: boolean;
58
58
  /** Custom line height */
59
59
  lineHeight?: 'tight' | 'normal' | 'relaxed' | 'loose';
60
+ /**
61
+ * Gradient text (grid-table portal style). Wraps content in GradientText with these colors.
62
+ * @example gradient={['#22c55e', '#16a34a']}
63
+ */
64
+ gradient?: [string, string] | string[];
65
+ /**
66
+ * Typewriter effect (grid-table portal style). Cycles through texts with typing animation.
67
+ * When set, children are ignored and typewriter texts are used.
68
+ */
69
+ typewriter?: {
70
+ texts: string[];
71
+ loop?: boolean;
72
+ speed?: number;
73
+ deleteSpeed?: number;
74
+ cursor?: boolean;
75
+ cursorChar?: string;
76
+ };
60
77
  /** Content */
61
78
  children?: ReactNode;
62
79
  /** Test ID */