@ttoss/ui 1.31.0 → 1.31.2

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
@@ -14,19 +14,18 @@ var ThemeProvider = ({
14
14
  theme = BruttalTheme,
15
15
  fonts = BruttalFonts
16
16
  }) => {
17
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(ThemeUiProvider, { theme, children: [
18
- /* @__PURE__ */ jsx(
19
- Global,
20
- {
17
+ return /* @__PURE__ */jsx(Fragment, {
18
+ children: /* @__PURE__ */jsxs(ThemeUiProvider, {
19
+ theme,
20
+ children: [/* @__PURE__ */jsx(Global, {
21
21
  styles: css`
22
- ${fonts.map((url) => {
22
+ ${fonts.map(url => {
23
23
  return `@import url('${url}');`;
24
24
  }).join("\n")}
25
25
  `
26
- }
27
- ),
28
- children
29
- ] }) });
26
+ }), children]
27
+ })
28
+ });
30
29
  };
31
30
 
32
31
  // src/theme/useTheme.ts
@@ -41,61 +40,52 @@ import { Box } from "theme-ui";
41
40
 
42
41
  // src/components/Button.tsx
43
42
  import * as React3 from "react";
44
- import {
45
- Button as ButtonUi
46
- } from "theme-ui";
43
+ import { Button as ButtonUi } from "theme-ui";
47
44
 
48
45
  // src/components/Icon.tsx
49
46
  import * as React2 from "react";
50
- import {
51
- Icon as IconifyIcon
52
- } from "@iconify-icon/react";
47
+ import { Icon as IconifyIcon } from "@iconify-icon/react";
53
48
  import { jsx as jsx2 } from "react/jsx-runtime";
54
- var Icon = React2.forwardRef(
55
- (props, ref) => {
56
- return /* @__PURE__ */ jsx2(IconifyIcon, { ref, "data-testid": "iconify-icon", ...props });
57
- }
58
- );
49
+ var Icon = /*#__PURE__*/React2.forwardRef((props, ref) => {
50
+ return /* @__PURE__ */jsx2(IconifyIcon, {
51
+ ref,
52
+ "data-testid": "iconify-icon",
53
+ ...props
54
+ });
55
+ });
59
56
  Icon.displayName = "Icon";
60
57
 
61
58
  // src/components/Button.tsx
62
- import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
63
- var RenderIcon = ({ icon }) => {
64
- if (!icon) {
65
- return null;
66
- }
67
- if (typeof icon === "string") {
68
- return /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3(Icon, { icon }) });
69
- }
70
- return /* @__PURE__ */ jsx3(Fragment2, { children: icon });
71
- };
72
- var MemoizedRenderIcon = React3.memo(RenderIcon);
73
- var Button = React3.forwardRef(
74
- (props, ref) => {
75
- const { children, leftIcon, rightIcon, ...restProps } = props;
76
- return /* @__PURE__ */ jsxs2(
77
- ButtonUi,
78
- {
79
- ref,
80
- ...restProps,
81
- sx: {
82
- cursor: "pointer",
83
- paddingX: "lg",
84
- paddingY: "md",
85
- display: "inline-flex",
86
- alignItems: "center",
87
- gap: "lg",
88
- ...restProps.sx
89
- },
90
- children: [
91
- /* @__PURE__ */ jsx3(MemoizedRenderIcon, { icon: leftIcon }),
92
- children,
93
- /* @__PURE__ */ jsx3(MemoizedRenderIcon, { icon: rightIcon })
94
- ]
95
- }
96
- );
97
- }
98
- );
59
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
60
+ var Button = /*#__PURE__*/React3.forwardRef((props, ref) => {
61
+ const {
62
+ children,
63
+ leftIcon,
64
+ rightIcon,
65
+ ...restProps
66
+ } = props;
67
+ return /* @__PURE__ */jsxs2(ButtonUi, {
68
+ ref,
69
+ type: "button",
70
+ ...restProps,
71
+ sx: {
72
+ cursor: "pointer",
73
+ paddingX: "lg",
74
+ paddingY: "md",
75
+ display: "inline-flex",
76
+ alignItems: "center",
77
+ gap: "lg",
78
+ ...restProps.sx
79
+ },
80
+ children: [leftIcon && /* @__PURE__ */jsx3(Icon, {
81
+ inline: true,
82
+ icon: leftIcon
83
+ }), children, rightIcon && /* @__PURE__ */jsx3(Icon, {
84
+ inline: true,
85
+ icon: rightIcon
86
+ })]
87
+ });
88
+ });
99
89
  Button.displayName = "Button";
