@appcorp/fusion-storybook 0.1.8 → 0.1.10

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.
@@ -11,6 +11,22 @@
11
11
  */
12
12
  import { FC } from "react";
13
13
  import { USER_ROLE } from "../../type";
14
- export declare const AdmissionPage: FC<{
14
+ interface Props {
15
+ cancelLabel: string;
16
+ drawerTitle: string;
17
+ labelActions: string;
18
+ labelClass: string;
19
+ labelEnabled: string;
20
+ labelFirstName: string;
21
+ labelId: string;
22
+ labelLastName: string;
23
+ labelRegistrationCode: string;
24
+ labelStatus: string;
25
+ saveLabel: string;
26
+ searchPlaceholder: string;
27
+ tableDescription: string;
28
+ tableTitle: string;
15
29
  userRole: USER_ROLE;
16
- }>;
30
+ }
31
+ export declare const AdmissionPage: FC<Props>;
32
+ export {};
@@ -20,7 +20,6 @@ import { AdmissionForm } from "./form";
20
20
  import { AdmissionView } from "./view";
21
21
  import { resolveRbacPermissions } from "../../utils/resolve-rbac-permissions";
22
22
  import { RbacNoAccess } from "../../components/rbac-no-access";
23
- import { useTranslations } from "next-intl";
24
23
  import { AdmissionMoreActions } from "./more-actions";
25
24
  // ============================================================================
26
25
  // TABLE COLUMN CONFIGURATION (static — no runtime deps)
@@ -41,20 +40,6 @@ const tableBodyCols = [
41
40
  { componentType: COMPONENT_TYPE.BOOLEAN, key: "enabled" },
42
41
  { componentType: COMPONENT_TYPE.ACTIONS },
43
42
  ];
44
- const tableColumns = [
45
- { label: "id", width: "5%" },
46
- { label: "firstName", width: "15%" },
47
- { label: "lastName", width: "15%" },
48
- { label: "registrationCode", width: "20%" },
49
- { label: "class", width: "20%" },
50
- { label: "status", width: "10%" },
51
- { label: "enabled", width: "10%" },
52
- { label: "actions", width: "5%" },
53
- ];
54
- // ============================================================================
55
- // TRANSLATED COLUMNS HELPER
56
- // ============================================================================
57
- const getTranslatedColumns = (t) => tableColumns.map((col) => (Object.assign(Object.assign({}, col), { label: t(col.label) })));
58
43
  // ============================================================================
59
44
  // COMPONENT FACTORY (creates JSX elements when config is created, not during render)
60
45
  // ============================================================================
@@ -64,23 +49,29 @@ const createComponentInstances = () => ({
64
49
  moreActions: _jsx(AdmissionMoreActions, {}),
65
50
  view: _jsx(AdmissionView, {}),
66
51
  });
