@ttoss/ui 1.16.1 → 1.16.5

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,9 @@ 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',
47
+ "https://fonts.googleapis.com/css?family=Roboto:400,500,700&display=swap",
48
48
  ,
49
- 'https://fonts.googleapis.com/css?family=Roboto+Mono&display=swap',
49
+ "https://fonts.googleapis.com/css?family=Roboto+Mono&display=swap",
50
50
  ]}
51
51
  >
52
52
  <App />
package/dist/esm/index.js CHANGED
@@ -1,37 +1,150 @@
1
+ "use strict";
2
+ var __create = Object.create;
1
3
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  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;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
18
10
  };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11
+ var __commonJS = (cb, mod) => function __require() {
12
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
23
 
21
24
  // tsup.inject.js
22
25
  import * as React from "react";
26
+ var init_tsup_inject = __esm({
27
+ "tsup.inject.js"() {
28
+ "use strict";
29
+ }
30
+ });
31
+
32
+ // ../../node_modules/deepmerge/dist/cjs.js
33
+ var require_cjs = __commonJS({
34
+ "../../node_modules/deepmerge/dist/cjs.js"(exports, module) {
35
+ "use strict";
36
+ init_tsup_inject();
37
+ var isMergeableObject = function isMergeableObject2(value) {
38
+ return isNonNullObject(value) && !isSpecial(value);
39
+ };
40
+ function isNonNullObject(value) {
41
+ return !!value && typeof value === "object";
42
+ }
43
+ function isSpecial(value) {
44
+ var stringValue = Object.prototype.toString.call(value);
45
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
46
+ }
47
+ var canUseSymbol2 = typeof Symbol === "function" && Symbol.for;
48
+ var REACT_ELEMENT_TYPE = canUseSymbol2 ? Symbol.for("react.element") : 60103;
49
+ function isReactElement(value) {
50
+ return value.$$typeof === REACT_ELEMENT_TYPE;
51
+ }
52
+ function emptyTarget(val) {
53
+ return Array.isArray(val) ? [] : {};
54
+ }
55
+ function cloneUnlessOtherwiseSpecified(value, options) {
56
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
57
+ }
58
+ function defaultArrayMerge(target, source, options) {
59
+ return target.concat(source).map(function(element) {
60
+ return cloneUnlessOtherwiseSpecified(element, options);
61
+ });
62
+ }
63
+ function getMergeFunction(key, options) {
64
+ if (!options.customMerge) {
65
+ return deepmerge2;
66
+ }
67
+ var customMerge = options.customMerge(key);
68
+ return typeof customMerge === "function" ? customMerge : deepmerge2;
69
+ }
70
+ function getEnumerableOwnPropertySymbols(target) {
71
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
72
+ return target.propertyIsEnumerable(symbol);
73
+ }) : [];
74
+ }
75
+ function getKeys(target) {
76
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
77
+ }
78
+ function propertyIsOnObject(object, property) {
79
+ try {
80
+ return property in object;
81
+ } catch (_) {
82
+ return false;
83
+ }
84
+ }
85
+ function propertyIsUnsafe(target, key) {
86
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
87
+ }
88
+ function mergeObject(target, source, options) {
89
+ var destination = {};
90
+ if (options.isMergeableObject(target)) {
91
+ getKeys(target).forEach(function(key) {
92
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
93
+ });
94
+ }
95
+ getKeys(source).forEach(function(key) {
96
+ if (propertyIsUnsafe(target, key)) {
97
+ return;
98
+ }
99
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
100
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
101
+ } else {
102
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
103
+ }
104
+ });
105
+ return destination;
106
+ }
107
+ function deepmerge2(target, source, options) {
108
+ options = options || {};
109
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
110
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
111
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
112
+ var sourceIsArray = Array.isArray(source);
113
+ var targetIsArray = Array.isArray(target);
114
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
115
+ if (!sourceAndTargetTypesMatch) {
116
+ return cloneUnlessOtherwiseSpecified(source, options);
117
+ } else if (sourceIsArray) {
118
+ return options.arrayMerge(target, source, options);
119
+ } else {
120
+ return mergeObject(target, source, options);
121
+ }
122
+ }
123
+ deepmerge2.all = function deepmergeAll(array, options) {
124
+ if (!Array.isArray(array)) {
125
+ throw new Error("first argument should be an array");
126
+ }
127
+ return array.reduce(function(prev, next) {
128
+ return deepmerge2(prev, next, options);
129
+ }, {});
130
+ };
131
+ var deepmerge_1 = deepmerge2;
132
+ module.exports = deepmerge_1;
133
+ }
134
+ });
23
135
 
