@ttoss/ui 1.2.0 → 1.5.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/dist/esm/index.js CHANGED
@@ -27,10 +27,7 @@ import { Themed } from "@theme-ui/mdx";
27
27
 
28
28
  // src/theme/ThemeProvider.tsx
29
29
  import { Global } from "@emotion/react";
30
- import {
31
- ThemeProvider as ThemeUiProvider,
32
- merge
33
- } from "@theme-ui/core";
30
+ import { ThemeProvider as ThemeUiProvider, merge } from "@theme-ui/core";
34
31
  import * as React2 from "react";
35
32
 
36
33
  // src/theme/defaultTheme.ts
@@ -48,6 +45,10 @@ var defaultTheme = {
48
45
  color: "primary",
49
46
  textDecoration: "underline",
50
47
  cursor: "pointer"
48
+ },
49
+ progress: {
50
+ color: "primary",
51
+ backgroundColor: "background"
51
52
  }
52
53
  },
53
54
  buttons: {
@@ -76,17 +77,14 @@ var defaultTheme = {
76
77
  };
77
78
 
78
79
  // src/theme/ThemeProvider.tsx
79
- var ThemeProvider = ({
80
- children,
81
- theme = {}
82
- }) => {
80
+ var ThemeProvider = ({ children, theme = {} }) => {
83
81
  const mergedTheme = React2.useMemo(() => {
84
82
  if (typeof theme === "function") {
85
83
  return theme;
86
84
  }
87
85
  return merge(defaultTheme, theme);
88
86
  }, [theme]);
89
- return /* @__PURE__ */ React2.createElement(ThemeUiProvider, {
87
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ThemeUiProvider, {
90
88
  theme: mergedTheme
91
89
  }, /* @__PURE__ */ React2.createElement(Global, {
92
90
  styles: {
@@ -94,7 +92,7 @@ var ThemeProvider = ({
94
92
  margin: 0
95
93
  }
96
94
  }
97
- }), children);
95
+ }), children));
98
96
  };
99
97
  var ThemeProvider_default = ThemeProvider;
100
98
 
@@ -160,6 +158,10 @@ import { Input } from "@theme-ui/components";
160
158
 
161
159
  // src/components/Link/Link.tsx
162
160
  import { Link } from "@theme-ui/components";
