@basic-ui/material 1.0.0-alpha.46 → 1.0.0-alpha.48

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basic-ui/material",
3
- "version": "1.0.0-alpha.46",
3
+ "version": "1.0.0-alpha.48",
4
4
  "description": "Accessible React Components used as building blocks for UI patterns",
5
5
  "author": "Lucas Terra <lucasterra7@gmail.com>",
6
6
  "license": "MIT",
@@ -62,5 +62,5 @@
62
62
  "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0",
63
63
  "tailwindcss": "^3.0.0"
64
64
  },
65
- "gitHead": "006bc0e1e68809669136f96dc66f2e591bffbfb7"
65
+ "gitHead": "38fd099ab13b9ce7a4df02e9bc634a858cf1782a"
66
66
  }
@@ -1,227 +1,227 @@
1
- import { Table, TableRow, TableBody, TableHead, TableCell } from './';
2
- import { Link } from '../Link';
3
-
4
- export default {
5
- title: 'components/Table',
6
- };
7
-
8
- const data = {
9
- items: [
10
- {
11
- full_name: 'facebook/react',
12
- url: 'https://github.com/facebook/react',
13
- owner: 'facebook',
14
- stargazers_count: 151659,
15
- },
16
- {
17
- full_name: 'duxianwei520/react',
18
- url: 'https://github.com/duxianwei520/react',
19
- owner: 'duxianwei520',
20
- stargazers_count: 3724,
21
- },
22
- {
23
- full_name: 'discountry/react',
24
- url: 'https://github.com/discountry/react',
25
- owner: 'discountry',
26
- stargazers_count: 946,
27
- },
28
- {
29
- full_name: 'Cathy0807/react',
30
- url: 'https://github.com/Cathy0807/react',
31
- owner: 'Cathy0807',
32
- stargazers_count: 653,
33
- },
34
- {
35
- full_name: 'react-redux-antd-es6/react',
36
- url: 'https://github.com/react-redux-antd-es6/react',
37
- owner: 'react-redux-antd-es6',
38
- stargazers_count: 721,
39
- },
40
- {
41
- full_name: 'HackYourFuture/React',
42
- url: 'https://github.com/HackYourFuture/React',
43
- owner: 'HackYourFuture',
44
- stargazers_count: 82,
45
- },
46
- {
47
- full_name: 'ReactiveCocoa/ReactiveCocoa',
48
- url: 'https://github.com/ReactiveCocoa/ReactiveCocoa',
49
- owner: 'ReactiveCocoa',
50
- stargazers_count: 19837,
51
- },
52
- {
53
- full_name: 'facebook/react-native',
54
- url: 'https://github.com/facebook/react-native',
55
- owner: 'facebook',
56
- stargazers_count: 88492,
57
- },
58
- {
59
- full_name: 'vercel/next.js',
60
- url: 'https://github.com/vercel/next.js',
61
- owner: 'vercel',
62
- stargazers_count: 50396,
63
- },
64
- {
65
- full_name: 'ReactTraining/react-router',
66
- url: 'https://github.com/ReactTraining/react-router',
67
- owner: 'ReactTraining',
68
- stargazers_count: 41060,
69
- },
70
- {
71
- full_name: 'azat-co/react',
72
- url: 'https://github.com/azat-co/react',
73
- owner: 'azat-co',
74
- stargazers_count: 209,
75
- },
76
- {
77
- full_name: 'facebook/create-react-app',
78
- url: 'https://github.com/facebook/create-react-app',
79
- owner: 'facebook',
80
- stargazers_count: 80029,
81
- },
82
- {
83
- full_name: 'zeit-ui/react',
84
- url: 'https://github.com/zeit-ui/react',
85
- owner: 'zeit-ui',
86
- stargazers_count: 723,
87
- },
88
- {
89
- full_name: 'ui-router/react',
90
- url: 'https://github.com/ui-router/react',
91
- owner: 'ui-router',
92
- stargazers_count: 366,
93
- },
94
- {
95
- full_name: 'omergulcicek/react',
96
- url: 'https://github.com/omergulcicek/react',
97
- owner: 'omergulcicek',
98
- stargazers_count: 379,
99
- },
100
- {
101
- full_name: 'werein/react',
102
- url: 'https://github.com/werein/react',
103
- owner: 'werein',
104
- stargazers_count: 240,
105
- },
106
- {
107
- full_name: 'enaqx/awesome-react',
108
- url: 'https://github.com/enaqx/awesome-react',
109
- owner: 'enaqx',
110
- stargazers_count: 37589,
111
- },
112
- {
113
- full_name: 'react-boilerplate/react-boilerplate',
114
- url: 'https://github.com/react-boilerplate/react-boilerplate',
115
- owner: 'react-boilerplate',
116
- stargazers_count: 25818,
117
- },
118
- {
119
- full_name: 'ruanyf/react-demos',
120
- url: 'https://github.com/ruanyf/react-demos',
121
- owner: 'ruanyf',
122
- stargazers_count: 15179,
123
- },
124
- {
125
- full_name: 'reactiveui/ReactiveUI',
126
- url: 'https://github.com/reactiveui/ReactiveUI',
127
- owner: 'reactiveui',
128
- stargazers_count: 5572,
129
- },
130
- {
131
- full_name: 'zf-huangxiao/react',
132
- url: 'https://github.com/zf-huangxiao/react',
133
- owner: 'zf-huangxiao',
134
- stargazers_count: 44,
135
- },
136
- {
137
- full_name: 'kdchang/reactjs101',
138
- url: 'https://github.com/kdchang/reactjs101',
139
- owner: 'kdchang',
140
- stargazers_count: 3667,
141
- },
142
- {
143
- full_name: 'davezuko/react-redux-starter-kit',
144
- url: 'https://github.com/davezuko/react-redux-starter-kit',
145
- owner: 'davezuko',
146
- stargazers_count: 10408,
147
- },
148
- {
149
- full_name: 'react-navigation/react-navigation',
150
- url: 'https://github.com/react-navigation/react-navigation',
151
- owner: 'react-navigation',
152
- stargazers_count: 18391,
153
- },
154
- {
155
- full_name: 'JedWatson/react-select',
156
- url: 'https://github.com/JedWatson/react-select',
157
- owner: 'JedWatson',
158
- stargazers_count: 20403,
159
- },
160
- {
161
- full_name: 'reactjs/reactjs.org',
162
- url: 'https://github.com/reactjs/reactjs.org',
163
- owner: 'reactjs',
164
- stargazers_count: 4732,
165
- },
166
- {
167
- full_name: 'leilihuang/React',
168
- url: 'https://github.com/leilihuang/React',
169
- owner: 'leilihuang',
170
- stargazers_count: 137,
171
- },
172
- {
173
- full_name: 'reactioncommerce/reaction',
174
- url: 'https://github.com/reactioncommerce/reaction',
175
- owner: 'reactioncommerce',
176
- stargazers_count: 10340,
177
- },
178
- {
179
- full_name: 'streamich/react-use',
180
- url: 'https://github.com/streamich/react-use',
181
- owner: 'streamich',
182
- stargazers_count: 13742,
183
- },
184
- {
185
- full_name: 'StephenGrider/ReactNativeReduxCasts',
186
- url: 'https://github.com/StephenGrider/ReactNativeReduxCasts',
187
- owner: 'StephenGrider',
188
- stargazers_count: 2591,
189
- },
190
- ],
191
- total_count: 1456586,
192
- };
193
-
194
- const GitHubTable = () => {
195
- const widths = ['45%', '35%', '20%'];
196
-
197
- return (
198
- <Table>
199
- <TableHead>
200
- <TableRow>
201
- <TableCell width={widths[0]}>Name</TableCell>
202
- <TableCell width={widths[1]}>Owner</TableCell>
203
- <TableCell width={widths[2]} textAlign="right">
204
- Star count
205
- </TableCell>
206
- </TableRow>
207
- </TableHead>
208
- <TableBody>
209
- {data.items.map((item) => (
210
- <TableRow key={item.full_name}>
211
- <TableCell width={widths[0]}>
212
- <Link href={item.url} target="_blank" rel="noopener noreferrer">
213
- {item.full_name}
214
- </Link>
215
- </TableCell>
216
- <TableCell width={widths[1]}>{item.owner}</TableCell>
217
- <TableCell width={widths[2]} textAlign="right">
218
- {item.stargazers_count} stars
219
- </TableCell>
220
- </TableRow>
221
- ))}
222
- </TableBody>
223
- </Table>
224
- );
225
- };
226
-
227
- export const Example = () => <GitHubTable />;
1
+ import { Table, TableRow, TableBody, TableHead, TableCell } from './';
2
+ import { Link } from '../Link';
3
+
4
+ export default {
5
+ title: 'components/Table',
6
+ };
7
+
8
+ const data = {
9
+ items: [
10
+ {
11
+ full_name: 'facebook/react',
12
+ url: 'https://github.com/facebook/react',
13
+ owner: 'facebook',
14
+ stargazers_count: 151659,
15
+ },
16
+ {
17
+ full_name: 'duxianwei520/react',
18
+ url: 'https://github.com/duxianwei520/react',
19
+ owner: 'duxianwei520',
20
+ stargazers_count: 3724,
21
+ },
22
+ {
23
+ full_name: 'discountry/react',
24
+ url: 'https://github.com/discountry/react',
25
+ owner: 'discountry',
26
+ stargazers_count: 946,
27
+ },
28
+ {
29
+ full_name: 'Cathy0807/react',
30
+ url: 'https://github.com/Cathy0807/react',
31
+ owner: 'Cathy0807',
32
+ stargazers_count: 653,
33
+ },
34
+ {
35
+ full_name: 'react-redux-antd-es6/react',
36
+ url: 'https://github.com/react-redux-antd-es6/react',
37
+ owner: 'react-redux-antd-es6',
38
+ stargazers_count: 721,
39
+ },
40
+ {
41
+ full_name: 'HackYourFuture/React',
42
+ url: 'https://github.com/HackYourFuture/React',
43
+ owner: 'HackYourFuture',
44
+ stargazers_count: 82,
45
+ },
46
+ {
47
+ full_name: 'ReactiveCocoa/ReactiveCocoa',
48
+ url: 'https://github.com/ReactiveCocoa/ReactiveCocoa',
49
+ owner: 'ReactiveCocoa',
50
+ stargazers_count: 19837,
51
+ },
52
+ {
53
+ full_name: 'facebook/react-native',
54
+ url: 'https://github.com/facebook/react-native',
55
+ owner: 'facebook',
56
+ stargazers_count: 88492,
57
+ },
58
+ {
59
+ full_name: 'vercel/next.js',
60
+ url: 'https://github.com/vercel/next.js',
61
+ owner: 'vercel',
62
+ stargazers_count: 50396,
63
+ },
64
+ {
65
+ full_name: 'ReactTraining/react-router',
66
+ url: 'https://github.com/ReactTraining/react-router',
67
+ owner: 'ReactTraining',
68
+ stargazers_count: 41060,
69
+ },
70
+ {
71
+ full_name: 'azat-co/react',
72
+ url: 'https://github.com/azat-co/react',
73
+ owner: 'azat-co',
74
+ stargazers_count: 209,
75
+ },
76
+ {
77
+ full_name: 'facebook/create-react-app',
78
+ url: 'https://github.com/facebook/create-react-app',
79
+ owner: 'facebook',
80
+ stargazers_count: 80029,
81
+ },
82
+ {
83
+ full_name: 'zeit-ui/react',
84
+ url: 'https://github.com/zeit-ui/react',
85
+ owner: 'zeit-ui',
86
+ stargazers_count: 723,
87
+ },
88
+ {
89
+ full_name: 'ui-router/react',
90
+ url: 'https://github.com/ui-router/react',
91
+ owner: 'ui-router',
92
+ stargazers_count: 366,
93
+ },
94
+ {
95
+ full_name: 'omergulcicek/react',
96
+ url: 'https://github.com/omergulcicek/react',
97
+ owner: 'omergulcicek',
98
+ stargazers_count: 379,
99
+ },
100
+ {
101
+ full_name: 'werein/react',
102
+ url: 'https://github.com/werein/react',
103
+ owner: 'werein',
104
+ stargazers_count: 240,
105
+ },
106
+ {
107
+ full_name: 'enaqx/awesome-react',
108
+ url: 'https://github.com/enaqx/awesome-react',
109
+ owner: 'enaqx',
110
+ stargazers_count: 37589,
111
+ },
112
+ {
113
+ full_name: 'react-boilerplate/react-boilerplate',
114
+ url: 'https://github.com/react-boilerplate/react-boilerplate',
115
+ owner: 'react-boilerplate',
116
+ stargazers_count: 25818,
117
+ },
118
+ {
119
+ full_name: 'ruanyf/react-demos',
120
+ url: 'https://github.com/ruanyf/react-demos',
121
+ owner: 'ruanyf',
122
+ stargazers_count: 15179,
123
+ },
124
+ {
125
+ full_name: 'reactiveui/ReactiveUI',
126
+ url: 'https://github.com/reactiveui/ReactiveUI',
127
+ owner: 'reactiveui',
128
+ stargazers_count: 5572,
129
+ },
130
+ {
131
+ full_name: 'zf-huangxiao/react',
132
+ url: 'https://github.com/zf-huangxiao/react',
133
+ owner: 'zf-huangxiao',
134
+ stargazers_count: 44,
135
+ },
136
+ {
137
+ full_name: 'kdchang/reactjs101',
138
+ url: 'https://github.com/kdchang/reactjs101',
139
+ owner: 'kdchang',
140
+ stargazers_count: 3667,
141
+ },
142
+ {
143
+ full_name: 'davezuko/react-redux-starter-kit',
144
+ url: 'https://github.com/davezuko/react-redux-starter-kit',
145
+ owner: 'davezuko',
146
+ stargazers_count: 10408,
147
+ },
148
+ {
149
+ full_name: 'react-navigation/react-navigation',
150
+ url: 'https://github.com/react-navigation/react-navigation',
151
+ owner: 'react-navigation',
152
+ stargazers_count: 18391,
153
+ },
154
+ {
155
+ full_name: 'JedWatson/react-select',
156
+ url: 'https://github.com/JedWatson/react-select',
157
+ owner: 'JedWatson',
158
+ stargazers_count: 20403,
159
+ },
160
+ {
161
+ full_name: 'reactjs/reactjs.org',
162
+ url: 'https://github.com/reactjs/reactjs.org',
163
+ owner: 'reactjs',
164
+ stargazers_count: 4732,
165
+ },
166
+ {
167
+ full_name: 'leilihuang/React',
168
+ url: 'https://github.com/leilihuang/React',
169
+ owner: 'leilihuang',
170
+ stargazers_count: 137,
171
+ },
172
+ {
173
+ full_name: 'reactioncommerce/reaction',
174
+ url: 'https://github.com/reactioncommerce/reaction',
175
+ owner: 'reactioncommerce',
176
+ stargazers_count: 10340,
177
+ },
178
+ {
179
+ full_name: 'streamich/react-use',
180
+ url: 'https://github.com/streamich/react-use',
181
+ owner: 'streamich',
182
+ stargazers_count: 13742,
183
+ },
184
+ {
185
+ full_name: 'StephenGrider/ReactNativeReduxCasts',
186
+ url: 'https://github.com/StephenGrider/ReactNativeReduxCasts',
187
+ owner: 'StephenGrider',
188
+ stargazers_count: 2591,
189
+ },
190
+ ],
191
+ total_count: 1456586,
192
+ };
193
+
194
+ const GitHubTable = () => {
195
+ const widths = ['45%', '35%', '20%'];
196
+
197
+ return (
198
+ <Table>
199
+ <TableHead>
200
+ <TableRow>
201
+ <TableCell width={widths[0]}>Name</TableCell>
202
+ <TableCell width={widths[1]}>Owner</TableCell>
203
+ <TableCell width={widths[2]} textAlign="right">
204
+ Star count
205
+ </TableCell>
206
+ </TableRow>
207
+ </TableHead>
208
+ <TableBody>
209
+ {data.items.map((item) => (
210
+ <TableRow key={item.full_name}>
211
+ <TableCell width={widths[0]}>
212
+ <Link href={item.url} target="_blank" rel="noopener noreferrer">
213
+ {item.full_name}
214
+ </Link>
215
+ </TableCell>
216
+ <TableCell width={widths[1]}>{item.owner}</TableCell>
217
+ <TableCell width={widths[2]} textAlign="right">
218
+ {item.stargazers_count} stars
219
+ </TableCell>
220
+ </TableRow>
221
+ ))}
222
+ </TableBody>
223
+ </Table>
224
+ );
225
+ };
226
+
227
+ export const Example = () => <GitHubTable />;
@@ -1,34 +1,28 @@
1
- import { rem } from 'polished';
2
- import { forwardRef } from 'react';
3
-
4
- import type { PaperProps } from '../Paper';
5
- import { Paper } from '../Paper';
6
-
7
- export type TableProps = PaperProps;
8
-
9
- export const Table = forwardRef<HTMLDivElement, TableProps>((props, ref) => {
10
- const { children, elevation = 0, __css, ...rest } = props;
11
-
12
- return (
13
- <Paper
14
- ref={ref}
15
- role="table"
16
- display="flex"
17
- width="100%"
18
- flexDirection="column"
19
- elevation={elevation}
20
- darkThemeBackgroundOverlay={elevation}
21
- borderRadius="extra-large"
22
- __css={{
23
- borderColor: 'surface-variant',
24
- borderWidth: rem(2),
25
- borderStyle: 'solid',
26
- overflowX: 'auto',
27
- ...__css,
28
- }}
29
- {...rest}
30
- >
31
- {children}
32
- </Paper>
33
- );
34
- });
1
+ import { forwardRef } from 'react';
2
+
3
+ import type { PaperProps } from '../Paper';
4
+ import { Box } from '../Box';
5
+
6
+ export type TableProps = PaperProps;
7
+
8
+ export const Table = forwardRef<HTMLDivElement, TableProps>((props, ref) => {
9
+ const { children, __css, ...rest } = props;
10
+
11
+ return (
12
+ <Box
13
+ ref={ref}
14
+ role="table"
15
+ __css={{
16
+ display: 'flex',
17
+ width: '100%',
18
+ flexDirection: 'column',
19
+ borderRadius: 'small',
20
+ overflowX: 'auto',
21
+ ...__css,
22
+ }}
23
+ {...rest}
24
+ >
25
+ {children}
26
+ </Box>
27
+ );
28
+ });
@@ -1,17 +1,17 @@
1
- import { forwardRef } from 'react';
2
-
3
- import type { BoxProps } from '../Box';
4
- import { Box } from '../Box';
5
-
6
- export type TableBodyProps = BoxProps;
7
-
8
- export const TableBody = forwardRef<HTMLDivElement, TableBodyProps>(
9
- (props, ref) => {
10
- const { children, ...rest } = props;
11
- return (
12
- <Box ref={ref} role="rowgroup" {...rest}>
13
- {children}
14
- </Box>
15
- );
16
- }
17
- );
1
+ import { forwardRef } from 'react';
2
+
3
+ import type { BoxProps } from '../Box';
4
+ import { Box } from '../Box';
5
+
6
+ export type TableBodyProps = BoxProps;
7
+
8
+ export const TableBody = forwardRef<HTMLDivElement, TableBodyProps>(
9
+ (props, ref) => {
10
+ const { children, ...rest } = props;
11
+ return (
12
+ <Box ref={ref} role="rowgroup" {...rest}>
13
+ {children}
14
+ </Box>
15
+ );
16
+ }
17
+ );
@@ -1,34 +1,37 @@
1
- import { forwardRef } from 'react';
2
-
3
- import type { BoxProps } from '../Box';
4
- import { Box } from '../Box';
5
- import { useTableHeadContext } from './context';
6
-
7
- export type TableCellProps = BoxProps;
8
-
9
- export const TableCell = forwardRef<HTMLDivElement, TableCellProps>(
10
- (props, ref) => {
11
- const { children, __css, ...rest } = props;
12
- const isHeadCell = useTableHeadContext();
13
-
14
- return (
15
- <Box
16
- ref={ref}
17
- px={1}
18
- py={3}
19
- role={isHeadCell ? 'columnheader' : 'cell'}
20
- __css={{
21
- whiteSpace: 'nowrap',
22
- overflow: 'hidden',
23
- textOverflow: 'ellipsis',
24
- fontWeight: isHeadCell ? 'medium' : undefined,
25
- color: 'on.surface',
26
- ...__css,
27
- }}
28
- {...rest}
29
- >
30
- {children}
31
- </Box>
32
- );
33
- }
34
- );
1
+ import { forwardRef } from 'react';
2
+ import { rem } from 'polished';
3
+
4
+ import type { BoxProps } from '../Box';
5
+ import { Box } from '../Box';
6
+ import { useTableHeadContext } from './context';
7
+
8
+ export type TableCellProps = BoxProps;
9
+
10
+ export const TableCell = forwardRef<HTMLDivElement, TableCellProps>(
11
+ (props, ref) => {
12
+ const { children, __css, ...rest } = props;
13
+ const isHeadCell = useTableHeadContext();
14
+
15
+ return (
16
+ <Box
17
+ ref={ref}
18
+ role={isHeadCell ? 'columnheader' : 'cell'}
19
+ __css={{
20
+ px: 1,
21
+ height: rem(36),
22
+ whiteSpace: 'nowrap',
23
+ overflow: 'hidden',
24
+ textOverflow: 'ellipsis',
25
+ fontWeight: isHeadCell ? 'medium' : undefined,
26
+ color: 'on.surface',
27
+ display: 'flex',
28
+ alignItems: 'center',
29
+ ...__css,
30
+ }}
31
+ {...rest}
32
+ >
33
+ {children}
34
+ </Box>
35
+ );
36
+ }
37
+ );