24
136
  // src/index.ts
25
- import * as color from "@theme-ui/color";
137
+ init_tsup_inject();
26
138
  import { useResponsiveValue, useBreakpointIndex } from "@theme-ui/match-media";
27
- import { Themed } from "@theme-ui/mdx";
28
139
 
29
140
  // src/theme/ThemeProvider.tsx
30
- import { Global, css } from "@emotion/react";
31
- import { ThemeProvider as ThemeUiProvider, merge } from "@theme-ui/core";
141
+ init_tsup_inject();
32
142
  import * as React2 from "react";
143
+ import { Global, css } from "@emotion/react";
144
+ import { ThemeProvider as ThemeUiProvider, merge } from "theme-ui";
33
145
 
34
146
  // src/theme/defaultFonts.ts
147
+ init_tsup_inject();
35
148
  var defaultFonts = [
36
149
  "https://fonts.googleapis.com/css?family=Asap",
37
150
  "https://fonts.googleapis.com/css?family=Overpass",
@@ -40,6 +153,7 @@ var defaultFonts = [
40
153
  ];
41
154
 
42
155
  // src/theme/defaultTheme.ts
156
+ init_tsup_inject();
43
157
  var defaultTheme = {
44
158
  colors: {
45
159
  text: "#000",
@@ -134,116 +248,118 @@ var ThemeProvider = ({
134
248
  styles: css`
135
249
  @import url('${url}');
136
250
  `
137
- })), /* @__PURE__ */ React2.createElement(Global, {
138
- styles: {
139
- "*": {
140
- margin: 0
141
- }
142
- }
143
- }), children));
251
+ })), children));
144
252
  };
145
253
  var ThemeProvider_default = ThemeProvider;
146
254
 
147
255
  // src/theme/useTheme.ts
148
- import { useThemeUI } from "@theme-ui/core";
256
+ init_tsup_inject();
257
+
258
+ // ../../node_modules/@theme-ui/core/dist/theme-ui-core.esm.js
259
+ init_tsup_inject();
260
+ var import_deepmerge = __toESM(require_cjs());
261
+ import { jsx as jsx$1, ThemeContext } from "@emotion/react";
262
+ import { createContext, useContext } from "react";
263
+ import packageInfo from "@emotion/react/package.json";
264
+ var __EMOTION_VERSION__ = packageInfo.version;
265
+ var __themeUiDefaultContextValue = {
266
+ __EMOTION_VERSION__,
267
+ theme: {}
268
+ };
269
+ var __ThemeUIContext = /* @__PURE__ */ createContext(__themeUiDefaultContextValue);
270
+ var useThemeUI = () => useContext(__ThemeUIContext);
271
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
272
+ var REACT_ELEMENT = canUseSymbol ? Symbol.for("react.element") : 60103;
273
+ var FORWARD_REF = canUseSymbol ? Symbol.for("react.forward_ref") : 60103;
274
+ var deepmergeOptions = {
275
+ isMergeableObject: (n) => {
276
+ return !!n && typeof n === "object" && n.$$typeof !== REACT_ELEMENT && n.$$typeof !== FORWARD_REF;
277
+ },
278
+ arrayMerge: (_leftArray, rightArray) => rightArray
279
+ };
280
+ var merge2 = (a, b) => (0, import_deepmerge.default)(a, b, deepmergeOptions);
281
+ function mergeAll(...args) {
282
+ return import_deepmerge.default.all(args, deepmergeOptions);
283
+ }
284
+ merge2.all = mergeAll;
285
+
286
+ // src/theme/useTheme.ts
149
287
  var useTheme = useThemeUI;
150
288
 
151
289
  // src/components/Box/Box.tsx
152
- import { Box } from "@theme-ui/components";
290
+ init_tsup_inject();
291
+ import { Box } from "theme-ui";
153
292
 
154
293
  // src/components/Button/Button.tsx
155
- import { Button as ButtonUi } from "@theme-ui/components";
294
+ init_tsup_inject();
295
+ import { Button as ButtonUi } from "theme-ui";
156
296
  var Button = (props) => {
157
- return /* @__PURE__ */ React.createElement(ButtonUi, __spreadProps(__spreadValues({}, props), {
158
- sx: __spreadValues({ cursor: "pointer", fontFamily: "body" }, props.sx)
159
- }));
297
+ return /* @__PURE__ */ React.createElement(ButtonUi, {
298
+ ...props,
299
+ sx: { cursor: "pointer", fontFamily: "body", ...props.sx }
300
+ });
160
301
  };
