@ttoss/components 1.26.14 → 1.26.16

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 CHANGED
@@ -2,13 +2,7 @@
2
2
 
3
3
  // src/components/Accordion/Accordion.tsx
4
4
  import * as React from "react";
5
- import {
6
- AccordionItem,
7
- AccordionItemButton,
8
- AccordionItemHeading,
9
- AccordionItemPanel,
10
- Accordion as ReactAccessibleAccordion
11
- } from "react-accessible-accordion";
5
+ import { AccordionItem, AccordionItemButton, AccordionItemHeading, AccordionItemPanel, Accordion as ReactAccessibleAccordion } from "react-accessible-accordion";
12
6
  import { Box, useTheme } from "@ttoss/ui";
13
7
  import { css as createClassName } from "@emotion/css";
14
8
  import { css as transformStyleObject } from "@theme-ui/css";
@@ -21,7 +15,9 @@ var Accordion = ({
21
15
  onChange,
22
16
  ...boxProps
23
17
  }) => {
24
- const { theme } = useTheme();
18
+ const {
19
+ theme
20
+ } = useTheme();
25
21
  const className = React.useMemo(() => {
26
22
  const styles = transformStyleObject({
27
23
  ".accordion__item": {
@@ -39,9 +35,11 @@ var Accordion = ({
39
35
  })(theme);
40
36
  return createClassName(styles);
41
37
  }, [theme]);
42
- return /* @__PURE__ */ jsx(Box, { variant: "accordion", className, ...boxProps, children: /* @__PURE__ */ jsx(
43
- ReactAccessibleAccordion,
44
- {
38
+ return /* @__PURE__ */jsx(Box, {
39
+ variant: "accordion",
40
+ className,
41
+ ...boxProps,
42
+ children: /* @__PURE__ */jsx(ReactAccessibleAccordion, {
45
43
  ...{
46
44
  allowMultipleExpanded,
47
45
  allowZeroExpanded,
@@ -49,8 +47,8 @@ var Accordion = ({
49
47
  onChange
50
48
  },
51
49
  children
52
- }
53
- ) });
50
+ })
51
+ });
54
52
  };
55
53
  Accordion.Item = AccordionItem;
56
54
  Accordion.ItemButton = AccordionItemButton;
@@ -63,38 +61,36 @@ import * as React3 from "react";
63
61
  // src/components/InstallPwa/InstallPwaUi.tsx
64
62
  import { Button, Flex, Text } from "@ttoss/ui";
65
63
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
66
- var InstallPwaUi = ({ onInstall }) => {
67
- return /* @__PURE__ */ jsx2(
68
- Flex,
69
- {
64
+ var InstallPwaUi = ({
65
+ onInstall
66
+ }) => {
67
+ return /* @__PURE__ */jsx2(Flex, {
68
+ sx: {
69
+ position: "absolute",
70
+ bottom: 4,
71
+ width: "100%",
72
+ justifyContent: "center"
73
+ },
74
+ children: /* @__PURE__ */jsxs(Flex, {
70
75
  sx: {
71
- position: "absolute",
72
- bottom: 4,
73
- width: "100%",
74
- justifyContent: "center"
76
+ backgroundColor: "background",
77
+ justifyContent: "center",
78
+ alignItems: "center",
79
+ gap: 3,
80
+ width: "auto",
81
+ border: "1px solid",
82
+ borderColor: "muted",
83
+ borderRadius: 1,
84
+ padding: 4
75
85
  },
76
- children: /* @__PURE__ */ jsxs(
77
- Flex,
78
- {
79
- sx: {
80
- backgroundColor: "background",
81
- justifyContent: "center",
82
- alignItems: "center",
83
- gap: 3,
84
- width: "auto",
85
- border: "1px solid",
86
- borderColor: "muted",
87
- borderRadius: 1,
88
- padding: 4
89
- },
90
- children: [
91
- /* @__PURE__ */ jsx2(Text, { children: "Deseja instalar o nosso aplicativo?" }),
92
- /* @__PURE__ */ jsx2(Button, { onClick: onInstall, children: "Instalar" })
93
- ]
94
- }
95
- )
96
- }
97
- );
86
+ children: [/* @__PURE__ */jsx2(Text, {
87
+ children: "Deseja instalar o nosso aplicativo?"
88
+ }), /* @__PURE__ */jsx2(Button, {
89
+ onClick: onInstall,
90
+ children: "Instalar"
91
+ })]
92
+ })
93
+ });
98
94
  };
99
95
 
100
96
  // src/components/InstallPwa/InstallPwa.tsx
@@ -103,7 +99,7 @@ var InstallPwa = () => {
103
99
  const [supportsPwa, setSupportsPwa] = React3.useState(false);
104
100
  const [promptInstall, setPromptInstall] = React3.useState(null);
105
101
  React3.useEffect(() => {
106
- const handler = (e) => {
102
+ const handler = e => {
107
103
  e.preventDefault();
108
104
  setSupportsPwa(true);
109
105
  setPromptInstall(e);
@@ -111,7 +107,7 @@ var InstallPwa = () => {
111
107
  window.addEventListener("beforeinstallprompt", handler);
112
108
  return () => window.removeEventListener("transitionend", handler);
113
109
  }, []);
114
- const onInstall = (e) => {
110
+ const onInstall = e => {
115
111
  e.preventDefault();
116
112
  if (!promptInstall) {
117
113
  return;
@@ -121,7 +117,9 @@ var InstallPwa = () => {
121
117
  if (!supportsPwa) {
122
118
  return null;
123
119
  }
124
- return /* @__PURE__ */ jsx3(InstallPwaUi, { onInstall });
120
+ return /* @__PURE__ */jsx3(InstallPwaUi, {
121
+ onInstall
122
+ });
125
123
  };
126
124
 
127
125
  // src/components/Modal/Modal.tsx
@@ -132,13 +130,11 @@ ReactModal.defaultStyles = {
132
130
  overlay: {},
133
131
  content: {}
134
132
  };
135
- var Modal = (props) => {
136
- const { theme } = useTheme2();
137
- const padding = useResponsiveValue([
138
- theme.space?.[2],
139
- theme.space?.[3],
140
- theme.space?.[4]
141
- ]) || 0;
133
+ var Modal = props => {
134
+ const {
135
+ theme
136
+ } = useTheme2();
137
+ const padding = useResponsiveValue([theme.space?.[2], theme.space?.[3], theme.space?.[4]]) || 0;
142
138
  const style = {
143
139
  overlay: {
144
140
  position: "fixed",
@@ -177,44 +173,40 @@ var Modal = (props) => {
177
173
  ...props.style?.content
178
174
  }
179
175
  };
180
- return /* @__PURE__ */ jsx4(ReactModal, { ...props, style });
176
+ return /* @__PURE__ */jsx4(ReactModal, {
177
+ ...props,
178
+ style
179
+ });
181
180
  };
182
181
  Modal.setAppElement = ReactModal.setAppElement;
183
182
 
184
183
  // src/components/Toast/Toast.tsx
185
184
  import * as React4 from "react";
186
185
  import { Box as Box2 } from "@ttoss/ui";
187
- import {
188
- ToastContainer as ReactToastifyToastContainer,
189
- toast
190
- } from "react-toastify";
186
+ import { ToastContainer as ReactToastifyToastContainer, toast } from "react-toastify";
191
187
  import { injectStyle } from "react-toastify/dist/inject-style";
192
188
  import { jsx as jsx5 } from "react/jsx-runtime";
193
- var ToastContainer = (props) => {
189
+ var ToastContainer = props => {
194
190
  React4.useEffect(() => {
195
191
  injectStyle();
196
192
  }, []);
197
- return /* @__PURE__ */ jsx5(
198
- Box2,
199
- {
200
- sx: ({ colors, fonts }) => ({
201
- "--toastify-color-light": "#fff",
202
- "--toastify-color-dark": "#121212",
203
- "--toastify-color-info": colors?.info || "#3498db",
204
- "--toastify-color-success": colors?.success || "#07bc0c",
205
- "--toastify-color-warning": "#f1c40f",
206
- "--toastify-color-error": "#e74c3c",
207
- "--toastify-color-progress-light": `linear-gradient(to right, ${colors?.primary}, ${colors?.secondary})`,
208
- "--toastify-font-family": fonts.body
209
- }),
210
- children: /* @__PURE__ */ jsx5(ReactToastifyToastContainer, { ...props })
211
- }
212
- );
213
- };
214
- export {
215
- Accordion,
216
- InstallPwa,
217
- Modal,
218
- ToastContainer,
219
- toast
193
+ return /* @__PURE__ */jsx5(Box2, {
194
+ sx: ({
195
+ colors,
196
+ fonts
197
+ }) => ({
198
+ "--toastify-color-light": "#fff",
199
+ "--toastify-color-dark": "#121212",
200
+ "--toastify-color-info": colors?.info || "#3498db",
201
+ "--toastify-color-success": colors?.success || "#07bc0c",
202
+ "--toastify-color-warning": "#f1c40f",
203
+ "--toastify-color-error": "#e74c3c",
204
+ "--toastify-color-progress-light": `linear-gradient(to right, ${colors?.primary}, ${colors?.secondary})`,
205
+ "--toastify-font-family": fonts.body
206
+ }),
207
+ children: /* @__PURE__ */jsx5(ReactToastifyToastContainer, {
208
+ ...props
209
+ })
210
+ });
220
211
  };
212
+ export { Accordion, InstallPwa, Modal, ToastContainer, toast };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
2
  "use strict";
3
+
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,26 +8,32 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
8
  var __getProtoOf = Object.getPrototypeOf;
8
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
10
  var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
12
15
  };
13
16
  var __copyProps = (to, from, except, desc) => {
14
17
  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
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
18
22
  }
19
23
  return to;
20
24
  };
21
25
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
+ // If the importer is in node compatibility mode or this is not an ESM
27
+ // file that has been converted to a CommonJS file using a Babel-
28
+ // compatible transform (i.e. "__esModule" has not been set), then set
29
+ // "default" to the CommonJS "module.exports" for node compatibility.
30
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
31
+ value: mod,
32
+ enumerable: true
33
+ }) : target, mod));
34
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
35
+ value: true
36
+ }), mod);
30
37
 
31
38
  // src/index.ts
32
39
  var src_exports = {};
@@ -54,7 +61,9 @@ var Accordion = ({
54
61
  onChange,
55
62
  ...boxProps
56
63
  }) => {
57
- const { theme } = (0, import_ui.useTheme)();
64
+ const {
65
+ theme
66
+ } = (0, import_ui.useTheme)();
58
67
  const className = React.useMemo(() => {
59
68
  const styles = (0, import_css2.css)({
60
69
  ".accordion__item": {
@@ -72,9 +81,11 @@ var Accordion = ({
72
81
  })(theme);
73
82
  return (0, import_css.css)(styles);
74
83
  }, [theme]);
75
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Box, { variant: "accordion", className, ...boxProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
76
- import_react_accessible_accordion.Accordion,
77
- {
84
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ui.Box, {
85
+ variant: "accordion",
86
+ className,
87
+ ...boxProps,
88
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react_accessible_accordion.Accordion, {
78
89
  ...{
79
90
  allowMultipleExpanded,
80
91
  allowZeroExpanded,
@@ -82,8 +93,8 @@ var Accordion = ({
82
93
  onChange
83
94
  },
84
95
  children
85
- }
86
- ) });
96
+ })
97
+ });
87
98
  };
88
99
  Accordion.Item = import_react_accessible_accordion.AccordionItem;
89
100
  Accordion.ItemButton = import_react_accessible_accordion.AccordionItemButton;
@@ -96,38 +107,36 @@ var React3 = __toESM(require("react"));
96
107
  // src/components/InstallPwa/InstallPwaUi.tsx
97
108
  var import_ui2 = require("@ttoss/ui");
98
109
  var import_jsx_runtime2 = require("react/jsx-runtime");
99
- var InstallPwaUi = ({ onInstall }) => {
100
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
101
- import_ui2.Flex,
102
- {
110
+ var InstallPwaUi = ({
111
+ onInstall
112
+ }) => {
113
+ return /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui2.Flex, {
114
+ sx: {
115
+ position: "absolute",
116
+ bottom: 4,
117
+ width: "100%",
118
+ justifyContent: "center"
119
+ },
120
+ children: /* @__PURE__ */(0, import_jsx_runtime2.jsxs)(import_ui2.Flex, {
103
121
  sx: {
104
- position: "absolute",
105
- bottom: 4,
106
- width: "100%",
107
- justifyContent: "center"
122
+ backgroundColor: "background",
123
+ justifyContent: "center",
124
+ alignItems: "center",
125
+ gap: 3,
126
+ width: "auto",
127
+ border: "1px solid",
128
+ borderColor: "muted",
129
+ borderRadius: 1,
130
+ padding: 4
108
131
  },
109
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
110
- import_ui2.Flex,
111
- {
112
- sx: {
113
- backgroundColor: "background",
114
- justifyContent: "center",
115
- alignItems: "center",
116
- gap: 3,
117
- width: "auto",
118
- border: "1px solid",
119
- borderColor: "muted",
120
- borderRadius: 1,
121
- padding: 4
122
- },
123
- children: [
124
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui2.Text, { children: "Deseja instalar o nosso aplicativo?" }),
125
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui2.Button, { onClick: onInstall, children: "Instalar" })
126
- ]
127
- }
128
- )
129
- }
130
- );
132
+ children: [/* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui2.Text, {
133
+ children: "Deseja instalar o nosso aplicativo?"
134
+ }), /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_ui2.Button, {
135
+ onClick: onInstall,
136
+ children: "Instalar"
137
+ })]
138
+ })
139
+ });
131
140
  };
132
141
 
133
142
  // src/components/InstallPwa/InstallPwa.tsx
@@ -136,7 +145,7 @@ var InstallPwa = () => {
136
145
  const [supportsPwa, setSupportsPwa] = React3.useState(false);
137
146
  const [promptInstall, setPromptInstall] = React3.useState(null);
138
147
  React3.useEffect(() => {
139
- const handler = (e) => {
148
+ const handler = e => {
140
149
  e.preventDefault();
141
150
  setSupportsPwa(true);
142
151
  setPromptInstall(e);
@@ -144,7 +153,7 @@ var InstallPwa = () => {
144
153
  window.addEventListener("beforeinstallprompt", handler);
145
154
  return () => window.removeEventListener("transitionend", handler);
146
155
  }, []);
147
- const onInstall = (e) => {
156
+ const onInstall = e => {
148
157
  e.preventDefault();
149
158
  if (!promptInstall) {
150
159
  return;
@@ -154,7 +163,9 @@ var InstallPwa = () => {
154
163
  if (!supportsPwa) {
155
164
  return null;
156
165
  }
157
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InstallPwaUi, { onInstall });
166
+ return /* @__PURE__ */(0, import_jsx_runtime3.jsx)(InstallPwaUi, {
167
+ onInstall
168
+ });
158
169
  };
159
170
 
160
171
  // src/components/Modal/Modal.tsx
@@ -165,13 +176,11 @@ import_react_modal.default.defaultStyles = {
165
176
  overlay: {},
166
177
  content: {}
167
178
  };
168
- var Modal = (props) => {
169
- const { theme } = (0, import_ui3.useTheme)();
170
- const padding = (0, import_ui3.useResponsiveValue)([
171
- theme.space?.[2],
172
- theme.space?.[3],
173
- theme.space?.[4]
174
- ]) || 0;
179
+ var Modal = props => {
180
+ const {
181
+ theme
182
+ } = (0, import_ui3.useTheme)();
183
+ const padding = (0, import_ui3.useResponsiveValue)([theme.space?.[2], theme.space?.[3], theme.space?.[4]]) || 0;
175
184
  const style = {
176
185
  overlay: {
177
186
  position: "fixed",
@@ -210,7 +219,10 @@ var Modal = (props) => {
210
219
  ...props.style?.content
211
220
  }
212
221
  };
213
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_modal.default, { ...props, style });
222
+ return /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_react_modal.default, {
223
+ ...props,
224
+ style
225
+ });
214
226
  };
215
227
  Modal.setAppElement = import_react_modal.default.setAppElement;
216
228
 
@@ -220,26 +232,28 @@ var import_ui4 = require("@ttoss/ui");
220
232
  var import_react_toastify = require("react-toastify");
221
233
  var import_inject_style = require("react-toastify/dist/inject-style");
222
234
  var import_jsx_runtime5 = require("react/jsx-runtime");
223
- var ToastContainer = (props) => {
235
+ var ToastContainer = props => {
224
236
  React4.useEffect(() => {
225
237
  (0, import_inject_style.injectStyle)();
226
238
  }, []);
227
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
228
- import_ui4.Box,
229
- {
230
- sx: ({ colors, fonts }) => ({
231
- "--toastify-color-light": "#fff",
232
- "--toastify-color-dark": "#121212",
233
- "--toastify-color-info": colors?.info || "#3498db",
234
- "--toastify-color-success": colors?.success || "#07bc0c",
235
- "--toastify-color-warning": "#f1c40f",
236
- "--toastify-color-error": "#e74c3c",
237
- "--toastify-color-progress-light": `linear-gradient(to right, ${colors?.primary}, ${colors?.secondary})`,
238
- "--toastify-font-family": fonts.body
239
- }),
240
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_toastify.ToastContainer, { ...props })
241
- }
242
- );
239
+ return /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_ui4.Box, {
240
+ sx: ({
241
+ colors,
242
+ fonts
243
+ }) => ({
244
+ "--toastify-color-light": "#fff",
245
+ "--toastify-color-dark": "#121212",
246
+ "--toastify-color-info": colors?.info || "#3498db",
247
+ "--toastify-color-success": colors?.success || "#07bc0c",
248
+ "--toastify-color-warning": "#f1c40f",
249
+ "--toastify-color-error": "#e74c3c",
250
+ "--toastify-color-progress-light": `linear-gradient(to right, ${colors?.primary}, ${colors?.secondary})`,
251
+ "--toastify-font-family": fonts.body
252
+ }),
253
+ children: /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_react_toastify.ToastContainer, {
254
+ ...props
255
+ })
256
+ });
243
257
  };
244
258
  // Annotate the CommonJS export names for ESM import in node:
245
259
  0 && (module.exports = {
@@ -248,4 +262,4 @@ var ToastContainer = (props) => {
248
262
  Modal,
249
263
  ToastContainer,
250
264
  toast
251
- });
265
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/components",
3
- "version": "1.26.14",
3
+ "version": "1.26.16",
4
4
  "description": "React components.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -33,9 +33,9 @@
33
33
  "react": ">=16.8.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@ttoss/config": "^1.29.1",
37
- "@ttoss/test-utils": "^1.20.8",
38
- "@ttoss/ui": "^1.31.1",
36
+ "@ttoss/config": "^1.29.2",
37
+ "@ttoss/test-utils": "^1.20.9",
38
+ "@ttoss/ui": "^1.31.3",
39
39
  "@types/jest": "^29.5.0",
40
40
  "jest": "^29.5.0"
41
41
  },
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "ee0c2e51d38f37f997c020d4303cf90be720ecb0"
49
+ "gitHead": "792b02e52847725c19fdceffb606c201840d5910"
50
50
  }