@times-design-system/theme-css 2.1.0 → 2.2.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 +63 -92
- package/dist/variables.css +455 -355
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Times Design System CSS theme package with 2,748+ pre-compiled CSS custom proper
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
8
|
+
yarn add @times-design-system/theme-css
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
@@ -18,50 +18,47 @@ npm install @times-design-system/theme-css
|
|
|
18
18
|
rel="stylesheet"
|
|
19
19
|
href="node_modules/@times-design-system/theme-css/variables.css"
|
|
20
20
|
/>
|
|
21
|
+
|
|
22
|
+
<!-- Via CDN with cachable version reference -->
|
|
23
|
+
<link
|
|
24
|
+
rel="stylesheet"
|
|
25
|
+
href="https://unpkg.com/@times-design-system/theme-css@[VERSION_NUMBER]/dist/variables.css"
|
|
26
|
+
/>
|
|
21
27
|
```
|
|
22
28
|
|
|
23
29
|
### Use CSS Variables in Your Stylesheet
|
|
24
30
|
|
|
25
31
|
```css
|
|
26
|
-
/* Color tokens */
|
|
32
|
+
/* Color tokens - prescoped within media queries for both mode (light/dark) and theme (e.g. [data-theme="sport"])*/
|
|
27
33
|
body {
|
|
28
|
-
background-color: var(
|
|
29
|
-
color: var(
|
|
34
|
+
background-color: var(surface-canvas);
|
|
35
|
+
color: var(text-primary);
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
/* Spacing tokens */
|
|
33
39
|
.component {
|
|
34
|
-
padding: var(
|
|
35
|
-
margin: var(
|
|
36
|
-
gap: var(
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/* Typography */
|
|
40
|
-
h1 {
|
|
41
|
-
font-size: var(--tds-font-size-100);
|
|
42
|
-
line-height: var(--tds-line-height-heading);
|
|
43
|
-
letter-spacing: var(--tds-letter-spacing-tight);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/* Dark mode with light-dark() */
|
|
47
|
-
.card {
|
|
48
|
-
background: light-dark(
|
|
49
|
-
var(--tds-surface-level-1),
|
|
50
|
-
var(--tds-surface-level-1-dark)
|
|
51
|
-
);
|
|
52
|
-
border-color: light-dark(
|
|
53
|
-
var(--tds-border-primary),
|
|
54
|
-
var(--tds-border-primary-dark)
|
|
55
|
-
);
|
|
40
|
+
padding: var(spacing-100);
|
|
41
|
+
margin: var(spacing-050);
|
|
42
|
+
gap: var(spacing-200);
|
|
56
43
|
}
|
|
57
44
|
|
|
58
45
|
/* Shadows/Elevation */
|
|
59
46
|
.elevated {
|
|
60
|
-
box-shadow: var(
|
|
47
|
+
box-shadow: var(elevation-100);
|
|
61
48
|
}
|
|
62
49
|
```
|
|
63
50
|
|
|
64
|
-
###
|
|
51
|
+
### Use Typographic classes in markup
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
/* Typography */
|
|
55
|
+
/* Typographic styling should be adopted through typographic classes */
|
|
56
|
+
<h1 className="brand-heading-fluid-bold-xlarge">Styled Heading</h1>
|
|
57
|
+
|
|
58
|
+
<Text typographyStyle="brand-heading-fluid-bold-xlarge">Styled Text Component</Text>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Alternative Import in JavaScript
|
|
65
62
|
|
|
66
63
|
```javascript
|
|
67
64
|
// If bundling CSS
|
|
@@ -69,7 +66,7 @@ import '@times-design-system/theme-css/variables.css';
|
|
|
69
66
|
|
|
70
67
|
// Then use in JS
|
|
71
68
|
const element = document.querySelector('.component');
|
|
72
|
-
const spacing = getComputedStyle(element).getPropertyValue('
|
|
69
|
+
const spacing = getComputedStyle(element).getPropertyValue('spacing-100');
|
|
73
70
|
```
|
|
74
71
|
|
|
75
72
|
## Package Contents
|
|
@@ -87,88 +84,62 @@ All semantic and brand colors:
|
|
|
87
84
|
|
|
88
85
|
```css
|
|
89
86
|
/* Semantic colors */
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
87
|
+
text-primary
|
|
88
|
+
text-secondary
|
|
89
|
+
text-tertiary
|
|
90
|
+
surface-canvas
|
|
91
|
+
surface-level-1
|
|
92
|
+
surface-level-2
|
|
93
|
+
border-primary
|
|
94
|
+
border-secondary
|
|
98
95
|
|
|
99
96
|
/* Brand/Channel colors (e.g.) */
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
brand-home-500
|
|
98
|
+
brand-business-500
|
|
99
|
+
channel-sport-500
|
|
100
|
+
channel-money-500
|
|
104
101
|
```
|
|
105
102
|
|
|
106
103
|
### Spacing Tokens
|
|
107
104
|
|
|
108
105
|
```css
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
106
|
+
spacing-025 /* 0.25rem */
|
|
107
|
+
spacing-050 /* 0.5rem */
|
|
108
|
+
spacing-100 /* 1rem */
|
|
109
|
+
spacing-200 /* 1.5rem */
|
|
110
|
+
spacing-300 /* 2rem */
|
|
111
|
+
spacing-400 /* 2.5rem */
|
|
115
112
|
```
|
|
116
113
|
|
|
117
114
|
### Typography Tokens
|
|
118
115
|
|
|
119
116
|
```css
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
117
|
+
font-size-025 /* 0.75rem */
|
|
118
|
+
font-size-050 /* 1rem */
|
|
119
|
+
font-size-100 /* 2.25rem */
|
|
120
|
+
font-family-sans
|
|
121
|
+
font-family-serif
|
|
122
|
+
font-weight-regular /* 400 */
|
|
123
|
+
font-weight-bold /* 700 */
|
|
124
|
+
line-height-tight
|
|
125
|
+
line-height-normal
|
|
126
|
+
letter-spacing-tight
|
|
130
127
|
```
|
|
131
128
|
|
|
132
129
|
### Other Tokens
|
|
133
130
|
|
|
134
131
|
```css
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## Dark Mode
|
|
144
|
-
|
|
145
|
-
All tokens support light and dark variants through CSS variable naming. Use with `light-dark()` for automatic switching:
|
|
146
|
-
|
|
147
|
-
```css
|
|
148
|
-
:root {
|
|
149
|
-
color-scheme: light dark;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
body {
|
|
153
|
-
color: light-dark(var(--tds-text-primary), var(--tds-text-primary-dark));
|
|
154
|
-
background: light-dark(
|
|
155
|
-
var(--tds-surface-canvas),
|
|
156
|
-
var(--tds-surface-canvas-dark)
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
@media (prefers-color-scheme: dark) {
|
|
161
|
-
:root {
|
|
162
|
-
--tds-text-primary: #ffffff;
|
|
163
|
-
--tds-surface-canvas: #000000;
|
|
164
|
-
/* ... */
|
|
165
|
-
}
|
|
166
|
-
}
|
|
132
|
+
radius-100 /* Border radius */
|
|
133
|
+
radius-200
|
|
134
|
+
elevation-100 /* Box shadows */
|
|
135
|
+
elevation-200
|
|
136
|
+
transition-normal
|
|
137
|
+
transition-smooth
|
|
167
138
|
```
|
|
168
139
|
|
|
169
140
|
## Browser Support
|
|
170
141
|
|
|
171
|
-
- **Modern browsers**: Full support with
|
|
142
|
+
- **Modern browsers**: Full support with scoped CSS
|
|
172
143
|
- **All other modern browsers (Chrome, Firefox, Safari, Edge)**: CSS custom properties supported
|
|
173
144
|
- **Fallback**: Provide fallback values for older browsers
|
|
174
145
|
|
|
@@ -177,7 +148,7 @@ body {
|
|
|
177
148
|
/* Fallback for older browsers */
|
|
178
149
|
padding: 1rem;
|
|
179
150
|
/* Override if CSS variables supported */
|
|
180
|
-
padding: var(
|
|
151
|
+
padding: var(spacing-100, 1rem);
|
|
181
152
|
}
|
|
182
153
|
```
|
|
183
154
|
|
|
@@ -198,7 +169,7 @@ body {
|
|
|
198
169
|
To rebuild the package after modifying tokens:
|
|
199
170
|
|
|
200
171
|
```bash
|
|
201
|
-
|
|
172
|
+
yarn build
|
|
202
173
|
```
|
|
203
174
|
|
|
204
175
|
## License
|