100
90
 
101
91
  // src/components/Card.tsx
@@ -120,52 +110,51 @@ import { Image } from "theme-ui";
120
110
  import React4 from "react";
121
111
  import { Input as InputUI } from "theme-ui";
122
112
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
123
- var Input = React4.forwardRef(
124
- ({ leadingIcon, trailingIcon, sx, ...inputProps }, ref) => {
125
- return /* @__PURE__ */ jsxs3(Flex, { sx: { position: "relative" }, children: [
126
- leadingIcon && /* @__PURE__ */ jsx4(
127
- Text,
128
- {
129
- sx: {
130
- position: "absolute",
131
- alignSelf: "center",
132
- fontSize: "lg",
133
- left: "1rem",
134
- lineHeight: 0
135
- },
136
- variant: "leading-icon",
137
- children: /* @__PURE__ */ jsx4(Icon, { icon: leadingIcon })
138
- }
139
- ),
140
- /* @__PURE__ */ jsx4(
141
- InputUI,
142
- {
143
- ref,
144
- sx: {
145
- paddingLeft: leadingIcon ? "3xl" : void 0,
146
- paddingRight: trailingIcon ? "3xl" : void 0,
147
- ...sx
148
- },
149
- ...inputProps
150
- }
151
- ),
152
- trailingIcon && /* @__PURE__ */ jsx4(
153
- Text,
154
- {
155
- sx: {
156
- position: "absolute",
157
- right: "1rem",
158
- alignSelf: "center",
159
- fontSize: "lg",
160
- lineHeight: 0
161
- },
162
- variant: "trailing-icon",
163
- children: /* @__PURE__ */ jsx4(Icon, { icon: trailingIcon })
164
- }
165
- )
166
- ] });
167
- }
168
- );
113
+ var Input = /*#__PURE__*/React4.forwardRef(({
114
+ leadingIcon,
115
+ trailingIcon,
116
+ sx,
117
+ ...inputProps
118
+ }, ref) => {
119
+ return /* @__PURE__ */jsxs3(Flex, {
120
+ sx: {
121
+ position: "relative"
122
+ },
123
+ children: [leadingIcon && /* @__PURE__ */jsx4(Text, {
124
+ sx: {
125
+ position: "absolute",
126
+ alignSelf: "center",
127
+ fontSize: "lg",
128
+ left: "1rem",
129
+ lineHeight: 0
130
+ },
131
+ variant: "leading-icon",
132
+ children: /* @__PURE__ */jsx4(Icon, {
133
+ icon: leadingIcon
134
+ })
135
+ }), /* @__PURE__ */jsx4(InputUI, {
136
+ ref,
137
+ sx: {
138
+ paddingLeft: leadingIcon ? "3xl" : void 0,
139
+ paddingRight: trailingIcon ? "3xl" : void 0,
140
+ ...sx
141
+ },
142
+ ...inputProps
143
+ }), trailingIcon && /* @__PURE__ */jsx4(Text, {
144
+ sx: {
145
+ position: "absolute",
146
+ right: "1rem",
147
+ alignSelf: "center",
148
+ fontSize: "lg",
149
+ lineHeight: 0
150
+ },
151
+ variant: "trailing-icon",
152
+ children: /* @__PURE__ */jsx4(Icon, {
153
+ icon: trailingIcon
154
+ })
155
+ })]
156
+ });
157
+ });
169
158
  Input.displayName = "Input";
