@ttoss/ui 1.16.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,12 +17,12 @@ $ npm install @ttoss/ui
17
17
  ## 📄 Examples of use
18
18
 
19
19
  ```tsx
20
- import { Flex, Text, Box, Button } from '@ttoss/ui';
20
+ import { Flex, Text, Box, Button } from "@ttoss/ui";
21
21
 
22
22
  const App = () => {
23
23
  return (
24
24
  <ThemeProvider>
25
- <Flex sx={{ flexDirection: 'column' }}>
25
+ <Flex sx={{ flexDirection: "column" }}>
26
26
  <Text>Text Value</Text>
27
27
  <Box>
28
28
  <Text>Text Value</Text>
@@ -44,9 +44,8 @@ You can pass fonts URLs to `ThemeProvider` component thought `fonts` prop.
44
44
  ```tsx
45
45
  <ThemeProvider
46
46
  fonts={[
47
- 'https://fonts.googleapis.com/css?family=Roboto:400,500,700&display=swap',
48
- ,
49
- 'https://fonts.googleapis.com/css?family=Roboto+Mono&display=swap',
47
+ "https://fonts.googleapis.com/css?family=Roboto:400,500,700&display=swap",
48
+ "https://fonts.googleapis.com/css?family=Roboto+Mono&display=swap",
50
49
  ]}
51
50
  >
52
51
  <App />
package/dist/esm/index.js CHANGED
@@ -1,35 +1,15 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1
+ "use strict";
20
2
 
21
3
  // tsup.inject.js
22
4
  import * as React from "react";
23
5
 
24
6
  // src/index.ts
25
- import * as color from "@theme-ui/color";
26
7
  import { useResponsiveValue, useBreakpointIndex } from "@theme-ui/match-media";
27
- import { Themed } from "@theme-ui/mdx";
28
8
 
29
9
  // src/theme/ThemeProvider.tsx
30
- import { Global, css } from "@emotion/react";
31
- import { ThemeProvider as ThemeUiProvider, merge } from "@theme-ui/core";
32
10
  import * as React2 from "react";
11
+ import { Global, css } from "@emotion/react";
12
+ import { ThemeProvider as ThemeUiProvider, merge } from "theme-ui";
33
13
 
34
14
  // src/theme/defaultFonts.ts
35
15
  var defaultFonts = [
@@ -134,116 +114,75 @@ var ThemeProvider = ({
134
114
  styles: css`
135
115
  @import url('${url}');
136
116
  `
137
- })), /* @__PURE__ */ React2.createElement(Global, {
138
- styles: {
139
- "*": {
140
- margin: 0
141
- }
142
- }
143
- }), children));
117
+ })), children));
144
118
  };
145
119
  var ThemeProvider_default = ThemeProvider;
146
120
 
147
121
  // src/theme/useTheme.ts
148
- import { useThemeUI } from "@theme-ui/core";
122
+ import { useThemeUI } from "theme-ui";
149
123
  var useTheme = useThemeUI;
150
124
 
151
125
  // src/components/Box/Box.tsx
152
- import { Box } from "@theme-ui/components";
126
+ import { Box } from "theme-ui";
153
127
 
154
128
  // src/components/Button/Button.tsx
155
- import { Button as ButtonUi } from "@theme-ui/components";
129
+ import { Button as ButtonUi } from "theme-ui";
156
130
  var Button = (props) => {
157
- return /* @__PURE__ */ React.createElement(ButtonUi, __spreadProps(__spreadValues({}, props), {
158
- sx: __spreadValues({ cursor: "pointer", fontFamily: "body" }, props.sx)
159
- }));
131
+ return /* @__PURE__ */ React.createElement(ButtonUi, {
132
+ ...props,
133
+ sx: { cursor: "pointer", fontFamily: "body", ...props.sx }
134
+ });
160
135
  };
161
- var Button_default = Button;
162
136
 
163
137
  // src/components/Card/Card.tsx
164
- import { Card } from "@theme-ui/components";
138
+ import { Card } from "theme-ui";
165
139
 
166
140
  // src/components/Divider/Divider.tsx
167
- import { Divider, DividerProps } from "@theme-ui/components";
141
+ import { Divider } from "theme-ui";
168
142
 
169
143
  // src/components/Flex/Flex.tsx
