@asdp/ferryui 0.1.0 → 0.1.1

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.d.ts CHANGED
@@ -1,6 +1,23 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
+ import { CarouselAnnouncerFunction } from '@fluentui/react-components';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
4
 
3
- interface ModalRadiusProps {
5
+ interface ModalIllustrationButton {
6
+ /**
7
+ * Button text
8
+ */
9
+ text: string;
10
+ /**
11
+ * Button click handler
12
+ */
13
+ onClick: () => void;
14
+ /**
15
+ * Button appearance
16
+ * @default "primary"
17
+ */
18
+ appearance?: 'primary' | 'outline' | 'secondary' | 'subtle' | 'transparent';
19
+ }
20
+ interface ModalIllustrationProps {
4
21
  /**
5
22
  * Whether the modal is open
6
23
  */
@@ -11,22 +28,25 @@ interface ModalRadiusProps {
11
28
  onClose: () => void;
12
29
  /**
13
30
  * Modal title
14
- * @default "Anda berada di luar area pemesanan"
15
31
  */
16
- title?: string;
32
+ title: string;
17
33
  /**
18
34
  * Modal message content
19
- * @default "Pemesanan tiket tidak dapat dilakukan dari lokasi Anda saat ini..."
35
+ * Can be a string or React node for more complex content
20
36
  */
21
- message?: string;
37
+ message: string | ReactNode;
22
38
  /**
23
39
  * Image source URL
24
40
  * @default "/assets/images/illustrations/radius.svg"
41
+ * @remarks
42
+ * When using this component in your application, ensure the asset is available at this path
43
+ * in your public directory, or provide a custom imageSrc prop pointing to your own image.
44
+ * The asset is included in the published package at `node_modules/@asdp/ferryui/dist/assets/images/illustrations/`
25
45
  */
26
46
  imageSrc?: string;
27
47
  /**
28
48
  * Image alt text
29
- * @default "Radius Illustration"
49
+ * @default "Illustration"
30
50
  */
31
51
  imageAlt?: string;
32
52
  /**
@@ -40,15 +60,302 @@ interface ModalRadiusProps {
40
60
  */
41
61
  imageHeight?: number;
42
62
  /**
43
- * Button text
44
- * @default "Tutup & Coba Lagi"
63
+ * Primary button configuration
64
+ */
65
+ primaryButton: ModalIllustrationButton;
66
+ /**
67
+ * Optional secondary button configuration
68
+ * If provided, buttons will be displayed side by side
69
+ */
70
+ secondaryButton?: ModalIllustrationButton;
71
+ }
72
+ declare const ModalIllustration: React.FC<ModalIllustrationProps>;
73
+
74
+ /**
75
+ * Preset configurations for common modal use cases
76
+ */
77
+ declare const MODAL_PRESETS: {
78
+ /**
79
+ * Modal for radius/location restriction
80
+ */
81
+ readonly RADIUS: {
82
+ readonly title: "Anda berada di luar area pemesanan";
83
+ readonly message: "Pemesanan tiket tidak dapat dilakukan dari lokasi Anda saat ini. Fitur pembatasan wilayah sedang aktif untuk mencegah pemesanan tidak sah.";
84
+ readonly imageSrc: "/assets/images/illustrations/radius.svg";
85
+ readonly imageAlt: "Radius Limitation Illustration";
86
+ };
87
+ /**
88
+ * Modal for expired session
89
+ */
90
+ readonly SESSION_EXPIRED: {
91
+ readonly title: "Sesi anda telah berakhir";
92
+ readonly message: "Waktu sesi Anda telah habis untuk alasan keamanan. Silakan klik tombol dibawah untuk masuk kembali.";
93
+ readonly imageSrc: "/assets/images/illustrations/sessionexp.svg";
94
+ readonly imageAlt: "Session Expired Illustration";
95
+ };
96
+ /**
97
+ * Modal for purchase period expired
98
+ */
99
+ readonly PURCHASE_PERIOD_EXPIRED: {
100
+ readonly title: "Waktu pembelian telah berakhir";
101
+ readonly message: "Pemesanan tiket ditutup 1 jam sebelum jadwal keberangkatan. Silakan pilih jadwal keberangkatan lain yang masih tersedia.";
102
+ readonly imageSrc: "/assets/images/illustrations/pay.svg";
103
+ readonly imageAlt: "Purchase Period Expired Illustration";
104
+ };
105
+ /**
106
+ * Modal for transaction limit reached
107
+ */
108
+ readonly TRANSACTION_LIMIT: {
109
+ readonly title: "Anda mencapai batas transaksi tertunda";
110
+ readonly message: "Anda telah mencapai batas transaksi tertunda. Pemesanan dapat dilakukan kembali setelah transaksi sebelumnya diselesaikan.";
111
+ readonly imageSrc: "/assets/images/illustrations/mobile-pay.svg";
112
+ readonly imageAlt: "Transaction Limit Illustration";
113
+ };
114
+ };
115
+ /**
116
+ * Type for preset keys
117
+ */
118
+ type ModalPresetKey = keyof typeof MODAL_PRESETS;
119
+ /**
120
+ * Helper function to get preset configuration
121
+ */
122
+ declare const getModalPreset: (presetKey: ModalPresetKey) => Partial<ModalIllustrationProps>;
123
+
124
+ interface CarouselWithCustomNavProps {
125
+ /**
126
+ * Carousel items/children
127
+ */
128
+ children: ReactNode;
129
+ /**
130
+ * Whether carousel should loop (circular)
131
+ * @default true
132
+ */
133
+ circular?: boolean;
134
+ /**
135
+ * Whether carousel is draggable
136
+ * @default true
137
+ */
138
+ draggable?: boolean;
139
+ /**
140
+ * Alignment of carousel items
141
+ * @default "start"
142
+ */
143
+ align?: 'start' | 'center' | 'end';
144
+ /**
145
+ * Whether to remove whitespace between items
146
+ * @default false
147
+ */
148
+ whitespace?: boolean;
149
+ /**
150
+ * Announcement function for accessibility
151
+ */
152
+ announcement?: CarouselAnnouncerFunction;
153
+ /**
154
+ * Active index (controlled)
155
+ */
156
+ activeIndex?: number;
157
+ /**
158
+ * Callback when active index changes
159
+ */
160
+ onActiveIndexChange?: (index: number) => void;
161
+ /**
162
+ * ARIA label for the carousel slider
163
+ * @default "Carousel"
164
+ */
165
+ ariaLabel?: string;
166
+ /**
167
+ * Whether to use dark background for navigation
168
+ * @default true
169
+ */
170
+ darkNavBackground?: boolean;
171
+ /**
172
+ * Additional className for carousel container
173
+ */
174
+ className?: string;
175
+ /**
176
+ * Whether to enable card focus mode
177
+ * @default false
178
+ */
179
+ cardFocus?: boolean;
180
+ }
181
+ declare const CarouselWithCustomNav: React.FC<CarouselWithCustomNavProps>;
182
+
183
+ interface CardPromoProps {
184
+ /**
185
+ * Image URL for the promo
186
+ */
187
+ imageUrl: string;
188
+ /**
189
+ * Promo title/heading
190
+ */
191
+ title: string;
192
+ /**
193
+ * Promo description/subtitle
194
+ */
195
+ description: string;
196
+ /**
197
+ * Image alt text
198
+ * @default "Promo image"
199
+ */
200
+ imageAlt?: string;
201
+ /**
202
+ * Index of the card (for accessibility)
203
+ */
204
+ index?: number;
205
+ /**
206
+ * Total number of cards (for accessibility)
207
+ */
208
+ totalCards?: number;
209
+ /**
210
+ * Click handler for the card
211
+ */
212
+ onClick?: () => void;
213
+ }
214
+ declare const CardPromo: React.FC<CardPromoProps>;
215
+
216
+ interface CardBannerProps {
217
+ /**
218
+ * Banner image URL
219
+ */
220
+ imageUrl: string;
221
+ /**
222
+ * Banner alt text
223
+ */
224
+ alt: string;
225
+ /**
226
+ * Index of the banner (for accessibility)
227
+ */
228
+ index?: number;
229
+ /**
230
+ * Total number of banners (for accessibility)
231
+ */
232
+ totalBanners?: number;
233
+ /**
234
+ * Click handler for the banner
235
+ */
236
+ onClick?: () => void;
237
+ }
238
+ declare const CardBanner: React.FC<CardBannerProps>;
239
+
240
+ interface CardTicketButton {
241
+ label: string;
242
+ icon?: JSX.Element;
243
+ onClick?: () => void;
244
+ }
245
+ interface CardTicketProps {
246
+ /**
247
+ * Ship type badge configuration
248
+ */
249
+ shipType: {
250
+ label: string;
251
+ color: 'brand' | 'danger' | 'important' | 'informative' | 'severe' | 'subtle' | 'success' | 'warning';
252
+ tooltip?: string;
253
+ };
254
+ /**
255
+ * Logo image source
256
+ * @default "/assets/logo/asdp-default.svg"
257
+ */
258
+ logoSrc?: string;
259
+ /**
260
+ * Ship name
261
+ */
262
+ shipName: string;
263
+ /**
264
+ * Available seats configuration
265
+ */
266
+ availableSeats: {
267
+ count: number;
268
+ threshold?: number;
269
+ };
270
+ /**
271
+ * Departure information
272
+ */
273
+ departure: {
274
+ day: string;
275
+ time: string;
276
+ location: string;
277
+ };
278
+ /**
279
+ * Arrival information
280
+ */
281
+ arrival: {
282
+ day: string;
283
+ time: string;
284
+ location: string;
285
+ };
286
+ /**
287
+ * Duration text
288
+ */
289
+ duration: string;
290
+ /**
291
+ * Middle section action buttons (max 2)
292
+ */
293
+ actionButtons?: CardTicketButton[];
294
+ /**
295
+ * Price display (formatted string)
296
+ */
297
+ price: string;
298
+ /**
299
+ * Primary button configuration
300
+ */
301
+ primaryButton: CardTicketButton;
302
+ /**
303
+ * List of facilities
304
+ */
305
+ facilities: string[];
306
+ /**
307
+ * Custom icon for ship indicator
308
+ */
309
+ shipIcon?: JSX.Element;
310
+ /**
311
+ * Custom icon for facilities checkmark
312
+ */
313
+ facilityIcon?: JSX.Element;
314
+ }
315
+ declare const CardTicket: React.FC<CardTicketProps>;
316
+
317
+ /**
318
+ * Horizontal ticket card background with decorative perforated edges
319
+ * Use this for desktop/landscape layouts
320
+ */
321
+ declare const BackgroundTicketCard: (props: React.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
322
+
323
+ /**
324
+ * Vertical ticket card background with decorative perforated edges
325
+ * Use this for mobile/portrait layouts
326
+ */
327
+ declare const BackgroundTicketCardVertical: (props: React.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
328
+
329
+ interface ServiceMenuItem {
330
+ id: string;
331
+ label: string;
332
+ logo?: string;
333
+ description?: string;
334
+ customStyle?: React.CSSProperties;
335
+ }
336
+ interface CardServiceMenuProps {
337
+ /**
338
+ * Array of menu items to display
339
+ */
340
+ items: ServiceMenuItem[];
341
+ /**
342
+ * Currently active item ID
343
+ */
344
+ activeItemId?: string;
345
+ /**
346
+ * Callback when an item is clicked
347
+ */
348
+ onItemClick?: (itemId: string) => void;
349
+ /**
350
+ * Whether to show descriptions on desktop
351
+ * @default true
45
352
  */
46
- buttonText?: string;
353
+ showDescriptions?: boolean;
47
354
  /**
48
- * Button click handler (if not provided, uses onClose)
355
+ * Custom className for the card
49
356
  */
50
- onButtonClick?: () => void;
357
+ className?: string;
51
358
  }
52
- declare const ModalRadius: React.FC<ModalRadiusProps>;
359
+ declare const CardServiceMenu: React.FC<CardServiceMenuProps>;
53
360
 
54
- export { ModalRadius, ModalRadius as ModalRadiusDefault, type ModalRadiusProps };
361
+ export { BackgroundTicketCard, BackgroundTicketCardVertical, CardBanner, type CardBannerProps, CardPromo, type CardPromoProps, CardServiceMenu, type CardServiceMenuProps, CardTicket, type CardTicketButton, type CardTicketProps, CarouselWithCustomNav, type CarouselWithCustomNavProps, MODAL_PRESETS, ModalIllustration, type ModalIllustrationButton, type ModalIllustrationProps, type ModalPresetKey, type ServiceMenuItem, getModalPreset };