@mindvalley/design-system 3.4.2 â 4.0.1
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/CHANGELOG.md +90 -2
- package/dist/b2b.d.ts +45 -45
- package/dist/b2b.d.ts.map +1 -1
- package/dist/b2b.js +1 -1
- package/dist/b2b.js.map +1 -1
- package/dist/helpers/casing.d.ts.map +1 -1
- package/dist/helpers/casing.js +21 -23
- package/dist/helpers/dimens.d.ts +1 -0
- package/dist/helpers/dimens.d.ts.map +1 -1
- package/dist/helpers/dimens.js +11 -2
- package/dist/helpers/regex.d.ts.map +1 -1
- package/dist/index.d.ts +98 -83
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tailwind/plugins/tokens/b2b/typography.d.ts.map +1 -1
- package/dist/tailwind/plugins/tokens/b2b/typography.js +25 -26
- package/dist/tailwind/plugins/tokens/mindvalley/typography.d.ts.map +1 -1
- package/dist/tailwind/plugins/tokens/mindvalley/typography.js +60 -67
- package/dist/tailwind/plugins/typography.d.ts.map +1 -1
- package/dist/tailwind/plugins/typography.js +25 -15
- package/dist/typography/b2b/fonts.css +19 -0
- package/dist/typography/b2b/fonts.d.ts +8 -0
- package/dist/typography/b2b/fonts.js +30 -0
- package/dist/typography/mindvalley/fonts.css +43 -0
- package/dist/typography/mindvalley/fonts.d.ts +8 -0
- package/dist/typography/mindvalley/fonts.js +54 -0
- package/docs/USAGE.md +121 -76
- package/docs/typography-fonts.md +552 -0
- package/docs/typography-token-pipeline-b2b.md +156 -0
- package/package.json +17 -3
- package/docs/token-validation.md +0 -298
package/docs/USAGE.md
CHANGED
|
@@ -12,7 +12,7 @@ npm install @mindvalley/design-system
|
|
|
12
12
|
yarn add @mindvalley/design-system
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
The package supports both ES module syntax and
|
|
15
|
+
The package supports both ES module syntax and CommonJS syntax.
|
|
16
16
|
|
|
17
17
|
#### *ES module syntax*
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ The package supports both ES module syntax and commonJS syntax
|
|
|
20
20
|
import { colors } from '@mindvalley/design-system'
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
#### *
|
|
23
|
+
#### *CommonJS syntax*
|
|
24
24
|
|
|
25
25
|
```js
|
|
26
26
|
const { colors } = require('@mindvalley/design-system')
|
|
@@ -36,7 +36,7 @@ To use the colors from the design system there are two options.
|
|
|
36
36
|
If you use TailwindCSS in your project, using the colors is a simple two-step process:
|
|
37
37
|
|
|
38
38
|
1. Install the design system. See [installation](#using-npm-or-yarn).
|
|
39
|
-
2. Use the [
|
|
39
|
+
2. Use the [CommonJS syntax](#commonjs-syntax) to include the colors and extend your `tailwind.config.js`.
|
|
40
40
|
|
|
41
41
|
*Example tailwind.config.js*
|
|
42
42
|
|
|
@@ -52,8 +52,8 @@ If you use TailwindCSS in your project, using the colors is a simple two-step pr
|
|
|
52
52
|
}
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
For other brands
|
|
56
|
-
and override the redefined colors using the
|
|
55
|
+
For other brands (e.g., B2B), you can access and combine colors from the core Mindvalley brand
|
|
56
|
+
and override the redefined colors using the B2B-specific colors.
|
|
57
57
|
|
|
58
58
|
```js
|
|
59
59
|
const { colors } = require('@mindvalley/design-system');
|
|
@@ -62,7 +62,7 @@ and override the redefined colors using the b2b specific colors.
|
|
|
62
62
|
module.exports = {
|
|
63
63
|
theme: {
|
|
64
64
|
colors: {
|
|
65
|
-
...
|
|
65
|
+
...colors,
|
|
66
66
|
...b2bColors
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -71,13 +71,13 @@ and override the redefined colors using the b2b specific colors.
|
|
|
71
71
|
|
|
72
72
|
## Why the override?
|
|
73
73
|
|
|
74
|
-
Both brands share color names, but their hues and shades are distinct. For instance, the reds, blues, teals, and purples in
|
|
74
|
+
Both brands share color names, but their hues and shades are distinct. For instance, the reds, blues, teals, and purples in B2B differ. Therefore, the override is necessary to guarantee that a developer working on B2B receives the specific shades associated with that brand.
|
|
75
75
|
|
|
76
|
-
Here is full list of [
|
|
76
|
+
Here is the full list of [B2B colors](https://www.figma.com/file/1EPj7v5H5JhP2d0v2h8QeC/B2B-Foundations?type=design&node-id=1-395&mode=design&t=SY5HTy1zbFO5p80n-0).
|
|
77
77
|
|
|
78
78
|
#### Gradients
|
|
79
79
|
|
|
80
|
-
For
|
|
80
|
+
For gradients you can use the following TailwindCSS presets:
|
|
81
81
|
|
|
82
82
|
- Purple wave: `from-brand-accent to-purple-600`
|
|
83
83
|
- Orange Wave: `from-orange-500 to-orange-600`
|
|
@@ -103,11 +103,11 @@ If you'd like other custom names, you can make [tailwindcss color customizations
|
|
|
103
103
|
1. Install the design system. See [installation](#using-npm-or-yarn).
|
|
104
104
|
2. Use the [ES module](#es-module-syntax) syntax to import your module and include it in your code.
|
|
105
105
|
|
|
106
|
-
*Sample usage in a
|
|
106
|
+
*Sample usage in a React app*
|
|
107
107
|
|
|
108
108
|
```js
|
|
109
109
|
import React from 'react'
|
|
110
|
-
import {
|
|
110
|
+
import { colors } from '@mindvalley/design-system'
|
|
111
111
|
|
|
112
112
|
function App() {
|
|
113
113
|
const isBackgroundRed = true;
|
|
@@ -115,7 +115,7 @@ If you'd like other custom names, you can make [tailwindcss color customizations
|
|
|
115
115
|
return (
|
|
116
116
|
<div
|
|
117
117
|
style={{
|
|
118
|
-
backgroundColor: isBackgroundRed ?
|
|
118
|
+
backgroundColor: isBackgroundRed ? colors.red : colors.blue,
|
|
119
119
|
}}
|
|
120
120
|
/>
|
|
121
121
|
);
|
|
@@ -126,76 +126,134 @@ If you'd like other custom names, you can make [tailwindcss color customizations
|
|
|
126
126
|
|
|
127
127
|
## đī¸ Typography
|
|
128
128
|
|
|
129
|
-
### Typography
|
|
129
|
+
### Loading Typography Fonts
|
|
130
|
+
|
|
131
|
+
Before using the typography plugin, you need to load the required fonts. The design system provides pre-generated `@font-face` declarations that you can easily import.
|
|
132
|
+
|
|
133
|
+
#### Recommended Method: Package Import
|
|
134
|
+
|
|
135
|
+
The easiest way to load fonts is to import them directly from the package:
|
|
136
|
+
|
|
137
|
+
**For Mindvalley Brand:**
|
|
138
|
+
|
|
139
|
+
```javascript
|
|
140
|
+
import '@mindvalley/design-system/typography/mindvalley/fonts.css'
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**For B2B Brand:**
|
|
144
|
+
|
|
145
|
+
```javascript
|
|
146
|
+
import '@mindvalley/design-system/typography/b2b/fonts.css'
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**For projects using both brands:**
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
import '@mindvalley/design-system/typography/mindvalley/fonts.css'
|
|
153
|
+
import '@mindvalley/design-system/typography/b2b/fonts.css'
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
This works in all modern JavaScript frameworks including Next.js, Vite, Webpack, and Phoenix (Elixir).
|
|
157
|
+
|
|
158
|
+
> đĄ **Note**: For detailed framework-specific examples (Next.js, Vite, Phoenix, CSS-in-JS solutions, etc.), see the comprehensive [Typography Font Loading Guide](typography-fonts.md).
|
|
159
|
+
|
|
160
|
+
> â ī¸ **PostCSS Users**: If you're using `@import` in SCSS/CSS files with `postcss-import`, you need to configure it to resolve from `node_modules`. See the [PostCSS configuration example](typography-fonts.md#using-with-postcss-and-scss-import-phoenix-webpack--scss) for details.
|
|
161
|
+
|
|
162
|
+
#### Alternative Method: Manual CSS
|
|
163
|
+
|
|
164
|
+
If you prefer more control or need to customize the font loading, you can manually add the `@font-face` declarations to your CSS:
|
|
165
|
+
|
|
166
|
+
```css
|
|
167
|
+
/* Font files are served via Fastly CDN under Mindvalley assets and
|
|
168
|
+
managed via platform backoffice
|
|
169
|
+
|
|
170
|
+
Note: Each font file has a single weight baked into the font name
|
|
171
|
+
(e.g., "Sharp Grotesk Cyr Medium 20" contains Medium, "Sharp Grotesk Cyr Semibold 20" weight of 600).
|
|
172
|
+
Using font-weight: auto allows the browser to use the font's intrinsic weight.
|
|
173
|
+
*/
|
|
174
|
+
|
|
175
|
+
@font-face {
|
|
176
|
+
font-family: "Sharp Grotesk Cyr Medium 22";
|
|
177
|
+
font-weight: auto;
|
|
178
|
+
font-display: swap;
|
|
179
|
+
src: url("https://assets.mindvalley.com/api/v1/assets/b61f86ec-3dbd-4674-907a-f3f26f5101ce.woff2") format("woff2");
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@font-face {
|
|
183
|
+
font-family: "Sharp Grotesk Cyr Semibold 20";
|
|
184
|
+
font-weight: auto;
|
|
185
|
+
font-display: swap;
|
|
186
|
+
src: url("https://assets.mindvalley.com/api/v1/assets/85092275-d096-483e-a271-7d6094cafca1.woff2") format("woff2");
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@font-face {
|
|
190
|
+
font-family: "Sharp Grotesk Cyr Medium 20";
|
|
191
|
+
font-weight: auto;
|
|
192
|
+
font-display: swap;
|
|
193
|
+
src: url("https://assets.mindvalley.com/api/v1/assets/faf3d1e3-d18c-461e-aafa-9e56f9f16ce0.woff2") format("woff2");
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@font-face {
|
|
197
|
+
font-family: "Sharp Grotesk Cyr Medium 19";
|
|
198
|
+
font-weight: auto;
|
|
199
|
+
font-display: swap;
|
|
200
|
+
src: url("https://assets.mindvalley.com/api/v1/assets/9f7eea7d-ba59-4ee1-85a6-3ac45f23239c.woff2") format("woff2");
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@font-face {
|
|
204
|
+
font-family: "Sharp Grotesk Cyr Book 19";
|
|
205
|
+
font-weight: auto;
|
|
206
|
+
font-display: swap;
|
|
207
|
+
src: url("https://assets.mindvalley.com/api/v1/assets/0982041e-3874-48dc-bba5-a15c6fb960d1.woff2") format("woff2");
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@font-face {
|
|
211
|
+
font-family: "Sharp Grotesk Cyr Book Itl 19";
|
|
212
|
+
font-weight: auto;
|
|
213
|
+
font-display: swap;
|
|
214
|
+
src: url("https://assets.mindvalley.com/api/v1/assets/2ba064b8-f0d5-48e4-a790-d7b90d5d2db5.woff2") format("woff2");
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Both methods are valid, but the package import is easier to maintain and ensures you always have the latest font definitions.
|
|
130
219
|
|
|
131
|
-
|
|
220
|
+
### Typography plugin (TailwindCSS)
|
|
221
|
+
|
|
222
|
+
Mindvalley's engineers utilize TailwindCSS, so we provide a typography plugin to make life easier. This plugin lets developers use Figma typography class references without worrying about the underlying font sizes, line heights, font families, etc.
|
|
132
223
|
|
|
133
224
|
#### How to use it?
|
|
134
225
|
|
|
135
|
-
Let's say that you are trying to codify a button from a Figma design, and you want to apply the exact same typography values(line height, font family, font size, etc.) to your code. Here are the steps you will need to go through to
|
|
226
|
+
Let's say that you are trying to codify a button from a Figma design, and you want to apply the exact same typography values (line height, font family, font size, etc.) to your code. Here are the steps you will need to go through to use the plugin.
|
|
227
|
+
|
|
228
|
+
1. Install the design system as described in the [install section](#using-npm-or-yarn).
|
|
136
229
|
|
|
137
|
-
|
|
230
|
+
2. Load the typography fonts using one of the methods described in [Loading Typography Fonts](#loading-typography-fonts) above.
|
|
138
231
|
|
|
139
|
-
|
|
232
|
+
3. Require and use the Tailwind typography plugin in your `tailwind.config.js` file.
|
|
140
233
|
|
|
141
234
|
```js
|
|
142
235
|
module.exports = {
|
|
143
236
|
...
|
|
144
237
|
plugins: [
|
|
145
|
-
require('@mindvalley/design-system/dist/tailwind/plugins/typography.js')()
|
|
238
|
+
require('@mindvalley/design-system/dist/tailwind/plugins/typography.js')()
|
|
146
239
|
],
|
|
147
240
|
...
|
|
148
241
|
}
|
|
149
242
|
|
|
150
243
|
```
|
|
151
244
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
```css
|
|
155
|
-
@font-face {
|
|
156
|
-
font-family: "Sharp Grotesk Cyr Semibold 21";
|
|
157
|
-
font-weight: 500;
|
|
158
|
-
font-display: swap;
|
|
159
|
-
/* We load fonts from assets.mindvalley.com cdn but you can choose to host the files yourself */
|
|
160
|
-
src: url("https://assets.mindvalley.com/api/v1/assets/270944f2-bb71-4559-b461-aabb0b351d6b.woff2") format("woff2");
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
@font-face {
|
|
164
|
-
font-family: "Sharp Grotesk Cyr Semibold 20";
|
|
165
|
-
font-weight: 600;
|
|
166
|
-
font-display: swap;
|
|
167
|
-
/* We load fonts from assets.mindvalley.com cdn but you can choose to host the files yourself */
|
|
168
|
-
src: url("https://assets.mindvalley.com/api/v1/assets/85092275-d096-483e-a271-7d6094cafca1.woff2") format("woff2");
|
|
169
|
-
}
|
|
245
|
+
4. Find the name to use by inspecting the selected text on the Figma design file.
|
|
170
246
|
|
|
171
|
-
|
|
172
|
-
font-family: "Sharp Grotesk Cyr Medium 22";
|
|
173
|
-
font-weight: 500;
|
|
174
|
-
font-display: swap;
|
|
175
|
-
src: url("https://assets.mindvalley.com/api/v1/assets/b61f86ec-3dbd-4674-907a-f3f26f5101ce.woff2") format("woff2");
|
|
176
|
-
}
|
|
247
|
+

|
|
177
248
|
|
|
178
|
-
|
|
179
|
-
font-family: "Sharp Grotesk Cyr Medium 20";
|
|
180
|
-
font-weight: 500;
|
|
181
|
-
font-display: swap;
|
|
182
|
-
src: url("https://assets.mindvalley.com/api/v1/assets/faf3d1e3-d18c-461e-aafa-9e56f9f16ce0.woff2") format("woff2");
|
|
183
|
-
}
|
|
249
|
+
5. Use the class name as follows. Remember to adjust that according to the casing option if you are not using the default.
|
|
184
250
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
font-weight: 400;
|
|
188
|
-
font-display: swap;
|
|
189
|
-
src: url("https://assets.mindvalley.com/api/v1/assets/0982041e-3874-48dc-bba5-a15c6fb960d1.woff2") format("woff2");
|
|
190
|
-
}
|
|
251
|
+
```html
|
|
252
|
+
<p class="button-text">...</p>
|
|
191
253
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
font-display: swap;
|
|
196
|
-
src: url("https://assets.mindvalley.com/api/v1/assets/d0e0425c-3c29-4d67-b4d6-77567bec96ba.woff2") format("woff2");
|
|
197
|
-
}
|
|
198
|
-
```
|
|
254
|
+
<!-- This won't work as the button-text class generated is already responsive -->
|
|
255
|
+
<p class="button-text lg:button-text">...</p>
|
|
256
|
+
```
|
|
199
257
|
|
|
200
258
|
*Note that*
|
|
201
259
|
|
|
@@ -245,9 +303,9 @@ Since the typography classes are responsive, you don't need to add media queries
|
|
|
245
303
|
|
|
246
304
|
```css
|
|
247
305
|
.title-bold-5 {
|
|
248
|
-
font-family: 'Sharp Grotesk Semibold
|
|
306
|
+
font-family: 'Sharp Grotesk Cyr Semibold 20', Helvetica, Arial, 'sans-serif';
|
|
249
307
|
font-size: 1.5rem;
|
|
250
|
-
letter-spacing:
|
|
308
|
+
letter-spacing: 0.015625rem;
|
|
251
309
|
line-height: 1.875rem;
|
|
252
310
|
}
|
|
253
311
|
/* configured-breakpoint value is the value of the breakpoint identifier you pass in the plugin configuration. */
|
|
@@ -378,19 +436,6 @@ You'll need to make the plugin aware of the `breakingPoint` boundary between the
|
|
|
378
436
|
}
|
|
379
437
|
```
|
|
380
438
|
|
|
381
|
-
4. Find the name to use by inspecting the selected text on the Figma design file.
|
|
382
|
-
|
|
383
|
-

|
|
384
|
-
|
|
385
|
-
5. Use the class name as follows. Remember to adjust that according to the casing option if you are not using the default.
|
|
386
|
-
|
|
387
|
-
```html
|
|
388
|
-
<p class="button-text">...</p>
|
|
389
|
-
|
|
390
|
-
<!-- This won't work as the button-text class generated is already responsive -->
|
|
391
|
-
<p class="button-text lg:button-text">...</p>
|
|
392
|
-
```
|
|
393
|
-
|
|
394
439
|
You can find the full list of typography definations here đ [Figma typography](https://www.figma.com/file/Gmdp0kAAYsmBgCthFjGkpY/MV-Core?node-id=5593%3A26473&t=3PPGng5xmhzaFyRe-0)
|
|
395
440
|
|
|
396
441
|
## ÂŠī¸ Icons
|