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