@webpros/mui-theme 0.3.9 → 0.3.10
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/package.json +1 -1
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.js +1 -0
- package/dist/src/components/inputs/Button/Button.theme.js +2 -2
- package/dist/src/components/inputs/Fab/Fab.theme.js +1 -1
- package/dist/src/components/inputs/Filter/Filter.d.ts +14 -0
- package/dist/src/components/inputs/Filter/Filter.js +84 -0
- package/dist/src/components/inputs/Filter/index.d.ts +1 -0
- package/dist/src/components/inputs/Filter/index.js +2 -0
- package/dist/src/components/surfaces/Paper/Paper.theme.js +3 -0
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -17,11 +17,11 @@ export const getButton = (theme) => {
|
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
props: { size: 'medium' },
|
|
20
|
-
style: Object.assign(Object.assign({}, typography.
|
|
20
|
+
style: Object.assign(Object.assign({}, typography.LabelMediumProminent), { borderRadius: '17px', height: 34, padding: '7px 17px' }),
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
props: { size: 'large' },
|
|
24
|
-
style: Object.assign(Object.assign({}, typography.
|
|
24
|
+
style: Object.assign(Object.assign({}, typography.LabelLargeProminent), { borderRadius: '24px', height: 42, padding: '9px 24px' }),
|
|
25
25
|
},
|
|
26
26
|
];
|
|
27
27
|
const getStylesByColor = (color, viewContext) => {
|
|
@@ -4,7 +4,7 @@ export const getFab = (theme) => {
|
|
|
4
4
|
MuiFab: {
|
|
5
5
|
defaultProps: { color: 'primary' },
|
|
6
6
|
styleOverrides: {
|
|
7
|
-
root: Object.assign(Object.assign({}, typography.
|
|
7
|
+
root: Object.assign(Object.assign({}, typography.LabelMediumProminent), { width: 'auto', height: '42px', boxShadow: theme.shadows[2], borderRadius: '17px', textTransform: 'none', padding: 11, '&:active': {
|
|
8
8
|
boxShadow: `${theme.shadows[1]} !important`,
|
|
9
9
|
} }),
|
|
10
10
|
},
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AutocompleteProps, AutocompleteRenderInputParams } from '@mui/material';
|
|
2
|
+
export type FilterOption = {
|
|
3
|
+
label: string;
|
|
4
|
+
/** Nested options for inner menu (not implemented in UI yet) */
|
|
5
|
+
options?: FilterOption[];
|
|
6
|
+
/** If true, shows inner menu with multiple selection (not implemented in UI yet) */
|
|
7
|
+
multiple?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type FilterProps<T extends FilterOption = FilterOption> = Omit<AutocompleteProps<T, true, true, false>, 'multiple' | 'renderInput' | 'disableClearable'> & {
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
renderInput?: (params: AutocompleteRenderInputParams) => React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export declare const Filter: <T extends FilterOption = FilterOption>({ placeholder, size, filterSelectedOptions, renderInput, slotProps, sx, value, onChange, ...props }: FilterProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export type FilterComponentType = typeof Filter;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// Copyright 2025 WebPros International GmbH. All rights reserved.
|
|
4
|
+
import { useCallback } from 'react';
|
|
5
|
+
import { Autocomplete, Box, IconButton, TextField, autocompleteClasses, } from '@mui/material';
|
|
6
|
+
import { FunnelSimpleIcon, XIcon } from '@phosphor-icons/react';
|
|
7
|
+
const FILTER_SX = {
|
|
8
|
+
'& .MuiAutocomplete-inputRoot': {
|
|
9
|
+
flexWrap: 'nowrap',
|
|
10
|
+
gap: '4px',
|
|
11
|
+
minHeight: 34,
|
|
12
|
+
py: '1px !important',
|
|
13
|
+
pl: '6px !important',
|
|
14
|
+
},
|
|
15
|
+
'& .MuiAutocomplete-input': {
|
|
16
|
+
minWidth: '20px !important',
|
|
17
|
+
width: 0,
|
|
18
|
+
flex: '1 1 auto !important',
|
|
19
|
+
p: '0 !important',
|
|
20
|
+
},
|
|
21
|
+
'&:has(.MuiChip-root) .MuiAutocomplete-input': {
|
|
22
|
+
flex: '1 1 auto !important',
|
|
23
|
+
minWidth: '50px !important',
|
|
24
|
+
},
|
|
25
|
+
'& .MuiAutocomplete-endAdornment': {
|
|
26
|
+
display: 'none',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
const CHIPS_CONTAINER_SX = {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
minWidth: 0,
|
|
33
|
+
gap: '2px',
|
|
34
|
+
overflowX: 'auto',
|
|
35
|
+
overflowY: 'hidden',
|
|
36
|
+
scrollbarWidth: 'none',
|
|
37
|
+
'&::-webkit-scrollbar': {
|
|
38
|
+
display: 'none',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
const FILTER_ICON_SX = {
|
|
42
|
+
flexShrink: 0,
|
|
43
|
+
display: 'flex',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
};
|
|
46
|
+
const CLEAR_BUTTON_SX = {
|
|
47
|
+
flexShrink: 0,
|
|
48
|
+
ml: 'auto',
|
|
49
|
+
};
|
|
50
|
+
const CHIP_SX = {
|
|
51
|
+
p: '6px',
|
|
52
|
+
height: 'auto',
|
|
53
|
+
m: '0 !important',
|
|
54
|
+
flexShrink: 0,
|
|
55
|
+
maxWidth: 'none !important',
|
|
56
|
+
'& .MuiChip-label': {
|
|
57
|
+
p: 0,
|
|
58
|
+
overflow: 'visible',
|
|
59
|
+
textOverflow: 'clip',
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
const LISTBOX_SX = {
|
|
63
|
+
[`& .${autocompleteClasses.option}`]: {
|
|
64
|
+
minHeight: 32,
|
|
65
|
+
padding: '4px 12px',
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
export const Filter = (_a) => {
|
|
69
|
+
var { placeholder = 'Filter', size = 'small', filterSelectedOptions = true, renderInput, slotProps, sx, value, onChange } = _a, props = __rest(_a, ["placeholder", "size", "filterSelectedOptions", "renderInput", "slotProps", "sx", "value", "onChange"]);
|
|
70
|
+
const handleClear = useCallback(() => {
|
|
71
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null, [], 'clear');
|
|
72
|
+
}, [onChange]);
|
|
73
|
+
const defaultRenderInput = useCallback((params) => {
|
|
74
|
+
var _a;
|
|
75
|
+
const chips = (_a = params.InputProps) === null || _a === void 0 ? void 0 : _a.startAdornment;
|
|
76
|
+
return (_jsx(TextField, Object.assign({}, params, { placeholder: placeholder, slotProps: {
|
|
77
|
+
input: Object.assign(Object.assign({}, params.InputProps), { startAdornment: (_jsxs(_Fragment, { children: [_jsx(Box, { sx: FILTER_ICON_SX, children: _jsx(FunnelSimpleIcon, { size: 20 }) }), _jsx(Box, { sx: CHIPS_CONTAINER_SX, children: chips })] })), endAdornment: chips ? (_jsx(IconButton, { size: "small", onClick: handleClear, sx: CLEAR_BUTTON_SX, "aria-label": "Clear", children: _jsx(XIcon, { size: 16 }) })) : null }),
|
|
78
|
+
} })));
|
|
79
|
+
}, [placeholder, handleClear]);
|
|
80
|
+
return (_jsx(Autocomplete, Object.assign({}, props, { multiple: true, size: size, value: value, onChange: onChange, filterSelectedOptions: filterSelectedOptions, forcePopupIcon: false, disableClearable: true, renderInput: renderInput !== null && renderInput !== void 0 ? renderInput : defaultRenderInput, slotProps: Object.assign(Object.assign({}, slotProps), { chip: {
|
|
81
|
+
size: 'small',
|
|
82
|
+
sx: CHIP_SX,
|
|
83
|
+
}, listbox: Object.assign(Object.assign({}, slotProps === null || slotProps === void 0 ? void 0 : slotProps.listbox), { sx: LISTBOX_SX }) }), sx: Object.assign(Object.assign({}, FILTER_SX), sx) })));
|
|
84
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Filter';
|