@mnbsolutions/framework-frontend 0.0.0-stage → 4.0.1
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/LICENSE +202 -0
- package/README.md +88 -2
- package/dist/esm/types/MuiClassNameSetup.d.ts +1 -0
- package/dist/esm/types/components/AdminLoginForm/AdminLoginForm.d.ts +89 -0
- package/dist/esm/types/components/AdminLoginForm/AdminLoginForm.stories.d.ts +11 -0
- package/dist/esm/types/components/AdminLoginForm/index.d.ts +3 -0
- package/dist/esm/types/components/Autocomplete/Autocomplete.d.ts +8 -0
- package/dist/esm/types/components/Autocomplete/Autocomplete.stories.d.ts +17 -0
- package/dist/esm/types/components/Autocomplete/AutocompleteOld.d.ts +7 -0
- package/dist/esm/types/components/Button/Button.d.ts +10 -0
- package/dist/esm/types/components/Button/Button.stories.d.ts +10 -0
- package/dist/esm/types/components/Captcha/CaptchaAccessibilityTest.d.ts +1 -0
- package/dist/esm/types/components/Captcha/CaptchaClientTest.d.ts +1 -0
- package/dist/esm/types/components/Captcha/CaptchaDebugTest.d.ts +1 -0
- package/dist/esm/types/components/Captcha/CaptchaDebugger.d.ts +1 -0
- package/dist/esm/types/components/Captcha/CaptchaExample.d.ts +1 -0
- package/dist/esm/types/components/Captcha/CaptchaStatusDebugger.d.ts +1 -0
- package/dist/esm/types/components/Captcha/CaptchaTest.d.ts +1 -0
- package/dist/esm/types/components/Captcha/CaptchaTroubleshoot.d.ts +2 -0
- package/dist/esm/types/components/Captcha/CaptchaWidget.d.ts +27 -0
- package/dist/esm/types/components/Captcha/CaptchaWidget.stories.d.ts +31 -0
- package/dist/esm/types/components/Captcha/CaptchaWidgetTest.d.ts +4 -0
- package/dist/esm/types/components/Captcha/ComprehensiveTest.d.ts +1 -0
- package/dist/esm/types/components/Captcha/FinalValidationTest.d.ts +1 -0
- package/dist/esm/types/components/Captcha/SimpleValidationTest.d.ts +1 -0
- package/dist/esm/types/components/Captcha/SubmitOnlyValidationTest.d.ts +1 -0
- package/dist/esm/types/components/Captcha/ValidationTest.d.ts +1 -0
- package/dist/esm/types/components/Captcha/hooks/useCaptchaForm.d.ts +14 -0
- package/dist/esm/types/components/Captcha/hooks/useCaptchaToken.d.ts +9 -0
- package/dist/esm/types/components/Captcha/hooks/useCaptchaValidation.d.ts +11 -0
- package/dist/esm/types/components/Captcha/types/captcha.d.ts +52 -0
- package/dist/esm/types/components/Checkbox/Checkbox.d.ts +18 -0
- package/dist/esm/types/components/Checkbox/Checkbox.stories.d.ts +12 -0
- package/dist/esm/types/components/ConfigContext/ConfigContext.d.ts +10 -0
- package/dist/esm/types/components/ConfigContext/ConfigContext.types.d.ts +8 -0
- package/dist/esm/types/components/ConfigContext/index.d.ts +2 -0
- package/dist/esm/types/components/ContactLink/ContactLink.d.ts +7 -0
- package/dist/esm/types/components/ContactLink/ContactLink.stories.d.ts +7 -0
- package/dist/esm/types/components/ContactLink/index.d.ts +2 -0
- package/dist/esm/types/components/DataTable/DataTable.d.ts +14 -0
- package/dist/esm/types/components/DataTable/DataTable.stories.d.ts +16 -0
- package/dist/esm/types/components/DataTable/index.d.ts +3 -0
- package/dist/esm/types/components/DataTable/locales/deDE.d.ts +6 -0
- package/dist/esm/types/components/DataTable/locales/index.d.ts +7 -0
- package/dist/esm/types/components/DataTable/types.d.ts +127 -0
- package/dist/esm/types/components/DatePicker/DatePicker.d.ts +12 -0
- package/dist/esm/types/components/DatePicker/DatePicker.stories.d.ts +15 -0
- package/dist/esm/types/components/Dropdown/Dropdown.d.ts +14 -0
- package/dist/esm/types/components/Experimental/UrlField/UrlField.d.ts +34 -0
- package/dist/esm/types/components/Experimental/UrlField/UrlField.stories.d.ts +6 -0
- package/dist/esm/types/components/Experimental/UrlField/index.d.ts +3 -0
- package/dist/esm/types/components/Fields/makeCustomAddressAutocompleteRHF.d.ts +40 -0
- package/dist/esm/types/components/Fields/makeCustomAutocompleteRHF.d.ts +40 -0
- package/dist/esm/types/components/Fields/makeCustomCheckboxRHF.d.ts +53 -0
- package/dist/esm/types/components/Fields/makeCustomDatePickerRHF.d.ts +22 -0
- package/dist/esm/types/components/Fields/makeCustomInputRHF.d.ts +25 -0
- package/dist/esm/types/components/Fields/makeCustomRadioRHF.d.ts +41 -0
- package/dist/esm/types/components/FieldsetLegend/FieldsetLegend.d.ts +58 -0
- package/dist/esm/types/components/FileUpload/FileUpload.d.ts +23 -0
- package/dist/esm/types/components/FileUpload/FileUpload.stories.d.ts +16 -0
- package/dist/esm/types/components/FileUpload/FileUpload2.d.ts +18 -0
- package/dist/esm/types/components/FileUpload/ShowUploadFiles.d.ts +20 -0
- package/dist/esm/types/components/FileUpload/ShowUploadFiles2.d.ts +19 -0
- package/dist/esm/types/components/FileUpload/UploadField.d.ts +28 -0
- package/dist/esm/types/components/FileUpload/UploadField.stories.d.ts +8 -0
- package/dist/esm/types/components/FileUpload/UploadField2.d.ts +33 -0
- package/dist/esm/types/components/FileUpload/UploadField2.stories.d.ts +10 -0
- package/dist/esm/types/components/FileUpload/types.d.ts +8 -0
- package/dist/esm/types/components/FormControlLabel/FormControlLabel.d.ts +7 -0
- package/dist/esm/types/components/ImageUploadCrop/ImageUploadCrop.d.ts +34 -0
- package/dist/esm/types/components/ImageUploadCrop/ImageUploadCrop.stories.d.ts +6 -0
- package/dist/esm/types/components/ImageUploadCrop/index.d.ts +3 -0
- package/dist/esm/types/components/InfoTooltipIcon/InfoTooltipIcon.d.ts +18 -0
- package/dist/esm/types/components/InfoTooltipIcon/InfoTooltipIcon.stories.d.ts +7 -0
- package/dist/esm/types/components/InfoTooltipIcon/TooltipWrapper.d.ts +35 -0
- package/dist/esm/types/components/InfoTooltipIcon/TooltipWrapper.stories.d.ts +7 -0
- package/dist/esm/types/components/LinkButton/LinkButton.d.ts +16 -0
- package/dist/esm/types/components/LinkButton/LinkButton.stories.d.ts +16 -0
- package/dist/esm/types/components/LocalizationProvider/LocalizationProvider.d.ts +8 -0
- package/dist/esm/types/components/Modal/MnbModal.d.ts +31 -0
- package/dist/esm/types/components/Modal/MnbModal.stories.d.ts +9 -0
- package/dist/esm/types/components/Notification/NotificationExample.d.ts +1 -0
- package/dist/esm/types/components/Notification/NotificationSystem.d.ts +81 -0
- package/dist/esm/types/components/Notification/NotificationTest.d.ts +1 -0
- package/dist/esm/types/components/Notification/ToastContainer.d.ts +182 -0
- package/dist/esm/types/components/PrivacyLink/PrivacyLink.d.ts +13 -0
- package/dist/esm/types/components/PrivacyLink/PrivacyLink.stories.d.ts +6 -0
- package/dist/esm/types/components/Radio/Radio.d.ts +31 -0
- package/dist/esm/types/components/Radio/Radio.stories.d.ts +13 -0
- package/dist/esm/types/components/Radio/RadioWCAG.d.ts +35 -0
- package/dist/esm/types/components/RequiredFieldsInfo/RequiredFieldsInfo.d.ts +34 -0
- package/dist/esm/types/components/RequiredFieldsInfo/RequiredFieldsInfo.stories.d.ts +7 -0
- package/dist/esm/types/components/RichTextEditor/RichTextEditor.d.ts +13 -0
- package/dist/esm/types/components/RichTextEditor/RichTextEditor.stories.d.ts +6 -0
- package/dist/esm/types/components/RichTextEditor/index.d.ts +3 -0
- package/dist/esm/types/components/Select/Select.d.ts +19 -0
- package/dist/esm/types/components/Select/Select.stories.d.ts +14 -0
- package/dist/esm/types/components/StatusTimeline/StatusTimeline.d.ts +38 -0
- package/dist/esm/types/components/StatusTimeline/StatusTimeline.stories.d.ts +7 -0
- package/dist/esm/types/components/StatusTimeline/index.d.ts +3 -0
- package/dist/esm/types/components/SvgIcon/SvgIcon.d.ts +27 -0
- package/dist/esm/types/components/SvgIcon/SvgIcon.stories.d.ts +7 -0
- package/dist/esm/types/components/TextField/TextField.d.ts +6 -0
- package/dist/esm/types/components/TextField/TextField.stories.d.ts +14 -0
- package/dist/esm/types/components/ThemeWrapper/ThemeWrapper.d.ts +9 -0
- package/dist/esm/types/components/UsercentricsAllowScreen/UsercentricsAllowScreen.d.ts +8 -0
- package/dist/esm/types/components/Wizard/NavigateItem.d.ts +28 -0
- package/dist/esm/types/components/Wizard/Wizard.d.ts +30 -0
- package/dist/esm/types/components/Wizard/Wizard.stories.d.ts +7 -0
- package/dist/esm/types/components/Wizard/Wizard.types.d.ts +17 -0
- package/dist/esm/types/components/Wizard/WizardAccessibilityTest.d.ts +1 -0
- package/dist/esm/types/components/Wizard/WizardTest.d.ts +1 -0
- package/dist/esm/types/hooks/useUserCentrics.d.ts +42 -0
- package/dist/esm/types/index.d.ts +95 -0
- package/dist/esm/types/stories/ThemeViewer.stories.d.ts +7 -0
- package/dist/esm/types/stories/decorators.d.ts +2 -0
- package/dist/esm/types/utils/accessibility.d.ts +94 -0
- package/dist/esm/types/utils/createFormField.d.ts +19 -0
- package/dist/esm/types/utils/pdfAccessibilityUtils.d.ts +213 -0
- package/dist/esm/types/utils/utils.d.ts +6 -0
- package/dist/index.d.ts +1777 -0
- package/dist/index.esm.js +29 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/package.json +112 -4
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface MTCaptchaConfig {
|
|
3
|
+
sitekey: string;
|
|
4
|
+
lang?: string;
|
|
5
|
+
renderQueue?: any[];
|
|
6
|
+
text?: {
|
|
7
|
+
instruction?: string;
|
|
8
|
+
};
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
export interface MTCaptchaStatus {
|
|
12
|
+
domId: string;
|
|
13
|
+
element: HTMLDivElement;
|
|
14
|
+
isVerified: boolean;
|
|
15
|
+
isVisible: boolean;
|
|
16
|
+
statusCode: number;
|
|
17
|
+
statusDesc: string;
|
|
18
|
+
verifiedToken: string;
|
|
19
|
+
}
|
|
20
|
+
export interface MTCaptchaAPI {
|
|
21
|
+
enableTestMode: () => void;
|
|
22
|
+
focus: () => void;
|
|
23
|
+
getConfiguration: () => void;
|
|
24
|
+
getStatus: () => MTCaptchaStatus;
|
|
25
|
+
getVerifiedToken: () => string | null;
|
|
26
|
+
remove: () => void;
|
|
27
|
+
renderUI: () => void;
|
|
28
|
+
resetUI: () => void;
|
|
29
|
+
showMandatory: () => void;
|
|
30
|
+
}
|
|
31
|
+
export interface CaptchaProviderProps {
|
|
32
|
+
sitekey: string;
|
|
33
|
+
lang?: string;
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
onVerificationChange?: (isVerified: boolean, token?: string) => void;
|
|
36
|
+
checkInterval?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface UseCaptchaReturn {
|
|
39
|
+
isVerified: boolean;
|
|
40
|
+
isLoading: boolean;
|
|
41
|
+
verifiedToken: string | null;
|
|
42
|
+
reset: () => void;
|
|
43
|
+
getStatus: () => MTCaptchaStatus | null;
|
|
44
|
+
}
|
|
45
|
+
declare global {
|
|
46
|
+
interface Window {
|
|
47
|
+
mtcaptcha?: MTCaptchaAPI;
|
|
48
|
+
mtcaptchaConfig?: MTCaptchaConfig;
|
|
49
|
+
debugMTCaptcha?: () => void;
|
|
50
|
+
testCaptchaRender?: () => void;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CheckboxProps } from '@mui/material/Checkbox/Checkbox';
|
|
3
|
+
interface ICheckboxProps extends CheckboxProps {
|
|
4
|
+
clr?: string;
|
|
5
|
+
hoverclr?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const CheckboxIcon: ({ clr, hoverclr }: {
|
|
10
|
+
clr: string;
|
|
11
|
+
hoverclr: string;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const CheckboxCheckedIcon: ({ clr, hoverclr }: {
|
|
14
|
+
clr: string;
|
|
15
|
+
hoverclr: string;
|
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<ICheckboxProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
export default Checkbox;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import MnbCheckbox from "./Checkbox";
|
|
3
|
+
declare const meta: Meta<typeof MnbCheckbox>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof MnbCheckbox>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Checked: Story;
|
|
8
|
+
export declare const Disabled: Story;
|
|
9
|
+
export declare const DisabledChecked: Story;
|
|
10
|
+
export declare const Required: Story;
|
|
11
|
+
export declare const WithoutLabel: Story;
|
|
12
|
+
export declare const WithClickHandler: Story;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ConfigProviderProps } from './ConfigContext.types';
|
|
3
|
+
declare const PassConfigContext: {
|
|
4
|
+
config: any;
|
|
5
|
+
};
|
|
6
|
+
declare const ConfigProvider: <T extends object>({ children, fallback, projectName, configFileName, defaultConfig }: ConfigProviderProps<T>) => string | number | true | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | null;
|
|
7
|
+
declare const useConfigContext: <T>() => T;
|
|
8
|
+
export default ConfigProvider;
|
|
9
|
+
export { PassConfigContext, useConfigContext };
|
|
10
|
+
export declare const isConfigReady: () => boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import ContactLink from "./ContactLink";
|
|
3
|
+
declare const meta: Meta<typeof ContactLink>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ContactLink>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const AllTypes: Story;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GridValidRowModel } from '@mui/x-data-grid-pro';
|
|
2
|
+
import { IDataTableProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* WCAG-compliant DataTable component
|
|
5
|
+
*
|
|
6
|
+
* Accessibility features:
|
|
7
|
+
* - Full keyboard navigation support
|
|
8
|
+
* - Screen reader optimized with German locale
|
|
9
|
+
* - ARIA labels and descriptions
|
|
10
|
+
* - High contrast focus indicators
|
|
11
|
+
* - Semantic table structure
|
|
12
|
+
*/
|
|
13
|
+
declare const DataTable: <T extends GridValidRowModel>({ rows, columns, isLoading, totalRowCount, config, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...dataGridProps }: IDataTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default DataTable;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import MnbDataTable from "./DataTable";
|
|
3
|
+
declare const meta: Meta<typeof MnbDataTable>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof MnbDataTable>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithPagination: Story;
|
|
8
|
+
export declare const WithRowSelection: Story;
|
|
9
|
+
export declare const WithFilters: Story;
|
|
10
|
+
export declare const WithExport: Story;
|
|
11
|
+
export declare const LoadingState: Story;
|
|
12
|
+
export declare const EmptyState: Story;
|
|
13
|
+
export declare const AutoHeight: Story;
|
|
14
|
+
export declare const FixedHeight: Story;
|
|
15
|
+
export declare const WithAllFeatures: Story;
|
|
16
|
+
export declare const ProductTable: Story;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { DataGridProProps, GridValidRowModel, GridLocaleText } from '@mui/x-data-grid-pro';
|
|
2
|
+
export interface IDataTableConfig {
|
|
3
|
+
/**
|
|
4
|
+
* Page size options for pagination
|
|
5
|
+
* @default [10, 20, 50, 100]
|
|
6
|
+
*/
|
|
7
|
+
pageSizeOptions?: number[];
|
|
8
|
+
/**
|
|
9
|
+
* Default page size
|
|
10
|
+
* @default 10
|
|
11
|
+
*/
|
|
12
|
+
defaultPageSize?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Always show pagination controls, even when all rows fit on one page
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
showPagination?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Locale text configuration for the data grid
|
|
20
|
+
* If not provided, uses German locale by default
|
|
21
|
+
*/
|
|
22
|
+
localeText?: Partial<GridLocaleText>;
|
|
23
|
+
/**
|
|
24
|
+
* Enable auto height (table adjusts to content)
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
autoHeight?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Fixed height for the table
|
|
30
|
+
* If not provided, table will use 100% of container
|
|
31
|
+
*/
|
|
32
|
+
height?: string | number;
|
|
33
|
+
/**
|
|
34
|
+
* Minimum height for the table
|
|
35
|
+
*/
|
|
36
|
+
minHeight?: string | number;
|
|
37
|
+
/**
|
|
38
|
+
* Maximum height for the table
|
|
39
|
+
*/
|
|
40
|
+
maxHeight?: string | number;
|
|
41
|
+
/**
|
|
42
|
+
* Show column menu
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
showColumnMenu?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Show toolbar
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
showToolbar?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Enable row selection
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
enableRowSelection?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Selection mode: 'single' or 'multiple'
|
|
58
|
+
* @default 'multiple'
|
|
59
|
+
*/
|
|
60
|
+
selectionMode?: 'single' | 'multiple';
|
|
61
|
+
/**
|
|
62
|
+
* Enable density selector
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
enableDensitySelector?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Enable column filter
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
enableColumnFilter?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Enable column visibility toggle
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
enableColumnVisibility?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Enable export functionality
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
enableExport?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Custom CSS class name for the table container
|
|
83
|
+
*/
|
|
84
|
+
containerClassName?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Custom CSS class name for the table
|
|
87
|
+
*/
|
|
88
|
+
tableClassName?: string;
|
|
89
|
+
}
|
|
90
|
+
export interface IDataTableProps<T extends GridValidRowModel> extends Omit<DataGridProProps<T>, 'rows' | 'columns'> {
|
|
91
|
+
/**
|
|
92
|
+
* Table rows data
|
|
93
|
+
*/
|
|
94
|
+
rows: T[];
|
|
95
|
+
/**
|
|
96
|
+
* Table column definitions
|
|
97
|
+
*/
|
|
98
|
+
columns: DataGridProProps<T>['columns'];
|
|
99
|
+
/**
|
|
100
|
+
* Loading state
|
|
101
|
+
* @default false
|
|
102
|
+
*/
|
|
103
|
+
isLoading?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Total row count (for server-side pagination)
|
|
106
|
+
*/
|
|
107
|
+
totalRowCount?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Table configuration options
|
|
110
|
+
*/
|
|
111
|
+
config?: IDataTableConfig;
|
|
112
|
+
/**
|
|
113
|
+
* WCAG: Accessible label for the table region
|
|
114
|
+
* Announced by screen readers when the table receives focus
|
|
115
|
+
*/
|
|
116
|
+
'aria-label'?: string;
|
|
117
|
+
/**
|
|
118
|
+
* WCAG: ID of an element that labels the table
|
|
119
|
+
* Use when a visible heading describes the table
|
|
120
|
+
*/
|
|
121
|
+
'aria-labelledby'?: string;
|
|
122
|
+
/**
|
|
123
|
+
* WCAG: ID of an element that describes the table
|
|
124
|
+
* Use for additional context about the table's content
|
|
125
|
+
*/
|
|
126
|
+
'aria-describedby'?: string;
|
|
127
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DatePickerProps } from '@mui/x-date-pickers';
|
|
3
|
+
import type { Moment } from 'moment';
|
|
4
|
+
/**
|
|
5
|
+
* MnbDatePicker – A themed wrapper around MUI X DatePicker that
|
|
6
|
+
* - uses the library TextField for consistent labeling and a11y
|
|
7
|
+
* - applies consistent calendar styling using theme colors
|
|
8
|
+
* - forwards all DatePicker props to MUI
|
|
9
|
+
*/
|
|
10
|
+
declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps<Moment, any> & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export type { DatePickerProps } from '@mui/x-date-pickers';
|
|
12
|
+
export default DatePicker;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import MnbDatePicker from "./DatePicker";
|
|
3
|
+
declare const meta: Meta<typeof MnbDatePicker>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof MnbDatePicker>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithValue: Story;
|
|
8
|
+
export declare const Required: Story;
|
|
9
|
+
export declare const WithError: Story;
|
|
10
|
+
export declare const Disabled: Story;
|
|
11
|
+
export declare const ReadOnly: Story;
|
|
12
|
+
export declare const YearMonthOnly: Story;
|
|
13
|
+
export declare const YearOnly: Story;
|
|
14
|
+
export declare const WithCustomHandler: Story;
|
|
15
|
+
export declare const WithRHF: Story;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutocompleteProps } from '@mui/material';
|
|
3
|
+
interface IDropdownProps extends AutocompleteProps<any, any, any, any> {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
theme?: any;
|
|
6
|
+
items: {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}[];
|
|
10
|
+
isCreatable?: boolean;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const Dropdown: React.FC<IDropdownProps>;
|
|
14
|
+
export default Dropdown;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextFieldProps } from '@mui/material/TextField';
|
|
3
|
+
export interface UrlFieldProps extends Omit<TextFieldProps, 'type' | 'InputProps'> {
|
|
4
|
+
/** Current URL value */
|
|
5
|
+
value?: string;
|
|
6
|
+
/** Callback when URL changes */
|
|
7
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
8
|
+
/** Callback when URL is blurred */
|
|
9
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
10
|
+
/** Custom URL validation regex pattern */
|
|
11
|
+
urlPattern?: RegExp;
|
|
12
|
+
/** Whether to show the "open in new tab" button */
|
|
13
|
+
showOpenButton?: boolean;
|
|
14
|
+
/** Custom error message */
|
|
15
|
+
error?: boolean;
|
|
16
|
+
/** Error message text */
|
|
17
|
+
errorMessage?: string;
|
|
18
|
+
/** Helper text */
|
|
19
|
+
helperText?: string;
|
|
20
|
+
/** Label text */
|
|
21
|
+
label?: string;
|
|
22
|
+
/** Placeholder text */
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
/** Whether field is required */
|
|
25
|
+
required?: boolean;
|
|
26
|
+
/** Disabled state */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/** ARIA describedby */
|
|
29
|
+
'aria-describedby'?: string;
|
|
30
|
+
/** Custom className */
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
declare const UrlField: React.FC<UrlFieldProps>;
|
|
34
|
+
export default UrlField;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Control, FieldValues, Path, RegisterOptions, UseFormSetValue } from 'react-hook-form';
|
|
3
|
+
export type AutoCompleteMode = 'PLZ' | 'CITY' | 'STREET';
|
|
4
|
+
export type CustomAddressAutocompleteProps<T extends FieldValues = FieldValues> = {
|
|
5
|
+
name: Path<T>;
|
|
6
|
+
label: string;
|
|
7
|
+
url: string;
|
|
8
|
+
autoCompleteFor: AutoCompleteMode;
|
|
9
|
+
city?: string;
|
|
10
|
+
postalNumber?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
autoload?: boolean;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
autoComplete?: string;
|
|
15
|
+
rules?: RegisterOptions<T, Path<T>>;
|
|
16
|
+
config?: RegisterOptions<T, Path<T>>;
|
|
17
|
+
control?: Control<T>;
|
|
18
|
+
onOptionSelected?: (selected: any, api: {
|
|
19
|
+
setValue: UseFormSetValue<T>;
|
|
20
|
+
name: Path<T>;
|
|
21
|
+
}) => void;
|
|
22
|
+
setValue?: UseFormSetValue<T>;
|
|
23
|
+
onClear?: (api: {
|
|
24
|
+
setValue: UseFormSetValue<T>;
|
|
25
|
+
name: Path<T>;
|
|
26
|
+
}) => void;
|
|
27
|
+
minChars?: number;
|
|
28
|
+
debounceMs?: number;
|
|
29
|
+
getOptionLabel?: (option: any) => string;
|
|
30
|
+
buildQuery?: (args: {
|
|
31
|
+
mode: AutoCompleteMode;
|
|
32
|
+
search: string;
|
|
33
|
+
city?: string;
|
|
34
|
+
postalNumber?: string;
|
|
35
|
+
}) => string;
|
|
36
|
+
clearOptionsSignal?: unknown;
|
|
37
|
+
/** Allow user to create a new option from free text input */
|
|
38
|
+
creatable?: boolean;
|
|
39
|
+
};
|
|
40
|
+
export declare function makeCustomAddressAutocompleteRHF<T extends FieldValues = FieldValues>(): React.FC<CustomAddressAutocompleteProps<T>>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Control, FieldValues, Path, RegisterOptions } from 'react-hook-form';
|
|
3
|
+
import { AutocompleteChangeReason } from '@mui/material';
|
|
4
|
+
/**
|
|
5
|
+
* A generic RHF wrapper for MnbAutocomplete WITHOUT address fetching.
|
|
6
|
+
* - Uses provided `items` only
|
|
7
|
+
* - Adds WCAG aids (instructions + live results count)
|
|
8
|
+
* - Works with FormProvider or with explicit `control`
|
|
9
|
+
*/
|
|
10
|
+
export type CustomAutocompleteItem = {
|
|
11
|
+
id?: string | number;
|
|
12
|
+
name?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
value?: string;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
};
|
|
17
|
+
export type CustomAutocompleteRHFProps<T extends FieldValues = FieldValues> = {
|
|
18
|
+
name: Path<T>;
|
|
19
|
+
label: string;
|
|
20
|
+
items: CustomAutocompleteItem[];
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
fullWidth?: boolean;
|
|
23
|
+
multiple?: boolean;
|
|
24
|
+
isLoading?: boolean;
|
|
25
|
+
isCreatable?: boolean;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
/** Validation */
|
|
28
|
+
rules?: RegisterOptions<T, Path<T>>;
|
|
29
|
+
config?: RegisterOptions<T, Path<T>>;
|
|
30
|
+
/** If NOT using <FormProvider>, pass control here */
|
|
31
|
+
control?: Control<T>;
|
|
32
|
+
/**
|
|
33
|
+
* Custom label/value resolvers
|
|
34
|
+
*/
|
|
35
|
+
getOptionLabel?: (option: CustomAutocompleteItem) => string;
|
|
36
|
+
isOptionEqualToValue?: (option: CustomAutocompleteItem, value: CustomAutocompleteItem) => boolean;
|
|
37
|
+
/** Optional external onChange tap */
|
|
38
|
+
onChanged?: (value: CustomAutocompleteItem | CustomAutocompleteItem[] | null, reason: AutocompleteChangeReason) => void;
|
|
39
|
+
};
|
|
40
|
+
export declare function makeCustomAutocompleteRHF<T extends FieldValues = FieldValues>(): React.FC<CustomAutocompleteRHFProps<T>>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Control, FieldValues, Path, RegisterOptions } from 'react-hook-form';
|
|
3
|
+
/** Optional ARIA props like in your legacy CustomCheckbox */
|
|
4
|
+
export type ItemAriaProps = Partial<{
|
|
5
|
+
'aria-expanded': boolean;
|
|
6
|
+
'aria-controls': string;
|
|
7
|
+
'aria-describedby': string;
|
|
8
|
+
'aria-invalid': boolean;
|
|
9
|
+
}>;
|
|
10
|
+
/** Per-item config for per-field mode (boolean fields) */
|
|
11
|
+
export type CheckboxItemPerField<T extends FieldValues> = ItemAriaProps & {
|
|
12
|
+
name: Path<T>;
|
|
13
|
+
label: string | React.ReactNode;
|
|
14
|
+
labelBold?: boolean;
|
|
15
|
+
rules?: RegisterOptions<T, Path<T>>;
|
|
16
|
+
config?: RegisterOptions<T, Path<T>>;
|
|
17
|
+
};
|
|
18
|
+
/** Per-item config for field-array mode (single array field collecting values) */
|
|
19
|
+
export type CheckboxItemArray = ItemAriaProps & {
|
|
20
|
+
value: string;
|
|
21
|
+
label: string | React.ReactNode;
|
|
22
|
+
labelBold?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type CustomCheckboxProps<T extends FieldValues = FieldValues> = {
|
|
25
|
+
/** Items; meaning depends on isFieldArray */
|
|
26
|
+
checkboxValues: (CheckboxItemPerField<T> | CheckboxItemArray)[];
|
|
27
|
+
/** Layout / styling */
|
|
28
|
+
className?: string;
|
|
29
|
+
errorClassName?: string;
|
|
30
|
+
row?: boolean;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** RHF interop */
|
|
33
|
+
control?: Control<T>;
|
|
34
|
+
/** If true, this group controls a single array field (string[]) using props.name */
|
|
35
|
+
isFieldArray?: boolean;
|
|
36
|
+
/** Required when isFieldArray is true: the array field name */
|
|
37
|
+
name?: Path<T>;
|
|
38
|
+
/** Group-level rules when isFieldArray is true (e.g., min selection) */
|
|
39
|
+
groupRules?: RegisterOptions<T, Path<T>>;
|
|
40
|
+
/** Optional helper text under the group (string or function) */
|
|
41
|
+
helperText?: React.ReactNode | ((ctx: {
|
|
42
|
+
errors: any;
|
|
43
|
+
hasError: boolean;
|
|
44
|
+
}) => React.ReactNode);
|
|
45
|
+
hasCustomErrorMessage?: boolean;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Generic, RHF-aware Checkbox Group that mirrors your CustomCheckbox behavior and adds:
|
|
49
|
+
* - isFieldArray mode (single string[] field)
|
|
50
|
+
* - helper text under the group
|
|
51
|
+
* - works with FormProvider or explicit control
|
|
52
|
+
*/
|
|
53
|
+
export declare function makeCustomCheckboxRHF<T extends FieldValues = FieldValues>(): React.FC<CustomCheckboxProps<T>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Control, FieldValues, Path, RegisterOptions } from 'react-hook-form';
|
|
3
|
+
import { MnbTextField } from '../../index';
|
|
4
|
+
import type { Moment } from 'moment';
|
|
5
|
+
import type { DatePickerProps } from '@mui/x-date-pickers-pro';
|
|
6
|
+
export type CustomDatePickerRHFProps<T extends FieldValues = FieldValues> = {
|
|
7
|
+
name: Path<T>;
|
|
8
|
+
label: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
fullWidth?: boolean;
|
|
11
|
+
isLoading?: boolean;
|
|
12
|
+
/** Validation */
|
|
13
|
+
rules?: RegisterOptions<T, Path<T>>;
|
|
14
|
+
config?: RegisterOptions<T, Path<T>>;
|
|
15
|
+
/** If NOT using <FormProvider>, pass control here */
|
|
16
|
+
control?: Control<T>;
|
|
17
|
+
/** Additional props to pass to the underlying TextField */
|
|
18
|
+
textFieldProps?: React.ComponentProps<typeof MnbTextField>;
|
|
19
|
+
/** MUI DatePicker props */
|
|
20
|
+
datePickerProps?: DatePickerProps<Moment, any>;
|
|
21
|
+
};
|
|
22
|
+
export declare function makeCustomDatePickerRHF<T extends FieldValues = FieldValues>(): React.FC<CustomDatePickerRHFProps<T>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Control, FieldValues, Path, RegisterOptions } from 'react-hook-form';
|
|
3
|
+
import { MnbTextField } from '../../index';
|
|
4
|
+
type MnbTextFieldProps = React.ComponentProps<typeof MnbTextField>;
|
|
5
|
+
export type CustomInputRHFProps<T extends FieldValues = FieldValues> = {
|
|
6
|
+
name: Path<T>;
|
|
7
|
+
label: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
fullWidth?: boolean;
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
/** Prefer `rules`; `config` kept for backwards compatibility */
|
|
12
|
+
rules?: RegisterOptions<T, Path<T>>;
|
|
13
|
+
config?: RegisterOptions<T, Path<T>>;
|
|
14
|
+
/** Pass when NOT using <FormProvider> */
|
|
15
|
+
control?: Control<T>;
|
|
16
|
+
} & Omit<MnbTextFieldProps, 'name' | 'defaultValue' | 'value' | 'onChange' | 'onBlur' | 'ref' | 'label'>;
|
|
17
|
+
export type MakeOptions<T extends FieldValues> = {
|
|
18
|
+
/** Optional: compute variant dynamically (e.g., based on theme) */
|
|
19
|
+
getVariant?: (ctx: {
|
|
20
|
+
props: CustomInputRHFProps<T>;
|
|
21
|
+
value: any;
|
|
22
|
+
}) => MnbTextFieldProps['variant'];
|
|
23
|
+
};
|
|
24
|
+
export declare function makeCustomInputRHF<T extends FieldValues = FieldValues>(opts?: MakeOptions<T>): React.FC<CustomInputRHFProps<T>>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Control, FieldValues, Path, RegisterOptions } from 'react-hook-form';
|
|
3
|
+
import { GridDirection } from '@mui/material';
|
|
4
|
+
export type RadioItem = {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type CustomRadioProps<T extends FieldValues = FieldValues> = {
|
|
10
|
+
/** RHF field name (type-safe) */
|
|
11
|
+
name: Path<T>;
|
|
12
|
+
/** Optional group label */
|
|
13
|
+
label?: string | React.ReactNode;
|
|
14
|
+
/** Options */
|
|
15
|
+
radioValues: RadioItem[];
|
|
16
|
+
/** Optional: externally controlled selection override */
|
|
17
|
+
selectedValue?: string;
|
|
18
|
+
/** Layout/styling */
|
|
19
|
+
className?: string;
|
|
20
|
+
errorClassName?: string;
|
|
21
|
+
row?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Validation */
|
|
24
|
+
rules?: RegisterOptions<T, Path<T>>;
|
|
25
|
+
config?: RegisterOptions<T, Path<T>>;
|
|
26
|
+
/** If NOT using <FormProvider>, pass control here */
|
|
27
|
+
control?: Control<T>;
|
|
28
|
+
/** Intercept onChange; call provided onChange when done */
|
|
29
|
+
onChangeOverride?: (e: React.ChangeEvent<HTMLInputElement>, value: string, onChange: (value: any) => void) => void;
|
|
30
|
+
/** If you need to mimic preventDefault() behavior */
|
|
31
|
+
preventDefaultOnChange?: boolean;
|
|
32
|
+
direction?: GridDirection;
|
|
33
|
+
/** ARIA accessibility props */
|
|
34
|
+
'aria-label'?: string;
|
|
35
|
+
'aria-labelledby'?: string;
|
|
36
|
+
'aria-describedby'?: string;
|
|
37
|
+
'aria-invalid'?: boolean;
|
|
38
|
+
'aria-required'?: boolean;
|
|
39
|
+
role?: string;
|
|
40
|
+
};
|
|
41
|
+
export declare function makeCustomRadioRHF<T extends FieldValues = FieldValues>(): React.FC<CustomRadioProps<T>>;
|