@beeq/tailwindcss 1.8.0-beta.9 → 1.8.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/.babelrc +10 -0
- package/eslint.config.js +72 -0
- package/package.json +16 -25
- package/project.json +37 -0
- package/src/helpers/blend-color.ts +18 -0
- package/src/index.ts +211 -0
- package/src/plugins/color-mix.ts +64 -0
- package/src/plugins/logical-properties.ts +84 -0
- package/src/theme/colors/base.ts +230 -0
- package/src/theme/colors/declarative.ts +87 -0
- package/src/theme/colors/primitive.ts +216 -0
- package/src/theme/default/dark.ts +105 -0
- package/src/theme/default/light.ts +104 -0
- package/src/theme/default/root.ts +106 -0
- package/src/theme/endava/dark.ts +106 -0
- package/src/theme/endava/light.ts +106 -0
- package/src/theme/endava/root.ts +58 -0
- package/src/theme/reset.ts +68 -0
- package/src/theme/typography/default.ts +74 -0
- package/tsconfig.json +22 -0
- package/tsconfig.lib.json +10 -0
- package/index.cjs.d.ts +0 -2
- package/index.cjs.default.js +0 -1
- package/index.cjs.js +0 -1356
- package/index.cjs.mjs +0 -2
- package/index.esm.d.ts +0 -2
- package/index.esm.js +0 -1342
- package/src/helpers/blend-color.d.ts +0 -10
- package/src/index.d.ts +0 -376
- package/src/plugins/color-mix.d.ts +0 -2
- package/src/plugins/logical-properties.d.ts +0 -2
- package/src/theme/colors/base.d.ts +0 -200
- package/src/theme/colors/declarative.d.ts +0 -78
- package/src/theme/colors/primitive.d.ts +0 -212
- package/src/theme/default/dark.d.ts +0 -54
- package/src/theme/default/light.d.ts +0 -54
- package/src/theme/default/root.d.ts +0 -92
- package/src/theme/endava/dark.d.ts +0 -55
- package/src/theme/endava/light.d.ts +0 -55
- package/src/theme/endava/root.d.ts +0 -48
- package/src/theme/reset.d.ts +0 -2
- package/src/theme/typography/default.d.ts +0 -2
- /package/src/helpers/{index.d.ts → index.ts} +0 -0
- /package/src/plugins/{index.d.ts → index.ts} +0 -0
- /package/src/theme/colors/{index.d.ts → index.ts} +0 -0
- /package/src/theme/default/{index.d.ts → index.ts} +0 -0
- /package/src/theme/endava/{index.d.ts → index.ts} +0 -0
- /package/src/theme/{index.d.ts → index.ts} +0 -0
- /package/src/theme/typography/{index.d.ts → index.ts} +0 -0
package/.babelrc
ADDED
package/eslint.config.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const nxESLint = require('@nx/eslint-plugin');
|
|
2
|
+
const importXPlugin = require('eslint-plugin-import-x');
|
|
3
|
+
const prettierRecommended = require('eslint-plugin-prettier/recommended');
|
|
4
|
+
const jsoncParser = require('jsonc-eslint-parser');
|
|
5
|
+
const tsESLint = require('typescript-eslint');
|
|
6
|
+
|
|
7
|
+
/** @type { import("eslint").Linter.Config[] } */
|
|
8
|
+
module.exports = [
|
|
9
|
+
...tsESLint.configs.recommended,
|
|
10
|
+
prettierRecommended,
|
|
11
|
+
importXPlugin.flatConfigs.recommended,
|
|
12
|
+
importXPlugin.flatConfigs.typescript,
|
|
13
|
+
{
|
|
14
|
+
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
languageOptions: {
|
|
18
|
+
sourceType: 'module',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
rules: {
|
|
23
|
+
'@typescript-eslint/no-inferrable-types': 'off',
|
|
24
|
+
'import-x/consistent-type-specifier-style': 'error',
|
|
25
|
+
'import-x/no-named-as-default': 'off',
|
|
26
|
+
'import-x/no-named-as-default-member': 'off',
|
|
27
|
+
'import-x/namespace': [
|
|
28
|
+
// @see https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/namespace.md
|
|
29
|
+
'error',
|
|
30
|
+
{
|
|
31
|
+
allowComputed: true,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
'import-x/order': [
|
|
35
|
+
'error',
|
|
36
|
+
{
|
|
37
|
+
groups: ['builtin', 'external', ['parent', 'sibling'], 'index'],
|
|
38
|
+
'newlines-between': 'always',
|
|
39
|
+
alphabetize: {
|
|
40
|
+
order: 'asc',
|
|
41
|
+
caseInsensitive: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
'sort-imports': [
|
|
46
|
+
'error',
|
|
47
|
+
{
|
|
48
|
+
ignoreCase: true,
|
|
49
|
+
ignoreDeclarationSort: true,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
files: ['**/package.json', '**/project.json'],
|
|
56
|
+
languageOptions: {
|
|
57
|
+
parser: jsoncParser,
|
|
58
|
+
},
|
|
59
|
+
plugins: {
|
|
60
|
+
'@nx': nxESLint,
|
|
61
|
+
},
|
|
62
|
+
rules: {
|
|
63
|
+
'@nx/dependency-checks': 'error',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
files: ['**/*.js'],
|
|
68
|
+
rules: {
|
|
69
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
];
|
package/package.json
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"./package.json": "./package.json",
|
|
19
|
-
".": {
|
|
20
|
-
"module": "./index.esm.js",
|
|
21
|
-
"types": "./index.esm.d.ts",
|
|
22
|
-
"import": "./index.cjs.mjs",
|
|
23
|
-
"default": "./index.cjs.js"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
2
|
+
"name": "@beeq/tailwindcss",
|
|
3
|
+
"version": "1.8.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"description": "BEEQ's opinionated TailwindCSS configuration",
|
|
6
|
+
"main": "./index.cjs.js",
|
|
7
|
+
"module": "./index.esm.js",
|
|
8
|
+
"types": "./src/index.d.ts",
|
|
9
|
+
"peerDependencies": {
|
|
10
|
+
"tailwindcss": "^3.4.4",
|
|
11
|
+
"tailwindcss-theme-swapper": "^0.12.0"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/Endava/BEEQ"
|
|
16
|
+
}
|
|
17
|
+
}
|
package/project.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "beeq-tailwindcss",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "packages/beeq-tailwindcss/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"tags": ["publishable", "preset", "tailwindcss"],
|
|
7
|
+
"targets": {
|
|
8
|
+
"build": {
|
|
9
|
+
"executor": "@nx/rollup:rollup",
|
|
10
|
+
"outputs": ["{options.outputPath}"],
|
|
11
|
+
"options": {
|
|
12
|
+
"format": ["esm", "cjs"],
|
|
13
|
+
"deleteOutputPath": true,
|
|
14
|
+
"generateExportsField": true,
|
|
15
|
+
"outputPath": "dist/beeq-tailwindcss",
|
|
16
|
+
"main": "packages/beeq-tailwindcss/src/index.ts",
|
|
17
|
+
"tsConfig": "packages/beeq-tailwindcss/tsconfig.lib.json",
|
|
18
|
+
"project": "packages/beeq-tailwindcss/package.json",
|
|
19
|
+
"external": ["tailwindcss", "tailwindcss-theme-swapper"],
|
|
20
|
+
"assets": [
|
|
21
|
+
{
|
|
22
|
+
"glob": "packages/beeq-tailwindcss/README.md",
|
|
23
|
+
"input": ".",
|
|
24
|
+
"output": "."
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"lint": {
|
|
30
|
+
"executor": "@nx/eslint:lint",
|
|
31
|
+
"dependsOn": ["build"],
|
|
32
|
+
"options": {
|
|
33
|
+
"lintFilePatterns": ["{projectRoot}/**/*.ts", "{projectRoot}/package.json", "{projectRoot}/project.json"]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type blendOptions = {
|
|
2
|
+
color: string;
|
|
3
|
+
base: string;
|
|
4
|
+
percentage?: number;
|
|
5
|
+
property?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Blend color with base color and percentage
|
|
9
|
+
*
|
|
10
|
+
* @param {Object} opt - The blendColor options object
|
|
11
|
+
* @param {string} opt.color - The color to blend
|
|
12
|
+
* @param {string} opt.base - The base color layer to blend with
|
|
13
|
+
* @param {number} opt.percentage - The percentage to blend
|
|
14
|
+
* @param {string} [opt.property ='background-color'] - The CSS property to blend (e.g: 'background-color', 'color')
|
|
15
|
+
*/
|
|
16
|
+
export const blendColor = ({ color, base, percentage = 20, property = 'background-color' }: blendOptions) => ({
|
|
17
|
+
[property]: `color-mix(in srgb, ${color}, ${base} ${percentage}%)`,
|
|
18
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import type { Config } from 'tailwindcss';
|
|
2
|
+
import plugin from 'tailwindcss/plugin';
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import ThemeSwapper from 'tailwindcss-theme-swapper';
|
|
6
|
+
|
|
7
|
+
import { ColorMix, LogicalProperties } from './plugins';
|
|
8
|
+
import {
|
|
9
|
+
CSS_COLORS,
|
|
10
|
+
DECLARATIVE_COLORS,
|
|
11
|
+
DefaultDarkTheme,
|
|
12
|
+
DefaultLightTheme,
|
|
13
|
+
DefaultRootTheme,
|
|
14
|
+
EndavaDarkTheme,
|
|
15
|
+
EndavaLightTheme,
|
|
16
|
+
EndavaRootTheme,
|
|
17
|
+
PRIMITIVE_COLORS,
|
|
18
|
+
reset,
|
|
19
|
+
TYPOGRAPHY_DEFAULT,
|
|
20
|
+
} from './theme';
|
|
21
|
+
|
|
22
|
+
const inherit: string = 'inherit';
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
theme: {
|
|
26
|
+
colors: {
|
|
27
|
+
inherit,
|
|
28
|
+
current: 'currentColor',
|
|
29
|
+
transparent: 'transparent',
|
|
30
|
+
/* ------------------- Extended palette color (Primitive) ------------------- */
|
|
31
|
+
...PRIMITIVE_COLORS,
|
|
32
|
+
/* ------------------- Specific Theme Colors (Declarative) ------------------ */
|
|
33
|
+
focus: DECLARATIVE_COLORS.focus,
|
|
34
|
+
data: { ...DECLARATIVE_COLORS.data },
|
|
35
|
+
icon: { ...DECLARATIVE_COLORS.icon },
|
|
36
|
+
ui: { ...DECLARATIVE_COLORS.ui },
|
|
37
|
+
},
|
|
38
|
+
borderRadius: {
|
|
39
|
+
none: 'var(--bq-radius--none)',
|
|
40
|
+
xs2: 'var(--bq-radius--xs2)',
|
|
41
|
+
xs: 'var(--bq-radius--xs)',
|
|
42
|
+
s: 'var(--bq-radius--s)',
|
|
43
|
+
m: 'var(--bq-radius--m)',
|
|
44
|
+
l: 'var(--bq-radius--l)',
|
|
45
|
+
full: 'var(--bq-radius--full)',
|
|
46
|
+
},
|
|
47
|
+
borderWidth: {
|
|
48
|
+
0: '0',
|
|
49
|
+
s: 'var(--bq-stroke-s)',
|
|
50
|
+
m: 'var(--bq-stroke-m)',
|
|
51
|
+
l: 'var(--bq-stroke-l)',
|
|
52
|
+
},
|
|
53
|
+
boxShadow: {
|
|
54
|
+
xs: 'var(--bq-box-shadow--xs)',
|
|
55
|
+
s: 'var(--bq-box-shadow--s)',
|
|
56
|
+
m: 'var(--bq-box-shadow--m)',
|
|
57
|
+
l: 'var(--bq-box-shadow--l)',
|
|
58
|
+
},
|
|
59
|
+
fontFamily: {
|
|
60
|
+
inherit,
|
|
61
|
+
default: 'var(--bq-font-family)',
|
|
62
|
+
outfit: 'var(--bq-font-family--outfit)',
|
|
63
|
+
poppins: 'var(--bq-font-family--poppins)',
|
|
64
|
+
},
|
|
65
|
+
fontSize: {
|
|
66
|
+
xs: 'var(--bq-font-size--xs)',
|
|
67
|
+
s: 'var(--bq-font-size--s)',
|
|
68
|
+
m: 'var(--bq-font-size--m)',
|
|
69
|
+
l: 'var(--bq-font-size--l)',
|
|
70
|
+
xl: 'var(--bq-font-size--xl)',
|
|
71
|
+
xxl: 'var(--bq-font-size--xxl)',
|
|
72
|
+
xxl2: 'var(--bq-font-size--xxl2)',
|
|
73
|
+
xxl3: 'var(--bq-font-size--xxl3)',
|
|
74
|
+
xxl4: 'var(--bq-font-size--xxl4)',
|
|
75
|
+
xxl5: 'var(--bq-font-size--xxl5)',
|
|
76
|
+
},
|
|
77
|
+
fontWeight: {
|
|
78
|
+
thin: 'var(--bq-font-weight--thin)',
|
|
79
|
+
light: 'var(--bq-font-weight--light)',
|
|
80
|
+
regular: 'var(--bq-font-weight--regular)',
|
|
81
|
+
medium: 'var(--bq-font-weight--medium)',
|
|
82
|
+
semibold: 'var(--bq-font-weight--semibold)',
|
|
83
|
+
bold: 'var(--bq-font-weight--bold)',
|
|
84
|
+
},
|
|
85
|
+
lineHeight: {
|
|
86
|
+
inherit,
|
|
87
|
+
small: 'var(--bq-font-line-height--small)',
|
|
88
|
+
regular: 'var(--bq-font-line-height--regular)',
|
|
89
|
+
large: 'var(--bq-font-line-height--large)',
|
|
90
|
+
},
|
|
91
|
+
strokeWidth: {
|
|
92
|
+
inherit,
|
|
93
|
+
none: '0',
|
|
94
|
+
s: 'var(--bq-stroke-s)',
|
|
95
|
+
m: 'var(--bq-stroke-m)',
|
|
96
|
+
l: 'var(--bq-stroke-l)',
|
|
97
|
+
},
|
|
98
|
+
extend: {
|
|
99
|
+
/* ------------------ Extend colors with declarative colors ----------------- */
|
|
100
|
+
backgroundColor: { ...DECLARATIVE_COLORS.bg },
|
|
101
|
+
borderColor: { ...DECLARATIVE_COLORS.stroke },
|
|
102
|
+
stroke: { ...DECLARATIVE_COLORS.stroke },
|
|
103
|
+
textColor: { ...DECLARATIVE_COLORS.text },
|
|
104
|
+
fill: { ...DECLARATIVE_COLORS.icon },
|
|
105
|
+
/* --------------------------- End: Extend colors --------------------------- */
|
|
106
|
+
content: {
|
|
107
|
+
empty: "''",
|
|
108
|
+
},
|
|
109
|
+
cursor: {
|
|
110
|
+
inherit,
|
|
111
|
+
},
|
|
112
|
+
height: {
|
|
113
|
+
inherit,
|
|
114
|
+
// Details: https://web.dev/viewport-units/#the-need-for-new-viewport-units
|
|
115
|
+
'dynamic-vh': '100dvh',
|
|
116
|
+
},
|
|
117
|
+
spacing: {
|
|
118
|
+
xs3: 'var(--bq-spacing-xs3)',
|
|
119
|
+
xs2: 'var(--bq-spacing-xs2)',
|
|
120
|
+
xs: 'var(--bq-spacing-xs)',
|
|
121
|
+
s: 'var(--bq-spacing-s)',
|
|
122
|
+
m: 'var(--bq-spacing-m)',
|
|
123
|
+
l: 'var(--bq-spacing-l)',
|
|
124
|
+
xl: 'var(--bq-spacing-xl)',
|
|
125
|
+
xxl: 'var(--bq-spacing-xxl)',
|
|
126
|
+
xxl2: 'var(--bq-spacing-xxl2)',
|
|
127
|
+
xxl3: 'var(--bq-spacing-xxl3)',
|
|
128
|
+
xxl4: 'var(--bq-spacing-xxl4)',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
plugins: [
|
|
133
|
+
plugin(function ({ addBase, addComponents, theme }) {
|
|
134
|
+
addBase({
|
|
135
|
+
// CSS variables
|
|
136
|
+
':root, ::backdrop': { ...CSS_COLORS },
|
|
137
|
+
// CSS reset
|
|
138
|
+
...reset,
|
|
139
|
+
});
|
|
140
|
+
addComponents({
|
|
141
|
+
/**
|
|
142
|
+
* Common `FOCUS` state that should be used within `focus-visible` Tailwind CSS utility
|
|
143
|
+
* Examples of usage:
|
|
144
|
+
*
|
|
145
|
+
* class="focus-visible:focus"
|
|
146
|
+
*
|
|
147
|
+
* @apply focus-visible:focus
|
|
148
|
+
*
|
|
149
|
+
* &:focus-visible {
|
|
150
|
+
* @apply focus;
|
|
151
|
+
* }
|
|
152
|
+
*/
|
|
153
|
+
'.focus': {
|
|
154
|
+
outline: `var(--bq-ring-width, 2px) solid var(--bq-ring-color-focus, ${String(theme('colors.focus'))})`,
|
|
155
|
+
outlineOffset: 'var(--bq-ring-offset-width, 1px)',
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
}),
|
|
159
|
+
// Local Custom Plugins
|
|
160
|
+
ColorMix,
|
|
161
|
+
LogicalProperties,
|
|
162
|
+
// Tailwind CSS Theme Swapper
|
|
163
|
+
ThemeSwapper({
|
|
164
|
+
themes: [
|
|
165
|
+
{
|
|
166
|
+
name: 'root',
|
|
167
|
+
selectors: [':root'],
|
|
168
|
+
theme: { ...DefaultRootTheme },
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: 'light',
|
|
172
|
+
selectors: [':root', '.light', '.beeq.light', '[bq-mode="light"]'],
|
|
173
|
+
theme: { ...DefaultLightTheme },
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'dark',
|
|
177
|
+
selectors: ['.dark', '.beeq.dark', '[bq-mode="dark"]'],
|
|
178
|
+
theme: { ...DefaultDarkTheme },
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: 'endava',
|
|
182
|
+
selectors: ['.endava', '[bq-theme="endava"]'],
|
|
183
|
+
theme: { ...EndavaRootTheme },
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: 'endava-light',
|
|
187
|
+
selectors: ['.endava.light', '[bq-theme="endava"][bq-mode="light"]'],
|
|
188
|
+
theme: { ...EndavaLightTheme },
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: 'endava-dark',
|
|
192
|
+
selectors: ['.endava.dark', '[bq-theme="endava"][bq-mode="dark"]'],
|
|
193
|
+
theme: { ...EndavaDarkTheme },
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
}),
|
|
197
|
+
],
|
|
198
|
+
} satisfies Partial<Config>;
|
|
199
|
+
|
|
200
|
+
export {
|
|
201
|
+
CSS_COLORS,
|
|
202
|
+
DECLARATIVE_COLORS,
|
|
203
|
+
DefaultDarkTheme,
|
|
204
|
+
DefaultLightTheme,
|
|
205
|
+
DefaultRootTheme,
|
|
206
|
+
EndavaDarkTheme,
|
|
207
|
+
EndavaLightTheme,
|
|
208
|
+
EndavaRootTheme,
|
|
209
|
+
PRIMITIVE_COLORS,
|
|
210
|
+
TYPOGRAPHY_DEFAULT,
|
|
211
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Config } from 'tailwindcss';
|
|
2
|
+
import plugin from 'tailwindcss/plugin';
|
|
3
|
+
|
|
4
|
+
import { blendColor } from '../helpers';
|
|
5
|
+
|
|
6
|
+
// NOTE: https://github.com/tailwindlabs/tailwindcss/discussions/6925#discussioncomment-1919382
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
8
|
+
const { default: flattenColorPalette } = require('tailwindcss/lib/util/flattenColorPalette');
|
|
9
|
+
|
|
10
|
+
export const ColorMix: Partial<Config> = plugin(function ({ matchUtilities, theme }) {
|
|
11
|
+
matchUtilities(
|
|
12
|
+
{
|
|
13
|
+
// Background `hover` state blend color
|
|
14
|
+
'bg-hover': (value) => blendColor({ color: value, base: 'var(--bq-hover)' }),
|
|
15
|
+
// Background `active` state blend color
|
|
16
|
+
'bg-active': (value) => blendColor({ color: value, base: 'var(--bq-active)' }),
|
|
17
|
+
// Border `hover` state blend color
|
|
18
|
+
'border-hover': (value) => blendColor({ color: value, base: 'var(--bq-hover)', property: 'border-color' }),
|
|
19
|
+
// Border `active` state blend color
|
|
20
|
+
'border-active': (value) => blendColor({ color: value, base: 'var(--bq-active)', property: 'border-color' }),
|
|
21
|
+
// Text `hover` state blend color
|
|
22
|
+
'text-hover': (value) => blendColor({ color: value, base: 'var(--bq-hover)', property: 'color' }),
|
|
23
|
+
// Text `active` state blend color
|
|
24
|
+
'text-active': (value) => blendColor({ color: value, base: 'var(--bq-active)', property: 'color' }),
|
|
25
|
+
},
|
|
26
|
+
{ values: flattenColorPalette(theme('colors')) },
|
|
27
|
+
);
|
|
28
|
+
matchUtilities(
|
|
29
|
+
{
|
|
30
|
+
// Background `hover` state blend color
|
|
31
|
+
'bg-hover': (value) => blendColor({ color: value, base: 'var(--bq-hover)' }),
|
|
32
|
+
// Background `active` state blend color
|
|
33
|
+
'bg-active': (value) => blendColor({ color: value, base: 'var(--bq-active)' }),
|
|
34
|
+
},
|
|
35
|
+
{ values: flattenColorPalette(theme('backgroundColor')) },
|
|
36
|
+
);
|
|
37
|
+
matchUtilities(
|
|
38
|
+
{
|
|
39
|
+
// Border `hover` state blend color
|
|
40
|
+
'border-hover': (value) => blendColor({ color: value, base: 'var(--bq-hover)', property: 'border-color' }),
|
|
41
|
+
// Border `active` state blend color
|
|
42
|
+
'border-active': (value) => blendColor({ color: value, base: 'var(--bq-active)', property: 'border-color' }),
|
|
43
|
+
},
|
|
44
|
+
{ values: flattenColorPalette(theme('borderColor')) },
|
|
45
|
+
);
|
|
46
|
+
matchUtilities(
|
|
47
|
+
{
|
|
48
|
+
// Text `hover` state blend color
|
|
49
|
+
'text-hover': (value) => blendColor({ color: value, base: 'var(--bq-hover)', property: 'color' }),
|
|
50
|
+
// Text `active` state blend color
|
|
51
|
+
'text-active': (value) => blendColor({ color: value, base: 'var(--bq-active)', property: 'color' }),
|
|
52
|
+
},
|
|
53
|
+
{ values: flattenColorPalette(theme('textColor')) },
|
|
54
|
+
);
|
|
55
|
+
matchUtilities(
|
|
56
|
+
{
|
|
57
|
+
// Stroke `hover` state blend color
|
|
58
|
+
'stroke-hover': (value) => blendColor({ color: value, base: 'var(--bq-hover)', property: 'color' }),
|
|
59
|
+
// Stroke `active` state blend color
|
|
60
|
+
'stroke-active': (value) => blendColor({ color: value, base: 'var(--bq-active)', property: 'color' }),
|
|
61
|
+
},
|
|
62
|
+
{ values: flattenColorPalette(theme('stroke')) },
|
|
63
|
+
);
|
|
64
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Config } from 'tailwindcss';
|
|
2
|
+
import plugin from 'tailwindcss/plugin';
|
|
3
|
+
|
|
4
|
+
// NOTE: https://github.com/tailwindlabs/tailwindcss/discussions/6925#discussioncomment-1919382
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
6
|
+
const { default: flattenColorPalette } = require('tailwindcss/lib/util/flattenColorPalette');
|
|
7
|
+
|
|
8
|
+
export const LogicalProperties: Partial<Config> = plugin(function ({ matchUtilities, theme }) {
|
|
9
|
+
matchUtilities(
|
|
10
|
+
{
|
|
11
|
+
// Logical Border Width properties
|
|
12
|
+
'border-bl': (value) => ({ 'border-block-width': value }),
|
|
13
|
+
'border-bs': (value) => ({ 'border-block-start-width': value }),
|
|
14
|
+
'border-be': (value) => ({ 'border-block-end-width': value }),
|
|
15
|
+
'border-i': (value) => ({ 'border-inline-width': value }),
|
|
16
|
+
'border-is': (value) => ({ 'border-inline-start-width': value }),
|
|
17
|
+
'border-ie': (value) => ({ 'border-inline-end-width': value }),
|
|
18
|
+
},
|
|
19
|
+
{ values: theme('borderWidth') },
|
|
20
|
+
);
|
|
21
|
+
matchUtilities(
|
|
22
|
+
{
|
|
23
|
+
// Logical Border Color properties
|
|
24
|
+
'border-bl': (value) => ({ 'border-block-color': value }),
|
|
25
|
+
'border-bs': (value) => ({ 'border-block-start-color': value }),
|
|
26
|
+
'border-be': (value) => ({ 'border-block-end-color': value }),
|
|
27
|
+
'border-i': (value) => ({ 'border-inline-color': value }),
|
|
28
|
+
'border-is': (value) => ({ 'border-inline-start-color': value }),
|
|
29
|
+
'border-ie': (value) => ({ 'border-inline-end-color': value }),
|
|
30
|
+
},
|
|
31
|
+
{ values: flattenColorPalette(theme('colors')) },
|
|
32
|
+
);
|
|
33
|
+
matchUtilities(
|
|
34
|
+
{
|
|
35
|
+
// Logical Height and Width properties
|
|
36
|
+
bs: (value) => ({ 'block-size': value }),
|
|
37
|
+
'max-bs': (value) => ({ 'max-block-size': value }),
|
|
38
|
+
'min-bs': (value) => ({ 'min-block-size': value }),
|
|
39
|
+
is: (value) => ({ 'inline-size': value }),
|
|
40
|
+
'max-is': (value) => ({ 'max-inline-size': value }),
|
|
41
|
+
'min-is': (value) => ({ 'min-inline-size': value }),
|
|
42
|
+
},
|
|
43
|
+
{ values: theme('width') },
|
|
44
|
+
);
|
|
45
|
+
matchUtilities(
|
|
46
|
+
{
|
|
47
|
+
// Logical Border properties
|
|
48
|
+
'border-bl': (value) => ({ 'border-block': value }),
|
|
49
|
+
'border-bs': (value) => ({ 'border-block-start': value }),
|
|
50
|
+
'border-be': (value) => ({ 'border-block-end': value }),
|
|
51
|
+
'border-i': (value) => ({ 'border-inline': value }),
|
|
52
|
+
'border-is': (value) => ({ 'border-inline-start': value }),
|
|
53
|
+
'border-ie': (value) => ({ 'border-inline-end': value }),
|
|
54
|
+
// Logical Padding properties (only those not covered by Tailwind CSS)
|
|
55
|
+
'p-b': (value) => ({ 'padding-block': value }),
|
|
56
|
+
'p-bs': (value) => ({ 'padding-block-start': value }),
|
|
57
|
+
'p-be': (value) => ({ 'padding-block-end': value }),
|
|
58
|
+
'p-i': (value) => ({ 'padding-inline': value }),
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
values: theme('spacing'),
|
|
62
|
+
},
|
|
63
|
+
);
|
|
64
|
+
matchUtilities(
|
|
65
|
+
{
|
|
66
|
+
// Logical Top, Right, Bottom, and Left properties
|
|
67
|
+
'inset-b': (value) => ({ 'inset-block': value }),
|
|
68
|
+
'inset-bs': (value) => ({ 'inset-block-start': value }),
|
|
69
|
+
'inset-be': (value) => ({ 'inset-block-end': value }),
|
|
70
|
+
'inset-i': (value) => ({ 'inset-inline': value }),
|
|
71
|
+
'inset-is': (value) => ({ 'inset-inline-start': value }),
|
|
72
|
+
'inset-ie': (value) => ({ 'inset-inline-end': value }),
|
|
73
|
+
// Logical Margin properties (only those not covered by Tailwind CSS)
|
|
74
|
+
'm-b': (value) => ({ 'margin-block': value }),
|
|
75
|
+
'm-bs': (value) => ({ 'margin-block-start': value }),
|
|
76
|
+
'm-be': (value) => ({ 'margin-block-end': value }),
|
|
77
|
+
'm-i': (value) => ({ 'margin-inline': value }),
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
values: theme('spacing'),
|
|
81
|
+
supportsNegativeValues: true,
|
|
82
|
+
},
|
|
83
|
+
);
|
|
84
|
+
});
|