170
159
 
171
160
  // src/components/Label.tsx
@@ -175,9 +164,7 @@ import { Label } from "theme-ui";
175
164
  import { Link } from "theme-ui";
176
165
 
177
166
  // src/components/LinearProgress.tsx
178
- import {
179
- Progress
180
- } from "theme-ui";
167
+ import { Progress } from "theme-ui";
181
168
 
182
169
  // src/components/Text.tsx
183
170
  import { Text } from "theme-ui";
@@ -208,7 +195,7 @@ var InfiniteLinearProgress = () => {
208
195
  const [progress, setProgress] = React5.useState(0);
209
196
  React5.useEffect(() => {
210
197
  const timer = setInterval(() => {
211
- setProgress((oldProgress) => {
198
+ setProgress(oldProgress => {
212
199
  if (oldProgress === MAX_PROGRESS) {
213
200
  return 0;
214
201
  }
@@ -227,7 +214,11 @@ var InfiniteLinearProgress = () => {
227
214
  clearInterval(timer);
228
215
  };
229
216
  }, []);
230
- return /* @__PURE__ */ jsx5(Progress, { max: MAX_PROGRESS, value: progress, role: "progressbar" });
217
+ return /* @__PURE__ */jsx5(Progress, {
218
+ max: MAX_PROGRESS,
219
+ value: progress,
220
+ role: "progressbar"
221
+ });
231
222
  };
232
223
 
233
224
  // src/components/Textarea.tsx
@@ -235,34 +226,4 @@ import { Textarea } from "theme-ui";
235
226
 
236
227
  // src/components/Container.tsx
237
228
  import { Container } from "theme-ui";
238
- export {
239
- Badge,
240
- BaseStyles,
241
- Box,
242
- Button,
243
- Card,
244
- Checkbox,
245
- Container,
246
- Divider,
247
- Flex,
248
- Grid,
249
- Heading,
250
- Icon,
251
- IconButton,
252
- Image,
253
- InfiniteLinearProgress,
254
- Input,
255
- Label,
256
- Progress as LinearProgress,
257
- Link,
258
- Radio,
259
- Select,
260
- Slider,
261
- Spinner,
262
- Text,
263
- Textarea,
264
- ThemeProvider,
265
- useBreakpointIndex,
266
- useResponsiveValue,
267
- useTheme
268
- };
229
+ export { Badge, BaseStyles, Box, Button, Card, Checkbox, Container, Divider, Flex, Grid, Heading, Icon, IconButton, Image, InfiniteLinearProgress, Input, Label, Progress as LinearProgress, Link, Radio, Select, Slider, Spinner, Text, Textarea, ThemeProvider, useBreakpointIndex, useResponsiveValue, useTheme };
package/dist/index.d.ts CHANGED
@@ -19,9 +19,13 @@ declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) =
19
19
 
20
20
  declare const useTheme: () => theme_ui.ThemeUIContextValue;
21
21
 
22
+ type IconType = string | IconifyIcon;
23
+ type IconProps = Omit<IconifyIconProps, 'ref'>;
24
+ declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<IconifyIconHTMLElement | null>>;
25
+
22
26
  type ButtonProps = ButtonProps$1 & {
23
- leftIcon?: React.ReactNode | string;
24
- rightIcon?: React.ReactNode | string;
27
+ leftIcon?: IconType;
28
+ rightIcon?: IconType;
25
29
  };
26
30
  declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
27
31
 
@@ -31,10 +35,6 @@ type InputProps = InputProps$1 & {
31
35
  };
32
36
  declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
33
37
 
34
- type IconType = string | IconifyIcon;
35
- type IconProps = Omit<IconifyIconProps, 'ref'>;
36
- declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<IconifyIconHTMLElement | null>>;
37
-
38
38
  declare const InfiniteLinearProgress: () => JSX.Element;
39
39
 
40
40
  export { Button, ButtonProps, Icon, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, ThemeProvider, ThemeProviderProps, useTheme };
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 = {};
@@ -75,19 +82,18 @@ var ThemeProvider = ({
75
82
  theme = import_Bruttal.BruttalTheme,
76
83
  fonts = import_Bruttal.BruttalFonts
77
84
  }) => {
78
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_theme_ui.ThemeProvider, { theme, children: [
79
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
80
- import_react.Global,
81
- {
85
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
86
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_theme_ui.ThemeProvider, {
87
+ theme,
88
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react.Global, {
82
89
  styles: import_react.css`
83
- ${fonts.map((url) => {
90
+ ${fonts.map(url => {
84
91
  return `@import url('${url}');`;
85
92
  }).join("\n")}
86
93
  `
87
- }
88
- ),
89
- children
90
- ] }) });
94
+ }), children]
95
+ })
96
+ });
91
97
  };
