@asdp/ferryui 0.1.4 → 0.1.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.
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
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
+ import { FieldValues, Path } from 'react-hook-form';
5
5
 
6
6
  interface ModalIllustrationButton {
7
7
  /**
@@ -379,7 +379,7 @@ interface CountryCode {
379
379
  }
380
380
  interface InputDynamicProps<T extends FieldValues = FieldValues> {
381
381
  name: Path<T>;
382
- control: Control<T>;
382
+ control: any;
383
383
  label?: string;
384
384
  type: InputType;
385
385
  placeholder?: string;
@@ -553,4 +553,182 @@ interface ModalSearchHarborProps {
553
553
  */
554
554
  declare const ModalSearchHarbor: React.FC<ModalSearchHarborProps>;
555
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 };
556
+ /**
557
+ * Tab type for trip selection
558
+ */
559
+ type TabType = 'one-way' | 'round-trip';
560
+ /**
561
+ * Props for ModalSelectDate component
562
+ */
563
+ interface ModalSelectDateProps {
564
+ /**
565
+ * Whether the modal is open
566
+ */
567
+ open: boolean;
568
+ /**
569
+ * Callback when modal should close
570
+ */
571
+ onClose: () => void;
572
+ /**
573
+ * Modal title
574
+ * @default "Pilih Tanggal"
575
+ */
576
+ title?: string;
577
+ /**
578
+ * Initial selected departure date
579
+ */
580
+ selectedDepartureDate?: Date;
581
+ /**
582
+ * Initial selected return date (for round trip)
583
+ */
584
+ selectedReturnDate?: Date;
585
+ /**
586
+ * Initial tab selection
587
+ * @default "one-way"
588
+ */
589
+ initialTab?: TabType;
590
+ /**
591
+ * Whether to show tabs for one-way/round-trip selection
592
+ * @default true
593
+ */
594
+ showTabs?: boolean;
595
+ /**
596
+ * Callback when departure date is selected
597
+ */
598
+ onSelectDepartureDate: (date: Date) => void;
599
+ /**
600
+ * Callback when return date is selected (for round trip)
601
+ */
602
+ onSelectReturnDate?: (date: Date) => void;
603
+ /**
604
+ * Callback when tab changes
605
+ */
606
+ onTabChange?: (tab: TabType) => void;
607
+ /**
608
+ * Minimum selectable date
609
+ * @default new Date()
610
+ */
611
+ minDate?: Date;
612
+ /**
613
+ * Maximum selectable date
614
+ */
615
+ maxDate?: Date;
616
+ /**
617
+ * Date format for internal handling
618
+ * @default "DD MMMM YYYY"
619
+ */
620
+ dateFormat?: string;
621
+ }
622
+ /**
623
+ * ModalSelectDate - A reusable modal component for selecting dates
624
+ *
625
+ * This component provides a date selection modal with features like:
626
+ * - Single date selection (one-way)
627
+ * - Date range selection (round-trip)
628
+ * - Visual range preview on hover
629
+ * - Customizable date constraints
630
+ *
631
+ * @example
632
+ * ```tsx
633
+ * <ModalSelectDate
634
+ * open={isOpen}
635
+ * onClose={() => setIsOpen(false)}
636
+ * title="Pilih Tanggal Keberangkatan"
637
+ * selectedDepartureDate={departureDate}
638
+ * selectedReturnDate={returnDate}
639
+ * onSelectDepartureDate={setDepartureDate}
640
+ * onSelectReturnDate={setReturnDate}
641
+ * onTabChange={handleTabChange}
642
+ * />
643
+ * ```
644
+ */
645
+ declare const ModalSelectDate: React.FC<ModalSelectDateProps>;
646
+
647
+ /**
648
+ * Service item structure
649
+ */
650
+ interface ServiceItem {
651
+ /**
652
+ * Unique identifier for the service
653
+ */
654
+ id: number;
655
+ /**
656
+ * Display name of the service type
657
+ */
658
+ serviceTypeName: string;
659
+ /**
660
+ * Code identifier for the service type
661
+ */
662
+ serviceTypeCode: string;
663
+ /**
664
+ * Detailed description of the service
665
+ */
666
+ serviceDescription: string;
667
+ }
668
+ /**
669
+ * Props for ModalService component
670
+ */
671
+ interface ModalServiceProps {
672
+ /**
673
+ * Whether the modal is open
674
+ */
675
+ open: boolean;
676
+ /**
677
+ * Callback when modal should close
678
+ */
679
+ onClose: () => void;
680
+ /**
681
+ * Modal title
682
+ * @default "Pilih Kelas Layanan"
683
+ */
684
+ title?: string;
685
+ /**
686
+ * Array of available services
687
+ */
688
+ services: ServiceItem[];
689
+ /**
690
+ * Array of currently selected service IDs
691
+ */
692
+ selectedServiceIds: number[];
693
+ /**
694
+ * Callback when save button is clicked
695
+ * @param services - Array of selected service items
696
+ */
697
+ onSave: (services: ServiceItem[]) => void;
698
+ /**
699
+ * Loading state for services data
700
+ * @default false
701
+ */
702
+ isLoading?: boolean;
703
+ /**
704
+ * Error state for services data
705
+ * @default false
706
+ */
707
+ isError?: boolean;
708
+ }
709
+ /**
710
+ * ModalService - A reusable modal component for selecting service classes
711
+ *
712
+ * This component provides a service selection modal with features like:
713
+ * - Multiple service selection with checkboxes
714
+ * - Select all/deselect all functionality
715
+ * - Service details display (name, code, description)
716
+ * - Save validation (requires at least one selection)
717
+ *
718
+ * @example
719
+ * ```tsx
720
+ * <ModalService
721
+ * open={isOpen}
722
+ * onClose={() => setIsOpen(false)}
723
+ * title="Pilih Kelas Layanan"
724
+ * services={servicesList}
725
+ * selectedServiceIds={selectedIds}
726
+ * onSave={handleSave}
727
+ * isLoading={isLoading}
728
+ * isError={isError}
729
+ * />
730
+ * ```
731
+ */
732
+ declare const ModalService: React.FC<ModalServiceProps>;
733
+
734
+ 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, ModalSelectDate, type ModalSelectDateProps, ModalService, type ModalServiceProps, type RadioOption, type SelectOption, type ServiceItem, type ServiceMenuItem, type TabType, getModalPreset };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
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
+ import { FieldValues, Path } from 'react-hook-form';
5
5
 
