@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.d.mts CHANGED
@@ -2023,7 +2023,7 @@ interface ModalFilterTicketProps {
2023
2023
  */
2024
2024
  onPriceRangeChange: (range: [number, number]) => void;
2025
2025
  /**
2026
- * Duration range [min, max] in hours
2026
+ * Duration range [min, max] in minutes
2027
2027
  */
2028
2028
  durationRange: [number, number];
2029
2029
  /**
@@ -2043,14 +2043,14 @@ interface ModalFilterTicketProps {
2043
2043
  */
2044
2044
  labels?: Partial<ModalFilterTicketLabels>;
2045
2045
  /**
2046
- * Optional custom service types
2046
+ * Service types list (from API data)
2047
2047
  */
2048
2048
  serviceTypes?: Array<{
2049
2049
  value: string;
2050
2050
  label: string;
2051
2051
  }>;
2052
2052
  /**
2053
- * Optional custom time slots
2053
+ * Time slots list (from API/Redux data)
2054
2054
  */
2055
2055
  timeSlots?: Array<{
2056
2056
  value: string;
@@ -2058,24 +2058,34 @@ interface ModalFilterTicketProps {
2058
2058
  }>;
2059
2059
  /**
2060
2060
  * Min price for range slider
2061
- * @default 200000
2061
+ * @default 0
2062
2062
  */
2063
2063
  minPrice?: number;
2064
2064
  /**
2065
2065
  * Max price for range slider
2066
- * @default 800000
2066
+ * @default 0
2067
2067
  */
2068
2068
  maxPrice?: number;
2069
2069
  /**
2070
- * Min duration for range slider (hours)
2070
+ * Min duration for range slider (minutes)
2071
2071
  * @default 0
2072
2072
  */
2073
2073
  minDuration?: number;
2074
2074
  /**
2075
- * Max duration for range slider (hours)
2076
- * @default 8
2075
+ * Max duration for range slider (minutes)
2076
+ * @default 0
2077
2077
  */
2078
2078
  maxDuration?: number;
2079
+ /**
2080
+ * Step value for duration range slider
2081
+ * @default 1
2082
+ */
2083
+ durationStep?: number;
2084
+ /**
2085
+ * Whether the filter data is still loading (shows skeleton)
2086
+ * @default false
2087
+ */
2088
+ isLoading?: boolean;
2079
2089
  }
2080
2090
  interface ModalFilterTicketLabels {
2081
2091
  title: string;
@@ -2089,6 +2099,7 @@ interface ModalFilterTicketLabels {
2089
2099
  resetButton: string;
2090
2100
  applyButton: string;
2091
2101
  hourUnit: string;
2102
+ minuteUnit: string;
2092
2103
  currencySymbol: string;
2093
2104
  closeAriaLabel: string;
2094
2105
  }
package/dist/index.d.ts CHANGED
@@ -2023,7 +2023,7 @@ interface ModalFilterTicketProps {
2023
2023
  */
2024
2024
  onPriceRangeChange: (range: [number, number]) => void;
2025
2025
  /**
2026
- * Duration range [min, max] in hours
2026
+ * Duration range [min, max] in minutes
2027
2027
  */
2028
2028
  durationRange: [number, number];
2029
2029
  /**
@@ -2043,14 +2043,14 @@ interface ModalFilterTicketProps {
2043
2043
  */
2044
2044
  labels?: Partial<ModalFilterTicketLabels>;
2045
2045
  /**
2046
- * Optional custom service types
2046
+ * Service types list (from API data)
2047
2047
  */
2048
2048
  serviceTypes?: Array<{
2049
2049
  value: string;
2050
2050
  label: string;
2051
2051
  }>;
2052
2052
  /**
2053
- * Optional custom time slots
2053
+ * Time slots list (from API/Redux data)
2054
2054
  */
2055
2055
  timeSlots?: Array<{
2056
2056
  value: string;
@@ -2058,24 +2058,34 @@ interface ModalFilterTicketProps {
2058
2058
  }>;
2059
2059
  /**
2060
2060
  * Min price for range slider
2061
- * @default 200000
2061
+ * @default 0
2062
2062
  */
2063
2063
  minPrice?: number;
2064
2064
  /**
2065
2065
  * Max price for range slider
2066
- * @default 800000
2066
+ * @default 0
2067
2067
  */
2068
2068
  maxPrice?: number;
2069
2069
  /**
2070
- * Min duration for range slider (hours)
2070
+ * Min duration for range slider (minutes)
2071
2071
  * @default 0
2072
2072
  */
2073
2073
  minDuration?: number;
2074
2074
  /**
2075
- * Max duration for range slider (hours)
2076
- * @default 8
2075
+ * Max duration for range slider (minutes)
2076
+ * @default 0
2077
2077
  */
2078
2078
  maxDuration?: number;
2079
+ /**
2080
+ * Step value for duration range slider
2081
+ * @default 1
2082
+ */
2083
+ durationStep?: number;
2084
+ /**
2085
+ * Whether the filter data is still loading (shows skeleton)
2086
+ * @default false
2087
+ */
2088
+ isLoading?: boolean;
2079
2089
  }
2080
2090
  interface ModalFilterTicketLabels {
2081
2091
  title: string;
@@ -2089,6 +2099,7 @@ interface ModalFilterTicketLabels {
2089
2099
  resetButton: string;
2090
2100
  applyButton: string;
2091
2101
  hourUnit: string;
2102
+ minuteUnit: string;
2092
2103
  currencySymbol: string;
2093
2104
  closeAriaLabel: string;
2094
2105
  }
package/dist/index.js CHANGED
@@ -8926,10 +8926,11 @@ var DEFAULT_LABELS17 = {
8926
8926
  return `Mulai dari IDR ${formatPrice(min)} - ${formatPrice(max)}`;
8927
8927
  },
8928
8928
  durationLabel: "Durasi perjalanan",
8929
- durationRangeText: (min, max) => `Perjalanan ${min} - ${max} jam`,
8929
+ durationRangeText: (min, max) => `Perjalanan ${min} - ${max} menit`,
8930
8930
  resetButton: "Reset",
8931
8931
  applyButton: "Terapkan",
8932
8932
  hourUnit: "jam",
8933
+ minuteUnit: "menit",
8933
8934
  currencySymbol: "IDR",
8934
8935
  closeAriaLabel: "Tutup"
8935
8936
  },
@@ -8944,10 +8945,11 @@ var DEFAULT_LABELS17 = {
8944
8945
  return `From IDR ${formatPrice(min)} - ${formatPrice(max)}`;
8945
8946
  },
8946
8947
  durationLabel: "Travel duration",
8947
- durationRangeText: (min, max) => `${min} - ${max} hours trip`,
8948
+ durationRangeText: (min, max) => `${min} - ${max} minutes trip`,
8948
8949
  resetButton: "Reset",
8949
8950
  applyButton: "Apply",
8950
8951
  hourUnit: "hours",
8952
+ minuteUnit: "minutes",
8951
8953
  currencySymbol: "IDR",
8952
8954
  closeAriaLabel: "Close"
8953
8955
  }
@@ -8968,16 +8970,16 @@ var DEFAULT_TIME_SLOTS = [
8968
8970
  { value: "18:00 - 24:00", label: "18:00 - 24:00" }
8969
8971
  ];
8970
8972
  var DEFAULT_PRICE_RANGE = {
8971
- min: 2e5,
8972
- max: 8e5
8973
+ min: 0,
8974
+ max: 0
8973
8975
  };
8974
8976
  var DEFAULT_DURATION_RANGE = {
8975
8977
  min: 0,
8976
- max: 8
8978
+ max: 0
8977
8979
  };
8978
8980
  var useStyles18 = reactComponents.makeStyles({
8979
8981
  dialogSurface: {
8980
- maxWidth: "600px",
8982
+ maxWidth: "650px",
8981
8983
  width: "100%"
8982
8984
  },
8983
8985
  content: {
@@ -9059,6 +9061,16 @@ var useStyles18 = reactComponents.makeStyles({
9059
9061
  backgroundColor: reactComponents.tokens.colorPaletteRedBackground1,
9060
9062
  ...reactComponents.shorthands.borderColor(reactComponents.tokens.colorPaletteRedForeground1)
9061
9063
  }
9064
+ },
9065
+ skeletonGrid: {
9066
+ display: "grid",
9067
+ gridTemplateColumns: "repeat(2, 1fr)",
9068
+ gap: "0.5rem"
9069
+ },
9070
+ skeletonCheckboxRow: {
9071
+ display: "flex",
9072
+ gap: reactComponents.tokens.spacingHorizontalS,
9073
+ alignItems: "center"
9062
9074
  }
9063
9075
  });
9064
9076
  var ModalFilterTicket = ({
@@ -9078,12 +9090,14 @@ var ModalFilterTicket = ({
9078
9090
  onReset,
9079
9091
  onApply,
9080
9092
  labels,
9081
- serviceTypes = DEFAULT_SERVICE_TYPES,
9082
- timeSlots = DEFAULT_TIME_SLOTS,
9083
- minPrice = DEFAULT_PRICE_RANGE.min,
9084
- maxPrice = DEFAULT_PRICE_RANGE.max,
9085
- minDuration = DEFAULT_DURATION_RANGE.min,
9086
- maxDuration = DEFAULT_DURATION_RANGE.max
9093
+ serviceTypes = [],
9094
+ timeSlots = [],
9095
+ minPrice = 0,
9096
+ maxPrice = 0,
9097
+ minDuration = 0,
9098
+ maxDuration = 0,
9099
+ durationStep = 1,
9100
+ isLoading = false
9087
9101
  }) => {
9088
9102
  const styles = useStyles18();
9089
9103
  const mergedLabels = { ...DEFAULT_LABELS17[language], ...labels };
@@ -9125,8 +9139,19 @@ var ModalFilterTicket = ({
9125
9139
  price
9126
9140
  );
9127
9141
  };
9142
+ const hasPriceRange = minPrice > 0 || maxPrice > 0;
9143
+ const hasDurationRange = minDuration > 0 || maxDuration > 0;
9144
+ const safePriceValues = hasPriceRange ? [
9145
+ Math.min(Math.max(priceRange[0], minPrice), maxPrice),
9146
+ Math.min(Math.max(priceRange[1], minPrice), maxPrice)
9147
+ ] : [minPrice, maxPrice];
9148
+ const safeDurationValues = hasDurationRange ? [
9149
+ Math.min(Math.max(durationRange[0], minDuration), maxDuration),
9150
+ Math.min(Math.max(durationRange[1], minDuration), maxDuration)
9151
+ ] : [minDuration, maxDuration];
9128
9152
  const renderPriceTrack = React.useCallback(
9129
9153
  ({ props, children }) => {
9154
+ if (!hasPriceRange) return /* @__PURE__ */ jsxRuntime.jsx("div", { ...props, ref: props.ref, children });
9130
9155
  const [value1, value2] = priceRange;
9131
9156
  const percent1 = (value1 - minPrice) / (maxPrice - minPrice) * 100;
9132
9157
  const percent2 = (value2 - minPrice) / (maxPrice - minPrice) * 100;
@@ -9162,10 +9187,11 @@ var ModalFilterTicket = ({
9162
9187
  }
9163
9188
  );
9164
9189
  },
9165
- [priceRange, minPrice, maxPrice]
9190
+ [priceRange, minPrice, maxPrice, hasPriceRange]
9166
9191
  );
9167
9192
  const renderDurationTrack = React.useCallback(
9168
9193
  ({ props, children }) => {
9194
+ if (!hasDurationRange) return /* @__PURE__ */ jsxRuntime.jsx("div", { ...props, ref: props.ref, children });
9169
9195
  const [value1, value2] = durationRange;
9170
9196
  const percent1 = (value1 - minDuration) / (maxDuration - minDuration) * 100;
9171
9197
  const percent2 = (value2 - minDuration) / (maxDuration - minDuration) * 100;
@@ -9201,7 +9227,7 @@ var ModalFilterTicket = ({
9201
9227
  }
9202
9228
  );
9203
9229
  },
9204
- [durationRange, minDuration, maxDuration]
9230
+ [durationRange, minDuration, maxDuration, hasDurationRange]
9205
9231
  );
9206
9232
  const renderThumb = ({ props }) => /* @__PURE__ */ jsxRuntime.jsx(
9207
9233
  "div",
@@ -9221,6 +9247,30 @@ var ModalFilterTicket = ({
9221
9247
  }
9222
9248
  }
9223
9249
  );
9250
+ const renderServiceTypesSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.section, children: [
9251
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Skeleton, { children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.SkeletonItem, { style: { width: "120px", height: "20px" } }) }),
9252
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.skeletonGrid, children: Array.from({ length: 4 }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Skeleton, { children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.SkeletonItem, { style: { width: "100%", height: "40px", borderRadius: "8px" } }) }, `svc-skel-${i}`)) })
9253
+ ] });
9254
+ const renderTimeSlotsSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.section, children: [
9255
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Skeleton, { children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.SkeletonItem, { style: { width: "100px", height: "20px" } }) }),
9256
+ /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Row, { children: Array.from({ length: 4 }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Col, { xs: 6, sm: 6, md: 6, lg: 3, xl: 3, xxl: 3, xxxl: 3, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.skeletonCheckboxRow, children: [
9257
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Skeleton, { children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.SkeletonItem, { style: { width: "16px", height: "16px", borderRadius: "4px" } }) }),
9258
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Skeleton, { children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.SkeletonItem, { style: { width: "80px", height: "16px" } }) })
9259
+ ] }) }, `time-skel-${i}`)) })
9260
+ ] });
9261
+ const renderRangeSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.containerRange, children: [
9262
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.spaceText, children: [
9263
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Skeleton, { children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.SkeletonItem, { style: { width: "80px", height: "20px" } }) }),
9264
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Skeleton, { children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.SkeletonItem, { style: { width: "200px", height: "16px" } }) })
9265
+ ] }),
9266
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.sliderContainer, children: [
9267
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Skeleton, { children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.SkeletonItem, { style: { width: "100%", height: "4px", borderRadius: "2px" } }) }),
9268
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.sliderValues, children: [
9269
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Skeleton, { children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.SkeletonItem, { style: { width: "60px", height: "14px" } }) }),
9270
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Skeleton, { children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.SkeletonItem, { style: { width: "60px", height: "14px" } }) })
9271
+ ] })
9272
+ ] })
9273
+ ] });
9224
9274
  return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Dialog, { open, onOpenChange: (_, data) => onOpenChange(data.open), children: /* @__PURE__ */ jsxRuntime.jsx(reactComponents.DialogSurface, { className: styles.dialogSurface, children: /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.DialogBody, { children: [
9225
9275
  /* @__PURE__ */ jsxRuntime.jsx(
9226
9276
  reactComponents.DialogTitle,
@@ -9240,7 +9290,7 @@ var ModalFilterTicket = ({
9240
9290
  ),
9241
9291
  /* @__PURE__ */ jsxRuntime.jsxs(reactComponents.DialogContent, { className: styles.content, children: [
9242
9292
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Divider, {}),
9243
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.section, children: [
9293
+ isLoading ? renderServiceTypesSkeleton() : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.section, children: [
9244
9294
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: mergedLabels.serviceTypeLabel }),
9245
9295
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.buttonGrid, children: serviceTypes.map((service) => {
9246
9296
  const isSelected = selectedServiceTypes.includes(
@@ -9261,7 +9311,7 @@ var ModalFilterTicket = ({
9261
9311
  }) })
9262
9312
  ] }),
9263
9313
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Divider, {}),
9264
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.section, children: [
9314
+ isLoading ? renderTimeSlotsSkeleton() : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.section, children: [
9265
9315
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: mergedLabels.departureTimeLabel }),
9266
9316
  /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Row, { children: timeSlots.map((slot) => /* @__PURE__ */ jsxRuntime.jsx(
9267
9317
  reactGridSystem.Col,
@@ -9289,7 +9339,7 @@ var ModalFilterTicket = ({
9289
9339
  )) })
9290
9340
  ] }),
9291
9341
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Divider, {}),
9292
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.section, children: [
9342
+ isLoading ? renderTimeSlotsSkeleton() : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.section, children: [
9293
9343
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: mergedLabels.arrivalTimeLabel }),
9294
9344
  /* @__PURE__ */ jsxRuntime.jsx(reactGridSystem.Row, { children: timeSlots.map((slot) => /* @__PURE__ */ jsxRuntime.jsx(
9295
9345
  reactGridSystem.Col,
@@ -9317,18 +9367,18 @@ var ModalFilterTicket = ({
9317
9367
  )) })
9318
9368
  ] }),
9319
9369
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Divider, {}),
9320
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.containerRange, children: [
9370
+ isLoading ? renderRangeSkeleton() : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.containerRange, children: [
9321
9371
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.spaceText, children: [
9322
9372
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Subtitle2, { children: mergedLabels.priceLabel }),
9323
9373
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: mergedLabels.priceRangeText(priceRange[0], priceRange[1]) })
9324
9374
  ] }),
