@ttoss/ui 1.3.0 → 1.6.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 +14 -2
- package/dist/esm/index.js +22 -7
- package/dist/index.d.ts +14 -5
- package/dist/index.js +21 -2
- package/package.json +4 -4
- package/src/components/LinearProgress/LinearProgress.tsx +5 -0
- package/src/index.ts +4 -0
- package/src/theme/ThemeProvider.tsx +21 -8
- package/src/theme/defaultTheme.ts +4 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<strong> @ttoss/ui</strong> is a easiest way to use Ui components in your React application.
|
|
6
6
|
|
|
7
|
-
## 🚀
|
|
7
|
+
## 🚀 Getting Started
|
|
8
8
|
|
|
9
9
|
### Install @ttoss/ui
|
|
10
10
|
|
|
@@ -37,6 +37,18 @@ const App = () => {
|
|
|
37
37
|
export default App;
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
### Loading Fonts
|
|
41
|
+
|
|
42
|
+
You can pass fonts URLs to `ThemeProvider` component thought `fonts` prop.
|
|
41
43
|
|
|
44
|
+
```tsx
|
|
45
|
+
<ThemeProvider
|
|
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',
|
|
50
|
+
]}
|
|
51
|
+
>
|
|
52
|
+
<App />
|
|
53
|
+
</ThemeProvider>
|
|
42
54
|
```
|
package/dist/esm/index.js
CHANGED
|
@@ -26,11 +26,8 @@ import * as color from "@theme-ui/color";
|
|
|
26
26
|
import { Themed } from "@theme-ui/mdx";
|
|
27
27
|
|
|
28
28
|
// src/theme/ThemeProvider.tsx
|
|
29
|
-
import { Global } from "@emotion/react";
|
|
30
|
-
import {
|
|
31
|
-
ThemeProvider as ThemeUiProvider,
|
|
32
|
-
merge
|
|
33
|
-
} from "@theme-ui/core";
|
|
29
|
+
import { Global, css } from "@emotion/react";
|
|
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,7 +77,11 @@ var defaultTheme = {
|
|
|
76
77
|
};
|
|
77
78
|
|
|
78
79
|
// src/theme/ThemeProvider.tsx
|
|
79
|
-
var ThemeProvider = ({
|
|
80
|
+
var ThemeProvider = ({
|
|
81
|
+
children,
|
|
82
|
+
theme = {},
|
|
83
|
+
fonts = []
|
|
84
|
+
}) => {
|
|
80
85
|
const mergedTheme = React2.useMemo(() => {
|
|
81
86
|
if (typeof theme === "function") {
|
|
82
87
|
return theme;
|
|
@@ -85,7 +90,12 @@ var ThemeProvider = ({ children, theme = {} }) => {
|
|
|
85
90
|
}, [theme]);
|
|
86
91
|
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ThemeUiProvider, {
|
|
87
92
|
theme: mergedTheme
|
|
88
|
-
}, /* @__PURE__ */ React2.createElement(Global, {
|
|
93
|
+
}, fonts.map((url) => /* @__PURE__ */ React2.createElement(Global, {
|
|
94
|
+
key: url,
|
|
95
|
+
styles: css`
|
|
96
|
+
@import url('${url}');
|
|
97
|
+
`
|
|
98
|
+
})), /* @__PURE__ */ React2.createElement(Global, {
|
|
89
99
|
styles: {
|
|
90
100
|
"*": {
|
|
91
101
|
margin: 0
|
|
@@ -157,6 +167,10 @@ import { Input } from "@theme-ui/components";
|
|
|
157
167
|
|
|
158
168
|
// src/components/Link/Link.tsx
|
|
159
169
|
import { Link } from "@theme-ui/components";
|
|
170
|
+
|
|
171
|
+
// src/components/LinearProgress/LinearProgress.tsx
|
|
172
|
+
import { Progress } from "@theme-ui/components";
|
|
173
|
+
var LinearProgress = Progress;
|
|
160
174
|
export {
|
|
161
175
|
Box,
|
|
162
176
|
Button_default as Button,
|
|
@@ -165,6 +179,7 @@ export {
|
|
|
165
179
|
FormField_default as FormField,
|
|
166
180
|
Image,
|
|
167
181
|
Input,
|
|
182
|
+
LinearProgress,
|
|
168
183
|
Link,
|
|
169
184
|
Text,
|
|
170
185
|
ThemeProvider_default as ThemeProvider,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
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 {
|
|
4
|
+
import { Theme } from '@theme-ui/core';
|
|
5
5
|
export { Theme } from '@theme-ui/core';
|
|
6
6
|
export { Themed } from '@theme-ui/mdx';
|
|
7
7
|
import * as React from 'react';
|
|
8
|
-
import
|
|
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 type ThemeProviderProps =
|
|
12
|
+
declare type ThemeProviderProps = {
|
|
12
13
|
children?: React.ReactNode;
|
|
14
|
+
theme?: Theme;
|
|
15
|
+
/**
|
|
16
|
+
* Fonts URLs.
|
|
17
|
+
*/
|
|
18
|
+
fonts?: string[];
|
|
13
19
|
};
|
|
14
|
-
declare const ThemeProvider: ({ children, theme }: ThemeProviderProps) => JSX.Element;
|
|
20
|
+
declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) => JSX.Element;
|
|
15
21
|
|
|
16
22
|
declare const useTheme: () => _theme_ui_core.ThemeUIContextValue;
|
|
17
23
|
|
|
@@ -24,4 +30,7 @@ declare type FormFieldProps = {
|
|
|
24
30
|
};
|
|
25
31
|
declare const FormField: ({ children, label, error }: FormFieldProps) => JSX.Element;
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
declare type LinearProgressProps = ProgressProps;
|
|
34
|
+
declare const LinearProgress: _theme_ui_components.ForwardRef<HTMLProgressElement, ProgressProps>;
|
|
35
|
+
|
|
36
|
+
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,7 +121,11 @@ var defaultTheme = {
|
|
|
116
121
|
};
|
|
117
122
|
|
|
118
123
|
// src/theme/ThemeProvider.tsx
|
|
119
|
-
var ThemeProvider = ({
|
|
124
|
+
var ThemeProvider = ({
|
|
125
|
+
children,
|
|
126
|
+
theme = {},
|
|
127
|
+
fonts = []
|
|
128
|
+
}) => {
|
|
120
129
|
const mergedTheme = React2.useMemo(() => {
|
|
121
130
|
if (typeof theme === "function") {
|
|
122
131
|
return theme;
|
|
@@ -125,7 +134,12 @@ var ThemeProvider = ({ children, theme = {} }) => {
|
|
|
125
134
|
}, [theme]);
|
|
126
135
|
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(import_core.ThemeProvider, {
|
|
127
136
|
theme: mergedTheme
|
|
128
|
-
}, /* @__PURE__ */ React2.createElement(import_react.Global, {
|
|
137
|
+
}, fonts.map((url) => /* @__PURE__ */ React2.createElement(import_react.Global, {
|
|
138
|
+
key: url,
|
|
139
|
+
styles: import_react.css`
|
|
140
|
+
@import url('${url}');
|
|
141
|
+
`
|
|
142
|
+
})), /* @__PURE__ */ React2.createElement(import_react.Global, {
|
|
129
143
|
styles: {
|
|
130
144
|
"*": {
|
|
131
145
|
margin: 0
|
|
@@ -197,6 +211,10 @@ var import_components8 = require("@theme-ui/components");
|
|
|
197
211
|
|
|
198
212
|
// src/components/Link/Link.tsx
|
|
199
213
|
var import_components9 = require("@theme-ui/components");
|
|
214
|
+
|
|
215
|
+
// src/components/LinearProgress/LinearProgress.tsx
|
|
216
|
+
var import_components10 = require("@theme-ui/components");
|
|
217
|
+
var LinearProgress = import_components10.Progress;
|
|
200
218
|
module.exports = __toCommonJS(src_exports);
|
|
201
219
|
// Annotate the CommonJS export names for ESM import in node:
|
|
202
220
|
0 && (module.exports = {
|
|
@@ -207,6 +225,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
207
225
|
FormField,
|
|
208
226
|
Image,
|
|
209
227
|
Input,
|
|
228
|
+
LinearProgress,
|
|
210
229
|
Link,
|
|
211
230
|
Text,
|
|
212
231
|
ThemeProvider,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.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.
|
|
47
|
-
"@ttoss/test-utils": "^1.
|
|
46
|
+
"@ttoss/config": "^1.6.0",
|
|
47
|
+
"@ttoss/test-utils": "^1.6.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "692ebb7d1938b9b9e04453b47ed36beb9b9c8a69"
|
|
50
50
|
}
|
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,18 +1,23 @@
|
|
|
1
|
-
import { Global } from '@emotion/react';
|
|
2
|
-
import {
|
|
3
|
-
ThemeProvider as ThemeUiProvider,
|
|
4
|
-
ThemeProviderProps as ThemeUiProviderProps,
|
|
5
|
-
merge,
|
|
6
|
-
} from '@theme-ui/core';
|
|
1
|
+
import { Global, css } from '@emotion/react';
|
|
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 = {
|
|
12
8
|
children?: React.ReactNode;
|
|
9
|
+
theme?: Theme;
|
|
10
|
+
/**
|
|
11
|
+
* Fonts URLs.
|
|
12
|
+
*/
|
|
13
|
+
fonts?: string[];
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
const ThemeProvider = ({
|
|
16
|
+
const ThemeProvider = ({
|
|
17
|
+
children,
|
|
18
|
+
theme = {},
|
|
19
|
+
fonts = [],
|
|
20
|
+
}: ThemeProviderProps) => {
|
|
16
21
|
const mergedTheme = React.useMemo(() => {
|
|
17
22
|
if (typeof theme === 'function') {
|
|
18
23
|
return theme;
|
|
@@ -24,6 +29,14 @@ const ThemeProvider = ({ children, theme = {} }: ThemeProviderProps) => {
|
|
|
24
29
|
return (
|
|
25
30
|
<>
|
|
26
31
|
<ThemeUiProvider theme={mergedTheme}>
|
|
32
|
+
{fonts.map((url) => (
|
|
33
|
+
<Global
|
|
34
|
+
key={url}
|
|
35
|
+
styles={css`
|
|
36
|
+
@import url('${url}');
|
|
37
|
+
`}
|
|
38
|
+
/>
|
|
39
|
+
))}
|
|
27
40
|
<Global
|
|
28
41
|
styles={{
|
|
29
42
|
'*': {
|