161
- var Button_default = Button;
162
302
 
163
303
  // src/components/Card/Card.tsx
164
- import { Card } from "@theme-ui/components";
304
+ init_tsup_inject();
305
+ import { Card } from "theme-ui";
165
306
 
166
307
  // src/components/Divider/Divider.tsx
167
- import { Divider, DividerProps } from "@theme-ui/components";
308
+ init_tsup_inject();
309
+ import { Divider } from "theme-ui";
168
310
 
169
311
  // 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;
312
+ init_tsup_inject();
313
+ import { Flex } from "theme-ui";
203
314
 
204
315
  // src/components/Grid/Grid.tsx
205
- import { Grid } from "@theme-ui/components";
316
+ init_tsup_inject();
317
+ import { Grid } from "theme-ui";
206
318
 
207
319
  // src/components/Heading/Heading.tsx
208
- import { Heading, HeadingProps } from "@theme-ui/components";
320
+ init_tsup_inject();
321
+ import { Heading } from "theme-ui";
209
322
 
210
323
  // src/components/Image/Image.tsx
211
- import { Image } from "@theme-ui/components";
324
+ init_tsup_inject();
325
+ import { Image } from "theme-ui";
212
326
 
213
327
  // src/components/Input/Input.tsx
214
- import { Input } from "@theme-ui/components";
328
+ init_tsup_inject();
329
+ import { Input } from "theme-ui";
215
330
 
216
331
  // src/components/Link/Link.tsx
217
- import { Link } from "@theme-ui/components";
332
+ init_tsup_inject();
333
+ import { Link } from "theme-ui";
218
334
 
219
335
  // src/components/LinearProgress/LinearProgress.tsx
220
- import { Progress } from "@theme-ui/components";
221
- var LinearProgress = Progress;
336
+ init_tsup_inject();
337
+ import {
338
+ Progress
339
+ } from "theme-ui";
222
340
 
223
- // src/components/Select/Select.tsx
224
- import { Select } from "@theme-ui/components";
341
+ // src/components/Text/Text.tsx
342
+ init_tsup_inject();
343
+ import { Text } from "theme-ui";
225
344
 
