@mnbsolutions/framework-frontend 0.0.0-stage → 4.0.0
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/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 +103 -4
- package/README.md +0 -3
|
@@ -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>>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface FieldsetLegendProps {
|
|
3
|
+
/** The title/legend text for the fieldset */
|
|
4
|
+
title?: string;
|
|
5
|
+
/** The content inside the fieldset */
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/** Additional CSS classes */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Additional styling props for the fieldset */
|
|
10
|
+
sx?: any;
|
|
11
|
+
/** Additional styling props for the legend */
|
|
12
|
+
legendSx?: any;
|
|
13
|
+
/** Whether to show the legend visually (default: true) */
|
|
14
|
+
showLegend?: boolean;
|
|
15
|
+
/** Custom legend component (optional) */
|
|
16
|
+
legendComponent?: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* MnbFieldsetLegend Component
|
|
20
|
+
*
|
|
21
|
+
* A reusable fieldset with legend component that provides proper accessibility
|
|
22
|
+
* for screen readers. The fieldset groups related form elements and the legend
|
|
23
|
+
* provides context about what the group contains.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Basic usage with title
|
|
27
|
+
* <MnbFieldsetLegend title="Personal Information">
|
|
28
|
+
* <TextField label="Name" />
|
|
29
|
+
* <TextField label="Email" />
|
|
30
|
+
* </MnbFieldsetLegend>
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // Without visual legend (for screen readers only)
|
|
34
|
+
* <MnbFieldsetLegend title="Hidden Legend" showLegend={false}>
|
|
35
|
+
* <TextField label="Name" />
|
|
36
|
+
* </MnbFieldsetLegend>
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Custom legend component
|
|
40
|
+
* <MnbFieldsetLegend
|
|
41
|
+
* title="Custom Legend"
|
|
42
|
+
* legendComponent={<Typography variant="h6">Custom Legend</Typography>}
|
|
43
|
+
* >
|
|
44
|
+
* <TextField label="Name" />
|
|
45
|
+
* </MnbFieldsetLegend>
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* // With custom styling
|
|
49
|
+
* <MnbFieldsetLegend
|
|
50
|
+
* title="Styled Fieldset"
|
|
51
|
+
* sx={{ border: '2px solid #ccc', padding: 2 }}
|
|
52
|
+
* legendSx={{ color: 'primary.main' }}
|
|
53
|
+
* >
|
|
54
|
+
* <TextField label="Name" />
|
|
55
|
+
* </MnbFieldsetLegend>
|
|
56
|
+
*/
|
|
57
|
+
declare const MnbFieldsetLegend: React.FC<FieldsetLegendProps>;
|
|
58
|
+
export default MnbFieldsetLegend;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated This component is deprecated. Use FileUpload2 instead.
|
|
4
|
+
* FileUpload2 provides better support for both client-side and server-side files
|
|
5
|
+
* with the IFile interface, improved validation, and better accessibility.
|
|
6
|
+
*
|
|
7
|
+
* Migration guide:
|
|
8
|
+
* - Replace FileUpload with FileUpload2
|
|
9
|
+
* - Change File[] to IFile[] in your state
|
|
10
|
+
* - Use convertFileToIFile() helper to convert native File objects
|
|
11
|
+
*/
|
|
12
|
+
interface IFileUploadProps {
|
|
13
|
+
openModal: boolean;
|
|
14
|
+
toggleModal: (modalState: boolean) => void;
|
|
15
|
+
selectedFiles: File[];
|
|
16
|
+
handleSetSelectedFiles: (files: File[]) => void;
|
|
17
|
+
maxFileSizeMB?: number;
|
|
18
|
+
multipleFiles?: boolean;
|
|
19
|
+
accept?: string | string[];
|
|
20
|
+
customHelperText?: string;
|
|
21
|
+
}
|
|
22
|
+
declare const FileUpload: React.FC<IFileUploadProps>;
|
|
23
|
+
export default FileUpload;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import MnbFileUpload from './FileUpload';
|
|
3
|
+
import MnbFileUpload2 from './FileUpload2';
|
|
4
|
+
declare const meta: Meta<typeof MnbFileUpload>;
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof MnbFileUpload>;
|
|
7
|
+
type Story2 = StoryObj<typeof MnbFileUpload2>;
|
|
8
|
+
export declare const Default: Story;
|
|
9
|
+
export declare const SingleFileUpload: Story;
|
|
10
|
+
export declare const LargeSizeLimit: Story;
|
|
11
|
+
export declare const SmallSizeLimit: Story;
|
|
12
|
+
export declare const PrefilledFiles: Story;
|
|
13
|
+
export declare const ContractDocuments: Story;
|
|
14
|
+
export declare const AlwaysOpen: Story;
|
|
15
|
+
export declare const MaxFilesLimit: Story2;
|
|
16
|
+
export declare const MaxTotalSizeLimit: Story2;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IFile } from './types';
|
|
3
|
+
interface IFileUploadProps {
|
|
4
|
+
openModal: boolean;
|
|
5
|
+
toggleModal: (modalState: boolean) => void;
|
|
6
|
+
selectedFiles: IFile[];
|
|
7
|
+
handleSetSelectedFiles: (files: IFile[]) => void;
|
|
8
|
+
maxFileSizeMB?: number;
|
|
9
|
+
multipleFiles?: boolean;
|
|
10
|
+
maxFiles?: number;
|
|
11
|
+
allFilesMaxSizeMB?: number;
|
|
12
|
+
maxFilesExceededMessage?: string;
|
|
13
|
+
allFilesMaxSizeExceededMessage?: string;
|
|
14
|
+
accept?: string | string[];
|
|
15
|
+
showAlreadyUploaded?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare const FileUpload: React.FC<IFileUploadProps>;
|
|
18
|
+
export default FileUpload;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated This component is deprecated. Use ShowUploadFiles2 instead.
|
|
4
|
+
* ShowUploadFiles2 provides better support for both client-side and server-side files
|
|
5
|
+
* with the IFile interface, modal confirmation for file removal, and improved accessibility.
|
|
6
|
+
*
|
|
7
|
+
* Migration guide:
|
|
8
|
+
* - Replace ShowUploadFiles with ShowUploadFiles2
|
|
9
|
+
* - Change File[] to IFile[] in your state
|
|
10
|
+
* - Add optional modal configuration props for server-side file removal
|
|
11
|
+
* - Use convertFileToIFile() helper to convert native File objects
|
|
12
|
+
*/
|
|
13
|
+
interface ShowUploadFilesProps {
|
|
14
|
+
selectedFiles: File[];
|
|
15
|
+
handleSetSelectedFiles: (files: File[]) => void;
|
|
16
|
+
toggleModal: (modalState: boolean) => void;
|
|
17
|
+
enableDownload?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const ShowUploadFiles: React.FC<ShowUploadFilesProps>;
|
|
20
|
+
export default ShowUploadFiles;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IFile } from './types';
|
|
3
|
+
interface ShowUploadFilesProps {
|
|
4
|
+
selectedFiles: IFile[];
|
|
5
|
+
handleSetSelectedFiles: (files: IFile[]) => void;
|
|
6
|
+
toggleModal: (modalState: boolean) => void;
|
|
7
|
+
enableDownload?: boolean;
|
|
8
|
+
title?: string;
|
|
9
|
+
onDownloadFile?: (file: IFile) => void;
|
|
10
|
+
showRemoveModal?: boolean;
|
|
11
|
+
onRemoveFile?: (file: IFile) => void;
|
|
12
|
+
removeModalTitle?: string;
|
|
13
|
+
removeModalText?: string;
|
|
14
|
+
removeModalAcceptText?: string;
|
|
15
|
+
removeModalCancelText?: string;
|
|
16
|
+
removeModalMaxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | false;
|
|
17
|
+
}
|
|
18
|
+
declare const ShowUploadFiles: React.FC<ShowUploadFilesProps>;
|
|
19
|
+
export default ShowUploadFiles;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated This component is deprecated. Use UploadField2 instead.
|
|
4
|
+
* UploadField2 provides better support for both client-side and server-side files
|
|
5
|
+
* with the IFile interface, modal confirmation for file removal, and improved accessibility.
|
|
6
|
+
*
|
|
7
|
+
* Migration guide:
|
|
8
|
+
* - Replace UploadField with UploadField2
|
|
9
|
+
* - Change File[] to IFile[] in your state
|
|
10
|
+
* - Add optional modal configuration props for server-side file removal
|
|
11
|
+
* - Use convertFileToIFile() helper to convert native File objects
|
|
12
|
+
*/
|
|
13
|
+
interface IUploadField {
|
|
14
|
+
buttonLabel: string;
|
|
15
|
+
selectedFiles: File[];
|
|
16
|
+
isModalOpen: boolean;
|
|
17
|
+
toggleModal: (modalState: boolean) => void;
|
|
18
|
+
handleSetSelectedFiles: (files: File[]) => void;
|
|
19
|
+
showUploadedFiles?: boolean;
|
|
20
|
+
enableDownload?: boolean;
|
|
21
|
+
maxFileSizeMB?: number;
|
|
22
|
+
multipleFiles?: boolean;
|
|
23
|
+
ariaLabel?: string;
|
|
24
|
+
accept?: string | string[];
|
|
25
|
+
customHelperText?: string;
|
|
26
|
+
}
|
|
27
|
+
declare const UploadField: React.FC<IUploadField>;
|
|
28
|
+
export default UploadField;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import UploadField from "./UploadField";
|
|
3
|
+
declare const meta: Meta<typeof UploadField>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof UploadField>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const LargeSizeLimit: Story;
|
|
8
|
+
export declare const PrefilledFiles: Story;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IFile } from './types';
|
|
3
|
+
interface IUploadField2 {
|
|
4
|
+
buttonLabel: string;
|
|
5
|
+
selectedFiles: IFile[];
|
|
6
|
+
isModalOpen: boolean;
|
|
7
|
+
toggleModal: (modalState: boolean) => void;
|
|
8
|
+
handleSetSelectedFiles: (files: IFile[]) => void;
|
|
9
|
+
showUploadedFiles?: boolean;
|
|
10
|
+
enableDownload?: boolean;
|
|
11
|
+
maxFileSizeMB?: number;
|
|
12
|
+
multipleFiles?: boolean;
|
|
13
|
+
maxFiles?: number;
|
|
14
|
+
allFilesMaxSizeMB?: number;
|
|
15
|
+
maxFilesExceededMessage?: string;
|
|
16
|
+
allFilesMaxSizeExceededMessage?: string;
|
|
17
|
+
ariaLabel?: string;
|
|
18
|
+
accept?: string | string[];
|
|
19
|
+
title?: string;
|
|
20
|
+
showAlreadyUploaded?: boolean;
|
|
21
|
+
onDownloadFile?: (file: IFile) => void;
|
|
22
|
+
showRemoveModal?: boolean;
|
|
23
|
+
onRemoveFile?: (file: IFile) => void;
|
|
24
|
+
removeModalTitle?: string;
|
|
25
|
+
removeModalText?: string;
|
|
26
|
+
removeModalAcceptText?: string;
|
|
27
|
+
removeModalCancelText?: string;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
showButtonGrid?: boolean;
|
|
30
|
+
hideButton?: boolean;
|
|
31
|
+
}
|
|
32
|
+
declare const UploadField2: React.FC<IUploadField2>;
|
|
33
|
+
export default UploadField2;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import UploadField2 from './UploadField2';
|
|
3
|
+
declare const meta: Meta<typeof UploadField2>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof UploadField2>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const HideAlreadyUploadedInModal: Story;
|
|
8
|
+
export declare const WithCustomDownload: Story;
|
|
9
|
+
export declare const WithRemoveConfirmation: Story;
|
|
10
|
+
export declare const SingleFileAndAcceptFilter: Story;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormControlLabelProps } from '@mui/material/FormControlLabel/FormControlLabel';
|
|
3
|
+
interface IFormControlLabelProps extends FormControlLabelProps {
|
|
4
|
+
underline?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const FormControlLabel: React.ComponentType<IFormControlLabelProps>;
|
|
7
|
+
export default FormControlLabel;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'cropperjs/dist/cropper.css';
|
|
3
|
+
export interface ImageUploadCropProps {
|
|
4
|
+
/** Current image file */
|
|
5
|
+
value?: File | null;
|
|
6
|
+
/** Current image preview URL (for existing images) */
|
|
7
|
+
previewUrl?: string | null;
|
|
8
|
+
/** Callback when image changes */
|
|
9
|
+
onChange?: (file: File | null, previewUrl: string | null) => void;
|
|
10
|
+
/** Callback when image is removed */
|
|
11
|
+
onRemove?: () => void;
|
|
12
|
+
/** Required aspect ratio (width/height), default 16/9 */
|
|
13
|
+
aspectRatio?: number;
|
|
14
|
+
/** Maximum file size in MB, default 10 */
|
|
15
|
+
maxSizeMB?: number;
|
|
16
|
+
/** Allowed file types, default ['image/jpeg', 'image/png', 'image/gif', 'image/webp'] */
|
|
17
|
+
acceptedTypes?: string[];
|
|
18
|
+
/** Label text */
|
|
19
|
+
label?: string;
|
|
20
|
+
/** Helper text */
|
|
21
|
+
helperText?: string;
|
|
22
|
+
/** Error message */
|
|
23
|
+
error?: 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 ImageUploadCrop: React.FC<ImageUploadCropProps>;
|
|
34
|
+
export default ImageUploadCrop;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TooltipProps } from '@mui/material/Tooltip';
|
|
3
|
+
import { Theme } from '@mui/material/styles';
|
|
4
|
+
import { SvgIconProps } from '@mui/material/SvgIcon';
|
|
5
|
+
interface InfoTooltipIconProps {
|
|
6
|
+
message: string;
|
|
7
|
+
iconColor?: string;
|
|
8
|
+
theme?: Theme;
|
|
9
|
+
iconSize?: number;
|
|
10
|
+
icon?: React.ComponentType<SvgIconProps>;
|
|
11
|
+
tooltipFontSize?: number;
|
|
12
|
+
tooltipFontColor?: string;
|
|
13
|
+
tooltipBackgroundColor?: string;
|
|
14
|
+
placement?: TooltipProps['placement'];
|
|
15
|
+
tabIndex?: number;
|
|
16
|
+
}
|
|
17
|
+
declare const InfoTooltipIcon: React.FC<InfoTooltipIconProps>;
|
|
18
|
+
export default InfoTooltipIcon;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import InfoTooltipIcon from "./InfoTooltipIcon";
|
|
3
|
+
declare const meta: Meta<typeof InfoTooltipIcon>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof InfoTooltipIcon>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const DifferentSizes: Story;
|