@topconsultnpm/sdkui-react 6.21.0-dev3.32 → 6.21.0-dev3.33
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.
|
@@ -4,10 +4,12 @@ interface ITMSpinner {
|
|
|
4
4
|
description?: string;
|
|
5
5
|
width?: string;
|
|
6
6
|
flat?: boolean;
|
|
7
|
+
onCancel?: () => void;
|
|
8
|
+
cancelText?: string;
|
|
7
9
|
}
|
|
8
|
-
declare const Spinner: ({ backgroundColor, description, fontSize, width, flat }: ITMSpinner) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare const Spinner: ({ backgroundColor, description, fontSize, width, flat, onCancel, cancelText }: ITMSpinner) => import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
declare class TMSpinner {
|
|
10
|
-
static show({ description, backgroundColor, fontSize, flat }?: ITMSpinner): void;
|
|
12
|
+
static show({ description, backgroundColor, fontSize, flat, onCancel, cancelText }?: ITMSpinner): void;
|
|
11
13
|
static hide(): void;
|
|
12
14
|
}
|
|
13
15
|
export { Spinner };
|
|
@@ -32,7 +32,7 @@ const StyledSpinnerWrapper = styled.div `
|
|
|
32
32
|
width: ${props => props.$width || 'fit-content'};
|
|
33
33
|
height: fit-content;
|
|
34
34
|
max-width: 250px;
|
|
35
|
-
max-height: 200px;
|
|
35
|
+
max-height: ${props => props.$hasCancel ? '280px' : '200px'};
|
|
36
36
|
padding: 10px;
|
|
37
37
|
border-radius: 5px;
|
|
38
38
|
background-color: ${props => props.$flat ? 'transparent' : '#fcfcfc'};
|
|
@@ -134,22 +134,49 @@ const StyledSpinnerAnimation = styled.div `
|
|
|
134
134
|
const StyledSpinnerDescription = styled.div `
|
|
135
135
|
font-size: ${props => props.$fontSize || FontSize.defaultFontSize};
|
|
136
136
|
text-align: center;
|
|
137
|
+
white-space: pre-line;
|
|
137
138
|
`;
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
// Pulsante Annulla sotto lo spinner
|
|
140
|
+
const StyledCancelButton = styled.button `
|
|
141
|
+
margin-top: 15px;
|
|
142
|
+
padding: 8px 20px;
|
|
143
|
+
font-size: 14px;
|
|
144
|
+
font-weight: 500;
|
|
145
|
+
color: #fff;
|
|
146
|
+
background-color: #d12a1c;
|
|
147
|
+
border: none;
|
|
148
|
+
border-radius: 5px;
|
|
149
|
+
cursor: pointer;
|
|
150
|
+
transition: background-color 0.2s ease, transform 0.1s ease;
|
|
151
|
+
|
|
152
|
+
&:hover {
|
|
153
|
+
background-color: #b8241a;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&:active {
|
|
157
|
+
transform: scale(0.98);
|
|
158
|
+
}
|
|
159
|
+
`;
|
|
160
|
+
const Spinner = ({ backgroundColor = 'transparent', description = '', fontSize = FontSize.defaultFontSize, width = 'fit-content', flat = false, onCancel, cancelText = 'Annulla' }) => {
|
|
161
|
+
return (_jsx(StyledSpinnerContainer, { "$backgroundColor": backgroundColor, children: _jsxs(StyledSpinnerWrapper, { "$width": width, "$flat": flat, "$hasCancel": !!onCancel, children: [_jsxs("div", { style: { position: 'relative', width: '80px', height: '80px' }, children: [_jsx("img", { style: {
|
|
140
162
|
position: 'absolute',
|
|
141
163
|
top: '50%',
|
|
142
164
|
left: '50%',
|
|
143
165
|
transform: 'translate(-54%, -54%)'
|
|
144
|
-
}, src: six, width: 35, alt: "" }), _jsxs(StyledSpinnerAnimation, { children: [_jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {})] })] }), _jsx(StyledSpinnerDescription, { "$fontSize": fontSize, children: description })] }) }));
|
|
166
|
+
}, src: six, width: 35, alt: "" }), _jsxs(StyledSpinnerAnimation, { children: [_jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {}), _jsx("div", {})] })] }), _jsx(StyledSpinnerDescription, { "$fontSize": fontSize, children: description }), onCancel && (_jsx(StyledCancelButton, { onClick: onCancel, children: cancelText }))] }) }));
|
|
145
167
|
};
|
|
146
168
|
class TMSpinner {
|
|
147
|
-
static show({ description, backgroundColor, fontSize, flat
|
|
169
|
+
static show({ description, backgroundColor, fontSize, flat, onCancel, cancelText } = {
|
|
170
|
+
backgroundColor: 'transparent',
|
|
171
|
+
description: '',
|
|
172
|
+
fontSize: FontSize.defaultFontSize,
|
|
173
|
+
flat: false
|
|
174
|
+
}) {
|
|
148
175
|
let container = document.createElement('div');
|
|
149
176
|
container.setAttribute("id", 'tm-spinner-temporary-container');
|
|
150
177
|
document.body.appendChild(container);
|
|
151
178
|
const root = ReactDOM.createRoot(container);
|
|
152
|
-
root.render(_jsx(React.StrictMode, { children: _jsx(Spinner, { backgroundColor: backgroundColor, fontSize: fontSize, description: description, flat: flat }) }));
|
|
179
|
+
root.render(_jsx(React.StrictMode, { children: _jsx(Spinner, { backgroundColor: backgroundColor, fontSize: fontSize, description: description, flat: flat, onCancel: onCancel, cancelText: cancelText }) }));
|
|
153
180
|
}
|
|
154
181
|
static hide() {
|
|
155
182
|
let container = document.getElementById('tm-spinner-temporary-container');
|