@ttoss/components 1.20.0 → 1.21.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.
- package/dist/esm/index.js +34 -5
- package/dist/index.d.ts +5 -1
- package/dist/index.js +34 -6
- package/package.json +7 -6
- package/src/components/Modal/Modal.tsx +3 -2
- package/src/components/Toast/Toast.tsx +28 -0
- package/src/index.spec.tsx +2 -0
- package/src/index.ts +1 -0
package/dist/esm/index.js
CHANGED
|
@@ -125,7 +125,7 @@ ReactModal.defaultStyles = {
|
|
|
125
125
|
content: {}
|
|
126
126
|
};
|
|
127
127
|
var Modal = (props) => {
|
|
128
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
128
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
129
129
|
const { theme } = useTheme2();
|
|
130
130
|
const padding = useResponsiveValue([
|
|
131
131
|
(_a = theme.space) == null ? void 0 : _a[2],
|
|
@@ -147,7 +147,7 @@ var Modal = (props) => {
|
|
|
147
147
|
...(_d = props.style) == null ? void 0 : _d.overlay
|
|
148
148
|
},
|
|
149
149
|
content: {
|
|
150
|
-
|
|
150
|
+
backgroundColor: ((_f = (_e = theme.rawColors) == null ? void 0 : _e.background) == null ? void 0 : _f.toString()) || "#fff",
|
|
151
151
|
padding,
|
|
152
152
|
WebkitOverflowScrolling: "touch",
|
|
153
153
|
overflow: "auto",
|
|
@@ -156,11 +156,12 @@ var Modal = (props) => {
|
|
|
156
156
|
left: "0px",
|
|
157
157
|
right: "0px",
|
|
158
158
|
bottom: "0px",
|
|
159
|
-
border: "
|
|
159
|
+
border: "2px solid",
|
|
160
|
+
borderColor: ((_h = (_g = theme.rawColors) == null ? void 0 : _g.muted) == null ? void 0 : _h.toString()) || "#fff",
|
|
160
161
|
display: "flex",
|
|
161
162
|
flexDirection: "column",
|
|
162
163
|
alignItems: "center",
|
|
163
|
-
...(
|
|
164
|
+
...(_i = props.style) == null ? void 0 : _i.content
|
|
164
165
|
}
|
|
165
166
|
};
|
|
166
167
|
return /* @__PURE__ */ React.createElement(ReactModal, {
|
|
@@ -169,8 +170,36 @@ var Modal = (props) => {
|
|
|
169
170
|
});
|
|
170
171
|
};
|
|
171
172
|
Modal.setAppElement = ReactModal.setAppElement;
|
|
173
|
+
|
|
174
|
+
// src/components/Toast/Toast.tsx
|
|
175
|
+
import { Box as Box2 } from "@ttoss/ui";
|
|
176
|
+
import {
|
|
177
|
+
ToastContainer as ReactToastifyToastContainer,
|
|
178
|
+
ToastContainerProps,
|
|
179
|
+
toast
|
|
180
|
+
} from "react-toastify";
|
|
181
|
+
import "react-toastify/dist/ReactToastify.min.css";
|
|
182
|
+
var ToastContainer = (props) => {
|
|
183
|
+
return /* @__PURE__ */ React.createElement(Box2, {
|
|
184
|
+
sx: ({ colors, fonts }) => ({
|
|
185
|
+
"--toastify-color-light": "#fff",
|
|
186
|
+
"--toastify-color-dark": "#121212",
|
|
187
|
+
"--toastify-color-info": (colors == null ? void 0 : colors.info) || "#3498db",
|
|
188
|
+
"--toastify-color-success": (colors == null ? void 0 : colors.success) || "#07bc0c",
|
|
189
|
+
"--toastify-color-warning": "#f1c40f",
|
|
190
|
+
"--toastify-color-error": "#e74c3c",
|
|
191
|
+
"--toastify-color-progress-light": `linear-gradient(to right, ${colors == null ? void 0 : colors.primary}, ${colors == null ? void 0 : colors.secondary})`,
|
|
192
|
+
"--toastify-font-family": fonts.body
|
|
193
|
+
})
|
|
194
|
+
}, /* @__PURE__ */ React.createElement(ReactToastifyToastContainer, {
|
|
195
|
+
...props
|
|
196
|
+
}));
|
|
197
|
+
};
|
|
172
198
|
export {
|
|
173
199
|
Accordion,
|
|
174
200
|
InstallPwa,
|
|
175
|
-
Modal
|
|
201
|
+
Modal,
|
|
202
|
+
ToastContainer,
|
|
203
|
+
ToastContainerProps,
|
|
204
|
+
toast
|
|
176
205
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import * as react_accessible_accordion_dist_types_helpers_types from 'react-acce
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { BoxProps } from '@ttoss/ui';
|
|
6
6
|
import ReactModal from 'react-modal';
|
|
7
|
+
import { ToastContainerProps } from 'react-toastify';
|
|
8
|
+
export { ToastContainerProps, toast } from 'react-toastify';
|
|
7
9
|
|
|
8
10
|
declare type AccordionProps = BoxProps & {
|
|
9
11
|
allowMultipleExpanded?: boolean;
|
|
@@ -291,4 +293,6 @@ declare const Modal: {
|
|
|
291
293
|
setAppElement: typeof ReactModal.setAppElement;
|
|
292
294
|
};
|
|
293
295
|
|
|
294
|
-
|
|
296
|
+
declare const ToastContainer: (props: ToastContainerProps) => JSX.Element;
|
|
297
|
+
|
|
298
|
+
export { Accordion, AccordionProps, InstallPwa, Modal, ModalProps, ToastContainer };
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,10 @@ var src_exports = {};
|
|
|
25
25
|
__export(src_exports, {
|
|
26
26
|
Accordion: () => Accordion,
|
|
27
27
|
InstallPwa: () => InstallPwa,
|
|
28
|
-
Modal: () => Modal
|
|
28
|
+
Modal: () => Modal,
|
|
29
|
+
ToastContainer: () => ToastContainer,
|
|
30
|
+
ToastContainerProps: () => import_react_toastify.ToastContainerProps,
|
|
31
|
+
toast: () => import_react_toastify.toast
|
|
29
32
|
});
|
|
30
33
|
module.exports = __toCommonJS(src_exports);
|
|
31
34
|
|
|
@@ -148,7 +151,7 @@ import_react_modal.default.defaultStyles = {
|
|
|
148
151
|
content: {}
|
|
149
152
|
};
|
|
150
153
|
var Modal = (props) => {
|
|
151
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
154
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
152
155
|
const { theme } = (0, import_ui3.useTheme)();
|
|
153
156
|
const padding = (0, import_ui3.useResponsiveValue)([
|
|
154
157
|
(_a = theme.space) == null ? void 0 : _a[2],
|
|
@@ -170,7 +173,7 @@ var Modal = (props) => {
|
|
|
170
173
|
...(_d = props.style) == null ? void 0 : _d.overlay
|
|
171
174
|
},
|
|
172
175
|
content: {
|
|
173
|
-
|
|
176
|
+
backgroundColor: ((_f = (_e = theme.rawColors) == null ? void 0 : _e.background) == null ? void 0 : _f.toString()) || "#fff",
|
|
174
177
|
padding,
|
|
175
178
|
WebkitOverflowScrolling: "touch",
|
|
176
179
|
overflow: "auto",
|
|
@@ -179,11 +182,12 @@ var Modal = (props) => {
|
|
|
179
182
|
left: "0px",
|
|
180
183
|
right: "0px",
|
|
181
184
|
bottom: "0px",
|
|
182
|
-
border: "
|
|
185
|
+
border: "2px solid",
|
|
186
|
+
borderColor: ((_h = (_g = theme.rawColors) == null ? void 0 : _g.muted) == null ? void 0 : _h.toString()) || "#fff",
|
|
183
187
|
display: "flex",
|
|
184
188
|
flexDirection: "column",
|
|
185
189
|
alignItems: "center",
|
|
186
|
-
...(
|
|
190
|
+
...(_i = props.style) == null ? void 0 : _i.content
|
|
187
191
|
}
|
|
188
192
|
};
|
|
189
193
|
return /* @__PURE__ */ React.createElement(import_react_modal.default, {
|
|
@@ -192,9 +196,33 @@ var Modal = (props) => {
|
|
|
192
196
|
});
|
|
193
197
|
};
|
|
194
198
|
Modal.setAppElement = import_react_modal.default.setAppElement;
|
|
199
|
+
|
|
200
|
+
// src/components/Toast/Toast.tsx
|
|
201
|
+
var import_ui4 = require("@ttoss/ui");
|
|
202
|
+
var import_react_toastify = require("react-toastify");
|
|
203
|
+
var import_ReactToastify_min = require("react-toastify/dist/ReactToastify.min.css");
|
|
204
|
+
var ToastContainer = (props) => {
|
|
205
|
+
return /* @__PURE__ */ React.createElement(import_ui4.Box, {
|
|
206
|
+
sx: ({ colors, fonts }) => ({
|
|
207
|
+
"--toastify-color-light": "#fff",
|
|
208
|
+
"--toastify-color-dark": "#121212",
|
|
209
|
+
"--toastify-color-info": (colors == null ? void 0 : colors.info) || "#3498db",
|
|
210
|
+
"--toastify-color-success": (colors == null ? void 0 : colors.success) || "#07bc0c",
|
|
211
|
+
"--toastify-color-warning": "#f1c40f",
|
|
212
|
+
"--toastify-color-error": "#e74c3c",
|
|
213
|
+
"--toastify-color-progress-light": `linear-gradient(to right, ${colors == null ? void 0 : colors.primary}, ${colors == null ? void 0 : colors.secondary})`,
|
|
214
|
+
"--toastify-font-family": fonts.body
|
|
215
|
+
})
|
|
216
|
+
}, /* @__PURE__ */ React.createElement(import_react_toastify.ToastContainer, {
|
|
217
|
+
...props
|
|
218
|
+
}));
|
|
219
|
+
};
|
|
195
220
|
// Annotate the CommonJS export names for ESM import in node:
|
|
196
221
|
0 && (module.exports = {
|
|
197
222
|
Accordion,
|
|
198
223
|
InstallPwa,
|
|
199
|
-
Modal
|
|
224
|
+
Modal,
|
|
225
|
+
ToastContainer,
|
|
226
|
+
ToastContainerProps,
|
|
227
|
+
toast
|
|
200
228
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"description": "React components.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,18 +35,19 @@
|
|
|
35
35
|
"@theme-ui/css": "^0.14.7",
|
|
36
36
|
"@types/react-modal": "^3.13.1",
|
|
37
37
|
"react-accessible-accordion": "^5.0.0",
|
|
38
|
-
"react-modal": "^3.15.1"
|
|
38
|
+
"react-modal": "^3.15.1",
|
|
39
|
+
"react-toastify": "^9.0.8"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
41
42
|
"@ttoss/ui": "^1.16.5",
|
|
42
43
|
"react": ">=16.8.0"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@ttoss/config": "^1.
|
|
46
|
-
"@ttoss/test-utils": "^1.
|
|
47
|
-
"@ttoss/ui": "^1.
|
|
46
|
+
"@ttoss/config": "^1.17.0",
|
|
47
|
+
"@ttoss/test-utils": "^1.16.6",
|
|
48
|
+
"@ttoss/ui": "^1.19.0",
|
|
48
49
|
"@types/jest": "^28.1.5",
|
|
49
50
|
"jest": "^28.1.3"
|
|
50
51
|
},
|
|
51
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "bea31ace95128d57607156807e402a793b0c46e4"
|
|
52
53
|
}
|
|
@@ -36,7 +36,7 @@ export const Modal = (props: ModalProps) => {
|
|
|
36
36
|
/**
|
|
37
37
|
* Theme
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
backgroundColor: theme.rawColors?.background?.toString() || '#fff',
|
|
40
40
|
padding,
|
|
41
41
|
/**
|
|
42
42
|
* General
|
|
@@ -48,7 +48,8 @@ export const Modal = (props: ModalProps) => {
|
|
|
48
48
|
left: '0px',
|
|
49
49
|
right: '0px',
|
|
50
50
|
bottom: '0px',
|
|
51
|
-
border: '
|
|
51
|
+
border: '2px solid',
|
|
52
|
+
borderColor: theme.rawColors?.muted?.toString() || '#fff',
|
|
52
53
|
display: 'flex',
|
|
53
54
|
flexDirection: 'column',
|
|
54
55
|
alignItems: 'center',
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Box } from '@ttoss/ui';
|
|
2
|
+
import {
|
|
3
|
+
ToastContainer as ReactToastifyToastContainer,
|
|
4
|
+
ToastContainerProps,
|
|
5
|
+
toast,
|
|
6
|
+
} from 'react-toastify';
|
|
7
|
+
import 'react-toastify/dist/ReactToastify.min.css';
|
|
8
|
+
|
|
9
|
+
export { toast, ToastContainerProps };
|
|
10
|
+
|
|
11
|
+
export const ToastContainer = (props: ToastContainerProps) => {
|
|
12
|
+
return (
|
|
13
|
+
<Box
|
|
14
|
+
sx={({ colors, fonts }) => ({
|
|
15
|
+
'--toastify-color-light': '#fff',
|
|
16
|
+
'--toastify-color-dark': '#121212',
|
|
17
|
+
'--toastify-color-info': colors?.info || '#3498db',
|
|
18
|
+
'--toastify-color-success': colors?.success || '#07bc0c',
|
|
19
|
+
'--toastify-color-warning': '#f1c40f',
|
|
20
|
+
'--toastify-color-error': '#e74c3c',
|
|
21
|
+
'--toastify-color-progress-light': `linear-gradient(to right, ${colors?.primary}, ${colors?.secondary})`,
|
|
22
|
+
'--toastify-font-family': (fonts as { body: string }).body,
|
|
23
|
+
})}
|
|
24
|
+
>
|
|
25
|
+
<ReactToastifyToastContainer {...props} />
|
|
26
|
+
</Box>
|
|
27
|
+
);
|
|
28
|
+
};
|
package/src/index.spec.tsx
CHANGED
package/src/index.ts
CHANGED