tailwind-preset-mantine 1.1.0 → 1.2.1
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/index.d.ts +8 -2
- package/src/index.js +30 -18
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
MantineBreakpointsValues,
|
|
3
|
+
MantineThemeColorsOverride,
|
|
4
|
+
} from "@mantine/core";
|
|
2
5
|
import type { Config } from "tailwindcss";
|
|
3
6
|
|
|
4
7
|
declare function tailwindPresetMantine(
|
|
5
|
-
options?: Partial<{
|
|
8
|
+
options?: Partial<{
|
|
9
|
+
mantineColors: MantineThemeColorsOverride;
|
|
10
|
+
mantineBreakpoints: Partial<MantineBreakpointsValues>;
|
|
11
|
+
}>,
|
|
6
12
|
): Config;
|
|
7
13
|
|
|
8
14
|
export = tailwindPresetMantine;
|
package/src/index.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @typedef {import('@mantine/core').MantineThemeColorsOverride} MantineThemeColorsOverride
|
|
5
|
+
* @typedef {import('@mantine/core').MantineBreakpointsValues} MantineBreakpointsValues
|
|
5
6
|
* @typedef {import('tailwindcss').Config} TailwindConfig
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
|
-
const { DEFAULT_THEME } = require("@mantine/core");
|
|
9
|
+
const { DEFAULT_THEME, mergeMantineTheme } = require("@mantine/core");
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @example
|
|
@@ -34,10 +35,21 @@ const { DEFAULT_THEME } = require("@mantine/core");
|
|
|
34
35
|
* presets: [tailwindPresetMantine({ mantineColors: mantineTheme.colors })],
|
|
35
36
|
* };
|
|
36
37
|
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param {Object} options
|
|
40
|
+
* @param {MantineThemeColorsOverride} [options.mantineColors=DEFAULT_THEME.colors]
|
|
41
|
+
* @param {Partial<MantineBreakpointsValues>} [options.mantineBreakpoints=DEFAULT_THEME.breakpoints]
|
|
37
42
|
*/
|
|
38
43
|
module.exports = function tailwindPresetMantine({
|
|
39
44
|
mantineColors = DEFAULT_THEME.colors,
|
|
45
|
+
mantineBreakpoints = DEFAULT_THEME.breakpoints,
|
|
40
46
|
} = {}) {
|
|
47
|
+
const { colors: mergedMantineColors, breakpoints: mergedMantineBreakpoints } =
|
|
48
|
+
mergeMantineTheme(DEFAULT_THEME, {
|
|
49
|
+
colors: mantineColors,
|
|
50
|
+
breakpoints: mantineBreakpoints,
|
|
51
|
+
});
|
|
52
|
+
|
|
41
53
|
/**
|
|
42
54
|
* @type {TailwindConfig}
|
|
43
55
|
*/
|
|
@@ -47,11 +59,11 @@ module.exports = function tailwindPresetMantine({
|
|
|
47
59
|
theme: {
|
|
48
60
|
extend: {
|
|
49
61
|
screens: {
|
|
50
|
-
xs:
|
|
51
|
-
sm:
|
|
52
|
-
md:
|
|
53
|
-
lg:
|
|
54
|
-
xl:
|
|
62
|
+
xs: mergedMantineBreakpoints.xs,
|
|
63
|
+
sm: mergedMantineBreakpoints.sm,
|
|
64
|
+
md: mergedMantineBreakpoints.md,
|
|
65
|
+
lg: mergedMantineBreakpoints.lg,
|
|
66
|
+
xl: mergedMantineBreakpoints.xl,
|
|
55
67
|
},
|
|
56
68
|
fontFamily: {
|
|
57
69
|
DEFAULT: ["var(--mantine-font-family)"],
|
|
@@ -120,44 +132,44 @@ module.exports = function tailwindPresetMantine({
|
|
|
120
132
|
DEFAULT: "var(--mantine-radius-default)",
|
|
121
133
|
},
|
|
122
134
|
colors: {
|
|
123
|
-
...generateColors(
|
|
135
|
+
...generateColors(mergedMantineColors),
|
|
124
136
|
...generatePrimaryColors(),
|
|
125
|
-
...generateVariantSpecificColors(
|
|
137
|
+
...generateVariantSpecificColors(mergedMantineColors),
|
|
126
138
|
...generateVariantSpecificPrimaryColors(),
|
|
127
139
|
...generateOtherTextColors(),
|
|
128
140
|
},
|
|
129
141
|
backgroundColor: {
|
|
130
|
-
...generateColors(
|
|
142
|
+
...generateColors(mergedMantineColors),
|
|
131
143
|
...generatePrimaryColors(),
|
|
132
|
-
...generateVariantSpecificColors(
|
|
144
|
+
...generateVariantSpecificColors(mergedMantineColors),
|
|
133
145
|
...generateVariantSpecificPrimaryColors(),
|
|
134
146
|
...generateOtherBackgroundColors(),
|
|
135
147
|
},
|
|
136
148
|
placeholderColor: {
|
|
137
|
-
...generateColors(
|
|
149
|
+
...generateColors(mergedMantineColors),
|
|
138
150
|
...generatePrimaryColors(),
|
|
139
|
-
...generateVariantSpecificColors(
|
|
151
|
+
...generateVariantSpecificColors(mergedMantineColors),
|
|
140
152
|
...generateVariantSpecificPrimaryColors(),
|
|
141
153
|
...generateOtherTextColors(),
|
|
142
154
|
},
|
|
143
155
|
ringColor: {
|
|
144
|
-
...generateColors(
|
|
156
|
+
...generateColors(mergedMantineColors),
|
|
145
157
|
...generatePrimaryColors(),
|
|
146
|
-
...generateVariantSpecificColors(
|
|
158
|
+
...generateVariantSpecificColors(mergedMantineColors),
|
|
147
159
|
...generateVariantSpecificPrimaryColors(),
|
|
148
160
|
...generateOtherBorderColors(),
|
|
149
161
|
},
|
|
150
162
|
divideColor: {
|
|
151
|
-
...generateColors(
|
|
163
|
+
...generateColors(mergedMantineColors),
|
|
152
164
|
...generatePrimaryColors(),
|
|
153
|
-
...generateVariantSpecificColors(
|
|
165
|
+
...generateVariantSpecificColors(mergedMantineColors),
|
|
154
166
|
...generateVariantSpecificPrimaryColors(),
|
|
155
167
|
...generateOtherBorderColors(),
|
|
156
168
|
},
|
|
157
169
|
borderColor: {
|
|
158
|
-
...generateColors(
|
|
170
|
+
...generateColors(mergedMantineColors),
|
|
159
171
|
...generatePrimaryColors(),
|
|
160
|
-
...generateVariantSpecificColors(
|
|
172
|
+
...generateVariantSpecificColors(mergedMantineColors),
|
|
161
173
|
...generateVariantSpecificPrimaryColors(),
|
|
162
174
|
...generateOtherBorderColors(),
|
|
163
175
|
},
|