@webpros/mui-theme 0.4.1 → 0.4.3
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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright 2025 WebPros International GmbH. All rights reserved.
|
|
2
|
-
import {
|
|
2
|
+
import { dialogContentClasses, iconButtonClasses, } from '@mui/material';
|
|
3
3
|
export const getDialog = (theme) => {
|
|
4
4
|
const { spacing, colors } = theme;
|
|
5
5
|
const closeButtonPosition = {
|
|
@@ -28,24 +28,12 @@ export const getDialog = (theme) => {
|
|
|
28
28
|
},
|
|
29
29
|
styleOverrides: {
|
|
30
30
|
paper: {
|
|
31
|
-
|
|
31
|
+
minHeight: spacing(25),
|
|
32
32
|
backgroundColor: colors.schemes.surfaces.elevatedContainer,
|
|
33
33
|
[`& > .${iconButtonClasses.root}`]: closeButtonPosition,
|
|
34
34
|
[`& > .${iconButtonClasses.root} + .${dialogContentClasses.root}`]: {
|
|
35
35
|
paddingTop: spacing(5.125),
|
|
36
36
|
},
|
|
37
|
-
[`&.${dialogClasses.paperFullScreen}`]: {
|
|
38
|
-
borderRadius: 0,
|
|
39
|
-
maxWidth: 'none',
|
|
40
|
-
maxHeight: 'none',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
root: {
|
|
44
|
-
height: 'auto',
|
|
45
|
-
[`&.${modalClasses.root}.${dialogClasses.root} .${dialogClasses.paper}`]: {
|
|
46
|
-
height: 'auto',
|
|
47
|
-
minHeight: spacing(25),
|
|
48
|
-
},
|
|
49
37
|
},
|
|
50
38
|
},
|
|
51
39
|
},
|
|
@@ -2,12 +2,14 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
type ToggleButtonGroupProps = {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
multiple?: boolean;
|
|
5
|
+
value?: string | string[];
|
|
6
|
+
onToggle?: (value: string | string[]) => void;
|
|
5
7
|
};
|
|
6
8
|
export type ToggleContextType = {
|
|
7
9
|
value: string | Array<string>;
|
|
8
10
|
handleToggle: React.MouseEventHandler;
|
|
9
11
|
};
|
|
10
12
|
export declare const ToggleContext: import("react").Context<ToggleContextType>;
|
|
11
|
-
export declare const ToggleButtonGroup: ({ children, multiple }: ToggleButtonGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const ToggleButtonGroup: ({ children, multiple, value: controlledValue, onToggle, }: ToggleButtonGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
export type ToggleButtonGroupComponentType = typeof ToggleButtonGroup;
|
|
13
15
|
export {};
|
|
@@ -13,19 +13,24 @@ const toggleGroupSX = {
|
|
|
13
13
|
gap: 0.25,
|
|
14
14
|
width: 'fit-content',
|
|
15
15
|
};
|
|
16
|
-
export const ToggleButtonGroup = ({ children, multiple = false }) => {
|
|
17
|
-
const [
|
|
16
|
+
export const ToggleButtonGroup = ({ children, multiple = false, value: controlledValue, onToggle, }) => {
|
|
17
|
+
const [internalValue, setInternalValue] = useState(multiple ? [] : '');
|
|
18
|
+
const value = controlledValue !== null && controlledValue !== void 0 ? controlledValue : internalValue;
|
|
18
19
|
const handleToggle = (e) => {
|
|
19
20
|
const clickedValue = e.currentTarget.value;
|
|
21
|
+
let newValue;
|
|
20
22
|
if (Array.isArray(value)) {
|
|
21
|
-
|
|
23
|
+
newValue = value.includes(clickedValue)
|
|
22
24
|
? value.filter((item) => item !== clickedValue)
|
|
23
25
|
: [...value, clickedValue];
|
|
24
|
-
setValue(newValue);
|
|
25
26
|
}
|
|
26
27
|
else {
|
|
27
|
-
|
|
28
|
+
newValue = clickedValue;
|
|
28
29
|
}
|
|
30
|
+
if (controlledValue === undefined) {
|
|
31
|
+
setInternalValue(newValue);
|
|
32
|
+
}
|
|
33
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle(newValue);
|
|
29
34
|
e.currentTarget.blur();
|
|
30
35
|
};
|
|
31
36
|
const toggleContextValue = { value, handleToggle };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpros/mui-theme",
|
|
3
3
|
"description": "MUI v7 theme for WebPros products",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -123,4 +123,4 @@
|
|
|
123
123
|
"resolutions": {
|
|
124
124
|
"react-is": "^18.3.1"
|
|
125
125
|
}
|
|
126
|
-
}
|
|
126
|
+
}
|