92
98
 
93
99
  // src/theme/useTheme.ts
@@ -108,51 +114,46 @@ var import_theme_ui5 = require("theme-ui");
108
114
  var React2 = __toESM(require("react"));
109
115
  var import_react2 = require("@iconify-icon/react");
110
116
  var import_jsx_runtime2 = require("react/jsx-runtime");
111
- var Icon = React2.forwardRef(
112
- (props, ref) => {
113
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.Icon, { ref, "data-testid": "iconify-icon", ...props });
114
- }
115
- );
117
+ var Icon = React2.forwardRef((props, ref) => {
118
+ return /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_react2.Icon, {
119
+ ref,
120
+ "data-testid": "iconify-icon",
121
+ ...props
122
+ });
123
+ });
116
124
  Icon.displayName = "Icon";
117
125
 
118
126
  // src/components/Button.tsx
119
127
  var import_jsx_runtime3 = require("react/jsx-runtime");
120
- var RenderIcon = ({ icon }) => {
121
- if (!icon) {
122
- return null;
123
- }
124
- if (typeof icon === "string") {
125
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon, { icon }) });
126
- }
127
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: icon });
128
- };
129
- var MemoizedRenderIcon = React3.memo(RenderIcon);
130
- var Button = React3.forwardRef(
131
- (props, ref) => {
132
- const { children, leftIcon, rightIcon, ...restProps } = props;
133
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
134
- import_theme_ui5.Button,
135
- {
136
- ref,
137
- ...restProps,
138
- sx: {
139
- cursor: "pointer",
140
- paddingX: "lg",
141
- paddingY: "md",
142
- display: "inline-flex",
143
- alignItems: "center",
144
- gap: "lg",
145
- ...restProps.sx
146
- },
147
- children: [
148
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MemoizedRenderIcon, { icon: leftIcon }),
149
- children,
150
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MemoizedRenderIcon, { icon: rightIcon })
151
- ]
152
- }
153
- );
154
- }
155
- );
128
+ var Button = React3.forwardRef((props, ref) => {
129
+ const {
130
+ children,
131
+ leftIcon,
132
+ rightIcon,
133
+ ...restProps
134
+ } = props;
135
+ return /* @__PURE__ */(0, import_jsx_runtime3.jsxs)(import_theme_ui5.Button, {
136
+ ref,
137
+ type: "button",
138
+ ...restProps,
139
+ sx: {
140
+ cursor: "pointer",
141
+ paddingX: "lg",
142
+ paddingY: "md",
143
+ display: "inline-flex",
144
+ alignItems: "center",
145
+ gap: "lg",
146
+ ...restProps.sx
147
+ },
148
+ children: [leftIcon && /* @__PURE__ */(0, import_jsx_runtime3.jsx)(Icon, {
149
+ inline: true,
150
+ icon: leftIcon
151
+ }), children, rightIcon && /* @__PURE__ */(0, import_jsx_runtime3.jsx)(Icon, {
152
+ inline: true,
153
+ icon: rightIcon
154
+ })]
155
+ });
156
+ });
156
157
  Button.displayName = "Button";