6
6
  interface ModalIllustrationButton {
7
7
  /**
@@ -379,7 +379,7 @@ interface CountryCode {
379
379
  }
380
380
  interface InputDynamicProps<T extends FieldValues = FieldValues> {
381
381
  name: Path<T>;
382
- control: Control<T>;
382
+ control: any;
383
383
  label?: string;
384
384
  type: InputType;
385
385
  placeholder?: string;
@@ -553,4 +553,182 @@ interface ModalSearchHarborProps {
553
553
  */
554
554
  declare const ModalSearchHarbor: React.FC<ModalSearchHarborProps>;
555
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 };
556
+ /**
557
+ * Tab type for trip selection
558
+ */
559
+ type TabType = 'one-way' | 'round-trip';
560
+ /**
561
+ * Props for ModalSelectDate component
562
+ */
563
+ interface ModalSelectDateProps {
564
+ /**
565
+ * Whether the modal is open
566
+ */
567
+ open: boolean;
568
+ /**
569
+ * Callback when modal should close
570
+ */
571
+ onClose: () => void;
572
+ /**
573
+ * Modal title
574
+ * @default "Pilih Tanggal"
575
+ */
576
+ title?: string;
577
+ /**
578
+ * Initial selected departure date
579
+ */
580
+ selectedDepartureDate?: Date;
581
+ /**
582
+ * Initial selected return date (for round trip)
583
+ */
584
+ selectedReturnDate?: Date;
585
+ /**
586
+ * Initial tab selection
587
+ * @default "one-way"
588
+ */
589
+ initialTab?: TabType;
590
+ /**
591
+ * Whether to show tabs for one-way/round-trip selection
592
+ * @default true
593
+ */
594
+ showTabs?: boolean;
595
+ /**
596
+ * Callback when departure date is selected
597
+ */
598
+ onSelectDepartureDate: (date: Date) => void;
599
+ /**
600
+ * Callback when return date is selected (for round trip)
601
+ */
602
+ onSelectReturnDate?: (date: Date) => void;
603
+ /**
604
+ * Callback when tab changes
605
+ */
606
+ onTabChange?: (tab: TabType) => void;
607
+ /**
608
+ * Minimum selectable date
609
+ * @default new Date()
610
+ */
611
+ minDate?: Date;
612
+ /**
613
+ * Maximum selectable date
614
+ */
615
+ maxDate?: Date;
616
+ /**
617
+ * Date format for internal handling
618
+ * @default "DD MMMM YYYY"
619
+ */
620
+ dateFormat?: string;
621
+ }
622
+ /**
623
+ * ModalSelectDate - A reusable modal component for selecting dates
624
+ *
625
+ * This component provides a date selection modal with features like:
626
+ * - Single date selection (one-way)
627
+ * - Date range selection (round-trip)
628
+ * - Visual range preview on hover
629
+ * - Customizable date constraints
630
+ *
631
+ * @example
632
+ * ```tsx
633
+ * <ModalSelectDate
634
+ * open={isOpen}
635
+ * onClose={() => setIsOpen(false)}
636
+ * title="Pilih Tanggal Keberangkatan"
637
+ * selectedDepartureDate={departureDate}
638
+ * selectedReturnDate={returnDate}
639
+ * onSelectDepartureDate={setDepartureDate}
640
+ * onSelectReturnDate={setReturnDate}
641
+ * onTabChange={handleTabChange}
642
+ * />
643
+ * ```
644
+ */
645
+ declare const ModalSelectDate: React.FC<ModalSelectDateProps>;
646
+
647
+ /**
648
+ * Service item structure
649
+ */
650
+ interface ServiceItem {
651
+ /**
652
+ * Unique identifier for the service
653
+ */
654
+ id: number;
655
+ /**
656
+ * Display name of the service type
657
+ */
658
+ serviceTypeName: string;
659
+ /**
660
+ * Code identifier for the service type
661
+ */
662
+ serviceTypeCode: string;
663
+ /**
664
+ * Detailed description of the service
665
+ */
666
+ serviceDescription: string;
667
+ }
668
+ /**
669
+ * Props for ModalService component
670
+ */
671
+ interface ModalServiceProps {
672
+ /**
673
+ * Whether the modal is open
674
+ */
675
+ open: boolean;
676
+ /**
677
+ * Callback when modal should close
678
+ */
679
+ onClose: () => void;
680
+ /**
681
+ * Modal title
682
+ * @default "Pilih Kelas Layanan"
683
+ */
684
+ title?: string;
685
+ /**
686
+ * Array of available services
687
+ */
688
+ services: ServiceItem[];
689
+ /**
690
+ * Array of currently selected service IDs
691
+ */
692
+ selectedServiceIds: number[];
693
+ /**
694
+ * Callback when save button is clicked
695
+ * @param services - Array of selected service items
696
+ */
697
+ onSave: (services: ServiceItem[]) => void;
698
+ /**
699
+ * Loading state for services data
700
+ * @default false
701
+ */
702
+ isLoading?: boolean;
703
+ /**
704
+ * Error state for services data
705
+ * @default false
706
+ */
707
+ isError?: boolean;
708
+ }
709
+ /**
710
+ * ModalService - A reusable modal component for selecting service classes
711
+ *
712
+ * This component provides a service selection modal with features like:
713
+ * - Multiple service selection with checkboxes
714
+ * - Select all/deselect all functionality
715
+ * - Service details display (name, code, description)
716
+ * - Save validation (requires at least one selection)
717
+ *
718
+ * @example
719
+ * ```tsx
720
+ * <ModalService
721
+ * open={isOpen}
722
+ * onClose={() => setIsOpen(false)}
723
+ * title="Pilih Kelas Layanan"
724
+ * services={servicesList}
725
+ * selectedServiceIds={selectedIds}
726
+ * onSave={handleSave}
727
+ * isLoading={isLoading}
728
+ * isError={isError}
729
+ * />
730
+ * ```
731
+ */
732
+ declare const ModalService: React.FC<ModalServiceProps>;
733
+
734
+ 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, ModalSelectDate, type ModalSelectDateProps, ModalService, type ModalServiceProps, type RadioOption, type SelectOption, type ServiceItem, type ServiceMenuItem, type TabType, getModalPreset };