@myunisoft/design-system 1.2.4 → 1.2.5

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.
@@ -1,14 +1,11 @@
1
1
  import type React from 'react';
2
- import { type SxProps, type Theme } from '@mui/material';
3
- import type { OptionType } from '../index';
4
- export type AutocompleteTagProps = {
2
+ import { type ChipProps } from '@mui/material';
3
+ import type { OptionType } from '../types';
4
+ export type AutocompleteTagProps = ChipProps & {
5
5
  option?: OptionType;
6
- label?: string;
7
6
  maxChipWidth?: number;
8
7
  reserveForCounter?: number;
9
8
  isDisabled?: boolean;
10
- onDelete?: (event: MouseEvent) => void;
11
- sx?: SxProps<Theme>;
12
9
  };
13
10
  declare const AutocompleteTag: React.FC<AutocompleteTagProps>;
14
11
  export default AutocompleteTag;
@@ -1,52 +1,4 @@
1
- import React, { type ReactNode } from 'react';
2
- import { type ChipProps, type AutocompleteProps as MuiAutocompleteProps, type TextFieldVariants } from '@mui/material';
3
- import type { InputProps as StandardInputProps } from '@mui/material/Input/Input';
4
- export type OptionType = {
5
- id: string | number;
6
- label: string;
7
- /**
8
- * @deprecated Use value instead
9
- */
10
- selected?: boolean;
11
- disabled?: boolean;
12
- optionType?: 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
13
- };
14
- type SingleValueType<T> = T | null;
15
- type MultiValueType<T> = T[];
16
- type ValueType<T> = SingleValueType<T> | MultiValueType<T>;
17
- export type AutocompleteBaseProps<T extends OptionType = OptionType> = {
18
- label?: string;
19
- options?: T[];
20
- isError?: boolean;
21
- isDisplayLabel?: boolean;
22
- customSearch?: (inputValue: string, options: T[]) => T[];
23
- selectAllHidden?: boolean;
24
- selectAllLabel?: string;
25
- allSelectedLabel?: string;
26
- isDisabled?: boolean;
27
- oneRowMode?: true;
28
- InputProps?: StandardInputProps;
29
- onIsSearchingChange?: (isOpen: boolean) => void;
30
- getOptionLabel?: (option: T) => string;
31
- onCreate?: (label: string, options: T[]) => void;
32
- renderTag?: (tagProps: ChipProps, option: T) => ReactNode;
33
- renderOptionLabel?: (labelChild: ReactNode, option: T) => ReactNode;
34
- disableAllSelectedTag?: true;
35
- disableSort?: true;
36
- variant?: TextFieldVariants;
37
- isOptionEqualToValue?: (option: T, value: T) => boolean;
38
- placeholder?: string;
39
- };
40
- export type AutocompleteMultipleProps<T extends OptionType = OptionType> = Omit<MuiAutocompleteProps<T, true, false, false>, 'renderInput' | 'renderOption' | 'value' | 'multiple'> & AutocompleteBaseProps<T> & {
41
- multiple: true;
42
- value?: MultiValueType<T>;
43
- onChange?: (newValue: ValueType<T>) => void;
44
- };
45
- export type AutocompleteSingleProps<T extends OptionType = OptionType> = Omit<MuiAutocompleteProps<T, false, false, false>, 'renderInput' | 'renderOption' | 'value' | 'multiple'> & AutocompleteBaseProps<T> & {
46
- multiple?: false;
47
- value?: SingleValueType<T>;
48
- onChange?: (newValue: ValueType<T>) => void;
49
- };
50
- export type AutocompleteProps<T extends OptionType = OptionType> = AutocompleteMultipleProps<T> | AutocompleteSingleProps<T>;
51
- declare const Autocomplete: <T extends OptionType = OptionType>(inProps: AutocompleteProps<T>) => React.ReactElement;
1
+ import React from 'react';
2
+ import type { AutocompleteProps, OptionType } from './types';
3
+ declare const Autocomplete: <T = OptionType>(inProps: AutocompleteProps<T>) => React.ReactElement;
52
4
  export default Autocomplete;
@@ -0,0 +1,63 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { AutocompleteRenderOptionState, ChipProps, AutocompleteProps as MuiAutocompleteProps, TextFieldVariants } from '@mui/material';
3
+ import type { InputProps as StandardInputProps } from '@mui/material/Input/Input';
4
+ export type OptionType = {
5
+ id?: string | number;
6
+ label?: string;
7
+ /**
8
+ * @deprecated Use value instead
9
+ */
10
+ selected?: boolean;
11
+ disabled?: boolean;
12
+ optionType?: 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
13
+ };
14
+ export type SingleValueType<T> = T | null;
15
+ export type MultiValueType<T> = T[];
16
+ export type ValueType<T> = SingleValueType<T> | MultiValueType<T>;
17
+ export type AutocompleteBaseProps<T = OptionType> = {
18
+ label?: string;
19
+ options?: T[];
20
+ isError?: boolean;
21
+ isDisplayLabel?: boolean;
22
+ customSearch?: (inputValue: string, options: T[]) => T[];
23
+ selectAllHidden?: boolean;
24
+ selectAllLabel?: string;
25
+ allSelectedLabel?: string;
26
+ isDisabled?: boolean;
27
+ expandSelectedTagsOnEdition?: false;
28
+ InputProps?: StandardInputProps;
29
+ onIsSearchingChange?: (isOpen: boolean) => void;
30
+ getOptionLabel?: (option: T) => string;
31
+ onCreate?: (label: string, options: T[]) => void;
32
+ renderTag?: (tagProps: ChipProps, option: T) => ReactNode;
33
+ renderOptionLabel?: (labelChild: ReactNode, option: T) => ReactNode;
34
+ disableAllSelectedTag?: true;
35
+ disableSort?: true;
36
+ variant?: TextFieldVariants;
37
+ isOptionEqualToValue?: (option: T, value: T) => boolean;
38
+ placeholder?: string;
39
+ minListWidth?: number;
40
+ helperText?: string;
41
+ };
42
+ export type AutocompleteMultipleProps<T = OptionType> = Omit<MuiAutocompleteProps<T, true, false, false>, 'renderInput' | 'renderOption' | 'value' | 'multiple' | 'onChange'> & AutocompleteBaseProps<T> & {
43
+ multiple: true;
44
+ value?: MultiValueType<T>;
45
+ onChange?: (newValue: MultiValueType<T>) => void;
46
+ };
47
+ export type AutocompleteSingleProps<T = OptionType> = Omit<MuiAutocompleteProps<T, false, false, false>, 'renderInput' | 'renderOption' | 'value' | 'multiple' | 'onChange'> & AutocompleteBaseProps<T> & {
48
+ multiple?: false;
49
+ value?: SingleValueType<T>;
50
+ onChange?: (newValue: SingleValueType<T>) => void;
51
+ };
52
+ export type AutocompleteProps<T = OptionType> = AutocompleteMultipleProps<T> | AutocompleteSingleProps<T>;
53
+ export type ItemData<T = OptionType> = {
54
+ items: Array<{
55
+ key: number;
56
+ group: string;
57
+ children: React.ReactNode;
58
+ } | [React.ReactElement, T, AutocompleteRenderOptionState]>;
59
+ };
60
+ export type AutocompleteContextProps<T = OptionType> = {
61
+ renderOption: (props: React.HTMLAttributes<HTMLLIElement>, option: T, { selected }: AutocompleteRenderOptionState, inlineStyle: React.CSSProperties, currentValue: ValueType<T>) => React.ReactElement;
62
+ value: ValueType<T>;
63
+ };
@@ -2,7 +2,7 @@ declare const useStyles: (params: void, muiStyleOverridesParams?: {
2
2
  props: Record<string, unknown>;
3
3
  ownerState?: Record<string, unknown> | undefined;
4
4
  } | undefined) => {
5
- classes: Record<"fieldset" | "title" | "checkbox" | "root" | "actions" | "exportAllPage" | "checkboxLabel" | "switchButton", string>;
5
+ classes: Record<"fieldset" | "title" | "root" | "checkbox" | "actions" | "exportAllPage" | "checkboxLabel" | "switchButton", string>;
6
6
  theme: import("@mui/material/styles").Theme;
7
7
  css: import("tss-react/types").Css;
8
8
  cx: import("tss-react/types").Cx;
@@ -2,7 +2,7 @@ declare const useStyles: (params: void, muiStyleOverridesParams?: {
2
2
  props: Record<string, unknown>;
3
3
  ownerState?: Record<string, unknown> | undefined;
4
4
  } | undefined) => {
5
- classes: Record<"center" | "container" | "disabled" | "onError" | "align" | "checkbox" | "cell" | "pointer" | "alignLeft" | "alignCenter" | "alignRight" | "thumbnail" | "groupRow" | "cbCell" | "checkmark" | "BodyGrid" | "defaultStyle" | "lockRow" | "alignVerticalCenter" | "alignVerticalBottom" | "alignVerticalTop" | "selectedRow" | "hasSelectAll" | "HeaderGrid" | "GridRow" | "GridColumn" | "LeftSideGridContainer" | "LeftSideGrid" | "mb32" | "hoverRow" | "displayNone", string>;
5
+ classes: Record<"center" | "container" | "disabled" | "onError" | "align" | "cell" | "checkbox" | "pointer" | "alignLeft" | "alignCenter" | "alignRight" | "thumbnail" | "groupRow" | "cbCell" | "checkmark" | "BodyGrid" | "defaultStyle" | "lockRow" | "alignVerticalCenter" | "alignVerticalBottom" | "alignVerticalTop" | "selectedRow" | "hasSelectAll" | "HeaderGrid" | "GridRow" | "GridColumn" | "LeftSideGridContainer" | "LeftSideGrid" | "mb32" | "hoverRow" | "displayNone", string>;
6
6
  theme: import("@mui/material/styles").Theme;
7
7
  css: import("tss-react/types").Css;
8
8
  cx: import("tss-react/types").Cx;
package/dist/index.d.ts CHANGED
@@ -7,7 +7,6 @@ export { default as BackgroundLoader } from './components/BackgroundLoader';
7
7
  export { default as BadgeAdd } from './components/BadgeAdd';
8
8
  export { default as Checkbox } from './components/basics/Checkbox';
9
9
  export { default as ExpandButton } from './components/basics/ExpandButton';
10
- export { default as DocumentComposer } from './components/DocumentComposer';
11
10
  export * from './components/basics/Icon/';
12
11
  export * from './components/basics/Icon/Icons-material';
13
12
  export { default as Snackbar } from './components/basics/Snackbar';