@carbon/styles 1.111.0 → 1.112.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 +89 -0
- package/css/styles.css +323 -213
- package/css/styles.min.css +1 -1
- package/package.json +9 -9
- package/scss/__tests__/__snapshots__/motion-test.js.snap +96 -1
- package/scss/components/__tests__/ai-label-test.js +58 -0
- package/scss/components/__tests__/code-snippet-test.js +46 -1
- package/scss/components/__tests__/content-switcher-test.js +46 -1
- package/scss/components/__tests__/notification-test.js +41 -1
- package/scss/components/code-snippet/_code-snippet.scss +42 -23
- package/scss/components/content-switcher/_content-switcher.scss +265 -189
- package/scss/components/copy-button/_copy-button.scss +5 -3
- package/scss/components/notification/_actionable-notification.scss +37 -18
- package/scss/components/notification/_inline-notification.scss +16 -6
- package/scss/components/progress-indicator/_progress-indicator.scss +28 -17
- package/scss/components/slug/_slug.scss +57 -47
package/README.md
CHANGED
|
@@ -74,6 +74,95 @@ To learn more about the various helpers that `@carbon/styles` provides, checkout
|
|
|
74
74
|
the overview of the files available to use in our
|
|
75
75
|
[Sass docs](./docs/sass.md#files).
|
|
76
76
|
|
|
77
|
+
## Replacing the typeface
|
|
78
|
+
|
|
79
|
+
Carbon is designed, tested, and tuned for IBM Plex. We do not recommend
|
|
80
|
+
replacing the Carbon typeface. If you absolutely need to use a different
|
|
81
|
+
typeface, you'll need to treat it as a build-time Sass customization that your
|
|
82
|
+
application owns. There is no support for runtime typeface overrides on
|
|
83
|
+
prebuilt/CDN Carbon styles.
|
|
84
|
+
|
|
85
|
+
<!-- prettier-ignore-start -->
|
|
86
|
+
> [!WARNING]
|
|
87
|
+
> **Use at your own risk**
|
|
88
|
+
>
|
|
89
|
+
> Overriding the Carbon typeface has broad design and accessibility
|
|
90
|
+
> implications. Carbon type styles are tuned with IBM Plex metrics in mind,
|
|
91
|
+
> including line heights, letter spacing, weight, glyph proportions, ligatures,
|
|
92
|
+
> and fallback behavior. A replacement typeface can change layout, wrapping,
|
|
93
|
+
> density, readability, and interaction states. It can be a significant design
|
|
94
|
+
> and engineering effort to make another typeface work correctly across an
|
|
95
|
+
> application.
|
|
96
|
+
<!-- prettier-ignore-end -->
|
|
97
|
+
|
|
98
|
+
To use Carbon with a different typeface, three things are needed:
|
|
99
|
+
|
|
100
|
+
1. Turn off Carbon's Plex `@font-face` generation
|
|
101
|
+
2. Change the root `font-family` definition(s)
|
|
102
|
+
3. Supply your own `@font-face` rules
|
|
103
|
+
|
|
104
|
+
You can accomplish the first two by configuring the Sass entrypoint that your
|
|
105
|
+
application compiles. This configuration must happen before any other `@use` of
|
|
106
|
+
Carbon Sass modules.
|
|
107
|
+
|
|
108
|
+
```scss
|
|
109
|
+
@use 'sass:string';
|
|
110
|
+
|
|
111
|
+
@use '@carbon/styles' with (
|
|
112
|
+
// Turn off Carbon's Plex `@font-face` generation
|
|
113
|
+
$css--font-face: false,
|
|
114
|
+
|
|
115
|
+
// Change the root `font-family` definition(s)
|
|
116
|
+
$font-families:
|
|
117
|
+
(
|
|
118
|
+
'sans':
|
|
119
|
+
string.unquote(
|
|
120
|
+
"'Inter Local', system-ui, -apple-system, BlinkMacSystemFont, '.SFNSText-Regular', sans-serif"
|
|
121
|
+
),
|
|
122
|
+
'mono':
|
|
123
|
+
string.unquote(
|
|
124
|
+
"'IBM Plex Mono', system-ui, -apple-system, BlinkMacSystemFont, '.SFNSText-Regular', monospace"
|
|
125
|
+
),
|
|
126
|
+
'serif':
|
|
127
|
+
string.unquote(
|
|
128
|
+
"'IBM Plex Serif', system-ui, -apple-system, BlinkMacSystemFont, '.SFNSText-Regular', serif"
|
|
129
|
+
),
|
|
130
|
+
// Include any other Carbon font family keys your application compiles.
|
|
131
|
+
)
|
|
132
|
+
);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`$font-families` is not merged with Carbon's defaults. If you configure this
|
|
136
|
+
map, include every family key your compiled styles need, such as `sans`, `mono`,
|
|
137
|
+
`serif`, or any additional language-specific Plex stacks used by your
|
|
138
|
+
application.
|
|
139
|
+
|
|
140
|
+
Then, supply your own `@font-face` rules to load your replacement font assets.
|
|
141
|
+
|
|
142
|
+
```scss
|
|
143
|
+
@font-face {
|
|
144
|
+
font-display: swap;
|
|
145
|
+
font-family: 'Inter Local';
|
|
146
|
+
font-style: normal;
|
|
147
|
+
font-weight: 400;
|
|
148
|
+
src: url('./fonts/inter-latin-400-normal.woff2') format('woff2');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@font-face {
|
|
152
|
+
font-display: swap;
|
|
153
|
+
font-family: 'Inter Local';
|
|
154
|
+
font-style: normal;
|
|
155
|
+
font-weight: 600;
|
|
156
|
+
src: url('./fonts/inter-latin-600-normal.woff2') format('woff2');
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Only load the weights, styles, and Unicode ranges that your application needs,
|
|
161
|
+
but make sure they cover the font weights and styles your Carbon usage emits. If
|
|
162
|
+
you use a third-party font service, review its privacy and regional compliance
|
|
163
|
+
implications carefully, including whether font requests expose user data in ways
|
|
164
|
+
your application cannot accept.
|
|
165
|
+
|
|
77
166
|
## Theming
|
|
78
167
|
|
|
79
168
|
You can change the default theme of Carbon by doing the following:
|