@ttoss/components 1.19.0 → 1.21.1
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 +61 -20
- package/dist/index.d.ts +173 -170
- package/dist/index.js +58 -18
- package/package.json +9 -6
- package/src/components/Accordion/Accordion.tsx +26 -21
- package/src/components/Modal/Modal.tsx +3 -2
- package/src/components/Toast/Toast.tsx +33 -0
- package/src/index.spec.tsx +2 -0
- package/src/index.ts +1 -0
- package/src/components/Accordion/Accordion.docs.md +0 -57
- package/src/components/Modal/Modal.docs.md +0 -56
package/dist/esm/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
|
|
6
6
|
// src/components/Accordion/Accordion.tsx
|
|
7
|
+
import * as React2 from "react";
|
|
7
8
|
import {
|
|
8
9
|
AccordionItem,
|
|
9
10
|
AccordionItemButton,
|
|
@@ -11,7 +12,9 @@ import {
|
|
|
11
12
|
AccordionItemPanel,
|
|
12
13
|
Accordion as ReactAccessibleAccordion
|
|
13
14
|
} from "react-accessible-accordion";
|
|
14
|
-
import { Box } from "@ttoss/ui";
|
|
15
|
+
import { Box, useTheme } from "@ttoss/ui";
|
|
16
|
+
import { css as createClassName } from "@emotion/css";
|
|
17
|
+
import { css as transformStyleObject } from "@theme-ui/css";
|
|
15
18
|
var Accordion = ({
|
|
16
19
|
children,
|
|
17
20
|
allowMultipleExpanded,
|
|
@@ -20,9 +23,9 @@ var Accordion = ({
|
|
|
20
23
|
onChange,
|
|
21
24
|
...boxProps
|
|
22
25
|
}) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
const { theme } = useTheme();
|
|
27
|
+
const className = React2.useMemo(() => {
|
|
28
|
+
const styles = transformStyleObject({
|
|
26
29
|
".accordion__item": {
|
|
27
30
|
marginBottom: 3
|
|
28
31
|
},
|
|
@@ -34,10 +37,15 @@ var Accordion = ({
|
|
|
34
37
|
".accordion__button": {},
|
|
35
38
|
".accordion__panel": {
|
|
36
39
|
padding: 2
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
40
|
+
}
|
|
41
|
+
})(theme);
|
|
42
|
+
return createClassName(styles);
|
|
43
|
+
}, [theme]);
|
|
44
|
+
return /* @__PURE__ */ React2.createElement(Box, {
|
|
45
|
+
variant: "accordion",
|
|
46
|
+
className,
|
|
47
|
+
...boxProps
|
|
48
|
+
}, /* @__PURE__ */ React2.createElement(ReactAccessibleAccordion, {
|
|
41
49
|
...{
|
|
42
50
|
allowMultipleExpanded,
|
|
43
51
|
allowZeroExpanded,
|
|
@@ -52,7 +60,7 @@ Accordion.ItemHeading = AccordionItemHeading;
|
|
|
52
60
|
Accordion.ItemPanel = AccordionItemPanel;
|
|
53
61
|
|
|
54
62
|
// src/components/InstallPwa/InstallPwa.tsx
|
|
55
|
-
import * as
|
|
63
|
+
import * as React3 from "react";
|
|
56
64
|
|
|
57
65
|
// src/components/InstallPwa/InstallPwaUi.tsx
|
|
58
66
|
import { Button, Flex, Text } from "@ttoss/ui";
|
|
@@ -83,9 +91,9 @@ var InstallPwaUi = ({ onInstall }) => {
|
|
|
83
91
|
|
|
84
92
|
// src/components/InstallPwa/InstallPwa.tsx
|
|
85
93
|
var InstallPwa = () => {
|
|
86
|
-
const [supportsPwa, setSupportsPwa] =
|
|
87
|
-
const [promptInstall, setPromptInstall] =
|
|
88
|
-
|
|
94
|
+
const [supportsPwa, setSupportsPwa] = React3.useState(false);
|
|
95
|
+
const [promptInstall, setPromptInstall] = React3.useState(null);
|
|
96
|
+
React3.useEffect(() => {
|
|
89
97
|
const handler = (e) => {
|
|
90
98
|
e.preventDefault();
|
|
91
99
|
setSupportsPwa(true);
|
|
@@ -104,21 +112,21 @@ var InstallPwa = () => {
|
|
|
104
112
|
if (!supportsPwa) {
|
|
105
113
|
return null;
|
|
106
114
|
}
|
|
107
|
-
return /* @__PURE__ */
|
|
115
|
+
return /* @__PURE__ */ React3.createElement(InstallPwaUi, {
|
|
108
116
|
onInstall
|
|
109
117
|
});
|
|
110
118
|
};
|
|
111
119
|
|
|
112
120
|
// src/components/Modal/Modal.tsx
|
|
113
|
-
import { useResponsiveValue, useTheme } from "@ttoss/ui";
|
|
121
|
+
import { useResponsiveValue, useTheme as useTheme2 } from "@ttoss/ui";
|
|
114
122
|
import ReactModal from "react-modal";
|
|
115
123
|
ReactModal.defaultStyles = {
|
|
116
124
|
overlay: {},
|
|
117
125
|
content: {}
|
|
118
126
|
};
|
|
119
127
|
var Modal = (props) => {
|
|
120
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
121
|
-
const { theme } =
|
|
128
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
129
|
+
const { theme } = useTheme2();
|
|
122
130
|
const padding = useResponsiveValue([
|
|
123
131
|
(_a = theme.space) == null ? void 0 : _a[2],
|
|
124
132
|
(_b = theme.space) == null ? void 0 : _b[3],
|
|
@@ -139,7 +147,7 @@ var Modal = (props) => {
|
|
|
139
147
|
...(_d = props.style) == null ? void 0 : _d.overlay
|
|
140
148
|
},
|
|
141
149
|
content: {
|
|
142
|
-
|
|
150
|
+
backgroundColor: ((_f = (_e = theme.rawColors) == null ? void 0 : _e.background) == null ? void 0 : _f.toString()) || "#fff",
|
|
143
151
|
padding,
|
|
144
152
|
WebkitOverflowScrolling: "touch",
|
|
145
153
|
overflow: "auto",
|
|
@@ -148,11 +156,12 @@ var Modal = (props) => {
|
|
|
148
156
|
left: "0px",
|
|
149
157
|
right: "0px",
|
|
150
158
|
bottom: "0px",
|
|
151
|
-
border: "
|
|
159
|
+
border: "2px solid",
|
|
160
|
+
borderColor: ((_h = (_g = theme.rawColors) == null ? void 0 : _g.muted) == null ? void 0 : _h.toString()) || "#fff",
|
|
152
161
|
display: "flex",
|
|
153
162
|
flexDirection: "column",
|
|
154
163
|
alignItems: "center",
|
|
155
|
-
...(
|
|
164
|
+
...(_i = props.style) == null ? void 0 : _i.content
|
|
156
165
|
}
|
|
157
166
|
};
|
|
158
167
|
return /* @__PURE__ */ React.createElement(ReactModal, {
|
|
@@ -161,8 +170,40 @@ var Modal = (props) => {
|
|
|
161
170
|
});
|
|
162
171
|
};
|
|
163
172
|
Modal.setAppElement = ReactModal.setAppElement;
|
|
173
|
+
|
|
174
|
+
// src/components/Toast/Toast.tsx
|
|
175
|
+
import * as React4 from "react";
|
|
176
|
+
import { Box as Box2 } from "@ttoss/ui";
|
|
177
|
+
import {
|
|
178
|
+
ToastContainer as ReactToastifyToastContainer,
|
|
179
|
+
ToastContainerProps,
|
|
180
|
+
toast
|
|
181
|
+
} from "react-toastify";
|
|
182
|
+
import { injectStyle } from "react-toastify/dist/inject-style";
|
|
183
|
+
var ToastContainer = (props) => {
|
|
184
|
+
React4.useEffect(() => {
|
|
185
|
+
injectStyle();
|
|
186
|
+
}, []);
|
|
187
|
+
return /* @__PURE__ */ React4.createElement(Box2, {
|
|
188
|
+
sx: ({ colors, fonts }) => ({
|
|
189
|
+
"--toastify-color-light": "#fff",
|
|
190
|
+
"--toastify-color-dark": "#121212",
|
|
191
|
+
"--toastify-color-info": (colors == null ? void 0 : colors.info) || "#3498db",
|
|
192
|
+
"--toastify-color-success": (colors == null ? void 0 : colors.success) || "#07bc0c",
|
|
193
|
+
"--toastify-color-warning": "#f1c40f",
|
|
194
|
+
"--toastify-color-error": "#e74c3c",
|
|
195
|
+
"--toastify-color-progress-light": `linear-gradient(to right, ${colors == null ? void 0 : colors.primary}, ${colors == null ? void 0 : colors.secondary})`,
|
|
196
|
+
"--toastify-font-family": fonts.body
|
|
197
|
+
})
|
|
198
|
+
}, /* @__PURE__ */ React4.createElement(ReactToastifyToastContainer, {
|
|
199
|
+
...props
|
|
200
|
+
}));
|
|
201
|
+
};
|
|
164
202
|
export {
|
|
165
203
|
Accordion,
|
|
166
204
|
InstallPwa,
|
|
167
|
-
Modal
|
|
205
|
+
Modal,
|
|
206
|
+
ToastContainer,
|
|
207
|
+
ToastContainerProps,
|
|
208
|
+
toast
|
|
168
209
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
1
|
import * as react_accessible_accordion_dist_types_helpers_DisplayName from 'react-accessible-accordion/dist/types/helpers/DisplayName';
|
|
3
2
|
import * as react_accessible_accordion_dist_types_components_ItemContext from 'react-accessible-accordion/dist/types/components/ItemContext';
|
|
4
3
|
import * as react_accessible_accordion_dist_types_helpers_types from 'react-accessible-accordion/dist/types/helpers/types';
|
|
5
|
-
import * as
|
|
4
|
+
import * as React from 'react';
|
|
6
5
|
import { BoxProps } from '@ttoss/ui';
|
|
7
6
|
import ReactModal from 'react-modal';
|
|
7
|
+
import { ToastContainerProps } from 'react-toastify';
|
|
8
|
+
export { ToastContainerProps, toast } from 'react-toastify';
|
|
8
9
|
|
|
9
10
|
declare type AccordionProps = BoxProps & {
|
|
10
11
|
allowMultipleExpanded?: boolean;
|
|
@@ -16,7 +17,7 @@ declare type AccordionProps = BoxProps & {
|
|
|
16
17
|
onChange?: (args: string[]) => void;
|
|
17
18
|
};
|
|
18
19
|
declare const Accordion: {
|
|
19
|
-
({ children, allowMultipleExpanded, allowZeroExpanded, preExpanded, onChange, ...boxProps }: AccordionProps):
|
|
20
|
+
({ children, allowMultipleExpanded, allowZeroExpanded, preExpanded, onChange, ...boxProps }: AccordionProps): JSX.Element;
|
|
20
21
|
Item: {
|
|
21
22
|
({ uuid: customUuid, dangerouslySetExpanded, className, activeClassName, ...rest }: react_accessible_accordion_dist_types_helpers_types.DivAttributes & {
|
|
22
23
|
uuid?: react_accessible_accordion_dist_types_components_ItemContext.ID | undefined;
|
|
@@ -25,10 +26,10 @@ declare const Accordion: {
|
|
|
25
26
|
}): JSX.Element;
|
|
26
27
|
displayName: react_accessible_accordion_dist_types_helpers_DisplayName.default;
|
|
27
28
|
};
|
|
28
|
-
ItemButton:
|
|
29
|
-
children?:
|
|
29
|
+
ItemButton: React.FC<{
|
|
30
|
+
children?: React.ReactNode;
|
|
30
31
|
slot?: string | undefined;
|
|
31
|
-
style?:
|
|
32
|
+
style?: React.CSSProperties | undefined;
|
|
32
33
|
title?: string | undefined;
|
|
33
34
|
defaultChecked?: boolean | undefined;
|
|
34
35
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
@@ -70,7 +71,7 @@ declare const Accordion: {
|
|
|
70
71
|
is?: string | undefined;
|
|
71
72
|
'aria-activedescendant'?: string | undefined;
|
|
72
73
|
'aria-atomic'?: (boolean | "true" | "false") | undefined;
|
|
73
|
-
'aria-autocomplete'?: "list" | "none" | "
|
|
74
|
+
'aria-autocomplete'?: "list" | "none" | "both" | "inline" | undefined;
|
|
74
75
|
'aria-busy'?: (boolean | "true" | "false") | undefined;
|
|
75
76
|
'aria-checked'?: boolean | "true" | "false" | "mixed" | undefined;
|
|
76
77
|
'aria-colcount'?: number | undefined;
|
|
@@ -79,7 +80,7 @@ declare const Accordion: {
|
|
|
79
80
|
'aria-current'?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
|
|
80
81
|
'aria-describedby'?: string | undefined;
|
|
81
82
|
'aria-details'?: string | undefined;
|
|
82
|
-
'aria-dropeffect'?: "link" | "none" | "copy" | "
|
|
83
|
+
'aria-dropeffect'?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
|
|
83
84
|
'aria-errormessage'?: string | undefined;
|
|
84
85
|
'aria-flowto'?: string | undefined;
|
|
85
86
|
'aria-grabbed'?: (boolean | "true" | "false") | undefined;
|
|
@@ -116,168 +117,168 @@ declare const Accordion: {
|
|
|
116
117
|
dangerouslySetInnerHTML?: {
|
|
117
118
|
__html: string;
|
|
118
119
|
} | undefined;
|
|
119
|
-
onCopy?:
|
|
120
|
-
onCopyCapture?:
|
|
121
|
-
onCut?:
|
|
122
|
-
onCutCapture?:
|
|
123
|
-
onPaste?:
|
|
124
|
-
onPasteCapture?:
|
|
125
|
-
onCompositionEnd?:
|
|
126
|
-
onCompositionEndCapture?:
|
|
127
|
-
onCompositionStart?:
|
|
128
|
-
onCompositionStartCapture?:
|
|
129
|
-
onCompositionUpdate?:
|
|
130
|
-
onCompositionUpdateCapture?:
|
|
131
|
-
onFocus?:
|
|
132
|
-
onFocusCapture?:
|
|
133
|
-
onBlur?:
|
|
134
|
-
onBlurCapture?:
|
|
135
|
-
onChange?:
|
|
136
|
-
onChangeCapture?:
|
|
137
|
-
onBeforeInput?:
|
|
138
|
-
onBeforeInputCapture?:
|
|
139
|
-
onInput?:
|
|
140
|
-
onInputCapture?:
|
|
141
|
-
onReset?:
|
|
142
|
-
onResetCapture?:
|
|
143
|
-
onSubmit?:
|
|
144
|
-
onSubmitCapture?:
|
|
145
|
-
onInvalid?:
|
|
146
|
-
onInvalidCapture?:
|
|
147
|
-
onLoad?:
|
|
148
|
-
onLoadCapture?:
|
|
149
|
-
onError?:
|
|
150
|
-
onErrorCapture?:
|
|
151
|
-
onKeyDown?:
|
|
152
|
-
onKeyDownCapture?:
|
|
153
|
-
onKeyPress?:
|
|
154
|
-
onKeyPressCapture?:
|
|
155
|
-
onKeyUp?:
|
|
156
|
-
onKeyUpCapture?:
|
|
157
|
-
onAbort?:
|
|
158
|
-
onAbortCapture?:
|
|
159
|
-
onCanPlay?:
|
|
160
|
-
onCanPlayCapture?:
|
|
161
|
-
onCanPlayThrough?:
|
|
162
|
-
onCanPlayThroughCapture?:
|
|
163
|
-
onDurationChange?:
|
|
164
|
-
onDurationChangeCapture?:
|
|
165
|
-
onEmptied?:
|
|
166
|
-
onEmptiedCapture?:
|
|
167
|
-
onEncrypted?:
|
|
168
|
-
onEncryptedCapture?:
|
|
169
|
-
onEnded?:
|
|
170
|
-
onEndedCapture?:
|
|
171
|
-
onLoadedData?:
|
|
172
|
-
onLoadedDataCapture?:
|
|
173
|
-
onLoadedMetadata?:
|
|
174
|
-
onLoadedMetadataCapture?:
|
|
175
|
-
onLoadStart?:
|
|
176
|
-
onLoadStartCapture?:
|
|
177
|
-
onPause?:
|
|
178
|
-
onPauseCapture?:
|
|
179
|
-
onPlay?:
|
|
180
|
-
onPlayCapture?:
|
|
181
|
-
onPlaying?:
|
|
182
|
-
onPlayingCapture?:
|
|
183
|
-
onProgress?:
|
|
184
|
-
onProgressCapture?:
|
|
185
|
-
onRateChange?:
|
|
186
|
-
onRateChangeCapture?:
|
|
187
|
-
onSeeked?:
|
|
188
|
-
onSeekedCapture?:
|
|
189
|
-
onSeeking?:
|
|
190
|
-
onSeekingCapture?:
|
|
191
|
-
onStalled?:
|
|
192
|
-
onStalledCapture?:
|
|
193
|
-
onSuspend?:
|
|
194
|
-
onSuspendCapture?:
|
|
195
|
-
onTimeUpdate?:
|
|
196
|
-
onTimeUpdateCapture?:
|
|
197
|
-
onVolumeChange?:
|
|
198
|
-
onVolumeChangeCapture?:
|
|
199
|
-
onWaiting?:
|
|
200
|
-
onWaitingCapture?:
|
|
201
|
-
onAuxClick?:
|
|
202
|
-
onAuxClickCapture?:
|
|
203
|
-
onClick?:
|
|
204
|
-
onClickCapture?:
|
|
205
|
-
onContextMenu?:
|
|
206
|
-
onContextMenuCapture?:
|
|
207
|
-
onDoubleClick?:
|
|
208
|
-
onDoubleClickCapture?:
|
|
209
|
-
onDrag?:
|
|
210
|
-
onDragCapture?:
|
|
211
|
-
onDragEnd?:
|
|
212
|
-
onDragEndCapture?:
|
|
213
|
-
onDragEnter?:
|
|
214
|
-
onDragEnterCapture?:
|
|
215
|
-
onDragExit?:
|
|
216
|
-
onDragExitCapture?:
|
|
217
|
-
onDragLeave?:
|
|
218
|
-
onDragLeaveCapture?:
|
|
219
|
-
onDragOver?:
|
|
220
|
-
onDragOverCapture?:
|
|
221
|
-
onDragStart?:
|
|
222
|
-
onDragStartCapture?:
|
|
223
|
-
onDrop?:
|
|
224
|
-
onDropCapture?:
|
|
225
|
-
onMouseDown?:
|
|
226
|
-
onMouseDownCapture?:
|
|
227
|
-
onMouseEnter?:
|
|
228
|
-
onMouseLeave?:
|
|
229
|
-
onMouseMove?:
|
|
230
|
-
onMouseMoveCapture?:
|
|
231
|
-
onMouseOut?:
|
|
232
|
-
onMouseOutCapture?:
|
|
233
|
-
onMouseOver?:
|
|
234
|
-
onMouseOverCapture?:
|
|
235
|
-
onMouseUp?:
|
|
236
|
-
onMouseUpCapture?:
|
|
237
|
-
onSelect?:
|
|
238
|
-
onSelectCapture?:
|
|
239
|
-
onTouchCancel?:
|
|
240
|
-
onTouchCancelCapture?:
|
|
241
|
-
onTouchEnd?:
|
|
242
|
-
onTouchEndCapture?:
|
|
243
|
-
onTouchMove?:
|
|
244
|
-
onTouchMoveCapture?:
|
|
245
|
-
onTouchStart?:
|
|
246
|
-
onTouchStartCapture?:
|
|
247
|
-
onPointerDown?:
|
|
248
|
-
onPointerDownCapture?:
|
|
249
|
-
onPointerMove?:
|
|
250
|
-
onPointerMoveCapture?:
|
|
251
|
-
onPointerUp?:
|
|
252
|
-
onPointerUpCapture?:
|
|
253
|
-
onPointerCancel?:
|
|
254
|
-
onPointerCancelCapture?:
|
|
255
|
-
onPointerEnter?:
|
|
256
|
-
onPointerEnterCapture?:
|
|
257
|
-
onPointerLeave?:
|
|
258
|
-
onPointerLeaveCapture?:
|
|
259
|
-
onPointerOver?:
|
|
260
|
-
onPointerOverCapture?:
|
|
261
|
-
onPointerOut?:
|
|
262
|
-
onPointerOutCapture?:
|
|
263
|
-
onGotPointerCapture?:
|
|
264
|
-
onGotPointerCaptureCapture?:
|
|
265
|
-
onLostPointerCapture?:
|
|
266
|
-
onLostPointerCaptureCapture?:
|
|
267
|
-
onScroll?:
|
|
268
|
-
onScrollCapture?:
|
|
269
|
-
onWheel?:
|
|
270
|
-
onWheelCapture?:
|
|
271
|
-
onAnimationStart?:
|
|
272
|
-
onAnimationStartCapture?:
|
|
273
|
-
onAnimationEnd?:
|
|
274
|
-
onAnimationEndCapture?:
|
|
275
|
-
onAnimationIteration?:
|
|
276
|
-
onAnimationIterationCapture?:
|
|
277
|
-
onTransitionEnd?:
|
|
278
|
-
onTransitionEndCapture?:
|
|
120
|
+
onCopy?: React.ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
121
|
+
onCopyCapture?: React.ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
122
|
+
onCut?: React.ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
123
|
+
onCutCapture?: React.ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
124
|
+
onPaste?: React.ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
125
|
+
onPasteCapture?: React.ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
126
|
+
onCompositionEnd?: React.CompositionEventHandler<HTMLDivElement> | undefined;
|
|
127
|
+
onCompositionEndCapture?: React.CompositionEventHandler<HTMLDivElement> | undefined;
|
|
128
|
+
onCompositionStart?: React.CompositionEventHandler<HTMLDivElement> | undefined;
|
|
129
|
+
onCompositionStartCapture?: React.CompositionEventHandler<HTMLDivElement> | undefined;
|
|
130
|
+
onCompositionUpdate?: React.CompositionEventHandler<HTMLDivElement> | undefined;
|
|
131
|
+
onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLDivElement> | undefined;
|
|
132
|
+
onFocus?: React.FocusEventHandler<HTMLDivElement> | undefined;
|
|
133
|
+
onFocusCapture?: React.FocusEventHandler<HTMLDivElement> | undefined;
|
|
134
|
+
onBlur?: React.FocusEventHandler<HTMLDivElement> | undefined;
|
|
135
|
+
onBlurCapture?: React.FocusEventHandler<HTMLDivElement> | undefined;
|
|
136
|
+
onChange?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
137
|
+
onChangeCapture?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
138
|
+
onBeforeInput?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
139
|
+
onBeforeInputCapture?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
140
|
+
onInput?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
141
|
+
onInputCapture?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
142
|
+
onReset?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
143
|
+
onResetCapture?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
144
|
+
onSubmit?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
145
|
+
onSubmitCapture?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
146
|
+
onInvalid?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
147
|
+
onInvalidCapture?: React.FormEventHandler<HTMLDivElement> | undefined;
|
|
148
|
+
onLoad?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
149
|
+
onLoadCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
150
|
+
onError?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
151
|
+
onErrorCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
152
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
153
|
+
onKeyDownCapture?: React.KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
154
|
+
onKeyPress?: React.KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
155
|
+
onKeyPressCapture?: React.KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
156
|
+
onKeyUp?: React.KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
157
|
+
onKeyUpCapture?: React.KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
158
|
+
onAbort?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
159
|
+
onAbortCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
160
|
+
onCanPlay?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
161
|
+
onCanPlayCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
162
|
+
onCanPlayThrough?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
163
|
+
onCanPlayThroughCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
164
|
+
onDurationChange?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
165
|
+
onDurationChangeCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
166
|
+
onEmptied?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
167
|
+
onEmptiedCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
168
|
+
onEncrypted?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
169
|
+
onEncryptedCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
170
|
+
onEnded?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
171
|
+
onEndedCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
172
|
+
onLoadedData?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
173
|
+
onLoadedDataCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
174
|
+
onLoadedMetadata?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
175
|
+
onLoadedMetadataCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
176
|
+
onLoadStart?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
177
|
+
onLoadStartCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
178
|
+
onPause?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
179
|
+
onPauseCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
180
|
+
onPlay?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
181
|
+
onPlayCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
182
|
+
onPlaying?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
183
|
+
onPlayingCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
184
|
+
onProgress?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
185
|
+
onProgressCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
186
|
+
onRateChange?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
187
|
+
onRateChangeCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
188
|
+
onSeeked?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
189
|
+
onSeekedCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
190
|
+
onSeeking?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
191
|
+
onSeekingCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
192
|
+
onStalled?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
193
|
+
onStalledCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
194
|
+
onSuspend?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
195
|
+
onSuspendCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
196
|
+
onTimeUpdate?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
197
|
+
onTimeUpdateCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
198
|
+
onVolumeChange?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
199
|
+
onVolumeChangeCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
200
|
+
onWaiting?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
201
|
+
onWaitingCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
202
|
+
onAuxClick?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
203
|
+
onAuxClickCapture?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
204
|
+
onClick?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
205
|
+
onClickCapture?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
206
|
+
onContextMenu?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
207
|
+
onContextMenuCapture?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
208
|
+
onDoubleClick?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
209
|
+
onDoubleClickCapture?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
210
|
+
onDrag?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
211
|
+
onDragCapture?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
212
|
+
onDragEnd?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
213
|
+
onDragEndCapture?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
214
|
+
onDragEnter?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
215
|
+
onDragEnterCapture?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
216
|
+
onDragExit?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
217
|
+
onDragExitCapture?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
218
|
+
onDragLeave?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
219
|
+
onDragLeaveCapture?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
220
|
+
onDragOver?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
221
|
+
onDragOverCapture?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
222
|
+
onDragStart?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
223
|
+
onDragStartCapture?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
224
|
+
onDrop?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
225
|
+
onDropCapture?: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
226
|
+
onMouseDown?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
227
|
+
onMouseDownCapture?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
228
|
+
onMouseEnter?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
229
|
+
onMouseLeave?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
230
|
+
onMouseMove?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
231
|
+
onMouseMoveCapture?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
232
|
+
onMouseOut?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
233
|
+
onMouseOutCapture?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
234
|
+
onMouseOver?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
235
|
+
onMouseOverCapture?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
236
|
+
onMouseUp?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
237
|
+
onMouseUpCapture?: React.MouseEventHandler<HTMLDivElement> | undefined;
|
|
238
|
+
onSelect?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
239
|
+
onSelectCapture?: React.ReactEventHandler<HTMLDivElement> | undefined;
|
|
240
|
+
onTouchCancel?: React.TouchEventHandler<HTMLDivElement> | undefined;
|
|
241
|
+
onTouchCancelCapture?: React.TouchEventHandler<HTMLDivElement> | undefined;
|
|
242
|
+
onTouchEnd?: React.TouchEventHandler<HTMLDivElement> | undefined;
|
|
243
|
+
onTouchEndCapture?: React.TouchEventHandler<HTMLDivElement> | undefined;
|
|
244
|
+
onTouchMove?: React.TouchEventHandler<HTMLDivElement> | undefined;
|
|
245
|
+
onTouchMoveCapture?: React.TouchEventHandler<HTMLDivElement> | undefined;
|
|
246
|
+
onTouchStart?: React.TouchEventHandler<HTMLDivElement> | undefined;
|
|
247
|
+
onTouchStartCapture?: React.TouchEventHandler<HTMLDivElement> | undefined;
|
|
248
|
+
onPointerDown?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
249
|
+
onPointerDownCapture?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
250
|
+
onPointerMove?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
251
|
+
onPointerMoveCapture?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
252
|
+
onPointerUp?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
253
|
+
onPointerUpCapture?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
254
|
+
onPointerCancel?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
255
|
+
onPointerCancelCapture?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
256
|
+
onPointerEnter?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
257
|
+
onPointerEnterCapture?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
258
|
+
onPointerLeave?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
259
|
+
onPointerLeaveCapture?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
260
|
+
onPointerOver?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
261
|
+
onPointerOverCapture?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
262
|
+
onPointerOut?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
263
|
+
onPointerOutCapture?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
264
|
+
onGotPointerCapture?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
265
|
+
onGotPointerCaptureCapture?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
266
|
+
onLostPointerCapture?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
267
|
+
onLostPointerCaptureCapture?: React.PointerEventHandler<HTMLDivElement> | undefined;
|
|
268
|
+
onScroll?: React.UIEventHandler<HTMLDivElement> | undefined;
|
|
269
|
+
onScrollCapture?: React.UIEventHandler<HTMLDivElement> | undefined;
|
|
270
|
+
onWheel?: React.WheelEventHandler<HTMLDivElement> | undefined;
|
|
271
|
+
onWheelCapture?: React.WheelEventHandler<HTMLDivElement> | undefined;
|
|
272
|
+
onAnimationStart?: React.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
273
|
+
onAnimationStartCapture?: React.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
274
|
+
onAnimationEnd?: React.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
275
|
+
onAnimationEndCapture?: React.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
276
|
+
onAnimationIteration?: React.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
277
|
+
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLDivElement> | undefined;
|
|
278
|
+
onTransitionEnd?: React.TransitionEventHandler<HTMLDivElement> | undefined;
|
|
279
|
+
onTransitionEndCapture?: React.TransitionEventHandler<HTMLDivElement> | undefined;
|
|
279
280
|
}>;
|
|
280
|
-
ItemHeading:
|
|
281
|
+
ItemHeading: React.FC<react_accessible_accordion_dist_types_helpers_types.DivAttributes>;
|
|
281
282
|
ItemPanel: ({ className, region, id, ...rest }: react_accessible_accordion_dist_types_helpers_types.DivAttributes & {
|
|
282
283
|
region?: boolean | undefined;
|
|
283
284
|
className?: string | undefined;
|
|
@@ -292,4 +293,6 @@ declare const Modal: {
|
|
|
292
293
|
setAppElement: typeof ReactModal.setAppElement;
|
|
293
294
|
};
|
|
294
295
|
|
|
295
|
-
|
|
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
|
|
|
@@ -33,8 +36,11 @@ module.exports = __toCommonJS(src_exports);
|
|
|
33
36
|
var React = __toESM(require("react"));
|
|
34
37
|
|
|
35
38
|
// src/components/Accordion/Accordion.tsx
|
|
39
|
+
var React2 = __toESM(require("react"));
|
|
36
40
|
var import_react_accessible_accordion = require("react-accessible-accordion");
|
|
37
41
|
var import_ui = require("@ttoss/ui");
|
|
42
|
+
var import_css = require("@emotion/css");
|
|
43
|
+
var import_css2 = require("@theme-ui/css");
|
|
38
44
|
var Accordion = ({
|
|
39
45
|
children,
|
|
40
46
|
allowMultipleExpanded,
|
|
@@ -43,9 +49,9 @@ var Accordion = ({
|
|
|
43
49
|
onChange,
|
|
44
50
|
...boxProps
|
|
45
51
|
}) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
const { theme } = (0, import_ui.useTheme)();
|
|
53
|
+
const className = React2.useMemo(() => {
|
|
54
|
+
const styles = (0, import_css2.css)({
|
|
49
55
|
".accordion__item": {
|
|
50
56
|
marginBottom: 3
|
|
51
57
|
},
|
|
@@ -57,10 +63,15 @@ var Accordion = ({
|
|
|
57
63
|
".accordion__button": {},
|
|
58
64
|
".accordion__panel": {
|
|
59
65
|
padding: 2
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
66
|
+
}
|
|
67
|
+
})(theme);
|
|
68
|
+
return (0, import_css.css)(styles);
|
|
69
|
+
}, [theme]);
|
|
70
|
+
return /* @__PURE__ */ React2.createElement(import_ui.Box, {
|
|
71
|
+
variant: "accordion",
|
|
72
|
+
className,
|
|
73
|
+
...boxProps
|
|
74
|
+
}, /* @__PURE__ */ React2.createElement(import_react_accessible_accordion.Accordion, {
|
|
64
75
|
...{
|
|
65
76
|
allowMultipleExpanded,
|
|
66
77
|
allowZeroExpanded,
|
|
@@ -75,7 +86,7 @@ Accordion.ItemHeading = import_react_accessible_accordion.AccordionItemHeading;
|
|
|
75
86
|
Accordion.ItemPanel = import_react_accessible_accordion.AccordionItemPanel;
|
|
76
87
|
|
|
77
88
|
// src/components/InstallPwa/InstallPwa.tsx
|
|
78
|
-
var
|
|
89
|
+
var React3 = __toESM(require("react"));
|
|
79
90
|
|
|
80
91
|
// src/components/InstallPwa/InstallPwaUi.tsx
|
|
81
92
|
var import_ui2 = require("@ttoss/ui");
|
|
@@ -106,9 +117,9 @@ var InstallPwaUi = ({ onInstall }) => {
|
|
|
106
117
|
|
|
107
118
|
// src/components/InstallPwa/InstallPwa.tsx
|
|
108
119
|
var InstallPwa = () => {
|
|
109
|
-
const [supportsPwa, setSupportsPwa] =
|
|
110
|
-
const [promptInstall, setPromptInstall] =
|
|
111
|
-
|
|
120
|
+
const [supportsPwa, setSupportsPwa] = React3.useState(false);
|
|
121
|
+
const [promptInstall, setPromptInstall] = React3.useState(null);
|
|
122
|
+
React3.useEffect(() => {
|
|
112
123
|
const handler = (e) => {
|
|
113
124
|
e.preventDefault();
|
|
114
125
|
setSupportsPwa(true);
|
|
@@ -127,7 +138,7 @@ var InstallPwa = () => {
|
|
|
127
138
|
if (!supportsPwa) {
|
|
128
139
|
return null;
|
|
129
140
|
}
|
|
130
|
-
return /* @__PURE__ */
|
|
141
|
+
return /* @__PURE__ */ React3.createElement(InstallPwaUi, {
|
|
131
142
|
onInstall
|
|
132
143
|
});
|
|
133
144
|
};
|
|
@@ -140,7 +151,7 @@ import_react_modal.default.defaultStyles = {
|
|
|
140
151
|
content: {}
|
|
141
152
|
};
|
|
142
153
|
var Modal = (props) => {
|
|
143
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
154
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
144
155
|
const { theme } = (0, import_ui3.useTheme)();
|
|
145
156
|
const padding = (0, import_ui3.useResponsiveValue)([
|
|
146
157
|
(_a = theme.space) == null ? void 0 : _a[2],
|
|
@@ -162,7 +173,7 @@ var Modal = (props) => {
|
|
|
162
173
|
...(_d = props.style) == null ? void 0 : _d.overlay
|
|
163
174
|
},
|
|
164
175
|
content: {
|
|
165
|
-
|
|
176
|
+
backgroundColor: ((_f = (_e = theme.rawColors) == null ? void 0 : _e.background) == null ? void 0 : _f.toString()) || "#fff",
|
|
166
177
|
padding,
|
|
167
178
|
WebkitOverflowScrolling: "touch",
|
|
168
179
|
overflow: "auto",
|
|
@@ -171,11 +182,12 @@ var Modal = (props) => {
|
|
|
171
182
|
left: "0px",
|
|
172
183
|
right: "0px",
|
|
173
184
|
bottom: "0px",
|
|
174
|
-
border: "
|
|
185
|
+
border: "2px solid",
|
|
186
|
+
borderColor: ((_h = (_g = theme.rawColors) == null ? void 0 : _g.muted) == null ? void 0 : _h.toString()) || "#fff",
|
|
175
187
|
display: "flex",
|
|
176
188
|
flexDirection: "column",
|
|
177
189
|
alignItems: "center",
|
|
178
|
-
...(
|
|
190
|
+
...(_i = props.style) == null ? void 0 : _i.content
|
|
179
191
|
}
|
|
180
192
|
};
|
|
181
193
|
return /* @__PURE__ */ React.createElement(import_react_modal.default, {
|
|
@@ -184,9 +196,37 @@ var Modal = (props) => {
|
|
|
184
196
|
});
|
|
185
197
|
};
|
|
186
198
|
Modal.setAppElement = import_react_modal.default.setAppElement;
|
|
199
|
+
|
|
200
|
+
// src/components/Toast/Toast.tsx
|
|
201
|
+
var React4 = __toESM(require("react"));
|
|
202
|
+
var import_ui4 = require("@ttoss/ui");
|
|
203
|
+
var import_react_toastify = require("react-toastify");
|
|
204
|
+
var import_inject_style = require("react-toastify/dist/inject-style");
|
|
205
|
+
var ToastContainer = (props) => {
|
|
206
|
+
React4.useEffect(() => {
|
|
207
|
+
(0, import_inject_style.injectStyle)();
|
|
208
|
+
}, []);
|
|
209
|
+
return /* @__PURE__ */ React4.createElement(import_ui4.Box, {
|
|
210
|
+
sx: ({ colors, fonts }) => ({
|
|
211
|
+
"--toastify-color-light": "#fff",
|
|
212
|
+
"--toastify-color-dark": "#121212",
|
|
213
|
+
"--toastify-color-info": (colors == null ? void 0 : colors.info) || "#3498db",
|
|
214
|
+
"--toastify-color-success": (colors == null ? void 0 : colors.success) || "#07bc0c",
|
|
215
|
+
"--toastify-color-warning": "#f1c40f",
|
|
216
|
+
"--toastify-color-error": "#e74c3c",
|
|
217
|
+
"--toastify-color-progress-light": `linear-gradient(to right, ${colors == null ? void 0 : colors.primary}, ${colors == null ? void 0 : colors.secondary})`,
|
|
218
|
+
"--toastify-font-family": fonts.body
|
|
219
|
+
})
|
|
220
|
+
}, /* @__PURE__ */ React4.createElement(import_react_toastify.ToastContainer, {
|
|
221
|
+
...props
|
|
222
|
+
}));
|
|
223
|
+
};
|
|
187
224
|
// Annotate the CommonJS export names for ESM import in node:
|
|
188
225
|
0 && (module.exports = {
|
|
189
226
|
Accordion,
|
|
190
227
|
InstallPwa,
|
|
191
|
-
Modal
|
|
228
|
+
Modal,
|
|
229
|
+
ToastContainer,
|
|
230
|
+
ToastContainerProps,
|
|
231
|
+
toast
|
|
192
232
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.1",
|
|
4
4
|
"description": "React components.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,20 +31,23 @@
|
|
|
31
31
|
"dev": "yarn workspace @docs/storybook run dev"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@emotion/css": "^11.10.0",
|
|
35
|
+
"@theme-ui/css": "^0.14.7",
|
|
34
36
|
"@types/react-modal": "^3.13.1",
|
|
35
37
|
"react-accessible-accordion": "^5.0.0",
|
|
36
|
-
"react-modal": "^3.15.1"
|
|
38
|
+
"react-modal": "^3.15.1",
|
|
39
|
+
"react-toastify": "^9.0.8"
|
|
37
40
|
},
|
|
38
41
|
"peerDependencies": {
|
|
39
42
|
"@ttoss/ui": "^1.16.5",
|
|
40
43
|
"react": ">=16.8.0"
|
|
41
44
|
},
|
|
42
45
|
"devDependencies": {
|
|
43
|
-
"@ttoss/config": "^1.
|
|
44
|
-
"@ttoss/test-utils": "^1.
|
|
45
|
-
"@ttoss/ui": "^1.
|
|
46
|
+
"@ttoss/config": "^1.17.0",
|
|
47
|
+
"@ttoss/test-utils": "^1.16.6",
|
|
48
|
+
"@ttoss/ui": "^1.19.0",
|
|
46
49
|
"@types/jest": "^28.1.5",
|
|
47
50
|
"jest": "^28.1.3"
|
|
48
51
|
},
|
|
49
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "db9d943fedab3b0e2fab1752e9436130fdb351fa"
|
|
50
53
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as React from 'react';
|
|
3
2
|
import {
|
|
4
3
|
AccordionItem,
|
|
5
4
|
AccordionItemButton,
|
|
@@ -7,7 +6,9 @@ import {
|
|
|
7
6
|
AccordionItemPanel,
|
|
8
7
|
Accordion as ReactAccessibleAccordion,
|
|
9
8
|
} from 'react-accessible-accordion';
|
|
10
|
-
import { Box, BoxProps } from '@ttoss/ui';
|
|
9
|
+
import { Box, BoxProps, useTheme } from '@ttoss/ui';
|
|
10
|
+
import { css as createClassName } from '@emotion/css';
|
|
11
|
+
import { css as transformStyleObject } from '@theme-ui/css';
|
|
11
12
|
|
|
12
13
|
export type AccordionProps = BoxProps & {
|
|
13
14
|
// https://github.com/springload/react-accessible-accordion#accordion
|
|
@@ -28,25 +29,29 @@ export const Accordion = ({
|
|
|
28
29
|
onChange,
|
|
29
30
|
...boxProps
|
|
30
31
|
}: AccordionProps) => {
|
|
32
|
+
const { theme } = useTheme();
|
|
33
|
+
|
|
34
|
+
const className = React.useMemo(() => {
|
|
35
|
+
const styles = transformStyleObject({
|
|
36
|
+
'.accordion__item': {
|
|
37
|
+
marginBottom: 3,
|
|
38
|
+
},
|
|
39
|
+
'.accordion__heading': {
|
|
40
|
+
padding: 2,
|
|
41
|
+
border: '1px solid',
|
|
42
|
+
borderColor: 'black',
|
|
43
|
+
},
|
|
44
|
+
'.accordion__button': {},
|
|
45
|
+
'.accordion__panel': {
|
|
46
|
+
padding: 2,
|
|
47
|
+
},
|
|
48
|
+
})(theme);
|
|
49
|
+
|
|
50
|
+
return createClassName(styles);
|
|
51
|
+
}, [theme]);
|
|
52
|
+
|
|
31
53
|
return (
|
|
32
|
-
<Box
|
|
33
|
-
{...boxProps}
|
|
34
|
-
sx={{
|
|
35
|
-
'.accordion__item': {
|
|
36
|
-
marginBottom: 3,
|
|
37
|
-
},
|
|
38
|
-
'.accordion__heading': {
|
|
39
|
-
padding: 2,
|
|
40
|
-
border: '1px solid',
|
|
41
|
-
borderColor: 'black',
|
|
42
|
-
},
|
|
43
|
-
'.accordion__button': {},
|
|
44
|
-
'.accordion__panel': {
|
|
45
|
-
padding: 2,
|
|
46
|
-
},
|
|
47
|
-
...boxProps.sx,
|
|
48
|
-
}}
|
|
49
|
-
>
|
|
54
|
+
<Box variant="accordion" className={className} {...boxProps}>
|
|
50
55
|
<ReactAccessibleAccordion
|
|
51
56
|
{...{
|
|
52
57
|
allowMultipleExpanded,
|
|
@@ -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,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Box } from '@ttoss/ui';
|
|
3
|
+
import {
|
|
4
|
+
ToastContainer as ReactToastifyToastContainer,
|
|
5
|
+
ToastContainerProps,
|
|
6
|
+
toast,
|
|
7
|
+
} from 'react-toastify';
|
|
8
|
+
import { injectStyle } from 'react-toastify/dist/inject-style';
|
|
9
|
+
|
|
10
|
+
export { toast, ToastContainerProps };
|
|
11
|
+
|
|
12
|
+
export const ToastContainer = (props: ToastContainerProps) => {
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
injectStyle();
|
|
15
|
+
}, []);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Box
|
|
19
|
+
sx={({ colors, fonts }) => ({
|
|
20
|
+
'--toastify-color-light': '#fff',
|
|
21
|
+
'--toastify-color-dark': '#121212',
|
|
22
|
+
'--toastify-color-info': colors?.info || '#3498db',
|
|
23
|
+
'--toastify-color-success': colors?.success || '#07bc0c',
|
|
24
|
+
'--toastify-color-warning': '#f1c40f',
|
|
25
|
+
'--toastify-color-error': '#e74c3c',
|
|
26
|
+
'--toastify-color-progress-light': `linear-gradient(to right, ${colors?.primary}, ${colors?.secondary})`,
|
|
27
|
+
'--toastify-font-family': (fonts as { body: string }).body,
|
|
28
|
+
})}
|
|
29
|
+
>
|
|
30
|
+
<ReactToastifyToastContainer {...props} />
|
|
31
|
+
</Box>
|
|
32
|
+
);
|
|
33
|
+
};
|
package/src/index.spec.tsx
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# Accordion
|
|
2
|
-
|
|
3
|
-
This components uses [react-accessible-accordion package](https://react-accessible-accordion.springload.co.nz/) as a base and apply [@ttoss/ui](/docs/modules/packages/ui/) styles.
|
|
4
|
-
|
|
5
|
-
## Storybook
|
|
6
|
-
|
|
7
|
-
[Stories](https://storybook.ttoss.dev/?path=/story/components-accordion)
|
|
8
|
-
|
|
9
|
-
## Example
|
|
10
|
-
|
|
11
|
-
```jsx
|
|
12
|
-
import { Accordion } from "@ttoss/components";
|
|
13
|
-
import { Text } from "@ttoss/ui";
|
|
14
|
-
|
|
15
|
-
const MyAccordion = () => {
|
|
16
|
-
return (
|
|
17
|
-
<Accordion>
|
|
18
|
-
<Accordion.Item>
|
|
19
|
-
<Accordion.ItemHeading>
|
|
20
|
-
<Accordion.ItemButton>
|
|
21
|
-
What harsh truths do you prefer to ignore?
|
|
22
|
-
</Accordion.ItemButton>
|
|
23
|
-
</Accordion.ItemHeading>
|
|
24
|
-
<Accordion.ItemPanel>
|
|
25
|
-
<Text>
|
|
26
|
-
Exercitation in fugiat est ut ad ea cupidatat ut in cupidatat
|
|
27
|
-
occaecat ut occaecat consequat est minim minim esse tempor laborum
|
|
28
|
-
consequat esse adipisicing eu reprehenderit enim.
|
|
29
|
-
</Text>
|
|
30
|
-
</Accordion.ItemPanel>
|
|
31
|
-
</Accordion.Item>
|
|
32
|
-
<Accordion.Item>
|
|
33
|
-
<Accordion.ItemHeading>
|
|
34
|
-
<Accordion.ItemButton>
|
|
35
|
-
Is free will real or just an illusion?
|
|
36
|
-
</Accordion.ItemButton>
|
|
37
|
-
</Accordion.ItemHeading>
|
|
38
|
-
<Accordion.ItemPanel>
|
|
39
|
-
<Text>
|
|
40
|
-
In ad velit in ex nostrud dolore cupidatat consectetur ea in ut
|
|
41
|
-
nostrud velit in irure cillum tempor laboris sed adipisicing eu esse
|
|
42
|
-
duis nulla non.
|
|
43
|
-
</Text>
|
|
44
|
-
</Accordion.ItemPanel>
|
|
45
|
-
</Accordion.Item>
|
|
46
|
-
</Accordion>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## API
|
|
52
|
-
|
|
53
|
-
TODO
|
|
54
|
-
|
|
55
|
-
## Styles
|
|
56
|
-
|
|
57
|
-
TODO
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# Modal
|
|
2
|
-
|
|
3
|
-
This components uses [react-modal package](http://reactcommunity.org/react-modal) as a base and apply [@ttoss/ui](/docs/modules/packages/ui/) styles.
|
|
4
|
-
|
|
5
|
-
## Storybook
|
|
6
|
-
|
|
7
|
-
[Stories](https://storybook.ttoss.dev/?path=/story/components-modal)
|
|
8
|
-
|
|
9
|
-
## Example
|
|
10
|
-
|
|
11
|
-
```jsx
|
|
12
|
-
import { Modal } from "@ttoss/components";
|
|
13
|
-
import { Box, Flex, Text } from "@ttoss/ui";
|
|
14
|
-
|
|
15
|
-
const Component = () => {
|
|
16
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Box>
|
|
20
|
-
<Modal
|
|
21
|
-
isOpen={isOpen}
|
|
22
|
-
onRequestClose={() => {
|
|
23
|
-
setIsOpen(false);
|
|
24
|
-
}}
|
|
25
|
-
>
|
|
26
|
-
<Flex
|
|
27
|
-
sx={{
|
|
28
|
-
flexDirection: "column",
|
|
29
|
-
alignItems: "center",
|
|
30
|
-
}}
|
|
31
|
-
>
|
|
32
|
-
<Text>This is a modal.</Text>
|
|
33
|
-
<Button
|
|
34
|
-
onClick={() => {
|
|
35
|
-
setIsOpen(false);
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
38
|
-
Close Modal
|
|
39
|
-
</Button>
|
|
40
|
-
</Flex>
|
|
41
|
-
</Modal>
|
|
42
|
-
<Button
|
|
43
|
-
onClick={() => {
|
|
44
|
-
setIsOpen(true);
|
|
45
|
-
}}
|
|
46
|
-
>
|
|
47
|
-
Open Modal
|
|
48
|
-
</Button>
|
|
49
|
-
</Box>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## API
|
|
55
|
-
|
|
56
|
-
This components extends the API of [react-modal package](http://reactcommunity.org/react-modal/#usage).
|