@asdp/ferryui 0.1.7 → 0.1.9
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 +97 -1
- package/dist/index.d.ts +97 -1
- package/dist/index.js +271 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +271 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +82 -78
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { makeStyles, tokens, shorthands, Popover, PopoverTrigger, Input, PopoverSurface, Dialog, DialogSurface, DialogBody, DialogTitle, DialogContent, Body1, Button, Carousel, mergeClasses, CarouselViewport, CarouselSlider, CarouselNav, CarouselNavButton, CarouselCard, Subtitle2, Card, Tooltip, Badge, Caption1, Title2, Caption2, Divider, Title3, Caption1Strong, Field, Label, Text, Body1Strong, Checkbox, MessageBar, MessageBarBody, Accordion, AccordionItem, AccordionHeader, AccordionPanel,
|
|
1
|
+
import { makeStyles, tokens, shorthands, Popover, PopoverTrigger, Input, PopoverSurface, Dialog, DialogSurface, DialogBody, DialogTitle, DialogContent, Body1, Button, Carousel, mergeClasses, CarouselViewport, CarouselSlider, CarouselNav, CarouselNavButton, CarouselCard, Subtitle2, Card, Tooltip, Badge, Caption1, Title2, Caption2, Divider, Title3, Caption1Strong, Field, Label, Text, Body1Strong, Checkbox, MessageBar, MessageBarBody, Accordion, AccordionItem, AccordionHeader, AccordionPanel, RadioGroup, Radio, typographyStyles, Switch, Textarea } from '@fluentui/react-components';
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import React2, { forwardRef, useState, useCallback, useRef, useEffect, useMemo } from 'react';
|
|
4
4
|
import { Icon } from '@iconify/react';
|
|
@@ -3872,7 +3872,276 @@ var ModalTotalPassengers = ({
|
|
|
3872
3872
|
}
|
|
3873
3873
|
);
|
|
3874
3874
|
};
|
|
3875
|
+
var useStyles12 = makeStyles({
|
|
3876
|
+
dialogSurface: {
|
|
3877
|
+
maxWidth: "600px",
|
|
3878
|
+
width: "100%"
|
|
3879
|
+
},
|
|
3880
|
+
closeButton: {
|
|
3881
|
+
minWidth: "32px",
|
|
3882
|
+
minHeight: "32px"
|
|
3883
|
+
},
|
|
3884
|
+
passengerSection: {
|
|
3885
|
+
marginTop: tokens.spacingHorizontalM,
|
|
3886
|
+
display: "flex",
|
|
3887
|
+
flexDirection: "column"
|
|
3888
|
+
},
|
|
3889
|
+
accordionItem: {
|
|
3890
|
+
borderBottom: `1px solid ${tokens.colorNeutralStroke2}`,
|
|
3891
|
+
width: "100%"
|
|
3892
|
+
},
|
|
3893
|
+
accordionHeader: {
|
|
3894
|
+
fontSize: tokens.fontSizeBase300,
|
|
3895
|
+
fontWeight: tokens.fontWeightBold,
|
|
3896
|
+
display: "flex",
|
|
3897
|
+
alignItems: "center",
|
|
3898
|
+
justifyContent: "space-between",
|
|
3899
|
+
width: "100%"
|
|
3900
|
+
},
|
|
3901
|
+
accordionTitleAndInfo: {
|
|
3902
|
+
display: "flex",
|
|
3903
|
+
flexDirection: "column",
|
|
3904
|
+
gap: "2px",
|
|
3905
|
+
marginLeft: tokens.spacingHorizontalM,
|
|
3906
|
+
flex: 1
|
|
3907
|
+
},
|
|
3908
|
+
accordionBody: {
|
|
3909
|
+
marginLeft: "100px"
|
|
3910
|
+
},
|
|
3911
|
+
footer: {
|
|
3912
|
+
marginTop: tokens.spacingVerticalL,
|
|
3913
|
+
display: "flex",
|
|
3914
|
+
gap: tokens.spacingHorizontalM,
|
|
3915
|
+
justifyContent: "flex-end"
|
|
3916
|
+
}
|
|
3917
|
+
});
|
|
3918
|
+
var ModalTypeOfService = ({
|
|
3919
|
+
open,
|
|
3920
|
+
onClose,
|
|
3921
|
+
title = "Pilih Tipe Layanan",
|
|
3922
|
+
serviceTypes,
|
|
3923
|
+
selectedService,
|
|
3924
|
+
onSave,
|
|
3925
|
+
renderImage
|
|
3926
|
+
}) => {
|
|
3927
|
+
const styles = useStyles12();
|
|
3928
|
+
const [selectedServiceTitle, setSelectedServiceTitle] = useState(
|
|
3929
|
+
selectedService?.title || ""
|
|
3930
|
+
);
|
|
3931
|
+
const [openItems, setOpenItems] = useState(() => {
|
|
3932
|
+
if (!selectedService) return void 0;
|
|
3933
|
+
for (const item of serviceTypes) {
|
|
3934
|
+
if (item.type === "accordion" && item.child.length > 0) {
|
|
3935
|
+
const hasSelectedChild = item.child.some(
|
|
3936
|
+
(child) => child.title === selectedService.title
|
|
3937
|
+
);
|
|
3938
|
+
if (hasSelectedChild) {
|
|
3939
|
+
return item.id;
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
return void 0;
|
|
3944
|
+
});
|
|
3945
|
+
const defaultRenderImage = ({ src, alt, width, height }) => /* @__PURE__ */ jsx("img", { src, alt, width, height, style: { objectFit: "contain" } });
|
|
3946
|
+
const imageRenderer = renderImage || defaultRenderImage;
|
|
3947
|
+
useEffect(() => {
|
|
3948
|
+
const newTitle = selectedService?.title || "";
|
|
3949
|
+
if (newTitle !== selectedServiceTitle) {
|
|
3950
|
+
setSelectedServiceTitle(newTitle);
|
|
3951
|
+
}
|
|
3952
|
+
if (selectedService) {
|
|
3953
|
+
for (const item of serviceTypes) {
|
|
3954
|
+
if (item.type === "accordion" && item.child.length > 0) {
|
|
3955
|
+
const hasSelectedChild = item.child.some(
|
|
3956
|
+
(child) => child.title === selectedService.title
|
|
3957
|
+
);
|
|
3958
|
+
if (hasSelectedChild && openItems !== item.id) {
|
|
3959
|
+
setOpenItems(item.id);
|
|
3960
|
+
break;
|
|
3961
|
+
}
|
|
3962
|
+
}
|
|
3963
|
+
}
|
|
3964
|
+
} else if (openItems !== void 0) {
|
|
3965
|
+
setOpenItems(void 0);
|
|
3966
|
+
}
|
|
3967
|
+
}, [open, selectedService?.title]);
|
|
3968
|
+
const handleConfirm = () => {
|
|
3969
|
+
if (selectedServiceTitle) {
|
|
3970
|
+
let selectedItem = null;
|
|
3971
|
+
for (const item of serviceTypes) {
|
|
3972
|
+
if (item.title === selectedServiceTitle) {
|
|
3973
|
+
selectedItem = {
|
|
3974
|
+
id: item.id,
|
|
3975
|
+
image: item.image,
|
|
3976
|
+
title: item.title,
|
|
3977
|
+
info: item.info,
|
|
3978
|
+
price: item.price,
|
|
3979
|
+
parentTitle: "",
|
|
3980
|
+
parentId: 0,
|
|
3981
|
+
type: item.type,
|
|
3982
|
+
typeOfPassanger: item.typeOfPassanger,
|
|
3983
|
+
child: []
|
|
3984
|
+
};
|
|
3985
|
+
break;
|
|
3986
|
+
}
|
|
3987
|
+
if (item.child && item.child.length > 0) {
|
|
3988
|
+
const childItem = item.child.find((child) => child.title === selectedServiceTitle);
|
|
3989
|
+
if (childItem) {
|
|
3990
|
+
selectedItem = {
|
|
3991
|
+
id: childItem.id,
|
|
3992
|
+
image: childItem.image,
|
|
3993
|
+
title: childItem.title,
|
|
3994
|
+
info: childItem.info,
|
|
3995
|
+
price: childItem.price,
|
|
3996
|
+
parentTitle: childItem.parentTitle,
|
|
3997
|
+
parentId: childItem.parentId,
|
|
3998
|
+
type: childItem.type,
|
|
3999
|
+
typeOfPassanger: childItem.typeOfPassanger,
|
|
4000
|
+
child: []
|
|
4001
|
+
};
|
|
4002
|
+
break;
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
}
|
|
4006
|
+
if (selectedItem) {
|
|
4007
|
+
onSave(selectedItem);
|
|
4008
|
+
}
|
|
4009
|
+
}
|
|
4010
|
+
};
|
|
4011
|
+
return /* @__PURE__ */ jsx(
|
|
4012
|
+
Dialog,
|
|
4013
|
+
{
|
|
4014
|
+
open,
|
|
4015
|
+
onOpenChange: (_, data) => !data.open && onClose(),
|
|
4016
|
+
children: /* @__PURE__ */ jsx(DialogSurface, { className: styles.dialogSurface, children: /* @__PURE__ */ jsxs(DialogBody, { children: [
|
|
4017
|
+
/* @__PURE__ */ jsx(
|
|
4018
|
+
DialogTitle,
|
|
4019
|
+
{
|
|
4020
|
+
action: /* @__PURE__ */ jsx(
|
|
4021
|
+
Button,
|
|
4022
|
+
{
|
|
4023
|
+
appearance: "subtle",
|
|
4024
|
+
"aria-label": "close",
|
|
4025
|
+
icon: /* @__PURE__ */ jsx(Icon, { icon: "fluent:dismiss-24-regular" }),
|
|
4026
|
+
onClick: onClose,
|
|
4027
|
+
className: styles.closeButton
|
|
4028
|
+
}
|
|
4029
|
+
),
|
|
4030
|
+
children: title
|
|
4031
|
+
}
|
|
4032
|
+
),
|
|
4033
|
+
/* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
4034
|
+
/* @__PURE__ */ jsx(
|
|
4035
|
+
Accordion,
|
|
4036
|
+
{
|
|
4037
|
+
collapsible: true,
|
|
4038
|
+
openItems,
|
|
4039
|
+
onToggle: (_, data) => setOpenItems(data.openItems[0]),
|
|
4040
|
+
className: styles.passengerSection,
|
|
4041
|
+
children: /* @__PURE__ */ jsx(
|
|
4042
|
+
RadioGroup,
|
|
4043
|
+
{
|
|
4044
|
+
value: selectedServiceTitle,
|
|
4045
|
+
onChange: (_, data) => setSelectedServiceTitle(data.value),
|
|
4046
|
+
children: serviceTypes.map((item, index) => {
|
|
4047
|
+
if (item.type === "accordion") {
|
|
4048
|
+
return /* @__PURE__ */ jsxs(AccordionItem, { value: item.id, className: styles.accordionItem, children: [
|
|
4049
|
+
/* @__PURE__ */ jsxs(
|
|
4050
|
+
AccordionHeader,
|
|
4051
|
+
{
|
|
4052
|
+
className: styles.accordionHeader,
|
|
4053
|
+
expandIconPosition: "end",
|
|
4054
|
+
children: [
|
|
4055
|
+
/* @__PURE__ */ jsx("div", { children: imageRenderer({ src: item.image, alt: "vehicles", width: 74, height: 74 }) }),
|
|
4056
|
+
/* @__PURE__ */ jsxs("div", { className: styles.accordionTitleAndInfo, children: [
|
|
4057
|
+
/* @__PURE__ */ jsx(Body1, { children: item.title }),
|
|
4058
|
+
/* @__PURE__ */ jsx(Caption1, { children: item.info })
|
|
4059
|
+
] })
|
|
4060
|
+
]
|
|
4061
|
+
}
|
|
4062
|
+
),
|
|
4063
|
+
/* @__PURE__ */ jsx(AccordionPanel, { className: styles.accordionBody, children: item.child.length > 0 && item.child.map((childItem, childIndex) => /* @__PURE__ */ jsxs(
|
|
4064
|
+
"div",
|
|
4065
|
+
{
|
|
4066
|
+
className: mergeClasses(
|
|
4067
|
+
styles.accordionHeader,
|
|
4068
|
+
styles.accordionItem
|
|
4069
|
+
),
|
|
4070
|
+
style: { padding: tokens.spacingHorizontalXS },
|
|
4071
|
+
children: [
|
|
4072
|
+
/* @__PURE__ */ jsx("div", { children: imageRenderer({
|
|
4073
|
+
src: childItem.image,
|
|
4074
|
+
alt: childItem.title,
|
|
4075
|
+
width: 48,
|
|
4076
|
+
height: 48
|
|
4077
|
+
}) }),
|
|
4078
|
+
/* @__PURE__ */ jsxs("div", { className: styles.accordionTitleAndInfo, children: [
|
|
4079
|
+
/* @__PURE__ */ jsx(Body1, { children: childItem.title }),
|
|
4080
|
+
/* @__PURE__ */ jsx(Caption1, { children: childItem.info })
|
|
4081
|
+
] }),
|
|
4082
|
+
/* @__PURE__ */ jsx(Radio, { value: childItem.title })
|
|
4083
|
+
]
|
|
4084
|
+
},
|
|
4085
|
+
childIndex
|
|
4086
|
+
)) })
|
|
4087
|
+
] }, index);
|
|
4088
|
+
} else if (item.type === "radio") {
|
|
4089
|
+
return /* @__PURE__ */ jsxs(
|
|
4090
|
+
"div",
|
|
4091
|
+
{
|
|
4092
|
+
className: mergeClasses(styles.accordionHeader, styles.accordionItem),
|
|
4093
|
+
style: { padding: tokens.spacingHorizontalXS },
|
|
4094
|
+
children: [
|
|
4095
|
+
/* @__PURE__ */ jsx("div", { style: { marginLeft: 2 }, children: imageRenderer({ src: item.image, alt: item.title, width: 74, height: 74 }) }),
|
|
4096
|
+
/* @__PURE__ */ jsxs("div", { className: styles.accordionTitleAndInfo, style: { marginLeft: 18 }, children: [
|
|
4097
|
+
/* @__PURE__ */ jsx(Body1, { children: item.title }),
|
|
4098
|
+
/* @__PURE__ */ jsx(Caption1, { children: item.info })
|
|
4099
|
+
] }),
|
|
4100
|
+
/* @__PURE__ */ jsx(Radio, { value: item.title })
|
|
4101
|
+
]
|
|
4102
|
+
},
|
|
4103
|
+
index
|
|
4104
|
+
);
|
|
4105
|
+
}
|
|
4106
|
+
return null;
|
|
4107
|
+
})
|
|
4108
|
+
}
|
|
4109
|
+
)
|
|
4110
|
+
}
|
|
4111
|
+
),
|
|
4112
|
+
/* @__PURE__ */ jsxs("div", { className: styles.footer, children: [
|
|
4113
|
+
/* @__PURE__ */ jsx(Button, { appearance: "secondary", shape: "circular", onClick: onClose, children: "Batal" }),
|
|
4114
|
+
/* @__PURE__ */ jsx(
|
|
4115
|
+
Button,
|
|
4116
|
+
{
|
|
4117
|
+
appearance: "primary",
|
|
4118
|
+
shape: "circular",
|
|
4119
|
+
onClick: handleConfirm,
|
|
4120
|
+
disabled: !selectedServiceTitle,
|
|
4121
|
+
children: "Simpan"
|
|
4122
|
+
}
|
|
4123
|
+
)
|
|
4124
|
+
] })
|
|
4125
|
+
] })
|
|
4126
|
+
] }) })
|
|
4127
|
+
}
|
|
4128
|
+
);
|
|
4129
|
+
};
|
|
4130
|
+
|
|
4131
|
+
// src/components/ModalTypeOfService/constants.ts
|
|
4132
|
+
var DEFAULT_VEHICLE_ICONS = {
|
|
4133
|
+
pedestrian: "/assets/images/icons/pedestrian.webp",
|
|
4134
|
+
roadbike: "/assets/images/icons/roadbike.webp",
|
|
4135
|
+
motorbike1: "/assets/images/icons/motorbike-1.webp",
|
|
4136
|
+
motorbike2: "/assets/images/icons/motorbike-2.svg",
|
|
4137
|
+
smallCar: "/assets/images/icons/small-car.webp",
|
|
4138
|
+
smallBus: "/assets/images/icons/small-bus.webp",
|
|
4139
|
+
bigBus: "/assets/images/icons/big-bus.webp",
|
|
4140
|
+
truck: "/assets/images/icons/truck.webp",
|
|
4141
|
+
bigTruck: "/assets/images/icons/big-truck.webp",
|
|
4142
|
+
looseLoad: "/assets/images/icons/loose-load.webp"
|
|
4143
|
+
};
|
|
3875
4144
|
|
|
3876
|
-
export { BackgroundTicketCard_default as BackgroundTicketCard, BackgroundTicketCardVertical_default as BackgroundTicketCardVertical, CardBanner, CardPromo, CardServiceMenu, CardTicket, CarouselWithCustomNav, DEFAULT_COUNTRY_CODES2 as DEFAULT_COUNTRY_CODES, DEFAULT_SERVICE_CLASSES, InputDynamic_default as InputDynamic, MODAL_PRESETS, ModalIllustration, ModalSearchHarbor, ModalSelectDate, ModalService, ModalTotalPassengers, getModalPreset };
|
|
4145
|
+
export { BackgroundTicketCard_default as BackgroundTicketCard, BackgroundTicketCardVertical_default as BackgroundTicketCardVertical, CardBanner, CardPromo, CardServiceMenu, CardTicket, CarouselWithCustomNav, DEFAULT_COUNTRY_CODES2 as DEFAULT_COUNTRY_CODES, DEFAULT_SERVICE_CLASSES, DEFAULT_VEHICLE_ICONS, InputDynamic_default as InputDynamic, MODAL_PRESETS, ModalIllustration, ModalSearchHarbor, ModalSelectDate, ModalService, ModalTotalPassengers, ModalTypeOfService, getModalPreset };
|
|
3877
4146
|
//# sourceMappingURL=index.mjs.map
|
|
3878
4147
|
//# sourceMappingURL=index.mjs.map
|