@pagamio/frontend-commons-lib 0.8.239 → 0.8.243
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/lib/api/ReactQuery.js +3 -1
- package/lib/api/context.d.ts +6 -0
- package/lib/api/context.js +9 -0
- package/lib/api/swr.d.ts +1 -1
- package/lib/auth/components/AuthFormUtils.d.ts +1 -1
- package/lib/auth/components/ChangePasswordPage.js +1 -1
- package/lib/auth/components/CustomerRegistrationPage.js +1 -1
- package/lib/auth/components/ForgotPasswordPage.js +1 -1
- package/lib/auth/components/LoginPage.js +1 -1
- package/lib/auth/components/ResetPasswordPage.js +1 -1
- package/lib/auth/shared/layout/AuthPageLayout.js +0 -1
- package/lib/components/layout/VerticalTabsLayout.js +0 -1
- package/lib/components/sidebar-v2/NavbarV2.js +1 -2
- package/lib/components/sidebar-v2/SidebarV2.js +1 -2
- package/lib/components/sidebar-v2/SidebarV2Context.js +1 -2
- package/lib/components/sidebar-v2/SidebarV2Primitives.js +1 -3
- package/lib/components/sidebar-v2/iconResolver.d.ts +38 -38
- package/lib/components/sidebar-v2/iconResolver.js +3 -2
- package/lib/components/ui/Calendar.js +1 -8
- package/lib/components/ui/Chart.js +12 -5
- package/lib/components/ui/DatePicker.d.ts +0 -1
- package/lib/components/ui/DatePicker.js +0 -1
- package/lib/components/ui/DateRangeModal.js +1 -1
- package/lib/components/ui/DateRangePickerWithPresets.js +1 -10
- package/lib/components/ui/DetailsCard.d.ts +1 -1
- package/lib/components/ui/FilterComponent.js +8 -4
- package/lib/components/ui/FilterList.js +0 -1
- package/lib/components/ui/FilterSection.js +0 -1
- package/lib/components/ui/FilterWrapper.d.ts +2 -1
- package/lib/components/ui/ImageUploader.d.ts +1 -0
- package/lib/components/ui/ImageUploader.js +3 -4
- package/lib/components/ui/MultiSelect.js +1 -1
- package/lib/components/ui/PageLoader.d.ts +23 -0
- package/lib/components/ui/PageLoader.js +18 -0
- package/lib/components/ui/Popover.js +3 -3
- package/lib/components/ui/Progress.js +1 -2
- package/lib/components/ui/Select.js +8 -7
- package/lib/components/ui/Switch.d.ts +2 -1
- package/lib/components/ui/TailwindIndicator.js +3 -1
- package/lib/components/ui/Tooltip.js +0 -1
- package/lib/components/ui/index.d.ts +1 -0
- package/lib/components/ui/index.js +1 -0
- package/lib/context/BreadcrumbContext.js +0 -1
- package/lib/dashboard-visuals/components/ChartWrapper.d.ts +1 -1
- package/lib/dashboard-visuals/components/DataTable.js +1 -1
- package/lib/dashboard-visuals/components/ErrorState.js +1 -1
- package/lib/dashboard-visuals/components/Switch.js +1 -1
- package/lib/dashboard-visuals/components/molecules/NoChartData.js +1 -1
- package/lib/dashboard-visuals/hooks/useChartData.js +23 -2
- package/lib/dashboard-visuals/hooks/useChartDataV2.js +4 -2
- package/lib/dashboard-visuals/v2/components/ApexChartWrapper.js +51 -8
- package/lib/dashboard-visuals/v2/components/DashboardWrapperV2.js +1 -1
- package/lib/dashboard-visuals/visuals/DistributionChart.d.ts +2 -1
- package/lib/form-engine/Form.js +9 -4
- package/lib/form-engine/FormEngine.d.ts +2 -1
- package/lib/form-engine/FormEngine.js +11 -0
- package/lib/form-engine/components/FieldWrapper.js +0 -1
- package/lib/form-engine/index.d.ts +1 -0
- package/lib/form-engine/index.js +1 -0
- package/lib/form-engine/registry/RegisterComponents.d.ts +5 -1
- package/lib/form-engine/registry/RegisterComponents.js +51 -17
- package/lib/form-engine/registry/Registry.d.ts +2 -0
- package/lib/form-engine/registry/Registry.js +8 -4
- package/lib/form-engine/types/index.d.ts +1 -1
- package/lib/pagamio-table/data-table/MantineCoreTable.js +8 -14
- package/lib/pagamio-table/data-table/Pagination.js +1 -1
- package/lib/pagamio-table/utils/functionHelper.d.ts +2 -1
- package/lib/pagamio-table/utils/functionHelper.js +5 -4
- package/lib/permissions/Can.d.ts +20 -0
- package/lib/permissions/Can.js +14 -0
- package/lib/permissions/PermissionProvider.d.ts +15 -0
- package/lib/permissions/PermissionProvider.js +23 -0
- package/lib/permissions/hooks.d.ts +20 -0
- package/lib/permissions/hooks.js +34 -0
- package/lib/permissions/index.d.ts +4 -0
- package/lib/permissions/index.js +3 -0
- package/lib/permissions/types.d.ts +19 -0
- package/lib/permissions/types.js +7 -0
- package/lib/shared/hooks/useContainerWidth.d.ts +1 -1
- package/lib/shared/hooks/useImageUpload.d.ts +1 -1
- package/lib/shared/hooks/useImageUpload.js +2 -2
- package/lib/styles.css +21 -21
- package/package.json +123 -57
package/lib/api/ReactQuery.js
CHANGED
|
@@ -43,7 +43,9 @@ const createDefaultQueryClient = () => new QueryClient({
|
|
|
43
43
|
*/
|
|
44
44
|
export function QueryClientProvider({ children, queryClient, showDevTools }) {
|
|
45
45
|
const [client] = useState(() => queryClient || createDefaultQueryClient());
|
|
46
|
-
|
|
46
|
+
// Use explicit prop; fall back to Vite's import.meta.env.DEV (works in both Vite & SSR).
|
|
47
|
+
// Avoids process.env.NODE_ENV which crashes in Vite browser bundles.
|
|
48
|
+
const shouldShowDevTools = showDevTools ?? import.meta?.env?.DEV === true;
|
|
47
49
|
return (_jsxs(TanStackQueryClientProvider, { client: client, children: [children, shouldShowDevTools && _jsx(ReactQueryDevtools, { initialIsOpen: false })] }));
|
|
48
50
|
}
|
|
49
51
|
/**
|
package/lib/api/context.d.ts
CHANGED
|
@@ -77,6 +77,12 @@ export declare function ApiProvider<T extends CustomAuthConfig>({ children, apiC
|
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
79
|
export declare function useApi<T extends CustomAuthConfig>(): ApiClient<T>;
|
|
80
|
+
/**
|
|
81
|
+
* Non-throwing variant of useApi.
|
|
82
|
+
* Returns the API client if inside an ApiProvider, or null otherwise.
|
|
83
|
+
* Useful for hooks/components that optionally use the API (e.g. static-mode charts).
|
|
84
|
+
*/
|
|
85
|
+
export declare function useApiSafe<T extends CustomAuthConfig>(): ApiClient<T>;
|
|
80
86
|
/**
|
|
81
87
|
* Factory function to create a configured ApiClient instance
|
|
82
88
|
*
|
package/lib/api/context.js
CHANGED
|
@@ -69,6 +69,15 @@ export function useApi() {
|
|
|
69
69
|
}
|
|
70
70
|
return context.apiClient;
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Non-throwing variant of useApi.
|
|
74
|
+
* Returns the API client if inside an ApiProvider, or null otherwise.
|
|
75
|
+
* Useful for hooks/components that optionally use the API (e.g. static-mode charts).
|
|
76
|
+
*/
|
|
77
|
+
export function useApiSafe() {
|
|
78
|
+
const context = useContext(ApiContext);
|
|
79
|
+
return context?.apiClient ?? null;
|
|
80
|
+
}
|
|
72
81
|
/**
|
|
73
82
|
* Factory function to create a configured ApiClient instance
|
|
74
83
|
*
|
package/lib/api/swr.d.ts
CHANGED
|
@@ -42,5 +42,5 @@ export declare function useApiSWRWithMutation<ResponseData>(endpoint: Key, confi
|
|
|
42
42
|
data: ResponseData | undefined;
|
|
43
43
|
error: ApiErrorResponse | undefined;
|
|
44
44
|
isValidating: boolean;
|
|
45
|
-
isLoading:
|
|
45
|
+
isLoading: import("swr/dist/_internal").IsLoadingResponse<Data, Config>;
|
|
46
46
|
};
|
|
@@ -43,7 +43,7 @@ export interface FormSubmissionConfig {
|
|
|
43
43
|
setIsLoading: React.Dispatch<React.SetStateAction<boolean>>;
|
|
44
44
|
setError?: React.Dispatch<React.SetStateAction<string | null>>;
|
|
45
45
|
addToast: (toast: PartialToastData) => void;
|
|
46
|
-
formRef: React.MutableRefObject<FormRef | undefined>;
|
|
46
|
+
formRef: React.MutableRefObject<FormRef | undefined> | React.RefObject<FormRef | null>;
|
|
47
47
|
onSuccess?: (response?: any) => void;
|
|
48
48
|
onError?: (error: Error) => void;
|
|
49
49
|
}
|
|
@@ -8,7 +8,7 @@ const ChangePasswordPage = ({ backHome = 'Back Home', submitButtonText = 'Change
|
|
|
8
8
|
const { addToast } = useToast();
|
|
9
9
|
const [isLoading, setIsLoading] = useState(false);
|
|
10
10
|
const [error, setError] = useState(null);
|
|
11
|
-
const formRef = useRef();
|
|
11
|
+
const formRef = useRef(null);
|
|
12
12
|
const changePasswordFields = [
|
|
13
13
|
{
|
|
14
14
|
name: 'oldPassword',
|
|
@@ -49,7 +49,7 @@ export function PagamioCustomerRegistrationPage({ logo, text = customerRegistrat
|
|
|
49
49
|
const { authService, error } = useAuth();
|
|
50
50
|
const { addToast } = useToast();
|
|
51
51
|
const [isLoading, setIsLoading] = useState(false);
|
|
52
|
-
const formRef = useRef();
|
|
52
|
+
const formRef = useRef(null);
|
|
53
53
|
const registrationFields = [
|
|
54
54
|
{
|
|
55
55
|
name: 'email',
|
|
@@ -45,7 +45,7 @@ export function PagamioForgotPasswordPage({ logo, text = forgotPasswordDefaultTe
|
|
|
45
45
|
const { addToast } = useToast();
|
|
46
46
|
const [isLoading, setIsLoading] = useState(false);
|
|
47
47
|
const [error, setError] = useState(null);
|
|
48
|
-
const formRef = useRef();
|
|
48
|
+
const formRef = useRef(null);
|
|
49
49
|
const emailField = [
|
|
50
50
|
{
|
|
51
51
|
name: 'email',
|
|
@@ -50,7 +50,7 @@ export function PagamioLoginPage({ logo, text = loginPageDefaultText, appLabel,
|
|
|
50
50
|
const { addToast } = useToast();
|
|
51
51
|
const [isLoading, setIsLoading] = useState(false);
|
|
52
52
|
const [error, setError] = useState(null);
|
|
53
|
-
const formRef = useRef();
|
|
53
|
+
const formRef = useRef(null);
|
|
54
54
|
// Generate the identifier field based on loginFieldType
|
|
55
55
|
const identifierField = loginFieldType === 'email'
|
|
56
56
|
? {
|
|
@@ -47,7 +47,7 @@ export function PagamioResetPasswordPage({ logo, text = resetPasswordDefaultText
|
|
|
47
47
|
const { addToast } = useToast();
|
|
48
48
|
const [isLoading, setIsLoading] = useState(false);
|
|
49
49
|
const [error, setError] = useState(null);
|
|
50
|
-
const formRef = useRef();
|
|
50
|
+
const formRef = useRef(null);
|
|
51
51
|
const resetPasswordFields = [
|
|
52
52
|
{
|
|
53
53
|
name: 'password',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
2
|
/**
|
|
2
3
|
* @fileoverview NavbarV2 - Fully customizable navbar for SidebarV2 system
|
|
3
4
|
*
|
|
@@ -23,8 +24,6 @@
|
|
|
23
24
|
* />
|
|
24
25
|
* ```
|
|
25
26
|
*/
|
|
26
|
-
'use client';
|
|
27
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
28
27
|
import { IconLock, IconLogout, IconMenu2, IconUser, IconX } from '@tabler/icons-react';
|
|
29
28
|
import { Avatar, DarkThemeToggle, Dropdown, Tooltip } from 'flowbite-react';
|
|
30
29
|
import React, { useCallback } from 'react';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
2
|
/**
|
|
2
3
|
* @fileoverview SidebarV2 - High-level composed sidebar component
|
|
3
4
|
*
|
|
@@ -8,8 +9,6 @@
|
|
|
8
9
|
* - Collapses to icons on desktop
|
|
9
10
|
* - Full mobile support with offcanvas
|
|
10
11
|
*/
|
|
11
|
-
'use client';
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
12
|
import { IconChevronDown, IconChevronRight } from '@tabler/icons-react';
|
|
14
13
|
import React, { useMemo, useState } from 'react';
|
|
15
14
|
import { cn } from '../../helpers/utils';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
/**
|
|
2
3
|
* @fileoverview SidebarV2 Context and Provider
|
|
3
4
|
*
|
|
@@ -9,8 +10,6 @@
|
|
|
9
10
|
* - Cookie persistence
|
|
10
11
|
* - Pathname for active state
|
|
11
12
|
*/
|
|
12
|
-
'use client';
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
13
|
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
15
14
|
import { TooltipProvider } from '../ui/Tooltip';
|
|
16
15
|
import { DEFAULT_SIDEBAR_CONFIG } from './types';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
/**
|
|
2
3
|
* @fileoverview SidebarV2 Primitives
|
|
3
4
|
*
|
|
4
5
|
* Core building blocks for the v2 sidebar following shadcn patterns.
|
|
5
6
|
* These are composable components that can be used to build custom sidebars.
|
|
6
7
|
*/
|
|
7
|
-
'use client';
|
|
8
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { IconLayoutSidebarLeftCollapse, IconLayoutSidebarLeftExpand, IconX } from '@tabler/icons-react';
|
|
10
9
|
import { forwardRef } from 'react';
|
|
11
10
|
import { cn } from '../../helpers/utils';
|
|
@@ -32,7 +31,6 @@ const SidebarContainer = forwardRef(({ className, side = 'left', variant = 'defa
|
|
|
32
31
|
height: 'calc(100vh - 4rem)', // Full height minus navbar (64px)
|
|
33
32
|
backgroundColor: 'var(--sidebar, hsl(0 0% 100%))',
|
|
34
33
|
color: 'var(--sidebar-foreground, hsl(240 10% 3.9%))',
|
|
35
|
-
borderColor: 'var(--sidebar-border, hsl(240 5.9% 90%))',
|
|
36
34
|
}, ...props, children: children }));
|
|
37
35
|
});
|
|
38
36
|
SidebarContainer.displayName = 'SidebarContainer';
|
|
@@ -27,43 +27,43 @@ export declare const resolveIcon: (icon: SidebarIcon | undefined, resolver?: Ico
|
|
|
27
27
|
* Commonly used icons for quick access
|
|
28
28
|
*/
|
|
29
29
|
export declare const SidebarIcons: {
|
|
30
|
-
readonly Dashboard: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
31
|
-
readonly Home: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
32
|
-
readonly Menu: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
33
|
-
readonly Settings: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
34
|
-
readonly Search: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
35
|
-
readonly Plus: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
36
|
-
readonly Edit: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
37
|
-
readonly Trash: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
38
|
-
readonly ShoppingCart: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
39
|
-
readonly Package: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
40
|
-
readonly CreditCard: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
41
|
-
readonly Receipt: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
42
|
-
readonly ChartBar: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
43
|
-
readonly ChartLine: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
44
|
-
readonly ChartPie: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
45
|
-
readonly TrendingUp: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
46
|
-
readonly Users: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
47
|
-
readonly User: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
48
|
-
readonly UserPlus: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
49
|
-
readonly File: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
50
|
-
readonly FileAnalytics: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
51
|
-
readonly Folder: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
52
|
-
readonly Bell: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
53
|
-
readonly Help: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
54
|
-
readonly Info: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
55
|
-
readonly Logout: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
56
|
-
readonly ChevronDown: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
57
|
-
readonly ChevronRight: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
58
|
-
readonly ChevronLeft: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
59
|
-
readonly ChevronUp: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
60
|
-
readonly MoreHorizontal: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
61
|
-
readonly ExternalLink: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
62
|
-
readonly Check: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
63
|
-
readonly X: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
64
|
-
readonly AlertCircle: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
65
|
-
readonly Clock: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
66
|
-
readonly PanelLeft: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
67
|
-
readonly PanelLeftClose: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<
|
|
30
|
+
readonly Dashboard: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
31
|
+
readonly Home: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
32
|
+
readonly Menu: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
33
|
+
readonly Settings: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
34
|
+
readonly Search: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
35
|
+
readonly Plus: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
36
|
+
readonly Edit: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
37
|
+
readonly Trash: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
38
|
+
readonly ShoppingCart: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
39
|
+
readonly Package: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
40
|
+
readonly CreditCard: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
41
|
+
readonly Receipt: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
42
|
+
readonly ChartBar: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
43
|
+
readonly ChartLine: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
44
|
+
readonly ChartPie: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
45
|
+
readonly TrendingUp: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
46
|
+
readonly Users: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
47
|
+
readonly User: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
48
|
+
readonly UserPlus: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
49
|
+
readonly File: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
50
|
+
readonly FileAnalytics: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
51
|
+
readonly Folder: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
52
|
+
readonly Bell: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
53
|
+
readonly Help: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
54
|
+
readonly Info: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
55
|
+
readonly Logout: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
56
|
+
readonly ChevronDown: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
57
|
+
readonly ChevronRight: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
58
|
+
readonly ChevronLeft: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
59
|
+
readonly ChevronUp: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
60
|
+
readonly MoreHorizontal: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
61
|
+
readonly ExternalLink: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
62
|
+
readonly Check: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
63
|
+
readonly X: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
64
|
+
readonly AlertCircle: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
65
|
+
readonly Clock: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
66
|
+
readonly PanelLeft: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
67
|
+
readonly PanelLeftClose: import("react").ForwardRefExoticComponent<TablerIcons.IconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
68
68
|
};
|
|
69
69
|
export type SidebarIconName = keyof typeof SidebarIcons;
|
|
@@ -56,8 +56,9 @@ export const resolveIcon = (icon, resolver = defaultIconResolver, fallbackIcon)
|
|
|
56
56
|
const resolved = resolver(icon);
|
|
57
57
|
if (resolved)
|
|
58
58
|
return resolved;
|
|
59
|
-
// Log warning in development
|
|
60
|
-
|
|
59
|
+
// Log warning in development (Vite-compatible env check)
|
|
60
|
+
const isDev = import.meta?.env?.DEV === true;
|
|
61
|
+
if (isDev) {
|
|
61
62
|
console.warn(`[SidebarV2] Icon "${icon}" not found in Tabler icons`);
|
|
62
63
|
}
|
|
63
64
|
// Return fallback if provided, otherwise use a default circle icon
|
|
@@ -3,14 +3,7 @@ import { DayPicker } from 'react-day-picker';
|
|
|
3
3
|
import { cn } from '../../helpers';
|
|
4
4
|
import { variantStyles } from '../ui';
|
|
5
5
|
const Calendar = ({ className, classNames, showOutsideDays = true, ...props }) => {
|
|
6
|
-
return (_jsx("div", { style: {
|
|
7
|
-
// Provide fallback CSS variables for colors
|
|
8
|
-
['--primary']: 'var(--primary, hsl(305 38% 54%))',
|
|
9
|
-
['--primary-foreground']: 'var(--primary-foreground, hsl(0 0% 100%))',
|
|
10
|
-
['--accent']: 'var(--accent, hsl(305 38% 94%))',
|
|
11
|
-
['--accent-foreground']: 'var(--accent-foreground, hsl(305 38% 20%))',
|
|
12
|
-
['--muted-foreground']: 'var(--muted-foreground, hsl(0 0% 45%))',
|
|
13
|
-
}, children: _jsx(DayPicker, { showOutsideDays: showOutsideDays, className: cn('p-3', className), classNames: {
|
|
6
|
+
return (_jsx("div", { style: {}, children: _jsx(DayPicker, { showOutsideDays: showOutsideDays, className: cn('p-3', className), classNames: {
|
|
14
7
|
months: 'flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0',
|
|
15
8
|
month: 'space-y-4',
|
|
16
9
|
caption: 'flex justify-center pt-1 relative items-center',
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import ReactApexChart from 'react-apexcharts';
|
|
3
2
|
import { useEffect, useState } from 'react';
|
|
4
3
|
import { Loader } from '../ui';
|
|
5
4
|
// TODO: Define proper props type
|
|
6
5
|
const Chart = (props) => {
|
|
7
|
-
const [
|
|
6
|
+
const [ApexChart, setApexChart] = useState(null);
|
|
8
7
|
useEffect(() => {
|
|
9
|
-
|
|
8
|
+
let cancelled = false;
|
|
9
|
+
import('react-apexcharts').then((mod) => {
|
|
10
|
+
if (!cancelled) {
|
|
11
|
+
setApexChart(() => mod.default);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return () => {
|
|
15
|
+
cancelled = true;
|
|
16
|
+
};
|
|
10
17
|
}, []);
|
|
11
|
-
if (!
|
|
18
|
+
if (!ApexChart) {
|
|
12
19
|
return _jsx(Loader, { colorClassName: "primary-500" });
|
|
13
20
|
}
|
|
14
|
-
return _jsx(
|
|
21
|
+
return _jsx(ApexChart, { ...props, width: "100%" });
|
|
15
22
|
};
|
|
16
23
|
export default Chart;
|
|
@@ -84,6 +84,6 @@ const CustomDateRangeModal = ({ isOpen, showTimeSelect, onClose, onApply, initia
|
|
|
84
84
|
setEndDate(newDate);
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
return (_jsxs(Modal, { show: isOpen, size: "xl", popup: true, onClose: onClose, dismissible: true, children: [_jsx(Modal.Header, { className: "border-b border-gray-200", children: _jsx("h3", { className: "px-4 text-lg font-bold text-gray-900", children: "Select Custom Date Range" }) }), _jsx(Modal.Body, { className: "p-6", children: _jsxs("div", { className: "flex flex-col space-y-4", children: [_jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col", children: [_jsx("label", { htmlFor: "startDate", className: "mb-2 text-sm font-medium text-gray-700", children: "Start Date" }), _jsx(DatePicker, { selected: startDate, onChange: handleStartDateChange, selectsStart: true, startDate: startDate, endDate: endDate, showTimeSelect: showTimeSelect, timeIntervals: timeIntervals, dateFormat: datePickerFormat, placeholderText: "Select start date", className: `w-full rounded-md border ${!isValidRange ? 'border-red-500' : 'border-gray-300'} px-3 py-2 shadow-sm focus:ring-2 focus:ring-
|
|
87
|
+
return (_jsxs(Modal, { show: isOpen, size: "xl", popup: true, onClose: onClose, dismissible: true, children: [_jsx(Modal.Header, { className: "border-b border-gray-200", children: _jsx("h3", { className: "px-4 text-lg font-bold text-gray-900", children: "Select Custom Date Range" }) }), _jsx(Modal.Body, { className: "p-6", children: _jsxs("div", { className: "flex flex-col space-y-4", children: [_jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col", children: [_jsx("label", { htmlFor: "startDate", className: "mb-2 text-sm font-medium text-gray-700", children: "Start Date" }), _jsx(DatePicker, { selected: startDate, onChange: handleStartDateChange, selectsStart: true, startDate: startDate, endDate: endDate, showTimeSelect: showTimeSelect, timeIntervals: timeIntervals, dateFormat: datePickerFormat, placeholderText: "Select start date", className: `w-full rounded-md border ${!isValidRange ? 'border-red-500' : 'border-gray-300'} px-3 py-2 shadow-sm focus:ring-2 focus:ring-primary focus:border-primary`, minDate: minDate, maxDate: maxDate })] }), _jsxs("div", { className: "flex flex-col", children: [_jsx("label", { htmlFor: "endDate", className: "mb-2 text-sm font-medium text-gray-700", children: "End Date" }), _jsx(DatePicker, { selected: endDate, onChange: handleEndDateChange, selectsEnd: true, startDate: startDate, endDate: endDate, minDate: startDate, maxDate: maxDate, showTimeSelect: showTimeSelect, timeIntervals: timeIntervals, dateFormat: datePickerFormat, placeholderText: "Select end date", className: `w-full rounded-md border ${!isValidRange ? 'border-red-500' : 'border-gray-300'} px-3 py-2 shadow-sm focus:ring-2 focus:ring-primary focus:border-primary` })] })] }), !isValidRange && _jsx("p", { className: "text-sm text-red-600 mt-2", children: "End date must be on or after start date." })] }) }), _jsxs(Modal.Footer, { className: "flex justify-end space-x-3 border-t border-gray-200 px-6 py-4", children: [_jsx(Button, { variant: "outline", onClick: onClose, className: "px-4 py-2", children: "Cancel" }), _jsx(Button, { variant: "primary", onClick: handleApply, disabled: !isValidRange, className: "px-4 py-2 disabled:opacity-50 disabled:cursor-not-allowed", children: "Apply" })] })] }));
|
|
88
88
|
};
|
|
89
89
|
export default CustomDateRangeModal;
|
|
@@ -149,16 +149,7 @@ const DateRangePickerWithPresets = ({ value, onChange, presets = defaultDatePres
|
|
|
149
149
|
e.stopPropagation();
|
|
150
150
|
onChange?.(undefined, undefined);
|
|
151
151
|
};
|
|
152
|
-
return (_jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", disabled: disabled, className: cn('w-auto justify-start text-left font-normal', !value && 'text-muted-foreground', className), children: [_jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }), _jsx("span", { children: displayText }), showClearButton && value?.from && (_jsx(X, { className: "ml-2 h-4 w-4 opacity-50 hover:opacity-100 cursor-pointer", onClick: handleClear }))] }) }), _jsx(PopoverContent, { className: "w-auto p-0 bg-background border border-border shadow-lg", align: "start", sideOffset: 8, children: _jsxs("div", { className: "flex",
|
|
153
|
-
// Provide fallback CSS variables for colors
|
|
154
|
-
['--primary']: 'var(--primary, hsl(305 38% 54%))',
|
|
155
|
-
['--primary-foreground']: 'var(--primary-foreground, hsl(0 0% 100%))',
|
|
156
|
-
['--accent']: 'var(--accent, hsl(305 38% 94%))',
|
|
157
|
-
['--accent-foreground']: 'var(--accent-foreground, hsl(305 38% 20%))',
|
|
158
|
-
['--background']: 'var(--background, hsl(0 0% 100%))',
|
|
159
|
-
['--border']: 'var(--border, hsl(0 0% 90%))',
|
|
160
|
-
['--muted-foreground']: 'var(--muted-foreground, hsl(0 0% 45%))',
|
|
161
|
-
}, children: [_jsx("div", { className: "border-r border-border p-2 min-w-[140px] bg-background", children: _jsx("div", { className: "flex flex-col gap-1", children: presets.map((preset) => (_jsx("button", { type: "button", onClick: () => handlePresetSelect(preset), className: cn('text-left px-3 py-2 text-sm rounded-md transition-colors', 'hover:bg-accent hover:text-accent-foreground', tempPreset === preset.value &&
|
|
152
|
+
return (_jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", disabled: disabled, className: cn('w-auto justify-start text-left font-normal', !value && 'text-muted-foreground', className), children: [_jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }), _jsx("span", { children: displayText }), showClearButton && value?.from && (_jsx(X, { className: "ml-2 h-4 w-4 opacity-50 hover:opacity-100 cursor-pointer", onClick: handleClear }))] }) }), _jsx(PopoverContent, { className: "w-auto p-0 bg-background border border-border shadow-lg", align: "start", sideOffset: 8, children: _jsxs("div", { className: "flex", children: [_jsx("div", { className: "border-r border-border p-2 min-w-[140px] bg-background", children: _jsx("div", { className: "flex flex-col gap-1", children: presets.map((preset) => (_jsx("button", { type: "button", onClick: () => handlePresetSelect(preset), className: cn('text-left px-3 py-2 text-sm rounded-md transition-colors', 'hover:bg-accent hover:text-accent-foreground', tempPreset === preset.value &&
|
|
162
153
|
'bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground'), children: preset.label }, preset.value))) }) }), tempPreset === 'custom' && (_jsxs("div", { className: "p-3 bg-background", children: [_jsx(Calendar, { mode: "range", defaultMonth: tempRange?.from || new Date(), selected: tempRange, onSelect: handleCalendarSelect, numberOfMonths: numberOfMonths, disabled: (date) => {
|
|
163
154
|
if (minDate && date < minDate)
|
|
164
155
|
return true;
|
|
@@ -12,5 +12,5 @@ interface DetailsCardProps {
|
|
|
12
12
|
onClickButton: () => void;
|
|
13
13
|
actionContent?: React.ReactNode;
|
|
14
14
|
}
|
|
15
|
-
declare const DetailsCard: ({ data, loading, buttonText, showButton, onClickButton, actionContent, }: DetailsCardProps) => JSX.Element | null;
|
|
15
|
+
declare const DetailsCard: ({ data, loading, buttonText, showButton, onClickButton, actionContent, }: DetailsCardProps) => React.JSX.Element | null;
|
|
16
16
|
export default DetailsCard;
|
|
@@ -69,7 +69,7 @@ const FilterComponent = ({ filters, selectedFilters, showApplyFilterButton = tru
|
|
|
69
69
|
resetFilters();
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
return (_jsxs(FilterWrapper, { isNarrow: isNarrow, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [showSearch && (_jsx("div", { className: "w-full sm:w-[300px]", children: _jsx(Input, {
|
|
72
|
+
return (_jsxs(FilterWrapper, { isNarrow: isNarrow, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [showSearch && (_jsx("div", { className: "w-full sm:w-[300px]", children: _jsx(Input, { leftSection: _jsx(IconSearch, { size: 16 }), placeholder: searctInputPlaceHolder, value: searchQuery, onChange: (event) => onSearch(event), onKeyDown: handleSearchKeyDown, className: "w-full", styles: { input: { height: 39 } }, "aria-label": "Search" }) })), filters.map((filter) => {
|
|
73
73
|
const { name, type, options } = filter;
|
|
74
74
|
const value = selectedFilters[name];
|
|
75
75
|
const renderFilterInput = () => {
|
|
@@ -106,9 +106,13 @@ const FilterComponent = ({ filters, selectedFilters, showApplyFilterButton = tru
|
|
|
106
106
|
return (_jsx(DatePicker, { value: value || null, onChange: (date) => handleFilterChange(name, date), placeholder: filter.placeholder ?? `Select ${name}` }));
|
|
107
107
|
}
|
|
108
108
|
if (type === 'multi-select') {
|
|
109
|
-
return (_jsx(MultiSelect, { data: options || [], placeholder: filter.placeholder ?? `Select ${name}`, value: value || [], onChange: (val) => handleFilterChange(name, val), searchable: true, clearable: true, className: "w-full", styles: {
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
return (_jsx(MultiSelect, { data: options || [], placeholder: filter.placeholder ?? `Select ${name}`, value: value || [], onChange: (val) => handleFilterChange(name, val), searchable: true, clearable: true, className: "w-full", styles: {
|
|
110
|
+
...sharedStyles,
|
|
111
|
+
input: {
|
|
112
|
+
...sharedStyles.input,
|
|
113
|
+
'&[type="search"]': {
|
|
114
|
+
fontSize: '0.9rem',
|
|
115
|
+
},
|
|
112
116
|
},
|
|
113
117
|
}, ...commonProps, onKeyDown: (e) => handleFilterKeyDown(e, name), "aria-label": filter.placeholder ?? name }));
|
|
114
118
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
interface FilterWrapperProps {
|
|
2
3
|
isNarrow: boolean;
|
|
3
4
|
children: React.ReactNode;
|
|
4
5
|
}
|
|
5
|
-
declare const FilterWrapper: ({ isNarrow, children }: FilterWrapperProps) => JSX.Element;
|
|
6
|
+
declare const FilterWrapper: ({ isNarrow, children }: FilterWrapperProps) => React.JSX.Element;
|
|
6
7
|
export default FilterWrapper;
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
export interface ImageUploaderProps {
|
|
3
3
|
project: 'vas' | 'stocklink' | 'events' | 'commerce';
|
|
4
4
|
env: 'dev' | 'uat' | 'prod';
|
|
5
|
+
endpoint: string;
|
|
5
6
|
onUploadSuccess?: (url: string) => void;
|
|
6
7
|
onError?: (error: Error) => void;
|
|
7
8
|
className?: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { Image as ImageIcon, Loader2, Upload, X } from 'lucide-react';
|
|
4
3
|
import { useDropzone } from 'react-dropzone';
|
|
@@ -6,14 +5,14 @@ import { useCallback, useState } from 'react';
|
|
|
6
5
|
import { Button, cn, useToast } from '../..';
|
|
7
6
|
import { useImageUpload } from '../../shared/hooks/useImageUpload';
|
|
8
7
|
import { Progress } from './Progress';
|
|
9
|
-
const ImageUploader = ({ project, env, onUploadSuccess, onError, className, disabled = false, maxFileSize = 5 * 1024 * 1024, // 5MB default
|
|
8
|
+
const ImageUploader = ({ project, env, endpoint, onUploadSuccess, onError, className, disabled = false, maxFileSize = 5 * 1024 * 1024, // 5MB default
|
|
10
9
|
acceptedFileTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'], placeholder = 'Click to upload or drag and drop an image', showPreview = true, value, onChange, }) => {
|
|
11
10
|
const [previewUrl, setPreviewUrl] = useState(value || null);
|
|
12
11
|
const [isUploading, setIsUploading] = useState(false);
|
|
13
12
|
const [uploadProgress, setUploadProgress] = useState(0);
|
|
14
13
|
const [error, setError] = useState(null);
|
|
15
14
|
const { addToast } = useToast();
|
|
16
|
-
const { uploadFile } = useImageUpload({ project, env });
|
|
15
|
+
const { uploadFile } = useImageUpload({ project, env, endpoint });
|
|
17
16
|
const handleFileUpload = async (file) => {
|
|
18
17
|
if (disabled)
|
|
19
18
|
return;
|
|
@@ -92,6 +91,6 @@ acceptedFileTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'], plac
|
|
|
92
91
|
setError(null);
|
|
93
92
|
onChange?.(null);
|
|
94
93
|
};
|
|
95
|
-
return (_jsxs("div", { className: cn('w-full', className), children: [previewUrl && showPreview ? (_jsxs("div", { className: "relative mb-4", children: [_jsx("img", { src: previewUrl, alt: "Preview", className: "max-h-64 w-full rounded-lg object-contain border border-gray-200" }), !isUploading && (_jsx(Button, { type: "button", variant: "destructive", size: "sm", className: "absolute top-2 right-2", onClick: handleRemove, children: _jsx(X, { className: "h-4 w-4" }) }))] })) : (_jsxs("div", { ...getRootProps(), className: cn('border-2 border-dashed border-gray-300 rounded-lg p-8 text-center cursor-pointer transition-colors hover:border-gray-400', isDragActive && 'border-
|
|
94
|
+
return (_jsxs("div", { className: cn('w-full', className), children: [previewUrl && showPreview ? (_jsxs("div", { className: "relative mb-4", children: [_jsx("img", { src: previewUrl, alt: "Preview", className: "max-h-64 w-full rounded-lg object-contain border border-gray-200" }), !isUploading && (_jsx(Button, { type: "button", variant: "destructive", size: "sm", className: "absolute top-2 right-2", onClick: handleRemove, children: _jsx(X, { className: "h-4 w-4" }) }))] })) : (_jsxs("div", { ...getRootProps(), className: cn('border-2 border-dashed border-gray-300 rounded-lg p-8 text-center cursor-pointer transition-colors hover:border-gray-400', isDragActive && 'border-primary bg-primary/10', disabled && 'cursor-not-allowed opacity-50', error && 'border-red-500 bg-red-50'), children: [_jsx("input", { ...getInputProps() }), isUploading ? (_jsxs("div", { className: "flex flex-col items-center space-y-2", children: [_jsx(Loader2, { className: "h-8 w-8 animate-spin text-primary" }), _jsx("p", { className: "text-sm text-gray-600", children: "Uploading image..." }), _jsx(Progress, { value: uploadProgress, className: "w-full max-w-xs" })] })) : (_jsxs("div", { className: "flex flex-col items-center space-y-2", children: [isDragActive ? (_jsx(Upload, { className: "h-8 w-8 text-primary" })) : (_jsx(ImageIcon, { className: "h-8 w-8 text-gray-400" })), _jsx("p", { className: "text-sm text-gray-600", children: isDragActive ? 'Drop the image here' : placeholder }), _jsxs("p", { className: "text-xs text-gray-500", children: ["Supported formats: ", acceptedFileTypes.map((type) => type.split('/')[1]).join(', ')] }), _jsxs("p", { className: "text-xs text-gray-500", children: ["Max size: ", Math.round(maxFileSize / 1024 / 1024), "MB"] })] }))] })), error && _jsx("p", { className: "mt-2 text-sm text-red-600", children: error })] }));
|
|
96
95
|
};
|
|
97
96
|
export default ImageUploader;
|
|
@@ -48,7 +48,7 @@ const MultiSelect = forwardRef(({ options, value, defaultValue = [], disabled, o
|
|
|
48
48
|
}
|
|
49
49
|
}, children: [_jsxs("div", { id: field?.name, className: "flex items-center w-full px-4 py-2 border rounded-md", style: { minHeight: '41px' }, children: [_jsx("div", { className: "flex-1 text-left", children: tagPosition === 'inside' ? (_jsx(TagsList, { selectedOptions: selectedOptions, removeTag: removeTag, placeholder: field?.placeholder })) : (_jsx("span", { className: "truncate", children: selectedOptions.length === 0
|
|
50
50
|
? (field?.placeholder ?? placeholder ?? 'Select options')
|
|
51
|
-
: `${selectedOptions.length} selected` })) }), _jsx(ChevronDownIcon, { className: "ml-2 flex-shrink-0" })] }), tagPosition === 'bottom' && selectedOptions.length > 0 && (_jsx("div", { className: "mt-2", children: _jsx(TagsList, { selectedOptions: selectedOptions, removeTag: removeTag, placeholder: field?.placeholder }) }))] }) }), _jsxs(Popover.Content, { className: "p-2 bg-white border rounded shadow-md w-full z-50", align: "start", sideOffset: 5, onOpenAutoFocus: (e) => e.preventDefault(), children: [_jsx("input", { type: "text", placeholder: "Search...", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), className: "w-full px-2 py-1 mb-2 border rounded", onClick: (e) => e.stopPropagation() }), _jsx("div", { className: "max-h-60 overflow-auto", children: filteredOptions.length > 0 ? (filteredOptions.map((option) => (_jsxs("div", { className: "flex items-center gap-2 px-2 py-1 cursor-pointer hover:bg-gray-100", children: [_jsx(Checkbox.Root, { type: "button", checked: internalValues.includes(option.value), onCheckedChange: () => handleToggle(option.value), className: "w-4 h-4 border rounded", children: _jsx(Checkbox.Indicator, { children: _jsx(CheckIcon, { className: "w-4 h-4 text-
|
|
51
|
+
: `${selectedOptions.length} selected` })) }), _jsx(ChevronDownIcon, { className: "ml-2 flex-shrink-0" })] }), tagPosition === 'bottom' && selectedOptions.length > 0 && (_jsx("div", { className: "mt-2", children: _jsx(TagsList, { selectedOptions: selectedOptions, removeTag: removeTag, placeholder: field?.placeholder }) }))] }) }), _jsxs(Popover.Content, { className: "p-2 bg-white border rounded shadow-md w-full z-50", align: "start", sideOffset: 5, onOpenAutoFocus: (e) => e.preventDefault(), children: [_jsx("input", { type: "text", placeholder: "Search...", value: searchTerm, onChange: (e) => setSearchTerm(e.target.value), className: "w-full px-2 py-1 mb-2 border rounded", onClick: (e) => e.stopPropagation() }), _jsx("div", { className: "max-h-60 overflow-auto", children: filteredOptions.length > 0 ? (filteredOptions.map((option) => (_jsxs("div", { className: "flex items-center gap-2 px-2 py-1 cursor-pointer hover:bg-gray-100", children: [_jsx(Checkbox.Root, { type: "button", checked: internalValues.includes(option.value), onCheckedChange: () => handleToggle(option.value), className: "w-4 h-4 border rounded", children: _jsx(Checkbox.Indicator, { children: _jsx(CheckIcon, { className: "w-4 h-4 text-primary" }) }) }), _jsx("button", { type: "button", onClick: () => handleToggle(option.value), onKeyDown: (e) => {
|
|
52
52
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
53
53
|
e.preventDefault();
|
|
54
54
|
handleToggle(option.value);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type LoaderProps } from './Loader';
|
|
3
|
+
export interface PageLoaderProps {
|
|
4
|
+
/** Size of the loader spinner. Defaults to 'xl'. */
|
|
5
|
+
size?: LoaderProps['size'];
|
|
6
|
+
/** Additional CSS class names for the wrapper div. */
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Full-page centered loader for page-level loading states.
|
|
11
|
+
* Accounts for navbar height (64px ≈ 5rem) so the spinner
|
|
12
|
+
* appears centered in the visible content area.
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```tsx
|
|
16
|
+
* import { PageLoader } from '@pagamio/frontend-commons-lib';
|
|
17
|
+
*
|
|
18
|
+
* if (isLoading) return <PageLoader />;
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare const PageLoader: React.FC<PageLoaderProps>;
|
|
22
|
+
export default PageLoader;
|
|
23
|
+
export { PageLoader };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../helpers';
|
|
3
|
+
import LoaderComponent from './Loader';
|
|
4
|
+
/**
|
|
5
|
+
* Full-page centered loader for page-level loading states.
|
|
6
|
+
* Accounts for navbar height (64px ≈ 5rem) so the spinner
|
|
7
|
+
* appears centered in the visible content area.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { PageLoader } from '@pagamio/frontend-commons-lib';
|
|
12
|
+
*
|
|
13
|
+
* if (isLoading) return <PageLoader />;
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
const PageLoader = ({ size = 'xl', className }) => (_jsx("div", { className: cn('flex min-h-[calc(100vh-5rem)] w-full items-center justify-center', className), children: _jsx(LoaderComponent, { size: size }) }));
|
|
17
|
+
export default PageLoader;
|
|
18
|
+
export { PageLoader };
|
|
@@ -6,9 +6,9 @@ const Popover = PopoverPrimitive.Root;
|
|
|
6
6
|
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
7
7
|
const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
8
8
|
const PopoverContent = React.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (_jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { ref: ref, align: align, sideOffset: sideOffset, className: cn('z-[70] w-72 rounded-md border p-4 shadow-md outline-none', 'data-[state=open]:animate-in data-[state=closed]:animate-out', 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0', 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95', 'data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2', 'data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', className), style: {
|
|
9
|
-
backgroundColor: 'var(--popover,
|
|
10
|
-
color: 'var(--popover-foreground,
|
|
11
|
-
borderColor: 'var(--border,
|
|
9
|
+
backgroundColor: 'hsl(var(--popover, 0 0% 100%))',
|
|
10
|
+
color: 'hsl(var(--popover-foreground, 240 10% 3.9%))',
|
|
11
|
+
borderColor: 'hsl(var(--border, 240 5.9% 90%))',
|
|
12
12
|
}, ...props }) })));
|
|
13
13
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
14
14
|
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import { cn } from '../../helpers';
|
|
5
|
-
const Progress = React.forwardRef(({ className, value = 0, max = 100, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('relative h-2 w-full overflow-hidden rounded-full bg-gray-200', className), ...props, children: _jsx("div", { className: "h-full w-full flex-1 bg-
|
|
4
|
+
const Progress = React.forwardRef(({ className, value = 0, max = 100, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('relative h-2 w-full overflow-hidden rounded-full bg-gray-200', className), ...props, children: _jsx("div", { className: "h-full w-full flex-1 bg-primary transition-all duration-300 ease-in-out", style: { transform: `translateX(-${100 - (value / max) * 100}%)` } }) })));
|
|
6
5
|
Progress.displayName = 'Progress';
|
|
7
6
|
export { Progress };
|