@appcorp/fusion-storybook 0.3.66 → 0.3.68

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.
@@ -14,7 +14,6 @@ export declare const useStudentFeeModule: () => {
14
14
  handleDelete: (row?: TableRow) => void;
15
15
  handleEdit: (row?: TableRow) => void;
16
16
  handleFilters: () => void;
17
- setPendingFilter: (field: string, value: boolean | undefined | string) => void;
18
17
  handleMoreActions: () => void;
19
18
  handlePageChange: (page: number | unknown) => void;
20
19
  handlePageLimitChange: (k: string, value: object) => void;
@@ -40,13 +40,6 @@ export const useStudentFeeModule = () => {
40
40
  const workspace = getCachedWorkspaceSync();
41
41
  const listFetchNowRef = useRef(null);
42
42
  const debouncedQuery = useDebounce(state.searchQuery, 800);
43
- const pendingFiltersRef = useRef({
44
- filterEnabled: state.filterEnabled,
45
- filterStatus: state.filterStatus || "",
46
- });
47
- const setPendingFilter = useCallback((field, value) => {
48
- pendingFiltersRef.current = Object.assign(Object.assign({}, pendingFiltersRef.current), { [field]: value });
49
- }, []);
50
43
  // ============================================================================
51
44
  // 1.4.2 API PARAMETERS
52
45
  // ============================================================================
@@ -508,16 +501,6 @@ export const useStudentFeeModule = () => {
508
501
  });
509
502
  }, [dispatch]);
510
503
  const applyFilters = useCallback(() => {
511
- const pending = pendingFiltersRef.current;
512
- dispatch({
513
- type: STUDENT_FEE_ACTION_TYPES.SET_FILTERS,
514
- payload: {
515
- filters: {
516
- filterEnabled: pending.filterEnabled,
517
- filterStatus: pending.filterStatus,
518
- },
519
- },
520
- });
521
504
  dispatch({
522
505
  type: STUDENT_FEE_ACTION_TYPES.SET_CURRENT_PAGE,
523
506
  payload: { currentPage: 1 },
@@ -525,17 +508,15 @@ export const useStudentFeeModule = () => {
525
508
  closeDrawer();
526
509
  }, [dispatch, closeDrawer]);
527
510
  const clearFilters = useCallback(() => {
528
- pendingFiltersRef.current = {
529
- filterEnabled: undefined,
530
- filterStatus: "",
531
- };
532
511
  dispatch({
533
- type: STUDENT_FEE_ACTION_TYPES.SET_CURRENT_PAGE,
534
- payload: { currentPage: 1 },
512
+ type: STUDENT_FEE_ACTION_TYPES.SET_FILTERS,
513
+ payload: {
514
+ filters: { filterEnabled: undefined, filterStatus: "" },
515
+ },
535
516
  });
536
517
  dispatch({
537
- type: STUDENT_FEE_ACTION_TYPES.SET_FILTERS,
538
- payload: { filters: { filterEnabled: undefined, filterStatus: "" } },
518
+ type: STUDENT_FEE_ACTION_TYPES.SET_CURRENT_PAGE,
519
+ payload: { currentPage: 1 },
539
520
  });
540
521
  }, [dispatch]);
541
522
  const handleSearch = useCallback((query) => {
@@ -720,7 +701,6 @@ export const useStudentFeeModule = () => {
720
701
  handleDelete,
721
702
  handleEdit,
722
703
  handleFilters,
723
- setPendingFilter,
724
704
  handleMoreActions,
725
705
  handlePageChange,
726
706
  handlePageLimitChange,
@@ -6,7 +6,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  * Filter UI for the student-fee list. Supports filterEnabled (radio) and
7
7
  * filterStatus (payment status combobox).
8
8
  */
9
- import { useState } from "react";
10
9
  import { EnhancedRadio } from "@appcorp/shadcn/components/enhanced-radio";
11
10
  import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
12
11
  import { useStudentFeeModule } from "./context";
@@ -14,11 +13,9 @@ import { PAYMENT_STATUS_OPTIONS } from "./constants";
14
13
  import { STUDENT_FEE_API_ROUTES } from "../../constants";
15
14
  import { useTranslations } from "next-intl";
16
15
  export const StudentFeeFilter = () => {
17
- const { state, setPendingFilter } = useStudentFeeModule();
16
+ const { state, handleChange } = useStudentFeeModule();
18
17
  const { filterEnabled, filterStatus } = state;
19
18
  const t = useTranslations("studentFee");
20
- const [localFilterEnabled, setLocalFilterEnabled] = useState(filterEnabled);
21
- const [localFilterStatus, setLocalFilterStatus] = useState(filterStatus || "");
22
19
  const paymentStatusLabelMap = {
23
20
  PENDING: t("formOptionPending"),
24
21
  PARTIAL: t("formOptionPartial"),
@@ -27,26 +24,17 @@ export const StudentFeeFilter = () => {
27
24
  CANCELLED: t("formOptionCancelled"),
28
25
  REFUNDED: t("formOptionRefunded"),
29
26
  };
30
- const filterEnabledValue = localFilterEnabled === undefined
27
+ const filterEnabledValue = filterEnabled === undefined
31
28
  ? "undefined"
32
- : localFilterEnabled
29
+ : filterEnabled
33
30
  ? "true"
34
31
  : "false";
35
- const handleStatusChange = (value) => {
36
- setLocalFilterStatus(value);
37
- setPendingFilter("filterStatus", value);
38
- };
39
- const handleEnabledChange = (next) => {
40
- const parsed = next === "true" ? true : next === "false" ? false : undefined;
41
- setLocalFilterEnabled(parsed);
42
- setPendingFilter("filterEnabled", parsed);
43
- };
44
32
  const { enhancedComboboxElement: filterStatusCombo } = useEnhancedCombobox({
45
33
  emptyText: t("filterNoStatusFoundLabel"),
46
34
  id: "filterStatus",
47
35
  info: t("filterByPaymentStatus"),
48
36
  label: t("filterPaymentStatusLabel"),
49
- onValueChange: handleStatusChange,
37
+ onValueChange: (value) => handleChange("filterStatus", value),
50
38
  options: PAYMENT_STATUS_OPTIONS.map((opt) => ({
51
39
  value: opt.value,
52
40
  label: paymentStatusLabelMap[opt.value] || opt.label,
@@ -61,11 +49,14 @@ export const StudentFeeFilter = () => {
61
49
  value: String((_b = item.value) !== null && _b !== void 0 ? _b : ""),
62
50
  });
63
51
  },
64
- value: localFilterStatus,
52
+ value: filterStatus || "",
65
53
  });
66
54
  return (_jsxs("div", { className: "space-y-4", children: [filterStatusCombo, _jsx(EnhancedRadio, { label: t("filterEnabledLabel"), name: "filterEnabled", value: filterEnabledValue, options: [
67
55
  { label: t("filterOptionAll"), value: "undefined" },
68
56
  { label: t("filterOptionEnabled"), value: "true" },
69
57
  { label: t("filterOptionDisabled"), value: "false" },
70
- ], onValueChange: handleEnabledChange })] }));
58
+ ], onValueChange: (next) => {
59
+ const parsed = next === "true" ? true : next === "false" ? false : undefined;
60
+ handleChange("filterEnabled", parsed);
61
+ } })] }));
71
62
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.3.66",
3
+ "version": "0.3.68",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",