@ttoss/components 1.21.7 → 1.21.8

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.
@@ -0,0 +1,225 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+
3
+ // tsup.inject.js
4
+ import * as React from "react";
5
+
6
+ // src/components/Accordion/Accordion.tsx
7
+ import * as React2 from "react";
8
+ import {
9
+ AccordionItem,
10
+ AccordionItemButton,
11
+ AccordionItemHeading,
12
+ AccordionItemPanel,
13
+ Accordion as ReactAccessibleAccordion
14
+ } from "react-accessible-accordion";
15
+ import { Box, useTheme } from "@ttoss/ui";
16
+ import { css as createClassName } from "@emotion/css";
17
+ import { css as transformStyleObject } from "@theme-ui/css";
18
+ import { jsx } from "react/jsx-runtime";
19
+ var Accordion = ({
20
+ children,
21
+ allowMultipleExpanded,
22
+ allowZeroExpanded,
23
+ preExpanded,
24
+ onChange,
25
+ ...boxProps
26
+ }) => {
27
+ const { theme } = useTheme();
28
+ const className = React2.useMemo(() => {
29
+ const styles = transformStyleObject({
30
+ ".accordion__item": {
31
+ marginBottom: 3
32
+ },
33
+ ".accordion__heading": {
34
+ padding: 2,
35
+ border: "1px solid",
36
+ borderColor: "black"
37
+ },
38
+ ".accordion__button": {},
39
+ ".accordion__panel": {
40
+ padding: 2
41
+ }
42
+ })(theme);
43
+ return createClassName(styles);
44
+ }, [theme]);
45
+ return /* @__PURE__ */ jsx(Box, {
46
+ variant: "accordion",
47
+ className,
48
+ ...boxProps,
49
+ children: /* @__PURE__ */ jsx(ReactAccessibleAccordion, {
50
+ ...{
51
+ allowMultipleExpanded,
52
+ allowZeroExpanded,
53
+ preExpanded,
54
+ onChange
55
+ },
56
+ children
57
+ })
58
+ });
59
+ };
60
+ Accordion.Item = AccordionItem;
61
+ Accordion.ItemButton = AccordionItemButton;
62
+ Accordion.ItemHeading = AccordionItemHeading;
63
+ Accordion.ItemPanel = AccordionItemPanel;
64
+
65
+ // src/components/InstallPwa/InstallPwa.tsx
66
+ import * as React3 from "react";
67
+
68
+ // src/components/InstallPwa/InstallPwaUi.tsx
69
+ import { Button, Flex, Text } from "@ttoss/ui";
70
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
71
+ var InstallPwaUi = ({ onInstall }) => {
72
+ return /* @__PURE__ */ jsx2(Flex, {
73
+ sx: {
74
+ position: "absolute",
75
+ bottom: 4,
76
+ width: "100%",
77
+ justifyContent: "center"
78
+ },
79
+ children: /* @__PURE__ */ jsxs(Flex, {
80
+ sx: {
81
+ backgroundColor: "background",
82
+ justifyContent: "center",
83
+ alignItems: "center",
84
+ gap: 3,
85
+ width: "auto",
86
+ border: "1px solid",
87
+ borderColor: "muted",
88
+ borderRadius: 1,
89
+ padding: 4
90
+ },
91
+ children: [
92
+ /* @__PURE__ */ jsx2(Text, {
93
+ children: "Deseja instalar o nosso aplicativo?"
94
+ }),
95
+ /* @__PURE__ */ jsx2(Button, {
96
+ onClick: onInstall,
97
+ children: "Instalar"
98
+ })
99
+ ]
100
+ })
101
+ });
102
+ };
103
+
104
+ // src/components/InstallPwa/InstallPwa.tsx
105
+ import { jsx as jsx3 } from "react/jsx-runtime";
106
+ var InstallPwa = () => {
107
+ const [supportsPwa, setSupportsPwa] = React3.useState(false);
108
+ const [promptInstall, setPromptInstall] = React3.useState(null);
109
+ React3.useEffect(() => {
110
+ const handler = (e) => {
111
+ e.preventDefault();
112
+ setSupportsPwa(true);
113
+ setPromptInstall(e);
114
+ };
115
+ window.addEventListener("beforeinstallprompt", handler);
116
+ return () => window.removeEventListener("transitionend", handler);
117
+ }, []);
118
+ const onInstall = (e) => {
119
+ e.preventDefault();
120
+ if (!promptInstall) {
121
+ return;
122
+ }
123
+ promptInstall.prompt();
124
+ };
125
+ if (!supportsPwa) {
126
+ return null;
127
+ }
128
+ return /* @__PURE__ */ jsx3(InstallPwaUi, {
129
+ onInstall
130
+ });
131
+ };
132
+
133
+ // src/components/Modal/Modal.tsx
134
+ import { useResponsiveValue, useTheme as useTheme2 } from "@ttoss/ui";
135
+ import ReactModal from "react-modal";
136
+ import { jsx as jsx4 } from "react/jsx-runtime";
137
+ ReactModal.defaultStyles = {
138
+ overlay: {},
139
+ content: {}
140
+ };
141
+ var Modal = (props) => {
142
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
143
+ const { theme } = useTheme2();
144
+ const padding = useResponsiveValue([
145
+ (_a = theme.space) == null ? void 0 : _a[2],
146
+ (_b = theme.space) == null ? void 0 : _b[3],
147
+ (_c = theme.space) == null ? void 0 : _c[4]
148
+ ]) || 0;
149
+ const style = {
150
+ overlay: {
151
+ position: "fixed",
152
+ top: 0,
153
+ left: 0,
154
+ right: 0,
155
+ bottom: 0,
156
+ backgroundColor: "rgba(255, 255, 255, 0.5)",
157
+ display: "flex",
158
+ justifyContent: "center",
159
+ alignItems: "center",
160
+ padding,
161
+ ...(_d = props.style) == null ? void 0 : _d.overlay
162
+ },
163
+ content: {
164
+ backgroundColor: ((_f = (_e = theme.rawColors) == null ? void 0 : _e.background) == null ? void 0 : _f.toString()) || "#fff",
165
+ padding,
166
+ WebkitOverflowScrolling: "touch",
167
+ overflow: "auto",
168
+ position: "relative",
169
+ top: "0px",
170
+ left: "0px",
171
+ right: "0px",
172
+ bottom: "0px",
173
+ border: "2px solid",
174
+ borderColor: ((_h = (_g = theme.rawColors) == null ? void 0 : _g.muted) == null ? void 0 : _h.toString()) || "#fff",
175
+ display: "flex",
176
+ flexDirection: "column",
177
+ alignItems: "center",
178
+ ...(_i = props.style) == null ? void 0 : _i.content
179
+ }
180
+ };
181
+ return /* @__PURE__ */ jsx4(ReactModal, {
182
+ ...props,
183
+ style
184
+ });
185
+ };
186
+ Modal.setAppElement = ReactModal.setAppElement;
187
+
188
+ // src/components/Toast/Toast.tsx
189
+ import * as React4 from "react";
190
+ import { Box as Box2 } from "@ttoss/ui";
191
+ import {
192
+ ToastContainer as ReactToastifyToastContainer,
193
+ ToastContainerProps,
194
+ toast
195
+ } from "react-toastify";
196
+ import { injectStyle } from "react-toastify/dist/inject-style";
197
+ import { jsx as jsx5 } from "react/jsx-runtime";
198
+ var ToastContainer = (props) => {
199
+ React4.useEffect(() => {
200
+ injectStyle();
201
+ }, []);
202
+ return /* @__PURE__ */ jsx5(Box2, {
203
+ sx: ({ colors, fonts }) => ({
204
+ "--toastify-color-light": "#fff",
205
+ "--toastify-color-dark": "#121212",
206
+ "--toastify-color-info": (colors == null ? void 0 : colors.info) || "#3498db",
207
+ "--toastify-color-success": (colors == null ? void 0 : colors.success) || "#07bc0c",
208
+ "--toastify-color-warning": "#f1c40f",
209
+ "--toastify-color-error": "#e74c3c",
210
+ "--toastify-color-progress-light": `linear-gradient(to right, ${colors == null ? void 0 : colors.primary}, ${colors == null ? void 0 : colors.secondary})`,
211
+ "--toastify-font-family": fonts.body
212
+ }),
213
+ children: /* @__PURE__ */ jsx5(ReactToastifyToastContainer, {
214
+ ...props
215
+ })
216
+ });
217
+ };
218
+ export {
219
+ Accordion,
220
+ InstallPwa,
221
+ Modal,
222
+ ToastContainer,
223
+ ToastContainerProps,
224
+ toast
225
+ };
@@ -0,0 +1,298 @@
1
+ import * as react_accessible_accordion_dist_types_helpers_DisplayName from 'react-accessible-accordion/dist/types/helpers/DisplayName';
2
+ import * as react_accessible_accordion_dist_types_components_ItemContext from 'react-accessible-accordion/dist/types/components/ItemContext';
3
+ import * as react_accessible_accordion_dist_types_helpers_types from 'react-accessible-accordion/dist/types/helpers/types';
4
+ import * as React from 'react';
5
+ import { BoxProps } from '@ttoss/ui';
6
+ import ReactModal from 'react-modal';
7
+ import { ToastContainerProps } from 'react-toastify';
8
+ export { ToastContainerProps, toast } from 'react-toastify';
9
+
10
+ declare type AccordionProps = BoxProps & {
11
+ allowMultipleExpanded?: boolean;
12
+ allowZeroExpanded?: boolean;
13
+ preExpanded?: string[];
14
+ /**
15
+ * Callback which is invoked when items are expanded or collapsed. Gets passed uuids of the currently expanded AccordionItems.
16
+ */
17
+ onChange?: (args: string[]) => void;
18
+ };
19
+ declare const Accordion: {
20
+ ({ children, allowMultipleExpanded, allowZeroExpanded, preExpanded, onChange, ...boxProps }: AccordionProps): JSX.Element;
21
+ Item: {
22
+ ({ uuid, dangerouslySetExpanded, className, activeClassName, ...rest }: react_accessible_accordion_dist_types_helpers_types.DivAttributes & {
23
+ uuid?: react_accessible_accordion_dist_types_components_ItemContext.ID | undefined;
24
+ activeClassName?: string | undefined;
25
+ dangerouslySetExpanded?: boolean | undefined;
26
+ }): JSX.Element;
27
+ displayName: react_accessible_accordion_dist_types_helpers_DisplayName.default;
28
+ };
29
+ ItemButton: React.FC<{
30
+ children?: React.ReactNode;
31
+ slot?: string | undefined;
32
+ style?: React.CSSProperties | undefined;
33
+ title?: string | undefined;
34
+ defaultChecked?: boolean | undefined;
35
+ defaultValue?: string | number | readonly string[] | undefined;
36
+ suppressContentEditableWarning?: boolean | undefined;
37
+ suppressHydrationWarning?: boolean | undefined;
38
+ accessKey?: string | undefined;
39
+ className?: string | undefined;
40
+ contentEditable?: (boolean | "true" | "false") | "inherit" | undefined;
41
+ contextMenu?: string | undefined;
42
+ dir?: string | undefined;
43
+ draggable?: (boolean | "true" | "false") | undefined;
44
+ hidden?: boolean | undefined;
45
+ lang?: string | undefined;
46
+ placeholder?: string | undefined;
47
+ spellCheck?: (boolean | "true" | "false") | undefined;
48
+ translate?: "yes" | "no" | undefined;
49
+ radioGroup?: string | undefined;
50
+ about?: string | undefined;
51
+ datatype?: string | undefined;
52
+ inlist?: any;
53
+ prefix?: string | undefined;
54
+ property?: string | undefined;
55
+ resource?: string | undefined;
56
+ typeof?: string | undefined;
57
+ vocab?: string | undefined;
58
+ autoCapitalize?: string | undefined;
59
+ autoCorrect?: string | undefined;
60
+ autoSave?: string | undefined;
61
+ color?: string | undefined;
62
+ itemProp?: string | undefined;
63
+ itemScope?: boolean | undefined;
64
+ itemType?: string | undefined;
65
+ itemID?: string | undefined;
66
+ itemRef?: string | undefined;
67
+ results?: number | undefined;
68
+ security?: string | undefined;
69
+ unselectable?: "on" | "off" | undefined;
70
+ inputMode?: "text" | "none" | "search" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
71
+ is?: string | undefined;
72
+ 'aria-activedescendant'?: string | undefined;
73
+ 'aria-atomic'?: (boolean | "true" | "false") | undefined;
74
+ 'aria-autocomplete'?: "list" | "none" | "both" | "inline" | undefined;
75
+ 'aria-busy'?: (boolean | "true" | "false") | undefined;
76
+ 'aria-checked'?: boolean | "true" | "false" | "mixed" | undefined;
77
+ 'aria-colcount'?: number | undefined;
78
+ 'aria-colindex'?: number | undefined;
79
+ 'aria-colspan'?: number | undefined;
80
+ 'aria-current'?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
81
+ 'aria-describedby'?: string | undefined;
82
+ 'aria-details'?: string | undefined;
83
+ 'aria-dropeffect'?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
84
+ 'aria-errormessage'?: string | undefined;
85
+ 'aria-flowto'?: string | undefined;
86
+ 'aria-grabbed'?: (boolean | "true" | "false") | undefined;
87
+ 'aria-haspopup'?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
88
+ 'aria-hidden'?: (boolean | "true" | "false") | undefined;
89
+ 'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
90
+ 'aria-keyshortcuts'?: string | undefined;
91
+ 'aria-label'?: string | undefined;
92
+ 'aria-labelledby'?: string | undefined;
93
+ 'aria-level'?: number | undefined;
94
+ 'aria-live'?: "off" | "assertive" | "polite" | undefined;
95
+ 'aria-modal'?: (boolean | "true" | "false") | undefined;
96
+ 'aria-multiline'?: (boolean | "true" | "false") | undefined;
97
+ 'aria-multiselectable'?: (boolean | "true" | "false") | undefined;
98
+ 'aria-orientation'?: "horizontal" | "vertical" | undefined;
99
+ 'aria-owns'?: string | undefined;
100
+ 'aria-placeholder'?: string | undefined;
101
+ 'aria-posinset'?: number | undefined;
102
+ 'aria-pressed'?: boolean | "true" | "false" | "mixed" | undefined;
103
+ 'aria-readonly'?: (boolean | "true" | "false") | undefined;
104
+ 'aria-relevant'?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
105
+ 'aria-required'?: (boolean | "true" | "false") | undefined;
106
+ 'aria-roledescription'?: string | undefined;
107
+ 'aria-rowcount'?: number | undefined;
108
+ 'aria-rowindex'?: number | undefined;
109
+ 'aria-rowspan'?: number | undefined;
110
+ 'aria-selected'?: (boolean | "true" | "false") | undefined;
111
+ 'aria-setsize'?: number | undefined;
112
+ 'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
113
+ 'aria-valuemax'?: number | undefined;
114
+ 'aria-valuemin'?: number | undefined;
115
+ 'aria-valuenow'?: number | undefined;
116
+ 'aria-valuetext'?: string | undefined;
117
+ dangerouslySetInnerHTML?: {
118
+ __html: string;
119
+ } | undefined;
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;
280
+ }>;
281
+ ItemHeading: React.FC<react_accessible_accordion_dist_types_helpers_types.DivAttributes>;
282
+ ItemPanel: ({ className, region, id, ...rest }: react_accessible_accordion_dist_types_helpers_types.DivAttributes & {
283
+ region?: boolean | undefined;
284
+ className?: string | undefined;
285
+ }) => JSX.Element;
286
+ };
287
+
288
+ declare const InstallPwa: () => JSX.Element | null;
289
+
290
+ declare type ModalProps = ReactModal.Props;
291
+ declare const Modal: {
292
+ (props: ModalProps): JSX.Element;
293
+ setAppElement: typeof ReactModal.setAppElement;
294
+ };
295
+
296
+ declare const ToastContainer: (props: ToastContainerProps) => JSX.Element;
297
+
298
+ export { Accordion, AccordionProps, InstallPwa, Modal, ModalProps, ToastContainer };
package/dist/index.js ADDED
@@ -0,0 +1,252 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
+ mod
24
+ ));
25
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
+
27
+ // src/index.ts
28
+ var src_exports = {};
29
+ __export(src_exports, {
30
+ Accordion: () => Accordion,
31
+ InstallPwa: () => InstallPwa,
32
+ Modal: () => Modal,
33
+ ToastContainer: () => ToastContainer,
34
+ ToastContainerProps: () => import_react_toastify.ToastContainerProps,
35
+ toast: () => import_react_toastify.toast
36
+ });
37
+ module.exports = __toCommonJS(src_exports);
38
+
39
+ // tsup.inject.js
40
+ var React = __toESM(require("react"));
41
+
42
+ // src/components/Accordion/Accordion.tsx
43
+ var React2 = __toESM(require("react"));
44
+ var import_react_accessible_accordion = require("react-accessible-accordion");
45
+ var import_ui = require("@ttoss/ui");
46
+ var import_css = require("@emotion/css");
47
+ var import_css2 = require("@theme-ui/css");
48
+ var import_jsx_runtime = require("react/jsx-runtime");
49
+ var Accordion = ({
50
+ children,
51
+ allowMultipleExpanded,
52
+ allowZeroExpanded,
53
+ preExpanded,
54
+ onChange,
55
+ ...boxProps
56
+ }) => {
57
+ const { theme } = (0, import_ui.useTheme)();
58
+ const className = React2.useMemo(() => {
59
+ const styles = (0, import_css2.css)({
60
+ ".accordion__item": {
61
+ marginBottom: 3
62
+ },
63
+ ".accordion__heading": {
64
+ padding: 2,
65
+ border: "1px solid",
66
+ borderColor: "black"
67
+ },
68
+ ".accordion__button": {},
69
+ ".accordion__panel": {
70
+ padding: 2
71
+ }
72
+ })(theme);
73
+ return (0, import_css.css)(styles);
74
+ }, [theme]);
75
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Box, {
76
+ variant: "accordion",
77
+ className,
78
+ ...boxProps,
79
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_accessible_accordion.Accordion, {
80
+ ...{
81
+ allowMultipleExpanded,
82
+ allowZeroExpanded,
83
+ preExpanded,
84
+ onChange
85
+ },
86
+ children
87
+ })
88
+ });
89
+ };
90
+ Accordion.Item = import_react_accessible_accordion.AccordionItem;
91
+ Accordion.ItemButton = import_react_accessible_accordion.AccordionItemButton;
92
+ Accordion.ItemHeading = import_react_accessible_accordion.AccordionItemHeading;
93
+ Accordion.ItemPanel = import_react_accessible_accordion.AccordionItemPanel;
94
+
95
+ // src/components/InstallPwa/InstallPwa.tsx
96
+ var React3 = __toESM(require("react"));
97
+
98
+ // src/components/InstallPwa/InstallPwaUi.tsx
99
+ var import_ui2 = require("@ttoss/ui");
100
+ var import_jsx_runtime2 = require("react/jsx-runtime");
101
+ var InstallPwaUi = ({ onInstall }) => {
102
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui2.Flex, {
103
+ sx: {
104
+ position: "absolute",
105
+ bottom: 4,
106
+ width: "100%",
107
+ justifyContent: "center"
108
+ },
109
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui2.Flex, {
110
+ sx: {
111
+ backgroundColor: "background",
112
+ justifyContent: "center",
113
+ alignItems: "center",
114
+ gap: 3,
115
+ width: "auto",
116
+ border: "1px solid",
117
+ borderColor: "muted",
118
+ borderRadius: 1,
119
+ padding: 4
120
+ },
121
+ children: [
122
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui2.Text, {
123
+ children: "Deseja instalar o nosso aplicativo?"
124
+ }),
125
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui2.Button, {
126
+ onClick: onInstall,
127
+ children: "Instalar"
128
+ })
129
+ ]
130
+ })
131
+ });
132
+ };
133
+
134
+ // src/components/InstallPwa/InstallPwa.tsx
135
+ var import_jsx_runtime3 = require("react/jsx-runtime");
136
+ var InstallPwa = () => {
137
+ const [supportsPwa, setSupportsPwa] = React3.useState(false);
138
+ const [promptInstall, setPromptInstall] = React3.useState(null);
139
+ React3.useEffect(() => {
140
+ const handler = (e) => {
141
+ e.preventDefault();
142
+ setSupportsPwa(true);
143
+ setPromptInstall(e);
144
+ };
145
+ window.addEventListener("beforeinstallprompt", handler);
146
+ return () => window.removeEventListener("transitionend", handler);
147
+ }, []);
148
+ const onInstall = (e) => {
149
+ e.preventDefault();
150
+ if (!promptInstall) {
151
+ return;
152
+ }
153
+ promptInstall.prompt();
154
+ };
155
+ if (!supportsPwa) {
156
+ return null;
157
+ }
158
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InstallPwaUi, {
159
+ onInstall
160
+ });
161
+ };
162
+
163
+ // src/components/Modal/Modal.tsx
164
+ var import_ui3 = require("@ttoss/ui");
165
+ var import_react_modal = __toESM(require("react-modal"));
166
+ var import_jsx_runtime4 = require("react/jsx-runtime");
167
+ import_react_modal.default.defaultStyles = {
168
+ overlay: {},
169
+ content: {}
170
+ };
171
+ var Modal = (props) => {
172
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
173
+ const { theme } = (0, import_ui3.useTheme)();
174
+ const padding = (0, import_ui3.useResponsiveValue)([
175
+ (_a = theme.space) == null ? void 0 : _a[2],
176
+ (_b = theme.space) == null ? void 0 : _b[3],
177
+ (_c = theme.space) == null ? void 0 : _c[4]
178
+ ]) || 0;
179
+ const style = {
180
+ overlay: {
181
+ position: "fixed",
182
+ top: 0,
183
+ left: 0,
184
+ right: 0,
185
+ bottom: 0,
186
+ backgroundColor: "rgba(255, 255, 255, 0.5)",
187
+ display: "flex",
188
+ justifyContent: "center",
189
+ alignItems: "center",
190
+ padding,
191
+ ...(_d = props.style) == null ? void 0 : _d.overlay
192
+ },
193
+ content: {
194
+ backgroundColor: ((_f = (_e = theme.rawColors) == null ? void 0 : _e.background) == null ? void 0 : _f.toString()) || "#fff",
195
+ padding,
196
+ WebkitOverflowScrolling: "touch",
197
+ overflow: "auto",
198
+ position: "relative",
199
+ top: "0px",
200
+ left: "0px",
201
+ right: "0px",
202
+ bottom: "0px",
203
+ border: "2px solid",
204
+ borderColor: ((_h = (_g = theme.rawColors) == null ? void 0 : _g.muted) == null ? void 0 : _h.toString()) || "#fff",
205
+ display: "flex",
206
+ flexDirection: "column",
207
+ alignItems: "center",
208
+ ...(_i = props.style) == null ? void 0 : _i.content
209
+ }
210
+ };
211
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_modal.default, {
212
+ ...props,
213
+ style
214
+ });
215
+ };
216
+ Modal.setAppElement = import_react_modal.default.setAppElement;
217
+
218
+ // src/components/Toast/Toast.tsx
219
+ var React4 = __toESM(require("react"));
220
+ var import_ui4 = require("@ttoss/ui");
221
+ var import_react_toastify = require("react-toastify");
222
+ var import_inject_style = require("react-toastify/dist/inject-style");
223
+ var import_jsx_runtime5 = require("react/jsx-runtime");
224
+ var ToastContainer = (props) => {
225
+ React4.useEffect(() => {
226
+ (0, import_inject_style.injectStyle)();
227
+ }, []);
228
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui4.Box, {
229
+ sx: ({ colors, fonts }) => ({
230
+ "--toastify-color-light": "#fff",
231
+ "--toastify-color-dark": "#121212",
232
+ "--toastify-color-info": (colors == null ? void 0 : colors.info) || "#3498db",
233
+ "--toastify-color-success": (colors == null ? void 0 : colors.success) || "#07bc0c",
234
+ "--toastify-color-warning": "#f1c40f",
235
+ "--toastify-color-error": "#e74c3c",
236
+ "--toastify-color-progress-light": `linear-gradient(to right, ${colors == null ? void 0 : colors.primary}, ${colors == null ? void 0 : colors.secondary})`,
237
+ "--toastify-font-family": fonts.body
238
+ }),
239
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_toastify.ToastContainer, {
240
+ ...props
241
+ })
242
+ });
243
+ };
244
+ // Annotate the CommonJS export names for ESM import in node:
245
+ 0 && (module.exports = {
246
+ Accordion,
247
+ InstallPwa,
248
+ Modal,
249
+ ToastContainer,
250
+ ToastContainerProps,
251
+ toast
252
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/components",
3
- "version": "1.21.7",
3
+ "version": "1.21.8",
4
4
  "description": "React components.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -34,7 +34,7 @@
34
34
  "devDependencies": {
35
35
  "@ttoss/config": "^1.18.3",
36
36
  "@ttoss/test-utils": "^1.16.10",
37
- "@ttoss/ui": "^1.20.4",
37
+ "@ttoss/ui": "^1.21.0",
38
38
  "@types/jest": "^28.1.5",
39
39
  "jest": "^28.1.3"
40
40
  },
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "b9f9de9b8389be76965f125b593166f10c2171e6"
48
+ "gitHead": "8407ac0199e566fb6695f0caddb9f6bed4bf6578"
49
49
  }