170
- import { Flex } from "@theme-ui/components";
171
-
172
- // src/components/FormField/FormField.tsx
173
- import * as React3 from "react";
174
-
175
- // src/components/Label/Label.tsx
176
- import { Label } from "@theme-ui/components";
177
-
178
- // src/components/Text/Text.tsx
179
- import { Text } from "@theme-ui/components";
180
-
181
- // src/components/FormField/FormField.tsx
182
- var FormField = ({ children, label, error }) => {
183
- const errorAsArray = (() => {
184
- if (Array.isArray(error)) {
185
- return error;
186
- }
187
- if (typeof error === "string") {
188
- return [error];
189
- }
190
- return [];
191
- })();
192
- return /* @__PURE__ */ React3.createElement(Box, null, /* @__PURE__ */ React3.createElement(Label, {
193
- sx: { display: "flex", flexDirection: "column" }
194
- }, label && /* @__PURE__ */ React3.createElement(Text, {
195
- as: "span"
196
- }, label), children), errorAsArray.map((err) => /* @__PURE__ */ React3.createElement(Text, {
197
- key: err,
198
- as: "span",
199
- variant: "error"
200
- }, err)));
201
- };
202
- var FormField_default = FormField;
144
+ import { Flex } from "theme-ui";
203
145
 
204
146
  // src/components/Grid/Grid.tsx
205
- import { Grid } from "@theme-ui/components";
147
+ import { Grid } from "theme-ui";
206
148
 
207
149
  // src/components/Heading/Heading.tsx
208
- import { Heading, HeadingProps } from "@theme-ui/components";
150
+ import { Heading } from "theme-ui";
209
151
 
210
152
  // src/components/Image/Image.tsx
211
- import { Image } from "@theme-ui/components";
153
+ import { Image } from "theme-ui";
212
154
 
213
155
  // src/components/Input/Input.tsx
214
- import { Input } from "@theme-ui/components";
156
+ import { Input } from "theme-ui";
215
157
 
216
158
  // src/components/Link/Link.tsx
217
- import { Link } from "@theme-ui/components";
159
+ import { Link } from "theme-ui";
218
160
 
219
161
  // src/components/LinearProgress/LinearProgress.tsx
220
- import { Progress } from "@theme-ui/components";
221
- var LinearProgress = Progress;
162
+ import {
163
+ Progress
164
+ } from "theme-ui";
222
165
 
223
- // src/components/Select/Select.tsx
224
- import { Select } from "@theme-ui/components";
166
+ // src/components/Text/Text.tsx
167
+ import { Text } from "theme-ui";
225
168
 