226
- // src/components/Spinner/Spinner.tsx
227
- import { Spinner } from "@theme-ui/components";
345
+ // src/components/Select/Select.tsx
346
+ init_tsup_inject();
347
+ import { Select } from "theme-ui";
228
348
  export {
229
349
  Box,
230
- Button_default as Button,
350
+ Button,
231
351
  Card,
232
352
  Divider,
233
353
  Flex,
234
- FormField_default as FormField,
235
354
  Grid,
236
355
  Heading,
237
356
  Image,
238
357
  Input,
239
- LinearProgress,
358
+ Progress as LinearProgress,
240
359
  Link,
241
360
  Select,
242
- Spinner,
243
361
  Text,
244
362
  ThemeProvider_default as ThemeProvider,
245
- Themed,
246
- color,
247
363
  useBreakpointIndex,
248
364
  useResponsiveValue,
249
365
  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 { Theme, ButtonProps } from 'theme-ui';
2
+ 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
3
  export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
7
- export { Themed } from '@theme-ui/mdx';
8
4
  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';
5
+ import * as _theme_ui_core from '@theme-ui/core';
12
6
 
13
7
  declare type ThemeProviderProps = {
14
8
  children?: React.ReactNode;
@@ -24,14 +18,4 @@ declare const useTheme: () => _theme_ui_core.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,16 @@
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;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
11
+ var __commonJS = (cb, mod) => function __require() {
12
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
22
13
  };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
14
  var __export = (target, all) => {
25
15
  for (var name in all)
26
16
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -36,47 +26,152 @@ var __copyProps = (to, from, except, desc) => {
36
26
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
37
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
28
 
29
+ // tsup.inject.js
30
+ var React;
31
+ var init_tsup_inject = __esm({
32
+ "tsup.inject.js"() {
33
+ "use strict";
34
+ React = __toESM(require("react"));
35
+ }
36
+ });
37
+
38
+ // ../../node_modules/deepmerge/dist/cjs.js
39
+ var require_cjs = __commonJS({
40
+ "../../node_modules/deepmerge/dist/cjs.js"(exports, module2) {
41
+ "use strict";
42
+ init_tsup_inject();
43
+ var isMergeableObject = function isMergeableObject2(value) {
44
+ return isNonNullObject(value) && !isSpecial(value);
45
+ };
46
+ function isNonNullObject(value) {
47
+ return !!value && typeof value === "object";
48
+ }
49
+ function isSpecial(value) {
50
+ var stringValue = Object.prototype.toString.call(value);
51
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
52
+ }
53
+ var canUseSymbol2 = typeof Symbol === "function" && Symbol.for;
54
+ var REACT_ELEMENT_TYPE = canUseSymbol2 ? Symbol.for("react.element") : 60103;
55
+ function isReactElement(value) {
56
+ return value.$$typeof === REACT_ELEMENT_TYPE;
57
+ }
58
+ function emptyTarget(val) {
59
+ return Array.isArray(val) ? [] : {};
60
+ }
61
+ function cloneUnlessOtherwiseSpecified(value, options) {
62
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
63
+ }
64
+ function defaultArrayMerge(target, source, options) {
65
+ return target.concat(source).map(function(element) {
66
+ return cloneUnlessOtherwiseSpecified(element, options);
67
+ });
68
+ }
69
+ function getMergeFunction(key, options) {
70
+ if (!options.customMerge) {
71
+ return deepmerge2;
72
+ }
73
+ var customMerge = options.customMerge(key);
74
+ return typeof customMerge === "function" ? customMerge : deepmerge2;
75
+ }
76
+ function getEnumerableOwnPropertySymbols(target) {
77
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
78
+ return target.propertyIsEnumerable(symbol);
79
+ }) : [];
80
+ }
81
+ function getKeys(target) {
82
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
83
+ }
84
+ function propertyIsOnObject(object, property) {
85
+ try {
86
+ return property in object;
87
+ } catch (_) {
88
+ return false;
89
+ }
90
+ }
91
+ function propertyIsUnsafe(target, key) {
92
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
93
+ }
94
+ function mergeObject(target, source, options) {
95
+ var destination = {};
96
+ if (options.isMergeableObject(target)) {
97
+ getKeys(target).forEach(function(key) {
98
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
99
+ });
100
+ }
101
+ getKeys(source).forEach(function(key) {
102
+ if (propertyIsUnsafe(target, key)) {
103
+ return;
104
+ }
105
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
106
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
107
+ } else {
108
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
109
+ }
110
+ });
111
+ return destination;
112
+ }
113
+ function deepmerge2(target, source, options) {
114
+ options = options || {};
115
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
116
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
117
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
118
+ var sourceIsArray = Array.isArray(source);
119
+ var targetIsArray = Array.isArray(target);
120
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
121
+ if (!sourceAndTargetTypesMatch) {
122
+ return cloneUnlessOtherwiseSpecified(source, options);
123
+ } else if (sourceIsArray) {
124
+ return options.arrayMerge(target, source, options);
125
+ } else {
126
+ return mergeObject(target, source, options);
127
+ }
128
+ }
129
+ deepmerge2.all = function deepmergeAll(array, options) {
130
+ if (!Array.isArray(array)) {
131
+ throw new Error("first argument should be an array");
132
+ }
133
+ return array.reduce(function(prev, next) {
134
+ return deepmerge2(prev, next, options);
135
+ }, {});
136
+ };
137
+ var deepmerge_1 = deepmerge2;
138
+ module2.exports = deepmerge_1;
139
+ }
140
+ });
141
+
39
142
  // src/index.ts
40
143
  var src_exports = {};
41
144
  __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,
145
+ Box: () => import_theme_ui2.Box,
146
+ Button: () => Button,
147
+ Card: () => import_theme_ui4.Card,
148
+ Divider: () => import_theme_ui5.Divider,
149
+ Flex: () => import_theme_ui6.Flex,
150
+ Grid: () => import_theme_ui7.Grid,
151
+ Heading: () => import_theme_ui8.Heading,
152
+ Image: () => import_theme_ui9.Image,
153
+ Input: () => import_theme_ui10.Input,
154
+ LinearProgress: () => import_theme_ui12.Progress,
155
+ Link: () => import_theme_ui11.Link,
156
+ Select: () => import_theme_ui14.Select,
157
+ Text: () => import_theme_ui13.Text,
57
158
  ThemeProvider: () => ThemeProvider_default,
58
- Themed: () => import_mdx.Themed,
59
- color: () => color,
60
159
  useBreakpointIndex: () => import_match_media.useBreakpointIndex,
61
160
  useResponsiveValue: () => import_match_media.useResponsiveValue,
62
161
  useTheme: () => useTheme
63
162
  });
