@appcorp/fusion-storybook 0.2.44 → 0.2.45

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.
@@ -32,8 +32,8 @@ export const AdmissionFilter = () => {
32
32
  label: t("filterAdmissionStatusLabel"),
33
33
  info: t("filterByAdmissionStatus"),
34
34
  options: ADMISSION_STATUS_OPTIONS.map((opt) => ({
35
- id: opt.value,
36
- name: admissionStatusLabelMap[opt.value] || opt.label,
35
+ value: opt.value,
36
+ label: admissionStatusLabelMap[opt.value] || opt.label,
37
37
  })),
38
38
  value: filterAdmissionStatus || "",
39
39
  onValueChange: (value) => handleChange("filterAdmissionStatus", value),
@@ -44,8 +44,8 @@ export const AdmissionForm = () => {
44
44
  required: true,
45
45
  onValueChange: (value) => handleChange("gender", value),
46
46
  options: GENDER_OPTIONS.map((g) => ({
47
- id: g.value,
48
- name: genderLabelMap[g.value] || g.label,
47
+ value: g.value,
48
+ label: genderLabelMap[g.value] || g.label,
49
49
  })),
50
50
  placeholder: t("formGenderPlaceholder"),
51
51
  searchEndpoint: ADMISSION_API_ROUTES.UNIT,
@@ -63,8 +63,8 @@ export const AdmissionForm = () => {
63
63
  .map((code) => {
64
64
  var _a;
65
65
  return ({
66
- id: code.code,
67
- name: `${code.code} - ${code.discountValue}${code.discountType === "PERCENTAGE" ? "%" : (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.currency}`,
66
+ value: code.code,
67
+ label: `${code.code} - ${code.discountValue}${code.discountType === "PERCENTAGE" ? "%" : (_a = workspace === null || workspace === void 0 ? void 0 : workspace.school) === null || _a === void 0 ? void 0 : _a.currency}`,
68
68
  });
69
69
  }),
70
70
  placeholder: t("formDiscountCodePlaceholder"),
@@ -24,8 +24,8 @@ export const AttendanceForm = () => {
24
24
  label: t("formOptionStatus"),
25
25
  onValueChange: (value) => handleChange("status", value),
26
26
  options: ATTENDANCE_STATUS_OPTIONS.map((opt) => ({
27
- id: opt.value,
28
- name: attendanceStatusLabelMap[opt.value] || opt.label,
27
+ value: opt.value,
28
+ label: attendanceStatusLabelMap[opt.value] || opt.label,
29
29
  })),
30
30
  placeholder: t("formStatusPlaceholder"),
31
31
  required: true,
@@ -20,8 +20,8 @@ export const AttendanceMoreActions = ({ labelAttendanceStatus, labelCourse, labe
20
20
  label: labelCourse,
21
21
  onValueChange: (value) => setCourseId(value),
22
22
  options: [{ id: "", code: "" }].map((c) => ({
23
- id: c.id,
24
- name: c.code.trim(),
23
+ value: c.id,
24
+ label: c.code.trim(),
25
25
  })),
26
26
  placeholder: labelCoursePlaceholder,
27
27
  required: true,
@@ -45,8 +45,8 @@ export const CourseForm = () => {
45
45
  options: sections === null || sections === void 0 ? void 0 : sections.map((section) => {
46
46
  var _a;
47
47
  return ({
48
- id: section.id,
49
- name: ((_a = section.class) === null || _a === void 0 ? void 0 : _a.code)
48
+ value: section.id,
49
+ label: ((_a = section.class) === null || _a === void 0 ? void 0 : _a.code)
50
50
  ? `${section.class.code}-${section.name}`
51
51
  : section.name,
52
52
  });
@@ -68,8 +68,8 @@ export const CourseForm = () => {
68
68
  handleChange("subjectLabel", ((_a = subjects === null || subjects === void 0 ? void 0 : subjects.find((s) => s.id === value)) === null || _a === void 0 ? void 0 : _a.name) || "");
69
69
  },
70
70
  options: subjects === null || subjects === void 0 ? void 0 : subjects.map((subject) => ({
71
- id: subject.id,
72
- name: subject.name,
71
+ value: subject.id,
72
+ label: subject.name,
73
73
  })),
74
74
  placeholder: t("formSubjectPlaceholder"),
75
75
  required: true,
@@ -92,8 +92,8 @@ export const CourseForm = () => {
92
92
  : "");
93
93
  },
94
94
  options: teachers === null || teachers === void 0 ? void 0 : teachers.map((teacher) => ({
95
- id: teacher.id,
96
- name: `${teacher.firstName || ""} ${teacher.lastName || ""}`.trim() ||
95
+ value: teacher.id,
96
+ label: `${teacher.firstName || ""} ${teacher.lastName || ""}`.trim() ||
97
97
  teacher.teacherCode ||
98
98
  teacher.id,
99
99
  })),
@@ -34,8 +34,8 @@ export const DiscountCodeForm = () => {
34
34
  label: t("formDiscountTypeLabel"),
35
35
  onValueChange: (value) => handleChange("discountType", value),
36
36
  options: DISCOUNT_TYPE_OPTIONS.map((opt) => ({
37
- id: opt.value,
38
- name: discountTypeLabelMap[opt.value] || opt.label,
37
+ value: opt.value,
38
+ label: discountTypeLabelMap[opt.value] || opt.label,
39
39
  })),
40
40
  placeholder: t("formDiscountTypePlaceholder"),
41
41
  required: true,
@@ -23,7 +23,7 @@ import { useTranslations } from "next-intl";
23
23
  // COMPONENT
24
24
  // ============================================================================
25
25
  export const EnrollmentForm = () => {
26
- const { state: { enabled, enrollmentDate, errors, sectionId, studentProfileId, }, handleChange, } = useEnrollmentModule();
26
+ const { state: { enabled, enrollmentDate, errors, sectionId, studentProfileId }, handleChange, } = useEnrollmentModule();
27
27
  const t = useTranslations("enrollment");
28
28
  const { enhancedComboboxElement: studentProfileIdCombo } = useEnhancedCombobox({
29
29
  emptyText: t("formNoStudentEmpty"),
@@ -32,8 +32,8 @@ export const EnrollmentForm = () => {
32
32
  label: t("formStudentLabel"),
33
33
  onValueChange: (value) => handleChange("studentProfileId", value),
34
34
  options: (getCachedStudentProfilesSync().items || []).map((s) => ({
35
- id: s.id,
36
- name: s.studentCode || s.id,
35
+ value: s.id,
36
+ label: s.studentCode || s.id,
37
37
  })),
38
38
  placeholder: t("formStudentPlaceholder"),
39
39
  required: true,
@@ -50,8 +50,8 @@ export const EnrollmentForm = () => {
50
50
  options: (getCachedSectionsSync().items || []).map((s) => {
51
51
  var _a;
52
52
  return ({
53
- id: s.id,
54
- name: ((_a = s.class) === null || _a === void 0 ? void 0 : _a.code) ? `${s.class.code}-${s.name}` : s.name,
53
+ value: s.id,
54
+ label: ((_a = s.class) === null || _a === void 0 ? void 0 : _a.code) ? `${s.class.code}-${s.name}` : s.name,
55
55
  });
56
56
  }),
57
57
  placeholder: t("sectionPlaceholder"),
@@ -9,7 +9,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  import { EnhancedRadio } from "@appcorp/shadcn/components/enhanced-radio";
10
10
  import { useEnhancedCombobox } from "@appcorp/shadcn/hooks/use-enhanced-combobox";
11
11
  import { useExpenseModule } from "./context";
12
- import { EXPENSE_CATEGORY_OPTIONS, EXPENSE_STATUS_OPTIONS, EXPENSE_API_ROUTES } from "./constants";
12
+ import { EXPENSE_CATEGORY_OPTIONS, EXPENSE_STATUS_OPTIONS, EXPENSE_API_ROUTES, } from "./constants";
13
13
  import { useTranslations } from "next-intl";
14
14
  export const ExpenseFilter = () => {
15
15
  const { state, handleChange } = useExpenseModule();
@@ -49,7 +49,10 @@ export const ExpenseFilter = () => {
49
49
  info: t("filterByCategory"),
50
50
  label: t("filterCategoryLabel"),
51
51
  onValueChange: (value) => handleChange("filterCategory", value),
52
- options: EXPENSE_CATEGORY_OPTIONS.map((opt) => ({ id: opt.value, name: categoryLabelMap[opt.value] || opt.label })),
52
+ options: EXPENSE_CATEGORY_OPTIONS.map((opt) => ({
53
+ value: opt.value,
54
+ label: categoryLabelMap[opt.value] || opt.label,
55
+ })),
53
56
  placeholder: t("filterAllCategoriesLabel"),
54
57
  searchEndpoint: EXPENSE_API_ROUTES.UNIT,
55
58
  searchPlaceholder: t("filterSearchCategoriesLabel"),
@@ -61,7 +64,10 @@ export const ExpenseFilter = () => {
61
64
  info: t("filterByStatus"),
62
65
  label: t("filterOptionStatus"),
63
66
  onValueChange: (value) => handleChange("filterStatus", value),
64
- options: EXPENSE_STATUS_OPTIONS.map((opt) => ({ id: opt.value, name: statusLabelMap[opt.value] || opt.label })),
67
+ options: EXPENSE_STATUS_OPTIONS.map((opt) => ({
68
+ value: opt.value,
69
+ label: statusLabelMap[opt.value] || opt.label,
70
+ })),
65
71
  placeholder: t("filterAllStatusesLabel"),
66
72
  searchEndpoint: EXPENSE_API_ROUTES.UNIT,
67
73
  searchPlaceholder: t("filterSearchStatusLabel"),
@@ -60,8 +60,8 @@ export const ExpenseForm = () => {
60
60
  label: t("formCategoryLabel"),
61
61
  onValueChange: (value) => handleChange("category", value),
62
62
  options: EXPENSE_CATEGORY_OPTIONS.map((opt) => ({
63
- id: opt.value,
64
- name: categoryLabelMap[opt.value] || opt.label,
63
+ value: opt.value,
64
+ label: categoryLabelMap[opt.value] || opt.label,
65
65
  })),
66
66
  placeholder: t("formCategoryPlaceholder"),
67
67
  required: true,
@@ -76,8 +76,8 @@ export const ExpenseForm = () => {
76
76
  label: t("formOptionStatus"),
77
77
  onValueChange: (value) => handleChange("status", value),
78
78
  options: EXPENSE_STATUS_OPTIONS.map((opt) => ({
79
- id: opt.value,
80
- name: statusLabelMap[opt.value] || opt.label,
79
+ value: opt.value,
80
+ label: statusLabelMap[opt.value] || opt.label,
81
81
  })),
82
82
  placeholder: t("formStatusPlaceholder"),
83
83
  required: true,
@@ -92,8 +92,8 @@ export const ExpenseForm = () => {
92
92
  label: t("formPaymentMethodLabel"),
93
93
  onValueChange: (value) => handleChange("paymentMethod", value),
94
94
  options: PAYMENT_METHOD_OPTIONS.map((opt) => ({
95
- id: opt.value,
96
- name: paymentMethodLabelMap[opt.value] || opt.label,
95
+ value: opt.value,
96
+ label: paymentMethodLabelMap[opt.value] || opt.label,
97
97
  })),
98
98
  placeholder: t("formPaymentMethodPlaceholder"),
99
99
  searchEndpoint: EXPENSE_API_ROUTES.UNIT,
@@ -51,8 +51,8 @@ export const FeeStructureForm = () => {
51
51
  label: t("formOptionFeeType"),
52
52
  onValueChange: (value) => handleChange("feeType", value),
53
53
  options: FEE_TYPE_OPTIONS.map((opt) => ({
54
- id: opt.value,
55
- name: feeTypeLabelMap[opt.value] || opt.label,
54
+ value: opt.value,
55
+ label: feeTypeLabelMap[opt.value] || opt.label,
56
56
  })),
57
57
  placeholder: t("formFeeTypePlaceholder"),
58
58
  required: true,
@@ -67,8 +67,8 @@ export const FeeStructureForm = () => {
67
67
  label: t("formOptionFrequency"),
68
68
  onValueChange: (value) => handleChange("frequency", value),
69
69
  options: FREQUENCY_OPTIONS.map((opt) => ({
70
- id: opt.value,
71
- name: frequencyLabelMap[opt.value] || opt.label,
70
+ value: opt.value,
71
+ label: frequencyLabelMap[opt.value] || opt.label,
72
72
  })),
73
73
  placeholder: t("formFrequencyPlaceholder"),
74
74
  searchEndpoint: FEE_STRUCTURE_API_ROUTES.UNIT,
@@ -82,8 +82,8 @@ export const FeeStructureForm = () => {
82
82
  label: t("formClassLabel"),
83
83
  onValueChange: (value) => handleChange("classId", value || null),
84
84
  options: classes === null || classes === void 0 ? void 0 : classes.map((cls) => ({
85
- id: cls.id,
86
- name: `${cls.name} (${cls.code})`,
85
+ value: cls.id,
86
+ label: `${cls.name} (${cls.code})`,
87
87
  })),
88
88
  placeholder: t("formClassPlaceholder"),
89
89
  searchEndpoint: FEE_STRUCTURE_API_ROUTES.UNIT,
@@ -24,7 +24,10 @@ export const SchoolForm = () => {
24
24
  info: t("formCurrencyInfo"),
25
25
  label: t("formCurrencyLabel"),
26
26
  onValueChange: (value) => handleChange("currency", value),
27
- options: Object.values(CURRENCY).map((c) => ({ id: c, name: c })),
27
+ options: Object.values(CURRENCY).map((c) => ({
28
+ value: c,
29
+ label: c,
30
+ })),
28
31
  placeholder: t("formCurrencyPlaceholder"),
29
32
  required: true,
30
33
  searchEndpoint: SCHOOL_API_ROUTES.UNIT,
@@ -31,8 +31,8 @@ export const SectionForm = () => {
31
31
  label: t("formClassLabel"),
32
32
  onValueChange: (value) => handleChange("classId", value),
33
33
  options: (classes === null || classes === void 0 ? void 0 : classes.map((cls) => ({
34
- id: cls.id,
35
- name: `${cls.name} (${cls.code})`,
34
+ value: cls.id,
35
+ label: `${cls.name} (${cls.code})`,
36
36
  }))) || [],
37
37
  placeholder: t("formClassPlaceholder"),
38
38
  required: true,
@@ -34,7 +34,10 @@ export const StudentFeeFilter = () => {
34
34
  info: t("filterByPaymentStatus"),
35
35
  label: t("filterPaymentStatusLabel"),
36
36
  onValueChange: (value) => handleChange("filterStatus", value),
37
- options: PAYMENT_STATUS_OPTIONS.map((opt) => ({ id: opt.value, name: paymentStatusLabelMap[opt.value] || opt.label })),
37
+ options: PAYMENT_STATUS_OPTIONS.map((opt) => ({
38
+ value: opt.value,
39
+ label: paymentStatusLabelMap[opt.value] || opt.label,
40
+ })),
38
41
  placeholder: t("filterAllStatusesLabel"),
39
42
  searchEndpoint: STUDENT_FEE_API_ROUTES.UNIT,
40
43
  searchPlaceholder: t("filterSearchStatusLabel"),
@@ -64,7 +64,10 @@ export const StudentFeeForm = () => {
64
64
  info: t("formStudentInfo"),
65
65
  label: t("formStudentLabel"),
66
66
  onValueChange: (value) => handleChange("studentProfileId", value),
67
- options: filteredStudentOptions,
67
+ options: filteredStudentOptions.map((s) => ({
68
+ value: s.id,
69
+ label: s.name,
70
+ })),
68
71
  placeholder: t("formStudentPlaceholder"),
69
72
  required: true,
70
73
  searchEndpoint: STUDENT_FEE_API_ROUTES.UNIT,
@@ -78,8 +81,8 @@ export const StudentFeeForm = () => {
78
81
  label: t("formFeeStructureLabel"),
79
82
  onValueChange: (value) => handleChange("feeStructureId", value),
80
83
  options: feeStructures === null || feeStructures === void 0 ? void 0 : feeStructures.map((fs) => ({
81
- id: fs.id,
82
- name: fs.name || fs.id,
84
+ value: fs.id,
85
+ label: fs.name || fs.id,
83
86
  })),
84
87
  placeholder: t("formFeeStructurePlaceholder"),
85
88
  required: true,
@@ -94,8 +97,8 @@ export const StudentFeeForm = () => {
94
97
  label: t("formDiscountCodeLabel"),
95
98
  onValueChange: (value) => handleChange("discountCodeId", value),
96
99
  options: (discountCodes === null || discountCodes === void 0 ? void 0 : discountCodes.map((code) => ({
97
- id: code.id,
98
- name: `${code.code} - ${code.discountValue}${code.discountType === DISCOUNT_TYPE.PERCENTAGE ? "%" : currency}`,
100
+ value: code.id,
101
+ label: `${code.code} - ${code.discountValue}${code.discountType === DISCOUNT_TYPE.PERCENTAGE ? "%" : currency}`,
99
102
  }))) || [],
100
103
  placeholder: t("formDiscountCodePlaceholder"),
101
104
  searchEndpoint: STUDENT_FEE_API_ROUTES.UNIT,
@@ -109,8 +112,8 @@ export const StudentFeeForm = () => {
109
112
  label: t("formOptionStatus"),
110
113
  onValueChange: (value) => handleChange("status", value),
111
114
  options: PAYMENT_STATUS_OPTIONS.map((opt) => ({
112
- id: opt.value,
113
- name: paymentStatusLabelMap[opt.value] || opt.label,
115
+ value: opt.value,
116
+ label: paymentStatusLabelMap[opt.value] || opt.label,
114
117
  })),
115
118
  placeholder: t("formStatusPlaceholder"),
116
119
  required: true,
@@ -27,8 +27,8 @@ export const StudentProfileFilter = () => {
27
27
  label: t("filterOptionStatus"),
28
28
  info: t("filterByStudentStatus"),
29
29
  options: [...STATUS_OPTIONS].map((opt) => ({
30
- id: opt.value,
31
- name: statusLabelMap[opt.value] || opt.label,
30
+ value: opt.value,
31
+ label: statusLabelMap[opt.value] || opt.label,
32
32
  })),
33
33
  value: "filterStatus",
34
34
  onValueChange: (value) => handleChange("filterStatus", value),
@@ -24,8 +24,8 @@ export const StudentProfileForm = () => {
24
24
  label: t("formGenderLabel"),
25
25
  onValueChange: (value) => handleChange("gender", value),
26
26
  options: GENDER_OPTIONS.map((opt) => ({
27
- id: opt.value,
28
- name: genderLabelMap[opt.value] || opt.label,
27
+ value: opt.value,
28
+ label: genderLabelMap[opt.value] || opt.label,
29
29
  })),
30
30
  placeholder: "",
31
31
  searchEndpoint: STUDENT_PROFILE_API_ROUTES.UNIT,
@@ -37,8 +37,8 @@ export const StudentProfileForm = () => {
37
37
  label: t("formOptionStatus"),
38
38
  onValueChange: (value) => handleChange("status", value),
39
39
  options: STATUS_OPTIONS.map((opt) => ({
40
- id: opt.value,
41
- name: opt.label,
40
+ value: opt.value,
41
+ label: opt.label,
42
42
  })),
43
43
  placeholder: "",
44
44
  required: true,
@@ -49,8 +49,8 @@ export const TeacherForm = () => {
49
49
  label: t("formGenderLabel"),
50
50
  onValueChange: (value) => handleChange("gender", value || null),
51
51
  options: GENDER_OPTIONS.map((opt) => ({
52
- id: opt.value,
53
- name: genderLabelMap[opt.value] || opt.label,
52
+ value: opt.value,
53
+ label: genderLabelMap[opt.value] || opt.label,
54
54
  })),
55
55
  placeholder: "",
56
56
  searchEndpoint: TEACHER_API_ROUTES.UNIT,
@@ -36,8 +36,8 @@ export const UserForm = () => {
36
36
  label: t("formRoleIdLabel"),
37
37
  onValueChange: (value) => handleChange("userRole", value),
38
38
  options: roleOptions.map((opt) => ({
39
- id: opt.id,
40
- name: opt.name,
39
+ value: opt.id,
40
+ label: opt.name,
41
41
  })),
42
42
  placeholder: t("formRoleIdPlaceholder"),
43
43
  required: true,
@@ -39,8 +39,8 @@ export const WorkspaceForm = () => {
39
39
  options: plans
40
40
  .filter(({ name }) => name.match("PKR"))
41
41
  .map((plan) => ({
42
- id: plan.id,
43
- name: plan.name,
42
+ value: plan.id,
43
+ label: plan.name,
44
44
  })),
45
45
  placeholder: t("formPlanPlaceholder"),
46
46
  info: t("formPlanInfo"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.2.44",
3
+ "version": "0.2.45",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@appcorp/app-corp-vista": "^1.0.0",
41
- "@appcorp/shadcn": "^1.1.92",
41
+ "@appcorp/shadcn": "^1.1.97",
42
42
  "@chromatic-com/storybook": "^5.1.2",
43
43
  "@commitlint/cli": "^20.5.0",
44
44
  "@commitlint/config-conventional": "^20.5.0",