161
+
162
+ // src/components/LinearProgress/LinearProgress.tsx
163
+ import { Progress } from "@theme-ui/components";
164
+ var LinearProgress = Progress;
163
165
  export {
164
166
  Box,
165
167
  Button_default as Button,
@@ -168,6 +170,7 @@ export {
168
170
  FormField_default as FormField,
169
171
  Image,
170
172
  Input,
173
+ LinearProgress,
171
174
  Link,
172
175
  Text,
173
176
  ThemeProvider_default as ThemeProvider,
package/dist/index.d.ts CHANGED
@@ -1,14 +1,19 @@
1
1
  import * as color from '@theme-ui/color';
2
2
  export { color };
3
3
  import * as _theme_ui_core from '@theme-ui/core';
4
- import { ThemeProviderProps } from '@theme-ui/core';
5
- export { Theme, ThemeProviderProps } from '@theme-ui/core';
4
+ import { Theme } from '@theme-ui/core';
5
+ export { Theme } from '@theme-ui/core';
6
6
  export { Themed } from '@theme-ui/mdx';
7
7
  import * as React from 'react';
8
- import { ButtonProps } from '@theme-ui/components';
8
+ import * as _theme_ui_components from '@theme-ui/components';
9
+ import { ButtonProps, ProgressProps } from '@theme-ui/components';
9
10
  export { Box, BoxProps, ButtonProps, Card, CardProps, Flex, FlexProps, Image, ImageProps, Input, InputProps, Link, LinkProps, Text, TextProps } from '@theme-ui/components';
10
11
 
11
- declare const ThemeProvider: React.FC<Partial<ThemeProviderProps>>;
12
+ declare type ThemeProviderProps = {
13
+ children?: React.ReactNode;
14
+ theme?: Theme;
15
+ };
16
+ declare const ThemeProvider: ({ children, theme }: ThemeProviderProps) => JSX.Element;
12
17
 
13
18
  declare const useTheme: () => _theme_ui_core.ThemeUIContextValue;
14
19
 
@@ -21,4 +26,7 @@ declare type FormFieldProps = {
21
26
  };
22
27
  declare const FormField: ({ children, label, error }: FormFieldProps) => JSX.Element;
23
28
 
24
- export { Button, FormField, FormFieldProps, ThemeProvider, useTheme };
29
+ declare type LinearProgressProps = ProgressProps;
30
+ declare const LinearProgress: _theme_ui_components.ForwardRef<HTMLProgressElement, ProgressProps>;
31
+
32
+ export { Button, FormField, FormFieldProps, LinearProgress, LinearProgressProps, ThemeProvider, ThemeProviderProps, useTheme };
package/dist/index.js CHANGED
@@ -53,6 +53,7 @@ __export(src_exports, {
53
53
  FormField: () => FormField_default,
54
54
  Image: () => import_components7.Image,
55
55
  Input: () => import_components8.Input,
56
+ LinearProgress: () => LinearProgress,
56
57
  Link: () => import_components9.Link,
57
58
  Text: () => import_components6.Text,
58
59
  ThemeProvider: () => ThemeProvider_default,
@@ -88,6 +89,10 @@ var defaultTheme = {
88
89
  color: "primary",
89
90
  textDecoration: "underline",
90
91
  cursor: "pointer"
92
+ },
93
+ progress: {
94
+ color: "primary",
95
+ backgroundColor: "background"
91
96
  }
92
97
  },
93
98
  buttons: {
@@ -116,17 +121,14 @@ var defaultTheme = {
116
121
  };
117
122
 
118
123
  // src/theme/ThemeProvider.tsx
119
- var ThemeProvider = ({
120
- children,
121
- theme = {}
122
- }) => {
124
+ var ThemeProvider = ({ children, theme = {} }) => {
123
125
  const mergedTheme = React2.useMemo(() => {
124
126
  if (typeof theme === "function") {
125
127
  return theme;
126
128
  }
127
129
  return (0, import_core.merge)(defaultTheme, theme);
128
130
  }, [theme]);
129
- return /* @__PURE__ */ React2.createElement(import_core.ThemeProvider, {
131
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(import_core.ThemeProvider, {
130
132
  theme: mergedTheme
131
133
  }, /* @__PURE__ */ React2.createElement(import_react.Global, {
132
134
  styles: {
@@ -134,7 +136,7 @@ var ThemeProvider = ({
134
136
  margin: 0
135
137
  }
136
138
  }
137
- }), children);
139
+ }), children));
138
140
  };
139
141
  var ThemeProvider_default = ThemeProvider;
140
142
 
@@ -200,6 +202,10 @@ var import_components8 = require("@theme-ui/components");
200
202
 
201
203
  // src/components/Link/Link.tsx
202
204
  var import_components9 = require("@theme-ui/components");
205
+
206
+ // src/components/LinearProgress/LinearProgress.tsx
207
+ var import_components10 = require("@theme-ui/components");
208
+ var LinearProgress = import_components10.Progress;
203
209
  module.exports = __toCommonJS(src_exports);
204
210
  // Annotate the CommonJS export names for ESM import in node:
205
211
  0 && (module.exports = {
@@ -210,6 +216,7 @@ module.exports = __toCommonJS(src_exports);
210
216
  FormField,
211
217
  Image,
212
218
  Input,
219
+ LinearProgress,
213
220
  Link,
214
221
  Text,
215
222
  ThemeProvider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.2.0",
3
+ "version": "1.5.0",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {
@@ -43,8 +43,8 @@
43
43
  "react": ">=17.0.2"
44
44
  },
45
45
  "devDependencies": {
46
- "@ttoss/config": "^1.2.0",
47
- "@ttoss/test-utils": "^1.2.0"
46
+ "@ttoss/config": "^1.5.0",
47
+ "@ttoss/test-utils": "^1.5.0"
48
48
  },
49
- "gitHead": "f86ec742bf1e8baec64c99ad5950835a6ff8b5c1"
49
+ "gitHead": "fdb52165ac95413f6ba93ac679d1c839db5426b2"
50
50
  }
@@ -1,4 +1,4 @@
1
- import { customRender, screen } from '@ttoss/test-utils';
1
+ import { render, screen } from '@ttoss/test-utils';
2
2
 
3
3
  import Input from '../Input/Input';
4
4
 
@@ -8,7 +8,7 @@ const label = 'Label';
8
8
  const value = 'Value';
9
9
 
10
10
  test('check if label is rendered on screen', () => {
11
- customRender(
11
+ render(
12
12
  <FormField label={label}>
13
13
  <Input defaultValue={value} />
14
14
  </FormField>
@@ -18,7 +18,7 @@ test('check if label is rendered on screen', () => {
18
18
  });
19
19
 
20
20
  test('check if label is associated with input', () => {
21
- customRender(
21
+ render(
22
22
  <FormField label={label}>
23
23
  <Input defaultValue={value} />
24
24
  </FormField>
@@ -30,7 +30,7 @@ test('check if label is associated with input', () => {
30
30
  test('check if renders a single error', () => {
31
31
  const error = 'Error';
32
32
 
33
- customRender(
33
+ render(
34
34
  <FormField label={label} error={error}>
35
35
  <Input defaultValue={value} />
36
36
  </FormField>
@@ -42,7 +42,7 @@ test('check if renders a single error', () => {
42
42
  test('check if renders multiple errors', () => {
43
43
  const errors = ['Error1', 'Error2', 'Error3'];
44
44
 
45
- customRender(
45
+ render(
46
46
  <FormField label={label} error={errors}>
47
47
  <Input defaultValue={value} />
48
48
  </FormField>
@@ -0,0 +1,5 @@
1
+ import { Progress, ProgressProps } from '@theme-ui/components';
2
+
3
+ export type LinearProgressProps = ProgressProps;
4
+
5
+ export const LinearProgress = Progress;
package/src/index.ts CHANGED
@@ -20,4 +20,8 @@ export {
20
20
  export { default as Image, ImageProps } from './components/Image/Image';
21
21
  export { default as Input, InputProps } from './components/Input/Input';
22
22
  export { default as Link, LinkProps } from './components/Link/Link';
23
+ export {
24
+ LinearProgress,
25
+ LinearProgressProps,
26
+ } from './components/LinearProgress/LinearProgress';
23
27
  export { default as Text, TextProps } from './components/Text/Text';
@@ -1,19 +1,15 @@
1
1
  import { Global } from '@emotion/react';
2
- import {
3
- ThemeProvider as ThemeUiProvider,
4
- ThemeProviderProps,
5
- merge,
6
- } from '@theme-ui/core';
2
+ import { ThemeProvider as ThemeUiProvider, Theme, merge } from '@theme-ui/core';
7
3
  import * as React from 'react';
8
4
 
9
5
  import { defaultTheme } from './defaultTheme';
10
6
 
11
- export type { ThemeProviderProps };
7
+ export type ThemeProviderProps = {
8
+ children?: React.ReactNode;
9
+ theme?: Theme;
10
+ };
12
11
 
13
- const ThemeProvider: React.FC<Partial<ThemeProviderProps>> = ({
14
- children,
15
- theme = {},
16
- }) => {
12
+ const ThemeProvider = ({ children, theme = {} }: ThemeProviderProps) => {
17
13
  const mergedTheme = React.useMemo(() => {
18
14
  if (typeof theme === 'function') {
19
15
  return theme;
@@ -23,16 +19,18 @@ const ThemeProvider: React.FC<Partial<ThemeProviderProps>> = ({
23
19
  }, [theme]);
24
20
 
25
21
  return (
26
- <ThemeUiProvider theme={mergedTheme}>
27
- <Global
28
- styles={{
29
- '*': {
30
- margin: 0,
31
- },
32
- }}
33
- />
34
- {children}
35
- </ThemeUiProvider>
22
+ <>
23
+ <ThemeUiProvider theme={mergedTheme}>
24
+ <Global
25
+ styles={{
26
+ '*': {
27
+ margin: 0,
28
+ },
29
+ }}
30
+ />
31
+ {children}
32
+ </ThemeUiProvider>
33
+ </>
36
34
  );
37
35
  };
38
36
 
@@ -15,6 +15,10 @@ export const defaultTheme: Theme = {
15
15
  textDecoration: 'underline',
16
16
  cursor: 'pointer',
17
17
  },
18
+ progress: {
19
+ color: 'primary',
20
+ backgroundColor: 'background',
21
+ },
18
22
  },
19
23
  buttons: {
20
24
  primary: {