@madgex/design-system 9.3.0 → 10.0.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.
- package/README.md +52 -1
- package/dist/_tokens/css/{_tokens.css → variables.css} +3 -4
- package/dist/_tokens/js/_tokens-module.js +2599 -3884
- package/dist/_tokens/json/{_tokens-flat.json → variables-flat.json} +2 -28
- package/dist/_tokens/json/variables.json +331 -0
- package/dist/assets/icons.json +1 -1
- package/dist/css/index.css +1 -1
- package/dist/js/index.js +1 -1
- package/package.json +14 -17
- package/src/components/_preview.njk +1 -1
- package/src/components/inputs/combobox/combobox.scss +9 -3
- package/src/components/modal/modal.js +1 -1
- package/src/components/popover/popover.js +1 -1
- package/src/components/tabs/tabs.js +1 -1
- package/src/scss/constants/_sd-tokens.scss +1 -2
- package/src/tokens/_constants.json +35 -33
- package/src/tokens/color.json +64 -63
- package/src/tokens/custom.json +11 -7
- package/src/tokens/effects.json +4 -3
- package/src/tokens/email.json +30 -27
- package/src/tokens/size.json +16 -15
- package/src/tokens/typography.json +68 -62
- package/style-dictionary/color-transforms.js +143 -0
- package/style-dictionary/index.js +215 -0
- package/tasks/tokens.js +8 -26
- package/dist/_tokens/json/_tokens-nested.json +0 -4024
- package/src/tokens/_config.js +0 -181
- package/tasks/colorTransforms.js +0 -65
- package/tasks/registerTransforms.js +0 -17
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ You'll need to use the Madgex DS CSS file in your project (which you will find i
|
|
|
18
18
|
|
|
19
19
|
The design system is using CSS Custom Properties to apply the brand styling of each site so you will need to import the custom properties file found in S3 for each client property id as well.
|
|
20
20
|
|
|
21
|
-
if you want to use the default styling set in the design system, you can use the `
|
|
21
|
+
if you want to use the default styling set in the design system, you can use the `variables.css` file found in `dist/_tokens/css`.
|
|
22
22
|
|
|
23
23
|
## Working with [hapi.js](https://hapijs.com/), [vision](https://github.com/hapijs/vision) and [Nunjucks](https://mozilla.github.io/nunjucks/)
|
|
24
24
|
|
|
@@ -86,3 +86,54 @@ npm link
|
|
|
86
86
|
cd [your local path]/jobseekers-frontend
|
|
87
87
|
npm link npm link @madgex/design-system
|
|
88
88
|
```
|
|
89
|
+
|
|
90
|
+
## Building Tokens
|
|
91
|
+
|
|
92
|
+
We use [Style Dictionary](https://styledictionary.com/) to build our Design System tokens.
|
|
93
|
+
|
|
94
|
+
### createStyleDictionary(overridesObject:StyleDictionaryConfig?) : { styleDictionary:StyleDictionary, cleanTempFiles:Function }
|
|
95
|
+
|
|
96
|
+
`createStyleDictionary(StyleDictionaryConfig)` is exposed via `@madgex/design-system/style-dictionary`.
|
|
97
|
+
This creates a new [StyleDictionary Instance](https://styledictionary.com/reference/api/#instance-methods), preconfigured with our base tokens, and all platforms we want to build. [See here for the base config we use](style-dictionary/index.js).
|
|
98
|
+
|
|
99
|
+
You can supply overrides to `createStyleDictionary` which should be the same shape as [Style Dictionary Configuration](https://styledictionary.com/reference/config/#properties).
|
|
100
|
+
|
|
101
|
+
Typically you will only override `buildPath` on platforms (so the platform builds with the same transforms everywhere), and supply `source` token override file paths.
|
|
102
|
+
|
|
103
|
+
### pre-configured platforms
|
|
104
|
+
|
|
105
|
+
A `platform` determines a certain type of output based on the tokens.
|
|
106
|
+
When you create a new StyleDictionary Instance via `createStyleDictionary`, it comes with our pre-configured platforms :
|
|
107
|
+
|
|
108
|
+
- 'css-variables' : outputs `variables.css` to `buildPath`, CSS Variables
|
|
109
|
+
- 'json-variables' : outputs `variables.json` to `buildPath`, JSON version of CSS Variables, useful for rendering in Node e.g. [display-image-render-api](https://github.com/wiley/madgex-display-image-render-api/blob/27e6e219400a98a41f39861c8b362a0849888ea3/lib/services/templates.js#L157) or [template-renderer](https://github.com/wiley/madgex-template-renderer/blob/e5eb868e6b789a8d751efc98768672d877196fa5/lib/services/dataUtils.js#L101)
|
|
110
|
+
- 'json-variables-flat' : outputs `variables-flat.json` to `buildPath`. similar to 'json-variables' but in a flat object structure
|
|
111
|
+
|
|
112
|
+
### Example usage, overrides
|
|
113
|
+
|
|
114
|
+
In this example we override the `buildPath` of our pre-configured `platforms`.
|
|
115
|
+
We also supply paths to override token files via `source`.
|
|
116
|
+
|
|
117
|
+
We then build only the platforms we want, and then call cleanTempFiles once we're done.
|
|
118
|
+
|
|
119
|
+
```javascript
|
|
120
|
+
const path = require('node:path');
|
|
121
|
+
const { createStyleDictionary, cleanTempFiles } = require('@madgex/design-system/style-dictionary');
|
|
122
|
+
|
|
123
|
+
const { styleDictionary, cleanTempFiles } = await createStyleDictionary({
|
|
124
|
+
platforms: {
|
|
125
|
+
'css-variables': {
|
|
126
|
+
buildPath: `${path.resolve(__dirname, '../yes-here')}/`,
|
|
127
|
+
},
|
|
128
|
+
'json-variables': {
|
|
129
|
+
buildPath: `${path.resolve(__dirname, '../yes-here')}/`,
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
source: [path.resolve(__dirname, '../brand.json')],
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
await styleDictionary.buildPlatform('css-variables');
|
|
136
|
+
await styleDictionary.buildPlatform('json-variables');
|
|
137
|
+
|
|
138
|
+
await cleanTempFiles();
|
|
139
|
+
```
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Do not edit directly
|
|
3
|
-
* Generated on Wed, 26 Mar 2025 09:21:17 GMT
|
|
2
|
+
* Do not edit directly, this file was auto-generated.
|
|
4
3
|
*/
|
|
5
4
|
|
|
6
5
|
:root {
|
|
@@ -81,8 +80,8 @@
|
|
|
81
80
|
--mds-size-main-padding: 0;
|
|
82
81
|
--mds-size-main-margin: 0 auto;
|
|
83
82
|
--mds-size-height-ad-container-leaderboard-min: 0;
|
|
84
|
-
--mds-custom-badge-1-background: #
|
|
85
|
-
--mds-custom-badge-1-color: #
|
|
83
|
+
--mds-custom-badge-1-background: #000000;
|
|
84
|
+
--mds-custom-badge-1-color: #ffffff;
|
|
86
85
|
--mds-custom-card-1-background: #e9f3fc;
|
|
87
86
|
--mds-custom-card-1-border: 1px solid #1b75bb;
|
|
88
87
|
--mds-shadow-site-container: none;
|