@asdp/ferryui 0.1.1 → 0.1.4

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.mts CHANGED
@@ -1,6 +1,7 @@
1
- import React, { ReactNode } from 'react';
1
+ import React$1, { ReactNode } from 'react';
2
2
  import { CarouselAnnouncerFunction } from '@fluentui/react-components';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { FieldValues, Path, Control } from 'react-hook-form';
4
5
 
5
6
  interface ModalIllustrationButton {
6
7
  /**
@@ -69,7 +70,7 @@ interface ModalIllustrationProps {
69
70
  */
70
71
  secondaryButton?: ModalIllustrationButton;
71
72
  }
72
- declare const ModalIllustration: React.FC<ModalIllustrationProps>;
73
+ declare const ModalIllustration: React$1.FC<ModalIllustrationProps>;
73
74
 
74
75
  /**
75
76
  * Preset configurations for common modal use cases
@@ -178,7 +179,7 @@ interface CarouselWithCustomNavProps {
178
179
  */
179
180
  cardFocus?: boolean;
180
181
  }
181
- declare const CarouselWithCustomNav: React.FC<CarouselWithCustomNavProps>;
182
+ declare const CarouselWithCustomNav: React$1.FC<CarouselWithCustomNavProps>;
182
183
 
183
184
  interface CardPromoProps {
184
185
  /**
@@ -211,7 +212,7 @@ interface CardPromoProps {
211
212
  */
212
213
  onClick?: () => void;
213
214
  }
214
- declare const CardPromo: React.FC<CardPromoProps>;
215
+ declare const CardPromo: React$1.FC<CardPromoProps>;
215
216
 
216
217
  interface CardBannerProps {
217
218
  /**
@@ -235,7 +236,7 @@ interface CardBannerProps {
235
236
  */
236
237
  onClick?: () => void;
237
238
  }
238
- declare const CardBanner: React.FC<CardBannerProps>;
239
+ declare const CardBanner: React$1.FC<CardBannerProps>;
239
240
 
