@veevarts/design-system 0.1.22 → 1.0.0-alpha.3

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,7 @@
1
+ import { default as React } from 'react';
2
+ import { DonationAmountsProps } from './types';
3
+ /**
4
+ * DonationAmounts component for selecting donation values
5
+ */
6
+ export declare const DonationAmounts: React.FC<DonationAmountsProps>;
7
+ export default DonationAmounts;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * DonationAmounts Component Tests
3
+ */
4
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * DonationAmounts Pattern
3
+ *
4
+ * A component for selecting donation amounts with preset options and custom input.
5
+ * Ensures exclusive selection (preset OR custom).
6
+ */
7
+ export { DonationAmounts } from './DonationAmounts';
8
+ export type { DonationAmount, SelectedDonation, DonationLabels, DonationAmountsProps } from './types';
9
+ export { formatCurrency, parseCurrency } from './utils/currency';
@@ -0,0 +1,145 @@
1
+ /**
2
+ * DonationAmounts - Type Definitions
3
+ */
4
+ /**
5
+ * Represents a preset donation amount option
6
+ */
7
+ export interface DonationAmount {
8
+ /**
9
+ * Unique identifier for the amount
10
+ */
11
+ id: string;
12
+ /**
13
+ * The numerical value of the donation
14
+ */
15
+ amount: number;
16
+ /**
17
+ * Optional label to display instead of the amount
18
+ * If not provided, the formatted currency will be used
19
+ */
20
+ label?: string;
21
+ }
22
+ /**
23
+ * Selected donation value (can be preset or custom)
24
+ */
25
+ export interface SelectedDonation {
26
+ /**
27
+ * The selected amount
28
+ */
29
+ amount: number;
30
+ /**
31
+ * Whether this is a custom amount
32
+ */
33
+ isCustom: boolean;
34
+ /**
35
+ * ID of the preset (if not custom)
36
+ */
37
+ presetId?: string;
38
+ }
39
+ /**
40
+ * Labels for internationalization
41
+ */
42
+ export interface DonationLabels {
43
+ /**
44
+ * Title text (e.g., "Donation Amount")
45
+ */
46
+ title?: string;
47
+ /**
48
+ * Placeholder for custom amount input
49
+ */
50
+ customAmountPlaceholder?: string;
51
+ /**
52
+ * Aria label for custom amount input
53
+ */
54
+ customAmountAriaLabel?: string;
55
+ }
56
+ /**
57
+ * Props for DonationAmounts component
58
+ */
59
+ export interface DonationAmountsProps {
60
+ /**
61
+ * Array of preset donation amounts to display as buttons
62
+ * @default [100, 250, 500, 1000, 2000]
63
+ */
64
+ presetAmounts?: DonationAmount[];
65
+ /**
66
+ * Currently selected donation (controlled mode)
67
+ */
68
+ selectedDonation?: SelectedDonation | null;
69
+ /**
70
+ * Default selected donation (uncontrolled mode)
71
+ */
72
+ defaultSelectedDonation?: SelectedDonation | null;
73
+ /**
74
+ * Callback fired when donation selection changes
75
+ */
76
+ onChange?: (donation: SelectedDonation | null) => void;
77
+ /**
78
+ * Currency code (ISO 4217)
79
+ * @default 'USD'
80
+ */
81
+ currency?: string;
82
+ /**
83
+ * Locale for currency formatting
84
+ * @default 'en-US'
85
+ */
86
+ locale?: string;
87
+ /**
88
+ * Whether to show the custom amount input
89
+ * @default true
90
+ */
91
+ showCustomAmount?: boolean;
92
+ /**
93
+ * Minimum allowed custom amount
94
+ * @default 0.5
95
+ */
96
+ minCustomAmount?: number;
97
+ /**
98
+ * Maximum allowed custom amount
99
+ * @default 1000000
100
+ */
101
+ maxCustomAmount?: number;
102
+ /**
103
+ * Labels for internationalization
104
+ */
105
+ labels?: DonationLabels;
106
+ /**
107
+ * Number of columns for preset buttons on mobile
108
+ * @default 2
109
+ */
110
+ mobileColumns?: 2 | 3;
111
+ /**
112
+ * Number of columns for preset buttons on desktop
113
+ * @default 3
114
+ */
115
+ desktopColumns?: 3 | 4 | 5 | 6;
116
+ /**
117
+ * Whether the component is disabled
118
+ * @default false
119
+ */
120
+ isDisabled?: boolean;
121
+ /**
122
+ * Button variant for preset amounts
123
+ * @default 'bordered'
124
+ */
125
+ buttonVariant?: 'solid' | 'bordered' | 'light' | 'flat' | 'faded' | 'shadow' | 'ghost';
126
+ /**
127
+ * Button color for preset amounts
128
+ * @default 'default'
129
+ */
130
+ buttonColor?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
131
+ /**
132
+ * Input variant for custom amount
133
+ * @default 'bordered'
134
+ */
135
+ inputVariant?: 'flat' | 'bordered' | 'faded' | 'underlined';
136
+ /**
137
+ * Additional CSS classes
138
+ */
139
+ className?: string;
140
+ /**
141
+ * Whether to show the component inside a Card
142
+ * @default true
143
+ */
144
+ showCard?: boolean;
145
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Currency formatting utilities
3
+ */
4
+ /**
5
+ * Formats a number as currency
6
+ * @param amount - The amount to format
7
+ * @param locale - The locale to use for formatting (e.g., 'en-US', 'es-ES')
8
+ * @param currency - The currency code (ISO 4217, e.g., 'USD', 'EUR')
9
+ * @returns Formatted currency string
10
+ *
11
+ * @example
12
+ * formatCurrency(1000, 'en-US', 'USD') // "$1,000.00"
13
+ * formatCurrency(1000, 'es-ES', 'EUR') // "1.000,00 €"
14
+ */
15
+ export declare function formatCurrency(amount: number, locale?: string, currency?: string): string;
16
+ /**
17
+ * Parses a currency string to a number
18
+ * @param value - The currency string to parse
19
+ * @returns Parsed number or null if invalid
20
+ *
21
+ * @example
22
+ * parseCurrency('$1,000.00') // 1000
23
+ * parseCurrency('1.000,00 €') // 1000
24
+ */
25
+ export declare function parseCurrency(value: string): number | null;
@@ -1,21 +1,4 @@
1
- import { ReactNode } from 'react';
2
- export interface FooterLink {
3
- label: string;
4
- href: string;
5
- }
6
- export interface FooterSection {
7
- title: string;
8
- links: FooterLink[];
9
- }
10
- export interface SocialLink {
11
- platform: string;
12
- href: string;
13
- icon?: ReactNode;
14
- }
15
- export interface FooterProps {
16
- sections?: FooterSection[];
17
- socialLinks?: SocialLink[];
18
- copyrightText?: string;
19
- logo?: ReactNode;
20
- }
21
- export declare function Footer(_props: FooterProps): import("react/jsx-runtime").JSX.Element;
1
+ /**
2
+ * Footer Component
3
+ */
4
+ export declare function Footer(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1 @@
1
1
  export { Footer } from './Footer';
2
- export type { FooterProps, FooterSection, FooterLink, SocialLink } from './Footer';
@@ -103,3 +103,4 @@ import { RichTextAreaProps } from './types';
103
103
  * @see {@link https://tiptap.dev/docs/editor/api/editor Tiptap Editor API} for underlying editor functionality
104
104
  */
105
105
  export declare const RichTextArea: import('react').ForwardRefExoticComponent<Omit<RichTextAreaProps, "ref"> & import('react').RefAttributes<HTMLTextAreaElement>>;
106
+ export type { RichTextAreaProps };
@@ -26,9 +26,16 @@ export interface ToolbarProps {
26
26
  * Custom class name
27
27
  */
28
28
  className?: string;
29
+ /**
30
+ * Callback when a toolbar action is executed
31
+ */
32
+ onToolbarAction?: (action: {
33
+ type: string;
34
+ modifier: string;
35
+ }) => void;
29
36
  }
30
37
  /**
31
38
  * Main toolbar component
32
39
  * Renders all toolbar sections based on active modifiers
33
40
  */
34
- export declare function Toolbar({ editor, modifiers, zoom, onZoomChange, sticky, className }: ToolbarProps): import("react/jsx-runtime").JSX.Element | null;
41
+ export declare function Toolbar({ editor, modifiers, zoom, onZoomChange, sticky, className, onToolbarAction, }: ToolbarProps): import("react/jsx-runtime").JSX.Element | null;
@@ -4,9 +4,13 @@ import { ModifierType, ModifierConfig } from '../../types';
4
4
  * Hook to execute toolbar commands
5
5
  *
6
6
  * @param editor - TipTap editor instance
7
+ * @param onToolbarAction - Optional callback for logging/analytics
7
8
  * @returns Command execution functions
8
9
  */
9
- export declare function useToolbarCommands(editor: Editor | null): {
10
+ export declare function useToolbarCommands(editor: Editor | null, onToolbarAction?: (action: {
11
+ type: string;
12
+ modifier: string;
13
+ }) => void): {
10
14
  executeCommand: (modifierType: ModifierType, config?: ModifierConfig) => void;
11
15
  toggleModifier: (modifierType: ModifierType) => void;
12
16
  canExecute: (modifierType: ModifierType, config?: ModifierConfig) => boolean;
@@ -3,5 +3,9 @@ import { ModifierIdentifier } from '../../types';
3
3
  export interface TextFormattingSectionProps {
4
4
  editor: Editor | null;
5
5
  modifiers: ModifierIdentifier[];
6
+ onToolbarAction?: (action: {
7
+ type: string;
8
+ modifier: string;
9
+ }) => void;
6
10
  }
7
- export declare function TextFormattingSection({ editor, modifiers }: TextFormattingSectionProps): import("react/jsx-runtime").JSX.Element | null;
11
+ export declare function TextFormattingSection({ editor, modifiers, onToolbarAction }: TextFormattingSectionProps): import("react/jsx-runtime").JSX.Element | null;
@@ -139,6 +139,14 @@ export interface RichTextAreaProps extends Omit<ComponentProps<typeof Textarea>,
139
139
  * Callback when editor content changes (controlled mode)
140
140
  */
141
141
  onUpdate?: (content: EditorContent) => void;
142
+ /**
143
+ * Callback when a toolbar action is executed
144
+ * Useful for logging/analytics
145
+ */
146
+ onToolbarAction?: (action: {
147
+ type: string;
148
+ modifier: string;
149
+ }) => void;
142
150
  }
143
151
  /**
144
152
  * Internal TipTap editor props (for core/TipTapEditor.tsx)
@@ -3,6 +3,7 @@ export { Stepper } from './Stepper';
3
3
  export { Footer } from './Footer';
4
4
  export type { RichTextAreaProps } from './RichText';
5
5
  export { RichTextArea, RICH_TEXT_PRESETS } from './RichText';
6
+ export { DonationAmounts } from './DonationAmounts';
6
7
  export type { NavbarProps, NavbarLink, NavbarLanguage } from './Navbar';
7
8
  export type { StepperProps } from './Stepper';
8
- export type { FooterProps, FooterSection, FooterLink, SocialLink } from './Footer';
9
+ export type { DonationAmountsProps, DonationAmount, SelectedDonation, DonationLabels } from './DonationAmounts';
@@ -1,6 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { NavbarProps } from '../../patterns/Navbar';
3
- import { FooterProps } from '../../patterns/Footer';
4
3
  export interface ConfirmationDetails {
5
4
  title: string;
6
5
  message: string;
@@ -12,7 +11,6 @@ export interface ConfirmationDetails {
12
11
  }
13
12
  export interface ConfirmationPageTemplateProps {
14
13
  navbar?: NavbarProps;
15
- footer?: FooterProps;
16
14
  confirmation: ConfirmationDetails;
17
15
  primaryAction?: {
18
16
  label: string;
@@ -1,7 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { NavbarProps } from '../../patterns/Navbar';
3
3
  import { StepperProps } from '../../patterns/Stepper';
4
- import { FooterProps } from '../../patterns/Footer';
5
4
  export interface EventInfo {
6
5
  title: string;
7
6
  description: string;
@@ -16,7 +15,6 @@ export interface EventInfo {
16
15
  }
17
16
  export interface EventDetailsTemplateProps {
18
17
  navbar?: NavbarProps;
19
- footer?: FooterProps;
20
18
  stepper?: StepperProps;
21
19
  event: EventInfo;
22
20
  primaryAction?: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@veevarts/design-system",
3
3
  "private": false,
4
- "version": "0.1.22",
4
+ "version": "1.0.0-alpha.3",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -14,15 +14,17 @@
14
14
  "build": "vite build",
15
15
  "lint": "eslint .",
16
16
  "preview": "vite preview",
17
- "test": "vitest --run",
17
+ "test": "vitest --project unit --run",
18
18
  "test:watch": "vitest",
19
+ "test:storybook": "vitest --project storybook --run",
19
20
  "test:unit": "vitest --project unit --run",
20
21
  "test:unit:watch": "vitest --project unit",
21
22
  "test:ui": "vitest --ui",
22
23
  "test:coverage": "vitest --coverage --run",
23
24
  "storybook": "storybook dev -p 6006",
24
25
  "build-storybook": "storybook build",
25
- "deploy-storybook": "npm run build-storybook && npx vercel storybook-static --prod"
26
+ "deploy-storybook": "npm run build-storybook && npx vercel storybook-static --prod",
27
+ "prepublishOnly": "npm run test && npm run lint && npm run build"
26
28
  },
27
29
  "peerDependencies": {
28
30
  "@heroui/react": ">=2.7.0",