67
- // ============================================================================
68
- // CONFIG CREATION HELPER
69
- // ============================================================================
70
- const createAdmissionConfig = (t, drawer, dispatch) => {
52
+ const createAdmissionConfig = ({ cancelLabel, dispatch, drawer, drawerTitle, labelActions, labelClass, labelEnabled, labelFirstName, labelId, labelLastName, labelRegistrationCode, labelStatus, saveLabel, searchPlaceholder, tableDescription, tableTitle, }) => {
71
53
  const components = createComponentInstances();
72
54
  return {
73
55
  moduleName: "admission",
74
- tableColumns: getTranslatedColumns(t),
75
- cancelLabel: t("cancel"),
76
- drawerTitle: t("admission"),
56
+ tableColumns: [
57
+ { label: labelId, width: "5%" },
58
+ { label: labelFirstName, width: "15%" },
59
+ { label: labelLastName, width: "15%" },
60
+ { label: labelRegistrationCode, width: "20%" },
61
+ { label: labelClass, width: "20%" },
62
+ { label: labelStatus, width: "10%" },
63
+ { label: labelEnabled, width: "10%" },
64
+ { label: labelActions, width: "5%" },
65
+ ],
66
+ cancelLabel,
67
+ drawerTitle,
77
68
  filterContent: components.filter,
78
69
  formContent: components.form,
79
70
  moreActionsContent: components.moreActions,
80
- saveLabel: t("save"),
81
- searchPlaceholder: t("searchAdmissions"),
82
- tableDescription: t("manageAdmissionsInTheSystem"),
83
- tableTitle: t("admission"),
71
+ saveLabel,
72
+ searchPlaceholder,
73
+ tableDescription,
74
+ tableTitle,
84
75
  viewContent: components.view,
85
76
  size: drawer === ADMISSION_DRAWER.FORM_DRAWER ? "full" : "small",
86
77
  onClearFilters: () => {
@@ -92,37 +83,36 @@ const createAdmissionConfig = (t, drawer, dispatch) => {
92
83
  // STABLE PAGE COMPONENT (created once, outside render)
93
84
  // ============================================================================
94
85
  const GenericAdmissionPage = createGenericModulePage({
95
- moduleName: "admission",
96
- tableColumns: [],
97
86
  cancelLabel: "",
98
87
  drawerTitle: "",
99
88
  filterContent: _jsx(AdmissionFilter, {}),
100
89
  formContent: _jsx(AdmissionForm, {}),
90
+ moduleName: "admission",
101
91
  moreActionsContent: _jsx(AdmissionMoreActions, {}),
92
+ onClearFilters: () => { },
102
93
  saveLabel: "",
103
94
  searchPlaceholder: "",
95
+ size: "small",
96
+ tableColumns: [],
104
97
  tableDescription: "",
105
- tableTitle: "",
98
+ tableTitle: "ww",
106
99
  viewContent: _jsx(AdmissionView, {}),
107
- size: "small",
108
- onClearFilters: () => { },
109
100
  });
110
101
  // ============================================================================
111
102
  // INNER PAGE (requires AdmissionProvider context)
112
103
  // ============================================================================
113
- const AdmissionPageInner = ({ userRole }) => {
114
- const t = useTranslations("admission");
104
+ const AdmissionPageInner = (props) => {
115
105
  const context = useAdmissionModule();
106
+ // Memoize config creation
107
+ const admissionConfig = useMemo(() => createAdmissionConfig(Object.assign({ dispatch: context.dispatch, drawer: context.state.drawer }, props)), [context.dispatch, context.state.drawer, props]);
116
108
  // Memoize permission check to avoid recalculation on every render
117
109
  const hasPermission = useMemo(() => resolveRbacPermissions({
118
- userRole,
110
+ userRole: props.userRole,
119
111
  moduleName: "Admission",
120
- }), [userRole]);
121
- // Memoize config creation
122
- const admissionConfig = useMemo(() => createAdmissionConfig(t, context.state.drawer, context.dispatch), [t, context.state.drawer, context.dispatch]);
112
+ }), [props.userRole]);
123
113
  if (!hasPermission) {
124
114
  return _jsx(RbacNoAccess, { moduleName: "Admission" });
125
115
  }
126
- return (_jsx("div", { className: "p-4", children: _jsx(GenericAdmissionPage, { config: admissionConfig, context: context, tableBodyCols: tableBodyCols }) }));
116
+ return (_jsx("div", { className: "p-4", children: _jsx(GenericAdmissionPage, { overrideConfig: admissionConfig, config: admissionConfig, context: context, tableBodyCols: tableBodyCols }) }));
127
117
  };
128
- export const AdmissionPage = ({ userRole }) => (_jsx(AdmissionProvider, { children: _jsx(AdmissionPageInner, { userRole: userRole }) }));
118
+ export const AdmissionPage = (props) => (_jsx(AdmissionProvider, { children: _jsx(AdmissionPageInner, Object.assign({}, props)) }));
@@ -0,0 +1,2 @@
1
+ declare const _default: (params: import("next-intl/server").GetRequestConfigParams) => import("next-intl/server").RequestConfig | Promise<import("next-intl/server").RequestConfig>;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { getRequestConfig } from "next-intl/server";
2
+ export default getRequestConfig(async () => {
3
+ // Static for now, we'll change this later
4
+ const locale = "en";
5
+ return {
6
+ locale,
7
+ messages: (await import(`../../messages/${locale}.json`)).default,
8
+ };
9
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/fusion-storybook",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "scripts": {
5
5
  "build-storybook": "storybook build",
6
6
  "build:next": "next build",
@@ -45,19 +45,25 @@
45
45
  "@pdfme/generator": "^6.0.6",
46
46
  "@pdfme/schemas": "^6.0.6",
47
47
  "@playwright/test": "^1.59.1",
48
+ "@radix-ui/react-checkbox": "^1.3.3",
48
49
  "@radix-ui/react-dialog": "^1.1.15",
49
50
  "@radix-ui/react-dropdown-menu": "^2.1.16",
51
+ "@radix-ui/react-icons": "^1.3.2",
50
52
  "@radix-ui/react-label": "^2.1.8",
53
+ "@radix-ui/react-popover": "^1.1.15",
54
+ "@radix-ui/react-radio-group": "^1.3.8",
55
+ "@radix-ui/react-select": "^2.2.6",
51
56
  "@radix-ui/react-separator": "^1.1.8",
52
57
  "@radix-ui/react-slot": "^1.2.4",
53
58
  "@radix-ui/react-toast": "^1.2.15",
54
- "@react-pakistan/util-functions": "^1.25.63",
59
+ "@react-pakistan/util-functions": "^1.25.64",
55
60
  "@storybook/addon-a11y": "^10.3.4",
56
61
  "@storybook/addon-docs": "^10.3.4",
57
62
  "@storybook/addon-onboarding": "^10.3.4",
58
63
  "@storybook/addon-vitest": "^10.3.4",
59
64
  "@storybook/nextjs-vite": "^10.3.4",
60
65
  "@supabase/supabase-js": "^2.103.0",
66
+ "@tailwindcss/forms": "^0.5.11",
61
67
  "@tailwindcss/postcss": "^4",
62
68
  "@testing-library/jest-dom": "^6.9.1",
63
69
  "@testing-library/react": "^16.3.2",
@@ -70,6 +76,7 @@
70
76
  "@vitest/coverage-v8": "^4.1.2",
71
77
  "class-variance-authority": "^0.7.1",
72
78
  "clsx": "^2.1.1",
79
+ "cmdk": "^1.1.1",
73
80
  "eslint": "^9",
74
81
  "eslint-config-next": "16.2.2",
75
82
  "eslint-config-prettier": "^10.1.8",
@@ -77,22 +84,27 @@
77
84
  "husky": "^9.1.7",
78
85
  "jest": "^30.3.0",
79
86
  "jest-environment-jsdom": "^30.3.0",
87
+ "libphonenumber-js": "^1.12.41",
80
88
  "lint-staged": "^16.4.0",
81
89
  "lucide-react": "^1.8.0",
82
90
  "next": "^16.2.3",
83
91
  "next-intl": "^4.9.1",
92
+ "next-themes": "^0.4.6",
84
93
  "playwright": "^1.59.1",
85
94
  "prettier": "^3.8.1",
86
95
  "prettier-plugin-tailwindcss": "^0.7.2",
87
96
  "react": "^19.2.5",
88
97
  "react-dom": "^19.2.5",
89
98
  "rimraf": "^6.1.3",
99
+ "sonner": "^2.0.7",
90
100
  "storybook": "^10.3.4",
91
101
  "tailwind-merge": "^3.5.0",
92
102
  "tailwindcss": "^4",
93
103
  "ts-jest": "^29.4.9",
104
+ "tw-animate-css": "^1.4.0",
94
105
  "typescript": "^5",
95
106
  "uuid": "^13.0.0",
107
+ "vaul": "^1.1.2",
96
108
  "vite": "^8.0.5",
97
109
  "vitest": "^4.1.2"
98
110
  },