@ttoss/ui 1.25.0 → 1.26.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 +61 -24
- package/dist/index.d.ts +3 -1
- package/dist/index.js +62 -24
- package/package.json +7 -7
- package/src/components/{Box/Box.tsx → Box.tsx} +0 -0
- package/src/components/{Button/Button.tsx → Button.tsx} +0 -0
- package/src/components/{Card/Card.tsx → Card.tsx} +0 -0
- package/src/components/{Checkbox/Checkbox.tsx → Checkbox.tsx} +0 -0
- package/src/components/{Divider/Divider.tsx → Divider.tsx} +0 -0
- package/src/components/{Flex/Flex.tsx → Flex.tsx} +0 -0
- package/src/components/{Grid/Grid.tsx → Grid.tsx} +0 -0
- package/src/components/{Heading/Heading.tsx → Heading.tsx} +0 -0
- package/src/components/{Icon/Icon.tsx → Icon.tsx} +1 -1
- package/src/components/{Image/Image.tsx → Image.tsx} +0 -0
- package/src/components/InfiniteLinearProgress.tsx +38 -0
- package/src/components/{Input/Input.tsx → Input.tsx} +0 -0
- package/src/components/{Label/Label.tsx → Label.tsx} +0 -0
- package/src/components/{LinearProgress/LinearProgress.tsx → LinearProgress.tsx} +0 -0
- package/src/components/{Link/Link.tsx → Link.tsx} +0 -0
- package/src/components/{Radio/Radio.tsx → Radio.tsx} +0 -0
- package/src/components/{Select/Select.tsx → Select.tsx} +0 -0
- package/src/components/{Slider/Slider.tsx → Slider.tsx} +0 -0
- package/src/components/{Spinner/Spinner.tsx → Spinner.tsx} +0 -0
- package/src/components/{Text/Text.tsx → Text.tsx} +0 -0
- package/src/index.ts +20 -19
- package/src/theme/ThemeProvider.tsx +10 -8
- package/src/index.spec.tsx +0 -10
- package/src/theme/ThemeProvider.spec.tsx +0 -79
package/dist/esm/index.js
CHANGED
|
@@ -110,11 +110,13 @@ var ThemeProvider = ({
|
|
|
110
110
|
children: /* @__PURE__ */ jsxs(ThemeUiProvider, {
|
|
111
111
|
theme: mergedTheme,
|
|
112
112
|
children: [
|
|
113
|
-
fonts.map((url) =>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
fonts.map((url) => {
|
|
114
|
+
return /* @__PURE__ */ jsx(Global, {
|
|
115
|
+
styles: css`
|
|
116
|
+
@import url('${url}');
|
|
117
|
+
`
|
|
118
|
+
}, url);
|
|
119
|
+
}),
|
|
118
120
|
children
|
|
119
121
|
]
|
|
120
122
|
})
|
|
@@ -126,10 +128,10 @@ var ThemeProvider_default = ThemeProvider;
|
|
|
126
128
|
import { useThemeUI } from "theme-ui";
|
|
127
129
|
var useTheme = useThemeUI;
|
|
128
130
|
|
|
129
|
-
// src/components/Box
|
|
131
|
+
// src/components/Box.tsx
|
|
130
132
|
import { Box } from "theme-ui";
|
|
131
133
|
|
|
132
|
-
// src/components/Button
|
|
134
|
+
// src/components/Button.tsx
|
|
133
135
|
import { Button as ButtonUi } from "theme-ui";
|
|
134
136
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
135
137
|
var Button = (props) => {
|
|
@@ -139,51 +141,51 @@ var Button = (props) => {
|
|
|
139
141
|
});
|
|
140
142
|
};
|
|
141
143
|
|
|
142
|
-
// src/components/Card
|
|
144
|
+
// src/components/Card.tsx
|
|
143
145
|
import { Card } from "theme-ui";
|
|
144
146
|
|
|
145
|
-
// src/components/Divider
|
|
147
|
+
// src/components/Divider.tsx
|
|
146
148
|
import { Divider } from "theme-ui";
|
|
147
149
|
|
|
148
|
-
// src/components/Flex
|
|
150
|
+
// src/components/Flex.tsx
|
|
149
151
|
import { Flex } from "theme-ui";
|
|
150
152
|
|
|
151
|
-
// src/components/Grid
|
|
153
|
+
// src/components/Grid.tsx
|
|
152
154
|
import { Grid } from "theme-ui";
|
|
153
155
|
|
|
154
|
-
// src/components/Heading
|
|
156
|
+
// src/components/Heading.tsx
|
|
155
157
|
import { Heading } from "theme-ui";
|
|
156
158
|
|
|
157
|
-
// src/components/Image
|
|
159
|
+
// src/components/Image.tsx
|
|
158
160
|
import { Image } from "theme-ui";
|
|
159
161
|
|
|
160
|
-
// src/components/Input
|
|
162
|
+
// src/components/Input.tsx
|
|
161
163
|
import { Input } from "theme-ui";
|
|
162
164
|
|
|
163
|
-
// src/components/Label
|
|
165
|
+
// src/components/Label.tsx
|
|
164
166
|
import { Label } from "theme-ui";
|
|
165
167
|
|
|
166
|
-
// src/components/Link
|
|
168
|
+
// src/components/Link.tsx
|
|
167
169
|
import { Link } from "theme-ui";
|
|
168
170
|
|
|
169
|
-
// src/components/LinearProgress
|
|
171
|
+
// src/components/LinearProgress.tsx
|
|
170
172
|
import {
|
|
171
173
|
Progress
|
|
172
174
|
} from "theme-ui";
|
|
173
175
|
|
|
174
|
-
// src/components/Text
|
|
176
|
+
// src/components/Text.tsx
|
|
175
177
|
import { Text } from "theme-ui";
|
|
176
178
|
|
|
177
|
-
// src/components/Select
|
|
179
|
+
// src/components/Select.tsx
|
|
178
180
|
import { Select } from "theme-ui";
|
|
179
181
|
|
|
180
|
-
// src/components/Spinner
|
|
182
|
+
// src/components/Spinner.tsx
|
|
181
183
|
import { Spinner } from "theme-ui";
|
|
182
184
|
|
|
183
|
-
// src/components/Radio
|
|
185
|
+
// src/components/Radio.tsx
|
|
184
186
|
import { Radio } from "theme-ui";
|
|
185
187
|
|
|
186
|
-
// src/components/Icon
|
|
188
|
+
// src/components/Icon.tsx
|
|
187
189
|
import { Icon as IconUI } from "@iconify/react";
|
|
188
190
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
189
191
|
var Icon = ({ icon, sx, iconProps, ...props }) => {
|
|
@@ -197,11 +199,45 @@ var Icon = ({ icon, sx, iconProps, ...props }) => {
|
|
|
197
199
|
});
|
|
198
200
|
};
|
|
199
201
|
|
|
200
|
-
// src/components/Slider
|
|
202
|
+
// src/components/Slider.tsx
|
|
201
203
|
import { Slider } from "theme-ui";
|
|
202
204
|
|
|
203
|
-
// src/components/Checkbox
|
|
205
|
+
// src/components/Checkbox.tsx
|
|
204
206
|
import { Checkbox } from "theme-ui";
|
|
207
|
+
|
|
208
|
+
// src/components/InfiniteLinearProgress.tsx
|
|
209
|
+
import * as React3 from "react";
|
|
210
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
211
|
+
var MAX_PROGRESS = 100;
|
|
212
|
+
var InfiniteLinearProgress = () => {
|
|
213
|
+
const [progress, setProgress] = React3.useState(0);
|
|
214
|
+
React3.useEffect(() => {
|
|
215
|
+
const timer = setInterval(() => {
|
|
216
|
+
setProgress((oldProgress) => {
|
|
217
|
+
if (oldProgress === MAX_PROGRESS) {
|
|
218
|
+
return 0;
|
|
219
|
+
}
|
|
220
|
+
let diff = 0;
|
|
221
|
+
if (oldProgress > 0.97 * MAX_PROGRESS) {
|
|
222
|
+
diff -= 0.75 * MAX_PROGRESS;
|
|
223
|
+
} else if (oldProgress > 0.6 * MAX_PROGRESS) {
|
|
224
|
+
diff = Math.random() * (MAX_PROGRESS - oldProgress) * 0.1;
|
|
225
|
+
} else {
|
|
226
|
+
diff = Math.random() * (MAX_PROGRESS * 0.02);
|
|
227
|
+
}
|
|
228
|
+
return Math.min(oldProgress + diff, MAX_PROGRESS);
|
|
229
|
+
});
|
|
230
|
+
}, 100);
|
|
231
|
+
return () => {
|
|
232
|
+
clearInterval(timer);
|
|
233
|
+
};
|
|
234
|
+
}, []);
|
|
235
|
+
return /* @__PURE__ */ jsx4(Progress, {
|
|
236
|
+
max: MAX_PROGRESS,
|
|
237
|
+
value: progress,
|
|
238
|
+
role: "progressbar"
|
|
239
|
+
});
|
|
240
|
+
};
|
|
205
241
|
export {
|
|
206
242
|
Box,
|
|
207
243
|
Button,
|
|
@@ -213,6 +249,7 @@ export {
|
|
|
213
249
|
Heading,
|
|
214
250
|
Icon,
|
|
215
251
|
Image,
|
|
252
|
+
InfiniteLinearProgress,
|
|
216
253
|
Input,
|
|
217
254
|
Label,
|
|
218
255
|
Progress as LinearProgress,
|
package/dist/index.d.ts
CHANGED
|
@@ -25,4 +25,6 @@ declare type IconProps = TextProps & {
|
|
|
25
25
|
};
|
|
26
26
|
declare const Icon: ({ icon, sx, iconProps, ...props }: IconProps) => JSX.Element;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
declare const InfiniteLinearProgress: () => JSX.Element;
|
|
29
|
+
|
|
30
|
+
export { Button, Icon, IconProps, InfiniteLinearProgress, ThemeProvider, ThemeProviderProps, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -37,6 +37,7 @@ __export(src_exports, {
|
|
|
37
37
|
Heading: () => import_theme_ui9.Heading,
|
|
38
38
|
Icon: () => Icon,
|
|
39
39
|
Image: () => import_theme_ui10.Image,
|
|
40
|
+
InfiniteLinearProgress: () => InfiniteLinearProgress,
|
|
40
41
|
Input: () => import_theme_ui11.Input,
|
|
41
42
|
Label: () => import_theme_ui12.Label,
|
|
42
43
|
LinearProgress: () => import_theme_ui14.Progress,
|
|
@@ -163,11 +164,13 @@ var ThemeProvider = ({
|
|
|
163
164
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_theme_ui.ThemeProvider, {
|
|
164
165
|
theme: mergedTheme,
|
|
165
166
|
children: [
|
|
166
|
-
fonts.map((url) =>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
fonts.map((url) => {
|
|
168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Global, {
|
|
169
|
+
styles: import_react.css`
|
|
170
|
+
@import url('${url}');
|
|
171
|
+
`
|
|
172
|
+
}, url);
|
|
173
|
+
}),
|
|
171
174
|
children
|
|
172
175
|
]
|
|
173
176
|
})
|
|
@@ -179,10 +182,10 @@ var ThemeProvider_default = ThemeProvider;
|
|
|
179
182
|
var import_theme_ui2 = require("theme-ui");
|
|
180
183
|
var useTheme = import_theme_ui2.useThemeUI;
|
|
181
184
|
|
|
182
|
-
// src/components/Box
|
|
185
|
+
// src/components/Box.tsx
|
|
183
186
|
var import_theme_ui3 = require("theme-ui");
|
|
184
187
|
|
|
185
|
-
// src/components/Button
|
|
188
|
+
// src/components/Button.tsx
|
|
186
189
|
var import_theme_ui4 = require("theme-ui");
|
|
187
190
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
188
191
|
var Button = (props) => {
|
|
@@ -192,49 +195,49 @@ var Button = (props) => {
|
|
|
192
195
|
});
|
|
193
196
|
};
|
|
194
197
|
|
|
195
|
-
// src/components/Card
|
|
198
|
+
// src/components/Card.tsx
|
|
196
199
|
var import_theme_ui5 = require("theme-ui");
|
|
197
200
|
|
|
198
|
-
// src/components/Divider
|
|
201
|
+
// src/components/Divider.tsx
|
|
199
202
|
var import_theme_ui6 = require("theme-ui");
|
|
200
203
|
|
|
201
|
-
// src/components/Flex
|
|
204
|
+
// src/components/Flex.tsx
|
|
202
205
|
var import_theme_ui7 = require("theme-ui");
|
|
203
206
|
|
|
204
|
-
// src/components/Grid
|
|
207
|
+
// src/components/Grid.tsx
|
|
205
208
|
var import_theme_ui8 = require("theme-ui");
|
|
206
209
|
|
|
207
|
-
// src/components/Heading
|
|
210
|
+
// src/components/Heading.tsx
|
|
208
211
|
var import_theme_ui9 = require("theme-ui");
|
|
209
212
|
|
|
210
|
-
// src/components/Image
|
|
213
|
+
// src/components/Image.tsx
|
|
211
214
|
var import_theme_ui10 = require("theme-ui");
|
|
212
215
|
|
|
213
|
-
// src/components/Input
|
|
216
|
+
// src/components/Input.tsx
|
|
214
217
|
var import_theme_ui11 = require("theme-ui");
|
|
215
218
|
|
|
216
|
-
// src/components/Label
|
|
219
|
+
// src/components/Label.tsx
|
|
217
220
|
var import_theme_ui12 = require("theme-ui");
|
|
218
221
|
|
|
219
|
-
// src/components/Link
|
|
222
|
+
// src/components/Link.tsx
|
|
220
223
|
var import_theme_ui13 = require("theme-ui");
|
|
221
224
|
|
|
222
|
-
// src/components/LinearProgress
|
|
225
|
+
// src/components/LinearProgress.tsx
|
|
223
226
|
var import_theme_ui14 = require("theme-ui");
|
|
224
227
|
|
|
225
|
-
// src/components/Text
|
|
228
|
+
// src/components/Text.tsx
|
|
226
229
|
var import_theme_ui15 = require("theme-ui");
|
|
227
230
|
|
|
228
|
-
// src/components/Select
|
|
231
|
+
// src/components/Select.tsx
|
|
229
232
|
var import_theme_ui16 = require("theme-ui");
|
|
230
233
|
|
|
231
|
-
// src/components/Spinner
|
|
234
|
+
// src/components/Spinner.tsx
|
|
232
235
|
var import_theme_ui17 = require("theme-ui");
|
|
233
236
|
|
|
234
|
-
// src/components/Radio
|
|
237
|
+
// src/components/Radio.tsx
|
|
235
238
|
var import_theme_ui18 = require("theme-ui");
|
|
236
239
|
|
|
237
|
-
// src/components/Icon
|
|
240
|
+
// src/components/Icon.tsx
|
|
238
241
|
var import_react2 = require("@iconify/react");
|
|
239
242
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
240
243
|
var Icon = ({ icon, sx, iconProps, ...props }) => {
|
|
@@ -248,11 +251,45 @@ var Icon = ({ icon, sx, iconProps, ...props }) => {
|
|
|
248
251
|
});
|
|
249
252
|
};
|
|
250
253
|
|
|
251
|
-
// src/components/Slider
|
|
254
|
+
// src/components/Slider.tsx
|
|
252
255
|
var import_theme_ui19 = require("theme-ui");
|
|
253
256
|
|
|
254
|
-
// src/components/Checkbox
|
|
257
|
+
// src/components/Checkbox.tsx
|
|
255
258
|
var import_theme_ui20 = require("theme-ui");
|
|
259
|
+
|
|
260
|
+
// src/components/InfiniteLinearProgress.tsx
|
|
261
|
+
var React3 = __toESM(require("react"));
|
|
262
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
263
|
+
var MAX_PROGRESS = 100;
|
|
264
|
+
var InfiniteLinearProgress = () => {
|
|
265
|
+
const [progress, setProgress] = React3.useState(0);
|
|
266
|
+
React3.useEffect(() => {
|
|
267
|
+
const timer = setInterval(() => {
|
|
268
|
+
setProgress((oldProgress) => {
|
|
269
|
+
if (oldProgress === MAX_PROGRESS) {
|
|
270
|
+
return 0;
|
|
271
|
+
}
|
|
272
|
+
let diff = 0;
|
|
273
|
+
if (oldProgress > 0.97 * MAX_PROGRESS) {
|
|
274
|
+
diff -= 0.75 * MAX_PROGRESS;
|
|
275
|
+
} else if (oldProgress > 0.6 * MAX_PROGRESS) {
|
|
276
|
+
diff = Math.random() * (MAX_PROGRESS - oldProgress) * 0.1;
|
|
277
|
+
} else {
|
|
278
|
+
diff = Math.random() * (MAX_PROGRESS * 0.02);
|
|
279
|
+
}
|
|
280
|
+
return Math.min(oldProgress + diff, MAX_PROGRESS);
|
|
281
|
+
});
|
|
282
|
+
}, 100);
|
|
283
|
+
return () => {
|
|
284
|
+
clearInterval(timer);
|
|
285
|
+
};
|
|
286
|
+
}, []);
|
|
287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_theme_ui14.Progress, {
|
|
288
|
+
max: MAX_PROGRESS,
|
|
289
|
+
value: progress,
|
|
290
|
+
role: "progressbar"
|
|
291
|
+
});
|
|
292
|
+
};
|
|
256
293
|
// Annotate the CommonJS export names for ESM import in node:
|
|
257
294
|
0 && (module.exports = {
|
|
258
295
|
Box,
|
|
@@ -265,6 +302,7 @@ var import_theme_ui20 = require("theme-ui");
|
|
|
265
302
|
Heading,
|
|
266
303
|
Icon,
|
|
267
304
|
Image,
|
|
305
|
+
InfiniteLinearProgress,
|
|
268
306
|
Input,
|
|
269
307
|
Label,
|
|
270
308
|
LinearProgress,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "Primitive layout, typographic, and other components for styling applications.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"typings": "dist/index.d.ts",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@iconify/react": "^4.0.
|
|
23
|
+
"@iconify/react": "^4.0.1",
|
|
24
24
|
"@theme-ui/match-media": "^0.15.4",
|
|
25
25
|
"theme-ui": "^0.15.4"
|
|
26
26
|
},
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@emotion/react": "^11.10.4",
|
|
33
|
-
"@ttoss/config": "^1.
|
|
34
|
-
"@ttoss/test-utils": "^1.18.
|
|
35
|
-
"@ttoss/theme": "^1.0
|
|
36
|
-
"@types/jest": "^29.2.
|
|
33
|
+
"@ttoss/config": "^1.21.0",
|
|
34
|
+
"@ttoss/test-utils": "^1.18.1",
|
|
35
|
+
"@ttoss/theme": "^1.1.0",
|
|
36
|
+
"@types/jest": "^29.2.4",
|
|
37
37
|
"jest": "^29.3.1",
|
|
38
38
|
"tsup": "^6.5.0"
|
|
39
39
|
},
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "770c9a378b57b46158e533b505d53747f1b27a07"
|
|
49
49
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LinearProgress } from './LinearProgress';
|
|
3
|
+
|
|
4
|
+
const MAX_PROGRESS = 100;
|
|
5
|
+
|
|
6
|
+
export const InfiniteLinearProgress = () => {
|
|
7
|
+
const [progress, setProgress] = React.useState(0);
|
|
8
|
+
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
const timer = setInterval(() => {
|
|
11
|
+
setProgress((oldProgress) => {
|
|
12
|
+
if (oldProgress === MAX_PROGRESS) {
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let diff = 0;
|
|
17
|
+
|
|
18
|
+
if (oldProgress > 0.97 * MAX_PROGRESS) {
|
|
19
|
+
diff -= 0.75 * MAX_PROGRESS;
|
|
20
|
+
} else if (oldProgress > 0.6 * MAX_PROGRESS) {
|
|
21
|
+
diff = Math.random() * (MAX_PROGRESS - oldProgress) * 0.1;
|
|
22
|
+
} else {
|
|
23
|
+
diff = Math.random() * (MAX_PROGRESS * 0.02);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return Math.min(oldProgress + diff, MAX_PROGRESS);
|
|
27
|
+
});
|
|
28
|
+
}, 100);
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
clearInterval(timer);
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<LinearProgress max={MAX_PROGRESS} value={progress} role="progressbar" />
|
|
37
|
+
);
|
|
38
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/index.ts
CHANGED
|
@@ -8,25 +8,26 @@ export {
|
|
|
8
8
|
|
|
9
9
|
export { useTheme } from './theme/useTheme';
|
|
10
10
|
|
|
11
|
-
export { Box, type BoxProps } from './components/Box
|
|
12
|
-
export { Button, type ButtonProps } from './components/Button
|
|
13
|
-
export { Card, type CardProps } from './components/Card
|
|
14
|
-
export { Divider, type DividerProps } from './components/Divider
|
|
15
|
-
export { Flex, type FlexProps } from './components/Flex
|
|
16
|
-
export { Grid, type GridProps } from './components/Grid
|
|
17
|
-
export { Heading, type HeadingProps } from './components/Heading
|
|
18
|
-
export { Image, type ImageProps } from './components/Image
|
|
19
|
-
export { Input, type InputProps } from './components/Input
|
|
20
|
-
export { Label, type LabelProps } from './components/Label
|
|
21
|
-
export { Link, type LinkProps } from './components/Link
|
|
11
|
+
export { Box, type BoxProps } from './components/Box';
|
|
12
|
+
export { Button, type ButtonProps } from './components/Button';
|
|
13
|
+
export { Card, type CardProps } from './components/Card';
|
|
14
|
+
export { Divider, type DividerProps } from './components/Divider';
|
|
15
|
+
export { Flex, type FlexProps } from './components/Flex';
|
|
16
|
+
export { Grid, type GridProps } from './components/Grid';
|
|
17
|
+
export { Heading, type HeadingProps } from './components/Heading';
|
|
18
|
+
export { Image, type ImageProps } from './components/Image';
|
|
19
|
+
export { Input, type InputProps } from './components/Input';
|
|
20
|
+
export { Label, type LabelProps } from './components/Label';
|
|
21
|
+
export { Link, type LinkProps } from './components/Link';
|
|
22
22
|
export {
|
|
23
23
|
LinearProgress,
|
|
24
24
|
type LinearProgressProps,
|
|
25
|
-
} from './components/LinearProgress
|
|
26
|
-
export { Text, type TextProps } from './components/Text
|
|
27
|
-
export { Select, type SelectProps } from './components/Select
|
|
28
|
-
export { Spinner, type SpinnerProps } from './components/Spinner
|
|
29
|
-
export { Radio, type RadioProps } from './components/Radio
|
|
30
|
-
export { Icon, type IconProps } from './components/Icon
|
|
31
|
-
export { Slider, type SliderProps } from './components/Slider
|
|
32
|
-
export { Checkbox, type CheckboxProps } from './components/Checkbox
|
|
25
|
+
} from './components/LinearProgress';
|
|
26
|
+
export { Text, type TextProps } from './components/Text';
|
|
27
|
+
export { Select, type SelectProps } from './components/Select';
|
|
28
|
+
export { Spinner, type SpinnerProps } from './components/Spinner';
|
|
29
|
+
export { Radio, type RadioProps } from './components/Radio';
|
|
30
|
+
export { Icon, type IconProps } from './components/Icon';
|
|
31
|
+
export { Slider, type SliderProps } from './components/Slider';
|
|
32
|
+
export { Checkbox, type CheckboxProps } from './components/Checkbox';
|
|
33
|
+
export { InfiniteLinearProgress } from './components/InfiniteLinearProgress';
|
|
@@ -28,14 +28,16 @@ const ThemeProvider = ({
|
|
|
28
28
|
return (
|
|
29
29
|
<>
|
|
30
30
|
<ThemeUiProvider theme={mergedTheme}>
|
|
31
|
-
{fonts.map((url) =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
{fonts.map((url) => {
|
|
32
|
+
return (
|
|
33
|
+
<Global
|
|
34
|
+
key={url}
|
|
35
|
+
styles={css`
|
|
36
|
+
@import url('${url}');
|
|
37
|
+
`}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
})}
|
|
39
41
|
{children}
|
|
40
42
|
</ThemeUiProvider>
|
|
41
43
|
</>
|
package/src/index.spec.tsx
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as uiModule from './';
|
|
2
|
-
|
|
3
|
-
test('should export methods', () => {
|
|
4
|
-
expect(uiModule.useBreakpointIndex).toBeDefined();
|
|
5
|
-
expect(uiModule.useResponsiveValue).toBeDefined();
|
|
6
|
-
expect(uiModule.useTheme).toBeDefined();
|
|
7
|
-
|
|
8
|
-
expect(uiModule.Divider).toBeDefined();
|
|
9
|
-
expect(uiModule.Radio).toBeDefined();
|
|
10
|
-
});
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { DefaultTheme } from '@ttoss/theme';
|
|
2
|
-
import { renderHook } from '@ttoss/test-utils';
|
|
3
|
-
import { useTheme } from './useTheme';
|
|
4
|
-
import ThemeProvider from './ThemeProvider';
|
|
5
|
-
|
|
6
|
-
test('should return default theme colors', () => {
|
|
7
|
-
const { result } = renderHook(() => useTheme(), {
|
|
8
|
-
wrapper: ThemeProvider,
|
|
9
|
-
initialProps: { theme: {} },
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
expect(result.current.theme.rawColors).toEqual(DefaultTheme.colors);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test('should return new theme colors', () => {
|
|
16
|
-
const newColor = '#000';
|
|
17
|
-
|
|
18
|
-
const { result } = renderHook(() => useTheme(), {
|
|
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
|
-
),
|
|
33
|
-
});
|
|
34
|
-
|
|
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);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test('should pass variants', () => {
|
|
42
|
-
const authCard = {
|
|
43
|
-
backgroundColor: 'red',
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const authLayout = {
|
|
47
|
-
backgroundColor: 'blue',
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const variants = {
|
|
51
|
-
layout: {
|
|
52
|
-
auth: authLayout,
|
|
53
|
-
},
|
|
54
|
-
cards: {
|
|
55
|
-
auth: authCard,
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const { result } = renderHook(() => useTheme(), {
|
|
60
|
-
wrapper: ({ children }: any) => (
|
|
61
|
-
<ThemeProvider
|
|
62
|
-
theme={{
|
|
63
|
-
colors: {},
|
|
64
|
-
...variants,
|
|
65
|
-
}}
|
|
66
|
-
>
|
|
67
|
-
{children}
|
|
68
|
-
</ThemeProvider>
|
|
69
|
-
),
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
expect(result.current.theme.cards).toEqual(
|
|
73
|
-
expect.objectContaining(variants.cards)
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
expect(result.current.theme.layout).toEqual(
|
|
77
|
-
expect.objectContaining(variants.layout)
|
|
78
|
-
);
|
|
79
|
-
});
|