@ttoss/ui 0.9.2 → 1.2.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 +177 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +219 -0
- package/package.json +8 -6
- package/src/components/Button/Button.tsx +12 -2
- package/src/components/Link/Link.tsx +3 -0
- package/src/index.ts +5 -0
- package/src/theme/ThemeProvider.spec.tsx +7 -1
- package/src/theme/ThemeProvider.tsx +13 -1
- package/src/theme/defaultTheme.ts +24 -7
|
@@ -0,0 +1,177 @@
|
|
|
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));
|
|
20
|
+
|
|
21
|
+
// tsup.inject.js
|
|
22
|
+
import * as React from "react";
|
|
23
|
+
|
|
24
|
+
// src/index.ts
|
|
25
|
+
import * as color from "@theme-ui/color";
|
|
26
|
+
import { Themed } from "@theme-ui/mdx";
|
|
27
|
+
|
|
28
|
+
// src/theme/ThemeProvider.tsx
|
|
29
|
+
import { Global } from "@emotion/react";
|
|
30
|
+
import {
|
|
31
|
+
ThemeProvider as ThemeUiProvider,
|
|
32
|
+
merge
|
|
33
|
+
} from "@theme-ui/core";
|
|
34
|
+
import * as React2 from "react";
|
|
35
|
+
|
|
36
|
+
// src/theme/defaultTheme.ts
|
|
37
|
+
var defaultTheme = {
|
|
38
|
+
colors: {
|
|
39
|
+
text: "#000",
|
|
40
|
+
background: "#fff",
|
|
41
|
+
primary: "#07c",
|
|
42
|
+
secondary: "#639",
|
|
43
|
+
gray: "#555"
|
|
44
|
+
},
|
|
45
|
+
space: [0, 4, 8, 16, 32, 64, 128, 256, 512],
|
|
46
|
+
styles: {
|
|
47
|
+
a: {
|
|
48
|
+
color: "primary",
|
|
49
|
+
textDecoration: "underline",
|
|
50
|
+
cursor: "pointer"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
buttons: {
|
|
54
|
+
primary: {
|
|
55
|
+
color: "white",
|
|
56
|
+
backgroundColor: "primary"
|
|
57
|
+
},
|
|
58
|
+
secondary: {
|
|
59
|
+
color: "white",
|
|
60
|
+
backgroundColor: "secondary"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
cards: {
|
|
64
|
+
primary: {
|
|
65
|
+
backgroundColor: "background",
|
|
66
|
+
border: "1px solid black",
|
|
67
|
+
padding: [4, 5]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
text: {
|
|
71
|
+
title: {
|
|
72
|
+
fontSize: [4, 5],
|
|
73
|
+
textAlign: "center"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// src/theme/ThemeProvider.tsx
|
|
79
|
+
var ThemeProvider = ({
|
|
80
|
+
children,
|
|
81
|
+
theme = {}
|
|
82
|
+
}) => {
|
|
83
|
+
const mergedTheme = React2.useMemo(() => {
|
|
84
|
+
if (typeof theme === "function") {
|
|
85
|
+
return theme;
|
|
86
|
+
}
|
|
87
|
+
return merge(defaultTheme, theme);
|
|
88
|
+
}, [theme]);
|
|
89
|
+
return /* @__PURE__ */ React2.createElement(ThemeUiProvider, {
|
|
90
|
+
theme: mergedTheme
|
|
91
|
+
}, /* @__PURE__ */ React2.createElement(Global, {
|
|
92
|
+
styles: {
|
|
93
|
+
"*": {
|
|
94
|
+
margin: 0
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}), children);
|
|
98
|
+
};
|
|
99
|
+
var ThemeProvider_default = ThemeProvider;
|
|
100
|
+
|
|
101
|
+
// src/theme/useTheme.ts
|
|
102
|
+
import { useThemeUI } from "@theme-ui/core";
|
|
103
|
+
var useTheme = useThemeUI;
|
|
104
|
+
|
|
105
|
+
// src/components/Box/Box.tsx
|
|
106
|
+
import { Box } from "@theme-ui/components";
|
|
107
|
+
|
|
108
|
+
// src/components/Button/Button.tsx
|
|
109
|
+
import { Button as ButtonUi } from "@theme-ui/components";
|
|
110
|
+
var Button = (props) => {
|
|
111
|
+
return /* @__PURE__ */ React.createElement(ButtonUi, __spreadProps(__spreadValues({}, props), {
|
|
112
|
+
sx: __spreadValues({ cursor: "pointer", padding: 2 }, props.sx)
|
|
113
|
+
}));
|
|
114
|
+
};
|
|
115
|
+
var Button_default = Button;
|
|
116
|
+
|
|
117
|
+
// src/components/Card/Card.tsx
|
|
118
|
+
import { Card } from "@theme-ui/components";
|
|
119
|
+
|
|
120
|
+
// src/components/Flex/Flex.tsx
|
|
121
|
+
import { Flex } from "@theme-ui/components";
|
|
122
|
+
|
|
123
|
+
// src/components/FormField/FormField.tsx
|
|
124
|
+
import * as React3 from "react";
|
|
125
|
+
|
|
126
|
+
// src/components/Label/Label.tsx
|
|
127
|
+
import { Label } from "@theme-ui/components";
|
|
128
|
+
|
|
129
|
+
// src/components/Text/Text.tsx
|
|
130
|
+
import { Text } from "@theme-ui/components";
|
|
131
|
+
|
|
132
|
+
// src/components/FormField/FormField.tsx
|
|
133
|
+
var FormField = ({ children, label, error }) => {
|
|
134
|
+
const errorAsArray = (() => {
|
|
135
|
+
if (Array.isArray(error)) {
|
|
136
|
+
return error;
|
|
137
|
+
}
|
|
138
|
+
if (typeof error === "string") {
|
|
139
|
+
return [error];
|
|
140
|
+
}
|
|
141
|
+
return [];
|
|
142
|
+
})();
|
|
143
|
+
return /* @__PURE__ */ React3.createElement(Box, null, /* @__PURE__ */ React3.createElement(Label, {
|
|
144
|
+
sx: { display: "flex", flexDirection: "column" }
|
|
145
|
+
}, label && /* @__PURE__ */ React3.createElement(Text, {
|
|
146
|
+
as: "span"
|
|
147
|
+
}, label), children), errorAsArray.map((err) => /* @__PURE__ */ React3.createElement(Text, {
|
|
148
|
+
key: err,
|
|
149
|
+
as: "span",
|
|
150
|
+
variant: "error"
|
|
151
|
+
}, err)));
|
|
152
|
+
};
|
|
153
|
+
var FormField_default = FormField;
|
|
154
|
+
|
|
155
|
+
// src/components/Image/Image.tsx
|
|
156
|
+
import { Image } from "@theme-ui/components";
|
|
157
|
+
|
|
158
|
+
// src/components/Input/Input.tsx
|
|
159
|
+
import { Input } from "@theme-ui/components";
|
|
160
|
+
|
|
161
|
+
// src/components/Link/Link.tsx
|
|
162
|
+
import { Link } from "@theme-ui/components";
|
|
163
|
+
export {
|
|
164
|
+
Box,
|
|
165
|
+
Button_default as Button,
|
|
166
|
+
Card,
|
|
167
|
+
Flex,
|
|
168
|
+
FormField_default as FormField,
|
|
169
|
+
Image,
|
|
170
|
+
Input,
|
|
171
|
+
Link,
|
|
172
|
+
Text,
|
|
173
|
+
ThemeProvider_default as ThemeProvider,
|
|
174
|
+
Themed,
|
|
175
|
+
color,
|
|
176
|
+
useTheme
|
|
177
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as color from '@theme-ui/color';
|
|
2
|
+
export { color };
|
|
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';
|
|
6
|
+
export { Themed } from '@theme-ui/mdx';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { ButtonProps } from '@theme-ui/components';
|
|
9
|
+
export { Box, BoxProps, ButtonProps, Card, CardProps, Flex, FlexProps, Image, ImageProps, Input, InputProps, Link, LinkProps, Text, TextProps } from '@theme-ui/components';
|
|
10
|
+
|
|
11
|
+
declare const ThemeProvider: React.FC<Partial<ThemeProviderProps>>;
|
|
12
|
+
|
|
13
|
+
declare const useTheme: () => _theme_ui_core.ThemeUIContextValue;
|
|
14
|
+
|
|
15
|
+
declare const Button: (props: ButtonProps) => JSX.Element;
|
|
16
|
+
|
|
17
|
+
declare type FormFieldProps = {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
label?: string;
|
|
20
|
+
error?: string[] | string;
|
|
21
|
+
};
|
|
22
|
+
declare const FormField: ({ children, label, error }: FormFieldProps) => JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { Button, FormField, FormFieldProps, ThemeProvider, useTheme };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
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
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
|
+
var __export = (target, all) => {
|
|
26
|
+
for (var name in all)
|
|
27
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
|
+
};
|
|
29
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
30
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
31
|
+
for (let key of __getOwnPropNames(module2))
|
|
32
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
33
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (module2, isNodeMode) => {
|
|
38
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
39
|
+
};
|
|
40
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
41
|
+
return (module2, temp) => {
|
|
42
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
43
|
+
};
|
|
44
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
45
|
+
|
|
46
|
+
// src/index.ts
|
|
47
|
+
var src_exports = {};
|
|
48
|
+
__export(src_exports, {
|
|
49
|
+
Box: () => import_components.Box,
|
|
50
|
+
Button: () => Button_default,
|
|
51
|
+
Card: () => import_components3.Card,
|
|
52
|
+
Flex: () => import_components4.Flex,
|
|
53
|
+
FormField: () => FormField_default,
|
|
54
|
+
Image: () => import_components7.Image,
|
|
55
|
+
Input: () => import_components8.Input,
|
|
56
|
+
Link: () => import_components9.Link,
|
|
57
|
+
Text: () => import_components6.Text,
|
|
58
|
+
ThemeProvider: () => ThemeProvider_default,
|
|
59
|
+
Themed: () => import_mdx.Themed,
|
|
60
|
+
color: () => color,
|
|
61
|
+
useTheme: () => useTheme
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// tsup.inject.js
|
|
65
|
+
var React = __toESM(require("react"));
|
|
66
|
+
|
|
67
|
+
// src/index.ts
|
|
68
|
+
var color = __toESM(require("@theme-ui/color"));
|
|
69
|
+
var import_mdx = require("@theme-ui/mdx");
|
|
70
|
+
|
|
71
|
+
// src/theme/ThemeProvider.tsx
|
|
72
|
+
var import_react = require("@emotion/react");
|
|
73
|
+
var import_core = require("@theme-ui/core");
|
|
74
|
+
var React2 = __toESM(require("react"));
|
|
75
|
+
|
|
76
|
+
// src/theme/defaultTheme.ts
|
|
77
|
+
var defaultTheme = {
|
|
78
|
+
colors: {
|
|
79
|
+
text: "#000",
|
|
80
|
+
background: "#fff",
|
|
81
|
+
primary: "#07c",
|
|
82
|
+
secondary: "#639",
|
|
83
|
+
gray: "#555"
|
|
84
|
+
},
|
|
85
|
+
space: [0, 4, 8, 16, 32, 64, 128, 256, 512],
|
|
86
|
+
styles: {
|
|
87
|
+
a: {
|
|
88
|
+
color: "primary",
|
|
89
|
+
textDecoration: "underline",
|
|
90
|
+
cursor: "pointer"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
buttons: {
|
|
94
|
+
primary: {
|
|
95
|
+
color: "white",
|
|
96
|
+
backgroundColor: "primary"
|
|
97
|
+
},
|
|
98
|
+
secondary: {
|
|
99
|
+
color: "white",
|
|
100
|
+
backgroundColor: "secondary"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
cards: {
|
|
104
|
+
primary: {
|
|
105
|
+
backgroundColor: "background",
|
|
106
|
+
border: "1px solid black",
|
|
107
|
+
padding: [4, 5]
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
text: {
|
|
111
|
+
title: {
|
|
112
|
+
fontSize: [4, 5],
|
|
113
|
+
textAlign: "center"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// src/theme/ThemeProvider.tsx
|
|
119
|
+
var ThemeProvider = ({
|
|
120
|
+
children,
|
|
121
|
+
theme = {}
|
|
122
|
+
}) => {
|
|
123
|
+
const mergedTheme = React2.useMemo(() => {
|
|
124
|
+
if (typeof theme === "function") {
|
|
125
|
+
return theme;
|
|
126
|
+
}
|
|
127
|
+
return (0, import_core.merge)(defaultTheme, theme);
|
|
128
|
+
}, [theme]);
|
|
129
|
+
return /* @__PURE__ */ React2.createElement(import_core.ThemeProvider, {
|
|
130
|
+
theme: mergedTheme
|
|
131
|
+
}, /* @__PURE__ */ React2.createElement(import_react.Global, {
|
|
132
|
+
styles: {
|
|
133
|
+
"*": {
|
|
134
|
+
margin: 0
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}), children);
|
|
138
|
+
};
|
|
139
|
+
var ThemeProvider_default = ThemeProvider;
|
|
140
|
+
|
|
141
|
+
// src/theme/useTheme.ts
|
|
142
|
+
var import_core2 = require("@theme-ui/core");
|
|
143
|
+
var useTheme = import_core2.useThemeUI;
|
|
144
|
+
|
|
145
|
+
// src/components/Box/Box.tsx
|
|
146
|
+
var import_components = require("@theme-ui/components");
|
|
147
|
+
|
|
148
|
+
// src/components/Button/Button.tsx
|
|
149
|
+
var import_components2 = require("@theme-ui/components");
|
|
150
|
+
var Button = (props) => {
|
|
151
|
+
return /* @__PURE__ */ React.createElement(import_components2.Button, __spreadProps(__spreadValues({}, props), {
|
|
152
|
+
sx: __spreadValues({ cursor: "pointer", padding: 2 }, props.sx)
|
|
153
|
+
}));
|
|
154
|
+
};
|
|
155
|
+
var Button_default = Button;
|
|
156
|
+
|
|
157
|
+
// src/components/Card/Card.tsx
|
|
158
|
+
var import_components3 = require("@theme-ui/components");
|
|
159
|
+
|
|
160
|
+
// src/components/Flex/Flex.tsx
|
|
161
|
+
var import_components4 = require("@theme-ui/components");
|
|
162
|
+
|
|
163
|
+
// src/components/FormField/FormField.tsx
|
|
164
|
+
var React3 = __toESM(require("react"));
|
|
165
|
+
|
|
166
|
+
// src/components/Label/Label.tsx
|
|
167
|
+
var import_components5 = require("@theme-ui/components");
|
|
168
|
+
|
|
169
|
+
// src/components/Text/Text.tsx
|
|
170
|
+
var import_components6 = require("@theme-ui/components");
|
|
171
|
+
|
|
172
|
+
// src/components/FormField/FormField.tsx
|
|
173
|
+
var FormField = ({ children, label, error }) => {
|
|
174
|
+
const errorAsArray = (() => {
|
|
175
|
+
if (Array.isArray(error)) {
|
|
176
|
+
return error;
|
|
177
|
+
}
|
|
178
|
+
if (typeof error === "string") {
|
|
179
|
+
return [error];
|
|
180
|
+
}
|
|
181
|
+
return [];
|
|
182
|
+
})();
|
|
183
|
+
return /* @__PURE__ */ React3.createElement(import_components.Box, null, /* @__PURE__ */ React3.createElement(import_components5.Label, {
|
|
184
|
+
sx: { display: "flex", flexDirection: "column" }
|
|
185
|
+
}, label && /* @__PURE__ */ React3.createElement(import_components6.Text, {
|
|
186
|
+
as: "span"
|
|
187
|
+
}, label), children), errorAsArray.map((err) => /* @__PURE__ */ React3.createElement(import_components6.Text, {
|
|
188
|
+
key: err,
|
|
189
|
+
as: "span",
|
|
190
|
+
variant: "error"
|
|
191
|
+
}, err)));
|
|
192
|
+
};
|
|
193
|
+
var FormField_default = FormField;
|
|
194
|
+
|
|
195
|
+
// src/components/Image/Image.tsx
|
|
196
|
+
var import_components7 = require("@theme-ui/components");
|
|
197
|
+
|
|
198
|
+
// src/components/Input/Input.tsx
|
|
199
|
+
var import_components8 = require("@theme-ui/components");
|
|
200
|
+
|
|
201
|
+
// src/components/Link/Link.tsx
|
|
202
|
+
var import_components9 = require("@theme-ui/components");
|
|
203
|
+
module.exports = __toCommonJS(src_exports);
|
|
204
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
205
|
+
0 && (module.exports = {
|
|
206
|
+
Box,
|
|
207
|
+
Button,
|
|
208
|
+
Card,
|
|
209
|
+
Flex,
|
|
210
|
+
FormField,
|
|
211
|
+
Image,
|
|
212
|
+
Input,
|
|
213
|
+
Link,
|
|
214
|
+
Text,
|
|
215
|
+
ThemeProvider,
|
|
216
|
+
Themed,
|
|
217
|
+
color,
|
|
218
|
+
useTheme
|
|
219
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Primitive layout, typographic, and other components for styling applications.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,15 +34,17 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@emotion/react": "^11",
|
|
36
36
|
"@emotion/styled": "^11",
|
|
37
|
+
"@theme-ui/color": "^0.13.1",
|
|
37
38
|
"@theme-ui/components": "^0.13.1",
|
|
38
|
-
"@theme-ui/core": "^0.13.1"
|
|
39
|
+
"@theme-ui/core": "^0.13.1",
|
|
40
|
+
"@theme-ui/mdx": "^0.13.1"
|
|
39
41
|
},
|
|
40
42
|
"peerDependencies": {
|
|
41
|
-
"react": ">=
|
|
43
|
+
"react": ">=17.0.2"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
|
-
"@ttoss/config": "^
|
|
45
|
-
"@ttoss/test-utils": "^
|
|
46
|
+
"@ttoss/config": "^1.2.0",
|
|
47
|
+
"@ttoss/test-utils": "^1.2.0"
|
|
46
48
|
},
|
|
47
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "f86ec742bf1e8baec64c99ad5950835a6ff8b5c1"
|
|
48
50
|
}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { Button as ButtonUi } from '@theme-ui/components';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import type { ButtonProps } from '@theme-ui/components';
|
|
4
|
+
|
|
5
|
+
export type { ButtonProps };
|
|
6
|
+
|
|
7
|
+
const Button = (props: ButtonProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<ButtonUi {...props} sx={{ cursor: 'pointer', padding: 2, ...props.sx }} />
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default Button;
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export * as color from '@theme-ui/color';
|
|
2
|
+
export type { Theme } from '@theme-ui/core';
|
|
3
|
+
export { Themed } from '@theme-ui/mdx';
|
|
4
|
+
|
|
1
5
|
export {
|
|
2
6
|
default as ThemeProvider,
|
|
3
7
|
ThemeProviderProps,
|
|
@@ -15,4 +19,5 @@ export {
|
|
|
15
19
|
} from './components/FormField/FormField';
|
|
16
20
|
export { default as Image, ImageProps } from './components/Image/Image';
|
|
17
21
|
export { default as Input, InputProps } from './components/Input/Input';
|
|
22
|
+
export { default as Link, LinkProps } from './components/Link/Link';
|
|
18
23
|
export { default as Text, TextProps } from './components/Text/Text';
|
|
@@ -64,5 +64,11 @@ test('should pass variants', () => {
|
|
|
64
64
|
},
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
expect(result.current.theme).toEqual(
|
|
67
|
+
expect(result.current.theme.cards).toEqual(
|
|
68
|
+
expect.objectContaining(variants.cards)
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
expect(result.current.theme.layout).toEqual(
|
|
72
|
+
expect.objectContaining(variants.layout)
|
|
73
|
+
);
|
|
68
74
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Global } from '@emotion/react';
|
|
1
2
|
import {
|
|
2
3
|
ThemeProvider as ThemeUiProvider,
|
|
3
4
|
ThemeProviderProps,
|
|
@@ -21,7 +22,18 @@ const ThemeProvider: React.FC<Partial<ThemeProviderProps>> = ({
|
|
|
21
22
|
return merge(defaultTheme, theme);
|
|
22
23
|
}, [theme]);
|
|
23
24
|
|
|
24
|
-
return
|
|
25
|
+
return (
|
|
26
|
+
<ThemeUiProvider theme={mergedTheme}>
|
|
27
|
+
<Global
|
|
28
|
+
styles={{
|
|
29
|
+
'*': {
|
|
30
|
+
margin: 0,
|
|
31
|
+
},
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
{children}
|
|
35
|
+
</ThemeUiProvider>
|
|
36
|
+
);
|
|
25
37
|
};
|
|
26
38
|
|
|
27
39
|
export default ThemeProvider;
|
|
@@ -8,18 +8,35 @@ export const defaultTheme: Theme = {
|
|
|
8
8
|
secondary: '#639',
|
|
9
9
|
gray: '#555',
|
|
10
10
|
},
|
|
11
|
+
space: [0, 4, 8, 16, 32, 64, 128, 256, 512],
|
|
12
|
+
styles: {
|
|
13
|
+
a: {
|
|
14
|
+
color: 'primary',
|
|
15
|
+
textDecoration: 'underline',
|
|
16
|
+
cursor: 'pointer',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
11
19
|
buttons: {
|
|
12
20
|
primary: {
|
|
13
|
-
color: '
|
|
14
|
-
|
|
21
|
+
color: 'white',
|
|
22
|
+
backgroundColor: 'primary',
|
|
15
23
|
},
|
|
16
24
|
secondary: {
|
|
17
|
-
color: '
|
|
18
|
-
|
|
25
|
+
color: 'white',
|
|
26
|
+
backgroundColor: 'secondary',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
cards: {
|
|
30
|
+
primary: {
|
|
31
|
+
backgroundColor: 'background',
|
|
32
|
+
border: '1px solid black',
|
|
33
|
+
padding: [4, 5],
|
|
19
34
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
35
|
+
},
|
|
36
|
+
text: {
|
|
37
|
+
title: {
|
|
38
|
+
fontSize: [4, 5],
|
|
39
|
+
textAlign: 'center',
|
|
23
40
|
},
|
|
24
41
|
},
|
|
25
42
|
};
|