226
- // src/components/Spinner/Spinner.tsx
227
- import { Spinner } from "@theme-ui/components";
169
+ // src/components/Select/Select.tsx
170
+ import { Select } from "theme-ui";
228
171
  export {
229
172
  Box,
230
- Button_default as Button,
173
+ Button,
231
174
  Card,
232
175
  Divider,
233
176
  Flex,
234
- FormField_default as FormField,
235
177
  Grid,
236
178
  Heading,
237
179
  Image,
238
180
  Input,
239
- LinearProgress,
181
+ Progress as LinearProgress,
240
182
  Link,
241
183
  Select,
242
- Spinner,
243
184
  Text,
244
185
  ThemeProvider_default as ThemeProvider,
245
- Themed,
246
- color,
247
186
  useBreakpointIndex,
248
187
  useResponsiveValue,
249
188
  useTheme
package/dist/index.d.ts CHANGED
@@ -1,14 +1,8 @@
1
- import * as color from '@theme-ui/color';
2
- export { color };
3
- import * as _theme_ui_core from '@theme-ui/core';
4
- import { Theme } from '@theme-ui/core';
5
- export { Theme } from '@theme-ui/core';
1
+ import * as theme_ui from 'theme-ui';
2
+ import { Theme, ButtonProps } from 'theme-ui';
3
+ export { Box, BoxProps, ButtonProps, Card, CardProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, Image, ImageProps, Input, InputProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Link, LinkProps, Select, SelectProps, Text, TextProps, Theme } from 'theme-ui';
6
4
  export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
7
- export { Themed } from '@theme-ui/mdx';
8
5
  import * as React from 'react';
9
- import { ButtonProps, ProgressProps } from '@theme-ui/components';
10
- export { Box, BoxProps, ButtonProps, Card, CardProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, Image, ImageProps, Input, InputProps, Link, LinkProps, Select, SelectProps, Spinner, SpinnerProps, Text, TextProps } from '@theme-ui/components';
11
- import * as _theme_ui_components_dist_declarations_src_types from '@theme-ui/components/dist/declarations/src/types';
12
6
 
13
7
  declare type ThemeProviderProps = {
14
8
  children?: React.ReactNode;
@@ -20,18 +14,8 @@ declare type ThemeProviderProps = {
20
14
  };
21
15
  declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) => JSX.Element;
22
16
 
23
- declare const useTheme: () => _theme_ui_core.ThemeUIContextValue;
17
+ declare const useTheme: () => theme_ui.ThemeUIContextValue;
24
18
 
25
19
  declare const Button: (props: ButtonProps) => JSX.Element;
26
20
 
27
- declare type FormFieldProps = {
28
- children?: React.ReactNode;
29
- label?: string;
30
- error?: string[] | string;
31
- };
32
- declare const FormField: ({ children, label, error }: FormFieldProps) => JSX.Element;
33
-
34
- declare type LinearProgressProps = ProgressProps;
35
- declare const LinearProgress: _theme_ui_components_dist_declarations_src_types.ForwardRef<HTMLProgressElement, ProgressProps>;
36
-
37
- export { Button, FormField, FormFieldProps, LinearProgress, LinearProgressProps, ThemeProvider, ThemeProviderProps, useTheme };
21
+ export { Button, ThemeProvider, ThemeProviderProps, useTheme };
package/dist/index.js CHANGED
@@ -1,26 +1,10 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
6
  var __getProtoOf = Object.getPrototypeOf;
9
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
8
  var __export = (target, all) => {
25
9
  for (var name in all)
26
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -39,24 +23,20 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
39
23
  // src/index.ts
40
24
  var src_exports = {};
41
25
  __export(src_exports, {
42
- Box: () => import_components.Box,
43
- Button: () => Button_default,
44
- Card: () => import_components3.Card,
45
- Divider: () => import_components4.Divider,
46
- Flex: () => import_components5.Flex,
47
- FormField: () => FormField_default,
48
- Grid: () => import_components8.Grid,
49
- Heading: () => import_components9.Heading,
50
- Image: () => import_components10.Image,
51
- Input: () => import_components11.Input,
52
- LinearProgress: () => LinearProgress,
53
- Link: () => import_components12.Link,
54
- Select: () => import_components14.Select,
55
- Spinner: () => import_components15.Spinner,
56
- Text: () => import_components7.Text,
26
+ Box: () => import_theme_ui3.Box,
27
+ Button: () => Button,
28
+ Card: () => import_theme_ui5.Card,
29
+ Divider: () => import_theme_ui6.Divider,
30
+ Flex: () => import_theme_ui7.Flex,
31
+ Grid: () => import_theme_ui8.Grid,
32
+ Heading: () => import_theme_ui9.Heading,
33
+ Image: () => import_theme_ui10.Image,
34
+ Input: () => import_theme_ui11.Input,
35
+ LinearProgress: () => import_theme_ui13.Progress,
36
+ Link: () => import_theme_ui12.Link,
37
+ Select: () => import_theme_ui15.Select,
38
+ Text: () => import_theme_ui14.Text,
57
39
  ThemeProvider: () => ThemeProvider_default,
58
- Themed: () => import_mdx.Themed,
59
- color: () => color,
60
40
  useBreakpointIndex: () => import_match_media.useBreakpointIndex,
61
41
  useResponsiveValue: () => import_match_media.useResponsiveValue,
62
42
  useTheme: () => useTheme
@@ -67,14 +47,12 @@ module.exports = __toCommonJS(src_exports);
67
47
  var React = __toESM(require("react"));
68
48
 
69
49
  // src/index.ts
70
- var color = __toESM(require("@theme-ui/color"));
71
50
  var import_match_media = require("@theme-ui/match-media");
72
- var import_mdx = require("@theme-ui/mdx");
73
51
 
74
52
  // src/theme/ThemeProvider.tsx
75
- var import_react = require("@emotion/react");
76
- var import_core = require("@theme-ui/core");
77
53
  var React2 = __toESM(require("react"));
54
+ var import_react = require("@emotion/react");
55
+ var import_theme_ui = require("theme-ui");
78
56
 
79
57
  // src/theme/defaultFonts.ts
80
58
  var defaultFonts = [
@@ -170,106 +148,67 @@ var ThemeProvider = ({
170
148
  if (typeof theme === "function") {
171
149
  return theme;
172
150
  }
173
- return (0, import_core.merge)(defaultTheme, theme);
151
+ return (0, import_theme_ui.merge)(defaultTheme, theme);
174
152
  }, [theme]);
175
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(import_core.ThemeProvider, {
153
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(import_theme_ui.ThemeProvider, {
176
154
  theme: mergedTheme
177
155
  }, fonts.map((url) => /* @__PURE__ */ React2.createElement(import_react.Global, {
178
156
  key: url,
179
157
  styles: import_react.css`
180
158
  @import url('${url}');
181
159
  `
182
- })), /* @__PURE__ */ React2.createElement(import_react.Global, {
183
- styles: {
184
- "*": {
185
- margin: 0
186
- }
187
- }
188
- }), children));
160
+ })), children));
189
161
  };
