diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 0000000..ae24c12 --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,56 @@ +name: Prepare Release + +on: + workflow_dispatch: + push: + tags: + - 'v*' + +permissions: + contents: read + +jobs: + prepare: + permissions: + contents: write # for softprops/action-gh-release to create GitHub release + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [22] + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + registry-url: 'https://registry.npmjs.org' + cache: 'npm' + + - name: Install dependencies + run: npm install + + - name: Test + run: npm test + + - name: Resolve version + id: vars + run: | + echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV + + - name: Get release notes + run: | + RELEASE_NOTES=$(npm run release-notes --silent) + echo "RELEASE_NOTES<> $GITHUB_ENV + echo "$RELEASE_NOTES" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - name: Release + uses: softprops/action-gh-release@v1 + with: + draft: true + tag_name: ${{ env.TAG_NAME }} + body: ${{ env.RELEASE_NOTES }} diff --git a/.github/workflows/release-insiders.yml b/.github/workflows/release-insiders.yml new file mode 100644 index 0000000..1a9a2b1 --- /dev/null +++ b/.github/workflows/release-insiders.yml @@ -0,0 +1,42 @@ +name: Release Insiders + +on: + push: + branches: [main] + +permissions: + contents: read + id-token: write + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [22] + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + registry-url: 'https://registry.npmjs.org' + cache: 'npm' + + - name: Install dependencies + run: npm install + + - name: Resolve version + id: vars + run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + + - name: 'Version based on commit: 0.0.0-insiders.${{ steps.vars.outputs.sha_short }}' + run: npm version 0.0.0-insiders.${{ steps.vars.outputs.sha_short }} --force --no-git-tag-version + + - name: Publish + run: npm publish --provenance --tag insiders + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a4482d0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +name: Release + +on: + release: + types: [published] + +permissions: + contents: read + id-token: write + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [22] + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + registry-url: 'https://registry.npmjs.org' + cache: 'npm' + + - name: Install dependencies + run: npm install + + - name: Test + run: npm test + + - name: Calculate environment variables + run: | + echo "RELEASE_CHANNEL=$(npm run release-channel --silent)" >> $GITHUB_ENV + + - name: Publish + run: npm publish --provenance --tag ${{ env.RELEASE_CHANNEL }} + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index 386f24a..88b3bfc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ +dist node_modules yarn.lock -package-lock.json \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e2bc783..01cafed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,110 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Nothing yet! +## [0.5.10] - 2025-01-07 + +### Fixed + +- Support installing with beta versions of Tailwind CSS v4 ([#163](https://github.com/tailwindlabs/tailwindcss-forms/pull/163)) + +## [0.5.9] - 2024-09-05 + +### Fixed + +- Fallback to static chevron color if theme is using variables ([#167](https://github.com/tailwindlabs/tailwindcss-forms/pull/167)) + +## [0.5.8] - 2024-08-28 + +### Fixed + +- Support installing with alpha versions of Tailwind CSS v4 ([#163](https://github.com/tailwindlabs/tailwindcss-forms/pull/163)) + +## [0.5.7] - 2023-11-10 + +### Fixed + +- Use normal `checkbox` and `radio` appearance in `forced-colors` mode ([#152](https://github.com/tailwindlabs/tailwindcss-forms/pull/152)) + +## [0.5.6] - 2023-08-28 + +### Fixed + +- Fix date time bottom spacing on MacOS Safari ([#146](https://github.com/tailwindlabs/tailwindcss-forms/pull/146)) + +## [0.5.5] - 2023-08-22 + +### Fixed + +- Fix text alignment on date and time inputs on iOS ([#144](https://github.com/tailwindlabs/tailwindcss-forms/pull/144)) + +## [0.5.4] - 2023-07-13 + +### Fixed + +- Remove chevron for selects with a non-default size ([#137](https://github.com/tailwindlabs/tailwindcss-forms/pull/137)) +- Allow for without `type` ([#141](https://github.com/tailwindlabs/tailwindcss-forms/pull/141)) + +## [0.5.3] - 2022-09-02 + +### Fixed + +- Update TypeScript types ([#126](https://github.com/tailwindlabs/tailwindcss-forms/pull/126)) + +## [0.5.2] - 2022-05-18 + +### Added + +- Add TypeScript type declarations ([#118](https://github.com/tailwindlabs/tailwindcss-forms/pull/118)) + +## [0.5.1] - 2022-05-03 + +### Fixed + +- Remove duplicate `outline` property ([#116](https://github.com/tailwindlabs/tailwindcss-forms/pull/116)) +- Fix autoprefixer warning about `color-adjust` ([#115](https://github.com/tailwindlabs/tailwindcss-forms/pull/115)) + +## [0.5.0] - 2022-03-02 + +### Changed + +- Generate both global styles and classes by default ([#71](https://github.com/tailwindlabs/tailwindcss-forms/pull/71)) + +## [0.4.1] - 2022-03-02 + +### Added + +- Remove `dist` folder and related dependencies ([#96](https://github.com/tailwindlabs/tailwindcss-forms/pull/96)) + +### Fixed + +- Use `addComponents` for class strategy ([#91](https://github.com/tailwindlabs/tailwindcss-forms/pull/91)) +- Fix extra height on Safari date/time inputs ([#109](https://github.com/tailwindlabs/tailwindcss-forms/pull/109)) + +## [0.4.0] - 2021-12-09 + +### Changed + +- Update color palette references for v3 ([#83](https://github.com/tailwindlabs/tailwindcss-forms/pull/83)) +- Don't read outline.none value from config ([#89](https://github.com/tailwindlabs/tailwindcss-forms/pull/89)) + +## [0.3.4] - 2021-09-28 + +### Fixed + +- Fix compatibility with `optimizeUniversalDefaults` experimental feature in Tailwind CSS v2.2 ([#81](https://github.com/tailwindlabs/tailwindcss-forms/pull/81)) + +## [0.3.3] - 2021-06-03 + +### Fixed + +- Fix typo in selector when using `class` strategy that breaks background colors on checkboxes and radio buttons ([#72](https://github.com/tailwindlabs/tailwindcss-forms/pull/72)) + +## [0.3.2] - 2021-03-26 + +### Fixed + +- Filter `null` rules for JIT compatibility ([b4c4e03](https://github.com/tailwindlabs/tailwindcss-forms/commit/b4c4e039337c3a5599f5b6d9eabbcc8ab9e8c8d9)) + ## [0.3.1] - 2021-03-26 ### Fixed @@ -62,7 +166,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Initial release! -[unreleased]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.3.1...HEAD +[unreleased]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.5.10...HEAD +[0.5.10]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.5.9...v0.5.10 +[0.5.9]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.5.8...v0.5.9 +[0.5.8]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.5.7...v0.5.8 +[0.5.7]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.5.6...v0.5.7 +[0.5.6]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.5.5...v0.5.6 +[0.5.5]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.5.4...v0.5.5 +[0.5.4]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.5.3...v0.5.4 +[0.5.3]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.5.2...v0.5.3 +[0.5.2]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.5.1...v0.5.2 +[0.5.1]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.5.0...v0.5.1 +[0.5.0]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.4.1...v0.5.0 +[0.4.1]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.4.0...v0.4.1 +[0.4.0]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.3.3...v0.4.0 +[0.3.4]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.3.3...v0.3.4 +[0.3.3]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.3.2...v0.3.3 +[0.3.2]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.3.1...v0.3.2 [0.3.1]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.3.0...v0.3.1 [0.3.0]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.2.1...v0.3.0 [0.2.1]: https://github.com/tailwindlabs/tailwindcss-forms/compare/v0.2.0...v0.2.1 diff --git a/LICENSE b/LICENSE index b6303c0..d6a8229 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Tailwind Labs +Copyright (c) Tailwind Labs, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 695188d..d20b50d 100644 --- a/README.md +++ b/README.md @@ -4,16 +4,10 @@ A plugin that provides a basic reset for form styles that makes form elements ea ## Installation -> Note that @tailwindcss/forms is designed for Tailwind CSS v2.0. - Install the plugin from npm: ```sh -# Using npm -npm install @tailwindcss/forms - -# Using Yarn -yarn add @tailwindcss/forms +npm install -D @tailwindcss/forms ``` Then add the plugin to your `tailwind.config.js` file: @@ -57,13 +51,11 @@ Currently we add basic utility-friendly form styles for the following form eleme - `select[multiple]` - `textarea` -**Note that for text inputs, you must add the `type="text"` attribute for these styles to take effect.** This is a necessary trade-off to avoid relying on the overly greedy `input` selector and unintentionally styling elements we don't have solutions for yet, like `input[type="range"]` for example. - Every element has been normalized/reset to a simple visually consistent style that is easy to customize with utilities, even elements like `` that normally need to be reset with `appearance: none` and customized using custom CSS: ```html - @@ -73,27 +65,14 @@ Every element has been normalized/reset to a simple visually consistent style th More customization examples and best practices coming soon. -### Using classes instead of element selectors - -Although we recommend thinking of this plugin as a "form reset" rather than a collection of form component styles, in some cases our default approach may be too heavy-handed, especially when integrating this plugin into existing projects. - -For situations where the default strategy doesn't work well with your project, you can use the `class` strategy to make all form styling _opt-in_ instead of applied globally: - -```js -// tailwind.config.js -plugins: [ - require("@tailwindcss/forms")({ - strategy: 'class', - }), -], -``` +### Using classes to style -When using the `class` strategy, form elements do not receive any reset styles by default, and reset styles are added per element using a new set of `form-*` classes generated by the plugin: +In addition to the global styles, we also generate a set of corresponding classes which can be used to explicitly apply the form styles to an element. This can be useful in situations where you need to make a non-form element, such as a `
`, look like a form element. ```html - + - @@ -121,3 +100,23 @@ Here is a complete table of the provided `form-*` classes for reference: | `select[multiple]` | `form-multiselect` | | `[type='checkbox']` | `form-checkbox` | | `[type='radio']` | `form-radio` | + +### Using only global styles or only classes + +Although we recommend thinking of this plugin as a "form reset" rather than a collection of form component styles, in some cases our default approach may be too heavy-handed, especially when integrating this plugin into existing projects. + +If generating both the global (base) styles and classes doesn't work well with your project, you can use the `strategy` option to limit the plugin to just one of these approaches. + +```js +// tailwind.config.js +plugins: [ + require("@tailwindcss/forms")({ + strategy: 'base', // only generate global styles + strategy: 'class', // only generate classes + }), +], +``` + +When using the `base` strategy, form elements are styled globally, and no `form-{name}` classes are generated. + +When using the `class` strategy, form elements are not styled globally, and instead must be styled using the generated `form-{name}` classes. diff --git a/dist/.gitignore b/dist/.gitignore deleted file mode 100644 index 2f41fac..0000000 --- a/dist/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!.gitignore -!.npmignore diff --git a/dist/.npmignore b/dist/.npmignore deleted file mode 100644 index e69de29..0000000 diff --git a/index.html b/index.html index d2ab81a..c51b94d 100644 --- a/index.html +++ b/index.html @@ -1,17 +1,14 @@ + @tailwindcss/forms examples - - - - - + -
-
+
+

@tailwindcss/forms examples

@@ -44,7 +41,7 @@

Unstyled

@@ -154,13 +151,13 @@

Underline

When is your event? @@ -181,7 +178,7 @@

Underline

@@ -199,7 +196,7 @@

Solid

Full name @@ -207,7 +204,7 @@

Solid

Email address @@ -215,13 +212,13 @@

Solid

When is your event? @@ -242,7 +239,7 @@

Solid

diff --git a/kitchen-sink.html b/kitchen-sink.html index b5e6ec9..2b98657 100644 --- a/kitchen-sink.html +++ b/kitchen-sink.html @@ -1,22 +1,19 @@ + @tailwindcss/forms Kitchen Sink - - - - - + -
-
+
+

Reset styles

These are form elements this plugin styles by default.

-
+
+ + -
- Checkboxes +
+ Checkboxes
-
-
- Radio Buttons + +
+ Radio Buttons
-
+
-
+

Untouched

These are form elements we don't handle (yet?), but we use this to make sure we haven't accidentally styled them by mistake.

-
+