@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.
Files changed (26) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/types/src/components/Assets/Icons/IconComponents/UpArrow.d.ts +5 -0
  3. package/dist/cjs/types/src/components/Assets/Icons/Icons.d.ts +1 -0
  4. package/dist/cjs/types/src/components/DataDisplay/Accordion/Accordion.d.ts +2 -1
  5. package/dist/cjs/types/src/components/Input/MultiSelect/MultiSelect.d.ts +47 -0
  6. package/dist/cjs/types/src/components/Input/MultiSelect/components/MenuFooter.d.ts +3 -0
  7. package/dist/cjs/types/src/components/Input/MultiSelect/components/MultiFilter.d.ts +19 -0
  8. package/dist/cjs/types/src/components/Input/MultiSelect/components/MultiInput.d.ts +19 -0
  9. package/dist/cjs/types/src/components/Input/MultiSelect/components/OptionsLoader.d.ts +3 -0
  10. package/dist/cjs/types/src/components/Input/MultiSelect/multiSelectReducer.d.ts +42 -0
  11. package/dist/cjs/types/src/components/Input/export.d.ts +1 -0
  12. package/dist/cjs/types/src/stories/Input/MultiSelect.stories.d.ts +16 -0
  13. package/dist/esm/index.js +2 -2
  14. package/dist/esm/types/src/components/Assets/Icons/IconComponents/UpArrow.d.ts +5 -0
  15. package/dist/esm/types/src/components/Assets/Icons/Icons.d.ts +1 -0
  16. package/dist/esm/types/src/components/DataDisplay/Accordion/Accordion.d.ts +2 -1
  17. package/dist/esm/types/src/components/Input/MultiSelect/MultiSelect.d.ts +47 -0
  18. package/dist/esm/types/src/components/Input/MultiSelect/components/MenuFooter.d.ts +3 -0
  19. package/dist/esm/types/src/components/Input/MultiSelect/components/MultiFilter.d.ts +19 -0
  20. package/dist/esm/types/src/components/Input/MultiSelect/components/MultiInput.d.ts +19 -0
  21. package/dist/esm/types/src/components/Input/MultiSelect/components/OptionsLoader.d.ts +3 -0
  22. package/dist/esm/types/src/components/Input/MultiSelect/multiSelectReducer.d.ts +42 -0
  23. package/dist/esm/types/src/components/Input/export.d.ts +1 -0
  24. package/dist/esm/types/src/stories/Input/MultiSelect.stories.d.ts +16 -0
  25. package/dist/index.d.ts +48 -2
  26. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ export declare const UpArrow: ({ size, disabled, onClick, }: {
2
+ size?: number;
3
+ disabled?: boolean;
4
+ onClick?: (e: React.MouseEvent<SVGSVGElement>) => void;
5
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -64,6 +64,7 @@ export type IconsType = {
64
64
  DocumentIcon: IconComponent;
65
65
  DoneSquare: IconComponent;
66
66
  DownArrow: IconComponent;
67
+ UpArrow: IconComponent;
67
68
  DownloadIcon: IconComponent;
68
69
  DFormsIcon: IconComponent;
69
70
  EditIcon: IconComponent;
@@ -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,3 @@
1
+ export declare const MenuFooter: ({ onClick }: {
2
+ onClick: () => void;
3
+ }) => 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 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,3 @@
1
+ export declare const OptionsLoader: ({ isSearch }: {
2
+ isSearch: boolean;
3
+ }) => 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
+ };