activeadmin-tom_select 4.1.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.
Files changed (196) hide show
  1. checksums.yaml +7 -0
  2. data/.actrc +20 -0
  3. data/.claude/commands/fix-tests.md +203 -0
  4. data/.github/workflows/ci.yml +174 -0
  5. data/.github/workflows/npm-publish.yml +50 -0
  6. data/.gitignore +35 -0
  7. data/.npmignore +58 -0
  8. data/.rspec +1 -0
  9. data/.rubocop.yml +75 -0
  10. data/.yardopts +2 -0
  11. data/AGENTS.md +39 -0
  12. data/Appraisals +9 -0
  13. data/CHANGELOG.md +64 -0
  14. data/CLAUDE.md +157 -0
  15. data/Gemfile +12 -0
  16. data/Gemfile.lock +368 -0
  17. data/LICENSE.txt +25 -0
  18. data/README.md +483 -0
  19. data/Rakefile +4 -0
  20. data/activeadmin-tom_select.gemspec +43 -0
  21. data/bin/rspec +17 -0
  22. data/config/database.yml +16 -0
  23. data/docs/activeadmin-4-detailed-reference.md +932 -0
  24. data/docs/activeadmin-4-gem-migration-guide.md +313 -0
  25. data/docs/combustion.md +213 -0
  26. data/docs/fail.png +0 -0
  27. data/docs/guide-update-your-app.md +283 -0
  28. data/docs/normal.png +0 -0
  29. data/docs/propshaft-readme.md +320 -0
  30. data/docs/propshaft-upgrade.md +484 -0
  31. data/docs/setup-activeadmin-app.md +552 -0
  32. data/docs/setup-activeadmin-gem.md +535 -0
  33. data/docs/tailwind/blog-page.md +341 -0
  34. data/docs/tailwind/upgrade-guide-enhanced.md +438 -0
  35. data/docs/tailwind/upgrade-guide.md +416 -0
  36. data/docs/tailwind-4/active_admin.rake +38 -0
  37. data/docs/tailwind-4/active_admin.tailwind.css +415 -0
  38. data/docs/tailwind-4/tailwind-active_admin.config.js +18 -0
  39. data/docs/test-app-change.md +154 -0
  40. data/docs/test-environment-fixes.md +58 -0
  41. data/docs/update-tom-select.md +184 -0
  42. data/docs/upload-system.md +225 -0
  43. data/gemfiles/rails_7.x_active_admin_4.x.gemfile +10 -0
  44. data/gemfiles/rails_7.x_active_admin_4.x.gemfile.lock +377 -0
  45. data/gemfiles/rails_8.x_active_admin_4.x.gemfile +10 -0
  46. data/gemfiles/rails_8.x_active_admin_4.x.gemfile.lock +372 -0
  47. data/lefthook.yml +17 -0
  48. data/lib/activeadmin/inputs/filters/searchable_select_input.rb +19 -0
  49. data/lib/activeadmin/inputs/searchable_select_input.rb +16 -0
  50. data/lib/activeadmin/tom_select/engine.rb +17 -0
  51. data/lib/activeadmin/tom_select/option_collection.rb +128 -0
  52. data/lib/activeadmin/tom_select/resource_dsl_extension.rb +56 -0
  53. data/lib/activeadmin/tom_select/resource_extension.rb +10 -0
  54. data/lib/activeadmin/tom_select/select_input_extension.rb +168 -0
  55. data/lib/activeadmin/tom_select/version.rb +5 -0
  56. data/lib/activeadmin/tom_select.rb +20 -0
  57. data/lib/activeadmin-tom_select.rb +5 -0
  58. data/lib/generators/active_admin/tom_select/install/install_generator.rb +180 -0
  59. data/npm-package/package-lock.json +51 -0
  60. data/npm-package/package.json +43 -0
  61. data/npm-package/src/index.js +153 -0
  62. data/npm-package/src/tom-select-tailwind.css +392 -0
  63. data/sonar-project.properties +25 -0
  64. data/spec/features/ajax_params_spec.rb +31 -0
  65. data/spec/features/asset_pipeline_diagnostic_spec.rb +155 -0
  66. data/spec/features/end_to_end_spec.rb +273 -0
  67. data/spec/features/filter_input_spec.rb +144 -0
  68. data/spec/features/form_input_spec.rb +122 -0
  69. data/spec/features/inline_ajax_setting_spec.rb +26 -0
  70. data/spec/features/input_errors_spec.rb +76 -0
  71. data/spec/features/input_html_options_spec.rb +30 -0
  72. data/spec/features/options_dsl_spec.rb +230 -0
  73. data/spec/features/production_build_spec.rb +108 -0
  74. data/spec/internal/.node-version +1 -0
  75. data/spec/internal/Gemfile +43 -0
  76. data/spec/internal/Gemfile.lock +333 -0
  77. data/spec/internal/Procfile.dev +3 -0
  78. data/spec/internal/README.md +24 -0
  79. data/spec/internal/Rakefile +6 -0
  80. data/spec/internal/app/admin/categories.rb +26 -0
  81. data/spec/internal/app/admin/dashboard.rb +29 -0
  82. data/spec/internal/app/admin/option_types.rb +19 -0
  83. data/spec/internal/app/admin/option_values.rb +30 -0
  84. data/spec/internal/app/admin/posts.rb +27 -0
  85. data/spec/internal/app/admin/products.rb +22 -0
  86. data/spec/internal/app/admin/rgb_colors.rb +25 -0
  87. data/spec/internal/app/admin/tag_names.rb +21 -0
  88. data/spec/internal/app/admin/test_ajax_params_category.rb +10 -0
  89. data/spec/internal/app/admin/test_ajax_params_post.rb +20 -0
  90. data/spec/internal/app/admin/test_form_post_class.rb +7 -0
  91. data/spec/internal/app/admin/test_form_post_custom.rb +11 -0
  92. data/spec/internal/app/admin/test_form_post_resource.rb +11 -0
  93. data/spec/internal/app/admin/test_form_post_resource_custom.rb +12 -0
  94. data/spec/internal/app/admin/test_inline_ajax_post.rb +9 -0
  95. data/spec/internal/app/admin/test_input_html_post.rb +11 -0
  96. data/spec/internal/app/admin/test_posts_display_text.rb +9 -0
  97. data/spec/internal/app/admin/test_posts_filter.rb +9 -0
  98. data/spec/internal/app/admin/test_posts_named.rb +9 -0
  99. data/spec/internal/app/admin/test_posts_pagination.rb +9 -0
  100. data/spec/internal/app/admin/test_posts_payload_lambda.rb +11 -0
  101. data/spec/internal/app/admin/test_posts_payload_proc.rb +9 -0
  102. data/spec/internal/app/admin/test_posts_scope_lambda.rb +8 -0
  103. data/spec/internal/app/admin/test_posts_scope_params.rb +8 -0
  104. data/spec/internal/app/admin/test_posts_scope_user.rb +8 -0
  105. data/spec/internal/app/admin/test_posts_text_attr.rb +5 -0
  106. data/spec/internal/app/admin/users.rb +23 -0
  107. data/spec/internal/app/admin/variants.rb +31 -0
  108. data/spec/internal/app/assets/config/manifest.js +2 -0
  109. data/spec/internal/app/assets/images/.keep +0 -0
  110. data/spec/internal/app/assets/stylesheets/active_admin.tailwind.css +16 -0
  111. data/spec/internal/app/assets/stylesheets/application.tailwind.css +15 -0
  112. data/spec/internal/app/controllers/application_controller.rb +9 -0
  113. data/spec/internal/app/controllers/concerns/.keep +0 -0
  114. data/spec/internal/app/helpers/application_helper.rb +2 -0
  115. data/spec/internal/app/javascript/active_admin.js +19 -0
  116. data/spec/internal/app/javascript/application.js +2 -0
  117. data/spec/internal/app/jobs/application_job.rb +7 -0
  118. data/spec/internal/app/mailers/application_mailer.rb +4 -0
  119. data/spec/internal/app/models/admin_user.rb +9 -0
  120. data/spec/internal/app/models/application_record.rb +3 -0
  121. data/spec/internal/app/models/article.rb +12 -0
  122. data/spec/internal/app/models/category.rb +12 -0
  123. data/spec/internal/app/models/color.rb +9 -0
  124. data/spec/internal/app/models/concerns/.keep +0 -0
  125. data/spec/internal/app/models/internal/tag_name.rb +14 -0
  126. data/spec/internal/app/models/internal_tag_name.rb +11 -0
  127. data/spec/internal/app/models/option_type.rb +12 -0
  128. data/spec/internal/app/models/option_value.rb +4 -0
  129. data/spec/internal/app/models/post.rb +15 -0
  130. data/spec/internal/app/models/product.rb +12 -0
  131. data/spec/internal/app/models/rgb_color.rb +16 -0
  132. data/spec/internal/app/models/tag.rb +12 -0
  133. data/spec/internal/app/models/tagging.rb +12 -0
  134. data/spec/internal/app/models/user.rb +12 -0
  135. data/spec/internal/app/models/variant.rb +12 -0
  136. data/spec/internal/app/views/layouts/application.html.erb +28 -0
  137. data/spec/internal/app/views/layouts/mailer.html.erb +13 -0
  138. data/spec/internal/app/views/layouts/mailer.text.erb +1 -0
  139. data/spec/internal/app/views/pwa/manifest.json.erb +22 -0
  140. data/spec/internal/app/views/pwa/service-worker.js +26 -0
  141. data/spec/internal/bin/bundle +117 -0
  142. data/spec/internal/bin/dev +11 -0
  143. data/spec/internal/bin/rackup +27 -0
  144. data/spec/internal/bin/rails +4 -0
  145. data/spec/internal/bin/rake +4 -0
  146. data/spec/internal/bin/setup +37 -0
  147. data/spec/internal/config/application.rb +50 -0
  148. data/spec/internal/config/boot.rb +3 -0
  149. data/spec/internal/config/credentials.yml.enc +1 -0
  150. data/spec/internal/config/database.yml +32 -0
  151. data/spec/internal/config/environment.rb +5 -0
  152. data/spec/internal/config/environments/development.rb +63 -0
  153. data/spec/internal/config/environments/production.rb +86 -0
  154. data/spec/internal/config/environments/test.rb +50 -0
  155. data/spec/internal/config/initializers/active_admin.rb +54 -0
  156. data/spec/internal/config/initializers/assets.rb +8 -0
  157. data/spec/internal/config/initializers/content_security_policy.rb +25 -0
  158. data/spec/internal/config/initializers/devise.rb +315 -0
  159. data/spec/internal/config/initializers/filter_parameter_logging.rb +8 -0
  160. data/spec/internal/config/initializers/inflections.rb +16 -0
  161. data/spec/internal/config/initializers/searchable_select.rb +6 -0
  162. data/spec/internal/config/locales/devise.en.yml +65 -0
  163. data/spec/internal/config/locales/en.yml +31 -0
  164. data/spec/internal/config/master.key +1 -0
  165. data/spec/internal/config/puma.rb +38 -0
  166. data/spec/internal/config/routes.rb +17 -0
  167. data/spec/internal/config.ru +6 -0
  168. data/spec/internal/db/schema.rb +174 -0
  169. data/spec/internal/db/seeds.rb +167 -0
  170. data/spec/internal/esbuild.config.js +34 -0
  171. data/spec/internal/lib/tasks/.keep +0 -0
  172. data/spec/internal/lib/tasks/active_admin.rake +55 -0
  173. data/spec/internal/log/.keep +0 -0
  174. data/spec/internal/package-lock.json +1954 -0
  175. data/spec/internal/package.json +21 -0
  176. data/spec/internal/public/400.html +114 -0
  177. data/spec/internal/public/404.html +114 -0
  178. data/spec/internal/public/406-unsupported-browser.html +114 -0
  179. data/spec/internal/public/422.html +114 -0
  180. data/spec/internal/public/500.html +114 -0
  181. data/spec/internal/public/icon.png +0 -0
  182. data/spec/internal/public/icon.svg +3 -0
  183. data/spec/internal/public/robots.txt +1 -0
  184. data/spec/internal/script/.keep +0 -0
  185. data/spec/internal/storage/.keep +0 -0
  186. data/spec/internal/tailwind.config.js +23 -0
  187. data/spec/internal/vendor/.keep +0 -0
  188. data/spec/internal/yarn.lock +824 -0
  189. data/spec/rails_helper.rb +62 -0
  190. data/spec/spec_helper.rb +138 -0
  191. data/spec/support/active_admin_helpers.rb +17 -0
  192. data/spec/support/capybara.rb +8 -0
  193. data/spec/support/models.rb +11 -0
  194. data/spec/support/pluck_polyfill.rb +12 -0
  195. data/spec/support/reset_settings.rb +5 -0
  196. metadata +497 -0
