@memoreco/ui 0.2.2 → 0.2.4

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.
@@ -0,0 +1,61 @@
1
+ import { default as React } from 'react';
2
+
3
+ export interface CodeSampleProps {
4
+ /**
5
+ * Optional caption displayed above the code block
6
+ */
7
+ caption?: string;
8
+ /**
9
+ * Code content - can be a plain string or React elements for custom syntax highlighting
10
+ */
11
+ children: React.ReactNode;
12
+ /**
13
+ * Plain text version for clipboard copy (if children is JSX, provide this)
14
+ */
15
+ plainText?: string;
16
+ /**
17
+ * Enable keyboard shortcut (spacebar) to copy code
18
+ * @default false
19
+ */
20
+ enableSpacebar?: boolean;
21
+ /**
22
+ * Show copy success toast notification
23
+ * @default true
24
+ */
25
+ showToast?: boolean;
26
+ /**
27
+ * Maximum height for code block with scroll
28
+ * @default "60vh"
29
+ */
30
+ maxHeight?: string;
31
+ /**
32
+ * Custom className for the code block container
33
+ */
34
+ className?: string;
35
+ }
36
+ /**
37
+ * CodeSample: Professional code display component with copy functionality
38
+ *
39
+ * Features:
40
+ * - Copy to clipboard with animated feedback
41
+ * - Hover tooltip showing "Copy" hint
42
+ * - Optional keyboard shortcut (spacebar) for quick copy
43
+ * - Smooth scale animation on button press
44
+ * - Portal-based tooltip positioning
45
+ * - Toast notifications for copy success/failure
46
+ * - Supports both plain text and custom JSX syntax highlighting
47
+ *
48
+ * Usage:
49
+ * ```tsx
50
+ * // Simple usage with plain text
51
+ * <CodeSample caption="Example">
52
+ * {`const hello = "world";`}
53
+ * </CodeSample>
54
+ *
55
+ * // Advanced usage with custom syntax highlighting
56
+ * <CodeSample caption="React Example" plainText={plainTextVersion}>
57
+ * <span className="text-purple-400">import</span> ...
58
+ * </CodeSample>
59
+ * ```
60
+ */
61
+ export declare function CodeSample({ caption, children, plainText, enableSpacebar, showToast, maxHeight, className, }: CodeSampleProps): import("react/jsx-runtime").JSX.Element;
@@ -15,6 +15,7 @@ export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, Dialog
15
15
  export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, } from './components/select';
16
16
  export { Checkbox } from './components/checkbox';
17
17
  export { AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, } from './components/alert-dialog';
18
+ export { CodeSample } from './components/code-sample';
18
19
  export type { ButtonProps } from './components/button';
19
20
  export type { CardProps } from './components/card';
20
21
  export type { InputProps } from './components/input';
@@ -23,4 +24,6 @@ export type { FormProps, FormFieldProps } from './components/form';
23
24
  export type { BadgeProps } from './components/badge';
24
25
  export type { SeparatorProps } from './components/separator';
25
26
  export type { DiscLoaderProps } from './components/disc-loader';
27
+ export type { CodeSampleProps } from './components/code-sample';
26
28
  export { cn } from './lib/utils';
29
+ export declare const UI_LIBRARY_VERSION = "0.2.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memoreco/ui",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Memoreco shared UI components with Shadcn",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -45,13 +45,14 @@
45
45
  "vite": "^5.0.12",
46
46
  "vite-plugin-dts": "^3.7.2",
47
47
  "vitest": "^1.2.2",
48
- "@memoreco/utils": "0.2.0",
49
- "@memoreco/types": "0.2.0"
48
+ "@memoreco/types": "0.2.0",
49
+ "@memoreco/utils": "0.2.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": ">=18.0.0",
53
53
  "react-dom": ">=18.0.0"
54
54
  },
55
+ "sideEffects": false,
55
56
  "scripts": {
56
57
  "dev": "vite build --watch",
57
58
  "build": "vite build",