64
163
  module.exports = __toCommonJS(src_exports);
65
-
66
- // tsup.inject.js
67
- var React = __toESM(require("react"));
68
-
69
- // src/index.ts
70
- var color = __toESM(require("@theme-ui/color"));
164
+ init_tsup_inject();
71
165
  var import_match_media = require("@theme-ui/match-media");
72
- var import_mdx = require("@theme-ui/mdx");
73
166
 
74
167
  // src/theme/ThemeProvider.tsx
75
- var import_react = require("@emotion/react");
76
- var import_core = require("@theme-ui/core");
168
+ init_tsup_inject();
77
169
  var React2 = __toESM(require("react"));
170
+ var import_react = require("@emotion/react");
171
+ var import_theme_ui = require("theme-ui");
78
172
 
79
173
  // src/theme/defaultFonts.ts
174
+ init_tsup_inject();
80
175
  var defaultFonts = [
81
176
  "https://fonts.googleapis.com/css?family=Asap",
82
177
  "https://fonts.googleapis.com/css?family=Overpass",
@@ -85,6 +180,7 @@ var defaultFonts = [
85
180
  ];
86
181
 
87
182
  // src/theme/defaultTheme.ts
183
+ init_tsup_inject();
88
184
  var defaultTheme = {
89
185
  colors: {
90
186
  text: "#000",
@@ -170,106 +266,110 @@ var ThemeProvider = ({
170
266
  if (typeof theme === "function") {
171
267
  return theme;
172
268
  }
173
- return (0, import_core.merge)(defaultTheme, theme);
269
+ return (0, import_theme_ui.merge)(defaultTheme, theme);
174
270
  }, [theme]);
175
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(import_core.ThemeProvider, {
271
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(import_theme_ui.ThemeProvider, {
176
272
  theme: mergedTheme
177
273
  }, fonts.map((url) => /* @__PURE__ */ React2.createElement(import_react.Global, {
178
274
  key: url,
179
275
  styles: import_react.css`
180
276
  @import url('${url}');
181
277
  `
182
- })), /* @__PURE__ */ React2.createElement(import_react.Global, {
183
- styles: {
184
- "*": {
185
- margin: 0
186
- }
187
- }
188
- }), children));
278
+ })), children));
189
279
  };
190
280
  var ThemeProvider_default = ThemeProvider;
191
281
 
192
282
  // src/theme/useTheme.ts
193
- var import_core2 = require("@theme-ui/core");
194
- var useTheme = import_core2.useThemeUI;
283
+ init_tsup_inject();
284
+
285
+ // ../../node_modules/@theme-ui/core/dist/theme-ui-core.esm.js
286
+ init_tsup_inject();
287
+ var import_react2 = require("@emotion/react");
288
+ var import_react3 = require("react");
289
+ var import_deepmerge = __toESM(require_cjs());
290
+ var import_package = __toESM(require("@emotion/react/package.json"));
291
+ var __EMOTION_VERSION__ = import_package.default.version;
292
+ var __themeUiDefaultContextValue = {
293
+ __EMOTION_VERSION__,
294
+ theme: {}
295
+ };
296
+ var __ThemeUIContext = /* @__PURE__ */ (0, import_react3.createContext)(__themeUiDefaultContextValue);
297
+ var useThemeUI = () => (0, import_react3.useContext)(__ThemeUIContext);
298
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
299
+ var REACT_ELEMENT = canUseSymbol ? Symbol.for("react.element") : 60103;
300
+ var FORWARD_REF = canUseSymbol ? Symbol.for("react.forward_ref") : 60103;
301
+ var deepmergeOptions = {
302
+ isMergeableObject: (n) => {
303
+ return !!n && typeof n === "object" && n.$$typeof !== REACT_ELEMENT && n.$$typeof !== FORWARD_REF;
304
+ },
305
+ arrayMerge: (_leftArray, rightArray) => rightArray
306
+ };
307
+ var merge2 = (a, b) => (0, import_deepmerge.default)(a, b, deepmergeOptions);
308
+ function mergeAll(...args) {
309
+ return import_deepmerge.default.all(args, deepmergeOptions);
310
+ }
311
+ merge2.all = mergeAll;
312
+
313
+ // src/theme/useTheme.ts
314
+ var useTheme = useThemeUI;
195
315
 
196
316
  // src/components/Box/Box.tsx
