@forgedevstack/bear 1.0.8 → 1.0.9

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 (193) hide show
  1. package/dist/components/ActivityItem/ActivityItem.cjs +1 -1
  2. package/dist/components/ActivityItem/ActivityItem.js +1 -0
  3. package/dist/components/Alert/Alert.const.cjs +1 -1
  4. package/dist/components/Alert/Alert.const.js +3 -2
  5. package/dist/components/AppBar/AppBar.cjs +1 -1
  6. package/dist/components/AppBar/AppBar.js +3 -2
  7. package/dist/components/Badge/Badge.cjs +1 -1
  8. package/dist/components/Badge/Badge.js +15 -14
  9. package/dist/components/BearLogo/EmberLogo.cjs +1 -1
  10. package/dist/components/BearLogo/EmberLogo.js +3 -2
  11. package/dist/components/BottomNavigation/BottomNavigation.cjs +1 -1
  12. package/dist/components/BottomNavigation/BottomNavigation.js +3 -2
  13. package/dist/components/Carousel/Carousel.cjs +1 -1
  14. package/dist/components/Carousel/Carousel.const.cjs +1 -0
  15. package/dist/components/Carousel/Carousel.const.d.ts +12 -0
  16. package/dist/components/Carousel/Carousel.const.js +9 -0
  17. package/dist/components/Carousel/Carousel.d.ts +14 -3
  18. package/dist/components/Carousel/Carousel.js +222 -75
  19. package/dist/components/Carousel/Carousel.types.d.ts +32 -2
  20. package/dist/components/Carousel/index.d.ts +1 -1
  21. package/dist/components/Chip/Chip.cjs +1 -1
  22. package/dist/components/Chip/Chip.js +3 -2
  23. package/dist/components/CodeEditor/CodeEditor.cjs +5 -0
  24. package/dist/components/CodeEditor/CodeEditor.const.cjs +1 -0
  25. package/dist/components/CodeEditor/CodeEditor.const.d.ts +21 -0
  26. package/dist/components/CodeEditor/CodeEditor.const.js +119 -0
  27. package/dist/components/CodeEditor/CodeEditor.d.ts +22 -0
  28. package/dist/components/CodeEditor/CodeEditor.js +250 -0
  29. package/dist/components/CodeEditor/CodeEditor.types.d.ts +80 -0
  30. package/dist/components/CodeEditor/CodeEditor.utils.cjs +1 -0
  31. package/dist/components/CodeEditor/CodeEditor.utils.d.ts +6 -0
  32. package/dist/components/CodeEditor/CodeEditor.utils.js +75 -0
  33. package/dist/components/CodeEditor/index.d.ts +2 -0
  34. package/dist/components/Columns/Columns.cjs +1 -1
  35. package/dist/components/Columns/Columns.js +9 -8
  36. package/dist/components/CountdownTimer/CountdownTimer.cjs +1 -0
  37. package/dist/components/CountdownTimer/CountdownTimer.const.cjs +1 -0
  38. package/dist/components/CountdownTimer/CountdownTimer.const.d.ts +27 -0
  39. package/dist/components/CountdownTimer/CountdownTimer.const.js +35 -0
  40. package/dist/components/CountdownTimer/CountdownTimer.d.ts +7 -0
  41. package/dist/components/CountdownTimer/CountdownTimer.js +115 -0
  42. package/dist/components/CountdownTimer/CountdownTimer.types.d.ts +56 -0
  43. package/dist/components/CountdownTimer/index.d.ts +2 -0
  44. package/dist/components/Cropper/Cropper.cjs +1 -0
  45. package/dist/components/Cropper/Cropper.const.cjs +1 -0
  46. package/dist/components/Cropper/Cropper.const.d.ts +31 -0
  47. package/dist/components/Cropper/Cropper.const.js +33 -0
  48. package/dist/components/Cropper/Cropper.d.ts +21 -0
  49. package/dist/components/Cropper/Cropper.js +362 -0
  50. package/dist/components/Cropper/Cropper.types.d.ts +72 -0
  51. package/dist/components/Cropper/index.d.ts +2 -0
  52. package/dist/components/DataTable/DataTable.cjs +1 -1
  53. package/dist/components/DataTable/DataTable.js +5 -4
  54. package/dist/components/Divider/Divider.cjs +1 -1
  55. package/dist/components/Divider/Divider.js +15 -14
  56. package/dist/components/Dock/Dock.cjs +1 -0
  57. package/dist/components/Dock/Dock.const.cjs +1 -0
  58. package/dist/components/Dock/Dock.const.d.ts +25 -0
  59. package/dist/components/Dock/Dock.const.js +22 -0
  60. package/dist/components/Dock/Dock.d.ts +7 -0
  61. package/dist/components/Dock/Dock.js +144 -0
  62. package/dist/components/Dock/Dock.types.d.ts +42 -0
  63. package/dist/components/Dock/index.d.ts +2 -0
  64. package/dist/components/EmptyState/EmptyState.cjs +1 -1
  65. package/dist/components/EmptyState/EmptyState.js +7 -6
  66. package/dist/components/GradientText/GradientText.cjs +1 -0
  67. package/dist/components/GradientText/GradientText.const.cjs +1 -0
  68. package/dist/components/GradientText/GradientText.const.d.ts +15 -0
  69. package/dist/components/GradientText/GradientText.const.js +36 -0
  70. package/dist/components/GradientText/GradientText.d.ts +7 -0
  71. package/dist/components/GradientText/GradientText.js +52 -0
  72. package/dist/components/GradientText/GradientText.types.d.ts +27 -0
  73. package/dist/components/GradientText/index.d.ts +2 -0
  74. package/dist/components/Highlight/Highlight.cjs +1 -1
  75. package/dist/components/Highlight/Highlight.const.cjs +1 -0
  76. package/dist/components/Highlight/Highlight.const.d.ts +8 -0
  77. package/dist/components/Highlight/Highlight.const.js +15 -0
  78. package/dist/components/Highlight/Highlight.d.ts +4 -0
  79. package/dist/components/Highlight/Highlight.js +32 -24
  80. package/dist/components/Highlight/Highlight.types.d.ts +9 -1
  81. package/dist/components/Highlight/index.d.ts +1 -1
  82. package/dist/components/Icon/Icon.cjs +1 -1
  83. package/dist/components/Icon/Icon.js +17 -16
  84. package/dist/components/Icon/index.cjs +1 -1
  85. package/dist/components/Icon/index.js +12 -11
  86. package/dist/components/Kbd/Kbd.cjs +1 -1
  87. package/dist/components/Kbd/Kbd.js +17 -16
  88. package/dist/components/Map/Map.cjs +1 -0
  89. package/dist/components/Map/Map.const.cjs +1 -0
  90. package/dist/components/Map/Map.const.d.ts +20 -0
  91. package/dist/components/Map/Map.const.js +26 -0
  92. package/dist/components/Map/Map.d.ts +20 -0
  93. package/dist/components/Map/Map.js +259 -0
  94. package/dist/components/Map/Map.types.d.ts +81 -0
  95. package/dist/components/Map/index.d.ts +2 -0
  96. package/dist/components/Marquee/Marquee.cjs +1 -0
  97. package/dist/components/Marquee/Marquee.const.cjs +1 -0
  98. package/dist/components/Marquee/Marquee.const.d.ts +11 -0
  99. package/dist/components/Marquee/Marquee.const.js +12 -0
  100. package/dist/components/Marquee/Marquee.d.ts +7 -0
  101. package/dist/components/Marquee/Marquee.js +106 -0
  102. package/dist/components/Marquee/Marquee.types.d.ts +32 -0
  103. package/dist/components/Marquee/index.d.ts +2 -0
  104. package/dist/components/Masonry/Masonry.cjs +1 -0
  105. package/dist/components/Masonry/Masonry.const.cjs +1 -0
  106. package/dist/components/Masonry/Masonry.const.d.ts +9 -0
  107. package/dist/components/Masonry/Masonry.const.js +9 -0
  108. package/dist/components/Masonry/Masonry.d.ts +7 -0
  109. package/dist/components/Masonry/Masonry.js +51 -0
  110. package/dist/components/Masonry/Masonry.types.d.ts +21 -0
  111. package/dist/components/Masonry/index.d.ts +2 -0
  112. package/dist/components/NavigableSelect/NavigableSelect.cjs +1 -0
  113. package/dist/components/NavigableSelect/NavigableSelect.const.cjs +1 -0
  114. package/dist/components/NavigableSelect/NavigableSelect.const.d.ts +23 -0
  115. package/dist/components/NavigableSelect/NavigableSelect.const.js +33 -0
  116. package/dist/components/NavigableSelect/NavigableSelect.d.ts +7 -0
  117. package/dist/components/NavigableSelect/NavigableSelect.js +361 -0
  118. package/dist/components/NavigableSelect/NavigableSelect.types.d.ts +56 -0
  119. package/dist/components/NavigableSelect/index.d.ts +2 -0
  120. package/dist/components/Progress/Progress.cjs +1 -1
  121. package/dist/components/Progress/Progress.js +3 -2
  122. package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
  123. package/dist/components/RichEditor/components/ToolbarButton/ToolbarButton.js +3 -2
  124. package/dist/components/ScrollArea/ScrollArea.cjs +1 -1
  125. package/dist/components/ScrollArea/ScrollArea.js +3 -2
  126. package/dist/components/Sidebar/Sidebar.cjs +1 -1
  127. package/dist/components/Sidebar/Sidebar.js +13 -12
  128. package/dist/components/Spinner/Spinner.cjs +1 -1
  129. package/dist/components/Spinner/Spinner.js +3 -2
  130. package/dist/components/Spotlight/Spotlight.cjs +1 -0
  131. package/dist/components/Spotlight/Spotlight.const.cjs +1 -0
  132. package/dist/components/Spotlight/Spotlight.const.d.ts +18 -0
  133. package/dist/components/Spotlight/Spotlight.const.js +9 -0
  134. package/dist/components/Spotlight/Spotlight.d.ts +7 -0
  135. package/dist/components/Spotlight/Spotlight.js +220 -0
  136. package/dist/components/Spotlight/Spotlight.types.d.ts +51 -0
  137. package/dist/components/Spotlight/index.d.ts +2 -0
  138. package/dist/components/StatCard/StatCard.cjs +1 -1
  139. package/dist/components/StatCard/StatCard.js +9 -8
  140. package/dist/components/Statistic/Statistic.cjs +1 -1
  141. package/dist/components/Statistic/Statistic.js +7 -6
  142. package/dist/components/Switch/Switch.cjs +1 -1
  143. package/dist/components/Switch/Switch.js +11 -10
  144. package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.cjs +1 -1
  145. package/dist/components/TimePicker/components/TimePickerColumnsDropdown/TimePickerColumnsDropdown.js +16 -15
  146. package/dist/components/TimePicker/helpers/ClockFaceSvg.cjs +1 -1
  147. package/dist/components/TimePicker/helpers/ClockFaceSvg.js +13 -12
  148. package/dist/components/Transition/Transition.cjs +1 -0
  149. package/dist/components/Transition/Transition.const.cjs +1 -0
  150. package/dist/components/Transition/Transition.const.d.ts +15 -0
  151. package/dist/components/Transition/Transition.const.js +73 -0
  152. package/dist/components/Transition/Transition.d.ts +37 -0
  153. package/dist/components/Transition/Transition.js +107 -0
  154. package/dist/components/Transition/Transition.types.d.ts +69 -0
  155. package/dist/components/Transition/index.d.ts +2 -0
  156. package/dist/components/Typewriter/Typewriter.cjs +1 -0
  157. package/dist/components/Typewriter/Typewriter.const.cjs +1 -0
  158. package/dist/components/Typewriter/Typewriter.const.d.ts +22 -0
  159. package/dist/components/Typewriter/Typewriter.const.js +11 -0
  160. package/dist/components/Typewriter/Typewriter.d.ts +7 -0
  161. package/dist/components/Typewriter/Typewriter.js +88 -0
  162. package/dist/components/Typewriter/Typewriter.types.d.ts +32 -0
  163. package/dist/components/Typewriter/index.d.ts +2 -0
  164. package/dist/components/Watermark/Watermark.cjs +1 -0
  165. package/dist/components/Watermark/Watermark.const.cjs +1 -0
  166. package/dist/components/Watermark/Watermark.const.d.ts +30 -0
  167. package/dist/components/Watermark/Watermark.const.js +18 -0
  168. package/dist/components/Watermark/Watermark.d.ts +7 -0
  169. package/dist/components/Watermark/Watermark.js +96 -0
  170. package/dist/components/Watermark/Watermark.types.d.ts +35 -0
  171. package/dist/components/Watermark/index.d.ts +2 -0
  172. package/dist/components/index.cjs +1 -1
  173. package/dist/components/index.d.ts +27 -1
  174. package/dist/components/index.js +231 -204
  175. package/dist/hooks/index.cjs +1 -1
  176. package/dist/hooks/index.d.ts +4 -0
  177. package/dist/hooks/index.js +24 -19
  178. package/dist/hooks/useAnimate.cjs +1 -0
  179. package/dist/hooks/useAnimate.d.ts +61 -0
  180. package/dist/hooks/useAnimate.js +125 -0
  181. package/dist/hooks/useResponsive.cjs +1 -0
  182. package/dist/hooks/useResponsive.d.ts +35 -0
  183. package/dist/hooks/useResponsive.js +74 -0
  184. package/dist/index.cjs +1 -1
  185. package/dist/index.js +324 -290
  186. package/dist/styles.css +1 -1
  187. package/dist/utils/createSlots.cjs +1 -0
  188. package/dist/utils/createSlots.d.ts +70 -0
  189. package/dist/utils/createSlots.js +65 -0
  190. package/dist/utils/index.cjs +1 -1
  191. package/dist/utils/index.d.ts +2 -0
  192. package/dist/utils/index.js +4 -2
  193. package/package.json +1 -1