157
158
 
158
159
  // src/components/Card.tsx
@@ -177,52 +178,51 @@ var import_theme_ui11 = require("theme-ui");
177
178
  var import_react3 = __toESM(require("react"));
178
179
  var import_theme_ui12 = require("theme-ui");
179
180
  var import_jsx_runtime4 = require("react/jsx-runtime");
180
- var Input = import_react3.default.forwardRef(
181
- ({ leadingIcon, trailingIcon, sx, ...inputProps }, ref) => {
182
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_theme_ui8.Flex, { sx: { position: "relative" }, children: [
183
- leadingIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
184
- import_theme_ui16.Text,
185
- {
186
- sx: {
187
- position: "absolute",
188
- alignSelf: "center",
189
- fontSize: "lg",
190
- left: "1rem",
191
- lineHeight: 0
192
- },
193
- variant: "leading-icon",
194
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { icon: leadingIcon })
195
- }
196
- ),
197
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
198
- import_theme_ui12.Input,
199
- {
200
- ref,
201
- sx: {
202
- paddingLeft: leadingIcon ? "3xl" : void 0,
203
- paddingRight: trailingIcon ? "3xl" : void 0,
204
- ...sx
205
- },
206
- ...inputProps
207
- }
208
- ),
209
- trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
210
- import_theme_ui16.Text,
211
- {
212
- sx: {
213
- position: "absolute",
214
- right: "1rem",
215
- alignSelf: "center",
216
- fontSize: "lg",
217
- lineHeight: 0
218
- },
219
- variant: "trailing-icon",
220
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { icon: trailingIcon })
221
- }
222
- )
223
- ] });
224
- }
225
- );
181
+ var Input = import_react3.default.forwardRef(({
182
+ leadingIcon,
183
+ trailingIcon,
184
+ sx,
185
+ ...inputProps
186
+ }, ref) => {
187
+ return /* @__PURE__ */(0, import_jsx_runtime4.jsxs)(import_theme_ui8.Flex, {
188
+ sx: {
189
+ position: "relative"
190
+ },
191
+ children: [leadingIcon && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui16.Text, {
192
+ sx: {
193
+ position: "absolute",
194
+ alignSelf: "center",
195
+ fontSize: "lg",
196
+ left: "1rem",
197
+ lineHeight: 0
198
+ },
199
+ variant: "leading-icon",
200
+ children: /* @__PURE__ */(0, import_jsx_runtime4.jsx)(Icon, {
201
+ icon: leadingIcon
202
+ })
203
+ }), /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui12.Input, {
204
+ ref,
205
+ sx: {
206
+ paddingLeft: leadingIcon ? "3xl" : void 0,
207
+ paddingRight: trailingIcon ? "3xl" : void 0,
208
+ ...sx
209
+ },
210
+ ...inputProps
211
+ }), trailingIcon && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui16.Text, {
212
+ sx: {
213
+ position: "absolute",
214
+ right: "1rem",
215
+ alignSelf: "center",
216
+ fontSize: "lg",
217
+ lineHeight: 0
218
+ },
219
+ variant: "trailing-icon",
220
+ children: /* @__PURE__ */(0, import_jsx_runtime4.jsx)(Icon, {
221
+ icon: trailingIcon
222
+ })
223
+ })]
224
+ });
225
+ });
226
226
  Input.displayName = "Input";
227
227
 
228
228
  // src/components/Label.tsx