190
162
  var ThemeProvider_default = ThemeProvider;
191
163
 
192
164
  // src/theme/useTheme.ts
193
- var import_core2 = require("@theme-ui/core");
194
- var useTheme = import_core2.useThemeUI;
165
+ var import_theme_ui2 = require("theme-ui");
166
+ var useTheme = import_theme_ui2.useThemeUI;
195
167
 
196
168
  // src/components/Box/Box.tsx
197
- var import_components = require("@theme-ui/components");
169
+ var import_theme_ui3 = require("theme-ui");
198
170
 
199
171
  // src/components/Button/Button.tsx
200
- var import_components2 = require("@theme-ui/components");
172
+ var import_theme_ui4 = require("theme-ui");
201
173
  var Button = (props) => {
202
- return /* @__PURE__ */ React.createElement(import_components2.Button, __spreadProps(__spreadValues({}, props), {
203
- sx: __spreadValues({ cursor: "pointer", fontFamily: "body" }, props.sx)
204
- }));
174
+ return /* @__PURE__ */ React.createElement(import_theme_ui4.Button, {
175
+ ...props,
176
+ sx: { cursor: "pointer", fontFamily: "body", ...props.sx }
177
+ });
205
178
  };
206
- var Button_default = Button;
207
179
 
208
180
  // src/components/Card/Card.tsx
209
- var import_components3 = require("@theme-ui/components");
181
+ var import_theme_ui5 = require("theme-ui");
210
182
 
211
183
  // src/components/Divider/Divider.tsx
212
- var import_components4 = require("@theme-ui/components");
184
+ var import_theme_ui6 = require("theme-ui");
213
185
 
214
186
  // src/components/Flex/Flex.tsx
215
- var import_components5 = require("@theme-ui/components");
216
-
217
- // src/components/FormField/FormField.tsx
218
- var React3 = __toESM(require("react"));
219
-
220
- // src/components/Label/Label.tsx
221
- var import_components6 = require("@theme-ui/components");
222
-
223
- // src/components/Text/Text.tsx
224
- var import_components7 = require("@theme-ui/components");
225
-
226
- // src/components/FormField/FormField.tsx
227
- var FormField = ({ children, label, error }) => {
228
- const errorAsArray = (() => {
229
- if (Array.isArray(error)) {
230
- return error;
231
- }
232
- if (typeof error === "string") {
233
- return [error];
234
- }
235
- return [];
236
- })();
237
- return /* @__PURE__ */ React3.createElement(import_components.Box, null, /* @__PURE__ */ React3.createElement(import_components6.Label, {
238
- sx: { display: "flex", flexDirection: "column" }
239
- }, label && /* @__PURE__ */ React3.createElement(import_components7.Text, {
240
- as: "span"
241
- }, label), children), errorAsArray.map((err) => /* @__PURE__ */ React3.createElement(import_components7.Text, {
242
- key: err,
243
- as: "span",
244
- variant: "error"
245
- }, err)));
246
- };
247
- var FormField_default = FormField;
187
+ var import_theme_ui7 = require("theme-ui");
248
188
 
