@veevarts/design-system 1.0.0-alpha.6 → 1.0.0-alpha.8
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.
- package/dist/index.cjs +9 -9
- package/dist/index.js +896 -817
- package/dist/patterns/OfferCard/OfferCard.d.ts +12 -0
- package/dist/patterns/OfferCard/OfferCard.test.d.ts +1 -0
- package/dist/patterns/OfferCard/OfferCardEmpty.d.ts +12 -0
- package/dist/patterns/OfferCard/OfferCardError.d.ts +12 -0
- package/dist/patterns/OfferCard/OfferCardList.d.ts +12 -0
- package/dist/patterns/OfferCard/OfferCardSkeleton.d.ts +12 -0
- package/dist/patterns/OfferCard/animations.d.ts +42 -0
- package/dist/patterns/OfferCard/examples/CustomQuantitySelectorExample.d.ts +1 -0
- package/dist/patterns/OfferCard/examples/ListWithEurosCurrencyExample.d.ts +1 -0
- package/dist/patterns/OfferCard/examples/ListWithoutAnimationExample.d.ts +1 -0
- package/dist/patterns/OfferCard/examples/index.d.ts +3 -0
- package/dist/patterns/OfferCard/index.d.ts +14 -0
- package/dist/patterns/OfferCard/types.d.ts +483 -0
- package/dist/patterns/OfferCard/utils/currency.d.ts +26 -0
- package/dist/patterns/OfferCard/utils/index.d.ts +2 -0
- package/dist/patterns/OfferCard/utils/offers.d.ts +3 -0
- package/dist/patterns/index.d.ts +2 -0
- package/dist/theme/index.d.ts +26 -2
- package/dist/tokens/colors.d.ts +28 -2
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { OfferCardProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* OfferCard component displays a single offer with quantity selection controls.
|
|
5
|
+
* Provides visual feedback for sold out status and maximum ticket limits.
|
|
6
|
+
* Supports slot-based customization for all rendered elements.
|
|
7
|
+
*/
|
|
8
|
+
export declare const OfferCard: {
|
|
9
|
+
({ offer, quantity: quantityProp, defaultQuantity, onQuantityChange, currency, locale, labels: customLabels, slots, isDisabled, buttonVariant, buttonColor, showCard, showDescription, showPeopleCount, showPrice, classNames, "data-testid": dataTestId, selectedColor, }: OfferCardProps): JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export default OfferCard;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { OfferCardEmptyProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* OfferCardEmpty component renders a visually informative empty state
|
|
5
|
+
* when there are no offers to display. It includes an icon and a message
|
|
6
|
+
* that can be customized via props.
|
|
7
|
+
*/
|
|
8
|
+
export declare const OfferCardEmpty: {
|
|
9
|
+
({ message, icon, iconSize, showCard, classNames, renderEmpty, }: OfferCardEmptyProps): JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export default OfferCardEmpty;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { OfferCardErrorProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* OfferCardError component renders an alert with error information
|
|
5
|
+
* when the offers cannot be loaded. Supports custom error messages
|
|
6
|
+
* and color variants for different error severity levels.
|
|
7
|
+
*/
|
|
8
|
+
export declare const OfferCardError: {
|
|
9
|
+
({ error, labels: customLabels, showCard, color, classNames, }: OfferCardErrorProps): JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export default OfferCardError;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { OfferCardListProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* OfferCardList component displays a collection of offer cards in a responsive grid.
|
|
5
|
+
* It manages selection state internally or accepts external control via props.
|
|
6
|
+
* When animated is true, cards animate in/out using Framer Motion variants.
|
|
7
|
+
*/
|
|
8
|
+
export declare const OfferCardList: {
|
|
9
|
+
({ offers, selection: selectionProp, defaultSelection, onSelectionChange, onQuantityChange, currency, locale, labels, slots, isDisabled, buttonVariant, buttonColor, showCard, animated, gap, classNames, }: OfferCardListProps): JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export default OfferCardList;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { OfferCardSkeletonProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* OfferCardSkeleton component renders placeholder cards with animated skeletons
|
|
5
|
+
* that mimic the structure of actual offer cards. This provides visual feedback
|
|
6
|
+
* to users while content is loading.
|
|
7
|
+
*/
|
|
8
|
+
export declare const OfferCardSkeleton: {
|
|
9
|
+
({ quantity, gap, classNames }: OfferCardSkeletonProps): JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export default OfferCardSkeleton;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Variants for the offer list animation.
|
|
3
|
+
* This includes the initial hidden state and the final visible state.
|
|
4
|
+
*/
|
|
5
|
+
export declare const offerListVariants: {
|
|
6
|
+
hidden: {
|
|
7
|
+
opacity: number;
|
|
8
|
+
};
|
|
9
|
+
show: {
|
|
10
|
+
opacity: number;
|
|
11
|
+
transition: {
|
|
12
|
+
staggerChildren: number;
|
|
13
|
+
delayChildren: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @description Variants for the offer card animation.
|
|
19
|
+
* This includes the initial hidden state, the final visible state, and the exit state.
|
|
20
|
+
*/
|
|
21
|
+
export declare const offerCardVariants: {
|
|
22
|
+
hidden: {
|
|
23
|
+
opacity: number;
|
|
24
|
+
y: number;
|
|
25
|
+
};
|
|
26
|
+
show: {
|
|
27
|
+
opacity: number;
|
|
28
|
+
y: number;
|
|
29
|
+
transition: {
|
|
30
|
+
duration: number;
|
|
31
|
+
ease: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
exit: {
|
|
35
|
+
opacity: number;
|
|
36
|
+
y: number;
|
|
37
|
+
transition: {
|
|
38
|
+
duration: number;
|
|
39
|
+
ease: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CustomQuantitySelectorExample(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ListWithEurosCurrencyExample(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ListWithoutAnimationExample(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OfferCard Pattern
|
|
3
|
+
*
|
|
4
|
+
* A complete pattern for displaying offers with quantity selection,
|
|
5
|
+
* price formatting, and various states (loading, error, empty).
|
|
6
|
+
*/
|
|
7
|
+
export { OfferCard, default as OfferCardDefault } from './OfferCard';
|
|
8
|
+
export { OfferCardList } from './OfferCardList';
|
|
9
|
+
export { OfferCardSkeleton } from './OfferCardSkeleton';
|
|
10
|
+
export { OfferCardError } from './OfferCardError';
|
|
11
|
+
export { OfferCardEmpty } from './OfferCardEmpty';
|
|
12
|
+
export type { Offer, OfferSelection, OfferCardLabels, OfferCardErrorLabels, OfferCardClassNames, OfferCardListClassNames, OfferCardSkeletonClassNames, OfferCardErrorClassNames, OfferCardEmptyClassNames, OfferCardSlots, OfferCardProps, OfferCardListProps, OfferCardSkeletonProps, OfferCardErrorProps, OfferCardEmptyProps, } from './types';
|
|
13
|
+
export { offerListVariants, offerCardVariants } from './animations';
|
|
14
|
+
export { formatCurrency, parseCurrency } from './utils/currency';
|
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* OfferCard - Type Definitions
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Represents an offer with its details
|
|
7
|
+
*/
|
|
8
|
+
export interface Offer {
|
|
9
|
+
/**
|
|
10
|
+
* Unique identifier for the offer
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* Display name of the offer
|
|
15
|
+
*/
|
|
16
|
+
name: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optional description or details about the offer
|
|
19
|
+
*/
|
|
20
|
+
description?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Price of the offer (before or after tax based on your implementation)
|
|
23
|
+
*/
|
|
24
|
+
price: number;
|
|
25
|
+
/**
|
|
26
|
+
* Maximum number of tickets allowed for this offer
|
|
27
|
+
* If not provided, unlimited tickets are assumed
|
|
28
|
+
*/
|
|
29
|
+
ticketsAllowed?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Total number of tickets already sold
|
|
32
|
+
* Used to calculate availability and sold out status
|
|
33
|
+
*/
|
|
34
|
+
totalTicketsSold?: number | null;
|
|
35
|
+
/**
|
|
36
|
+
* Number of people included in the offer (e.g., for table tickets)
|
|
37
|
+
*/
|
|
38
|
+
numberOfPeople?: number | null;
|
|
39
|
+
/**
|
|
40
|
+
* Position for sorting offers in a list
|
|
41
|
+
*/
|
|
42
|
+
position?: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Selection state for offers (map of offer ID to quantity)
|
|
46
|
+
*/
|
|
47
|
+
export type OfferSelection = Record<string, number>;
|
|
48
|
+
/**
|
|
49
|
+
* Labels for internationalization
|
|
50
|
+
*/
|
|
51
|
+
export interface OfferCardLabels {
|
|
52
|
+
/**
|
|
53
|
+
* Label for single person (e.g., "Person")
|
|
54
|
+
*/
|
|
55
|
+
person?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Label for multiple people (e.g., "People")
|
|
58
|
+
*/
|
|
59
|
+
people?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Label for tickets section (e.g., "Tickets:")
|
|
62
|
+
*/
|
|
63
|
+
tickets?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Label for sold out status (e.g., "Sold Out")
|
|
66
|
+
*/
|
|
67
|
+
soldOut?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Message when maximum tickets reached (e.g., "Maximum number of tickets allowed reached")
|
|
70
|
+
*/
|
|
71
|
+
maxReached?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Labels for error state
|
|
75
|
+
*/
|
|
76
|
+
export interface OfferCardErrorLabels {
|
|
77
|
+
/**
|
|
78
|
+
* Error title (e.g., "Error Fetching Offers")
|
|
79
|
+
*/
|
|
80
|
+
title?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Error description (e.g., "An error occurred while fetching offers.")
|
|
83
|
+
*/
|
|
84
|
+
description?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Class names for styling different parts of the OfferCard
|
|
88
|
+
*/
|
|
89
|
+
export interface OfferCardClassNames {
|
|
90
|
+
/**
|
|
91
|
+
* Class for the root/container element
|
|
92
|
+
*/
|
|
93
|
+
base?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Class for the card body
|
|
96
|
+
*/
|
|
97
|
+
body?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Class for the offer name
|
|
100
|
+
*/
|
|
101
|
+
name?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Class for the price display
|
|
104
|
+
*/
|
|
105
|
+
price?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Class for the description text
|
|
108
|
+
*/
|
|
109
|
+
description?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Class for the people count section
|
|
112
|
+
*/
|
|
113
|
+
peopleCount?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Class for the tickets label
|
|
116
|
+
*/
|
|
117
|
+
ticketsLabel?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Class for the quantity selector container
|
|
120
|
+
*/
|
|
121
|
+
quantitySelector?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Class for the sold out badge
|
|
124
|
+
*/
|
|
125
|
+
soldOut?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Class for the max reached alert
|
|
128
|
+
*/
|
|
129
|
+
maxReachedAlert?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Class for the card footer
|
|
132
|
+
*/
|
|
133
|
+
footer?: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Class names for OfferCardList
|
|
137
|
+
*/
|
|
138
|
+
export interface OfferCardListClassNames {
|
|
139
|
+
/**
|
|
140
|
+
* Class for the list container
|
|
141
|
+
*/
|
|
142
|
+
base?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Class for each card wrapper (motion div)
|
|
145
|
+
*/
|
|
146
|
+
cardWrapper?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Class names passed to each OfferCard
|
|
149
|
+
*/
|
|
150
|
+
card?: OfferCardClassNames;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Class names for OfferCardSkeleton
|
|
154
|
+
*/
|
|
155
|
+
export interface OfferCardSkeletonClassNames {
|
|
156
|
+
/**
|
|
157
|
+
* Class for the container
|
|
158
|
+
*/
|
|
159
|
+
base?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Class for each skeleton card
|
|
162
|
+
*/
|
|
163
|
+
card?: string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Class names for OfferCardError
|
|
167
|
+
*/
|
|
168
|
+
export interface OfferCardErrorClassNames {
|
|
169
|
+
/**
|
|
170
|
+
* Class for the root element
|
|
171
|
+
*/
|
|
172
|
+
base?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Class for the alert component
|
|
175
|
+
*/
|
|
176
|
+
alert?: string;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Class names for OfferCardEmpty
|
|
180
|
+
*/
|
|
181
|
+
export interface OfferCardEmptyClassNames {
|
|
182
|
+
/**
|
|
183
|
+
* Class for the root element
|
|
184
|
+
*/
|
|
185
|
+
base?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Class for the content container
|
|
188
|
+
*/
|
|
189
|
+
content?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Class for the icon
|
|
192
|
+
*/
|
|
193
|
+
icon?: string;
|
|
194
|
+
/**
|
|
195
|
+
* Class for the message text
|
|
196
|
+
*/
|
|
197
|
+
message?: string;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Slot render functions for custom content
|
|
201
|
+
*/
|
|
202
|
+
export interface OfferCardSlots {
|
|
203
|
+
/**
|
|
204
|
+
* Custom render for the offer name
|
|
205
|
+
*/
|
|
206
|
+
renderName?: (name: string, offer: Offer) => React.ReactNode;
|
|
207
|
+
/**
|
|
208
|
+
* Custom render for the price display
|
|
209
|
+
*/
|
|
210
|
+
renderPrice?: (price: number, formattedPrice: string, offer: Offer) => React.ReactNode;
|
|
211
|
+
/**
|
|
212
|
+
* Custom render for the description
|
|
213
|
+
*/
|
|
214
|
+
renderDescription?: (description: string, offer: Offer) => React.ReactNode;
|
|
215
|
+
/**
|
|
216
|
+
* Custom render for the people count
|
|
217
|
+
*/
|
|
218
|
+
renderPeopleCount?: (count: number, label: string, offer: Offer) => React.ReactNode;
|
|
219
|
+
/**
|
|
220
|
+
* Custom render for the quantity selector
|
|
221
|
+
*/
|
|
222
|
+
renderQuantitySelector?: (props: {
|
|
223
|
+
quantity: number;
|
|
224
|
+
onIncrement: () => void;
|
|
225
|
+
onDecrement: () => void;
|
|
226
|
+
isDecrementDisabled: boolean;
|
|
227
|
+
isIncrementDisabled: boolean;
|
|
228
|
+
isDisabled: boolean;
|
|
229
|
+
}) => React.ReactNode;
|
|
230
|
+
/**
|
|
231
|
+
* Custom render for sold out badge
|
|
232
|
+
*/
|
|
233
|
+
renderSoldOut?: (label: string) => React.ReactNode;
|
|
234
|
+
/**
|
|
235
|
+
* Custom render for max reached alert
|
|
236
|
+
*/
|
|
237
|
+
renderMaxReachedAlert?: (message: string) => React.ReactNode;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Props for the OfferCard component
|
|
241
|
+
*/
|
|
242
|
+
export interface OfferCardProps {
|
|
243
|
+
/**
|
|
244
|
+
* A unique identifier for testing purposes.
|
|
245
|
+
*/
|
|
246
|
+
'data-testid'?: string;
|
|
247
|
+
/**
|
|
248
|
+
* The offer data to display
|
|
249
|
+
*/
|
|
250
|
+
offer: Offer;
|
|
251
|
+
/**
|
|
252
|
+
* Currently selected quantity (controlled mode)
|
|
253
|
+
*/
|
|
254
|
+
quantity?: number;
|
|
255
|
+
/**
|
|
256
|
+
* Default quantity (uncontrolled mode)
|
|
257
|
+
* @default 0
|
|
258
|
+
*/
|
|
259
|
+
defaultQuantity?: number;
|
|
260
|
+
/**
|
|
261
|
+
* Callback fired when quantity changes
|
|
262
|
+
*/
|
|
263
|
+
onQuantityChange?: (id: string, quantity: number) => void;
|
|
264
|
+
/**
|
|
265
|
+
* Currency code (ISO 4217)
|
|
266
|
+
* @default 'USD'
|
|
267
|
+
*/
|
|
268
|
+
currency?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Locale for currency and number formatting
|
|
271
|
+
* @default 'en-US'
|
|
272
|
+
*/
|
|
273
|
+
locale?: string;
|
|
274
|
+
/**
|
|
275
|
+
* Labels for internationalization
|
|
276
|
+
*/
|
|
277
|
+
labels?: OfferCardLabels;
|
|
278
|
+
/**
|
|
279
|
+
* Slot render functions for custom content
|
|
280
|
+
*/
|
|
281
|
+
slots?: OfferCardSlots;
|
|
282
|
+
/**
|
|
283
|
+
* Whether the component is disabled
|
|
284
|
+
* @default false
|
|
285
|
+
*/
|
|
286
|
+
isDisabled?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Button variant for quantity controls
|
|
289
|
+
* @default 'bordered'
|
|
290
|
+
*/
|
|
291
|
+
buttonVariant?: 'solid' | 'bordered' | 'light' | 'flat' | 'faded' | 'shadow' | 'ghost';
|
|
292
|
+
/**
|
|
293
|
+
* Button color for quantity controls
|
|
294
|
+
* @default 'default'
|
|
295
|
+
*/
|
|
296
|
+
buttonColor?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
|
|
297
|
+
/**
|
|
298
|
+
* Color for the selected/active state
|
|
299
|
+
* @default 'primary'
|
|
300
|
+
*/
|
|
301
|
+
selectedColor?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
|
|
302
|
+
/**
|
|
303
|
+
* Whether to show the component inside a Card
|
|
304
|
+
* @default true
|
|
305
|
+
*/
|
|
306
|
+
showCard?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Whether to show the description
|
|
309
|
+
* @default true
|
|
310
|
+
*/
|
|
311
|
+
showDescription?: boolean;
|
|
312
|
+
/**
|
|
313
|
+
* Whether to show the people count
|
|
314
|
+
* @default true
|
|
315
|
+
*/
|
|
316
|
+
showPeopleCount?: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* Whether to show the price
|
|
319
|
+
* @default true
|
|
320
|
+
*/
|
|
321
|
+
showPrice?: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* Class names for styling different parts of the component
|
|
324
|
+
*/
|
|
325
|
+
classNames?: OfferCardClassNames;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Props for the OfferCardList component
|
|
329
|
+
*/
|
|
330
|
+
export interface OfferCardListProps {
|
|
331
|
+
/**
|
|
332
|
+
* Array of offers to display
|
|
333
|
+
*/
|
|
334
|
+
offers: Offer[];
|
|
335
|
+
/**
|
|
336
|
+
* Currently selected quantities (controlled mode)
|
|
337
|
+
* Map of offer ID to quantity
|
|
338
|
+
*/
|
|
339
|
+
selection?: OfferSelection;
|
|
340
|
+
/**
|
|
341
|
+
* Default selection (uncontrolled mode)
|
|
342
|
+
*/
|
|
343
|
+
defaultSelection?: OfferSelection;
|
|
344
|
+
/**
|
|
345
|
+
* Callback fired when any quantity changes
|
|
346
|
+
*/
|
|
347
|
+
onSelectionChange?: (selection: OfferSelection) => void;
|
|
348
|
+
/**
|
|
349
|
+
* Callback fired when a single offer quantity changes
|
|
350
|
+
*/
|
|
351
|
+
onQuantityChange?: (id: string, quantity: number) => void;
|
|
352
|
+
/**
|
|
353
|
+
* Currency code (ISO 4217)
|
|
354
|
+
* @default 'USD'
|
|
355
|
+
*/
|
|
356
|
+
currency?: string;
|
|
357
|
+
/**
|
|
358
|
+
* Locale for currency and number formatting
|
|
359
|
+
* @default 'en-US'
|
|
360
|
+
*/
|
|
361
|
+
locale?: string;
|
|
362
|
+
/**
|
|
363
|
+
* Labels for internationalization (applied to all cards)
|
|
364
|
+
*/
|
|
365
|
+
labels?: OfferCardLabels;
|
|
366
|
+
/**
|
|
367
|
+
* Slot render functions (applied to all cards)
|
|
368
|
+
*/
|
|
369
|
+
slots?: OfferCardSlots;
|
|
370
|
+
/**
|
|
371
|
+
* Whether all cards are disabled
|
|
372
|
+
* @default false
|
|
373
|
+
*/
|
|
374
|
+
isDisabled?: boolean;
|
|
375
|
+
/**
|
|
376
|
+
* Button variant for quantity controls
|
|
377
|
+
* @default 'bordered'
|
|
378
|
+
*/
|
|
379
|
+
buttonVariant?: 'solid' | 'bordered' | 'light' | 'flat' | 'faded' | 'shadow' | 'ghost';
|
|
380
|
+
/**
|
|
381
|
+
* Button color for quantity controls
|
|
382
|
+
* @default 'default'
|
|
383
|
+
*/
|
|
384
|
+
buttonColor?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
|
|
385
|
+
/**
|
|
386
|
+
* Whether to show cards inside Card components
|
|
387
|
+
* @default true
|
|
388
|
+
*/
|
|
389
|
+
showCard?: boolean;
|
|
390
|
+
/**
|
|
391
|
+
* Whether to animate the list
|
|
392
|
+
* @default true
|
|
393
|
+
*/
|
|
394
|
+
animated?: boolean;
|
|
395
|
+
/**
|
|
396
|
+
* Gap between cards
|
|
397
|
+
* @default 2
|
|
398
|
+
*/
|
|
399
|
+
gap?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
400
|
+
/**
|
|
401
|
+
* Class names for styling different parts of the component
|
|
402
|
+
*/
|
|
403
|
+
classNames?: OfferCardListClassNames;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Props for the OfferCardSkeleton component
|
|
407
|
+
*/
|
|
408
|
+
export interface OfferCardSkeletonProps {
|
|
409
|
+
/**
|
|
410
|
+
* Number of skeleton cards to display
|
|
411
|
+
* @default 2
|
|
412
|
+
*/
|
|
413
|
+
quantity?: number;
|
|
414
|
+
/**
|
|
415
|
+
* Gap between skeleton cards
|
|
416
|
+
* @default 4
|
|
417
|
+
*/
|
|
418
|
+
gap?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
419
|
+
/**
|
|
420
|
+
* Class names for styling different parts of the component
|
|
421
|
+
*/
|
|
422
|
+
classNames?: OfferCardSkeletonClassNames;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Props for the OfferCardError component
|
|
426
|
+
*/
|
|
427
|
+
export interface OfferCardErrorProps {
|
|
428
|
+
/**
|
|
429
|
+
* Custom error message to display
|
|
430
|
+
*/
|
|
431
|
+
error?: string;
|
|
432
|
+
/**
|
|
433
|
+
* Labels for internationalization
|
|
434
|
+
*/
|
|
435
|
+
labels?: OfferCardErrorLabels;
|
|
436
|
+
/**
|
|
437
|
+
* Whether to show inside a Card
|
|
438
|
+
* @default true
|
|
439
|
+
*/
|
|
440
|
+
showCard?: boolean;
|
|
441
|
+
/**
|
|
442
|
+
* Alert color variant
|
|
443
|
+
* @default 'danger'
|
|
444
|
+
*/
|
|
445
|
+
color?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
|
|
446
|
+
/**
|
|
447
|
+
* Class names for styling different parts of the component
|
|
448
|
+
*/
|
|
449
|
+
classNames?: OfferCardErrorClassNames;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Props for the OfferCardEmpty component
|
|
453
|
+
*/
|
|
454
|
+
export interface OfferCardEmptyProps {
|
|
455
|
+
/**
|
|
456
|
+
* Custom message to display
|
|
457
|
+
* @default 'No offers available.'
|
|
458
|
+
*/
|
|
459
|
+
message?: string;
|
|
460
|
+
/**
|
|
461
|
+
* Iconify icon to display
|
|
462
|
+
* @default 'solar:ticket-sale-outline'
|
|
463
|
+
*/
|
|
464
|
+
icon?: string;
|
|
465
|
+
/**
|
|
466
|
+
* Icon size in pixels
|
|
467
|
+
* @default 48
|
|
468
|
+
*/
|
|
469
|
+
iconSize?: number;
|
|
470
|
+
/**
|
|
471
|
+
* Whether to show inside a Card
|
|
472
|
+
* @default true
|
|
473
|
+
*/
|
|
474
|
+
showCard?: boolean;
|
|
475
|
+
/**
|
|
476
|
+
* Class names for styling different parts of the component
|
|
477
|
+
*/
|
|
478
|
+
classNames?: OfferCardEmptyClassNames;
|
|
479
|
+
/**
|
|
480
|
+
* Custom render function for the entire empty state
|
|
481
|
+
*/
|
|
482
|
+
renderEmpty?: () => React.ReactNode;
|
|
483
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Currency formatting utilities for OfferCard
|
|
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(25.00, 'en-US', 'USD') // "$25.00"
|
|
13
|
+
* formatCurrency(25.00, 'es-ES', 'EUR') // "25,00 €"
|
|
14
|
+
* formatCurrency(1000, 'de-DE', 'EUR') // "1.000,00 €"
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatCurrency(amount: number, locale?: string, currency?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Parses a currency string to a number
|
|
19
|
+
* @param value - The currency string to parse
|
|
20
|
+
* @returns Parsed number or null if invalid
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* parseCurrency('$25.00') // 25
|
|
24
|
+
* parseCurrency('1.000,00 €') // 1000
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseCurrency(value: string): number | null;
|
package/dist/patterns/index.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ export type { RichTextAreaProps } from './RichText';
|
|
|
6
6
|
export { RichTextArea, RICH_TEXT_PRESETS } from './RichText';
|
|
7
7
|
export { DonationAmounts } from './DonationAmounts';
|
|
8
8
|
export { ExpireCartTimer } from './ExpireCartTimer';
|
|
9
|
+
export { OfferCard, OfferCardList, OfferCardSkeleton, OfferCardError, OfferCardEmpty, offerListVariants, offerCardVariants, formatCurrency as formatOfferCurrency, parseCurrency as parseOfferCurrency, } from './OfferCard';
|
|
9
10
|
export type { NavbarProps, NavbarLink, NavbarLanguage } from './Navbar';
|
|
10
11
|
export type { StepperProps } from './Stepper';
|
|
11
12
|
export type { DonationAmountsProps, DonationAmount, SelectedDonation, DonationLabels } from './DonationAmounts';
|
|
12
13
|
export type { ExpireCartTimerProps } from './ExpireCartTimer';
|
|
14
|
+
export type { Offer, OfferSelection, OfferCardLabels, OfferCardErrorLabels, OfferCardClassNames, OfferCardListClassNames, OfferCardSkeletonClassNames, OfferCardErrorClassNames, OfferCardEmptyClassNames, OfferCardSlots, OfferCardProps, OfferCardListProps, OfferCardSkeletonProps, OfferCardErrorProps, OfferCardEmptyProps, } from './OfferCard';
|