@guardian/stand 0.0.7 → 0.0.9
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 +243 -32
- package/dist/byline.cjs +9 -0
- package/dist/byline.js +2 -0
- package/dist/components/byline/styles.cjs +5 -5
- package/dist/components/byline/styles.js +1 -1
- package/dist/components/tag-picker/styles.cjs +11 -11
- package/dist/components/tag-picker/styles.js +1 -1
- package/dist/fonts/OpenSans.css +327 -0
- package/dist/index.cjs +14 -9
- package/dist/index.js +7 -4
- package/dist/styleD/build/css/{css/base → base}/colors.css +3 -3
- package/dist/styleD/build/css/base/radius.css +12 -0
- package/dist/styleD/build/css/base/sizing.css +24 -0
- package/dist/styleD/build/css/base/spacing.css +40 -0
- package/dist/styleD/build/css/{css/base → base}/typography.css +17 -1
- package/dist/styleD/build/css/semantic/colors.css +65 -0
- package/dist/styleD/build/css/semantic/sizing.css +15 -0
- package/dist/styleD/build/css/semantic/typography.css +151 -0
- package/dist/styleD/build/typescript/base/colors.cjs +3 -3
- package/dist/styleD/build/typescript/base/colors.js +3 -3
- package/dist/styleD/build/typescript/base/radius.cjs +12 -0
- package/dist/styleD/build/typescript/base/radius.js +10 -0
- package/dist/styleD/build/typescript/base/sizing.cjs +24 -0
- package/dist/styleD/build/typescript/base/sizing.js +22 -0
- package/dist/styleD/build/typescript/base/spacing.cjs +40 -0
- package/dist/styleD/build/typescript/base/spacing.js +38 -0
- package/dist/styleD/build/typescript/base/typography.cjs +22 -6
- package/dist/styleD/build/typescript/base/typography.js +22 -6
- package/dist/styleD/build/typescript/semantic/colors.cjs +53 -13
- package/dist/styleD/build/typescript/semantic/colors.js +53 -13
- package/dist/styleD/build/typescript/semantic/sizing.cjs +21 -0
- package/dist/styleD/build/typescript/semantic/sizing.js +19 -0
- package/dist/styleD/build/typescript/semantic/typography.cjs +86 -342
- package/dist/styleD/build/typescript/semantic/typography.js +86 -342
- package/dist/styleD/utils/semantic/typography.cjs +2 -10
- package/dist/styleD/utils/semantic/typography.js +2 -10
- package/dist/tag-picker.cjs +13 -0
- package/dist/tag-picker.js +4 -0
- package/dist/types/byline.d.ts +25 -0
- package/dist/types/components/byline/Byline.d.ts +1 -1
- package/dist/types/components/byline/styles.d.ts +1 -1
- package/dist/types/components/byline/theme.d.ts +1 -1
- package/dist/types/components/tag-picker/TagAutocomplete.d.ts +1 -1
- package/dist/types/components/tag-picker/TagTable.d.ts +1 -1
- package/dist/types/components/tag-picker/styles.d.ts +1 -1
- package/dist/types/index.d.ts +19 -10
- package/dist/types/styleD/build/typescript/base/colors.d.ts +3 -3
- package/dist/types/styleD/build/typescript/base/radius.d.ts +12 -0
- package/dist/types/styleD/build/typescript/base/sizing.d.ts +24 -0
- package/dist/types/styleD/build/typescript/base/spacing.d.ts +40 -0
- package/dist/types/styleD/build/typescript/base/typography.d.ts +19 -3
- package/dist/types/styleD/build/typescript/semantic/colors.d.ts +49 -9
- package/dist/types/styleD/build/typescript/semantic/sizing.d.ts +21 -0
- package/dist/types/styleD/build/typescript/semantic/typography.d.ts +48 -304
- package/dist/types/styleD/stories/base/Radius.d.ts +1 -0
- package/dist/types/styleD/stories/base/Sizing.d.ts +1 -0
- package/dist/types/styleD/stories/base/Spacing.d.ts +1 -0
- package/dist/types/styleD/stories/semantic/Sizing.d.ts +1 -0
- package/dist/types/styleD/utils/semantic/typography.d.ts +1 -8
- package/dist/types/tag-picker.d.ts +21 -0
- package/dist/types/util/mergeDeep.d.ts +1 -0
- package/dist/types/{components/util.d.ts → util/types.d.ts} +3 -1
- package/dist/types/utils.d.ts +6 -0
- package/dist/utils.cjs +8 -0
- package/dist/utils.js +1 -0
- package/package.json +59 -7
- package/dist/styleD/build/css/css/semantic/colors.css +0 -27
- package/dist/styleD/build/css/css/semantic/typography.css +0 -138
- /package/dist/styleD/build/css/{css/component → component}/byline.css +0 -0
- /package/dist/styleD/build/css/{css/component → component}/tagAutocomplete.css +0 -0
- /package/dist/styleD/build/css/{css/component → component}/tagTable.css +0 -0
- /package/dist/{components/util.cjs → util/mergeDeep.cjs} +0 -0
- /package/dist/{components/util.js → util/mergeDeep.js} +0 -0
package/README.md
CHANGED
|
@@ -34,11 +34,40 @@ Most applications should only need to load the `Open Sans` and `Guardian Headlin
|
|
|
34
34
|
|
|
35
35
|
You only need to load Guardian Text Egyptian if you're planning to use it in your project, in most cases you only need this when working on Guardian editorial content on an editorial tool, i.e. when using `article-body-*` semantic tokens.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
##### Open Sans
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
##### Guardian Hosted (Recommended)
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
We are self hosting this font under a Guardian specific domain, so you can load the Open Sans variable font CSS file from our CDN:
|
|
42
|
+
|
|
43
|
+
Via CSS `@import`:
|
|
44
|
+
|
|
45
|
+
```css
|
|
46
|
+
@import url('https://assets.guim.co.uk/fonts/open-sans/OpenSans.css');
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Via HTML `<link>`:
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<link
|
|
53
|
+
rel="stylesheet"
|
|
54
|
+
href="https://assets.guim.co.uk/fonts/open-sans/OpenSans.css"
|
|
55
|
+
/>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
We also publish the same `OpenSans.css` file in the `@guardian/stand` package if you prefer to import it from there and you're using a bundler that supports CSS imports:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import '@guardian/stand/fonts/OpenSans.css';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
All options use the font files hosted on the Guardian CDN at `https://assets.guim.co.uk/fonts/open-sans/woff2/`.
|
|
65
|
+
|
|
66
|
+
You can also create your own CSS `@font-face` declarations, using the same format as in the `OpenSans.css` file, and/or self host the font files yourself if needed.
|
|
67
|
+
|
|
68
|
+
##### via Google Fonts
|
|
69
|
+
|
|
70
|
+
The Open Sans variable font can also be loaded via Google Fonts, but we recommend using the Guardian hosted version to avoid loading from a third party domain:
|
|
42
71
|
|
|
43
72
|
1. Visit [Google Fonts - Open Sans](https://fonts.google.com/specimen/Open+Sans)
|
|
44
73
|
2. Click "Get Font" -> "Get embed code"
|
|
@@ -47,13 +76,13 @@ For now, the Open Sans variable font can be loaded via Google Fonts:
|
|
|
47
76
|
5. Copy the relevant `<link>` tag or `@import` code snippet into your project
|
|
48
77
|
- You don't need to include the CSS class, as the design system will handle applying the correct font-family via CSS variables or JS/TS tokens.
|
|
49
78
|
|
|
50
|
-
|
|
79
|
+
#### Guardian Fonts
|
|
51
80
|
|
|
52
81
|
Make sure to visit [guardian/fonts](https://github.com/guardian/fonts) repo for the latest information on how to self-host these fonts.
|
|
53
82
|
|
|
54
83
|
In general, we always want to use the `full-not-hinted` versions of the fonts where possible.
|
|
55
84
|
|
|
56
|
-
|
|
85
|
+
##### Guardian Headline
|
|
57
86
|
|
|
58
87
|
We only use the bold weight (700) of Guardian Headline in the design system.
|
|
59
88
|
|
|
@@ -68,7 +97,7 @@ We only use the bold weight (700) of Guardian Headline in the design system.
|
|
|
68
97
|
}
|
|
69
98
|
```
|
|
70
99
|
|
|
71
|
-
|
|
100
|
+
##### Guardian Text Egyptian
|
|
72
101
|
|
|
73
102
|
We want the regular/normal weight (400), the bold weight (700), and the italic version of each weight for Guardian Text Egyptian in the design system.
|
|
74
103
|
|
|
@@ -111,20 +140,22 @@ We want the regular/normal weight (400), the bold weight (700), and the italic v
|
|
|
111
140
|
|
|
112
141
|
#### Colors
|
|
113
142
|
|
|
143
|
+
_Status: WIP_
|
|
144
|
+
|
|
114
145
|
```ts
|
|
115
146
|
import { css } from '@emotion/react';
|
|
116
147
|
import { semanticColors } from '@guardian/stand'; // JS/TS usage
|
|
117
148
|
import '@guardian/stand/semantic/colors.css'; // CSS usage
|
|
118
149
|
|
|
119
150
|
const stringStyle = css`
|
|
120
|
-
color: ${semanticColors.text.
|
|
151
|
+
color: ${semanticColors.text.default}; /* JS/TS usage */
|
|
121
152
|
background-color: var(
|
|
122
153
|
--semantic-colors-bg-default-on-light
|
|
123
154
|
); /* CSS usage */
|
|
124
155
|
`;
|
|
125
156
|
|
|
126
157
|
const objectStyle = {
|
|
127
|
-
color: semanticColors.text.
|
|
158
|
+
color: semanticColors.text.default /* JS/TS usage */,
|
|
128
159
|
backgroundColor:
|
|
129
160
|
'var(--semantic-colors-bg-default-on-light)' /* CSS usage */,
|
|
130
161
|
};
|
|
@@ -136,30 +167,46 @@ For a full list of CSS Semantic Color tokens see [`semantic/colors.css`](./src/s
|
|
|
136
167
|
|
|
137
168
|
#### Typography
|
|
138
169
|
|
|
170
|
+
_Status: WIP_
|
|
171
|
+
|
|
139
172
|
```ts
|
|
140
173
|
import { css } from '@emotion/react';
|
|
174
|
+
import { semanticColors, semanticTypography } from '@guardian/stand'; // JS/TS usage
|
|
141
175
|
import {
|
|
142
|
-
semanticColors,
|
|
143
|
-
semanticTypography,
|
|
144
176
|
convertTypographyToEmotionObjectStyle, // helper function to convert from typography token object to emotion CSS object style
|
|
145
177
|
convertTypographyToEmotionStringStyle, // helper function to convert from typography token object to emotion CSS string style
|
|
146
|
-
} from '@guardian/stand'; //
|
|
178
|
+
} from '@guardian/stand/utils'; // Utils for working with design tokens
|
|
147
179
|
import '@guardian/stand/semantic/typography.css'; // CSS usage
|
|
148
180
|
|
|
149
181
|
/* JS/TS usage */
|
|
150
182
|
const stringStyleJS = css`
|
|
183
|
+
// other styles e.g.
|
|
184
|
+
color: ${semanticColors.text.default};
|
|
185
|
+
|
|
186
|
+
/* (recommended) emotion string style usage helper function*/
|
|
151
187
|
${convertTypographyToEmotionStringStyle(
|
|
152
188
|
semanticTypography['body-compact-md'],
|
|
153
189
|
)}
|
|
190
|
+
|
|
191
|
+
/* or direct usage without helper function */
|
|
192
|
+
font: ${semanticTypography['body-compact-md'].font};
|
|
193
|
+
letter-spacing: ${semanticTypography['body-compact-md'].letterSpacing};
|
|
194
|
+
font-variation-settings: 'wdth'
|
|
195
|
+
${semanticTypography['body-compact-md'].fontWidth};
|
|
154
196
|
`;
|
|
155
197
|
const objectStyleJS = {
|
|
156
198
|
// other styles e.g.
|
|
157
|
-
color: semanticColors.text.
|
|
199
|
+
color: semanticColors.text.default,
|
|
158
200
|
|
|
159
|
-
//
|
|
201
|
+
// (recommended) emotion object style usage helper function
|
|
160
202
|
...convertTypographyToEmotionObjectStyle(
|
|
161
203
|
semanticTypography['body-compact-sm'],
|
|
162
204
|
),
|
|
205
|
+
|
|
206
|
+
// or direct usage without helper function
|
|
207
|
+
font: semanticTypography['body-compact-sm'].font,
|
|
208
|
+
letterSpacing: semanticTypography['body-compact-sm'].letterSpacing,
|
|
209
|
+
fontVariationSettings: `'wdth' ${semanticTypography['body-compact-sm'].fontWidth}`,
|
|
163
210
|
};
|
|
164
211
|
|
|
165
212
|
/* CSS usage */
|
|
@@ -171,12 +218,9 @@ const stringStyleCSS = css`
|
|
|
171
218
|
var(--semantic-typography-body-compact-sm-font-width);
|
|
172
219
|
`;
|
|
173
220
|
const objectStyleCSS = {
|
|
174
|
-
|
|
175
|
-
fontWeight: 'var(--semantic-typography-body-compact-sm-font-weight)',
|
|
176
|
-
fontSize: 'var(--semantic-typography-body-compact-sm-font-size)',
|
|
177
|
-
lineHeight: 'var(--semantic-typography-body-compact-sm-line-height)',
|
|
221
|
+
font: 'var(--semantic-typography-body-compact-sm-font)',
|
|
178
222
|
letterSpacing: 'var(--semantic-typography-body-compact-sm-letter-spacing)',
|
|
179
|
-
fontVariationSettings: `'wdth' var(--semantic-typography-body-compact-sm-font-
|
|
223
|
+
fontVariationSettings: `'wdth' var(--semantic-typography-body-compact-sm-font-width)`,
|
|
180
224
|
};
|
|
181
225
|
```
|
|
182
226
|
|
|
@@ -184,10 +228,42 @@ For a list of available typography styles see the [Storybook Semantic Typography
|
|
|
184
228
|
|
|
185
229
|
For a full list of CSS Semantic Typography tokens see [`semantic/typography.css`](./src/styleD/build/css/semantic/typography.css).
|
|
186
230
|
|
|
231
|
+
#### Sizing
|
|
232
|
+
|
|
233
|
+
_Status: WIP_
|
|
234
|
+
|
|
235
|
+
```ts
|
|
236
|
+
import { css } from '@emotion/react';
|
|
237
|
+
import { semanticSizing } from '@guardian/stand'; // JS/TS usage
|
|
238
|
+
import '@guardian/stand/semantic/sizing.css'; // CSS usage
|
|
239
|
+
|
|
240
|
+
const stringStyle = css`
|
|
241
|
+
height: ${semanticSizing.height.md}; /* JS/TS usage */
|
|
242
|
+
border-width: var(--semantic-sizing-border-md); /* CSS usage */
|
|
243
|
+
`;
|
|
244
|
+
|
|
245
|
+
const objectStyle = {
|
|
246
|
+
height: semanticSizing.height.md /* JS/TS usage */,
|
|
247
|
+
borderWidth: 'var(--semantic-sizing-border-md)' /* CSS usage */,
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
// Icon sizing example
|
|
251
|
+
const iconStyle = css`
|
|
252
|
+
width: ${semanticSizing.icon.lg};
|
|
253
|
+
height: ${semanticSizing.icon.lg};
|
|
254
|
+
`;
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
For a list of available semantic sizing styles see the [Storybook Semantic Sizing](https://68c12e3ed577cb56abfd31bf-kggeezequd.chromatic.com/?path=/docs/stand-editorial-design-system-semantic-sizing--docs) section.
|
|
258
|
+
|
|
259
|
+
For a full list of CSS Semantic Sizing tokens see [`semantic/sizing.css`](./src/styleD/build/css/semantic/sizing.css).
|
|
260
|
+
|
|
187
261
|
### Base / Primitives
|
|
188
262
|
|
|
189
263
|
#### Colors
|
|
190
264
|
|
|
265
|
+
_Status: WIP_
|
|
266
|
+
|
|
191
267
|
```ts
|
|
192
268
|
import { css } from '@emotion/react';
|
|
193
269
|
import { baseColors } from '@guardian/stand'; // JS/TS usage
|
|
@@ -210,6 +286,8 @@ For a full list of CSS Base/Primitives Color tokens see [`base/colors.css`](./sr
|
|
|
210
286
|
|
|
211
287
|
#### Typography
|
|
212
288
|
|
|
289
|
+
_Status: WIP_
|
|
290
|
+
|
|
213
291
|
```ts
|
|
214
292
|
import { css } from '@emotion/react';
|
|
215
293
|
import { baseTypography } from '@guardian/stand'; // JS/TS usage
|
|
@@ -218,41 +296,41 @@ import '@guardian/stand/base/typography.css'; // CSS usage
|
|
|
218
296
|
/* JS/TS usage */
|
|
219
297
|
const stringStyleJS = css`
|
|
220
298
|
font-family: ${baseTypography.family['Open Sans']};
|
|
221
|
-
font-size: ${baseTypography.size['14-
|
|
299
|
+
font-size: ${baseTypography.size['14-rem']};
|
|
222
300
|
font-weight: ${baseTypography.weight['Open Sans'].normal};
|
|
223
301
|
font-variation-settings: 'wdth' ${baseTypography.width['Open Sans']};
|
|
224
302
|
style: ${baseTypography.style.normal};
|
|
225
303
|
line-height: ${baseTypography.lineHeight.normal};
|
|
226
|
-
letter-spacing: ${baseTypography.letterSpacing['default-
|
|
304
|
+
letter-spacing: ${baseTypography.letterSpacing['default-rem']};
|
|
227
305
|
`;
|
|
228
306
|
const objectStyleJS = {
|
|
229
307
|
fontFamily: baseTypography.family['Open Sans'],
|
|
230
|
-
fontSize: baseTypography.size['14-
|
|
308
|
+
fontSize: baseTypography.size['14-rem'],
|
|
231
309
|
fontWeight: baseTypography.weight['Open Sans'].normal,
|
|
232
310
|
fontVariationSettings: `'wdth' ${baseTypography.width['Open Sans']}`,
|
|
233
311
|
fontStyle: baseTypography.style.normal,
|
|
234
312
|
lineHeight: baseTypography.lineHeight.normal,
|
|
235
|
-
letterSpacing: baseTypography.letterSpacing['default-
|
|
313
|
+
letterSpacing: baseTypography.letterSpacing['default-rem'],
|
|
236
314
|
};
|
|
237
315
|
|
|
238
316
|
/* CSS usage */
|
|
239
317
|
const stringStyleCSS = css`
|
|
240
318
|
font-family: var(--base-typography-family-open-sans);
|
|
241
|
-
font-size: var(--base-typography-size-14-
|
|
319
|
+
font-size: var(--base-typography-size-14-rem);
|
|
242
320
|
font-weight: var(--base-typography-weight-open-sans-normal);
|
|
243
321
|
font-variation-settings: 'wdth' var(--base-typography-width-open-sans);
|
|
244
322
|
font-style: var(--base-typography-style-normal);
|
|
245
323
|
line-height: var(--base-typography-line-height-normal);
|
|
246
|
-
letter-spacing: var(--base-typography-letter-spacing-default-
|
|
324
|
+
letter-spacing: var(--base-typography-letter-spacing-default-rem);
|
|
247
325
|
`;
|
|
248
326
|
const objectStyleCSS = {
|
|
249
327
|
fontFamily: 'var(--base-typography-family-open-sans)',
|
|
250
|
-
fontSize: 'var(--base-typography-size-14-
|
|
328
|
+
fontSize: 'var(--base-typography-size-14-rem)',
|
|
251
329
|
fontWeight: 'var(--base-typography-weight-open-sans-normal)',
|
|
252
330
|
fontVariationSettings: `'wdth' var(--base-typography-width-open-sans)`,
|
|
253
331
|
fontStyle: 'var(--base-typography-style-normal)',
|
|
254
332
|
lineHeight: 'var(--base-typography-line-height-normal)',
|
|
255
|
-
letterSpacing: 'var(--base-typography-letter-spacing-default-
|
|
333
|
+
letterSpacing: 'var(--base-typography-letter-spacing-default-rem)',
|
|
256
334
|
};
|
|
257
335
|
```
|
|
258
336
|
|
|
@@ -260,6 +338,121 @@ For a list of the available base/primitives typography tokens see the [Storybook
|
|
|
260
338
|
|
|
261
339
|
For a full list of CSS Base/Primitives Typography tokens see [`base/typography.css`](./src/styleD/build/css/base/typography.css).
|
|
262
340
|
|
|
341
|
+
#### Spacing
|
|
342
|
+
|
|
343
|
+
_Status: WIP_
|
|
344
|
+
|
|
345
|
+
The `rem` tokens should be used in most cases to ensure scalability across different root font sizes.
|
|
346
|
+
`px` tokens are available for cases where a fixed pixel value is required.
|
|
347
|
+
|
|
348
|
+
```ts
|
|
349
|
+
import { css } from '@emotion/react';
|
|
350
|
+
import { baseSpacing } from '@guardian/stand'; // JS/TS usage
|
|
351
|
+
import '@guardian/stand/base/spacing.css'; // CSS usage
|
|
352
|
+
|
|
353
|
+
/* JS/TS usage */
|
|
354
|
+
const stringStyleJS = css`
|
|
355
|
+
padding: ${baseSpacing['16-rem']};
|
|
356
|
+
margin-bottom: ${baseSpacing['24-rem']};
|
|
357
|
+
gap: ${baseSpacing['8-rem']};
|
|
358
|
+
`;
|
|
359
|
+
const objectStyleJS = {
|
|
360
|
+
padding: baseSpacing['16-rem'],
|
|
361
|
+
marginBottom: baseSpacing['24-rem'],
|
|
362
|
+
gap: baseSpacing['8-rem'],
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
/* CSS usage */
|
|
366
|
+
const stringStyleCSS = css`
|
|
367
|
+
padding: var(--base-spacing-16-rem);
|
|
368
|
+
margin-bottom: var(--base-spacing-24-rem);
|
|
369
|
+
gap: var(--base-spacing-8-rem);
|
|
370
|
+
`;
|
|
371
|
+
const objectStyleCSS = {
|
|
372
|
+
padding: 'var(--base-spacing-16-rem)',
|
|
373
|
+
marginBottom: 'var(--base-spacing-24-rem)',
|
|
374
|
+
gap: 'var(--base-spacing-8-rem)',
|
|
375
|
+
};
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
For a list of the available base/primitives spacing tokens see the [Storybook Base Spacing](https://68c12e3ed577cb56abfd31bf-kggeezequd.chromatic.com/?path=/docs/stand-editorial-design-system-base-spacing--docs) section.
|
|
379
|
+
|
|
380
|
+
For a full list of CSS Base/Primitives Spacing tokens see [`base/spacing.css`](./src/styleD/build/css/base/spacing.css).
|
|
381
|
+
|
|
382
|
+
#### Sizing
|
|
383
|
+
|
|
384
|
+
_Status: WIP_
|
|
385
|
+
|
|
386
|
+
The `rem` tokens should be used in most cases to ensure scalability across different root font sizes.
|
|
387
|
+
`px` tokens are available for cases where a fixed pixel value is required.
|
|
388
|
+
|
|
389
|
+
```ts
|
|
390
|
+
import { css } from '@emotion/react';
|
|
391
|
+
import { baseSizing } from '@guardian/stand'; // JS/TS usage
|
|
392
|
+
import '@guardian/stand/base/sizing.css'; // CSS usage
|
|
393
|
+
|
|
394
|
+
/* JS/TS usage */
|
|
395
|
+
const stringStyleJS = css`
|
|
396
|
+
width: ${baseSizing['size-48-rem']};
|
|
397
|
+
height: ${baseSizing['size-24-rem']};
|
|
398
|
+
min-width: ${baseSizing['size-24-rem']};
|
|
399
|
+
`;
|
|
400
|
+
const objectStyleJS = {
|
|
401
|
+
width: baseSizing['size-48-rem'],
|
|
402
|
+
height: baseSizing['size-24-rem'],
|
|
403
|
+
minWidth: baseSizing['size-24-rem'],
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
/* CSS usage */
|
|
407
|
+
const stringStyleCSS = css`
|
|
408
|
+
width: var(--base-sizing-size-48-rem);
|
|
409
|
+
height: var(--base-sizing-size-24-rem);
|
|
410
|
+
min-width: var(--base-sizing-size-24-rem);
|
|
411
|
+
`;
|
|
412
|
+
const objectStyleCSS = {
|
|
413
|
+
width: 'var(--base-sizing-size-48-rem)',
|
|
414
|
+
height: 'var(--base-sizing-size-24-rem)',
|
|
415
|
+
minWidth: 'var(--base-sizing-size-24-rem)',
|
|
416
|
+
};
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
For a list of the available base/primitives sizing tokens see the [Storybook Base Sizing](https://68c12e3ed577cb56abfd31bf-kggeezequd.chromatic.com/?path=/docs/stand-editorial-design-system-base-sizing--docs) section.
|
|
420
|
+
|
|
421
|
+
For a full list of CSS Base/Primitives Sizing tokens see [`base/sizing.css`](./src/styleD/build/css/base/sizing.css).
|
|
422
|
+
|
|
423
|
+
#### Radius
|
|
424
|
+
|
|
425
|
+
_Status: WIP_
|
|
426
|
+
|
|
427
|
+
The `rem` tokens should be used in most cases to ensure scalability across different root font sizes.
|
|
428
|
+
`px` tokens are available for cases where a fixed pixel value is required.
|
|
429
|
+
|
|
430
|
+
```ts
|
|
431
|
+
import { css } from '@emotion/react';
|
|
432
|
+
import { baseRadius } from '@guardian/stand'; // JS/TS usage
|
|
433
|
+
import '@guardian/stand/base/radius.css'; // CSS usage
|
|
434
|
+
|
|
435
|
+
/* JS/TS usage */
|
|
436
|
+
const stringStyleJS = css`
|
|
437
|
+
border-radius: ${baseRadius['corner-4-rem']};
|
|
438
|
+
`;
|
|
439
|
+
const objectStyleJS = {
|
|
440
|
+
borderRadius: baseRadius['corner-4-rem'],
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
/* CSS usage */
|
|
444
|
+
const stringStyleCSS = css`
|
|
445
|
+
border-radius: var(--base-radius-corner-4-rem);
|
|
446
|
+
`;
|
|
447
|
+
const objectStyleCSS = {
|
|
448
|
+
borderRadius: 'var(--base-radius-corner-4-rem)',
|
|
449
|
+
};
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
For a list of the available base/primitives radius tokens see the [Storybook Base Radius](https://68c12e3ed577cb56abfd31bf-kggeezequd.chromatic.com/?path=/docs/stand-editorial-design-system-base-radius--docs) section.
|
|
453
|
+
|
|
454
|
+
For a full list of CSS Base/Primitives Radius tokens see [`base/radius.css`](./src/styleD/build/css/base/radius.css).
|
|
455
|
+
|
|
263
456
|
## Components
|
|
264
457
|
|
|
265
458
|
### `Byline`
|
|
@@ -270,6 +463,7 @@ A flexible byline editor component built in ProseMirror and React with usability
|
|
|
270
463
|
|
|
271
464
|
You'll need to install the following peer dependencies in your project to use the `Byline` component:
|
|
272
465
|
|
|
466
|
+
- `@emotion/react`
|
|
273
467
|
- `@guardian/prosemirror-invisibles`
|
|
274
468
|
- `prosemirror-dropcursor`
|
|
275
469
|
- `prosemirror-history`
|
|
@@ -277,14 +471,19 @@ You'll need to install the following peer dependencies in your project to use th
|
|
|
277
471
|
- `prosemirror-model`
|
|
278
472
|
- `prosemirror-state`
|
|
279
473
|
- `prosemirror-view`
|
|
474
|
+
- `react`
|
|
475
|
+
- `react-dom`
|
|
476
|
+
- `typescript`
|
|
280
477
|
|
|
281
|
-
See the `peerDependencies` section of `package.json` for compatible versions
|
|
478
|
+
See the `peerDependencies` section of `package.json` for compatible versions.
|
|
479
|
+
|
|
480
|
+
**Note:** If you only need the built CSS (`@guardian/stand/component/byline.css`), you don't need to install these dependencies.
|
|
282
481
|
|
|
283
482
|
#### Usage
|
|
284
483
|
|
|
285
484
|
```tsx
|
|
286
|
-
import type { BylineModel } from '@guardian/stand';
|
|
287
|
-
import { Byline } from '@guardian/stand';
|
|
485
|
+
import type { BylineModel } from '@guardian/stand/byline';
|
|
486
|
+
import { Byline } from '@guardian/stand/byline';
|
|
288
487
|
|
|
289
488
|
const Component = () => {
|
|
290
489
|
const bylineModel: BylineModel = {
|
|
@@ -324,9 +523,15 @@ autocomplete input for selecting tags from a list of options, based on the [Reac
|
|
|
324
523
|
|
|
325
524
|
**Peer dependencies:**
|
|
326
525
|
|
|
526
|
+
- `@emotion/react`
|
|
527
|
+
- `react`
|
|
327
528
|
- `react-aria-components`
|
|
529
|
+
- `react-dom`
|
|
530
|
+
- `typescript`
|
|
531
|
+
|
|
532
|
+
See the `peerDependencies` section of `package.json` for compatible versions.
|
|
328
533
|
|
|
329
|
-
|
|
534
|
+
**Note:** If you only need the built CSS (`@guardian/stand/component/tagAutocomplete.css`), you don't need to install these dependencies.
|
|
330
535
|
|
|
331
536
|
##### Props
|
|
332
537
|
|
|
@@ -342,9 +547,15 @@ based on the [React Aria Table](https://react-spectrum.adobe.com/react-aria/Tabl
|
|
|
342
547
|
|
|
343
548
|
**Peer dependencies:**
|
|
344
549
|
|
|
550
|
+
- `@emotion/react`
|
|
551
|
+
- `react`
|
|
345
552
|
- `react-aria-components`
|
|
553
|
+
- `react-dom`
|
|
554
|
+
- `typescript`
|
|
555
|
+
|
|
556
|
+
See the `peerDependencies` section of `package.json` for compatible versions.
|
|
346
557
|
|
|
347
|
-
|
|
558
|
+
**Note:** If you only need the built CSS (`@guardian/stand/component/tagTable.css`), you don't need to install these dependencies.
|
|
348
559
|
|
|
349
560
|
##### Props
|
|
350
561
|
|
|
@@ -355,7 +566,7 @@ See [`TagTableProps`](src/components/tag-picker/TagTable.tsx#L31) for the full l
|
|
|
355
566
|
_Example with TagAutocomplete and TagTable combined:_
|
|
356
567
|
|
|
357
568
|
```tsx
|
|
358
|
-
import { TagAutocomplete, TagTable } from '@guardian/stand';
|
|
569
|
+
import { TagAutocomplete, TagTable } from '@guardian/stand/tag-picker';
|
|
359
570
|
|
|
360
571
|
const Component = () => {
|
|
361
572
|
const [selectedTags, setSelectedTags] = useState<
|
package/dist/byline.cjs
ADDED
package/dist/byline.js
ADDED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var react = require('@emotion/react');
|
|
4
4
|
var byline = require('../../styleD/build/typescript/component/byline.cjs');
|
|
5
|
-
var
|
|
5
|
+
var mergeDeep = require('../../util/mergeDeep.cjs');
|
|
6
6
|
|
|
7
7
|
const bylineContainerStyles = react.css`
|
|
8
8
|
position: relative;
|
|
9
9
|
width: 100%;
|
|
10
10
|
`;
|
|
11
11
|
const bylineEditorStyles = (partialTheme = {}) => {
|
|
12
|
-
const theme =
|
|
12
|
+
const theme = mergeDeep.mergeDeep(byline.componentByline, partialTheme);
|
|
13
13
|
return react.css`
|
|
14
14
|
border-color: ${theme.borderColor};
|
|
15
15
|
border-style: ${theme.borderStyle};
|
|
@@ -205,7 +205,7 @@ const bylineEditorStyles = (partialTheme = {}) => {
|
|
|
205
205
|
`;
|
|
206
206
|
};
|
|
207
207
|
const dropdownContainerStyles = (showDropdown, partialTheme = {}) => {
|
|
208
|
-
const theme =
|
|
208
|
+
const theme = mergeDeep.mergeDeep(byline.componentByline["dropdown"], partialTheme);
|
|
209
209
|
return react.css`
|
|
210
210
|
position: absolute;
|
|
211
211
|
box-sizing: border-box;
|
|
@@ -226,7 +226,7 @@ const dropdownUlStyles = react.css`
|
|
|
226
226
|
list-style-type: none;
|
|
227
227
|
`;
|
|
228
228
|
const dropdownLiStyles = (partialTheme = {}) => {
|
|
229
|
-
const theme =
|
|
229
|
+
const theme = mergeDeep.mergeDeep(byline.componentByline["dropdown"], partialTheme);
|
|
230
230
|
return react.css`
|
|
231
231
|
cursor: pointer;
|
|
232
232
|
padding: 5px;
|
|
@@ -237,7 +237,7 @@ const dropdownLiStyles = (partialTheme = {}) => {
|
|
|
237
237
|
`;
|
|
238
238
|
};
|
|
239
239
|
const selectedDropdownLiStyles = (partialTheme = {}) => {
|
|
240
|
-
const theme =
|
|
240
|
+
const theme = mergeDeep.mergeDeep(byline.componentByline["dropdown"], partialTheme);
|
|
241
241
|
return react.css`
|
|
242
242
|
background-color: ${theme.li.selectedBackgroundColor};
|
|
243
243
|
color: ${theme.li.selectedColor};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { componentByline } from '../../styleD/build/typescript/component/byline.js';
|
|
3
|
-
import { mergeDeep } from '
|
|
3
|
+
import { mergeDeep } from '../../util/mergeDeep.js';
|
|
4
4
|
|
|
5
5
|
const bylineContainerStyles = css`
|
|
6
6
|
position: relative;
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
var react = require('@emotion/react');
|
|
4
4
|
var tagAutocomplete = require('../../styleD/build/typescript/component/tagAutocomplete.cjs');
|
|
5
5
|
var tagTable = require('../../styleD/build/typescript/component/tagTable.cjs');
|
|
6
|
-
var
|
|
6
|
+
var mergeDeep = require('../../util/mergeDeep.cjs');
|
|
7
7
|
|
|
8
8
|
const tagAutocompleteInputStyles = (partialTheme = {}) => {
|
|
9
|
-
const theme =
|
|
9
|
+
const theme = mergeDeep.mergeDeep(tagAutocomplete.componentTagAutocomplete, partialTheme);
|
|
10
10
|
return react.css`
|
|
11
11
|
width: 100%;
|
|
12
12
|
box-sizing: border-box;
|
|
@@ -23,7 +23,7 @@ const tagAutocompleteInputStyles = (partialTheme = {}) => {
|
|
|
23
23
|
`;
|
|
24
24
|
};
|
|
25
25
|
const listboxStyles = (partialTheme = {}) => {
|
|
26
|
-
const theme =
|
|
26
|
+
const theme = mergeDeep.mergeDeep(tagAutocomplete.componentTagAutocomplete, partialTheme);
|
|
27
27
|
return react.css`
|
|
28
28
|
padding: ${theme.listbox.paddingY} ${theme.listbox.paddingX};
|
|
29
29
|
max-height: 320px;
|
|
@@ -35,7 +35,7 @@ const listboxStyles = (partialTheme = {}) => {
|
|
|
35
35
|
`;
|
|
36
36
|
};
|
|
37
37
|
const listboxItemStyles = (partialTheme = {}) => {
|
|
38
|
-
const theme =
|
|
38
|
+
const theme = mergeDeep.mergeDeep(tagAutocomplete.componentTagAutocomplete, partialTheme);
|
|
39
39
|
return react.css`
|
|
40
40
|
padding: ${theme.listbox.item.paddingY} ${theme.listbox.item.paddingX};
|
|
41
41
|
cursor: pointer;
|
|
@@ -48,13 +48,13 @@ const listboxItemStyles = (partialTheme = {}) => {
|
|
|
48
48
|
`;
|
|
49
49
|
};
|
|
50
50
|
const listboxInfoStyles = (partialTheme = {}) => {
|
|
51
|
-
const theme =
|
|
51
|
+
const theme = mergeDeep.mergeDeep(tagAutocomplete.componentTagAutocomplete, partialTheme);
|
|
52
52
|
return react.css`
|
|
53
53
|
padding: ${theme.listbox.item.paddingY} ${theme.listbox.item.paddingX};
|
|
54
54
|
`;
|
|
55
55
|
};
|
|
56
56
|
const tagTableHeadingStyles = (partialTheme = {}) => {
|
|
57
|
-
const theme =
|
|
57
|
+
const theme = mergeDeep.mergeDeep(tagTable.componentTagTable, partialTheme);
|
|
58
58
|
return react.css`
|
|
59
59
|
background-color: ${theme.heading.backgroundColor};
|
|
60
60
|
font-weight: ${theme.heading.fontWeight};
|
|
@@ -63,7 +63,7 @@ const tagTableHeadingStyles = (partialTheme = {}) => {
|
|
|
63
63
|
`;
|
|
64
64
|
};
|
|
65
65
|
const tagTableCellStyles = (partialTheme = {}) => {
|
|
66
|
-
const theme =
|
|
66
|
+
const theme = mergeDeep.mergeDeep(tagTable.componentTagTable, partialTheme);
|
|
67
67
|
return react.css`
|
|
68
68
|
padding: ${theme.cell.paddingY} ${theme.cell.paddingX};
|
|
69
69
|
|
|
@@ -79,7 +79,7 @@ const tagTableCellStyles = (partialTheme = {}) => {
|
|
|
79
79
|
`;
|
|
80
80
|
};
|
|
81
81
|
const tagTableRowStyles = (canDrag, partialTheme = {}) => {
|
|
82
|
-
const theme =
|
|
82
|
+
const theme = mergeDeep.mergeDeep(tagTable.componentTagTable, partialTheme);
|
|
83
83
|
return react.css`
|
|
84
84
|
background-color: ${theme.row.backgroundColor};
|
|
85
85
|
height: ${theme.row.height};
|
|
@@ -106,7 +106,7 @@ const tagTableRowStyles = (canDrag, partialTheme = {}) => {
|
|
|
106
106
|
`;
|
|
107
107
|
};
|
|
108
108
|
const tagTableStyles = (canRemoveTag, partialTheme = {}) => {
|
|
109
|
-
const theme =
|
|
109
|
+
const theme = mergeDeep.mergeDeep(tagTable.componentTagTable, partialTheme);
|
|
110
110
|
return react.css`
|
|
111
111
|
width: 100%;
|
|
112
112
|
border-collapse: collapse;
|
|
@@ -129,7 +129,7 @@ const tagTableRemoveButtonStyles = react.css`
|
|
|
129
129
|
}
|
|
130
130
|
`;
|
|
131
131
|
const tagTableAddButtonStyles = (partialTheme = {}) => {
|
|
132
|
-
const theme =
|
|
132
|
+
const theme = mergeDeep.mergeDeep(tagTable.componentTagTable, partialTheme);
|
|
133
133
|
return react.css`
|
|
134
134
|
:hover {
|
|
135
135
|
cursor: pointer;
|
|
@@ -172,7 +172,7 @@ const tagTableDragButtonStyles = react.css`
|
|
|
172
172
|
}
|
|
173
173
|
`;
|
|
174
174
|
const tagTableTypeBadgeStyles = (partialTheme = {}) => {
|
|
175
|
-
const theme =
|
|
175
|
+
const theme = mergeDeep.mergeDeep(tagTable.componentTagTable, partialTheme);
|
|
176
176
|
return react.css`
|
|
177
177
|
white-space: nowrap;
|
|
178
178
|
text-transform: uppercase;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { componentTagAutocomplete } from '../../styleD/build/typescript/component/tagAutocomplete.js';
|
|
3
3
|
import { componentTagTable } from '../../styleD/build/typescript/component/tagTable.js';
|
|
4
|
-
import { mergeDeep } from '
|
|
4
|
+
import { mergeDeep } from '../../util/mergeDeep.js';
|
|
5
5
|
|
|
6
6
|
const tagAutocompleteInputStyles = (partialTheme = {}) => {
|
|
7
7
|
const theme = mergeDeep(componentTagAutocomplete, partialTheme);
|