249
189
  // src/components/Grid/Grid.tsx
250
- var import_components8 = require("@theme-ui/components");
190
+ var import_theme_ui8 = require("theme-ui");
251
191
 
252
192
  // src/components/Heading/Heading.tsx
253
- var import_components9 = require("@theme-ui/components");
193
+ var import_theme_ui9 = require("theme-ui");
254
194
 
255
195
  // src/components/Image/Image.tsx
256
- var import_components10 = require("@theme-ui/components");
196
+ var import_theme_ui10 = require("theme-ui");
257
197
 
258
198
  // src/components/Input/Input.tsx
259
- var import_components11 = require("@theme-ui/components");
199
+ var import_theme_ui11 = require("theme-ui");
260
200
 
261
201
  // src/components/Link/Link.tsx
262
- var import_components12 = require("@theme-ui/components");
202
+ var import_theme_ui12 = require("theme-ui");
263
203
 
264
204
  // src/components/LinearProgress/LinearProgress.tsx
265
- var import_components13 = require("@theme-ui/components");
266
- var LinearProgress = import_components13.Progress;
205
+ var import_theme_ui13 = require("theme-ui");
267
206
 
268
- // src/components/Select/Select.tsx
269
- var import_components14 = require("@theme-ui/components");
207
+ // src/components/Text/Text.tsx
208
+ var import_theme_ui14 = require("theme-ui");
270
209
 
271
- // src/components/Spinner/Spinner.tsx
272
- var import_components15 = require("@theme-ui/components");
210
+ // src/components/Select/Select.tsx
211
+ var import_theme_ui15 = require("theme-ui");
273
212
  // Annotate the CommonJS export names for ESM import in node:
274
213
  0 && (module.exports = {
275
214
  Box,
@@ -277,7 +216,6 @@ var import_components15 = require("@theme-ui/components");
277
216
  Card,
278
217
  Divider,
279
218
  Flex,
280
- FormField,
281
219
  Grid,
282
220
  Heading,
283
221
  Image,
@@ -285,11 +223,8 @@ var import_components15 = require("@theme-ui/components");
285
223
  LinearProgress,
286
224
  Link,
287
225
  Select,
288
- Spinner,
289
226
  Text,
290
227
  ThemeProvider,
291
- Themed,
292
- color,
293
228
  useBreakpointIndex,
294
229
  useResponsiveValue,
295
230
  useTheme
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.16.0",
3
+ "version": "1.18.0",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -33,20 +33,19 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@emotion/react": "^11",
36
- "@emotion/styled": "^11",
37
36
  "@mdx-js/react": "^1",
38
- "@theme-ui/color": "^0.14.3",
39
- "@theme-ui/components": "^0.14.3",
40
- "@theme-ui/core": "^0.14.3",
41
37
  "@theme-ui/match-media": "^0.14.3",
42
- "@theme-ui/mdx": "^0.14.3"
38
+ "theme-ui": "^0.14.6"
43
39
  },
44
40
  "peerDependencies": {
45
- "react": ">=16.8.0"
41
+ "react": ">=18.0.0"
46
42
  },
47
43
  "devDependencies": {
48
- "@ttoss/config": "^1.16.0",
49
- "@ttoss/test-utils": "^1.16.0"
44
+ "@ttoss/config": "^1.16.1",
45
+ "@ttoss/test-utils": "^1.16.5",
46
+ "@types/jest": "^28.1.3",
47
+ "jest": "^28.1.1",
48
+ "tsup": "^6.1.2"
50
49
  },
51
- "gitHead": "0412266ba0223a5b42904254a13d96473006e0a3"
50
+ "gitHead": "38d76661c6302b6447804375cd0193be9056b446"
52
51
  }
@@ -1,3 +1 @@
1
- export { Box as default } from '@theme-ui/components';
2
-
3
- export type { BoxProps } from '@theme-ui/components';
1
+ export { Box, type BoxProps } from 'theme-ui';
@@ -1,10 +1,8 @@
1
- import { Button as ButtonUi } from '@theme-ui/components';
2
-
3
- import type { ButtonProps } from '@theme-ui/components';
1
+ import { type ButtonProps, Button as ButtonUi } from 'theme-ui';
4
2
 
5
3
  export type { ButtonProps };
