@wwtdev/bsds-components-vue3 3.2.2 → 3.2.3
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 +2 -199
- package/lib/bsds-components.js +1412 -1386
- package/lib/bsds-components.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,200 +1,3 @@
|
|
|
1
|
-
# BSDS Components
|
|
2
|
-
|
|
3
|
-
## Installation & Usage
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
npm install --save @wwtdev/bsds-components-vue3
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
### Vue App Setup
|
|
10
|
-
|
|
11
|
-
Add the following to your `main.js` file to import styles:
|
|
12
|
-
|
|
13
|
-
```javascript
|
|
14
|
-
/* Blue Steel Styles
|
|
15
|
-
@wwtdev/bsds-css and @wwtdev/bsds-icons-vue3
|
|
16
|
-
will be installed as dependencies of this package
|
|
17
|
-
*/
|
|
18
|
-
import '@wwtdev/bsds-components-vue3/components.css'
|
|
19
|
-
import '@wwtdev/bsds-icons-vue3/lib/style.css' // see note below re ^2.0.6
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**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.*
|
|
24
|
-
|
|
25
|
-
*Starting from v2.0.6, the icon styles are also included in `@wwtdev/bsds-components-vue3/components.css`. This means that you do not need to import `@wwtdev/bsds-icons-vue3/lib/style.css` separately, either.
|
|
26
|
-
|
|
27
|
-
**If you're using Tailwind in your project,** see additional instructions below.
|
|
28
|
-
|
|
29
|
-
#### Migration from v1
|
|
30
|
-
1. Remove the `@wwtdev/bsds-components` package, as this Vue 3 package no longer depends on a base web component library.
|
|
31
|
-
2. This package no longer provides or requires a Vue plugin, so remove any imports / logic related to that.
|
|
32
|
-
3. These components no longer render custom element tags (e.g., `<bs-input-field>` is now `<div data-component="bs-input-field">`), so if you have any CSS rules or DOM-related logic that relied on the previous version's custom element tag selectors, you'll need to update those accordingly.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
### Nuxt App Setup
|
|
36
|
-
|
|
37
|
-
Add the following to your `nuxt.config.js` file to import styles:
|
|
38
|
-
|
|
39
|
-
```javascript
|
|
40
|
-
export default defineNuxtConfig({
|
|
41
|
-
...
|
|
42
|
-
css: [
|
|
43
|
-
'@wwtdev/bsds-components-vue3/components.css',
|
|
44
|
-
'@wwtdev/bsds-icons-vue3/lib/style.css'
|
|
45
|
-
],
|
|
46
|
-
...
|
|
47
|
-
})
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Usage
|
|
51
|
-
```javascript
|
|
52
|
-
<script setup>
|
|
53
|
-
import { BsButton } from '@wwtdev/bsds-components-vue3'
|
|
54
|
-
import { BsIconCaretRight } from '@wwtdev/bsds-icons-vue3'
|
|
55
|
-
</script>
|
|
56
|
-
|
|
57
|
-
<template>
|
|
58
|
-
<div>
|
|
59
|
-
<BsButton>Hello World!</BsButton>
|
|
60
|
-
<BsIconCaretRight />
|
|
61
|
-
</div>
|
|
62
|
-
</template>
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Usage with Tailwind
|
|
66
|
-
|
|
67
|
-
If you're using Tailwind in your project, you'll need to take additional steps as follows:
|
|
68
|
-
|
|
69
|
-
### 1. Add the WWT Preset to the Tailwind config.
|
|
70
|
-
|
|
71
|
-
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.
|
|
72
|
-
|
|
73
|
-
```javascript
|
|
74
|
-
/* tailwind.config.js */
|
|
75
|
-
|
|
76
|
-
module.exports = {
|
|
77
|
-
presets: [require('@wwtdev/bsds-css/dist/wwt-bsds-preset.js')]
|
|
78
|
-
};
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
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:
|
|
82
|
-
|
|
83
|
-
```javascript
|
|
84
|
-
/* tailwind.config.js */
|
|
85
|
-
|
|
86
|
-
const wwtConfig = require('@wwtdev/bsds-css/dist/wwt-bsds-preset.js')
|
|
87
|
-
module.exports = {
|
|
88
|
-
...wwtConfig,
|
|
89
|
-
corePlugins: { preflight: false }
|
|
90
|
-
};
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
### 2. Tailwind CSS Directives
|
|
95
|
-
|
|
96
|
-
To prevent conflicts with our CSS Framework, only include the `base` and `utilities` directives.
|
|
97
|
-
|
|
98
|
-
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.
|
|
99
|
-
|
|
100
|
-
```css
|
|
101
|
-
/* src/styles/tailwind.css */
|
|
102
|
-
|
|
103
|
-
@tailwind base;
|
|
104
|
-
@tailwind utilities;
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Once you have completed the Tailwind installation steps, you can use the classes generated from the preset.
|
|
108
|
-
|
|
109
|
-
### 3. App setup w/ Tailwind and BSDS Styles
|
|
110
|
-
|
|
111
|
-
Vue example:
|
|
112
|
-
|
|
113
|
-
```javascript
|
|
114
|
-
/* src/main.js */
|
|
115
|
-
|
|
116
|
-
// Blue Steel Styles
|
|
117
|
-
import '@wwtdev/bsds-components-vue3/components.css'
|
|
118
|
-
import '@wwtdev/bsds-icons-vue3/lib/style.css' // separate icon styles not needed from v2.0.6
|
|
119
|
-
|
|
120
|
-
// TW
|
|
121
|
-
import './styles/tailwind.css'
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Nuxt example:
|
|
126
|
-
|
|
127
|
-
```javascript
|
|
128
|
-
/* nuxt.config.js */
|
|
129
|
-
|
|
130
|
-
export default defineNuxtConfig({
|
|
131
|
-
...
|
|
132
|
-
css: [
|
|
133
|
-
'@wwtdev/bsds-components-vue3/components.css',
|
|
134
|
-
'@wwtdev/bsds-icons-vue3/lib/style.css', // separate icon styles not needed from v2.0.6
|
|
135
|
-
'~/assets/styles/tailwind.css',
|
|
136
|
-
]
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
#### Using CSS Layers with Tailwind
|
|
142
|
-
|
|
143
|
-
You can optionally leverage native CSS `@layer` to ensure TW utilities will always trump the component styles for easier overrides.
|
|
144
|
-
|
|
145
|
-
```css
|
|
146
|
-
/* src/styles/index.css (or wherever your app styles live) */
|
|
147
|
-
|
|
148
|
-
@layer app-base, external, app, utils;
|
|
149
|
-
|
|
150
|
-
/* -- BASE -- */
|
|
151
|
-
@import "@wwtdev/bsds-components-vue3/components.css" layer(app-base);
|
|
152
|
-
|
|
153
|
-
/* -- EXTERNAL: any external stylesheets, e.g. from other 3d party libs -- */
|
|
154
|
-
@import "some-other-pkg/dist/style.css" layer(external);
|
|
155
|
-
|
|
156
|
-
/* -- APP / INTERNAL STYLES, e.g. your site's base styles --
|
|
157
|
-
All .vue <style> code will automatically be added to this layer (see "vueWrapCssWithLayerPlugin" in vite.config.js)
|
|
158
|
-
*/
|
|
159
|
-
@import "some-content.css" layer(app);
|
|
160
|
-
|
|
161
|
-
/* -- UTILITY CLASSES --
|
|
162
|
-
Due to how native CSS @layer works, and our defined layer order at the top of this file, utility classes will always trump any other styles in the app (as long as those styles are in one of our defined layers)
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
|
-
@layer utils {
|
|
166
|
-
@tailwind base;
|
|
167
|
-
@tailwind utilities;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
And then in your vite config:
|
|
173
|
-
|
|
174
|
-
```javascript
|
|
175
|
-
/* vite.config.js */
|
|
176
|
-
|
|
177
|
-
// We'll need a plugin to pick up styles from our app's Vue SFCs and add them to the app layer
|
|
178
|
-
const vueWrapCssWithLayerPlugin = {
|
|
179
|
-
name: 'vue-wrap-css-with-layer',
|
|
180
|
-
transform(code, id) {
|
|
181
|
-
// if not a .vue <style> block, do nothing
|
|
182
|
-
if (!/vue&type=style/.test(id)) return
|
|
183
|
-
|
|
184
|
-
// wrap the <style> code in our "app" css layer (ensures utility classes always trump other styles, see index.css)
|
|
185
|
-
return { code: `@layer app { ${code} }`, map: null }
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export default defineConfig({
|
|
190
|
-
plugins: [ ...yourOtherPlugins, vueWrapCssWithLayerPlugin ],
|
|
191
|
-
/*
|
|
192
|
-
*** other configs **
|
|
193
|
-
*/
|
|
194
|
-
})
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
### 4. Dark Mode-compatible "semantic" color utilities
|
|
198
|
-
|
|
199
|
-
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.com/wwt-custom-apps/wwt-blue-steel/blob/main/packages/css-framework/src/styles/tokens.css) and [global.css](https://github.com/wwt-custom-apps/wwt-blue-steel/blob/main/packages/css-framework/src/styles/global.css) in your project.
|
|
1
|
+
# BSDS Vue 3 Components
|
|
200
2
|
|
|
3
|
+
Vue 3 component library for the [Blue Steel Design System](https://design.apps.wwt.com), built and maintained by [WWT](https://www.wwt.com). The library provides accessible, themeable components that implement WWT's brand design language on top of the [`@wwtdev/bsds-css`](https://www.npmjs.com/package/@wwtdev/bsds-css) framework.
|