@@ -1,10 +1,18 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactNode, CSSProperties } from 'react';
2
+ /**
3
+ * Carousel transition effect
4
+ */
5
+ export type CarouselTransition = 'slide' | 'fade' | 'zoom' | 'flip';
6
+ /**
7
+ * Carousel indicator style
8
+ */
9
+ export type CarouselIndicator = 'dots' | 'numbers' | 'thumbnails' | 'bars' | 'none';
2
10
  export interface CarouselProps {
3
11
  /** Carousel slides */
4
12
  children: ReactNode;
5
13
  /** Auto-play interval in ms (0 to disable) */
6
14
  autoPlay?: number;
7
- /** Show navigation dots */
15
+ /** Show navigation dots/indicators */
8
16
  showDots?: boolean;
9
17
  /** Show arrow buttons */
10
18
  showArrows?: boolean;
@@ -18,8 +26,30 @@ export interface CarouselProps {
18
26
  pauseOnHover?: boolean;
19
27
  /** Called when slide changes */
20
28
  onSlideChange?: (index: number) => void;
29
+ /** Transition effect */
30
+ transition?: CarouselTransition;
31
+ /** Transition duration in ms */
32
+ transitionDuration?: number;
33
+ /** Indicator style */
34
+ indicator?: CarouselIndicator;
35
+ /** Thumbnail images for 'thumbnails' indicator */
36
+ thumbnails?: string[];
37
+ /** Thumbnail size in px */
38
+ thumbnailSize?: number;
39
+ /** Enable keyboard navigation */
40
+ keyboard?: boolean;
41
+ /** Enable drag/swipe to navigate */
42
+ draggable?: boolean;
43
+ /** Show progress bar */
44
+ showProgress?: boolean;
45
+ /** Show slide counter */
46
+ showCounter?: boolean;
47
+ /** Active dot/indicator color */
48
+ activeColor?: string;
21
49
  /** Custom class name */
22
50
  className?: string;
51
+ /** Custom styles */
52
+ style?: CSSProperties;
23
53
  /** Test ID */
24
54
  testId?: string;
25
55
  }
@@ -1,2 +1,2 @@
1
1
  export { Carousel } from './Carousel';
2
- export type { CarouselProps } from './Carousel.types';
2
+ export type { CarouselProps, CarouselTransition, CarouselIndicator } from './Carousel.types';
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../../utils/cn.cjs"),m=({children:l,variant:i="filled",color:c="default",size:b="md",icon:t,avatar:o,onDelete:n,onClick:a,disabled:r=!1,className:d})=>{const p={filled:{default:"bear-bg-zinc-600 bear-text-white",primary:"bear-bg-pink-500 bear-text-white",secondary:"bear-bg-purple-500 bear-text-white",success:"bear-bg-green-500 bear-text-white",warning:"bear-bg-yellow-500 bear-text-black",error:"bear-bg-red-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white"},outlined:{default:"bear-border bear-border-zinc-500 bear-text-zinc-300",primary:"bear-border bear-border-pink-500 bear-text-pink-400",secondary:"bear-border bear-border-purple-500 bear-text-purple-400",success:"bear-border bear-border-green-500 bear-text-green-400",warning:"bear-border bear-border-yellow-500 bear-text-yellow-400",error:"bear-border bear-border-red-500 bear-text-red-400",info:"bear-border bear-border-blue-500 bear-text-blue-400"},soft:{default:"bear-bg-zinc-500/20 bear-text-zinc-300",primary:"bear-bg-pink-500/20 bear-text-pink-400",secondary:"bear-bg-purple-500/20 bear-text-purple-400",success:"bear-bg-green-500/20 bear-text-green-400",warning:"bear-bg-yellow-500/20 bear-text-yellow-400",error:"bear-bg-red-500/20 bear-text-red-400",info:"bear-bg-blue-500/20 bear-text-blue-400"}},u={sm:"bear-h-6 bear-text-xs bear-px-2 bear-gap-1",md:"bear-h-8 bear-text-sm bear-px-3 bear-gap-1.5",lg:"bear-h-10 bear-text-base bear-px-4 bear-gap-2"},x={sm:"bear-w-3 bear-h-3",md:"bear-w-4 bear-h-4",lg:"bear-w-5 bear-h-5"},g=a?"button":"span";return e.jsxs(g,{onClick:a,disabled:r,className:s.cn("bear-inline-flex bear-items-center bear-rounded-full bear-font-medium bear-transition-all",u[b],p[i][c],a&&!r&&"bear-cursor-pointer hover:bear-opacity-80",r&&"bear-opacity-50 bear-cursor-not-allowed",d),children:[o&&e.jsx("span",{className:"bear--ml-1",children:o}),t&&e.jsx("span",{children:t}),e.jsx("span",{children:l}),n&&e.jsx("button",{onClick:h=>{h.stopPropagation(),n()},disabled:r,className:s.cn("bear-ml-1 bear-rounded-full bear-p-0.5 hover:bear-bg-black/20 bear-transition-colors",r&&"bear-cursor-not-allowed"),children:e.jsx("svg",{className:x[b],fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};exports.Chip=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../../utils/cn.cjs");require("react");const m=({children:l,variant:i="filled",color:c="default",size:b="md",icon:t,avatar:o,onDelete:n,onClick:a,disabled:r=!1,className:d})=>{const p={filled:{default:"bear-bg-zinc-600 bear-text-white",primary:"bear-bg-pink-500 bear-text-white",secondary:"bear-bg-purple-500 bear-text-white",success:"bear-bg-green-500 bear-text-white",warning:"bear-bg-yellow-500 bear-text-black",error:"bear-bg-red-500 bear-text-white",info:"bear-bg-blue-500 bear-text-white"},outlined:{default:"bear-border bear-border-zinc-500 bear-text-zinc-300",primary:"bear-border bear-border-pink-500 bear-text-pink-400",secondary:"bear-border bear-border-purple-500 bear-text-purple-400",success:"bear-border bear-border-green-500 bear-text-green-400",warning:"bear-border bear-border-yellow-500 bear-text-yellow-400",error:"bear-border bear-border-red-500 bear-text-red-400",info:"bear-border bear-border-blue-500 bear-text-blue-400"},soft:{default:"bear-bg-zinc-500/20 bear-text-zinc-300",primary:"bear-bg-pink-500/20 bear-text-pink-400",secondary:"bear-bg-purple-500/20 bear-text-purple-400",success:"bear-bg-green-500/20 bear-text-green-400",warning:"bear-bg-yellow-500/20 bear-text-yellow-400",error:"bear-bg-red-500/20 bear-text-red-400",info:"bear-bg-blue-500/20 bear-text-blue-400"}},u={sm:"bear-h-6 bear-text-xs bear-px-2 bear-gap-1",md:"bear-h-8 bear-text-sm bear-px-3 bear-gap-1.5",lg:"bear-h-10 bear-text-base bear-px-4 bear-gap-2"},x={sm:"bear-w-3 bear-h-3",md:"bear-w-4 bear-h-4",lg:"bear-w-5 bear-h-5"},g=a?"button":"span";return e.jsxs(g,{onClick:a,disabled:r,className:s.cn("bear-inline-flex bear-items-center bear-rounded-full bear-font-medium bear-transition-all",u[b],p[i][c],a&&!r&&"bear-cursor-pointer hover:bear-opacity-80",r&&"bear-opacity-50 bear-cursor-not-allowed",d),children:[o&&e.jsx("span",{className:"bear--ml-1",children:o}),t&&e.jsx("span",{children:t}),e.jsx("span",{children:l}),n&&e.jsx("button",{onClick:h=>{h.stopPropagation(),n()},disabled:r,className:s.cn("bear-ml-1 bear-rounded-full bear-p-0.5 hover:bear-bg-black/20 bear-transition-colors",r&&"bear-cursor-not-allowed"),children:e.jsx("svg",{className:x[b],fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})};exports.Chip=m;
@@ -1,6 +1,7 @@
1
1
  import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
2
  import { cn as l } from "../../utils/cn.js";
3
- const y = ({
3
+ import "react";
4
+ const k = ({
4
5
  children: s,
5
6
  variant: i = "filled",
6
7
  color: p = "default",
@@ -81,5 +82,5 @@ const y = ({
81
82
  );
82
83
  };
83
84
  export {
84
- y as Chip
85
+ k as Chip
85
86
  };
@@ -0,0 +1,5 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),s=require("react"),ie=require("../../utils/cn.cjs"),l=require("./CodeEditor.const.cjs"),le=require("./CodeEditor.utils.cjs"),oe=({value:n,onChange:r,language:S="typescript",theme:I="dark",customTheme:f,placeholder:B="Start typing...",showLineNumbers:T=!0,showGutter:_=!0,highlightActiveLine:G=!0,readOnly:p=!1,fontSize:v=l.DEFAULT_FONT_SIZE,fontFamily:N=l.DEFAULT_FONT_FAMILY,tabSize:k=l.DEFAULT_TAB_SIZE,autoIndent:j=!0,autoCloseBrackets:H=!0,wordWrap:x=!1,minHeight:w,maxHeight:D,height:q,className:O,style:Y,testId:Z,onFocus:g,onBlur:L})=>{const y=s.useRef(null),[R,F]=s.useState(!1),[A,J]=s.useState(0),[M,Q]=s.useState(0),[X,W]=s.useState(0),U=I==="dark"?l.DARK_THEME:l.LIGHT_THEME,a=s.useMemo(()=>({...U,...f,tokens:{...U.tokens,...f==null?void 0:f.tokens}}),[I,f]),h=s.useMemo(()=>n.split(`
2
+ `),[n]),z=s.useMemo(()=>h.map(e=>le.tokenizeLine(e,S)),[h,S]),K=s.useCallback(()=>{const e=y.current;if(!e)return;const t=e.value.substring(0,e.selectionStart);J(t.split(`
3
+ `).length-1)},[]),C=s.useCallback(e=>{var V;if(p)return;const t=y.current;if(!t)return;const{selectionStart:i,selectionEnd:d}=t;if(e.key==="Tab"){e.preventDefault();const c=" ".repeat(k),b=n.substring(0,i),E=n.substring(d),u=b+c+E;r==null||r(u),requestAnimationFrame(()=>{t.selectionStart=t.selectionEnd=i+k});return}if(e.key==="Enter"&&j){e.preventDefault();const c=n.substring(0,i),b=n.substring(d),u=((V=(c.split(`
4
+ `).pop()??"").match(/^\s*/))==null?void 0:V[0])??"",m=c.trim().slice(-1),$=["{","(","[",":"].includes(m)?" ".repeat(k):"",ne=c+`
5
+ `+u+$+b;r==null||r(ne),requestAnimationFrame(()=>{const ae=i+1+u.length+$.length;t.selectionStart=t.selectionEnd=ae});return}if(H&&l.AUTO_CLOSE_PAIRS[e.key]){e.preventDefault();const c=l.AUTO_CLOSE_PAIRS[e.key],b=n.substring(0,i),E=n.substring(i,d),u=n.substring(d);if(E){const m=b+e.key+E+c+u;r==null||r(m),requestAnimationFrame(()=>{t.selectionStart=i+1,t.selectionEnd=d+1})}else{const m=b+e.key+c+u;r==null||r(m),requestAnimationFrame(()=>{t.selectionStart=t.selectionEnd=i+1})}return}},[n,r,p,k,j,H]),ee=s.useCallback(e=>{p||r==null||r(e.target.value)},[r,p]),te=s.useCallback(()=>{const e=y.current;e&&(Q(e.scrollTop),W(e.scrollLeft))},[]),re=s.useCallback(()=>{F(!0),g==null||g()},[g]),se=s.useCallback(()=>{F(!1),L==null||L()},[L]),P=v*l.LINE_HEIGHT;return o.jsxs("div",{className:ie.cn("bear-relative bear-overflow-hidden bear-rounded-lg bear-font-mono","bear-border",R?"bear-ring-2 bear-ring-offset-1":"",O),style:{background:a.background,borderColor:a.gutterBorder,fontFamily:N,fontSize:v,lineHeight:l.LINE_HEIGHT,minHeight:w,maxHeight:D,height:q,"--bear-editor-ring":"var(--bear-primary-500)",...Y},"data-testid":Z,children:[o.jsxs("div",{className:"bear-relative bear-flex bear-h-full",children:[_&&T&&o.jsx("div",{className:"bear-flex-shrink-0 bear-select-none bear-text-right bear-pr-3 bear-overflow-hidden",style:{width:l.GUTTER_WIDTH,background:a.gutterBackground,borderRight:`1px solid ${a.gutterBorder}`,paddingTop:12,transform:`translateY(-${M}px)`},"aria-hidden":"true",children:h.map((e,t)=>o.jsx("div",{style:{height:P,color:t===A?a.lineNumberActive:a.lineNumber,fontWeight:t===A?600:400},children:t+1},t))}),o.jsxs("div",{className:"bear-relative bear-flex-1 bear-overflow-hidden",children:[o.jsx("div",{className:"bear-absolute bear-inset-0 bear-pointer-events-none bear-overflow-hidden",style:{padding:12,paddingLeft:_&&!T?12:16,transform:`translate(-${X}px, -${M}px)`,whiteSpace:x?"pre-wrap":"pre",wordBreak:x?"break-all":"normal"},"aria-hidden":"true",children:z.map((e,t)=>o.jsxs("div",{style:{height:P,background:G&&t===A&&R?a.selection:"transparent"},children:[e.map((i,d)=>o.jsx("span",{style:{color:a.tokens[i.type]??a.foreground},children:i.value},d)),e.length===0&&" "]},t))}),o.jsx("textarea",{ref:y,value:n,onChange:ee,onKeyDown:C,onScroll:te,onFocus:re,onBlur:se,onClick:K,onKeyUp:K,readOnly:p,placeholder:n?void 0:B,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",className:"bear-w-full bear-h-full bear-resize-none bear-outline-none",style:{padding:12,paddingLeft:_&&!T?12:16,background:"transparent",color:"transparent",caretColor:a.cursor,fontFamily:N,fontSize:v,lineHeight:l.LINE_HEIGHT,tabSize:k,whiteSpace:x?"pre-wrap":"pre",wordBreak:x?"break-all":"normal",minHeight:w??100,maxHeight:D,height:q??"auto"}})]})]}),o.jsx("div",{className:"bear-absolute bear-bottom-2 bear-right-3 bear-text-xs bear-font-medium bear-px-2 bear-py-0.5 bear-rounded bear-select-none",style:{color:a.lineNumber,background:a.gutterBackground},children:S})]})};exports.CodeEditor=oe;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=14,t="'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace",a=2,n=56,r=1.6,o={background:"#1e1e2e",foreground:"#cdd6f4",cursor:"#f5e0dc",selection:"rgba(137, 180, 250, 0.2)",lineNumber:"#585b70",lineNumberActive:"#a6adc8",gutterBackground:"#181825",gutterBorder:"#313244",tokens:{keyword:"#cba6f7",string:"#a6e3a1",number:"#fab387",comment:"#6c7086",operator:"#89dceb",punctuation:"#a6adc8",function:"#89b4fa",variable:"#f5e0dc",tag:"#f38ba8",attribute:"#f9e2af",property:"#89b4fa",builtin:"#f5c2e7",regex:"#a6e3a1",boolean:"#fab387",null:"#f38ba8",type:"#f9e2af",default:"#cdd6f4"}},i={background:"#eff1f5",foreground:"#4c4f69",cursor:"#dc8a78",selection:"rgba(114, 135, 253, 0.15)",lineNumber:"#9ca0b0",lineNumberActive:"#4c4f69",gutterBackground:"#e6e9ef",gutterBorder:"#ccd0da",tokens:{keyword:"#8839ef",string:"#40a02b",number:"#fe640b",comment:"#9ca0b0",operator:"#04a5e5",punctuation:"#6c6f85",function:"#1e66f5",variable:"#dc8a78",tag:"#d20f39",attribute:"#df8e1d",property:"#1e66f5",builtin:"#ea76cb",regex:"#40a02b",boolean:"#fe640b",null:"#d20f39",type:"#df8e1d",default:"#4c4f69"}},s={"(":")","[":"]","{":"}",'"':'"',"'":"'","`":"`"},c={javascript:["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","new","delete","typeof","instanceof","in","of","class","extends","super","this","import","export","from","default","async","await","try","catch","finally","throw","yield","void","null","undefined","true","false","NaN","Infinity"],typescript:["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","new","delete","typeof","instanceof","in","of","class","extends","super","this","import","export","from","default","async","await","try","catch","finally","throw","yield","void","null","undefined","true","false","interface","type","enum","implements","abstract","private","protected","public","readonly","static","as","is","keyof","never","unknown","any","string","number","boolean","object","symbol","bigint"],jsx:["const","let","var","function","return","if","else","for","while","class","extends","import","export","from","default","async","await","try","catch","throw","new","this","super","null","undefined","true","false"],tsx:["const","let","var","function","return","if","else","for","while","class","extends","import","export","from","default","async","await","try","catch","throw","new","this","super","null","undefined","true","false","interface","type","enum","as","is","keyof"],python:["def","class","return","if","elif","else","for","while","break","continue","pass","import","from","as","try","except","finally","raise","with","yield","lambda","global","nonlocal","assert","del","in","not","and","or","is","True","False","None","async","await","self"],html:["html","head","body","div","span","p","a","img","input","button","form","table","tr","td","th","ul","ol","li","h1","h2","h3","h4","h5","h6","section","header","footer","nav","main","article","aside","script","style","link","meta"],css:["color","background","margin","padding","border","display","position","width","height","font","text","flex","grid","align","justify","overflow","transition","animation","transform","opacity","z-index","box-shadow","cursor"],sql:["SELECT","FROM","WHERE","INSERT","INTO","UPDATE","DELETE","CREATE","DROP","ALTER","TABLE","INDEX","JOIN","LEFT","RIGHT","INNER","OUTER","ON","AND","OR","NOT","NULL","IS","IN","BETWEEN","LIKE","ORDER","BY","GROUP","HAVING","LIMIT","OFFSET","AS","SET","VALUES","DISTINCT","COUNT","SUM","AVG","MAX","MIN"],json:[],markdown:[],shell:["echo","cd","ls","mkdir","rm","cp","mv","cat","grep","sed","awk","find","chmod","chown","export","source","alias","if","then","else","fi","for","do","done","while","case","esac","function","return","exit","sudo","apt","npm","yarn","git"]},l=["console","Math","JSON","Array","Object","String","Number","Boolean","Date","RegExp","Error","Map","Set","Promise","setTimeout","setInterval","clearTimeout","clearInterval","parseInt","parseFloat","isNaN","isFinite","fetch","require","document","window","navigator","alert","confirm","prompt"];exports.AUTO_CLOSE_PAIRS=s;exports.BUILTIN_FUNCTIONS=l;exports.DARK_THEME=o;exports.DEFAULT_FONT_FAMILY=t;exports.DEFAULT_FONT_SIZE=e;exports.DEFAULT_TAB_SIZE=a;exports.GUTTER_WIDTH=n;exports.LANGUAGE_KEYWORDS=c;exports.LIGHT_THEME=i;exports.LINE_HEIGHT=r;
@@ -0,0 +1,21 @@
1
+ import { CodeEditorTheme, CodeEditorLanguage } from './CodeEditor.types';
2
+ /** Default font size */
3
+ export declare const DEFAULT_FONT_SIZE = 14;
4
+ /** Default font family */
5
+ export declare const DEFAULT_FONT_FAMILY = "'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace";
6
+ /** Default tab size */
7
+ export declare const DEFAULT_TAB_SIZE = 2;
8
+ /** Gutter width */
9
+ export declare const GUTTER_WIDTH = 56;
10
+ /** Line height multiplier */
11
+ export declare const LINE_HEIGHT = 1.6;
12
+ /** Dark theme */
13
+ export declare const DARK_THEME: CodeEditorTheme;
14
+ /** Light theme */
15
+ export declare const LIGHT_THEME: CodeEditorTheme;
16
+ /** Auto-close pairs */
17
+ export declare const AUTO_CLOSE_PAIRS: Record<string, string>;
18
+ /** Keywords per language */
19
+ export declare const LANGUAGE_KEYWORDS: Partial<Record<CodeEditorLanguage, string[]>>;
20
+ /** Builtin functions */
21
+ export declare const BUILTIN_FUNCTIONS: string[];
@@ -0,0 +1,119 @@
1
+ const e = 14, t = "'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace", a = 2, n = 56, r = 1.6, o = {
2
+ background: "#1e1e2e",
3
+ foreground: "#cdd6f4",
4
+ cursor: "#f5e0dc",
5
+ selection: "rgba(137, 180, 250, 0.2)",
6
+ lineNumber: "#585b70",
7
+ lineNumberActive: "#a6adc8",
8
+ gutterBackground: "#181825",
9
+ gutterBorder: "#313244",
10
+ tokens: {
11
+ keyword: "#cba6f7",
12
+ string: "#a6e3a1",
13
+ number: "#fab387",
14
+ comment: "#6c7086",
15
+ operator: "#89dceb",
16
+ punctuation: "#a6adc8",
17
+ function: "#89b4fa",
18
+ variable: "#f5e0dc",
19
+ tag: "#f38ba8",
20
+ attribute: "#f9e2af",
21
+ property: "#89b4fa",
22
+ builtin: "#f5c2e7",
23
+ regex: "#a6e3a1",
24
+ boolean: "#fab387",
25
+ null: "#f38ba8",
26
+ type: "#f9e2af",
27
+ default: "#cdd6f4"
28
+ }
29
+ }, i = {
30
+ background: "#eff1f5",
31
+ foreground: "#4c4f69",
32
+ cursor: "#dc8a78",
33
+ selection: "rgba(114, 135, 253, 0.15)",
34
+ lineNumber: "#9ca0b0",
35
+ lineNumberActive: "#4c4f69",
36
+ gutterBackground: "#e6e9ef",
37
+ gutterBorder: "#ccd0da",
38
+ tokens: {
39
+ keyword: "#8839ef",
40
+ string: "#40a02b",
41
+ number: "#fe640b",
42
+ comment: "#9ca0b0",
43
+ operator: "#04a5e5",
44
+ punctuation: "#6c6f85",
45
+ function: "#1e66f5",
46
+ variable: "#dc8a78",
47
+ tag: "#d20f39",
48
+ attribute: "#df8e1d",
49
+ property: "#1e66f5",
50
+ builtin: "#ea76cb",
51
+ regex: "#40a02b",
52
+ boolean: "#fe640b",
53
+ null: "#d20f39",
54
+ type: "#df8e1d",
55
+ default: "#4c4f69"
56
+ }
57
+ }, s = {
58
+ "(": ")",
59
+ "[": "]",
60
+ "{": "}",
61
+ '"': '"',
62
+ "'": "'",
63
+ "`": "`"
64
+ }, c = {
65
+ javascript: ["const", "let", "var", "function", "return", "if", "else", "for", "while", "do", "switch", "case", "break", "continue", "new", "delete", "typeof", "instanceof", "in", "of", "class", "extends", "super", "this", "import", "export", "from", "default", "async", "await", "try", "catch", "finally", "throw", "yield", "void", "null", "undefined", "true", "false", "NaN", "Infinity"],
66
+ typescript: ["const", "let", "var", "function", "return", "if", "else", "for", "while", "do", "switch", "case", "break", "continue", "new", "delete", "typeof", "instanceof", "in", "of", "class", "extends", "super", "this", "import", "export", "from", "default", "async", "await", "try", "catch", "finally", "throw", "yield", "void", "null", "undefined", "true", "false", "interface", "type", "enum", "implements", "abstract", "private", "protected", "public", "readonly", "static", "as", "is", "keyof", "never", "unknown", "any", "string", "number", "boolean", "object", "symbol", "bigint"],
67
+ jsx: ["const", "let", "var", "function", "return", "if", "else", "for", "while", "class", "extends", "import", "export", "from", "default", "async", "await", "try", "catch", "throw", "new", "this", "super", "null", "undefined", "true", "false"],
68
+ tsx: ["const", "let", "var", "function", "return", "if", "else", "for", "while", "class", "extends", "import", "export", "from", "default", "async", "await", "try", "catch", "throw", "new", "this", "super", "null", "undefined", "true", "false", "interface", "type", "enum", "as", "is", "keyof"],
69
+ python: ["def", "class", "return", "if", "elif", "else", "for", "while", "break", "continue", "pass", "import", "from", "as", "try", "except", "finally", "raise", "with", "yield", "lambda", "global", "nonlocal", "assert", "del", "in", "not", "and", "or", "is", "True", "False", "None", "async", "await", "self"],
70
+ html: ["html", "head", "body", "div", "span", "p", "a", "img", "input", "button", "form", "table", "tr", "td", "th", "ul", "ol", "li", "h1", "h2", "h3", "h4", "h5", "h6", "section", "header", "footer", "nav", "main", "article", "aside", "script", "style", "link", "meta"],
71
+ css: ["color", "background", "margin", "padding", "border", "display", "position", "width", "height", "font", "text", "flex", "grid", "align", "justify", "overflow", "transition", "animation", "transform", "opacity", "z-index", "box-shadow", "cursor"],
72
+ sql: ["SELECT", "FROM", "WHERE", "INSERT", "INTO", "UPDATE", "DELETE", "CREATE", "DROP", "ALTER", "TABLE", "INDEX", "JOIN", "LEFT", "RIGHT", "INNER", "OUTER", "ON", "AND", "OR", "NOT", "NULL", "IS", "IN", "BETWEEN", "LIKE", "ORDER", "BY", "GROUP", "HAVING", "LIMIT", "OFFSET", "AS", "SET", "VALUES", "DISTINCT", "COUNT", "SUM", "AVG", "MAX", "MIN"],
73
+ json: [],
74
+ markdown: [],
75
+ shell: ["echo", "cd", "ls", "mkdir", "rm", "cp", "mv", "cat", "grep", "sed", "awk", "find", "chmod", "chown", "export", "source", "alias", "if", "then", "else", "fi", "for", "do", "done", "while", "case", "esac", "function", "return", "exit", "sudo", "apt", "npm", "yarn", "git"]
76
+ }, l = [
77
+ "console",
78
+ "Math",
79
+ "JSON",
80
+ "Array",
81
+ "Object",
82
+ "String",
83
+ "Number",
84
+ "Boolean",
85
+ "Date",
86
+ "RegExp",
87
+ "Error",
88
+ "Map",
89
+ "Set",
90
+ "Promise",
91
+ "setTimeout",
92
+ "setInterval",
93
+ "clearTimeout",
94
+ "clearInterval",
95
+ "parseInt",
96
+ "parseFloat",
97
+ "isNaN",
98
+ "isFinite",
99
+ "fetch",
100
+ "require",
101
+ "document",
102
+ "window",
103
+ "navigator",
104
+ "alert",
105
+ "confirm",
106
+ "prompt"
107
+ ];
108
+ export {
109
+ s as AUTO_CLOSE_PAIRS,
110
+ l as BUILTIN_FUNCTIONS,
111
+ o as DARK_THEME,
112
+ t as DEFAULT_FONT_FAMILY,
113
+ e as DEFAULT_FONT_SIZE,
114
+ a as DEFAULT_TAB_SIZE,
115
+ n as GUTTER_WIDTH,
116
+ c as LANGUAGE_KEYWORDS,
117
+ i as LIGHT_THEME,
118
+ r as LINE_HEIGHT
119
+ };
@@ -0,0 +1,22 @@
1
+ import { FC } from 'react';
2
+ import { CodeEditorProps } from './CodeEditor.types';
3
+ /**
4
+ * CodeEditor - Syntax-highlighted code editor with line numbers
5
+ *
6
+ * @description
7
+ * Zero-dependency code editor with syntax highlighting for multiple
8
+ * languages, line numbers, auto-indent, bracket pairing, and theming.
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * <CodeEditor
13
+ * value={code}
14
+ * onChange={setCode}
15
+ * language="typescript"
16
+ * theme="dark"
17
+ * showLineNumbers
18
+ * height={400}
19
+ * />
20
+ * ```
21
+ */
22
+ export declare const CodeEditor: FC<CodeEditorProps>;
@@ -0,0 +1,250 @@
1
+ import { jsxs as L, jsx as d } from "react/jsx-runtime";
2
+ import { useRef as de, useState as x, useMemo as N, useCallback as b } from "react";
3
+ import { cn as be } from "../../utils/cn.js";
4
+ import { DARK_THEME as pe, LIGHT_THEME as fe, DEFAULT_TAB_SIZE as ue, AUTO_CLOSE_PAIRS as G, LINE_HEIGHT as D, DEFAULT_FONT_SIZE as me, DEFAULT_FONT_FAMILY as ke, GUTTER_WIDTH as Ee } from "./CodeEditor.const.js";
5
+ import { tokenizeLine as ge } from "./CodeEditor.utils.js";
6
+ const Te = ({
7
+ value: s,
8
+ onChange: r,
9
+ language: A = "typescript",
10
+ theme: F = "dark",
11
+ customTheme: p,
12
+ placeholder: J = "Start typing...",
13
+ showLineNumbers: T = !0,
14
+ showGutter: h = !0,
15
+ highlightActiveLine: O = !0,
16
+ readOnly: f = !1,
17
+ fontSize: _ = me,
18
+ fontFamily: H = ke,
19
+ tabSize: u = ue,
20
+ autoIndent: I = !0,
21
+ autoCloseBrackets: R = !0,
22
+ wordWrap: E = !1,
23
+ minHeight: U,
24
+ maxHeight: q,
25
+ height: K,
26
+ className: Q,
27
+ style: X,
28
+ testId: W,
29
+ onFocus: g,
30
+ onBlur: v
31
+ }) => {
32
+ const y = de(null), [M, V] = x(!1), [S, z] = x(0), [$, C] = x(0), [ee, te] = x(0), B = F === "dark" ? pe : fe, n = N(
33
+ () => ({
34
+ ...B,
35
+ ...p,
36
+ tokens: { ...B.tokens, ...p == null ? void 0 : p.tokens }
37
+ }),
38
+ [F, p]
39
+ ), w = N(() => s.split(`
40
+ `), [s]), re = N(
41
+ () => w.map((e) => ge(e, A)),
42
+ [w, A]
43
+ ), j = b(() => {
44
+ const e = y.current;
45
+ if (!e) return;
46
+ const t = e.value.substring(0, e.selectionStart);
47
+ z(t.split(`
48
+ `).length - 1);
49
+ }, []), se = b(
50
+ (e) => {
51
+ var Y;
52
+ if (f) return;
53
+ const t = y.current;
54
+ if (!t) return;
55
+ const { selectionStart: i, selectionEnd: o } = t;
56
+ if (e.key === "Tab") {
57
+ e.preventDefault();
58
+ const a = " ".repeat(u), c = s.substring(0, i), m = s.substring(o), l = c + a + m;
59
+ r == null || r(l), requestAnimationFrame(() => {
60
+ t.selectionStart = t.selectionEnd = i + u;
61
+ });
62
+ return;
63
+ }
64
+ if (e.key === "Enter" && I) {
65
+ e.preventDefault();
66
+ const a = s.substring(0, i), c = s.substring(o), l = ((Y = (a.split(`
67
+ `).pop() ?? "").match(/^\s*/)) == null ? void 0 : Y[0]) ?? "", k = a.trim().slice(-1), Z = ["{", "(", "[", ":"].includes(k) ? " ".repeat(u) : "", le = a + `
68
+ ` + l + Z + c;
69
+ r == null || r(le), requestAnimationFrame(() => {
70
+ const ce = i + 1 + l.length + Z.length;
71
+ t.selectionStart = t.selectionEnd = ce;
72
+ });
73
+ return;
74
+ }
75
+ if (R && G[e.key]) {
76
+ e.preventDefault();
77
+ const a = G[e.key], c = s.substring(0, i), m = s.substring(i, o), l = s.substring(o);
78
+ if (m) {
79
+ const k = c + e.key + m + a + l;
80
+ r == null || r(k), requestAnimationFrame(() => {
81
+ t.selectionStart = i + 1, t.selectionEnd = o + 1;
82
+ });
83
+ } else {
84
+ const k = c + e.key + a + l;
85
+ r == null || r(k), requestAnimationFrame(() => {
86
+ t.selectionStart = t.selectionEnd = i + 1;
87
+ });
88
+ }
89
+ return;
90
+ }
91
+ },
92
+ [s, r, f, u, I, R]
93
+ ), ne = b(
94
+ (e) => {
95
+ f || r == null || r(e.target.value);
96
+ },
97
+ [r, f]
98
+ ), ie = b(() => {
99
+ const e = y.current;
100
+ e && (C(e.scrollTop), te(e.scrollLeft));
101
+ }, []), ae = b(() => {
102
+ V(!0), g == null || g();
103
+ }, [g]), oe = b(() => {
104
+ V(!1), v == null || v();
105
+ }, [v]), P = _ * D;
106
+ return /* @__PURE__ */ L(
107
+ "div",
108
+ {
109
+ className: be(
110
+ "bear-relative bear-overflow-hidden bear-rounded-lg bear-font-mono",
111
+ "bear-border",
112
+ M ? "bear-ring-2 bear-ring-offset-1" : "",
113
+ Q
114
+ ),
115
+ style: {
116
+ background: n.background,
117
+ borderColor: n.gutterBorder,
118
+ fontFamily: H,
119
+ fontSize: _,
120
+ lineHeight: D,
121
+ minHeight: U,
122
+ maxHeight: q,
123
+ height: K,
124
+ "--bear-editor-ring": "var(--bear-primary-500)",
125
+ ...X
126
+ },
127
+ "data-testid": W,
128
+ children: [
129
+ /* @__PURE__ */ L("div", { className: "bear-relative bear-flex bear-h-full", children: [
130
+ h && T && /* @__PURE__ */ d(
131
+ "div",
132
+ {
133
+ className: "bear-flex-shrink-0 bear-select-none bear-text-right bear-pr-3 bear-overflow-hidden",
134
+ style: {
135
+ width: Ee,
136
+ background: n.gutterBackground,
137
+ borderRight: `1px solid ${n.gutterBorder}`,
138
+ paddingTop: 12,
139
+ transform: `translateY(-${$}px)`
140
+ },
141
+ "aria-hidden": "true",
142
+ children: w.map((e, t) => /* @__PURE__ */ d(
143
+ "div",
144
+ {
145
+ style: {
146
+ height: P,
147
+ color: t === S ? n.lineNumberActive : n.lineNumber,
148
+ fontWeight: t === S ? 600 : 400
149
+ },
150
+ children: t + 1
151
+ },
152
+ t
153
+ ))
154
+ }
155
+ ),
156
+ /* @__PURE__ */ L("div", { className: "bear-relative bear-flex-1 bear-overflow-hidden", children: [
157
+ /* @__PURE__ */ d(
158
+ "div",
159
+ {
160
+ className: "bear-absolute bear-inset-0 bear-pointer-events-none bear-overflow-hidden",
161
+ style: {
162
+ padding: 12,
163
+ paddingLeft: h && !T ? 12 : 16,
164
+ transform: `translate(-${ee}px, -${$}px)`,
165
+ whiteSpace: E ? "pre-wrap" : "pre",
166
+ wordBreak: E ? "break-all" : "normal"
167
+ },
168
+ "aria-hidden": "true",
169
+ children: re.map((e, t) => /* @__PURE__ */ L(
170
+ "div",
171
+ {
172
+ style: {
173
+ height: P,
174
+ background: O && t === S && M ? n.selection : "transparent"
175
+ },
176
+ children: [
177
+ e.map((i, o) => /* @__PURE__ */ d(
178
+ "span",
179
+ {
180
+ style: {
181
+ color: n.tokens[i.type] ?? n.foreground
182
+ },
183
+ children: i.value
184
+ },
185
+ o
186
+ )),
187
+ e.length === 0 && " "
188
+ ]
189
+ },
190
+ t
191
+ ))
192
+ }
193
+ ),
194
+ /* @__PURE__ */ d(
195
+ "textarea",
196
+ {
197
+ ref: y,
198
+ value: s,
199
+ onChange: ne,
200
+ onKeyDown: se,
201
+ onScroll: ie,
202
+ onFocus: ae,
203
+ onBlur: oe,
204
+ onClick: j,
205
+ onKeyUp: j,
206
+ readOnly: f,
207
+ placeholder: s ? void 0 : J,
208
+ spellCheck: !1,
209
+ autoComplete: "off",
210
+ autoCorrect: "off",
211
+ autoCapitalize: "off",
212
+ className: "bear-w-full bear-h-full bear-resize-none bear-outline-none",
213
+ style: {
214
+ padding: 12,
215
+ paddingLeft: h && !T ? 12 : 16,
216
+ background: "transparent",
217
+ color: "transparent",
218
+ caretColor: n.cursor,
219
+ fontFamily: H,
220
+ fontSize: _,
221
+ lineHeight: D,
222
+ tabSize: u,
223
+ whiteSpace: E ? "pre-wrap" : "pre",
224
+ wordBreak: E ? "break-all" : "normal",
225
+ minHeight: U ?? 100,
226
+ maxHeight: q,
227
+ height: K ?? "auto"
228
+ }
229
+ }
230
+ )
231
+ ] })
232
+ ] }),
233
+ /* @__PURE__ */ d(
234
+ "div",
235
+ {
236
+ className: "bear-absolute bear-bottom-2 bear-right-3 bear-text-xs bear-font-medium bear-px-2 bear-py-0.5 bear-rounded bear-select-none",
237
+ style: {
238
+ color: n.lineNumber,
239
+ background: n.gutterBackground
240
+ },
241
+ children: A
242
+ }
243
+ )
244
+ ]
245
+ }
246
+ );
247
+ };
248
+ export {
249
+ Te as CodeEditor
250
+ };
@@ -0,0 +1,80 @@
1
+ import { CSSProperties } from 'react';
2
+ /**
3
+ * Supported programming languages
4
+ */
5
+ export type CodeEditorLanguage = 'javascript' | 'typescript' | 'jsx' | 'tsx' | 'html' | 'css' | 'json' | 'python' | 'markdown' | 'sql' | 'shell' | 'yaml' | 'xml' | 'plaintext';
6
+ /**
7
+ * Syntax token type for highlighting
8
+ */
9
+ export type TokenType = 'keyword' | 'string' | 'number' | 'comment' | 'operator' | 'punctuation' | 'function' | 'variable' | 'tag' | 'attribute' | 'property' | 'builtin' | 'regex' | 'boolean' | 'null' | 'type' | 'default';
10
+ /**
11
+ * Token from syntax analysis
12
+ */
13
+ export interface SyntaxToken {
14
+ type: TokenType;
15
+ value: string;
16
+ }
17
+ /**
18
+ * Theme colors for the editor
19
+ */
20
+ export interface CodeEditorTheme {
21
+ background: string;
22
+ foreground: string;
23
+ cursor: string;
24
+ selection: string;
25
+ lineNumber: string;
26
+ lineNumberActive: string;
27
+ gutterBackground: string;
28
+ gutterBorder: string;
29
+ tokens: Partial<Record<TokenType, string>>;
30
+ }
31
+ export interface CodeEditorProps {
32
+ /** Current value */
33
+ value: string;
34
+ /** Called on value change */
35
+ onChange?: (value: string) => void;
36
+ /** Programming language for syntax highlighting */
37
+ language?: CodeEditorLanguage;
38
+ /** Editor theme ('dark' | 'light') */
39
+ theme?: 'dark' | 'light';
40
+ /** Custom theme overrides */
41
+ customTheme?: Partial<CodeEditorTheme>;
42
+ /** Placeholder text */
43
+ placeholder?: string;
44
+ /** Show line numbers */
45
+ showLineNumbers?: boolean;
46
+ /** Show gutter (line number area) */
47
+ showGutter?: boolean;
48
+ /** Highlight active line */
49
+ highlightActiveLine?: boolean;
50
+ /** Read-only mode */
51
+ readOnly?: boolean;
52
+ /** Font size in px */
53
+ fontSize?: number;
54
+ /** Font family */
55
+ fontFamily?: string;
56
+ /** Tab size (spaces) */
57
+ tabSize?: number;
58
+ /** Auto-indent on new line */
59
+ autoIndent?: boolean;
60
+ /** Auto-close brackets */
61
+ autoCloseBrackets?: boolean;
62
+ /** Word wrap */
63
+ wordWrap?: boolean;
64
+ /** Min height */
65
+ minHeight?: string | number;
66
+ /** Max height */
67
+ maxHeight?: string | number;
68
+ /** Height */
69
+ height?: string | number;
70
+ /** Custom class name */
71
+ className?: string;
72
+ /** Custom styles */
73
+ style?: CSSProperties;
74
+ /** Test ID */
75
+ testId?: string;
76
+ /** Called on focus */
77
+ onFocus?: () => void;
78
+ /** Called on blur */
79
+ onBlur?: () => void;
80
+ }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./CodeEditor.const.cjs"),u=(e,f)=>{if(f==="plaintext"||f==="markdown")return[{type:"default",value:e}];const r=[],h=i.LANGUAGE_KEYWORDS[f]??[];let t=0;const c=(s,o)=>{o&&r.push({type:s,value:o})};for(;t<e.length;){if(e[t]==="/"&&e[t+1]==="/"){c("comment",e.slice(t));break}if(e[t]==="/"&&e[t+1]==="*"){const s=e.indexOf("*/",t+2),o=s===-1?e.slice(t):e.slice(t,s+2);c("comment",o),t+=o.length;continue}if(e[t]==="#"&&(f==="python"||f==="shell"||f==="yaml")){c("comment",e.slice(t));break}if(e[t]==='"'||e[t]==="'"||e[t]==="`"){const s=e[t];let o=t+1;for(;o<e.length&&e[o]!==s;)e[o]==="\\"&&o++,o++;c("string",e.slice(t,o+1)),t=o+1;continue}if(/[0-9]/.test(e[t])&&(t===0||/[^a-zA-Z_$]/.test(e[t-1]))){let s=t;for(;s<e.length&&/[0-9.xXa-fA-F_eEn]/.test(e[s]);)s++;c("number",e.slice(t,s)),t=s;continue}if(/[a-zA-Z_$]/.test(e[t])){let s=t;for(;s<e.length&&/[a-zA-Z0-9_$]/.test(e[s]);)s++;const o=e.slice(t,s);o==="true"||o==="false"?c("boolean",o):o==="null"||o==="undefined"||o==="None"||o==="NaN"?c("null",o):h.includes(o)?c("keyword",o):i.BUILTIN_FUNCTIONS.includes(o)?c("builtin",o):s<e.length&&e[s]==="("?c("function",o):t>0&&e[t-1]==="."?c("property",o):c("variable",o),t=s;continue}if(e[t]==="<"&&(f==="html"||f==="jsx"||f==="tsx"||f==="xml")){e[t+1]==="/"?(c("tag","</"),t+=2):(c("tag","<"),t+=1);continue}if(e[t]===">"&&(f==="html"||f==="jsx"||f==="tsx"||f==="xml")){c("tag",">"),t+=1;continue}if(/[+\-*/%=!<>&|^~?:]/.test(e[t])){let s=t;for(;s<e.length&&/[+\-*/%=!<>&|^~?:]/.test(e[s]);)s++;c("operator",e.slice(t,s)),t=s;continue}if(/[(){}[\],;.]/.test(e[t])){c("punctuation",e[t]),t++;continue}if(/\s/.test(e[t])){let s=t;for(;s<e.length&&/\s/.test(e[s]);)s++;c("default",e.slice(t,s)),t=s;continue}c("default",e[t]),t++}return r};exports.tokenizeLine=u;
@@ -0,0 +1,6 @@
1
+ import { CodeEditorLanguage, SyntaxToken } from './CodeEditor.types';
2
+ /**
3
+ * Simple tokenizer for syntax highlighting
4
+ * Produces tokens for a single line of code
5
+ */
6
+ export declare const tokenizeLine: (line: string, language: CodeEditorLanguage) => SyntaxToken[];