6
4
 
7
- const Button = (props: ButtonProps) => {
5
+ export const Button = (props: ButtonProps) => {
8
6
  return (
9
7
  <ButtonUi
10
8
  {...props}
@@ -12,5 +10,3 @@ const Button = (props: ButtonProps) => {
12
10
  />
13
11
  );
14
12
  };
15
-
16
- export default Button;
@@ -1,3 +1 @@
1
- export { Card as default } from '@theme-ui/components';
2
-
3
- export type { CardProps } from '@theme-ui/components';
1
+ export { Card, type CardProps } from 'theme-ui';
@@ -1 +1 @@
1
- export { Divider, DividerProps } from '@theme-ui/components';
1
+ export { Divider, type DividerProps } from 'theme-ui';
@@ -1,3 +1 @@
1
- export { Flex as default } from '@theme-ui/components';
2
-
3
- export type { FlexProps } from '@theme-ui/components';
1
+ export { Flex, type FlexProps } from 'theme-ui';
@@ -1 +1 @@
1
- export { Grid, type GridProps } from '@theme-ui/components';
1
+ export { Grid, type GridProps } from 'theme-ui';
@@ -1 +1 @@
1
- export { Heading, HeadingProps } from '@theme-ui/components';
1
+ export { Heading, type HeadingProps } from 'theme-ui';
@@ -1,3 +1 @@
1
- export { Image as default } from '@theme-ui/components';
2
-
3
- export type { ImageProps } from '@theme-ui/components';
1
+ export { Image, type ImageProps } from 'theme-ui';
@@ -1,3 +1 @@
1
- export { Input as default } from '@theme-ui/components';
2
-
3
- export type { InputProps } from '@theme-ui/components';
1
+ export { Input, type InputProps } from 'theme-ui';
@@ -1,3 +1 @@
1
- export { Label as default } from '@theme-ui/components';
2
-
3
- export type { LabelProps } from '@theme-ui/components';
1
+ export { Label, type LabelProps } from 'theme-ui';
@@ -1,5 +1,4 @@
1
- import { Progress, ProgressProps } from '@theme-ui/components';
2
-
3
- export type LinearProgressProps = ProgressProps;
4
-
5
- export const LinearProgress = Progress;
1
+ export {
2
+ Progress as LinearProgress,
3
+ type ProgressProps as LinearProgressProps,
4
+ } from 'theme-ui';
@@ -1,3 +1 @@
1
- export { Link as default } from '@theme-ui/components';
2
-
3
- export type { LinkProps } from '@theme-ui/components';
1
+ export { Link, type LinkProps } from 'theme-ui';
@@ -1,3 +1 @@
1
- export { Select as default } from '@theme-ui/components';
2
-
3
- export type { SelectProps } from '@theme-ui/components';
1
+ export { Select, type SelectProps } from 'theme-ui';
@@ -1,3 +1 @@
1
- export { Text as default } from '@theme-ui/components';
2
-
3
- export type { TextProps } from '@theme-ui/components';
1
+ export { Text, type TextProps } from 'theme-ui';
package/src/index.ts CHANGED
@@ -1,7 +1,5 @@
1
- export * as color from '@theme-ui/color';
2
- export type { Theme } from '@theme-ui/core';
1
+ export type { Theme } from 'theme-ui';
3
2
  export { useResponsiveValue, useBreakpointIndex } from '@theme-ui/match-media';
4
- export { Themed } from '@theme-ui/mdx';
5
3
 
6
4
  export {
7
5
  default as ThemeProvider,
@@ -10,33 +8,19 @@ export {
10
8
 
11
9
  export { useTheme } from './theme/useTheme';
12
10
 
13
- export { default as Box, type BoxProps } from './components/Box/Box';
14
- export {
15
- default as Button,
16
- type ButtonProps,
17
- } from './components/Button/Button';
18
- export { default as Card, type CardProps } from './components/Card/Card';
11
+ export { Box, type BoxProps } from './components/Box/Box';
12
+ export { Button, type ButtonProps } from './components/Button/Button';
13
+ export { Card, type CardProps } from './components/Card/Card';
19
14
  export { Divider, type DividerProps } from './components/Divider/Divider';
20
- export { default as Flex, type FlexProps } from './components/Flex/Flex';
21
- export {
22
- default as FormField,
23
- type FormFieldProps,
24
- } from './components/FormField/FormField';
15
+ export { Flex, type FlexProps } from './components/Flex/Flex';
25
16
  export { Grid, type GridProps } from './components/Grid/Grid';
26
17
  export { Heading, type HeadingProps } from './components/Heading/Heading';
27
- export { default as Image, type ImageProps } from './components/Image/Image';
28
- export { default as Input, type InputProps } from './components/Input/Input';
29
- export { default as Link, type LinkProps } from './components/Link/Link';
18
+ export { Image, type ImageProps } from './components/Image/Image';
19
+ export { Input, type InputProps } from './components/Input/Input';
20
+ export { Link, type LinkProps } from './components/Link/Link';
30
21
  export {
31
22
  LinearProgress,
32
23
  type LinearProgressProps,
33
24
  } from './components/LinearProgress/LinearProgress';
34
- export { default as Text, type TextProps } from './components/Text/Text';
35
- export {
36
- default as Select,
37
- type SelectProps,
38
- } from './components/Select/Select';
39
- export {
40
- default as Spinner,
41
- type SpinnerProps,
42
- } from './components/Spinner/Spinner'
25
+ export { Text, type TextProps } from './components/Text/Text';
26
+ export { Select, type SelectProps } from './components/Select/Select';
@@ -1,8 +1,7 @@
1
- import { renderHook } from '@ttoss/test-utils';
2
-
3
1
  import { defaultTheme } from './defaultTheme';
4
- import ThemeProvider from './ThemeProvider';
2
+ import { renderHook } from '@ttoss/test-utils';
5
3
  import { useTheme } from './useTheme';
4
+ import ThemeProvider from './ThemeProvider';
6
5
 
7
6
  test('should return default theme colors', () => {
8
7
  const { result } = renderHook(() => useTheme(), {
@@ -10,30 +9,33 @@ test('should return default theme colors', () => {
10
9
  initialProps: { theme: {} },
11
10
  });
12
11
 
13
- expect(result.current.theme.colors).toEqual(defaultTheme.colors);
12
+ expect(result.current.theme.rawColors).toEqual(defaultTheme.colors);
14
13
  });
15
14
 
16
15
  test('should return new theme colors', () => {
17
16
  const newColor = '#000';
18
17
 
19
18
  const { result } = renderHook(() => useTheme(), {
20
- wrapper: ThemeProvider,
21
- initialProps: {
22
- theme: {
23
- colors: {
24
- background: newColor,
25
- text: newColor,
26
- primary: newColor,
27
- secondary: newColor,
28
- },
29
- },
30
- },
19
+ wrapper: ({ children }: any) => (
20
+ <ThemeProvider
21
+ theme={{
22
+ colors: {
23
+ background: newColor,
24
+ text: newColor,
25
+ primary: newColor,
26
+ secondary: newColor,
27
+ },
28
+ }}
29
+ >
30
+ {children}
31
+ </ThemeProvider>
32
+ ),
31
33
  });
32
34
 
33
- expect(result.current.theme.colors?.background).toEqual(newColor);
34
- expect(result.current.theme.colors?.text).toEqual(newColor);
35
- expect(result.current.theme.colors?.primary).toEqual(newColor);
36
- expect(result.current.theme.colors?.secondary).toEqual(newColor);
35
+ expect(result.current.theme.rawColors?.background).toEqual(newColor);
36
+ expect(result.current.theme.rawColors?.text).toEqual(newColor);
37
+ expect(result.current.theme.rawColors?.primary).toEqual(newColor);
38
+ expect(result.current.theme.rawColors?.secondary).toEqual(newColor);
37
39
  });
38
40
 
39
41
  test('should pass variants', () => {
@@ -55,13 +57,16 @@ test('should pass variants', () => {
55
57
  };
56
58
 
57
59
  const { result } = renderHook(() => useTheme(), {
58
- wrapper: ThemeProvider,
59
- initialProps: {
60
- theme: {
61
- colors: {},
62
- ...variants,
63
- },
64
- },
60
+ wrapper: ({ children }: any) => (
61
+ <ThemeProvider
62
+ theme={{
63
+ colors: {},
64
+ ...variants,
65
+ }}
66
+ >
67
+ {children}
68
+ </ThemeProvider>
69
+ ),
65
70
  });
66
71
 
67
72
  expect(result.current.theme.cards).toEqual(
@@ -1,7 +1,6 @@
1
- import { Global, css } from '@emotion/react';
2
- import { ThemeProvider as ThemeUiProvider, Theme, merge } from '@theme-ui/core';
3
1
  import * as React from 'react';
4
-
2
+ import { Global, css } from '@emotion/react';
3
+ import { Theme, ThemeProvider as ThemeUiProvider, merge } from 'theme-ui';
5
4
  import { defaultFonts } from './defaultFonts';
6
5
  import { defaultTheme } from './defaultTheme';
7
6
 
@@ -38,13 +37,6 @@ const ThemeProvider = ({
38
37
  `}
39
38
  />
40
39
  ))}
41
- <Global
42
- styles={{
43
- '*': {
44
- margin: 0,
45
- },
46
- }}
47
- />
48
40
  {children}
49
41
  </ThemeUiProvider>
50
42
  </>
@@ -1,4 +1,4 @@
1
- import { Theme } from '@theme-ui/core';
1
+ import { Theme } from 'theme-ui';
2
2
 
3
3
  export const defaultTheme: Theme = {
4
4
  colors: {
@@ -1,3 +1,3 @@
1
- import { useThemeUI } from '@theme-ui/core';
1
+ import { useThemeUI } from 'theme-ui';
2
2
 
3
3
  export const useTheme = useThemeUI;
@@ -1,54 +0,0 @@
1
- import { render, screen } from '@ttoss/test-utils';
2
-
3
- import Input from '../Input/Input';
4
-
5
- import FormField from './FormField';
6
-
7
- const label = 'Label';
8
- const value = 'Value';
9
-
10
- test('check if label is rendered on screen', () => {
11
- render(
12
- <FormField label={label}>
13
- <Input defaultValue={value} />
14
- </FormField>
15
- );
16
-
17
- expect(screen.getByText(label)).toBeInTheDocument();
18
- });
19
-
20
- test('check if label is associated with input', () => {
21
- render(
22
- <FormField label={label}>
23
- <Input defaultValue={value} />
24
- </FormField>
25
- );
26
-
27
- expect(screen.getByLabelText(label)).toHaveValue(value);
28
- });
29
-
30
- test('check if renders a single error', () => {
31
- const error = 'Error';
32
-
33
- render(
34
- <FormField label={label} error={error}>
35
- <Input defaultValue={value} />
36
- </FormField>
37
- );
38
-
39
- expect(screen.getByText(error)).toBeInTheDocument();
40
- });
41
-
42
- test('check if renders multiple errors', () => {
43
- const errors = ['Error1', 'Error2', 'Error3'];
44
-
45
- render(
46
- <FormField label={label} error={errors}>
47
- <Input defaultValue={value} />
48
- </FormField>
49
- );
50
-
51
- errors.forEach((error) => {
52
- expect(screen.getByText(error)).toBeInTheDocument();
53
- });
54
- });
@@ -1,41 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import Box from '../Box/Box';
4
- import Label from '../Label/Label';
5
- import Text from '../Text/Text';
6
-
7
- export type FormFieldProps = {
8
- children?: React.ReactNode;
9
- label?: string;
10
- error?: string[] | string;
11
- };
12
-
13
- const FormField = ({ children, label, error }: FormFieldProps) => {
14
- const errorAsArray = (() => {
15
- if (Array.isArray(error)) {
16
- return error;
17
- }
18
-
19
- if (typeof error === 'string') {
20
- return [error];
21
- }
22
-
23
- return [];
24
- })();
25
-
26
- return (
27
- <Box>
28
- <Label sx={{ display: 'flex', flexDirection: 'column' }}>
29
- {label && <Text as="span">{label}</Text>}
30
- {children}
31
- </Label>
32
- {errorAsArray.map((err) => (
33
- <Text key={err} as="span" variant="error">
34
- {err}
35
- </Text>
36
- ))}
37
- </Box>
38
- );
39
- };
40
-
41
- export default FormField;
@@ -1,3 +0,0 @@
1
- export { Spinner as default } from '@theme-ui/components';
2
-
3
- export type { SpinnerProps } from '@theme-ui/components';