Skip to content

Commit 8dece67

Browse files
committed
fix(themes): add theme types #51
1 parent b2b550e commit 8dece67

File tree

9 files changed

+28
-20
lines changed

9 files changed

+28
-20
lines changed

.storybook/stories/Themes/Libraries/chakra-ui/editable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ import * as React from 'react';
102102
103103
import { CompactTable } from '@table-library/react-table-library/compact';
104104
import { useTheme } from '@table-library/react-table-library/theme';
105-
import { DEFAULT_OPTIONS, getTheme } from '@table-library/react-table-library/themes/chakra';
105+
import { DEFAULT_OPTIONS, getTheme } from '@table-library/react-table-library/chakra';
106106
107107
import { DocumentationSee } from '../../../documentation';
108108
import { nodes } from '../../../data';

.storybook/stories/Themes/Libraries/material-ui/editable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ import * as React from 'react';
102102
103103
import { CompactTable } from '@table-library/react-table-library/compact';
104104
import { useTheme } from '@table-library/react-table-library/theme';
105-
import { DEFAULT_OPTIONS, getTheme } from '@table-library/react-table-library/themes/material';
105+
import { DEFAULT_OPTIONS, getTheme } from '@table-library/react-table-library/material';
106106
107107
import { DocumentationSee } from '../../../documentation';
108108
import { nodes } from '../../../data';

babel.config.cjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ module.exports = {
1919
'@table-library/react-table-library/tree': './src/tree',
2020
'@table-library/react-table-library/pagination': './src/pagination',
2121
// themes
22-
'@table-library/react-table-library/baseline': './src/themes/baseline',
23-
'@table-library/react-table-library/mantine': './src/themes/mantine',
24-
'@table-library/react-table-library/chakra-ui': './src/themes/chakra-ui',
25-
'@table-library/react-table-library/material-ui': './src/themes/material-ui',
22+
'@table-library/react-table-library/baseline': './src/baseline',
23+
'@table-library/react-table-library/mantine': './src/mantine',
24+
'@table-library/react-table-library/chakra-ui': './src/chakra-ui',
25+
'@table-library/react-table-library/material-ui': './src/material-ui',
2626
},
2727
},
2828
],

rollup.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ export default {
3333
tree: './src/tree/index.ts',
3434
pagination: './src/pagination/index.ts',
3535
// themes
36-
baseline: './src/themes/baseline/index.ts',
37-
mantine: './src/themes/mantine/index.ts',
38-
['chakra-ui']: './src/themes/chakra-ui/index.ts',
39-
['material-ui']: './src/themes/material-ui/index.ts',
36+
baseline: './src/baseline/index.ts',
37+
mantine: './src/mantine/index.ts',
38+
['chakra-ui']: './src/chakra-ui/index.ts',
39+
['material-ui']: './src/material-ui/index.ts',
4040
},
4141
output: [
4242
// ES module version, for modern browsers

src/themes/baseline/index.ts renamed to src/baseline/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import * as COLORS from '@table-library/react-table-library/common/colors';
22
import { zipThemes } from '@table-library/react-table-library/theme/index';
33

4+
import { Theme } from '@table-library/react-table-library/types/theme';
5+
46
const GUTTER = 6;
57

68
const BASELINE_THEME = {
@@ -74,6 +76,6 @@ const BASELINE_THEME = {
7476
Cell: '',
7577
};
7678

77-
export const getTheme = () => {
79+
export const getTheme = (): Theme => {
7880
return zipThemes([BASELINE_THEME]);
7981
};

src/themes/chakra-ui/index.ts renamed to src/chakra-ui/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { zipThemes } from '@table-library/react-table-library/theme/index';
22

3+
import { Theme } from '@table-library/react-table-library/types/theme';
4+
35
type Configuration = {
46
isVirtualized?: boolean;
57
};
@@ -134,7 +136,7 @@ export const DEFAULT_CONFIGURATION = {
134136
isVirtualized: false,
135137
};
136138

137-
export const getTheme = (options?: Options, configuration?: Configuration) => {
139+
export const getTheme = (options?: Options, configuration?: Configuration): Theme => {
138140
const mergedOptions = {
139141
...DEFAULT_OPTIONS,
140142
...(options ? options : {}),

src/themes/mantine/index.ts renamed to src/mantine/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { zipThemes } from '@table-library/react-table-library/theme/index';
22

3+
import { Theme } from '@table-library/react-table-library/types/theme';
4+
35
type Configuration = {
46
isVirtualized?: boolean;
57
};
@@ -139,18 +141,18 @@ const getZipTheme = (options: OptionsSound, configuration: ConfigurationSound) =
139141
return zipThemes([commonTheme, specificTheme]);
140142
};
141143

142-
export const DEFAULT_OPTIONS = {
144+
export const DEFAULT_OPTIONS: OptionsSound = {
143145
horizontalSpacing: 10,
144146
verticalSpacing: 10,
145147
striped: false,
146148
highlightOnHover: false,
147149
};
148150

149-
export const DEFAULT_CONFIGURATION = {
151+
export const DEFAULT_CONFIGURATION: ConfigurationSound = {
150152
isVirtualized: false,
151153
};
152154

153-
export const getTheme = (options?: Options, configuration?: Configuration) => {
155+
export const getTheme = (options?: Options, configuration?: Configuration): Theme => {
154156
const mergedOptions = {
155157
...DEFAULT_OPTIONS,
156158
...(options ? options : {}),

src/themes/material-ui/index.ts renamed to src/material-ui/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { zipThemes } from '@table-library/react-table-library/theme/index';
22

3+
import { Theme } from '@table-library/react-table-library/types/theme';
4+
35
type Configuration = {
46
isVirtualized?: boolean;
57
};
@@ -153,7 +155,7 @@ export const DEFAULT_CONFIGURATION = {
153155
isVirtualized: false,
154156
};
155157

156-
export const getTheme = (options?: Options, configuration?: Configuration) => {
158+
export const getTheme = (options?: Options, configuration?: Configuration): Theme => {
157159
const mergedOptions = {
158160
...DEFAULT_OPTIONS,
159161
...(options ? options : {}),

tsconfig.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
"@table-library/react-table-library/tree/*": ["./src/tree/*"],
1616
"@table-library/react-table-library/pagination/*": ["./src/pagination/*"],
1717
// themes
18-
"@table-library/react-table-library/baseline/*": ["./src/themes/baseline/*"],
19-
"@table-library/react-table-library/mantine/*": ["./src/themes/mantine/*"],
20-
"@table-library/react-table-library/chakra-ui/*": ["./src/themes/chakra-ui/*"],
21-
"@table-library/react-table-library/material-ui/*": ["./src/themes/material-ui/*"],
18+
"@table-library/react-table-library/baseline/*": ["./src/baseline/*"],
19+
"@table-library/react-table-library/mantine/*": ["./src/mantine/*"],
20+
"@table-library/react-table-library/chakra-ui/*": ["./src/chakra-ui/*"],
21+
"@table-library/react-table-library/material-ui/*": ["./src/material-ui/*"],
2222
},
2323
"allowJs": true,
2424
"skipLibCheck": true,

0 commit comments

Comments
 (0)