9325
9375
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.sliderContainer, children: [
9326
- rangeReady && /* @__PURE__ */ jsxRuntime.jsx(
9376
+ rangeReady && hasPriceRange && /* @__PURE__ */ jsxRuntime.jsx(
9327
9377
  reactRange.Range,
9328
9378
  {
9329
9379
  min: minPrice,
9330
9380
  max: maxPrice,
9331
- values: priceRange,
9381
+ values: safePriceValues,
9332
9382
  onChange: (values) => onPriceRangeChange(values),
9333
9383
  renderTrack: renderPriceTrack,
9334
9384
  renderThumb
@@ -9342,7 +9392,7 @@ var ModalFilterTicket = ({
9342
9392
  ] })
9343
9393
  ] }),
9344
9394
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Divider, {}),
9345
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.containerRange, children: [
9395
+ isLoading ? renderRangeSkeleton() : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.containerRange, children: [
9346
9396
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.spaceText, children: [
9347
9397
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Subtitle2, { children: mergedLabels.durationLabel }),
9348
9398
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.Body1, { children: mergedLabels.durationRangeText(
@@ -9351,13 +9401,13 @@ var ModalFilterTicket = ({
9351
9401
  ) })
9352
9402
  ] }),
9353
9403
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.sliderContainer, children: [
9354
- rangeReady && /* @__PURE__ */ jsxRuntime.jsx(
9404
+ rangeReady && hasDurationRange && /* @__PURE__ */ jsxRuntime.jsx(
9355
9405
  reactRange.Range,
9356
9406
  {
9357
- step: 1,
9407
+ step: durationStep,
9358
9408
  min: minDuration,
9359
9409
  max: maxDuration,
9360
- values: durationRange,
9410
+ values: safeDurationValues,
9361
9411
  onChange: (values) => onDurationRangeChange(values),
9362
9412
  renderTrack: renderDurationTrack,
9363
9413
  renderThumb
@@ -9368,12 +9418,12 @@ var ModalFilterTicket = ({
9368
9418
  /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
9369
9419
  minDuration,
9370
9420
  " ",
9371
- mergedLabels.hourUnit
9421
+ mergedLabels.minuteUnit
9372
9422
  ] }),
9373
9423
  /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
9374
9424
  maxDuration,
9375
9425
  " ",
9376
- mergedLabels.hourUnit
9426
+ mergedLabels.minuteUnit
9377
9427
  ] })
9378
9428
  ] })
9379
9429
  ] })