@campxdev/react-blueprint 2.0.10 → 2.1.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/cjs/index.js +1 -1
- package/dist/cjs/types/src/components/Assets/Icons/IconComponents/UpArrow.d.ts +5 -0
- package/dist/cjs/types/src/components/Assets/Icons/Icons.d.ts +1 -0
- package/dist/cjs/types/src/components/DataDisplay/Accordion/Accordion.d.ts +2 -1
- package/dist/cjs/types/src/components/Input/MultiSelect/MultiSelect.d.ts +47 -0
- package/dist/cjs/types/src/components/Input/MultiSelect/components/MenuFooter.d.ts +3 -0
- package/dist/cjs/types/src/components/Input/MultiSelect/components/MultiFilter.d.ts +19 -0
- package/dist/cjs/types/src/components/Input/MultiSelect/components/MultiInput.d.ts +19 -0
- package/dist/cjs/types/src/components/Input/MultiSelect/components/OptionsLoader.d.ts +3 -0
- package/dist/cjs/types/src/components/Input/MultiSelect/multiSelectReducer.d.ts +42 -0
- package/dist/cjs/types/src/components/Input/export.d.ts +1 -0
- package/dist/cjs/types/src/stories/Input/MultiSelect.stories.d.ts +16 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/types/src/components/Assets/Icons/IconComponents/UpArrow.d.ts +5 -0
- package/dist/esm/types/src/components/Assets/Icons/Icons.d.ts +1 -0
- package/dist/esm/types/src/components/DataDisplay/Accordion/Accordion.d.ts +2 -1
- package/dist/esm/types/src/components/Input/MultiSelect/MultiSelect.d.ts +47 -0
- package/dist/esm/types/src/components/Input/MultiSelect/components/MenuFooter.d.ts +3 -0
- package/dist/esm/types/src/components/Input/MultiSelect/components/MultiFilter.d.ts +19 -0
- package/dist/esm/types/src/components/Input/MultiSelect/components/MultiInput.d.ts +19 -0
- package/dist/esm/types/src/components/Input/MultiSelect/components/OptionsLoader.d.ts +3 -0
- package/dist/esm/types/src/components/Input/MultiSelect/multiSelectReducer.d.ts +42 -0
- package/dist/esm/types/src/components/Input/export.d.ts +1 -0
- package/dist/esm/types/src/stories/Input/MultiSelect.stories.d.ts +16 -0
- package/dist/index.d.ts +48 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccordionProps as MuiAccordionProps } from '@mui/material';
|
|
1
|
+
import { AccordionProps as MuiAccordionProps, SxProps } from '@mui/material';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
export type AccordionProps = {
|
|
4
4
|
title: ReactNode;
|
|
@@ -6,6 +6,7 @@ export type AccordionProps = {
|
|
|
6
6
|
actions?: ReactNode;
|
|
7
7
|
index?: number;
|
|
8
8
|
errorKeys?: string[];
|
|
9
|
+
contentSx?: SxProps;
|
|
9
10
|
expanded?: boolean | number;
|
|
10
11
|
} & Omit<MuiAccordionProps, 'children' | 'content' | 'title' | 'index' | 'expanded' | 'actions'>;
|
|
11
12
|
export declare const Accordion: (props: AccordionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AutocompleteProps } from '@mui/material';
|
|
2
|
+
import { AxiosInstance } from 'axios';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
declare module '@mui/material/Autocomplete' {
|
|
5
|
+
interface AutocompletePaperSlotPropsOverrides {
|
|
6
|
+
loadingOptions: boolean;
|
|
7
|
+
isSearch: boolean;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export type MultiSelectProps = {
|
|
11
|
+
options?: {
|
|
12
|
+
label: string;
|
|
13
|
+
subLabel?: string;
|
|
14
|
+
value: any;
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
}[] | any[];
|
|
17
|
+
optionsApiEndPoint?: string;
|
|
18
|
+
optionsApiEndpointParams?: any;
|
|
19
|
+
externalAxios?: AxiosInstance;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
label?: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
getValue?: (option: any) => any;
|
|
24
|
+
dbValueProps?: {
|
|
25
|
+
valueKey: string;
|
|
26
|
+
isObjectId?: boolean;
|
|
27
|
+
isInt?: boolean;
|
|
28
|
+
isFloat?: boolean;
|
|
29
|
+
};
|
|
30
|
+
dbLabelProps?: {
|
|
31
|
+
labelKey: string;
|
|
32
|
+
subLabelKey?: string;
|
|
33
|
+
useLabelStartCase?: boolean;
|
|
34
|
+
useSubLabelStartCase?: boolean;
|
|
35
|
+
};
|
|
36
|
+
onChange?: (value: any) => void;
|
|
37
|
+
error?: any;
|
|
38
|
+
helperText?: string;
|
|
39
|
+
type?: 'input' | 'filter';
|
|
40
|
+
disableClear?: boolean;
|
|
41
|
+
} & Omit<AutocompleteProps<{
|
|
42
|
+
label: string;
|
|
43
|
+
subLabel?: string;
|
|
44
|
+
value: any;
|
|
45
|
+
} | any, false, true, false>, 'options' | 'open' | 'onChange' | 'autoFocus' | 'PaperComponent' | 'renderOption' | 'options' | 'renderInput'>;
|
|
46
|
+
export declare const MultiSelect: ({ options, optionsApiEndPoint, optionsApiEndpointParams, externalAxios, getValue, value, onChange, dbValueProps, dbLabelProps, onOpen, onClose, type, ...restProps }: MultiSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export default MultiSelect;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AutocompleteCloseReason } from '@mui/material';
|
|
2
|
+
import { SyntheticEvent } from 'react';
|
|
3
|
+
import { MultiSelectProps } from '../../../export';
|
|
4
|
+
import { MultiSelectState } from '../multiSelectReducer';
|
|
5
|
+
declare module '@mui/material/Autocomplete' {
|
|
6
|
+
interface AutocompletePaperSlotPropsOverrides {
|
|
7
|
+
loadingOptions: boolean;
|
|
8
|
+
isSearch: boolean;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export type MultiFilterProps = {
|
|
12
|
+
onChange: (value: any) => void;
|
|
13
|
+
searchDb: (searchValue: string) => Promise<void>;
|
|
14
|
+
handleOpen: (event: SyntheticEvent) => Promise<void>;
|
|
15
|
+
handleClose: (event: SyntheticEvent, reason: AutocompleteCloseReason) => void;
|
|
16
|
+
handleScroll: (event: any) => Promise<void>;
|
|
17
|
+
state: MultiSelectState;
|
|
18
|
+
} & MultiSelectProps;
|
|
19
|
+
export declare const MultiFilter: ({ options, optionsApiEndPoint, optionsApiEndpointParams, externalAxios, required, label, name, getValue, value, onChange, error, helperText, dbValueProps, dbLabelProps, onOpen, onClose, searchDb, handleOpen, handleClose, handleScroll, state, disableClear, ...restProps }: MultiFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AutocompleteCloseReason } from '@mui/material';
|
|
2
|
+
import { SyntheticEvent } from 'react';
|
|
3
|
+
import { MultiSelectProps } from '../../../export';
|
|
4
|
+
import { MultiSelectState } from '../multiSelectReducer';
|
|
5
|
+
declare module '@mui/material/Autocomplete' {
|
|
6
|
+
interface AutocompletePaperSlotPropsOverrides {
|
|
7
|
+
loadingOptions: boolean;
|
|
8
|
+
isSearch: boolean;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export type MultiInputProps = {
|
|
12
|
+
onChange: (value: any) => void;
|
|
13
|
+
searchDb: (searchValue: string) => Promise<void>;
|
|
14
|
+
handleOpen: (event: SyntheticEvent) => Promise<void>;
|
|
15
|
+
handleClose: (event: SyntheticEvent, reason: AutocompleteCloseReason) => void;
|
|
16
|
+
handleScroll: (event: any) => Promise<void>;
|
|
17
|
+
state: MultiSelectState;
|
|
18
|
+
} & MultiSelectProps;
|
|
19
|
+
export declare const MultiInput: ({ required, optionsApiEndPoint, label, name, getValue, value, onChange, error, helperText, dbLabelProps, searchDb, handleOpen, handleClose, handleScroll, state, disableClear, ...restProps }: MultiInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Reducer } from 'react';
|
|
2
|
+
export declare enum MultiSelectActionsTypes {
|
|
3
|
+
OPEN = "open",
|
|
4
|
+
CLOSE = "close",
|
|
5
|
+
LOAD_INTERNAL_OPTIONS_START = "load_internal_options_start",
|
|
6
|
+
LOAD_INTERNAL_OPTIONS_END = "load_internal_options_end",
|
|
7
|
+
LOAD_SELECTED_OPTIONS_START = "load_selected_options_start",
|
|
8
|
+
LOAD_SELECTED_OPTIONS_END = "load_selected_options_end",
|
|
9
|
+
SET_NETWORK_ERROR = "set_network_error",
|
|
10
|
+
SET_INTERNAL_OPTIONS = "set_internal_options",
|
|
11
|
+
APPEND_INTERNAL_OPTIONS = "append_internal_options",
|
|
12
|
+
CHANGE_HAS_MORE_FLAG = "change_has_more_flag",
|
|
13
|
+
SET_SEARCH = "set_search",
|
|
14
|
+
CLEAR_SEARCH = "clear_search"
|
|
15
|
+
}
|
|
16
|
+
export type Option = {
|
|
17
|
+
label: string;
|
|
18
|
+
subLabel?: string;
|
|
19
|
+
value: any;
|
|
20
|
+
};
|
|
21
|
+
export type MultiSelectState = {
|
|
22
|
+
open: boolean;
|
|
23
|
+
loadingInternalOptions: boolean;
|
|
24
|
+
loadingInitialInternalOptions: boolean;
|
|
25
|
+
internalOptions: Option[];
|
|
26
|
+
internalOptionsMap: {
|
|
27
|
+
[x: string]: Option;
|
|
28
|
+
};
|
|
29
|
+
limit: number;
|
|
30
|
+
offset: number;
|
|
31
|
+
hasMore: boolean;
|
|
32
|
+
search: string | null;
|
|
33
|
+
error?: any;
|
|
34
|
+
};
|
|
35
|
+
export type MultiSelectAction = {
|
|
36
|
+
actionType: MultiSelectActionsTypes;
|
|
37
|
+
stateChanges?: Partial<MultiSelectState> & {
|
|
38
|
+
persistOffset?: boolean;
|
|
39
|
+
newOptions?: Option[];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare const multiSelectReducer: Reducer<MultiSelectState, MultiSelectAction>;
|
|
@@ -14,6 +14,7 @@ export * from './SearchBar/SearchBar';
|
|
|
14
14
|
export * from './Select/Select';
|
|
15
15
|
export * from './SingleCheckBox/SingleCheckBox';
|
|
16
16
|
export * from './SingleSelect/SingleSelect';
|
|
17
|
+
export * from './MultiSelect/MultiSelect';
|
|
17
18
|
export * from './Switch/Switch';
|
|
18
19
|
export * from './TextField/TextField';
|
|
19
20
|
export * from './TimePicker/TimePicker';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Meta } from '@storybook/react';
|
|
2
|
+
import { MultiSelect, MultiSelectProps } from '../../components/Input/MultiSelect/MultiSelect';
|
|
3
|
+
declare const _default: Meta<typeof MultiSelect>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Default: {
|
|
6
|
+
render: (args: MultiSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
args: {
|
|
8
|
+
label: string;
|
|
9
|
+
required: boolean;
|
|
10
|
+
options: {
|
|
11
|
+
label: string;
|
|
12
|
+
value: number;
|
|
13
|
+
}[];
|
|
14
|
+
onChange: () => void;
|
|
15
|
+
};
|
|
16
|
+
};
|