tinywidgets 1.5.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/package.json +1 -1
- package/src/components/App/index.css.ts +35 -26
- package/src/components/App/index.tsx +31 -6
- package/src/components/Axis/index.css.ts +1 -1
- package/src/components/Button/index.css.ts +37 -23
- package/src/components/Button/index.tsx +14 -0
- package/src/components/Card/index.css.ts +2 -2
- package/src/components/Checkbox/index.css.ts +27 -8
- package/src/components/Checkbox/index.tsx +17 -2
- package/src/components/Code/index.css.ts +2 -2
- package/src/components/Collapsible/index.css.ts +6 -6
- package/src/components/Detail/index.css.ts +2 -2
- package/src/components/Flyout/index.css.ts +5 -5
- package/src/components/Hr/index.css.ts +1 -1
- package/src/components/Image/index.css.ts +12 -12
- package/src/components/Loading/index.css.ts +28 -28
- package/src/components/Row/index.css.ts +8 -8
- package/src/components/Select/index.css.ts +20 -9
- package/src/components/Select/index.tsx +22 -3
- package/src/components/Summary/index.css.ts +1 -1
- package/src/components/Table/index.css.ts +8 -8
- package/src/components/Tag/index.css.ts +8 -8
- package/src/components/TextInput/index.css.ts +48 -17
- package/src/components/TextInput/index.tsx +39 -5
- package/src/css/classes.css.ts +42 -0
- package/src/css/code.css.ts +18 -18
- package/src/css/colors.css.ts +17 -17
- package/src/css/dimensions.css.ts +2 -2
- package/src/css/global.css.ts +2 -2
- package/src/index.css.ts +1 -0
- package/src/index.ts +5 -1
- package/src/stores/RouteStore.tsx +52 -14
|
@@ -13,31 +13,31 @@ const shimmer = keyframes({
|
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
export const loading = style({
|
|
16
|
+
alignContent: 'start',
|
|
16
17
|
display: 'grid',
|
|
17
|
-
gridTemplateRows: 'auto minmax(0, 1fr)',
|
|
18
18
|
gap: `calc(${dimensions.padding} / 1.5)`,
|
|
19
|
-
|
|
19
|
+
gridTemplateRows: 'auto minmax(0, 1fr)',
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
export const header = style({
|
|
23
|
-
display: 'flex',
|
|
24
23
|
alignItems: 'center',
|
|
25
|
-
gap: `calc(${dimensions.padding} / 2)`,
|
|
26
24
|
color: colors.foregroundDim,
|
|
25
|
+
display: 'flex',
|
|
26
|
+
gap: `calc(${dimensions.padding} / 2)`,
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
export const spinner = style({
|
|
30
|
-
width: dimensions.icon,
|
|
31
|
-
height: dimensions.icon,
|
|
32
|
-
borderRadius: '999px',
|
|
33
|
-
border: `2px solid ${colors.backgroundHover}`,
|
|
34
|
-
borderTopColor: colors.accent,
|
|
35
|
-
animation: `${spin} .9s linear infinite`,
|
|
36
30
|
'@media': {
|
|
37
31
|
'(prefers-reduced-motion: reduce)': {
|
|
38
32
|
animation: 'none',
|
|
39
33
|
},
|
|
40
34
|
},
|
|
35
|
+
animation: `${spin} .9s linear infinite`,
|
|
36
|
+
border: `2px solid ${colors.backgroundHover}`,
|
|
37
|
+
borderRadius: '999px',
|
|
38
|
+
borderTopColor: colors.accent,
|
|
39
|
+
height: dimensions.icon,
|
|
40
|
+
width: dimensions.icon,
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
export const label = style({
|
|
@@ -45,40 +45,40 @@ export const label = style({
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
export const rows = style({
|
|
48
|
-
position: 'relative',
|
|
49
48
|
display: 'grid',
|
|
50
49
|
gap: `calc(${dimensions.padding} / 2)`,
|
|
51
50
|
minHeight: 0,
|
|
52
51
|
overflow: 'hidden',
|
|
52
|
+
position: 'relative',
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
export const row = style({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
'@media': {
|
|
57
|
+
'(prefers-reduced-motion: reduce)': {
|
|
58
|
+
selectors: {
|
|
59
|
+
'&::after': {
|
|
60
|
+
animation: 'none',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
60
65
|
background: colors.background2,
|
|
66
|
+
borderRadius: dimensions.radius,
|
|
67
|
+
height: '.875rem',
|
|
68
|
+
overflow: 'hidden',
|
|
69
|
+
position: 'relative',
|
|
61
70
|
selectors: {
|
|
62
71
|
'&::after': {
|
|
63
|
-
|
|
64
|
-
position: 'absolute',
|
|
65
|
-
inset: 0,
|
|
72
|
+
animation: `${shimmer} 1.6s ease-in-out infinite`,
|
|
66
73
|
background: `linear-gradient(
|
|
67
74
|
90deg,
|
|
68
75
|
transparent,
|
|
69
76
|
${colors.backgroundHover},
|
|
70
77
|
transparent
|
|
71
78
|
)`,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
'@media': {
|
|
76
|
-
'(prefers-reduced-motion: reduce)': {
|
|
77
|
-
selectors: {
|
|
78
|
-
'&::after': {
|
|
79
|
-
animation: 'none',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
79
|
+
content: '""',
|
|
80
|
+
inset: 0,
|
|
81
|
+
position: 'absolute',
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
});
|
|
@@ -4,27 +4,27 @@ import {dimensions} from '../../css/dimensions.css.ts';
|
|
|
4
4
|
|
|
5
5
|
export const row = style({
|
|
6
6
|
display: 'grid',
|
|
7
|
-
width: '100%',
|
|
8
7
|
gap: dimensions.padding,
|
|
8
|
+
width: '100%',
|
|
9
9
|
...notLarge({gridTemplateColumns: '1fr'}),
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
export const rowVariants = styleVariants({
|
|
13
13
|
'1|1': {gridTemplateColumns: `calc((100% - ${dimensions.padding})/2) 1fr`},
|
|
14
|
-
'1|2': {
|
|
15
|
-
gridTemplateColumns: `calc((100% - ${dimensions.padding}*2)/3) 1fr`,
|
|
16
|
-
},
|
|
17
|
-
'2|1': {
|
|
18
|
-
gridTemplateColumns: `1fr calc((100% - ${dimensions.padding}*2)/3)`,
|
|
19
|
-
},
|
|
20
14
|
'1|1|1': {
|
|
21
15
|
gridTemplateColumns: `1fr 1fr 1fr`,
|
|
22
16
|
},
|
|
17
|
+
'1|1|1|1': {gridTemplateColumns: '1fr 1fr 1fr 1fr'},
|
|
18
|
+
'1|2': {
|
|
19
|
+
gridTemplateColumns: `calc((100% - ${dimensions.padding}*2)/3) 1fr`,
|
|
20
|
+
},
|
|
23
21
|
'1|3': {
|
|
24
22
|
gridTemplateColumns: `calc((100% - ${dimensions.padding}*3)/4) 1fr`,
|
|
25
23
|
},
|
|
24
|
+
'2|1': {
|
|
25
|
+
gridTemplateColumns: `1fr calc((100% - ${dimensions.padding}*2)/3)`,
|
|
26
|
+
},
|
|
26
27
|
'3|1': {
|
|
27
28
|
gridTemplateColumns: `1fr calc((100% - ${dimensions.padding}*3)/4)`,
|
|
28
29
|
},
|
|
29
|
-
'1|1|1|1': {gridTemplateColumns: '1fr 1fr 1fr 1fr'},
|
|
30
30
|
});
|
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
import {style} from '@vanilla-extract/css';
|
|
1
|
+
import {style, styleVariants} from '@vanilla-extract/css';
|
|
2
2
|
import {colors} from '../../css/colors.css';
|
|
3
3
|
import {dimensions} from '../../css/dimensions.css';
|
|
4
4
|
|
|
5
5
|
export const select = style({
|
|
6
|
+
backgroundColor: colors.background,
|
|
7
|
+
border: colors.border,
|
|
6
8
|
borderRadius: dimensions.radius,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
boxSizing: 'border-box',
|
|
10
|
+
boxShadow: colors.shadow,
|
|
9
11
|
color: 'inherit',
|
|
10
|
-
fontWeight: 'inherit',
|
|
11
12
|
fontFamily: 'inherit',
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
fontWeight: 'inherit',
|
|
14
|
+
outlineOffset: '2px',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const selectVariants = styleVariants({
|
|
18
|
+
default: {
|
|
19
|
+
height: '2.5rem',
|
|
20
|
+
padding: '0.5rem',
|
|
21
|
+
},
|
|
22
|
+
small: {
|
|
23
|
+
fontSize: '0.75rem',
|
|
24
|
+
height: '1.5rem',
|
|
25
|
+
lineHeight: '0.875rem',
|
|
26
|
+
padding: '0.1875rem 0.375rem',
|
|
27
|
+
},
|
|
17
28
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {useCallback, useEffect, useState} from 'react';
|
|
2
2
|
import {classNames} from '../../common/functions.tsx';
|
|
3
|
-
import {select} from './index.css.ts';
|
|
3
|
+
import {select, selectVariants} from './index.css.ts';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The `Select` component displays a managed select input with an existing
|
|
@@ -16,6 +16,15 @@ import {select} from './index.css.ts';
|
|
|
16
16
|
* onChange={(option) => console.log(option)}
|
|
17
17
|
* />
|
|
18
18
|
* ```
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Select
|
|
22
|
+
* initialOption="CA"
|
|
23
|
+
* options={{AL: 'Albania', BE: 'Belgium', CA: 'Canada'}}
|
|
24
|
+
* variant="small"
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
* This example shows the `small` variant of the Select component.
|
|
19
28
|
* @icon Lucide.Combine
|
|
20
29
|
*/
|
|
21
30
|
export const Select = ({
|
|
@@ -24,6 +33,7 @@ export const Select = ({
|
|
|
24
33
|
onChange,
|
|
25
34
|
alt,
|
|
26
35
|
className,
|
|
36
|
+
variant = 'default',
|
|
27
37
|
ref,
|
|
28
38
|
}: {
|
|
29
39
|
/**
|
|
@@ -46,6 +56,15 @@ export const Select = ({
|
|
|
46
56
|
* An extra CSS class name for the component.
|
|
47
57
|
*/
|
|
48
58
|
readonly className?: string;
|
|
59
|
+
/**
|
|
60
|
+
* A variant of the select, one of:
|
|
61
|
+
* - `default`
|
|
62
|
+
* - `small`
|
|
63
|
+
*/
|
|
64
|
+
readonly variant?: keyof typeof selectVariants;
|
|
65
|
+
/**
|
|
66
|
+
* A ref to the underlying select element.
|
|
67
|
+
*/
|
|
49
68
|
ref?: React.RefObject<HTMLSelectElement | null>;
|
|
50
69
|
}) => {
|
|
51
70
|
const [option, setOption] = useState(initialOption ?? '');
|
|
@@ -63,12 +82,12 @@ export const Select = ({
|
|
|
63
82
|
[change],
|
|
64
83
|
);
|
|
65
84
|
|
|
66
|
-
useEffect(() =>
|
|
85
|
+
useEffect(() => setOption(initialOption ?? ''), [initialOption]);
|
|
67
86
|
|
|
68
87
|
return (
|
|
69
88
|
<select
|
|
70
89
|
value={option}
|
|
71
|
-
className={classNames(select, className)}
|
|
90
|
+
className={classNames(select, selectVariants[variant], className)}
|
|
72
91
|
onChange={handleChange}
|
|
73
92
|
title={alt}
|
|
74
93
|
ref={ref}
|
|
@@ -4,9 +4,9 @@ import {dimensions} from '../../css/dimensions.css.ts';
|
|
|
4
4
|
|
|
5
5
|
export const summary = style({
|
|
6
6
|
display: 'grid',
|
|
7
|
-
width: '100%',
|
|
8
7
|
gap: dimensions.padding,
|
|
9
8
|
gridTemplateColumns: `6rem 1fr`,
|
|
9
|
+
width: '100%',
|
|
10
10
|
...notLarge({gridTemplateColumns: '1fr'}),
|
|
11
11
|
});
|
|
12
12
|
|
|
@@ -2,25 +2,25 @@ import {globalStyle, style} from '@vanilla-extract/css';
|
|
|
2
2
|
import {colors} from '../../css/colors.css';
|
|
3
3
|
|
|
4
4
|
export const table = style({
|
|
5
|
-
|
|
5
|
+
borderCollapse: 'collapse',
|
|
6
6
|
height: '100%',
|
|
7
7
|
padding: 0,
|
|
8
|
-
borderCollapse: 'collapse',
|
|
9
8
|
tableLayout: 'fixed',
|
|
9
|
+
width: '100%',
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
globalStyle(`${table} th, ${table} td`, {
|
|
13
|
+
borderColor: colors.borderColor,
|
|
14
|
+
borderStyle: 'solid',
|
|
15
|
+
borderWidth: '1px 0',
|
|
13
16
|
overflow: 'hidden',
|
|
14
17
|
padding: '0.25rem 1rem',
|
|
15
|
-
whiteSpace: 'nowrap',
|
|
16
|
-
textOverflow: 'ellipsis',
|
|
17
|
-
borderWidth: '1px 0',
|
|
18
|
-
borderStyle: 'solid',
|
|
19
|
-
borderColor: colors.borderColor,
|
|
20
18
|
textAlign: 'left',
|
|
19
|
+
textOverflow: 'ellipsis',
|
|
20
|
+
whiteSpace: 'nowrap',
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
globalStyle(`${table} th`, {
|
|
24
|
-
fontWeight: 'inherit',
|
|
25
24
|
backgroundColor: colors.backgroundHover,
|
|
25
|
+
fontWeight: 'inherit',
|
|
26
26
|
});
|
|
@@ -2,26 +2,26 @@ import {style, styleVariants} from '@vanilla-extract/css';
|
|
|
2
2
|
import {colors} from '../../css/colors.css';
|
|
3
3
|
|
|
4
4
|
export const tag = style({
|
|
5
|
+
borderRadius: '0.25rem',
|
|
6
|
+
flexShrink: 0,
|
|
5
7
|
fontSize: '0.625rem',
|
|
8
|
+
gap: '0.25rem',
|
|
6
9
|
lineHeight: '0.625rem',
|
|
7
10
|
padding: '0.1rem 0.25rem',
|
|
8
|
-
borderRadius: '0.25rem',
|
|
9
|
-
gap: '0.25rem',
|
|
10
|
-
flexShrink: 0,
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
export const tagVariants = styleVariants({
|
|
14
|
-
default: {
|
|
15
|
-
backgroundColor: colors.backgroundHover,
|
|
16
|
-
color: colors.foregroundDim,
|
|
17
|
-
},
|
|
18
14
|
accent: {
|
|
19
15
|
backgroundColor: colors.accent,
|
|
20
16
|
color: colors.accentContrast,
|
|
21
17
|
},
|
|
18
|
+
default: {
|
|
19
|
+
backgroundColor: colors.backgroundHover,
|
|
20
|
+
color: colors.foregroundDim,
|
|
21
|
+
},
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
export const tagIcon = style({
|
|
25
|
-
width: '0.7rem',
|
|
26
25
|
height: '0.7rem',
|
|
26
|
+
width: '0.7rem',
|
|
27
27
|
});
|
|
@@ -1,37 +1,68 @@
|
|
|
1
|
-
import {style} from '@vanilla-extract/css';
|
|
1
|
+
import {style, styleVariants} from '@vanilla-extract/css';
|
|
2
2
|
import {colors} from '../../css/colors.css';
|
|
3
3
|
import {dimensions} from '../../css/dimensions.css';
|
|
4
4
|
|
|
5
5
|
export const wrapper = style({
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
alignSelf: 'stretch',
|
|
7
|
+
display: 'block',
|
|
8
|
+
flex: '1 1 auto',
|
|
9
|
+
minWidth: 0,
|
|
8
10
|
position: 'relative',
|
|
9
|
-
display: 'inline-block',
|
|
10
11
|
});
|
|
11
12
|
|
|
12
13
|
export const input = style({
|
|
14
|
+
backgroundColor: colors.background,
|
|
15
|
+
border: colors.border,
|
|
13
16
|
borderRadius: dimensions.radius,
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
boxSizing: 'border-box',
|
|
18
|
+
boxShadow: colors.shadow + ' inset',
|
|
16
19
|
color: 'inherit',
|
|
17
|
-
fontWeight: 'inherit',
|
|
18
20
|
fontFamily: 'inherit',
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
fontWeight: 'inherit',
|
|
22
|
+
outlineOffset: '2px',
|
|
23
|
+
width: '100%',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const inputVariants = styleVariants({
|
|
27
|
+
default: {
|
|
28
|
+
height: '2.5rem',
|
|
29
|
+
lineHeight: '1.5rem',
|
|
30
|
+
padding: '0.5rem',
|
|
31
|
+
},
|
|
32
|
+
small: {
|
|
33
|
+
fontSize: '0.75rem',
|
|
34
|
+
height: '1.5rem',
|
|
35
|
+
lineHeight: '0.875rem',
|
|
36
|
+
padding: '0.1875rem 0.375rem',
|
|
37
|
+
},
|
|
23
38
|
});
|
|
24
39
|
|
|
25
|
-
export const
|
|
26
|
-
|
|
40
|
+
export const inputWithIconVariants = styleVariants({
|
|
41
|
+
default: {
|
|
42
|
+
textIndent: `calc(${dimensions.icon} * 1.3)`,
|
|
43
|
+
},
|
|
44
|
+
small: {
|
|
45
|
+
textIndent: '1rem',
|
|
46
|
+
},
|
|
27
47
|
});
|
|
28
48
|
|
|
29
49
|
export const icon = style({
|
|
30
|
-
position: 'absolute',
|
|
31
|
-
left: `calc(${dimensions.icon} * .5)`,
|
|
32
|
-
top: `calc(${dimensions.icon} * .8)`,
|
|
33
|
-
color: colors.foregroundDim,
|
|
34
50
|
backgroundColor: colors.background,
|
|
35
51
|
borderRight: `calc(${dimensions.icon} * .25) solid ${colors.background}`,
|
|
36
52
|
boxSizing: 'content-box',
|
|
53
|
+
color: colors.foregroundDim,
|
|
54
|
+
left: `calc(${dimensions.icon} * .5)`,
|
|
55
|
+
position: 'absolute',
|
|
56
|
+
top: `calc(${dimensions.icon} * .8)`,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const iconVariants = styleVariants({
|
|
60
|
+
default: {},
|
|
61
|
+
small: {
|
|
62
|
+
borderRight: `calc(${dimensions.icon} * .2) solid ${colors.background}`,
|
|
63
|
+
height: '0.75rem',
|
|
64
|
+
left: '0.375rem',
|
|
65
|
+
top: '0.4375rem',
|
|
66
|
+
width: '0.75rem',
|
|
67
|
+
},
|
|
37
68
|
});
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import {useCallback, useEffect, useState, type ComponentType} from 'react';
|
|
2
2
|
import {classNames} from '../../common/functions.tsx';
|
|
3
3
|
import {iconSize} from '../../css/dimensions.css.ts';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
icon,
|
|
6
|
+
iconVariants,
|
|
7
|
+
input,
|
|
8
|
+
inputVariants,
|
|
9
|
+
inputWithIconVariants,
|
|
10
|
+
wrapper,
|
|
11
|
+
} from './index.css.ts';
|
|
5
12
|
|
|
6
13
|
/**
|
|
7
14
|
* The `TextInput` component displays a managed text input with an existing
|
|
@@ -23,6 +30,17 @@ import {icon, input, inputWithIcon, wrapper} from './index.css.ts';
|
|
|
23
30
|
* ```
|
|
24
31
|
* This example shows the TextInput component with an inset icon and
|
|
25
32
|
* placeholder.
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <TextInput initialText="42" variant="small" />
|
|
36
|
+
* ```
|
|
37
|
+
* This example shows the `small` variant of the TextInput component.
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <TextInput icon={Lucide.Search} placeholder="Search..." variant="small" />
|
|
41
|
+
* ```
|
|
42
|
+
* This example shows the `small` variant of the TextInput component with an
|
|
43
|
+
* inset icon and placeholder.
|
|
26
44
|
* @icon Lucide.TextCursorInput
|
|
27
45
|
*/
|
|
28
46
|
export const TextInput = ({
|
|
@@ -32,6 +50,7 @@ export const TextInput = ({
|
|
|
32
50
|
icon: Icon,
|
|
33
51
|
alt,
|
|
34
52
|
className,
|
|
53
|
+
variant = 'default',
|
|
35
54
|
ref,
|
|
36
55
|
}: {
|
|
37
56
|
/**
|
|
@@ -59,6 +78,15 @@ export const TextInput = ({
|
|
|
59
78
|
* An extra CSS class name for the component.
|
|
60
79
|
*/
|
|
61
80
|
readonly className?: string;
|
|
81
|
+
/**
|
|
82
|
+
* A variant of the input, one of:
|
|
83
|
+
* - `default`
|
|
84
|
+
* - `small`
|
|
85
|
+
*/
|
|
86
|
+
readonly variant?: keyof typeof inputVariants;
|
|
87
|
+
/**
|
|
88
|
+
* A ref to the underlying input element.
|
|
89
|
+
*/
|
|
62
90
|
ref?: React.RefObject<HTMLInputElement | null>;
|
|
63
91
|
}) => {
|
|
64
92
|
const [text, setText] = useState(initialText ?? '');
|
|
@@ -76,15 +104,21 @@ export const TextInput = ({
|
|
|
76
104
|
[change],
|
|
77
105
|
);
|
|
78
106
|
|
|
79
|
-
useEffect(() =>
|
|
107
|
+
useEffect(() => setText(initialText ?? ''), [initialText]);
|
|
80
108
|
|
|
81
109
|
return (
|
|
82
|
-
<div className={wrapper}>
|
|
83
|
-
{Icon ?
|
|
110
|
+
<div className={classNames(wrapper, className)}>
|
|
111
|
+
{Icon ? (
|
|
112
|
+
<Icon className={classNames(iconSize, icon, iconVariants[variant])} />
|
|
113
|
+
) : null}
|
|
84
114
|
<input
|
|
85
115
|
value={text}
|
|
86
116
|
placeholder={placeholder}
|
|
87
|
-
className={classNames(
|
|
117
|
+
className={classNames(
|
|
118
|
+
input,
|
|
119
|
+
inputVariants[variant],
|
|
120
|
+
Icon && inputWithIconVariants[variant],
|
|
121
|
+
)}
|
|
88
122
|
onChange={handleChange}
|
|
89
123
|
title={alt}
|
|
90
124
|
ref={ref}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {table} from '../components/Table/index.css.ts';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The `classes` object exposes reusable TinyWidgets CSS classes so they can be
|
|
5
|
+
* applied to markup rendered by other libraries.
|
|
6
|
+
*
|
|
7
|
+
* The current members are:
|
|
8
|
+
* - `table`
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <table className={classes.table}>
|
|
13
|
+
* <thead>
|
|
14
|
+
* <tr>
|
|
15
|
+
* <th>Name</th>
|
|
16
|
+
* <th>Species</th>
|
|
17
|
+
* <th>Color</th>
|
|
18
|
+
* </tr>
|
|
19
|
+
* </thead>
|
|
20
|
+
* <tbody>
|
|
21
|
+
* <tr>
|
|
22
|
+
* <td>Fido</td>
|
|
23
|
+
* <td>Dog</td>
|
|
24
|
+
* <td>Brown</td>
|
|
25
|
+
* </tr>
|
|
26
|
+
* <tr>
|
|
27
|
+
* <td>Felix</td>
|
|
28
|
+
* <td>Cat</td>
|
|
29
|
+
* <td>Black</td>
|
|
30
|
+
* </tr>
|
|
31
|
+
* <tr>
|
|
32
|
+
* <td>Cujo</td>
|
|
33
|
+
* <td>Wolf</td>
|
|
34
|
+
* <td>Gray</td>
|
|
35
|
+
* </tr>
|
|
36
|
+
* </tbody>
|
|
37
|
+
* </table>
|
|
38
|
+
* ```
|
|
39
|
+
* This example applies the TinyWidgets table style to existing table markup.
|
|
40
|
+
* @icon Lucide.Shapes
|
|
41
|
+
*/
|
|
42
|
+
export const classes = {table};
|
package/src/css/code.css.ts
CHANGED
|
@@ -54,9 +54,6 @@ import {createTheme, createThemeContract} from '@vanilla-extract/css';
|
|
|
54
54
|
* @icon Lucide.Palette
|
|
55
55
|
*/
|
|
56
56
|
export const code = createThemeContract({
|
|
57
|
-
'mono-1': null,
|
|
58
|
-
'mono-2': null,
|
|
59
|
-
'mono-3': null,
|
|
60
57
|
'hue-1': null,
|
|
61
58
|
'hue-2': null,
|
|
62
59
|
'hue-3': null,
|
|
@@ -65,17 +62,17 @@ export const code = createThemeContract({
|
|
|
65
62
|
'hue-5-2': null,
|
|
66
63
|
'hue-6': null,
|
|
67
64
|
'hue-6-2': null,
|
|
68
|
-
'
|
|
65
|
+
'mono-1': null,
|
|
66
|
+
'mono-2': null,
|
|
67
|
+
'mono-3': null,
|
|
68
|
+
'syntax-accent': null,
|
|
69
69
|
'syntax-bg': null,
|
|
70
|
-
'syntax-
|
|
70
|
+
'syntax-fg': null,
|
|
71
71
|
'syntax-guide': null,
|
|
72
|
-
'syntax-
|
|
72
|
+
'syntax-gutter': null,
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
export const codeLight = createTheme(code, {
|
|
76
|
-
'mono-1': `hsl(230, 8%, 24%)`,
|
|
77
|
-
'mono-2': `hsl(230, 6%, 44%)`,
|
|
78
|
-
'mono-3': `hsl(230, 4%, 64%)`,
|
|
79
76
|
'hue-1': `hsl(198, 99%, 37%)`,
|
|
80
77
|
'hue-2': `hsl(221, 87%, 60%)`,
|
|
81
78
|
'hue-3': `hsl(301, 63%, 40%)`,
|
|
@@ -84,17 +81,17 @@ export const codeLight = createTheme(code, {
|
|
|
84
81
|
'hue-5-2': `hsl(344, 84%, 43%)`,
|
|
85
82
|
'hue-6': `hsl(35, 99%, 36%)`,
|
|
86
83
|
'hue-6-2': `hsl(35, 99%, 40%)`,
|
|
87
|
-
'
|
|
84
|
+
'mono-1': `hsl(230, 8%, 24%)`,
|
|
85
|
+
'mono-2': `hsl(230, 6%, 44%)`,
|
|
86
|
+
'mono-3': `hsl(230, 4%, 64%)`,
|
|
87
|
+
'syntax-accent': `hsl(230, 100%, 66%)`,
|
|
88
88
|
'syntax-bg': `hsl(230, 1%, 98%)`,
|
|
89
|
-
'syntax-
|
|
89
|
+
'syntax-fg': `hsl(230, 8%, 24%)`,
|
|
90
90
|
'syntax-guide': `hsla(230, 8%, 24%, 0.2)`,
|
|
91
|
-
'syntax-
|
|
91
|
+
'syntax-gutter': `hsl(230, 1%, 62%)`,
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
export const codeDark = createTheme(code, {
|
|
95
|
-
'mono-1': `hsl(220, 14%, 71%)`,
|
|
96
|
-
'mono-2': `hsl(220, 9%, 55%)`,
|
|
97
|
-
'mono-3': `hsl(220, 10%, 40%)`,
|
|
98
95
|
'hue-1': `hsl(187, 47%, 55%)`,
|
|
99
96
|
'hue-2': `hsl(207, 82%, 66%)`,
|
|
100
97
|
'hue-3': `hsl(286, 60%, 67%)`,
|
|
@@ -103,9 +100,12 @@ export const codeDark = createTheme(code, {
|
|
|
103
100
|
'hue-5-2': `hsl(5, 48%, 51%)`,
|
|
104
101
|
'hue-6': `hsl(29, 54%, 61%)`,
|
|
105
102
|
'hue-6-2': `hsl(39, 67%, 69%)`,
|
|
106
|
-
'
|
|
103
|
+
'mono-1': `hsl(220, 14%, 71%)`,
|
|
104
|
+
'mono-2': `hsl(220, 9%, 55%)`,
|
|
105
|
+
'mono-3': `hsl(220, 10%, 40%)`,
|
|
106
|
+
'syntax-accent': `hsl(220, 100%, 66%)`,
|
|
107
107
|
'syntax-bg': `hsl(220, 13%, 18%)`,
|
|
108
|
-
'syntax-
|
|
108
|
+
'syntax-fg': `hsl(220, 14%, 71%)`,
|
|
109
109
|
'syntax-guide': `hsla(220, 14%, 71%, 0.15)`,
|
|
110
|
-
'syntax-
|
|
110
|
+
'syntax-gutter': `hsl(220, 14%, 45%)`,
|
|
111
111
|
});
|
package/src/css/colors.css.ts
CHANGED
|
@@ -66,53 +66,53 @@ import {
|
|
|
66
66
|
* @icon Lucide.Palette
|
|
67
67
|
*/
|
|
68
68
|
export const colors = createThemeContract({
|
|
69
|
-
accentHue: null,
|
|
70
|
-
backgroundHue: null,
|
|
71
69
|
accent: null,
|
|
72
|
-
accentLight: null,
|
|
73
|
-
accentHover: null,
|
|
74
|
-
accentContrast: null,
|
|
75
70
|
accentBright: null,
|
|
71
|
+
accentContrast: null,
|
|
72
|
+
accentHover: null,
|
|
73
|
+
accentHue: null,
|
|
74
|
+
accentLight: null,
|
|
76
75
|
background: null,
|
|
77
76
|
background2: null,
|
|
77
|
+
backgroundExtreme: null,
|
|
78
78
|
backgroundHaze: null,
|
|
79
79
|
backgroundHover: null,
|
|
80
|
-
|
|
80
|
+
backgroundHue: null,
|
|
81
|
+
border: null,
|
|
82
|
+
borderColor: null,
|
|
81
83
|
foreground: null,
|
|
82
84
|
foregroundBright: null,
|
|
83
85
|
foregroundDim: null,
|
|
84
86
|
foregroundExtreme: null,
|
|
85
|
-
borderColor: null,
|
|
86
|
-
border: null,
|
|
87
87
|
shadow: null,
|
|
88
88
|
});
|
|
89
89
|
|
|
90
90
|
const common = {
|
|
91
|
+
accent: `oklch(50% .11 ${colors.accentHue})`,
|
|
92
|
+
accentBright: `oklch(57.37% 0.2178 ${colors.accentHue})`,
|
|
93
|
+
accentContrast: '#fff',
|
|
94
|
+
accentHover: `oklch(45% .1 ${colors.accentHue})`,
|
|
91
95
|
accentHue: fallbackVar('var(--tinyWidgets-accentHue)', '8'),
|
|
96
|
+
accentLight: `oklch(71% .16 ${colors.accentHue})`,
|
|
92
97
|
backgroundHue: fallbackVar(
|
|
93
98
|
'var(--tinyWidgets-backgroundHue)',
|
|
94
99
|
`calc(${colors.accentHue} + 180)`,
|
|
95
100
|
),
|
|
96
101
|
border: `1px solid ${colors.borderColor}`,
|
|
97
|
-
accent: `oklch(50% .11 ${colors.accentHue})`,
|
|
98
|
-
accentLight: `oklch(71% .16 ${colors.accentHue})`,
|
|
99
|
-
accentHover: `oklch(45% .1 ${colors.accentHue})`,
|
|
100
|
-
accentBright: `oklch(57.37% 0.2178 ${colors.accentHue})`,
|
|
101
|
-
accentContrast: '#fff',
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
export const colorsLight = createTheme(colors, {
|
|
105
105
|
...common,
|
|
106
106
|
background: `oklch(99% .01 ${colors.backgroundHue})`,
|
|
107
107
|
background2: `oklch(95% .01 ${colors.backgroundHue})`,
|
|
108
|
+
backgroundExtreme: '#fff',
|
|
108
109
|
backgroundHaze: `oklch(99% .01 ${colors.backgroundHue} / .5)`,
|
|
109
110
|
backgroundHover: `oklch(90% .01 ${colors.backgroundHue})`,
|
|
110
|
-
|
|
111
|
+
borderColor: `oklch(90% .01 ${colors.backgroundHue})`,
|
|
111
112
|
foreground: `oklch(50% .01 ${colors.accentHue})`,
|
|
112
113
|
foregroundBright: `oklch(10% .01 ${colors.accentHue})`,
|
|
113
114
|
foregroundDim: `oklch(60% .01 ${colors.accentHue})`,
|
|
114
115
|
foregroundExtreme: '#000',
|
|
115
|
-
borderColor: `oklch(90% .01 ${colors.backgroundHue})`,
|
|
116
116
|
shadow: '0 1px 4px 0 hsl(0 0 20 / .1)',
|
|
117
117
|
});
|
|
118
118
|
globalStyle(`html:has(${colorsLight})`, {
|
|
@@ -123,14 +123,14 @@ export const colorsDark = createTheme(colors, {
|
|
|
123
123
|
...common,
|
|
124
124
|
background: `oklch(20% .01 ${colors.backgroundHue})`,
|
|
125
125
|
background2: `oklch(15% .01 ${colors.backgroundHue})`,
|
|
126
|
+
backgroundExtreme: '#000',
|
|
126
127
|
backgroundHaze: `oklch(21% 0% ${colors.backgroundHue} / .5)`,
|
|
127
128
|
backgroundHover: `oklch(25% .01 ${colors.backgroundHue})`,
|
|
128
|
-
|
|
129
|
+
borderColor: `oklch(30% .01 ${colors.backgroundHue})`,
|
|
129
130
|
foreground: `oklch(85% .01 ${colors.accentHue})`,
|
|
130
131
|
foregroundBright: `oklch(95% .01 ${colors.accentHue})`,
|
|
131
132
|
foregroundDim: `oklch(60% .01 ${colors.accentHue})`,
|
|
132
133
|
foregroundExtreme: '#fff',
|
|
133
|
-
borderColor: `oklch(30% .01 ${colors.backgroundHue})`,
|
|
134
134
|
shadow: '0 1px 4px 0 #000',
|
|
135
135
|
});
|
|
136
136
|
globalStyle(`html:has(${colorsDark})`, {
|