240
241
  interface CardTicketButton {
241
242
  label: string;
@@ -312,26 +313,26 @@ interface CardTicketProps {
312
313
  */
313
314
  facilityIcon?: JSX.Element;
314
315
  }
315
- declare const CardTicket: React.FC<CardTicketProps>;
316
+ declare const CardTicket: React$1.FC<CardTicketProps>;
316
317
 
317
318
  /**
318
319
  * Horizontal ticket card background with decorative perforated edges
319
320
  * Use this for desktop/landscape layouts
320
321
  */
321
- declare const BackgroundTicketCard: (props: React.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
322
+ declare const BackgroundTicketCard: (props: React$1.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
322
323
 
323
324
  /**
324
325
  * Vertical ticket card background with decorative perforated edges
325
326
  * Use this for mobile/portrait layouts
326
327
  */
327
- declare const BackgroundTicketCardVertical: (props: React.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
328
+ declare const BackgroundTicketCardVertical: (props: React$1.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
328
329
 
329
330
  interface ServiceMenuItem {
330
331
  id: string;
331
332
  label: string;
332
333
  logo?: string;
333
334
  description?: string;
334
- customStyle?: React.CSSProperties;
335
+ customStyle?: React$1.CSSProperties;
335
336
  }
336
337
  interface CardServiceMenuProps {
337
338
  /**
@@ -356,6 +357,200 @@ interface CardServiceMenuProps {
356
357
  */
357
358
  className?: string;
358
359
  }
359
- declare const CardServiceMenu: React.FC<CardServiceMenuProps>;
360
+ declare const CardServiceMenu: React$1.FC<CardServiceMenuProps>;
360
361
 
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 };
362
+ type InputType = 'checkbox' | 'date' | 'datetime-local' | 'email' | 'file' | 'identity' | 'emailOrPhone' | 'number' | 'otp' | 'passport' | 'password' | 'phone' | 'radio' | 'radiobutton' | 'select' | 'switch' | 'tel' | 'text' | 'textarea' | 'time' | 'url';
363
+ interface SelectOption {
364
+ value: string;
365
+ label: string;
366
+ disabled?: boolean;
367
+ }
368
+ interface RadioOption {
369
+ value: string;
370
+ label: string;
371
+ disabled?: boolean;
372
+ }
373
+ interface CountryCode {
374
+ code: string;
375
+ name: string;
376
+ dialCode: string;
377
+ flag?: string;
378
+ passportRegex?: string;
379
+ }
380
+ interface InputDynamicProps<T extends FieldValues = FieldValues> {
381
+ name: Path<T>;
382
+ control: Control<T>;
383
+ label?: string;
384
+ type: InputType;
385
+ placeholder?: string;
386
+ required?: boolean;
387
+ disabled?: boolean;
388
+ options?: SelectOption[] | RadioOption[];
389
+ multiple?: boolean;
390
+ accept?: string;
391
+ rows?: number;
392
+ min?: number | string;
393
+ max?: number | string;
394
+ step?: number | string;
395
+ isMultiSelect?: boolean;
396
+ selectScrollbarColor?: string;
397
+ contentBefore?: React.ReactNode;
398
+ appearance?: 'outline' | 'underline' | 'filled-darker' | 'filled-lighter' | 'filled-darker-shadow' | 'filled-lighter-shadow';
399
+ validationRules?: {
400
+ required?: string | boolean;
401
+ minLength?: {
402
+ value: number;
403
+ message: string;
404
+ };
405
+ maxLength?: {
406
+ value: number;
407
+ message: string;
408
+ };
409
+ pattern?: {
410
+ value: RegExp;
411
+ message: string;
412
+ };
413
+ min?: {
414
+ value: number;
415
+ message: string;
416
+ };
417
+ max?: {
418
+ value: number;
419
+ message: string;
420
+ };
421
+ validate?: (value: any) => string | boolean;
422
+ };
423
+ helperText?: string;
424
+ className?: string;
425
+ layout?: 'horizontal' | 'vertical';
426
+ size?: 'small' | 'medium' | 'large';
427
+ onClick?: () => void;
428
+ style?: React.CSSProperties;
429
+ countryCodes?: CountryCode[];
430
+ defaultCountry?: string;
431
+ maxLength?: number;
432
+ autoAdvance?: boolean;
433
+ otpIndex?: number;
434
+ hasError?: boolean;
435
+ autoComplete?: string;
436
+ onInput?: (e: React.FormEvent<HTMLInputElement>) => void;
437
+ contentAfter?: React.ReactNode;
438
+ onChange?: (value: any) => void;
439
+ }
440
+
441
+ declare function InputDynamic<T extends FieldValues = FieldValues>({ name, control, label, type, placeholder, required, disabled, options, multiple, accept, rows, min, max, step, isMultiSelect, selectScrollbarColor, contentBefore, appearance, validationRules, helperText, className, layout, size, onClick, style, countryCodes, defaultCountry, maxLength, autoAdvance, otpIndex, hasError, autoComplete, onInput, contentAfter, onChange, }: InputDynamicProps<T>): react_jsx_runtime.JSX.Element;
442
+
443
+ declare const DEFAULT_COUNTRY_CODES: CountryCode[];
444
+
445
+ /**
446
+ * Harbor item interface
447
+ */
448
+ interface HarborItem {
449
+ /**
450
+ * Unique identifier for the harbor
451
+ */
452
+ id: number;
453
+ /**
454
+ * Display name of the harbor
455
+ */
456
+ name: string;
457
+ }
458
+ /**
459
+ * Props for ModalSearchHarbor component
460
+ */
461
+ interface ModalSearchHarborProps {
462
+ /**
463
+ * Whether the modal is open
464
+ */
465
+ open: boolean;
466
+ /**
467
+ * Callback when modal should close
468
+ */
469
+ onClose: () => void;
470
+ /**
471
+ * Modal title
472
+ * @default "Pilih Pelabuhan"
473
+ */
474
+ title?: string;
475
+ /**
476
+ * Type of modal - origin or destination
477
+ * @default "origin"
478
+ */
479
+ modalType?: 'origin' | 'destination';
480
+ /**
481
+ * List of harbors to display
482
+ */
483
+ harbors: HarborItem[];
484
+ /**
485
+ * List of favorite harbors
486
+ */
487
+ favoriteHarbors: HarborItem[];
488
+ /**
489
+ * List of last searched harbors
490
+ */
491
+ lastSearchedHarbors: HarborItem[];
492
+ /**
493
+ * Loading state
494
+ * @default false
495
+ */
496
+ isLoading?: boolean;
497
+ /**
498
+ * Current search query value
499
+ */
500
+ searchQuery: string;
501
+ /**
502
+ * Callback when search query changes
503
+ */
504
+ onSearchChange: (query: string) => void;
505
+ /**
506
+ * Callback when a harbor is selected
507
+ */
508
+ onSelectHarbor: (harbor: HarborItem) => void;
509
+ /**
510
+ * Callback when favorite is toggled
511
+ */
512
+ onToggleFavorite: (harbor: HarborItem) => void;
513
+ /**
514
+ * Callback when adding to last searched
515
+ */
516
+ onAddLastSearched: (harbor: HarborItem) => void;
517
+ /**
518
+ * Callback when removing from last searched
519
+ */
520
+ onRemoveLastSearched: (harborId: number) => void;
521
+ /**
522
+ * Callback when clearing all last searched
523
+ */
524
+ onClearLastSearched: () => void;
525
+ }
526
+ /**
527
+ * ModalSearchHarbor - A reusable modal component for searching and selecting harbors
528
+ *
529
+ * This component provides a searchable modal interface for selecting harbors with features like:
530
+ * - Search functionality
531
+ * - Favorite harbors quick access
532
+ * - Last searched history
533
+ * - Loading states
534
+ *
535
+ * @example
536
+ * ```tsx
537
+ * <ModalSearchHarbor
538
+ * open={isOpen}
539
+ * onClose={() => setIsOpen(false)}
540
+ * title="Pilih Pelabuhan Asal"
541
+ * harbors={harborList}
542
+ * favoriteHarbors={favorites}
543
+ * lastSearchedHarbors={history}
544
+ * searchQuery={search}
545
+ * onSearchChange={setSearch}
546
+ * onSelectHarbor={handleSelect}
547
+ * onToggleFavorite={handleToggleFavorite}
548
+ * onAddLastSearched={handleAddHistory}
549
+ * onRemoveLastSearched={handleRemoveHistory}
550
+ * onClearLastSearched={handleClearHistory}
551
+ * />
552
+ * ```
553
+ */
554
+ declare const ModalSearchHarbor: React.FC<ModalSearchHarborProps>;
555
+
556
+ export { BackgroundTicketCard, BackgroundTicketCardVertical, CardBanner, type CardBannerProps, CardPromo, type CardPromoProps, CardServiceMenu, type CardServiceMenuProps, CardTicket, type CardTicketButton, type CardTicketProps, CarouselWithCustomNav, type CarouselWithCustomNavProps, type CountryCode, DEFAULT_COUNTRY_CODES, type HarborItem, InputDynamic, type InputDynamicProps, type InputType, MODAL_PRESETS, ModalIllustration, type ModalIllustrationButton, type ModalIllustrationProps, type ModalPresetKey, ModalSearchHarbor, type ModalSearchHarborProps, type RadioOption, type SelectOption, type ServiceMenuItem, getModalPreset };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import React, { ReactNode } from 'react';
1
+ import React$1, { ReactNode } from 'react';
2
2
  import { CarouselAnnouncerFunction } from '@fluentui/react-components';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { FieldValues, Path, Control } from 'react-hook-form';
4
5
 
5
6
  interface ModalIllustrationButton {
6
7
  /**
@@ -69,7 +70,7 @@ interface ModalIllustrationProps {
69
70
  */
70
71
  secondaryButton?: ModalIllustrationButton;
71
72
  }
72
- declare const ModalIllustration: React.FC<ModalIllustrationProps>;
73
+ declare const ModalIllustration: React$1.FC<ModalIllustrationProps>;
73
74
 
74
75
  /**
75
76
  * Preset configurations for common modal use cases
@@ -178,7 +179,7 @@ interface CarouselWithCustomNavProps {
178
179
  */
179
180
  cardFocus?: boolean;
180
181
  }
181
- declare const CarouselWithCustomNav: React.FC<CarouselWithCustomNavProps>;
182
+ declare const CarouselWithCustomNav: React$1.FC<CarouselWithCustomNavProps>;
182
183
 
183
184
  interface CardPromoProps {
184
185
  /**
@@ -211,7 +212,7 @@ interface CardPromoProps {
211
212
  */
212
213
  onClick?: () => void;
213
214
  }
214
- declare const CardPromo: React.FC<CardPromoProps>;
215
+ declare const CardPromo: React$1.FC<CardPromoProps>;
215
216
 
216
217
  interface CardBannerProps {
217
218
  /**
@@ -235,7 +236,7 @@ interface CardBannerProps {
235
236
  */
236
237
  onClick?: () => void;
237
238
  }
238
- declare const CardBanner: React.FC<CardBannerProps>;
239
+ declare const CardBanner: React$1.FC<CardBannerProps>;
239
240
 
240
241
  interface CardTicketButton {
241
242
  label: string;
@@ -312,26 +313,26 @@ interface CardTicketProps {
312
313
  */
313
314
  facilityIcon?: JSX.Element;
314
315
  }
315
- declare const CardTicket: React.FC<CardTicketProps>;
316
+ declare const CardTicket: React$1.FC<CardTicketProps>;
316
317
 
317
318
  /**
318
319
  * Horizontal ticket card background with decorative perforated edges
319
320
  * Use this for desktop/landscape layouts
320
321
  */
321
- declare const BackgroundTicketCard: (props: React.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
322
+ declare const BackgroundTicketCard: (props: React$1.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
322
323
 
323
324
  /**
324
325
  * Vertical ticket card background with decorative perforated edges
325
326
  * Use this for mobile/portrait layouts
326
327
  */
327
- declare const BackgroundTicketCardVertical: (props: React.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
328
+ declare const BackgroundTicketCardVertical: (props: React$1.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
328
329
 
329
330
  interface ServiceMenuItem {
330
331
  id: string;
331
332
  label: string;
332
333
  logo?: string;
333
334
  description?: string;
334
- customStyle?: React.CSSProperties;
335
+ customStyle?: React$1.CSSProperties;
335
336
  }
336
337
  interface CardServiceMenuProps {
337
338
  /**
@@ -356,6 +357,200 @@ interface CardServiceMenuProps {
356
357
  */
357
358
  className?: string;
358
359
  }
359
- declare const CardServiceMenu: React.FC<CardServiceMenuProps>;
360
+ declare const CardServiceMenu: React$1.FC<CardServiceMenuProps>;
360
361
 
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 };
362
+ type InputType = 'checkbox' | 'date' | 'datetime-local' | 'email' | 'file' | 'identity' | 'emailOrPhone' | 'number' | 'otp' | 'passport' | 'password' | 'phone' | 'radio' | 'radiobutton' | 'select' | 'switch' | 'tel' | 'text' | 'textarea' | 'time' | 'url';
363
+ interface SelectOption {
364
+ value: string;
365
+ label: string;
366
+ disabled?: boolean;
367
+ }
368
+ interface RadioOption {
369
+ value: string;
370
+ label: string;
371
+ disabled?: boolean;
372
+ }
373
+ interface CountryCode {
374
+ code: string;
375
+ name: string;
376
+ dialCode: string;
377
+ flag?: string;
378
+ passportRegex?: string;
379
+ }
380
+ interface InputDynamicProps<T extends FieldValues = FieldValues> {
381
+ name: Path<T>;
382
+ control: Control<T>;
383
+ label?: string;
384
+ type: InputType;
385
+ placeholder?: string;
386
+ required?: boolean;
387
+ disabled?: boolean;
388
+ options?: SelectOption[] | RadioOption[];
389
+ multiple?: boolean;
390
+ accept?: string;
391
+ rows?: number;
392
+ min?: number | string;
393
+ max?: number | string;
394
+ step?: number | string;
395
+ isMultiSelect?: boolean;
396
+ selectScrollbarColor?: string;
397
+ contentBefore?: React.ReactNode;
398
+ appearance?: 'outline' | 'underline' | 'filled-darker' | 'filled-lighter' | 'filled-darker-shadow' | 'filled-lighter-shadow';
399
+ validationRules?: {
400
+ required?: string | boolean;
401
+ minLength?: {
402
+ value: number;
403
+ message: string;
404
+ };
405
+ maxLength?: {
406
+ value: number;
407
+ message: string;
408
+ };
409
+ pattern?: {
410
+ value: RegExp;
411
+ message: string;
412
+ };
413
+ min?: {
414
+ value: number;
415
+ message: string;
416
+ };
417
+ max?: {
418
+ value: number;
419
+ message: string;
420
+ };
421
+ validate?: (value: any) => string | boolean;
422
+ };
423
+ helperText?: string;
424
+ className?: string;
425
+ layout?: 'horizontal' | 'vertical';
426
+ size?: 'small' | 'medium' | 'large';
427
+ onClick?: () => void;
428
+ style?: React.CSSProperties;
429
+ countryCodes?: CountryCode[];
430
+ defaultCountry?: string;
431
+ maxLength?: number;
432
+ autoAdvance?: boolean;
433
+ otpIndex?: number;
434
+ hasError?: boolean;
435
+ autoComplete?: string;
436
+ onInput?: (e: React.FormEvent<HTMLInputElement>) => void;
437
+ contentAfter?: React.ReactNode;
438
+ onChange?: (value: any) => void;
439
+ }
440
+
441
+ declare function InputDynamic<T extends FieldValues = FieldValues>({ name, control, label, type, placeholder, required, disabled, options, multiple, accept, rows, min, max, step, isMultiSelect, selectScrollbarColor, contentBefore, appearance, validationRules, helperText, className, layout, size, onClick, style, countryCodes, defaultCountry, maxLength, autoAdvance, otpIndex, hasError, autoComplete, onInput, contentAfter, onChange, }: InputDynamicProps<T>): react_jsx_runtime.JSX.Element;
442
+
443
+ declare const DEFAULT_COUNTRY_CODES: CountryCode[];
444
+
445
+ /**
446
+ * Harbor item interface
447
+ */
448
+ interface HarborItem {
449
+ /**
450
+ * Unique identifier for the harbor
451
+ */
452
+ id: number;
453
+ /**
454
+ * Display name of the harbor
455
+ */
456
+ name: string;
457
+ }
458
+ /**
459
+ * Props for ModalSearchHarbor component
460
+ */
461
+ interface ModalSearchHarborProps {
462
+ /**
463
+ * Whether the modal is open
464
+ */
465
+ open: boolean;
466
+ /**
467
+ * Callback when modal should close
468
+ */
469
+ onClose: () => void;
470
+ /**
471
+ * Modal title
472
+ * @default "Pilih Pelabuhan"
473
+ */
474
+ title?: string;
475
+ /**
476
+ * Type of modal - origin or destination
477
+ * @default "origin"
478
+ */
479
+ modalType?: 'origin' | 'destination';
480
+ /**
481
+ * List of harbors to display
482
+ */
483
+ harbors: HarborItem[];
484
+ /**
485
+ * List of favorite harbors
486
+ */
487
+ favoriteHarbors: HarborItem[];
488
+ /**
489
+ * List of last searched harbors
490
+ */
491
+ lastSearchedHarbors: HarborItem[];
492
+ /**
493
+ * Loading state
494
+ * @default false
495
+ */
496
+ isLoading?: boolean;
497
+ /**
498
+ * Current search query value
499
+ */
500
+ searchQuery: string;
501
+ /**
502
+ * Callback when search query changes
503
+ */
504
+ onSearchChange: (query: string) => void;
505
+ /**
506
+ * Callback when a harbor is selected
507
+ */
508
+ onSelectHarbor: (harbor: HarborItem) => void;
509
+ /**
510
+ * Callback when favorite is toggled
511
+ */
512
+ onToggleFavorite: (harbor: HarborItem) => void;
513
+ /**
514
+ * Callback when adding to last searched
515
+ */
516
+ onAddLastSearched: (harbor: HarborItem) => void;
517
+ /**
518
+ * Callback when removing from last searched
519
+ */
520
+ onRemoveLastSearched: (harborId: number) => void;
521
+ /**
522
+ * Callback when clearing all last searched
523
+ */
524
+ onClearLastSearched: () => void;
525
+ }
526
+ /**
527
+ * ModalSearchHarbor - A reusable modal component for searching and selecting harbors
528
+ *
529
+ * This component provides a searchable modal interface for selecting harbors with features like:
530
+ * - Search functionality
531
+ * - Favorite harbors quick access
532
+ * - Last searched history
533
+ * - Loading states
534
+ *
535
+ * @example
536
+ * ```tsx
537
+ * <ModalSearchHarbor
538
+ * open={isOpen}
539
+ * onClose={() => setIsOpen(false)}
540
+ * title="Pilih Pelabuhan Asal"
541
+ * harbors={harborList}
542
+ * favoriteHarbors={favorites}
543
+ * lastSearchedHarbors={history}
544
+ * searchQuery={search}
545
+ * onSearchChange={setSearch}
546
+ * onSelectHarbor={handleSelect}
547
+ * onToggleFavorite={handleToggleFavorite}
548
+ * onAddLastSearched={handleAddHistory}
549
+ * onRemoveLastSearched={handleRemoveHistory}
550
+ * onClearLastSearched={handleClearHistory}
551
+ * />
552
+ * ```
553
+ */
554
+ declare const ModalSearchHarbor: React.FC<ModalSearchHarborProps>;
555
+
556
+ export { BackgroundTicketCard, BackgroundTicketCardVertical, CardBanner, type CardBannerProps, CardPromo, type CardPromoProps, CardServiceMenu, type CardServiceMenuProps, CardTicket, type CardTicketButton, type CardTicketProps, CarouselWithCustomNav, type CarouselWithCustomNavProps, type CountryCode, DEFAULT_COUNTRY_CODES, type HarborItem, InputDynamic, type InputDynamicProps, type InputType, MODAL_PRESETS, ModalIllustration, type ModalIllustrationButton, type ModalIllustrationProps, type ModalPresetKey, ModalSearchHarbor, type ModalSearchHarborProps, type RadioOption, type SelectOption, type ServiceMenuItem, getModalPreset };