197
- var import_components = require("@theme-ui/components");
317
+ init_tsup_inject();
318
+ var import_theme_ui2 = require("theme-ui");
198
319
 
199
320
  // src/components/Button/Button.tsx
200
- var import_components2 = require("@theme-ui/components");
321
+ init_tsup_inject();
322
+ var import_theme_ui3 = require("theme-ui");
201
323
  var Button = (props) => {
202
- return /* @__PURE__ */ React.createElement(import_components2.Button, __spreadProps(__spreadValues({}, props), {
203
- sx: __spreadValues({ cursor: "pointer", fontFamily: "body" }, props.sx)
204
- }));
324
+ return /* @__PURE__ */ React.createElement(import_theme_ui3.Button, {
325
+ ...props,
326
+ sx: { cursor: "pointer", fontFamily: "body", ...props.sx }
327
+ });
205
328
  };
206
- var Button_default = Button;
207
329
 
208
330
  // src/components/Card/Card.tsx
209
- var import_components3 = require("@theme-ui/components");
331
+ init_tsup_inject();
332
+ var import_theme_ui4 = require("theme-ui");
210
333
 
211
334
  // src/components/Divider/Divider.tsx
212
- var import_components4 = require("@theme-ui/components");
335
+ init_tsup_inject();
336
+ var import_theme_ui5 = require("theme-ui");
213
337
 
214
338
  // 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;
339
+ init_tsup_inject();
340
+ var import_theme_ui6 = require("theme-ui");
248
341
 
249
342
  // src/components/Grid/Grid.tsx
250
- var import_components8 = require("@theme-ui/components");
343
+ init_tsup_inject();
344
+ var import_theme_ui7 = require("theme-ui");
251
345
 
252
346
  // src/components/Heading/Heading.tsx
253
- var import_components9 = require("@theme-ui/components");
347
+ init_tsup_inject();
348
+ var import_theme_ui8 = require("theme-ui");
254
349
 
255
350
  // src/components/Image/Image.tsx
256
- var import_components10 = require("@theme-ui/components");
351
+ init_tsup_inject();
352
+ var import_theme_ui9 = require("theme-ui");
257
353
 
258
354
  // src/components/Input/Input.tsx
259
- var import_components11 = require("@theme-ui/components");
355
+ init_tsup_inject();
356
+ var import_theme_ui10 = require("theme-ui");
260
357
 
261
358
  // src/components/Link/Link.tsx
262
- var import_components12 = require("@theme-ui/components");
359
+ init_tsup_inject();
360
+ var import_theme_ui11 = require("theme-ui");
263
361
 
264
362
  // src/components/LinearProgress/LinearProgress.tsx
265
- var import_components13 = require("@theme-ui/components");
266
- var LinearProgress = import_components13.Progress;
363
+ init_tsup_inject();
364
+ var import_theme_ui12 = require("theme-ui");
267
365
 
268
- // src/components/Select/Select.tsx
269
- var import_components14 = require("@theme-ui/components");
366
+ // src/components/Text/Text.tsx
367
+ init_tsup_inject();
368
+ var import_theme_ui13 = require("theme-ui");
270
369
 
271
- // src/components/Spinner/Spinner.tsx
272
- var import_components15 = require("@theme-ui/components");
370
+ // src/components/Select/Select.tsx
371
+ init_tsup_inject();
372
+ var import_theme_ui14 = require("theme-ui");
273
373
  // Annotate the CommonJS export names for ESM import in node:
274
374
  0 && (module.exports = {
275
375
  Box,
@@ -277,7 +377,6 @@ var import_components15 = require("@theme-ui/components");
277
377
  Card,
278
378
  Divider,
279
379
  Flex,
280
- FormField,
281
380
  Grid,
282
381
  Heading,
283
382
  Image,
@@ -285,11 +384,8 @@ var import_components15 = require("@theme-ui/components");
285
384
  LinearProgress,
286
385
  Link,
287
386
  Select,
288
- Spinner,
289
387
  Text,
290
388
  ThemeProvider,
291
- Themed,
292
- color,
293
389
  useBreakpointIndex,
294
390
  useResponsiveValue,
295
391
  useTheme
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.16.1",
3
+ "version": "1.16.5",
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
44
  "@ttoss/config": "^1.16.1",
49
- "@ttoss/test-utils": "^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": "d4caf53cd81bff99f232c6908a78e243ab9ed322"
50
+ "gitHead": "84559f07bf60bfccb886db9cea042da09e99bcdb"
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,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';