@@ -263,7 +263,7 @@ var InfiniteLinearProgress = () => {
263
263
  const [progress, setProgress] = React5.useState(0);
264
264
  React5.useEffect(() => {
265
265
  const timer = setInterval(() => {
266
- setProgress((oldProgress) => {
266
+ setProgress(oldProgress => {
267
267
  if (oldProgress === MAX_PROGRESS) {
268
268
  return 0;
269
269
  }
@@ -282,7 +282,11 @@ var InfiniteLinearProgress = () => {
282
282
  clearInterval(timer);
283
283
  };
284
284
  }, []);
285
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_theme_ui15.Progress, { max: MAX_PROGRESS, value: progress, role: "progressbar" });
285
+ return /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_theme_ui15.Progress, {
286
+ max: MAX_PROGRESS,
287
+ value: progress,
288
+ role: "progressbar"
289
+ });
286
290
  };
287
291
 
288
292
  // src/components/Textarea.tsx
@@ -321,4 +325,4 @@ var import_theme_ui24 = require("theme-ui");
321
325
  useBreakpointIndex,
322
326
  useResponsiveValue,
323
327
  useTheme
324
- });
328
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.31.0",
3
+ "version": "1.31.2",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -24,18 +24,19 @@
24
24
  "@emotion/react": "^11.10.6",
25
25
  "@iconify-icon/react": "^1.0.7",
26
26
  "@theme-ui/match-media": "^0.15.5",
27
- "@ttoss/theme": "^1.4.0",
27
+ "@ttoss/theme": "^1.4.2",
28
28
  "theme-ui": "^0.15.5"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "react": ">=16.8.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@ttoss/config": "^1.29.0",
35
- "@ttoss/test-utils": "^1.20.7",
36
- "@types/jest": "^29.4.4",
34
+ "@ttoss/config": "^1.29.2",
35
+ "@ttoss/test-utils": "^1.20.9",
36
+ "@types/jest": "^29.5.0",
37
37
  "jest": "^29.5.0",
38
- "tsup": "^6.6.3"
38
+ "react": "^18.2.0",
39
+ "tsup": "^6.7.0"
39
40
  },
40
41
  "keywords": [
41
42
  "React",
@@ -45,5 +46,5 @@
45
46
  "publishConfig": {
46
47
  "access": "public"
47
48
  },
48
- "gitHead": "2dc5f62e02ab8c901d6bb603024488b6aa3dda2b"
49
+ "gitHead": "0609bb0f6e6a1c0999c29e7a5c8f8ebb1c6d3d7a"
49
50
  }
@@ -3,31 +3,13 @@ import {
3
3
  type ButtonProps as ButtonPropsUi,
4
4
  Button as ButtonUi,
5
5
  } from 'theme-ui';
6
- import { Icon } from './Icon';
6
+ import { Icon, IconType } from './Icon';
7
7
 
8
8
  export type ButtonProps = ButtonPropsUi & {
9
- leftIcon?: React.ReactNode | string;
10
- rightIcon?: React.ReactNode | string;
9
+ leftIcon?: IconType;
10
+ rightIcon?: IconType;
11
11
  };
12
12
 
13
- const RenderIcon = ({ icon }: { icon: React.ReactNode | string }) => {
14
- if (!icon) {
15
- return null;
16
- }
17
-
18
- if (typeof icon === 'string') {
19
- return (
20
- <>
21
- <Icon icon={icon} />
22
- </>
23
- );
24
- }
25
-
26
- return <>{icon}</>;
27
- };
28
-
29
- const MemoizedRenderIcon = React.memo(RenderIcon);
30
-
31
13
  export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
32
14
  (props, ref) => {
33
15
  const { children, leftIcon, rightIcon, ...restProps } = props;
@@ -35,6 +17,7 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
35
17
  return (
36
18
  <ButtonUi
37
19
  ref={ref}
20
+ type="button"
38
21
  {...restProps}
39
22
  sx={{
40
23
  cursor: 'pointer',
@@ -46,9 +29,9 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
46
29
  ...restProps.sx,
47
30
  }}
48
31
  >
49
- <MemoizedRenderIcon icon={leftIcon} />
32
+ {leftIcon && <Icon inline icon={leftIcon} />}
50
33
  {children}
51
- <MemoizedRenderIcon icon={rightIcon} />
34
+ {rightIcon && <Icon inline icon={rightIcon} />}
52
35
  </ButtonUi>
53
36
  );
54
37
  }