@asdp/ferryui 0.1.5 → 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 +88 -1
- package/dist/index.d.ts +88 -1
- package/dist/index.js +192 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +193 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -644,4 +644,91 @@ interface ModalSelectDateProps {
|
|
|
644
644
|
*/
|
|
645
645
|
declare const ModalSelectDate: React.FC<ModalSelectDateProps>;
|
|
646
646
|
|
|
647
|
-
|
|
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
|
@@ -644,4 +644,91 @@ interface ModalSelectDateProps {
|
|
|
644
644
|
*/
|
|
645
645
|
declare const ModalSelectDate: React.FC<ModalSelectDateProps>;
|
|
646
646
|
|
|
647
|
-
|
|
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.js
CHANGED
|
@@ -3370,6 +3370,197 @@ var ModalSelectDate = ({
|
|
|
3370
3370
|
}
|
|
3371
3371
|
);
|
|
3372
3372
|
};
|
|
3373
|
+
var useStyles10 = reactComponents.makeStyles({
|
|
3374
|
+
dialogSurface: {
|
|
3375
|
+
maxWidth: "600px",
|
|
3376
|
+
width: "100%"
|
|
3377
|
+
},
|
|
3378
|
+
content: {
|
|
3379
|
+
display: "flex",
|
|
3380
|
+
flexDirection: "column",
|
|
3381
|
+
gap: "0px",
|
|
3382
|
+
paddingTop: "10px",
|
|
3383
|
+
paddingLeft: "10px",
|
|
3384
|
+
paddingRight: "10px"
|
|
3385
|
+
},
|
|
3386
|
+
closeButton: {
|
|
3387
|
+
minWidth: "32px",
|
|
3388
|
+
minHeight: "32px"
|
|
3389
|
+
},
|
|
3390
|
+
headerRow: {
|
|
3391
|
+
display: "flex",
|
|
3392
|
+
justifyContent: "end",
|
|
3393
|
+
alignItems: "center",
|
|
3394
|
+
borderBottom: `1px solid ${reactComponents.tokens.colorNeutralStroke2}`
|
|
3395
|
+
},
|
|
3396
|
+
serviceList: {
|
|
3397
|
+
display: "flex",
|
|
3398
|
+
flexDirection: "column",
|
|
3399
|
+
gap: "0px",
|
|
3400
|
+
maxHeight: "400px",
|
|
3401
|
+
overflowY: "auto",
|
|
3402
|
+
paddingLeft: "20px"
|
|
3403
|
+
},
|
|
3404
|
+
serviceItem: {
|
|
3405
|
+
padding: "16px 0px",
|
|
3406
|
+
borderBottom: `1px solid ${reactComponents.tokens.colorNeutralStroke2}`,
|
|
3407
|
+
display: "flex",
|
|
3408
|
+
alignItems: "flex-start",
|
|
3409
|
+
gap: "12px",
|
|
3410
|
+
cursor: "pointer",
|
|
3411
|
+
transition: "background-color 0.2s ease",
|
|
3412
|
+
":hover": {
|
|
3413
|
+
backgroundColor: reactComponents.tokens.colorNeutralBackground1Hover
|
|
3414
|
+
}
|
|
3415
|
+
},
|
|
3416
|
+
serviceContent: {
|
|
3417
|
+
flex: 1,
|
|
3418
|
+
display: "flex",
|
|
3419
|
+
flexDirection: "column",
|
|
3420
|
+
gap: "4px"
|
|
3421
|
+
},
|
|
3422
|
+
serviceName: {
|
|
3423
|
+
fontSize: reactComponents.tokens.fontSizeBase300,
|
|
3424
|
+
fontWeight: reactComponents.tokens.fontWeightSemibold,
|
|
3425
|
+
color: reactComponents.tokens.colorNeutralForeground1
|
|
3426
|
+
},
|
|
3427
|
+
serviceType: {
|
|
3428
|
+
fontSize: reactComponents.tokens.fontSizeBase200,
|
|
3429
|
+
fontWeight: reactComponents.tokens.fontWeightRegular,
|
|
3430
|
+
color: reactComponents.tokens.colorNeutralForeground2
|
|
3431
|
+
},
|
|
3432
|
+
serviceDescription: {
|
|
3433
|
+
fontSize: reactComponents.tokens.fontSizeBase200,
|
|
3434
|
+
color: reactComponents.tokens.colorNeutralForeground3,
|
|
3435
|
+
lineHeight: "1.4"
|
|
3436
|
+
},
|
|
3437
|
+
footer: {
|
|
3438
|
+
padding: "16px 20px",
|
|
3439
|
+
borderTop: `1px solid ${reactComponents.tokens.colorNeutralStroke2}`
|
|
3440
|
+
},
|
|
3441
|
+
saveButton: {
|
|
3442
|
+
width: "100%",
|
|
3443
|
+
borderRadius: reactComponents.tokens.borderRadiusCircular
|
|
3444
|
+
}
|
|
3445
|
+
});
|
|
3446
|
+
var ModalService = ({
|
|
3447
|
+
open,
|
|
3448
|
+
onClose,
|
|
3449
|
+
title = "Pilih Kelas Layanan",
|
|
3450
|
+
services,
|
|
3451
|
+
selectedServiceIds,
|
|
3452
|
+
onSave,
|
|
3453
|
+
isLoading = false,
|
|
3454
|
+
isError = false
|
|
3455
|
+
}) => {
|
|
3456
|
+
const styles = useStyles10();
|
|
3457
|
+
const [selectedServices, setSelectedServices] = React2.useState(selectedServiceIds);
|
|
3458
|
+
React2.useEffect(() => {
|
|
3459
|
+
if (open) {
|
|
3460
|
+
if (selectedServiceIds && selectedServiceIds.length > 0) {
|
|
3461
|
+
const validIds = services.filter((s) => selectedServiceIds.includes(s.id)).map((s) => s.id);
|
|
3462
|
+
setSelectedServices(validIds);
|
|
3463
|
+
} else {
|
|
3464
|
+
setSelectedServices(services.map((s) => s.id));
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
}, [open, services, selectedServiceIds]);
|
|
3468
|
+
const handleClose = () => {
|
|
3469
|
+
onClose();
|
|
3470
|
+
};
|
|
3471
|
+
const handleToggleService = (serviceId) => {
|
|
3472
|
+
setSelectedServices((prev) => {
|
|
3473
|
+
if (prev.includes(serviceId)) {
|
|
3474
|
+
return prev.filter((id) => id !== serviceId);
|
|
3475
|
+
} else {
|
|
3476
|
+
return [...prev, serviceId];
|
|
3477
|
+
}
|
|
3478
|
+
});
|
|
3479
|
+
};
|
|
3480
|
+
const handleToggleAll = () => {
|
|
3481
|
+
if (selectedServices.length === services.length) {
|
|
3482
|
+
setSelectedServices([]);
|
|
3483
|
+
} else {
|
|
3484
|
+
setSelectedServices(services.map((s) => s.id));
|
|
3485
|
+
}
|
|
3486
|
+
};
|
|
3487
|
+
const handleSave = () => {
|
|
3488
|
+
const selectedServiceItems = services.filter((s) => selectedServices.includes(s.id));
|
|
3489
|
+
onSave(selectedServiceItems);
|
|
3490
|
+
};
|
|
3491
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3492
|
+
reactComponents.Dialog,
|
|
3493
|
+
{
|
|
3494
|
+
open,
|
|
3495
|
+
onOpenChange: (_, data) => !data.open && onClose(),
|
|
3496
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.DialogSurface, { className: styles.dialogSurface, children: /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.DialogBody, { children: [
|
|
3497
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3498
|
+
reactComponents.DialogTitle,
|
|
3499
|
+
{
|
|
3500
|
+
action: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3501
|
+
reactComponents.Button,
|
|
3502
|
+
{
|
|
3503
|
+
appearance: "subtle",
|
|
3504
|
+
"aria-label": "close",
|
|
3505
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { icon: "fluent:dismiss-24-regular" }),
|
|
3506
|
+
onClick: handleClose,
|
|
3507
|
+
className: styles.closeButton
|
|
3508
|
+
}
|
|
3509
|
+
),
|
|
3510
|
+
children: title
|
|
3511
|
+
}
|
|
3512
|
+
),
|
|
3513
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactComponents.DialogContent, { className: styles.content, children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: "Loading..." }) : isError ? /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: "Error loading services" }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3514
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.serviceList, children: [
|
|
3515
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.headerRow, children: [
|
|
3516
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: "Pilih Semua" }),
|
|
3517
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3518
|
+
reactComponents.Checkbox,
|
|
3519
|
+
{
|
|
3520
|
+
checked: selectedServices.length === services.length,
|
|
3521
|
+
onChange: handleToggleAll
|
|
3522
|
+
}
|
|
3523
|
+
)
|
|
3524
|
+
] }),
|
|
3525
|
+
services.map((service) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3526
|
+
"div",
|
|
3527
|
+
{
|
|
3528
|
+
className: styles.serviceItem,
|
|
3529
|
+
onClick: () => handleToggleService(service.id),
|
|
3530
|
+
children: [
|
|
3531
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.serviceContent, children: [
|
|
3532
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { className: styles.serviceName, children: service.serviceTypeName }),
|
|
3533
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactComponents.Caption1, { className: styles.serviceType, children: service.serviceTypeCode }),
|
|
3534
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactComponents.Caption1, { className: styles.serviceDescription, children: service.serviceDescription })
|
|
3535
|
+
] }),
|
|
3536
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3537
|
+
reactComponents.Checkbox,
|
|
3538
|
+
{
|
|
3539
|
+
checked: selectedServices.includes(service.id),
|
|
3540
|
+
onChange: () => handleToggleService(service.id)
|
|
3541
|
+
}
|
|
3542
|
+
)
|
|
3543
|
+
]
|
|
3544
|
+
},
|
|
3545
|
+
service.id
|
|
3546
|
+
))
|
|
3547
|
+
] }),
|
|
3548
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.footer, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3549
|
+
reactComponents.Button,
|
|
3550
|
+
{
|
|
3551
|
+
appearance: "primary",
|
|
3552
|
+
size: "medium",
|
|
3553
|
+
className: styles.saveButton,
|
|
3554
|
+
onClick: handleSave,
|
|
3555
|
+
disabled: selectedServices.length === 0,
|
|
3556
|
+
children: "Simpan"
|
|
3557
|
+
}
|
|
3558
|
+
) })
|
|
3559
|
+
] }) })
|
|
3560
|
+
] }) })
|
|
3561
|
+
}
|
|
3562
|
+
);
|
|
3563
|
+
};
|
|
3373
3564
|
|
|
3374
3565
|
exports.BackgroundTicketCard = BackgroundTicketCard_default;
|
|
3375
3566
|
exports.BackgroundTicketCardVertical = BackgroundTicketCardVertical_default;
|
|
@@ -3384,6 +3575,7 @@ exports.MODAL_PRESETS = MODAL_PRESETS;
|
|
|
3384
3575
|
exports.ModalIllustration = ModalIllustration;
|
|
3385
3576
|
exports.ModalSearchHarbor = ModalSearchHarbor;
|
|
3386
3577
|
exports.ModalSelectDate = ModalSelectDate;
|
|
3578
|
+
exports.ModalService = ModalService;
|
|
3387
3579
|
exports.getModalPreset = getModalPreset;
|
|
3388
3580
|
//# sourceMappingURL=index.js.map
|
|
3389
3581
|
//# sourceMappingURL=index.js.map
|