@asdp/ferryui 0.1.22-dev.9582 → 0.1.22-dev.9596

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.mjs CHANGED
@@ -8917,10 +8917,11 @@ var DEFAULT_LABELS17 = {
8917
8917
  return `Mulai dari IDR ${formatPrice(min)} - ${formatPrice(max)}`;
8918
8918
  },
8919
8919
  durationLabel: "Durasi perjalanan",
8920
- durationRangeText: (min, max) => `Perjalanan ${min} - ${max} jam`,
8920
+ durationRangeText: (min, max) => `Perjalanan ${min} - ${max} menit`,
8921
8921
  resetButton: "Reset",
8922
8922
  applyButton: "Terapkan",
8923
8923
  hourUnit: "jam",
8924
+ minuteUnit: "menit",
8924
8925
  currencySymbol: "IDR",
8925
8926
  closeAriaLabel: "Tutup"
8926
8927
  },
@@ -8935,10 +8936,11 @@ var DEFAULT_LABELS17 = {
8935
8936
  return `From IDR ${formatPrice(min)} - ${formatPrice(max)}`;
8936
8937
  },
8937
8938
  durationLabel: "Travel duration",
8938
- durationRangeText: (min, max) => `${min} - ${max} hours trip`,
8939
+ durationRangeText: (min, max) => `${min} - ${max} minutes trip`,
8939
8940
  resetButton: "Reset",
8940
8941
  applyButton: "Apply",
8941
8942
  hourUnit: "hours",
8943
+ minuteUnit: "minutes",
8942
8944
  currencySymbol: "IDR",
8943
8945
  closeAriaLabel: "Close"
8944
8946
  }
@@ -8959,16 +8961,16 @@ var DEFAULT_TIME_SLOTS = [
8959
8961
  { value: "18:00 - 24:00", label: "18:00 - 24:00" }
8960
8962
  ];
8961
8963
  var DEFAULT_PRICE_RANGE = {
8962
- min: 2e5,
8963
- max: 8e5
8964
+ min: 0,
8965
+ max: 0
8964
8966
  };
8965
8967
  var DEFAULT_DURATION_RANGE = {
8966
8968
  min: 0,
8967
- max: 8
8969
+ max: 0
8968
8970
  };
