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

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,37 @@
1
+ import { JSX } from 'react';
2
+ /**
3
+ * @interface EventDetailsProps
4
+ * @description Defines the properties required to render event details in a card layout.
5
+ */
6
+ export interface EventDetailsProps {
7
+ /** @property {string} name - The name/title of the event. */
8
+ name: string;
9
+ /** @property {string} [imageUrl] - Optional URL for the event's background image. */
10
+ imageUrl?: string;
11
+ /** @property {string} eventDate - The date of the event (e.g., 'July 10, 2025'). */
12
+ eventDate: string;
13
+ /** @property {string} [eventTime] - Optional time of the event (e.g., '10:00 AM'). */
14
+ eventTime?: string;
15
+ /** @property {string} [location] - Optional location where the event takes place. */
16
+ location?: string;
17
+ /** @property {string} [description] - Optional description or details about the event. */
18
+ description?: string;
19
+ /** @property {string} [classes] - Optional Tailwind CSS utility classes for custom styling. */
20
+ classes?: string;
21
+ /** @property {boolean} [showImage] - Optional flag to show or hide the event image. Defaults to true. */
22
+ showImage?: boolean;
23
+ /** @property {string} [showMoreButtonClassName] - Optional Tailwind CSS utility classes for the 'Show more/less' button. */
24
+ showMoreButtonClassName?: string;
25
+ /** @property {Object} labels - Labels for the event details, used for localization. */
26
+ labels: {
27
+ eventInformation: string;
28
+ showMore?: string;
29
+ showLess?: string;
30
+ };
31
+ }
32
+ /**
33
+ * @function EventDetails
34
+ * @description Displays a card with event information such as name, image, date, time, location, and description.
35
+ */
36
+ declare const EventDetails: ({ classes, name, imageUrl, eventDate, eventTime, location, description, showImage, showMoreButtonClassName, labels, }: EventDetailsProps) => JSX.Element;
37
+ export default EventDetails;
@@ -0,0 +1,2 @@
1
+ export { default } from './EventDetails';
2
+ export * from './EventDetails';
@@ -0,0 +1,249 @@
1
+ import { default as React, ComponentProps } from 'react';
2
+ import { LucideIcon } from 'lucide-react';
3
+ /**
4
+ * Props for the ExpireCartTimer component
5
+ *
6
+ * @interface ExpireCartTimerProps
7
+ * @extends {React.HTMLAttributes<HTMLDivElement>}
8
+ */
9
+ export interface ExpireCartTimerProps extends Omit<ComponentProps<'div'>, 'children'> {
10
+ /**
11
+ * The current time left in seconds (controlled mode).
12
+ * When provided, the component is controlled and will not manage its own state.
13
+ *
14
+ * @controlled
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * const [time, setTime] = useState(1200);
19
+ * <ExpireCartTimer timeLeft={time} onTimeChange={setTime} />
20
+ * ```
21
+ */
22
+ timeLeft?: number;
23
+ /**
24
+ * The initial time left in seconds (uncontrolled mode).
25
+ * Used when `timeLeft` is not provided.
26
+ *
27
+ * @default 1200 (20 minutes)
28
+ * @uncontrolled
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * <ExpireCartTimer defaultTimeLeft={600} /> // 10 minutes
33
+ * ```
34
+ */
35
+ defaultTimeLeft?: number;
36
+ /**
37
+ * Callback fired when the time left changes.
38
+ * Used in controlled mode to sync external state.
39
+ *
40
+ * @param seconds - The new time left in seconds
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * <ExpireCartTimer
45
+ * timeLeft={time}
46
+ * onTimeChange={(seconds) => {
47
+ * setTime(seconds);
48
+ * // Sync with server, localStorage, etc.
49
+ * }}
50
+ * />
51
+ * ```
52
+ */
53
+ onTimeChange?: (seconds: number) => void;
54
+ /**
55
+ * Callback fired when the timer reaches zero.
56
+ *
57
+ * @example
58
+ * ```tsx
59
+ * <ExpireCartTimer
60
+ * defaultTimeLeft={300}
61
+ * onExpire={() => {
62
+ * // Clear cart, redirect, show message, etc.
63
+ * console.log('Time expired!');
64
+ * }}
65
+ * />
66
+ * ```
67
+ */
68
+ onExpire?: () => void;
69
+ /**
70
+ * Visual variant of the timer.
71
+ * Affects the overall styling and semantic meaning.
72
+ *
73
+ * @default 'info'
74
+ *
75
+ * @example
76
+ * ```tsx
77
+ * <ExpireCartTimer variant="warning" /> // Warning style
78
+ * <ExpireCartTimer variant="error" /> // Error style
79
+ * ```
80
+ */
81
+ variant?: 'info' | 'warning' | 'error' | 'success';
82
+ /**
83
+ * Color theme for the timer.
84
+ * Uses HeroUI color system.
85
+ *
86
+ * @default 'primary'
87
+ *
88
+ * @example
89
+ * ```tsx
90
+ * <ExpireCartTimer color="warning" /> // Orange/yellow theme
91
+ * <ExpireCartTimer color="danger" /> // Red theme
92
+ * ```
93
+ */
94
+ color?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'default';
95
+ /**
96
+ * The message text displayed before the timer.
97
+ *
98
+ * @default "Your cart expires in:"
99
+ *
100
+ * @example
101
+ * ```tsx
102
+ * <ExpireCartTimer message="Limited offer ends in:" />
103
+ * ```
104
+ */
105
+ message?: string;
106
+ /**
107
+ * Whether to show the icon.
108
+ *
109
+ * @default true
110
+ *
111
+ * @example
112
+ * ```tsx
113
+ * <ExpireCartTimer showIcon={false} />
114
+ * ```
115
+ */
116
+ showIcon?: boolean;
117
+ /**
118
+ * Custom icon component from Lucide React or custom SVG component.
119
+ * If not provided, a default clock icon based on variant will be used.
120
+ *
121
+ * @example
122
+ * ```tsx
123
+ * import { AlertCircle } from 'lucide-react';
124
+ * <ExpireCartTimer icon={AlertCircle} />
125
+ * ```
126
+ */
127
+ icon?: LucideIcon | React.ComponentType<ComponentProps<'svg'>>;
128
+ /**
129
+ * Position of the timer.
130
+ *
131
+ * @default 'fixed'
132
+ *
133
+ * @example
134
+ * ```tsx
135
+ * <ExpireCartTimer position="sticky" /> // Sticks to top when scrolling
136
+ * ```
137
+ */
138
+ position?: 'fixed' | 'sticky' | 'static';
139
+ /**
140
+ * Whether to automatically start the countdown.
141
+ * When false, the timer will not count down until manually started.
142
+ *
143
+ * @default true
144
+ *
145
+ * @example
146
+ * ```tsx
147
+ * <ExpireCartTimer autoStart={false} defaultTimeLeft={300} />
148
+ * // Timer paused until user action
149
+ * ```
150
+ */
151
+ autoStart?: boolean;
152
+ /**
153
+ * Custom function to format the time display.
154
+ * Receives seconds and should return a formatted string.
155
+ *
156
+ * @example
157
+ * ```tsx
158
+ * <ExpireCartTimer
159
+ * formatTime={(seconds) => {
160
+ * const h = Math.floor(seconds / 3600);
161
+ * const m = Math.floor((seconds % 3600) / 60);
162
+ * const s = seconds % 60;
163
+ * return `${h}h ${m}m ${s}s`;
164
+ * }}
165
+ * />
166
+ * ```
167
+ */
168
+ formatTime?: (seconds: number) => string;
169
+ /**
170
+ * Custom CSS class for the timer container.
171
+ *
172
+ * @example
173
+ * ```tsx
174
+ * <ExpireCartTimer className="shadow-lg" />
175
+ * ```
176
+ */
177
+ className?: string;
178
+ }
179
+ /**
180
+ * ExpireCartTimer - A flexible countdown timer component.
181
+ *
182
+ * @description
183
+ * The ExpireCartTimer component displays a countdown timer with customizable appearance,
184
+ * behavior, and messaging. It supports both controlled and uncontrolled modes,
185
+ * making it suitable for various use cases like cart expiration, limited-time
186
+ * offers, or session timeouts.
187
+ *
188
+ * @component
189
+ *
190
+ * @features
191
+ * - **Controlled & Uncontrolled**: Works in both modes
192
+ * - **Customizable appearance**: Variants, colors, icons, and messages
193
+ * - **Flexible positioning**: Fixed, sticky, or static
194
+ * - **Auto-start control**: Pause/resume countdown
195
+ * - **Custom time formatting**: Format time display as needed
196
+ * - **Accessible**: ARIA labels and live regions
197
+ * - **Responsive**: Mobile-first design
198
+ *
199
+ * @accessibility
200
+ * - Uses `aria-live="polite"` for time announcements
201
+ * - Includes descriptive `role="banner"`
202
+ * - Time display is announced to screen readers
203
+ *
204
+ * @example
205
+ * **Basic uncontrolled timer**
206
+ * ```tsx
207
+ * <ExpireCartTimer defaultTimeLeft={1200} />
208
+ * ```
209
+ *
210
+ * @example
211
+ * **Controlled timer with expiration handler**
212
+ * ```tsx
213
+ * function CartTimer() {
214
+ * const [timeLeft, setTimeLeft] = useState(1200);
215
+ *
216
+ * return (
217
+ * <ExpireCartTimer
218
+ * timeLeft={timeLeft}
219
+ * onTimeChange={setTimeLeft}
220
+ * onExpire={() => {
221
+ * // Clear cart or redirect
222
+ * clearCart();
223
+ * }}
224
+ * variant="warning"
225
+ * color="warning"
226
+ * />
227
+ * );
228
+ * }
229
+ * ```
230
+ *
231
+ * @example
232
+ * **Custom formatting and styling**
233
+ * ```tsx
234
+ * <ExpireCartTimer
235
+ * defaultTimeLeft={3600}
236
+ * formatTime={(seconds) => {
237
+ * const h = Math.floor(seconds / 3600);
238
+ * const m = Math.floor((seconds % 60) / 60);
239
+ * return `${h}h ${m}m remaining`;
240
+ * }}
241
+ * message="Sale ends in:"
242
+ * variant="error"
243
+ * color="danger"
244
+ * />
245
+ * ```
246
+ *
247
+ * @see {@link ExpireCartTimerProps} for all available props
248
+ */
249
+ export declare const ExpireCartTimer: React.ForwardRefExoticComponent<Omit<ExpireCartTimerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * ExpireCartTimer Component Tests
3
+ */
4
+ export {};
@@ -0,0 +1 @@
1
+ export * from './ExpireCartTimer';
@@ -1,4 +1,15 @@
1
- import { ReactNode } from 'react';
1
+ /**
2
+ * Navbar Component
3
+ *
4
+ * A flexible, stateless navigation bar pattern for React apps.
5
+ *
6
+ * Features:
7
+ * - Logo on the left (image URL via `logo` prop)
8
+ * - Language selector dropdown with a globe icon (disabled if no languages)
9
+ * - Login/Logout button with user icon, fully controlled via props
10
+ * - All state and actions (login, logout, language change) are controlled by parent via props
11
+ * - Strictly typed with TypeScript
12
+ */
2
13
  export interface NavbarLink {
3
14
  label: string;
4
15
  href: string;
@@ -8,17 +19,22 @@ export interface NavbarLanguage {
8
19
  code: string;
9
20
  label: string;
10
21
  }
22
+ export interface NavbarLabels {
23
+ login: string;
24
+ logout: string;
25
+ selectLanguage: string;
26
+ }
11
27
  export interface NavbarProps {
12
- logo?: ReactNode;
13
- links?: NavbarLink[];
28
+ logo?: string;
14
29
  languages?: NavbarLanguage[];
15
30
  selectedLanguage?: string;
16
31
  onLanguageChange?: (languageCode: string) => void;
17
32
  isLoggedIn?: boolean;
18
- userEmail?: string;
33
+ hasLanguages?: boolean;
34
+ hasAuth?: boolean;
19
35
  onLogin?: () => void;
20
36
  onLogout?: () => void;
21
- loginLabel?: string;
22
- logoutLabel?: string;
37
+ labels?: Partial<NavbarLabels>;
38
+ className?: string;
23
39
  }
24
- export declare function Navbar(_props: NavbarProps): import("react/jsx-runtime").JSX.Element;
40
+ export declare function Navbar({ logo, languages, selectedLanguage, onLanguageChange, isLoggedIn, onLogin, onLogout, hasLanguages, hasAuth, labels, className, }: NavbarProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,9 +1,12 @@
1
+ export * from './EventDetails';
1
2
  export { Navbar } from './Navbar';
2
3
  export { Stepper } from './Stepper';
3
4
  export { Footer } from './Footer';
4
5
  export type { RichTextAreaProps } from './RichText';
5
6
  export { RichTextArea, RICH_TEXT_PRESETS } from './RichText';
6
7
  export { DonationAmounts } from './DonationAmounts';
8
+ export { ExpireCartTimer } from './ExpireCartTimer';
7
9
  export type { NavbarProps, NavbarLink, NavbarLanguage } from './Navbar';
8
10
  export type { StepperProps } from './Stepper';
9
11
  export type { DonationAmountsProps, DonationAmount, SelectedDonation, DonationLabels } from './DonationAmounts';
12
+ export type { ExpireCartTimerProps } from './ExpireCartTimer';
@@ -6,13 +6,13 @@ export declare const colors: {
6
6
  readonly brand: {
7
7
  readonly primary: "#C14615";
8
8
  readonly secondary: "#000000";
9
- readonly accent: "#F59E0B";
10
9
  };
11
10
  readonly semantic: {
12
- readonly success: "#10B981";
13
- readonly warning: "#F59E0B";
14
- readonly error: "#EF4444";
15
- readonly info: "#3B82F6";
11
+ readonly secondary: "#000000";
12
+ readonly success: "#057A54";
13
+ readonly warning: "#F5A524";
14
+ readonly danger: "#B62214";
15
+ readonly info: "#2563EB";
16
16
  };
17
17
  readonly neutral: {
18
18
  readonly white: "#FFFFFF";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@veevarts/design-system",
3
3
  "private": false,
4
- "version": "1.0.0-alpha.3",
4
+ "version": "1.0.0-alpha.6",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -14,7 +14,7 @@
14
14
  "build": "vite build",
15
15
  "lint": "eslint .",
16
16
  "preview": "vite preview",
17
- "test": "vitest --project unit --run",
17
+ "test": "vitest --run",
18
18
  "test:watch": "vitest",
19
19
  "test:storybook": "vitest --project storybook --run",
20
20
  "test:unit": "vitest --project unit --run",
@@ -46,6 +46,7 @@
46
46
  "react-dom": "^18.0.0 || ^19.0.0"
47
47
  },
48
48
  "dependencies": {
49
+ "@iconify/react": "^6.0.2",
49
50
  "vite-plugin-css-injected-by-js": "3.5.2",
50
51
  "vite-plugin-dts": "4.5.4"
51
52
  },
@@ -53,6 +54,15 @@
53
54
  "@chromatic-com/storybook": "^4.1.3",
54
55
  "@eslint/js": "^9.39.1",
55
56
  "@heroui/react": "^2.8.7",
57
+ "@storybook/addon-a11y": "^10.0.8",
58
+ "@storybook/addon-docs": "^10.0.8",
59
+ "@storybook/addon-onboarding": "^10.0.8",
60
+ "@storybook/addon-vitest": "^10.0.8",
61
+ "@storybook/react-vite": "^10.0.8",
62
+ "@tailwindcss/line-clamp": "^0.4.4",
63
+ "@testing-library/jest-dom": "^6.9.1",
64
+ "@testing-library/react": "^16.3.1",
65
+ "@testing-library/user-event": "^14.6.1",
56
66
  "@tiptap/extension-color": "^2.27.0",
57
67
  "@tiptap/extension-highlight": "^2.27.2",
58
68
  "@tiptap/extension-link": "^2.27.2",
@@ -64,16 +74,7 @@
64
74
  "@tiptap/pm": "^2.27.0",
65
75
  "@tiptap/react": "^2.27.0",
66
76
  "@tiptap/starter-kit": "^2.27.0",
67
- "lucide-react": "^0.562.0",
68
- "@storybook/addon-a11y": "^10.0.8",
69
- "@storybook/addon-docs": "^10.0.8",
70
- "@storybook/addon-onboarding": "^10.0.8",
71
- "@storybook/addon-vitest": "^10.0.8",
72
- "@storybook/react-vite": "^10.0.8",
73
- "@testing-library/jest-dom": "^6.9.1",
74
- "@testing-library/react": "^16.3.1",
75
- "@testing-library/user-event": "^14.6.1",
76
- "@types/node": "^24.10.1",
77
+ "@types/node": "^24.10.9",
77
78
  "@types/react": "^19.2.5",
78
79
  "@types/react-dom": "^19.2.3",
79
80
  "@vitejs/plugin-react": "^5.1.1",
@@ -87,6 +88,7 @@
87
88
  "framer-motion": "^11.15.0",
88
89
  "globals": "^16.5.0",
89
90
  "jsdom": "^27.4.0",
91
+ "lucide-react": "^0.562.0",
90
92
  "playwright": "^1.56.1",
91
93
  "postcss": "^8.5.6",
92
94
  "react": "19.2.3",