@veevarts/design-system 0.1.23 → 1.0.0-alpha.12
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/components/index.d.ts +12 -1
- package/dist/index.cjs +11 -11
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3113 -1651
- package/dist/patterns/DonationAmounts/index.d.ts +1 -1
- package/dist/patterns/EventDetails/EventDetails.d.ts +37 -0
- package/dist/patterns/EventDetails/EventDetails.test.d.ts +0 -0
- package/dist/patterns/EventDetails/index.d.ts +2 -0
- package/dist/patterns/ExpireCartTimer/ExpireCartTimer.d.ts +249 -0
- package/dist/patterns/ExpireCartTimer/ExpireCartTimer.test.d.ts +4 -0
- package/dist/patterns/ExpireCartTimer/index.d.ts +1 -0
- package/dist/patterns/Footer/Footer.d.ts +4 -21
- package/dist/patterns/Footer/Footer.test.d.ts +1 -0
- package/dist/patterns/Footer/index.d.ts +0 -1
- package/dist/patterns/Navbar/Navbar.d.ts +23 -7
- package/dist/patterns/Navbar/Navbar.test.d.ts +1 -0
- 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/RevenueDistribution/RevenueDistributionCard.d.ts +16 -0
- package/dist/patterns/RevenueDistribution/RevenueDistributionCard.test.d.ts +1 -0
- package/dist/patterns/RevenueDistribution/RevenueDistributionEmpty.d.ts +11 -0
- package/dist/patterns/RevenueDistribution/RevenueDistributionError.d.ts +11 -0
- package/dist/patterns/RevenueDistribution/RevenueDistributionSkeleton.d.ts +11 -0
- package/dist/patterns/RevenueDistribution/examples/InteractiveExample.d.ts +8 -0
- package/dist/patterns/RevenueDistribution/examples/MultipleDistributionsFormExample.d.ts +10 -0
- package/dist/patterns/RevenueDistribution/examples/WithGlAccountSearchExample.d.ts +7 -0
- package/dist/patterns/RevenueDistribution/examples/index.d.ts +9 -0
- package/dist/patterns/RevenueDistribution/index.d.ts +14 -0
- package/dist/patterns/RevenueDistribution/types.d.ts +394 -0
- package/dist/patterns/RevenueDistribution/utils/amount.d.ts +56 -0
- package/dist/patterns/RevenueDistribution/utils/data.d.ts +4 -0
- package/dist/patterns/RevenueDistribution/utils/index.d.ts +5 -0
- package/dist/patterns/RichText/RichText.d.ts +1 -0
- package/dist/patterns/RichText/TipTapArea/TipTapArea.d.ts +1 -1
- package/dist/patterns/RichText/toolbar/Toolbar.d.ts +8 -1
- package/dist/patterns/RichText/toolbar/hooks/useToolbarCommands.d.ts +5 -1
- package/dist/patterns/RichText/toolbar/sections/TextFormattingSection.d.ts +5 -1
- package/dist/patterns/RichText/types/props.d.ts +9 -1
- package/dist/patterns/Stepper/Stepper.d.ts +1 -1
- package/dist/patterns/index.d.ts +5 -1
- package/dist/templates/ConfirmationPageTemplate/ConfirmationPageTemplate.d.ts +0 -2
- package/dist/templates/EventDetailsTemplate/EventDetailsTemplate.d.ts +0 -2
- package/dist/theme/index.d.ts +26 -2
- package/dist/tokens/colors.d.ts +72 -7
- package/package.json +16 -16
- package/dist/components/Footer/Footer.d.ts +0 -4
- package/dist/components/Footer/index.d.ts +0 -1
|
@@ -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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
import { RevenueDistributionCardProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* RevenueDistributionCard displays a single distribution with
|
|
6
|
+
* amount input, GL account selector, tax deductible checkbox, and delete button.
|
|
7
|
+
*
|
|
8
|
+
* Supports two modes:
|
|
9
|
+
* 1. Standalone mode: Use distribution/onDistributionChange props
|
|
10
|
+
* 2. React Hook Form mode: Pass control and name props for native RHF integration
|
|
11
|
+
*/
|
|
12
|
+
export declare const RevenueDistributionCard: {
|
|
13
|
+
<TFieldValues extends FieldValues = FieldValues>({ distribution: distributionProp, defaultDistribution, glAccounts, isLoadingGlAccounts, onSearchGlAccounts, onDistributionChange, onAmountChange, onGlAccountChange, onTaxDeductibleChange, onDelete, canDelete, canEditTaxDeductible, isDisabled, labels: customLabels, classNames, "data-testid": dataTestId, control, name, rules, }: RevenueDistributionCardProps<TFieldValues>): JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
export default RevenueDistributionCard;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { RevenueDistributionEmptyProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* RevenueDistributionEmpty displays a placeholder when there are no
|
|
5
|
+
* distributions configured or available.
|
|
6
|
+
*/
|
|
7
|
+
export declare const RevenueDistributionEmpty: {
|
|
8
|
+
({ message, icon, iconSize, showCard, classNames, renderEmpty, }: RevenueDistributionEmptyProps): JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
export default RevenueDistributionEmpty;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { RevenueDistributionErrorProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* RevenueDistributionError displays an error alert when there's an issue
|
|
5
|
+
* loading or processing distributions.
|
|
6
|
+
*/
|
|
7
|
+
export declare const RevenueDistributionError: {
|
|
8
|
+
({ error, labels: customLabels, showCard, color, classNames, }: RevenueDistributionErrorProps): JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
export default RevenueDistributionError;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { RevenueDistributionSkeletonProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* RevenueDistributionSkeleton displays a loading placeholder
|
|
5
|
+
* matching the structure of RevenueDistributionCard.
|
|
6
|
+
*/
|
|
7
|
+
export declare const RevenueDistributionSkeleton: {
|
|
8
|
+
({ rows, showCard, classNames, }: RevenueDistributionSkeletonProps): JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
export default RevenueDistributionSkeleton;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InteractiveExample
|
|
3
|
+
*
|
|
4
|
+
* A stateful example component for the RevenueDistributionCard.
|
|
5
|
+
* Demonstrates controlled mode with GL account search.
|
|
6
|
+
*/
|
|
7
|
+
export declare const InteractiveExample: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default InteractiveExample;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MultipleDistributionsFormExample
|
|
3
|
+
*
|
|
4
|
+
* Example demonstrating multiple RevenueDistributionCard components
|
|
5
|
+
* managed with React Hook Form's useFieldArray.
|
|
6
|
+
*
|
|
7
|
+
* Uses native RHF integration via control/name props for validation.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MultipleDistributionsFormExample: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default MultipleDistributionsFormExample;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RevenueDistribution Examples
|
|
3
|
+
*
|
|
4
|
+
* Stateful example components for Storybook stories.
|
|
5
|
+
* These are separated from stories to avoid using hooks directly in stories.
|
|
6
|
+
*/
|
|
7
|
+
export { InteractiveExample } from './InteractiveExample';
|
|
8
|
+
export { WithGlAccountSearchExample } from './WithGlAccountSearchExample';
|
|
9
|
+
export { MultipleDistributionsFormExample } from './MultipleDistributionsFormExample';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RevenueDistribution Pattern
|
|
3
|
+
*
|
|
4
|
+
* A pattern for displaying and editing a single revenue distribution.
|
|
5
|
+
* Includes card component with amount input, GL account selector,
|
|
6
|
+
* tax deductible checkbox, and delete button.
|
|
7
|
+
*/
|
|
8
|
+
export { RevenueDistributionCard } from './RevenueDistributionCard';
|
|
9
|
+
export { RevenueDistributionSkeleton } from './RevenueDistributionSkeleton';
|
|
10
|
+
export { RevenueDistributionError } from './RevenueDistributionError';
|
|
11
|
+
export { RevenueDistributionEmpty } from './RevenueDistributionEmpty';
|
|
12
|
+
export type { GlAccount, Distribution, RevenueDistributionLabels, RevenueDistributionErrorLabels, RevenueDistributionEmptyLabels, RevenueDistributionCardClassNames, RevenueDistributionSkeletonClassNames, RevenueDistributionErrorClassNames, RevenueDistributionEmptyClassNames, RevenueDistributionCardProps, RevenueDistributionSkeletonProps, RevenueDistributionErrorProps, RevenueDistributionEmptyProps, } from './types';
|
|
13
|
+
export { formatAmount, formatCurrency, getCurrencySymbol, parseCurrency, calculateAllocationDifference, generateDistributionId, } from './utils';
|
|
14
|
+
export { InteractiveExample, WithGlAccountSearchExample, MultipleDistributionsFormExample } from './examples';
|