8969
8971
  var useStyles18 = makeStyles({
8970
8972
  dialogSurface: {
8971
- maxWidth: "600px",
8973
+ maxWidth: "650px",
8972
8974
  width: "100%"
8973
8975
  },
8974
8976
  content: {
@@ -9050,6 +9052,16 @@ var useStyles18 = makeStyles({
9050
9052
  backgroundColor: tokens.colorPaletteRedBackground1,
9051
9053
  ...shorthands.borderColor(tokens.colorPaletteRedForeground1)
9052
9054
  }
9055
+ },
9056
+ skeletonGrid: {
9057
+ display: "grid",
9058
+ gridTemplateColumns: "repeat(2, 1fr)",
9059
+ gap: "0.5rem"
9060
+ },
9061
+ skeletonCheckboxRow: {
9062
+ display: "flex",
9063
+ gap: tokens.spacingHorizontalS,
9064
+ alignItems: "center"
9053
9065
  }
9054
9066
  });
9055
9067
  var ModalFilterTicket = ({
@@ -9069,12 +9081,14 @@ var ModalFilterTicket = ({
9069
9081
  onReset,
9070
9082
  onApply,
9071
9083
  labels,
9072
- serviceTypes = DEFAULT_SERVICE_TYPES,
9073
- timeSlots = DEFAULT_TIME_SLOTS,
9074
- minPrice = DEFAULT_PRICE_RANGE.min,
9075
- maxPrice = DEFAULT_PRICE_RANGE.max,
9076
- minDuration = DEFAULT_DURATION_RANGE.min,
9077
- maxDuration = DEFAULT_DURATION_RANGE.max
9084
+ serviceTypes = [],
9085
+ timeSlots = [],
9086
+ minPrice = 0,
9087
+ maxPrice = 0,
9088
+ minDuration = 0,
9089
+ maxDuration = 0,
9090
+ durationStep = 1,
9091
+ isLoading = false
9078
9092
  }) => {
9079
9093
  const styles = useStyles18();
9080
9094
  const mergedLabels = { ...DEFAULT_LABELS17[language], ...labels };
@@ -9116,8 +9130,19 @@ var ModalFilterTicket = ({
9116
9130
  price
9117
9131
  );
9118
9132
  };
9133
+ const hasPriceRange = minPrice > 0 || maxPrice > 0;
9134
+ const hasDurationRange = minDuration > 0 || maxDuration > 0;
9135
+ const safePriceValues = hasPriceRange ? [
9136
+ Math.min(Math.max(priceRange[0], minPrice), maxPrice),
9137
+ Math.min(Math.max(priceRange[1], minPrice), maxPrice)
9138
+ ] : [minPrice, maxPrice];
9139
+ const safeDurationValues = hasDurationRange ? [
9140
+ Math.min(Math.max(durationRange[0], minDuration), maxDuration),
9141
+ Math.min(Math.max(durationRange[1], minDuration), maxDuration)
9142
+ ] : [minDuration, maxDuration];
9119
9143
  const renderPriceTrack = useCallback(
9120
9144
  ({ props, children }) => {
9145
+ if (!hasPriceRange) return /* @__PURE__ */ jsx("div", { ...props, ref: props.ref, children });
9121
9146
  const [value1, value2] = priceRange;
9122
9147
  const percent1 = (value1 - minPrice) / (maxPrice - minPrice) * 100;
9123
9148
  const percent2 = (value2 - minPrice) / (maxPrice - minPrice) * 100;
@@ -9153,10 +9178,11 @@ var ModalFilterTicket = ({
9153
9178
  }
9154
9179
  );
9155
9180
  },
9156
- [priceRange, minPrice, maxPrice]
9181
+ [priceRange, minPrice, maxPrice, hasPriceRange]
9157
9182
  );
9158
9183
  const renderDurationTrack = useCallback(
9159
9184
  ({ props, children }) => {
9185
+ if (!hasDurationRange) return /* @__PURE__ */ jsx("div", { ...props, ref: props.ref, children });
9160
9186
  const [value1, value2] = durationRange;
9161
9187
  const percent1 = (value1 - minDuration) / (maxDuration - minDuration) * 100;
9162
9188
  const percent2 = (value2 - minDuration) / (maxDuration - minDuration) * 100;
@@ -9192,7 +9218,7 @@ var ModalFilterTicket = ({
9192
9218
  }
9193
9219
  );
9194
9220
  },
9195
- [durationRange, minDuration, maxDuration]
9221
+ [durationRange, minDuration, maxDuration, hasDurationRange]
9196
9222
  );
9197
9223
  const renderThumb = ({ props }) => /* @__PURE__ */ jsx(
9198
9224
  "div",
@@ -9212,6 +9238,30 @@ var ModalFilterTicket = ({
9212
9238
  }
9213
9239
  }
9214
9240
  );
9241
+ const renderServiceTypesSkeleton = () => /* @__PURE__ */ jsxs("div", { className: styles.section, children: [
9242
+ /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "120px", height: "20px" } }) }),
9243
+ /* @__PURE__ */ jsx("div", { className: styles.skeletonGrid, children: Array.from({ length: 4 }).map((_, i) => /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "100%", height: "40px", borderRadius: "8px" } }) }, `svc-skel-${i}`)) })
9244
+ ] });
9245
+ const renderTimeSlotsSkeleton = () => /* @__PURE__ */ jsxs("div", { className: styles.section, children: [
9246
+ /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "100px", height: "20px" } }) }),
9247
+ /* @__PURE__ */ jsx(Row, { children: Array.from({ length: 4 }).map((_, i) => /* @__PURE__ */ jsx(Col, { xs: 6, sm: 6, md: 6, lg: 3, xl: 3, xxl: 3, xxxl: 3, children: /* @__PURE__ */ jsxs("div", { className: styles.skeletonCheckboxRow, children: [
9248
+ /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "16px", height: "16px", borderRadius: "4px" } }) }),
9249
+ /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "80px", height: "16px" } }) })
9250
+ ] }) }, `time-skel-${i}`)) })
9251
+ ] });
9252
+ const renderRangeSkeleton = () => /* @__PURE__ */ jsxs("div", { className: styles.containerRange, children: [
9253
+ /* @__PURE__ */ jsxs("div", { className: styles.spaceText, children: [
9254
+ /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "80px", height: "20px" } }) }),
9255
+ /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "200px", height: "16px" } }) })
9256
+ ] }),
9257
+ /* @__PURE__ */ jsxs("div", { className: styles.sliderContainer, children: [
9258
+ /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "100%", height: "4px", borderRadius: "2px" } }) }),
9259
+ /* @__PURE__ */ jsxs("div", { className: styles.sliderValues, children: [
9260
+ /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "60px", height: "14px" } }) }),
9261
+ /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(SkeletonItem, { style: { width: "60px", height: "14px" } }) })
9262
+ ] })
9263
+ ] })
9264
+ ] });
9215
9265
  return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (_, data) => onOpenChange(data.open), children: /* @__PURE__ */ jsx(DialogSurface, { className: styles.dialogSurface, children: /* @__PURE__ */ jsxs(DialogBody, { children: [
9216
9266
  /* @__PURE__ */ jsx(
9217
9267
  DialogTitle,
@@ -9231,7 +9281,7 @@ var ModalFilterTicket = ({
9231
9281
  ),
9232
9282
  /* @__PURE__ */ jsxs(DialogContent, { className: styles.content, children: [
9233
9283
  /* @__PURE__ */ jsx(Divider, {}),
9234
- /* @__PURE__ */ jsxs("div", { className: styles.section, children: [
9284
+ isLoading ? renderServiceTypesSkeleton() : /* @__PURE__ */ jsxs("div", { className: styles.section, children: [
9235
9285
  /* @__PURE__ */ jsx(Body1, { children: mergedLabels.serviceTypeLabel }),
9236
9286
  /* @__PURE__ */ jsx("div", { className: styles.buttonGrid, children: serviceTypes.map((service) => {
9237
9287
  const isSelected = selectedServiceTypes.includes(
@@ -9252,7 +9302,7 @@ var ModalFilterTicket = ({
9252
9302
  }) })
9253
9303
  ] }),
9254
9304
  /* @__PURE__ */ jsx(Divider, {}),
9255
- /* @__PURE__ */ jsxs("div", { className: styles.section, children: [
9305
+ isLoading ? renderTimeSlotsSkeleton() : /* @__PURE__ */ jsxs("div", { className: styles.section, children: [
9256
9306
  /* @__PURE__ */ jsx(Body1, { children: mergedLabels.departureTimeLabel }),
9257
9307
  /* @__PURE__ */ jsx(Row, { children: timeSlots.map((slot) => /* @__PURE__ */ jsx(
9258
9308
  Col,
@@ -9280,7 +9330,7 @@ var ModalFilterTicket = ({
9280
9330
  )) })
9281
9331
  ] }),
9282
9332
  /* @__PURE__ */ jsx(Divider, {}),
9283
- /* @__PURE__ */ jsxs("div", { className: styles.section, children: [
9333
+ isLoading ? renderTimeSlotsSkeleton() : /* @__PURE__ */ jsxs("div", { className: styles.section, children: [
9284
9334
  /* @__PURE__ */ jsx(Body1, { children: mergedLabels.arrivalTimeLabel }),
9285
9335
  /* @__PURE__ */ jsx(Row, { children: timeSlots.map((slot) => /* @__PURE__ */ jsx(
9286
9336
  Col,
@@ -9308,18 +9358,18 @@ var ModalFilterTicket = ({
9308
9358
  )) })
9309
9359
  ] }),
9310
9360
  /* @__PURE__ */ jsx(Divider, {}),
9311
- /* @__PURE__ */ jsxs("div", { className: styles.containerRange, children: [
9361
+ isLoading ? renderRangeSkeleton() : /* @__PURE__ */ jsxs("div", { className: styles.containerRange, children: [
9312
9362
  /* @__PURE__ */ jsxs("div", { className: styles.spaceText, children: [
9313
9363
  /* @__PURE__ */ jsx(Subtitle2, { children: mergedLabels.priceLabel }),
9314
9364
  /* @__PURE__ */ jsx(Body1, { children: mergedLabels.priceRangeText(priceRange[0], priceRange[1]) })
9315
9365
  ] }),
9316
9366
  /* @__PURE__ */ jsxs("div", { className: styles.sliderContainer, children: [
9317
- rangeReady && /* @__PURE__ */ jsx(
9367
+ rangeReady && hasPriceRange && /* @__PURE__ */ jsx(
9318
9368
  Range,
9319
9369
  {
9320
9370
  min: minPrice,
9321
9371
  max: maxPrice,
9322
- values: priceRange,
9372
+ values: safePriceValues,
9323
9373
  onChange: (values) => onPriceRangeChange(values),
9324
9374
  renderTrack: renderPriceTrack,
9325
9375
  renderThumb
@@ -9333,7 +9383,7 @@ var ModalFilterTicket = ({
9333
9383
  ] })
9334
9384
  ] }),
9335
9385
  /* @__PURE__ */ jsx(Divider, {}),
9336
- /* @__PURE__ */ jsxs("div", { className: styles.containerRange, children: [
9386
+ isLoading ? renderRangeSkeleton() : /* @__PURE__ */ jsxs("div", { className: styles.containerRange, children: [
9337
9387
  /* @__PURE__ */ jsxs("div", { className: styles.spaceText, children: [
9338
9388
  /* @__PURE__ */ jsx(Subtitle2, { children: mergedLabels.durationLabel }),
9339
9389
  /* @__PURE__ */ jsx(Body1, { children: mergedLabels.durationRangeText(
@@ -9342,13 +9392,13 @@ var ModalFilterTicket = ({
9342
9392
  ) })
9343
9393
  ] }),
9344
9394
  /* @__PURE__ */ jsxs("div", { className: styles.sliderContainer, children: [
9345
- rangeReady && /* @__PURE__ */ jsx(
9395
+ rangeReady && hasDurationRange && /* @__PURE__ */ jsx(
9346
9396
  Range,
9347
9397
  {
9348
- step: 1,
9398
+ step: durationStep,
9349
9399
  min: minDuration,
9350
9400
  max: maxDuration,
9351
- values: durationRange,
9401
+ values: safeDurationValues,
9352
9402
  onChange: (values) => onDurationRangeChange(values),
9353
9403
  renderTrack: renderDurationTrack,
9354
9404
  renderThumb
@@ -9359,12 +9409,12 @@ var ModalFilterTicket = ({
9359
9409
  /* @__PURE__ */ jsxs("span", { children: [
9360
9410
  minDuration,
9361
9411
  " ",
9362
- mergedLabels.hourUnit
9412
+ mergedLabels.minuteUnit
9363
9413
  ] }),
9364
9414
  /* @__PURE__ */ jsxs("span", { children: [
9365
9415
  maxDuration,
9366
9416
  " ",
9367
- mergedLabels.hourUnit
9417
+ mergedLabels.minuteUnit
9368
9418
  ] })
9369
9419
  ] })
9370
9420
  ] })