@@ -0,0 +1,416 @@
1
+ Upgrading your Tailwind CSS projects from v3 to v4.
2
+
3
+ Tailwind CSS v4.0 is a new major version of the framework, so while we've worked really hard to minimize breaking changes, some updates are necessary. This guide outlines all the steps required to upgrade your projects from v3 to v4.
4
+
5
+ **Tailwind CSS v4.0 is designed for Safari 16.4+, Chrome 111+, and Firefox 128+.** If you need to support older browsers, stick with v3.4 until your browser support requirements change.
6
+
7
+ If you'd like to upgrade a project from v3 to v4, you can use our upgrade tool to do the vast majority of the heavy lifting for you:
8
+
9
+ ```
10
+ $ npx @tailwindcss/upgrade
11
+ ```
12
+
13
+ For most projects, the upgrade tool will automate the entire migration process including updating your dependencies, migrating your configuration file to CSS, and handling any changes to your template files.
14
+
15
+ The upgrade tool requires Node.js 20 or higher, so ensure your environment is updated before running it.
16
+
17
+ **We recommend running the upgrade tool in a new branch**, then carefully reviewing the diff and testing your project in the browser to make sure all of the changes look correct. You may need to tweak a few things by hand in complex projects, but the tool will save you a ton of time either way.
18
+
19
+ It's also a good idea to go over all of the [breaking changes](https://tailwindcss.com/docs/upgrade-guide#changes-from-v3) in v4 and get a good understanding of what's changed, in case there are other things you need to update in your project that the upgrade tool doesn't catch.
20
+
21
+ ## [Upgrading manually](https://tailwindcss.com/docs/upgrade-guide#upgrading-manually)
22
+
23
+ ### [Using PostCSS](https://tailwindcss.com/docs/upgrade-guide#using-postcss)
24
+
25
+ In v3, the `tailwindcss` package was a PostCSS plugin, but in v4 the PostCSS plugin lives in a dedicated `@tailwindcss/postcss` package.
26
+
27
+ Additionally, in v4 imports and vendor prefixing is now handled for you automatically, so you can remove `postcss-import` and `autoprefixer` if they are in your project:
28
+
29
+ ```
30
+ export default { plugins: { "postcss-import": {}, tailwindcss: {}, autoprefixer: {}, "@tailwindcss/postcss": {}, },};
31
+ ```
32
+
33
+ ### [Using Vite](https://tailwindcss.com/docs/upgrade-guide#using-vite)
34
+
35
+ If you're using Vite, we recommend migrating from the PostCSS plugin to our new dedicated Vite plugin for improved performance and the best developer experience:
36
+
37
+ ```
38
+ import { defineConfig } from "vite";import tailwindcss from "@tailwindcss/vite";export default defineConfig({ plugins: [ tailwindcss(), ],});
39
+ ```
40
+
41
+ ### [Using Tailwind CLI](https://tailwindcss.com/docs/upgrade-guide#using-tailwind-cli)
42
+
43
+ In v4, Tailwind CLI lives in a dedicated `@tailwindcss/cli` package. Update any of your build commands to use the new package instead:
44
+
45
+ ```
46
+ npx tailwindcss -i input.css -o output.cssnpx @tailwindcss/cli -i input.css -o output.css
47
+ ```
48
+
49
+ ## [Changes from v3](https://tailwindcss.com/docs/upgrade-guide#changes-from-v3)
50
+
51
+ Here's a comprehensive list of all the breaking changes in Tailwind CSS v4.0.
52
+
53
+ Our [upgrade tool](https://tailwindcss.com/docs/upgrade-guide#using-the-upgrade-tool) will handle most of these changes for you automatically, so we highly recommend using it if you can.
54
+
55
+ ### [Browser requirements](https://tailwindcss.com/docs/upgrade-guide#browser-requirements)
56
+
57
+ Tailwind CSS v4.0 is designed for modern browsers and targets Safari 16.4, Chrome 111, and Firefox 128. We depend on modern CSS features like `@property` and `color-mix()` for core framework features, and Tailwind CSS v4.0 will not work in older browsers.
58
+
59
+ If you need to support older browsers, we recommend sticking with v3.4 for now. We're actively exploring a compatibility mode to help people upgrade sooner that we hope to share more news on in the future.
60
+
61
+ ### [Removed @tailwind directives](https://tailwindcss.com/docs/upgrade-guide#removed-tailwind-directives)
62
+
63
+ In v4 you import Tailwind using a regular CSS `@import` statement, not using the `@tailwind` directives you used in v3:
64
+
65
+ ```
66
+ @tailwind base;@tailwind components;@tailwind utilities;@import "tailwindcss";
67
+ ```
68
+
69
+ ### [Removed deprecated utilities](https://tailwindcss.com/docs/upgrade-guide#removed-deprecated-utilities)
70
+
71
+ We've removed any utilities that were deprecated in v3 and have been undocumented for several years. Here's a list of what's been removed along with the modern alternative:
72
+
73
+ | Deprecated | Replacement |
74
+ | --- | --- |
75
+ | `bg-opacity-*` | Use opacity modifiers like `bg-black/50` |
76
+ | `text-opacity-*` | Use opacity modifiers like `text-black/50` |
77
+ | `border-opacity-*` | Use opacity modifiers like `border-black/50` |
78
+ | `divide-opacity-*` | Use opacity modifiers like `divide-black/50` |
79
+ | `ring-opacity-*` | Use opacity modifiers like `ring-black/50` |
80
+ | `placeholder-opacity-*` | Use opacity modifiers like `placeholder-black/50` |
81
+ | `flex-shrink-*` | `shrink-*` |
82
+ | `flex-grow-*` | `grow-*` |
83
+ | `overflow-ellipsis` | `text-ellipsis` |
84
+ | `decoration-slice` | `box-decoration-slice` |
85
+ | `decoration-clone` | `box-decoration-clone` |
86
+
87
+ ### [Renamed utilities](https://tailwindcss.com/docs/upgrade-guide#renamed-utilities)
88
+
89
+ We've renamed the following utilities in v4 to make them more consistent and predictable:
90
+
91
+ | v3 | v4 |
92
+ | --- | --- |
93
+ | `shadow-sm` | `shadow-xs` |
94
+ | `shadow` | `shadow-sm` |
95
+ | `drop-shadow-sm` | `drop-shadow-xs` |
96
+ | `drop-shadow` | `drop-shadow-sm` |
97
+ | `blur-sm` | `blur-xs` |
98
+ | `blur` | `blur-sm` |
99
+ | `backdrop-blur-sm` | `backdrop-blur-xs` |
100
+ | `backdrop-blur` | `backdrop-blur-sm` |
101
+ | `rounded-sm` | `rounded-xs` |
102
+ | `rounded` | `rounded-sm` |
103
+ | `outline-none` | `outline-hidden` |
104
+ | `ring` | `ring-3` |
105
+
106
+ #### [Updated shadow, radius, and blur scales](https://tailwindcss.com/docs/upgrade-guide#updated-shadow-radius-and-blur-scales)
107
+
108
+ We've renamed the default shadow, radius and blur scales to make sure every utility has a named value. The "bare" versions still work for backward compatibility, but the `_<utility>_-sm` utilities will look different unless updated to their respective `_<utility>_-xs` versions.
109
+
110
+ To update your project for these changes, replace all the v3 utilities with their v4 versions:
111
+
112
+ ```
113
+ <input class="shadow-sm" /><input class="shadow-xs" /><input class="shadow" /><input class="shadow-sm" />
114
+ ```
115
+
116
+ #### [Renamed outline utility](https://tailwindcss.com/docs/upgrade-guide#renamed-outline-utility)
117
+
118
+ The `outline` utility now sets `outline-width: 1px` by default to be more consistent with border and ring utilities. Furthermore all `outline-<number>` utilities default `outline-style` to `solid`, omitting the need to combine them with `outline`:
119
+
120
+ ```
121
+ <input class="outline outline-2" /><input class="outline-2" />
122
+ ```
123
+
124
+ The `outline-none` utility previously didn't actually set `outline-style: none`, and instead set an invisible outline that would still show up in forced colors mode for accessibility reasons.
125
+
126
+ To make this more clear we've renamed this utility to `outline-hidden` and added a new `outline-none` utility that actually sets `outline-style: none`.
127
+
128
+ To update your project for this change, replace any usage of `outline-none` with `outline-hidden`:
129
+
130
+ ```
131
+ <input class="focus:outline-none" /><input class="focus:outline-hidden" />
132
+ ```
133
+
134
+ #### [Default ring width change](https://tailwindcss.com/docs/upgrade-guide#default-ring-width-change)
135
+
136
+ In v3, the `ring` utility added a `3px` ring. We've changed this in v4 to be `1px` to make it consistent with borders and outlines.
137
+
138
+ To update your project for this change, replace any usage of `ring` with `ring-3`:
139
+
140
+ ```
141
+ <input class="ring ring-blue-500" /><input class="ring-3 ring-blue-500" />
142
+ ```
143
+
144
+ ### [Space-between selector](https://tailwindcss.com/docs/upgrade-guide#space-between-selector)
145
+
146
+ We've changed the selector used by the [`space-x-*` and `space-y-*` utilities](https://tailwindcss.com/docs/margin#adding-space-between-children) to address serious performance issues on large pages:
147
+
148
+ ```
149
+ /* Before */.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem;}/* Now */.space-y-4 > :not(:last-child) { margin-bottom: 1rem;}
150
+ ```
151
+
152
+ You might see changes in your project if you were ever using these utilities with inline elements, or if you were adding other margins to child elements to tweak their spacing.
153
+
154
+ If this change causes any issues in your project, we recommend migrating to a flex or grid layout and using `gap` instead:
155
+
156
+ ```
157
+ <div class="space-y-4 p-4"><div class="flex flex-col gap-4 p-4"> <label for="name">Name</label> <input type="text" name="name" /></div>
158
+ ```
159
+
160
+ ### [Using variants with gradients](https://tailwindcss.com/docs/upgrade-guide#using-variants-with-gradients)
161
+
162
+ In v3, overriding part of a gradient with a variant would "reset" the entire gradient, so in this example the `to-*` color would be transparent in dark mode instead of yellow:
163
+
164
+ ```
165
+ <div class="bg-gradient-to-r from-red-500 to-yellow-400 dark:from-blue-500"> <!-- ... --></div>
166
+ ```
167
+
168
+ In v4, these values are preserved which is more consistent with how other utilities in Tailwind work.
169
+
170
+ This means you may need to explicitly use `via-none` if you want to "unset" a three-stop gradient back to a two-stop gradient in a specific state:
171
+
172
+ ```
173
+ <div class="bg-linear-to-r from-red-500 via-orange-400 to-yellow-400 dark:via-none dark:from-blue-500 dark:to-teal-400"> <!-- ... --></div>
174
+ ```
175
+
176
+ ### [Container configuration](https://tailwindcss.com/docs/upgrade-guide#container-configuration)
177
+
178
+ In v3, the `container` utility had several configuration options like `center` and `padding` that no longer exist in v4.
179
+
180
+ To customize the `container` utility in v4, extend it using the `@utility` directive:
181
+
182
+ ```
183
+ @utility container { margin-inline: auto; padding-inline: 2rem;}
184
+ ```
185
+
186
+ ### [Default border color](https://tailwindcss.com/docs/upgrade-guide#default-border-color)
187
+
188
+ In v3, the `border-*` and `divide-*` utilities used your configured `gray-200` color by default. We've changed this to `currentColor` in v4 to make Tailwind less opinionated and match browser defaults.
189
+
190
+ To update your project for this change, make sure you specify a color anywhere you're using a `border-*` or `divide-*` utility:
191
+
192
+ ```
193
+ <div class="border border-gray-200 px-2 py-3 ..."> <!-- ... --></div>
194
+ ```
195
+
196
+ Alternatively, add these base styles to your project to preserve the v3 behavior:
197
+
198
+ ```
199
+ @layer base { *, ::after, ::before, ::backdrop, ::file-selector-button { border-color: var(--color-gray-200, currentColor); }}
200
+ ```
201
+
202
+ ### [Default ring width and color](https://tailwindcss.com/docs/upgrade-guide#default-ring-width-and-color)
203
+
204
+ We've changed the width of the `ring` utility from 3px to 1px and changed the default color from `blue-500` to `currentColor` to make things more consistent the `border-*`, `divide-*`, and `outline-*` utilities.
205
+
206
+ To update your project for these changes, replace any use of `ring` with `ring-3`:
207
+
208
+ ```
209
+ <button class="focus:ring ..."><button class="focus:ring-3 ..."> <!-- ... --></button>
210
+ ```
211
+
212
+ Then make sure to add `ring-blue-500` anywhere you were depending on the default ring color:
213
+
214
+ ```
215
+ <button class="focus:ring-3 focus:ring-blue-500 ..."> <!-- ... --></button>
216
+ ```
217
+
218
+ Alternatively, add these theme variables to your CSS to preserve the v3 behavior:
219
+
220
+ ```
221
+ @theme { --default-ring-width: 3px; --default-ring-color: var(--color-blue-500);}
222
+ ```
223
+
224
+ Note though that these variables are only supported for compatibility reasons, and are not considered idiomatic usage of Tailwind CSS v4.0.
225
+
226
+ ### [Preflight changes](https://tailwindcss.com/docs/upgrade-guide#preflight-changes)
227
+
228
+ We've made a couple small changes to the base styles in Preflight in v4:
229
+
230
+ #### [New default placeholder color](https://tailwindcss.com/docs/upgrade-guide#new-default-placeholder-color)
231
+
232
+ In v3, placeholder text used your configured `gray-400` color by default. We've simplified this in v4 to just use the current text color at 50% opacity.
233
+
234
+ You probably won't even notice this change (it might even make your project look better), but if you want to preserve the v3 behavior, add this CSS to your project:
235
+
236
+ ```
237
+ @layer base { input::placeholder, textarea::placeholder { color: var(--color-gray-400); }}
238
+ ```
239
+
240
+ #### [Buttons use the default cursor](https://tailwindcss.com/docs/upgrade-guide#buttons-use-the-default-cursor)
241
+
242
+ Buttons now use `cursor: default` instead of `cursor: pointer` to match the default browser behavior.
243
+
244
+ If you'd like to continue using `cursor: pointer` by default, add these base styles to your CSS:
245
+
246
+ ```
247
+ @layer base { button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; }}
248
+ ```
249
+
250
+ #### [Dialog margins removed](https://tailwindcss.com/docs/upgrade-guide#dialog-margins-removed)
251
+
252
+ Preflight now resets margins on `<dialog>` elements to be consistent with how other elements are reset.
253
+
254
+ If you still want dialogs to be centered by default, add this CSS to your project:
255
+
256
+ ```
257
+ @layer base { dialog { margin: auto; }}
258
+ ```
259
+
260
+ ### [Using a prefix](https://tailwindcss.com/docs/upgrade-guide#using-a-prefix)
261
+
262
+ Prefixes now look like variants and are always at the beginning of the class name:
263
+
264
+ ```
265
+ <div class="tw:flex tw:bg-red-500 tw:hover:bg-red-600"> <!-- ... --></div>
266
+ ```
267
+
268
+ When using a prefix, you should still configure your theme variables as if you aren't using a prefix:
269
+
270
+ ```
271
+ @import "tailwindcss" prefix(tw);@theme { --font-display: "Satoshi", "sans-serif"; --breakpoint-3xl: 120rem; --color-avocado-100: oklch(0.99 0 0); --color-avocado-200: oklch(0.98 0.04 113.22); --color-avocado-300: oklch(0.94 0.11 115.03); /* ... */}
272
+ ```
273
+
274
+ The generated CSS variables _will_ include a prefix to avoid conflicts with any existing variables in your project:
275
+
276
+ ```
277
+ :root { --tw-font-display: "Satoshi", "sans-serif"; --tw-breakpoint-3xl: 120rem; --tw-color-avocado-100: oklch(0.99 0 0); --tw-color-avocado-200: oklch(0.98 0.04 113.22); --tw-color-avocado-300: oklch(0.94 0.11 115.03); /* ... */}
278
+ ```
279
+
280
+ ### [Adding custom utilities](https://tailwindcss.com/docs/upgrade-guide#adding-custom-utilities)
281
+
282
+ In v3, any custom classes you defined within `@layer utilities` or `@layer components` would get picked up by Tailwind as a true utility class and would automatically work with variants like `hover`, `focus`, or `lg` with the difference being that `@layer components` would always come first in the generated stylesheet.
283
+
284
+ In v4 we are using native cascade layers and no longer hijacking the `@layer` at-rule, so we've introduced the `@utility` API as a replacement:
285
+
286
+ ```
287
+ @layer utilities { .tab-4 { tab-size: 4; }}@utility tab-4 { tab-size: 4;}
288
+ ```
289
+
290
+ Custom utilities are now also sorted based on the amount of properties they define. This means that component utilities like this `.btn` can be overwritten by other Tailwind utilities without additional configuration:
291
+
292
+ ```
293
+ @layer components { .btn { border-radius: 0.5rem; padding: 0.5rem 1rem; background-color: ButtonFace; }}@utility btn { border-radius: 0.5rem; padding: 0.5rem 1rem; background-color: ButtonFace;}
294
+ ```
295
+
296
+ Learn more about registering custom utilities in the [adding custom utilities documentation](https://tailwindcss.com/docs/adding-custom-styles#adding-custom-utilities).
297
+
298
+ ### [Variant stacking order](https://tailwindcss.com/docs/upgrade-guide#variant-stacking-order)
299
+
300
+ In v3, stacked variants were applied from right to left, but in v4 we've updated them to apply left to right to look more like CSS syntax.
301
+
302
+ To update your project for this change, reverse the order of any order-sensitive stacked variants in your project:
303
+
304
+ ```
305
+ <ul class="py-4 first:*:pt-0 last:*:pb-0"><ul class="py-4 *:first:pt-0 *:last:pb-0"> <li>One</li> <li>Two</li> <li>Three</li></ul>
306
+ ```
307
+
308
+ You likely have very few of these if any—the direct child variant (`*`) and any typography plugin variants (`prose-headings`) are the most likely ones you might be using, and even then it's only if you've stacked them with other variants.
309
+
310
+ ### [Variables in arbitrary values](https://tailwindcss.com/docs/upgrade-guide#variables-in-arbitrary-values)
311
+
312
+ In v3 you were able to use CSS variables as arbitrary values without `var()`, but recent updates to CSS mean that this can often be ambiguous, so we've changed the syntax for this in v4 to use parentheses instead of square brackets.
313
+
314
+ To update your project for this change, replace usage of the old variable shorthand syntax with the new variable shorthand syntax:
315
+
316
+ ```
317
+ <div class="bg-[--brand-color]"></div><div class="bg-(--brand-color)"></div>
318
+ ```
319
+
320
+ ### [Hover styles on mobile](https://tailwindcss.com/docs/upgrade-guide#hover-styles-on-mobile)
321
+
322
+ In v4 we've updated the `hover` variant to only apply when the primary input device supports hover:
323
+
324
+ ```
325
+ @media (hover: hover) { .hover\:underline:hover { text-decoration: underline; }}
326
+ ```
327
+
328
+ This can create problems if you've built your site in a way that depends on touch devices triggering hover on tap. If this is an issue for you, you can override the `hover` variant with your own variant that uses the old implementation:
329
+
330
+ ```
331
+ @custom-variant hover (&:hover);
332
+ ```
333
+
334
+ Generally though we recommend treating hover functionality as an enhancement, and not depending on it for your site to work since touch devices don't truly have the ability to hover.
335
+
336
+ ### [Transitioning outline-color](https://tailwindcss.com/docs/upgrade-guide#transitioning-outline-color)
337
+
338
+ The `transition` and `transition-color` utilities now include the `outline-color` property.
339
+
340
+ This means if you were adding an outline with a custom color on focus, you will see the color transition from the default color. To avoid this, make sure you set the outline color unconditionally, or explicitly set it for both states:
341
+
342
+ ```
343
+ <button class="transition hover:outline-2 hover:outline-cyan-500"></button><button class="outline-cyan-500 transition hover:outline-2"></button>
344
+ ```
345
+
346
+ ### [Disabling core plugins](https://tailwindcss.com/docs/upgrade-guide#disabling-core-plugins)
347
+
348
+ In v3 there was a `corePlugins` option you could use to completely disable certain utilities in the framework. This is no longer supported in v4.
349
+
350
+ ### [Using the theme() function](https://tailwindcss.com/docs/upgrade-guide#using-the-theme-function)
351
+
352
+ Since v4 includes CSS variables for all of your theme values, we recommend using those variables instead of the `theme()` function whenever possible:
353
+
354
+ ```
355
+ .my-class { background-color: theme(colors.red.500); background-color: var(--color-red-500);}
356
+ ```
357
+
358
+ For cases where you still need to use the `theme()` function (like in media queries where CSS variables aren't supported), you should use the CSS variable name instead of the old dot notation:
359
+
360
+ ```
361
+ @media (width >= theme(screens.xl)) {@media (width >= theme(--breakpoint-xl)) { /* ... */}
362
+ ```
363
+
364
+ ### [Using a JavaScript config file](https://tailwindcss.com/docs/upgrade-guide#using-a-javascript-config-file)
365
+
366
+ JavaScript config files are still supported for backward compatibility, but they are no longer detected automatically in v4.
367
+
368
+ If you still need to use a JavaScript config file, you can load it explicitly using the `@config` directive:
369
+
370
+ ```
371
+ @config "../../tailwind.config.js";
372
+ ```
373
+
374
+ The `corePlugins`, `safelist`, and `separator` options from the JavaScript-based config are not supported in v4.0. To safelist utilities in v4 use [`@source inline()`](https://tailwindcss.com/docs/detecting-classes-in-source-files#safelisting-specific-utilities).
375
+
376
+ ### [Theme values in JavaScript](https://tailwindcss.com/docs/upgrade-guide#theme-values-in-javascript)
377
+
378
+ In v3 we exported a `resolveConfig` function that you could use to turn your JavaScript-based config into a flat object that you could use in your other JavaScript.
379
+
380
+ We've removed this in v4 in hopes that people can use the CSS variables we generate directly instead, which is much simpler and will significantly reduce your bundle size.
381
+
382
+ For example, the popular [Motion](https://motion.dev/docs/react-quick-start) library for React lets you animate to and from CSS variable values:
383
+
384
+ ```
385
+ <motion.div animate={{ backgroundColor: "var(--color-blue-500)" }} />
386
+ ```
387
+
388
+ If you need access to a resolved CSS variable value in JS, you can use `getComputedStyle` to get the value of a theme variable on the document root:
389
+
390
+ ```
391
+ let styles = getComputedStyle(document.documentElement);let shadow = styles.getPropertyValue("--shadow-xl");
392
+ ```
393
+
394
+ ### [Using @apply with Vue, Svelte, or CSS modules](https://tailwindcss.com/docs/upgrade-guide#using-apply-with-vue-svelte-or-css-modules)
395
+
396
+ In v4, stylesheets that are bundled separately from your main CSS file (e.g. CSS modules files, `<style>` blocks in Vue, Svelte, or Astro, etc.) do not have access to theme variables, custom utilities, and custom variants defined in other files.
397
+
398
+ To make these definitions available in these contexts, use [`@reference`](https://tailwindcss.com/docs/functions-and-directives#reference-directive) to import them without duplicating any CSS in your bundle:
399
+
400
+ ```
401
+ <template> <h1>Hello world!</h1></template><style> @reference "../../app.css"; h1 { @apply text-2xl font-bold text-red-500; }</style>
402
+ ```
403
+
404
+ Alternatively, you can use your CSS theme variables directly instead of using `@apply` at all, which will also improve performance since Tailwind won't need to process these styles:
405
+
406
+ ```
407
+ <template> <h1>Hello world!</h1></template><style> h1 { color: var(--text-red-500); }</style>
408
+ ```
409
+
410
+ You can find more documentation on [using Tailwind with CSS modules](https://tailwindcss.com/docs/compatibility#css-modules).
411
+
412
+ ### [Using Sass, Less, and Stylus](https://tailwindcss.com/docs/upgrade-guide#using-sass-less-and-stylus)
413
+
414
+ Tailwind CSS v4.0 is not designed to be used with CSS preprocessors like Sass, Less, or Stylus. Think of Tailwind CSS itself as your preprocessor — you shouldn't use Tailwind with Sass for the same reason you wouldn't use Sass with Stylus. Because of this it is not possible to use Sass, Less, or Stylus for your stylesheets or `<style>` blocks in Vue, Svelte, Astro, etc.
415
+
416
+ Learn more in the [compatibility documentation](https://tailwindcss.com/docs/compatibility#sass-less-and-stylus).
@@ -0,0 +1,38 @@
1
+ namespace :active_admin do
2
+ desc 'Build Active Admin Tailwind stylesheets'
3
+ task build: :environment do
4
+ command = [
5
+ Rails.root.join('bin/tailwindcss').to_s,
6
+ '-i', Rails.root.join('app/assets/stylesheets/active_admin.tailwind.css').to_s,
7
+ '-o', Rails.root.join('app/assets/builds/active_admin.css').to_s,
8
+ '-m'
9
+ ]
10
+
11
+ system(*command, exception: true)
12
+ end
13
+
14
+ desc 'Watch Active Admin Tailwind stylesheets'
15
+ task watch: :environment do
16
+ command = [
17
+ Rails.root.join('bin/tailwindcss').to_s,
18
+ '--watch',
19
+ '-i', Rails.root.join('app/assets/stylesheets/active_admin.tailwind.css').to_s,
20
+ '-o', Rails.root.join('app/assets/builds/active_admin.css').to_s,
21
+ '-m'
22
+ ]
23
+
24
+ system(*command)
25
+ end
26
+ end
27
+
28
+ Rake::Task['assets:precompile'].enhance(['active_admin:build'])
29
+
30
+ if Rake::Task.task_defined?('test:prepare')
31
+ Rake::Task['test:prepare'].enhance(['active_admin:build'])
32
+ end
33
+ if Rake::Task.task_defined?('spec:prepare')
34
+ Rake::Task['spec:prepare'].enhance(['tailwindcss:build'])
35
+ end
36
+ if Rake::Task.task_defined?('db:test:prepare')
37
+ Rake::Task['db:test:prepare'].enhance(['tailwindcss:build'])
38
+ end