Skip to content

Commit 6a37f65

Browse files
jcfrancobenelan
andcommitted
feat: move Tailwind preset to package (#11817)
**Related Issue:** #6602 ## Summary ✨📦✨ --------- Co-authored-by: Ben Elan <[email protected]>
1 parent 58aa89c commit 6a37f65

18 files changed

+529
-203
lines changed

.github/workflows/chromatic.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
run: |
2323
npm install
2424
npm --workspace="packages/calcite-design-tokens" run build
25+
npm --workspace="packages/calcite-tailwind-preset" run build
2526
npm --workspace="packages/calcite-ui-icons" run build
2627
npm --workspace="packages/calcite-components" run build-storybook
2728
- name: Publish to Chromatic

package-lock.json

Lines changed: 345 additions & 199 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/calcite-components/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
},
9494
"devDependencies": {
9595
"@esri/calcite-design-tokens": "3.0.2-next.5",
96+
"@esri/calcite-tailwind-preset": "0.1.0",
9697
"@esri/eslint-plugin-calcite-components": "2.0.2-next.3"
9798
},
9899
"volta": {

packages/calcite-components/support/cleanupDistFiles.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
# The rest of the files showed up in v2 and are likely related to the Stencil v4 bump.
1010
rm -rf ./dist/collection/demos ./dist/collection/tests ./dist/.storybook/ \
1111
./dist/tailwind.config.js{,.map} ./dist/stencil.config.js{,.map} \
12-
./dist/calcite-preset.js{,.map} ./dist/types/tests ./dist/types/home
12+
./dist/types/tests ./dist/types/home

packages/calcite-components/tailwind.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import calcitePreset from "./calcite-preset";
1+
import calcitePreset from "@esri/calcite-tailwind-preset";
22

33
export default {
44
presets: [calcitePreset],
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Contributing
2+
3+
Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/Esri/contributing).
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Licensing
2+
3+
COPYRIGHT © 2025 Esri
4+
5+
All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions.
6+
7+
This material is licensed for use under the Esri Master License Agreement (MLA), and is bound by the terms of that agreement. You may redistribute and use this code without modification, provided you adhere to the terms of the MLA and include this copyright notice.
8+
9+
See use restrictions at <http://www.esri.com/legal/pdfs/mla_e204_e300/english>
10+
11+
For additional information, contact: Environmental Systems Research Institute, Inc. Attn: Contracts and Legal Services Department 380 New York Street Redlands, California, USA 92373 USA
12+
13+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Calcite Tailwind Preset
2+
3+
This package provides a Tailwind CSS preset for Calcite Design System, enabling consistent styling across your applications.
4+
5+
## Usage
6+
7+
Install the Calcite Tailwind preset:
8+
9+
```bash
10+
npm install -D @esri/calcite-tailwind-preset
11+
```
12+
13+
Then import it in your Tailwind CSS configuration file:
14+
15+
```ts
16+
import calcitePreset from "@esri/calcite-tailwind-preset";
17+
18+
export default {
19+
presets: [calcitePreset],
20+
content: [
21+
/* ... */
22+
],
23+
};
24+
```
25+
26+
## Note
27+
28+
This package is updated as needed. If you require any critical updates, please reach out to the Calcite Design System team.
29+
30+
## License
31+
32+
COPYRIGHT © 2025 Esri
33+
34+
All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions.
35+
36+
This material is licensed for use under the Esri Master License Agreement (MLA), and is bound by the terms of that agreement. You may redistribute and use this code without modification, provided you adhere to the terms of the MLA and include this copyright notice.
37+
38+
See use restrictions at <http://www.esri.com/legal/pdfs/mla_e204_e300/english>
39+
40+
For additional information, contact: Environmental Systems Research Institute, Inc. Attn: Contracts and Legal Services Department 380 New York Street Redlands, California, USA 92373 USA
41+
42+
43+
44+
## Third-party licenses
45+
46+
See [THIRD-PARTY-LICENSES.md](./THIRD-PARTY-LICENSES.md).
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Third Party Licenses
2+
3+
This packages does not have any third-party dependencies.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import calciteCoreConfig from "@esri/eslint-config-calcite/core.js";
2+
import tseslint from "typescript-eslint";
3+
4+
export default tseslint.config(
5+
{
6+
ignores: ["**/dist"],
7+
},
8+
9+
{
10+
extends: [calciteCoreConfig],
11+
12+
languageOptions: {
13+
parserOptions: {
14+
tsconfigRootDir: import.meta.dirname,
15+
project: ["tsconfig-eslint.json"],
16+
},
17+
},
18+
},
19+
);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import baseConfig from "../../lint-staged.config.mjs";
2+
3+
export default {
4+
...baseConfig,
5+
"*.{ts,tsx,mjs,cjs}": ["eslint --fix", "prettier --write"],
6+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "@esri/calcite-tailwind-preset",
3+
"version": "0.1.0",
4+
"description": "Tailwind CSS preset for the Calcite Design System",
5+
"repository": {
6+
"type": "git",
7+
"url": "git+https://github.com/Esri/calcite-design-system.git",
8+
"directory": "packages/calcite-tailwind-preset"
9+
},
10+
"license": "SEE LICENSE.md",
11+
"main": "dist/index.js",
12+
"types": "dist/index.d.ts",
13+
"files": [
14+
"dist/",
15+
"THIRD-PARTY-LICENSES.md"
16+
],
17+
"scripts": {
18+
"build": "vite build",
19+
"clean": "rimraf dist node_modules .turbo",
20+
"lint": "concurrently npm:lint:*",
21+
"lint:json": "prettier --write \"**/*.json\" >/dev/null",
22+
"lint:md": "prettier --write \"**/*.md\" >/dev/null && markdownlint \"**/*.md\" --fix --dot --ignore-path .gitignore --ignore-path ../../.gitignore",
23+
"util:update-3rd-party-licenses": "tsx ../../support/createThirdPartyLicenses.ts"
24+
},
25+
"peerDependencies": {
26+
"@esri/calcite-design-tokens": "^3.0.2-next.3",
27+
"tailwindcss": "^3.0.0 < 4.0.0"
28+
},
29+
"volta": {
30+
"extends": "../../package.json"
31+
}
32+
}

packages/calcite-components/calcite-preset.ts renamed to packages/calcite-tailwind-preset/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @ts-strict-ignore
21
import flattenColorPalette from "tailwindcss/lib/util/flattenColorPalette";
32
import plugin from "tailwindcss/plugin";
43

@@ -288,7 +287,7 @@ export default {
288287
addUtilities(newUtilities);
289288
}),
290289
plugin(({ addUtilities, theme }) => {
291-
const colors = flattenColorPalette.default(theme("borderColor"));
290+
const colors = flattenColorPalette(theme("borderColor"));
292291
delete colors["default"];
293292

294293
const colorMap = Object.keys(colors).map((color) => ({
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"compilerOptions": {
3+
"allowUnreachableCode": false,
4+
"declaration": true,
5+
"esModuleInterop": true,
6+
"lib": ["dom", "dom.iterable", "ES2023"],
7+
"module": "node16",
8+
"moduleResolution": "node16",
9+
"noUnusedLocals": true,
10+
"noUnusedParameters": true,
11+
"resolveJsonModule": true,
12+
"target": "ES2022"
13+
},
14+
"exclude": ["node_modules", "dist"]
15+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig-base.json",
3+
"include": ["**/*.*"]
4+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"declaration": true,
4+
"outDir": "dist"
5+
},
6+
"extends": "./tsconfig-base",
7+
"include": ["src/index.ts", "vite.config.mts"]
8+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { defineConfig } from "vite";
2+
import dts from 'vite-plugin-dts'
3+
import { version } from "./package.json";
4+
5+
export default defineConfig({
6+
build: {
7+
lib: {
8+
entry: "src/index.ts",
9+
formats: ["cjs"],
10+
fileName: () => "index.js",
11+
},
12+
rollupOptions: {
13+
external: ["tailwindcss"],
14+
output: {
15+
banner: `/*!
16+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
17+
See https://github.com/Esri/calcite-design-system/blob/${version}/LICENSE.md for details.
18+
*/`,
19+
}
20+
},
21+
},
22+
plugins: [
23+
dts({
24+
rollupTypes: true
25+
}),
26+
],
27+
});

release-please-config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@
7474
"packages/calcite-design-tokens": {
7575
"component": "@esri/calcite-design-tokens"
7676
},
77+
"packages/calcite-tailwind-preset": {
78+
"component": "@esri/calcite-tailwind-preset"
79+
},
7780
"packages/calcite-ui-icons": {
7881
"component": "@esri/calcite-ui-icons",
7982
"extra-files": ["docs/index.html"]

0 commit comments

Comments
 (0)