@wwtdev/bsds-components-vue3 2.0.3 → 2.0.5

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/README.md CHANGED
@@ -19,7 +19,7 @@ import '@wwtdev/bsds-components-vue3/components.css'
19
19
  import '@wwtdev/bsds-icons-vue3/lib/style.css'
20
20
  ```
21
21
 
22
- **Note** that the CSS framework is _included_ in `@wwtdev/bsds-components-vue3/components.css`, along with a few additional styles needed for the Vue components. This means that you do not need to import `@wwtdev/bsds-css/dist/wwt-bsds.min.css` separately.
22
+ **Note** that the CSS framework is _included_ in `@wwtdev/bsds-components-vue3/components.css`, along with a few additional styles needed for the Vue components. This means that you do not need to import `@wwtdev/bsds-css/dist/wwt-bsds.min.css` separately. If you're using Tailwind in your project, see additional instructions below.
23
23
 
24
24
  #### Migration from v1
25
25
  1. Remove the `@wwtdev/bsds-components` package, as this Vue 3 package no longer depends on a base web component library.
@@ -56,3 +56,85 @@ import { BsIconCaretRight } from '@wwtdev/bsds-icons-vue3'
56
56
  </div>
57
57
  </template>
58
58
  ```
59
+
60
+ ### Usage with Tailwind
61
+
62
+ If you're using Tailwind in your project, you'll need to take additional steps as follows:
63
+
64
+ ### 1. Add the WWT Preset to the Tailwind config.
65
+
66
+ For new projects, we recommend that you use the provided config file as a [**preset**](https://tailwindcss.com/docs/presets). When setting up the `tailwind.config.js` file, import the WWT preset from the CSS Framework package. Note that `wwt-bsds-preset.js` sets `config.corePlugins.preflight: false` by default; we do this to apply our style resets instead of the Tailwind resets.
67
+
68
+ ```javascript
69
+ /* tailwind.config.js */
70
+
71
+ module.exports = {
72
+ presets: [require('@wwtdev/bsds-css/dist/wwt-bsds-preset.js')]
73
+ };
74
+ ```
75
+
76
+ While the foregoing setup is our recommended method, we have still put in effort to ensure that `wwt-bsds-preset.js` works as a [**base configuration**](https://tailwindcss.com/docs/configuration) in conjunction with the tailwind defaults and reset as well. So this _should_ still work as an alternative if needed, though it is not the focus/priority of our project:
77
+
78
+ ```javascript
79
+ /* tailwind.config.js */
80
+
81
+ const wwtConfig = require('@wwtdev/bsds-css/dist/wwt-bsds-preset.js')
82
+ module.exports = {
83
+ ...wwtConfig,
84
+ corePlugins: { preflight: false }
85
+ };
86
+ ```
87
+
88
+
89
+ ### 2. Tailwind CSS Directives
90
+
91
+ To prevent conflicts with our CSS Framework, only include the `base` and `utilities` directives.
92
+
93
+ Since our CSS has its own reset and default styles, we prevent Tailwind's `base` reset styles from loading, via a setting in our WWT Preset. The only styles that will be used from `base` are Tailwind CSS variables, which are needed in order to ensure all Tailwind classes work as expected.
94
+
95
+ ```css
96
+ /* src/styles/tailwind.css */
97
+
98
+ @tailwind base;
99
+ @tailwind utilities;
100
+ ```
101
+
102
+ Once you have completed the Tailwind installation steps, you can use the classes generated from the preset.
103
+
104
+ ### 3. Dark Mode-compatible "semantic" color utilities
105
+
106
+ We've extended the TW theme with color utilities that will automatically adjust when using dark mode. These classes require the CSS custom properties defined in the global stylesheet (`wwt-bsds.css`). If you're not bringing that stylesheet in, either disregard these classes or manually include the properties from [tokens.css](https://github.wwt.com/custom-apps/wwt-blue-steel/blob/main/packages/css-framework/src/styles/tokens.css) and [global.css](https://github.wwt.com/custom-apps/wwt-blue-steel/blob/main/packages/css-framework/src/styles/global.css) in your project.
107
+
108
+ ### 4. Order matters!
109
+
110
+ In your project's stylesheet ordering, the base Tailwind styles should come first, _then_ the BSDS CSS framework.
111
+
112
+ Vue example:
113
+
114
+ ```javascript
115
+ /* src/main.js */
116
+
117
+ // TW
118
+ import './styles/tailwind.css'
119
+
120
+ // Blue Steel Styles
121
+ import '@wwtdev/bsds-components-vue3/components.css'
122
+ import '@wwtdev/bsds-icons-vue3/lib/style.css'
123
+
124
+ ```
125
+
126
+ Nuxt example:
127
+
128
+ ```javascript
129
+ /* nuxt.config.js */
130
+
131
+ export default defineNuxtConfig({
132
+ ...
133
+ css: [
134
+ '~/assets/styles/tailwind.css',
135
+ '@wwtdev/bsds-components-vue3/components.css',
136
+ '@wwtdev/bsds-icons-vue3/lib/style.css'
137
+ ]
138
+ })
139
+
140
+ ```