@janbox/storefront-ui 5.0.3 → 6.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 +31 -5
- package/dist/lib/dialog/dialog/dialog.js +3 -1
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme/preflight.d.ts +1 -0
- package/dist/theme/preflight.js +269 -0
- package/dist/theme/provider.js +0 -257
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,13 +56,20 @@ pnpm add react-router
|
|
|
56
56
|
### 1. Wrap app với ThemeProvider
|
|
57
57
|
|
|
58
58
|
```tsx
|
|
59
|
-
import { ThemeProvider } from '@janbox/storefront-ui/theme';
|
|
59
|
+
import { Preflight, ThemeProvider, defaultTheme } from '@janbox/storefront-ui/theme';
|
|
60
60
|
|
|
61
61
|
function App() {
|
|
62
|
-
return
|
|
62
|
+
return (
|
|
63
|
+
<ThemeProvider theme={defaultTheme}>
|
|
64
|
+
<Preflight />
|
|
65
|
+
{/* Your app */}
|
|
66
|
+
</ThemeProvider>
|
|
67
|
+
);
|
|
63
68
|
}
|
|
64
69
|
```
|
|
65
70
|
|
|
71
|
+
`Preflight` inject reset/base styles mặc định. Nếu app đã dùng Tailwind Preflight, MUI CssBaseline, Normalize.css hoặc reset riêng, có thể bỏ qua component này để tránh xung đột global styles.
|
|
72
|
+
|
|
66
73
|
### 2. Import và sử dụng components
|
|
67
74
|
|
|
68
75
|
```tsx
|
|
@@ -254,7 +261,7 @@ Thư viện cung cấp 60+ components được tổ chức theo các nhóm. Xem
|
|
|
254
261
|
import { Button, Input, Box } from '@janbox/storefront-ui';
|
|
255
262
|
|
|
256
263
|
// Theme utilities
|
|
257
|
-
import { ThemeProvider, getColorVar } from '@janbox/storefront-ui/theme';
|
|
264
|
+
import { Preflight, ThemeProvider, defaultTheme, getColorVar } from '@janbox/storefront-ui/theme';
|
|
258
265
|
|
|
259
266
|
// Hooks
|
|
260
267
|
import { useWindowScreen, useControllableState } from '@janbox/storefront-ui/hooks';
|
|
@@ -327,17 +334,36 @@ Mọi component đều hỗ trợ `sx` prop để override styles:
|
|
|
327
334
|
Wrap root app với `ThemeProvider` để inject design tokens:
|
|
328
335
|
|
|
329
336
|
```tsx
|
|
330
|
-
import { ThemeProvider } from '@janbox/storefront-ui/theme';
|
|
337
|
+
import { ThemeProvider, defaultTheme } from '@janbox/storefront-ui/theme';
|
|
331
338
|
|
|
332
339
|
function App() {
|
|
333
340
|
return (
|
|
334
|
-
<ThemeProvider>
|
|
341
|
+
<ThemeProvider theme={defaultTheme}>
|
|
335
342
|
<YourApp />
|
|
336
343
|
</ThemeProvider>
|
|
337
344
|
);
|
|
338
345
|
}
|
|
339
346
|
```
|
|
340
347
|
|
|
348
|
+
### Preflight
|
|
349
|
+
|
|
350
|
+
Render `Preflight` bên trong `ThemeProvider` nếu app muốn dùng reset/base styles mặc định của thư viện:
|
|
351
|
+
|
|
352
|
+
```tsx
|
|
353
|
+
import { Preflight, ThemeProvider, defaultTheme } from '@janbox/storefront-ui/theme';
|
|
354
|
+
|
|
355
|
+
function App() {
|
|
356
|
+
return (
|
|
357
|
+
<ThemeProvider theme={defaultTheme}>
|
|
358
|
+
<Preflight />
|
|
359
|
+
<YourApp />
|
|
360
|
+
</ThemeProvider>
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Consumer có thể không render `Preflight` nếu đã có global reset riêng.
|
|
366
|
+
|
|
341
367
|
### Design Tokens
|
|
342
368
|
|
|
343
369
|
Design tokens được expose qua CSS variables:
|
|
@@ -22,13 +22,15 @@ const Dialog = (_props) => {
|
|
|
22
22
|
display: "grid",
|
|
23
23
|
placeItems: "center",
|
|
24
24
|
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
|
25
|
-
backdropFilter: "blur(2px)"
|
|
25
|
+
backdropFilter: "blur(2px)",
|
|
26
|
+
paddingBlock: 16
|
|
26
27
|
}
|
|
27
28
|
},
|
|
28
29
|
sx: {
|
|
29
30
|
width: getDialogSizeInNumber(size),
|
|
30
31
|
backgroundColor: getColorVar("surface.default"),
|
|
31
32
|
maxWidth: `calc(100dvw - ${breakpoint.xs.padding * 2}px)`,
|
|
33
|
+
maxHeight: "100%",
|
|
32
34
|
overflow: "hidden",
|
|
33
35
|
display: "flex",
|
|
34
36
|
flexDirection: "column",
|
package/dist/theme/index.d.ts
CHANGED
package/dist/theme/index.js
CHANGED
|
@@ -2,10 +2,12 @@ import { breakpoint, containerQuery, getSmallerScreens, mediaQuery, screens } fr
|
|
|
2
2
|
import { getColorVar, groupedColors, paletteVars, parseColor } from "./palette.js";
|
|
3
3
|
import { getSmallerTypographyVariants, getTypographyVar, typographyVars } from "./typography.js";
|
|
4
4
|
import { ThemeProvider, usePortalContainer, useTheme } from "./provider.js";
|
|
5
|
+
import { Preflight } from "./preflight.js";
|
|
5
6
|
import { createTheme, defaultTheme } from "./create-theme.js";
|
|
6
7
|
const FLOATING_Z_INDEX = 9999;
|
|
7
8
|
export {
|
|
8
9
|
FLOATING_Z_INDEX,
|
|
10
|
+
Preflight,
|
|
9
11
|
ThemeProvider,
|
|
10
12
|
breakpoint,
|
|
11
13
|
containerQuery,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Preflight: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Global } from "@emotion/react";
|
|
3
|
+
import { getColorVar } from "./palette.js";
|
|
4
|
+
import { getTypographyVar } from "./typography.js";
|
|
5
|
+
const Preflight = () => {
|
|
6
|
+
return /* @__PURE__ */ jsx(Global, { styles: preflightStyles });
|
|
7
|
+
};
|
|
8
|
+
const preflightStyles = {
|
|
9
|
+
// ─── Reset / Preflight ───────────────────────────────────────────────────
|
|
10
|
+
// 1. Prevent padding and border from affecting element width.
|
|
11
|
+
// 2. Allow adding a border to an element by just adding a border-width.
|
|
12
|
+
"*, ::before, ::after": {
|
|
13
|
+
boxSizing: "border-box",
|
|
14
|
+
// 1
|
|
15
|
+
borderWidth: 0,
|
|
16
|
+
// 2
|
|
17
|
+
borderStyle: "solid",
|
|
18
|
+
// 2
|
|
19
|
+
borderColor: getColorVar("border.default")
|
|
20
|
+
},
|
|
21
|
+
// 1. Use a consistent sensible line-height in all browsers.
|
|
22
|
+
// 2. Prevent adjustments of font size after orientation changes in iOS.
|
|
23
|
+
// 3. Use a more readable tab size.
|
|
24
|
+
// 4. Use the user's configured `sans` font-family by default.
|
|
25
|
+
// 5. Use the user's configured `sans` font-feature-settings by default.
|
|
26
|
+
// 6. Use the user's configured `sans` font-variation-settings by default.
|
|
27
|
+
// 7. Disable tap highlights on iOS
|
|
28
|
+
"html, :host": {
|
|
29
|
+
lineHeight: 1.5,
|
|
30
|
+
// 1
|
|
31
|
+
WebkitTextSizeAdjust: "100%",
|
|
32
|
+
// 2
|
|
33
|
+
MozTabSize: 4,
|
|
34
|
+
// 3
|
|
35
|
+
tabSize: 4,
|
|
36
|
+
// 3
|
|
37
|
+
fontFamily: 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
|
|
38
|
+
// 4
|
|
39
|
+
fontFeatureSettings: "normal",
|
|
40
|
+
// 5
|
|
41
|
+
fontVariationSettings: "normal",
|
|
42
|
+
// 6
|
|
43
|
+
WebkitTapHighlightColor: "transparent"
|
|
44
|
+
// 7
|
|
45
|
+
},
|
|
46
|
+
// 1. Remove the margin in all browsers.
|
|
47
|
+
// 2. Inherit line-height from `html` — overridden below by app-level typography.
|
|
48
|
+
body: {
|
|
49
|
+
margin: 0,
|
|
50
|
+
// 1
|
|
51
|
+
// ─── App-level styles ───────────────────────────────────────────
|
|
52
|
+
display: "flex",
|
|
53
|
+
flexDirection: "column",
|
|
54
|
+
minHeight: "100dvh",
|
|
55
|
+
color: getColorVar("neutral.600"),
|
|
56
|
+
backgroundColor: getColorVar("background.default"),
|
|
57
|
+
fontSize: getTypographyVar("sm").fontSize,
|
|
58
|
+
lineHeight: getTypographyVar("sm").lineHeight
|
|
59
|
+
},
|
|
60
|
+
// 1. Add the correct height in Firefox.
|
|
61
|
+
// 2. Correct the inheritance of border color in Firefox.
|
|
62
|
+
// 3. Ensure horizontal rules are visible by default.
|
|
63
|
+
hr: {
|
|
64
|
+
height: 0,
|
|
65
|
+
// 1
|
|
66
|
+
color: "inherit",
|
|
67
|
+
// 2
|
|
68
|
+
borderTopWidth: "1px"
|
|
69
|
+
// 3
|
|
70
|
+
},
|
|
71
|
+
// Add the correct text decoration in Chrome, Edge, and Safari.
|
|
72
|
+
"abbr:where([title])": {
|
|
73
|
+
textDecoration: "underline dotted"
|
|
74
|
+
},
|
|
75
|
+
// Remove the default font size and weight for headings.
|
|
76
|
+
"h1, h2, h3, h4, h5, h6": {
|
|
77
|
+
fontSize: "inherit",
|
|
78
|
+
fontWeight: "inherit"
|
|
79
|
+
},
|
|
80
|
+
// Reset links to optimize for opt-in styling instead of opt-out.
|
|
81
|
+
a: {
|
|
82
|
+
color: "inherit",
|
|
83
|
+
textDecoration: "inherit"
|
|
84
|
+
},
|
|
85
|
+
// Add the correct font weight in Edge and Safari.
|
|
86
|
+
"b, strong": {
|
|
87
|
+
fontWeight: "bolder"
|
|
88
|
+
},
|
|
89
|
+
// 1. Use the user's configured `mono` font-family by default.
|
|
90
|
+
// 2. Use the user's configured `mono` font-feature-settings by default.
|
|
91
|
+
// 3. Use the user's configured `mono` font-variation-settings by default.
|
|
92
|
+
// 4. Correct the odd `em` font sizing in all browsers.
|
|
93
|
+
"code, kbd, samp, pre": {
|
|
94
|
+
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
|
|
95
|
+
// 1
|
|
96
|
+
fontFeatureSettings: "normal",
|
|
97
|
+
// 2
|
|
98
|
+
fontVariationSettings: "normal",
|
|
99
|
+
// 3
|
|
100
|
+
fontSize: "1em"
|
|
101
|
+
// 4
|
|
102
|
+
},
|
|
103
|
+
// Add the correct font size in all browsers.
|
|
104
|
+
small: {
|
|
105
|
+
fontSize: "80%"
|
|
106
|
+
},
|
|
107
|
+
// Prevent `sub` and `sup` elements from affecting the line height in all browsers.
|
|
108
|
+
"sub, sup": {
|
|
109
|
+
fontSize: "75%",
|
|
110
|
+
lineHeight: 0,
|
|
111
|
+
position: "relative",
|
|
112
|
+
verticalAlign: "baseline"
|
|
113
|
+
},
|
|
114
|
+
sub: {
|
|
115
|
+
bottom: "-0.25em"
|
|
116
|
+
},
|
|
117
|
+
sup: {
|
|
118
|
+
top: "-0.5em"
|
|
119
|
+
},
|
|
120
|
+
// 1. Remove text indentation from table contents in Chrome and Safari.
|
|
121
|
+
// 2. Correct table border color inheritance in all Chrome and Safari.
|
|
122
|
+
// 3. Remove gaps between table borders by default.
|
|
123
|
+
table: {
|
|
124
|
+
textIndent: 0,
|
|
125
|
+
// 1
|
|
126
|
+
borderColor: "inherit",
|
|
127
|
+
// 2
|
|
128
|
+
borderCollapse: "collapse"
|
|
129
|
+
// 3
|
|
130
|
+
},
|
|
131
|
+
// 1. Change the font styles in all browsers.
|
|
132
|
+
// 2. Remove the margin in Firefox and Safari.
|
|
133
|
+
// 3. Remove default padding in all browsers.
|
|
134
|
+
"button, input, optgroup, select, textarea": {
|
|
135
|
+
fontFamily: "inherit",
|
|
136
|
+
// 1
|
|
137
|
+
fontFeatureSettings: "inherit",
|
|
138
|
+
// 1
|
|
139
|
+
fontVariationSettings: "inherit",
|
|
140
|
+
// 1
|
|
141
|
+
fontSize: "100%",
|
|
142
|
+
// 1
|
|
143
|
+
fontWeight: "inherit",
|
|
144
|
+
// 1
|
|
145
|
+
lineHeight: "inherit",
|
|
146
|
+
// 1
|
|
147
|
+
letterSpacing: "inherit",
|
|
148
|
+
// 1
|
|
149
|
+
color: "inherit",
|
|
150
|
+
// 1
|
|
151
|
+
margin: 0,
|
|
152
|
+
// 2
|
|
153
|
+
padding: 0
|
|
154
|
+
// 3
|
|
155
|
+
},
|
|
156
|
+
// Remove the inheritance of text transform in Edge and Firefox.
|
|
157
|
+
"button, select": {
|
|
158
|
+
textTransform: "none"
|
|
159
|
+
},
|
|
160
|
+
// 1. Correct the inability to style clickable types in iOS and Safari.
|
|
161
|
+
// 2. Remove default button styles.
|
|
162
|
+
"button, input:where([type='button']), input:where([type='reset']), input:where([type='submit'])": {
|
|
163
|
+
WebkitAppearance: "button",
|
|
164
|
+
// 1
|
|
165
|
+
backgroundColor: "transparent",
|
|
166
|
+
// 2
|
|
167
|
+
backgroundImage: "none"
|
|
168
|
+
// 2
|
|
169
|
+
},
|
|
170
|
+
// Use the modern Firefox focus style for all focusable elements.
|
|
171
|
+
":-moz-focusring": {
|
|
172
|
+
outline: "auto"
|
|
173
|
+
},
|
|
174
|
+
// Remove the additional `:invalid` styles in Firefox.
|
|
175
|
+
":-moz-ui-invalid": {
|
|
176
|
+
boxShadow: "none"
|
|
177
|
+
},
|
|
178
|
+
// Add the correct vertical alignment in Chrome and Firefox.
|
|
179
|
+
progress: {
|
|
180
|
+
verticalAlign: "baseline"
|
|
181
|
+
},
|
|
182
|
+
// Correct the cursor style of increment and decrement buttons in Safari.
|
|
183
|
+
"::-webkit-inner-spin-button, ::-webkit-outer-spin-button": {
|
|
184
|
+
height: "auto"
|
|
185
|
+
},
|
|
186
|
+
// 1. Correct the odd appearance in Chrome and Safari.
|
|
187
|
+
// 2. Correct the outline style in Safari.
|
|
188
|
+
"[type='search']": {
|
|
189
|
+
WebkitAppearance: "textfield",
|
|
190
|
+
// 1
|
|
191
|
+
outlineOffset: "-2px"
|
|
192
|
+
// 2
|
|
193
|
+
},
|
|
194
|
+
// Remove the inner padding in Chrome and Safari on macOS.
|
|
195
|
+
"::-webkit-search-decoration": {
|
|
196
|
+
WebkitAppearance: "none"
|
|
197
|
+
},
|
|
198
|
+
// 1. Correct the inability to style clickable types in iOS and Safari.
|
|
199
|
+
// 2. Change font properties to `inherit` in Safari.
|
|
200
|
+
"::-webkit-file-upload-button": {
|
|
201
|
+
WebkitAppearance: "button",
|
|
202
|
+
// 1
|
|
203
|
+
font: "inherit"
|
|
204
|
+
// 2
|
|
205
|
+
},
|
|
206
|
+
// Add the correct display in Chrome and Safari.
|
|
207
|
+
summary: {
|
|
208
|
+
display: "list-item"
|
|
209
|
+
},
|
|
210
|
+
// Removes the default spacing and border for appropriate elements.
|
|
211
|
+
"blockquote, dl, dd, h1, h2, h3, h4, h5, h6, hr, figure, p, pre": {
|
|
212
|
+
margin: 0
|
|
213
|
+
},
|
|
214
|
+
fieldset: {
|
|
215
|
+
margin: 0,
|
|
216
|
+
padding: 0
|
|
217
|
+
},
|
|
218
|
+
legend: {
|
|
219
|
+
padding: 0
|
|
220
|
+
},
|
|
221
|
+
"ol, ul, menu": {
|
|
222
|
+
listStyle: "none",
|
|
223
|
+
margin: 0,
|
|
224
|
+
padding: 0
|
|
225
|
+
},
|
|
226
|
+
// Reset default styling for dialogs.
|
|
227
|
+
dialog: {
|
|
228
|
+
padding: 0
|
|
229
|
+
},
|
|
230
|
+
// Prevent resizing textareas horizontally by default.
|
|
231
|
+
textarea: {
|
|
232
|
+
resize: "vertical"
|
|
233
|
+
},
|
|
234
|
+
// 1. Reset the default placeholder opacity in Firefox.
|
|
235
|
+
// 2. Set the default placeholder color to gray 400.
|
|
236
|
+
"input::placeholder, textarea::placeholder": {
|
|
237
|
+
opacity: 1,
|
|
238
|
+
// 1
|
|
239
|
+
color: getColorVar("neutral.400")
|
|
240
|
+
},
|
|
241
|
+
// Set the default cursor for buttons.
|
|
242
|
+
"button, [role='button']": {
|
|
243
|
+
cursor: "pointer"
|
|
244
|
+
},
|
|
245
|
+
// Make sure disabled buttons don't get the pointer cursor.
|
|
246
|
+
":disabled": {
|
|
247
|
+
cursor: "default"
|
|
248
|
+
},
|
|
249
|
+
// 1. Make replaced elements `display: block` by default.
|
|
250
|
+
// 2. Add `vertical-align: middle` to align replaced elements more sensibly by default.
|
|
251
|
+
"img, svg, video, canvas, audio, iframe, embed, object": {
|
|
252
|
+
display: "block",
|
|
253
|
+
// 1
|
|
254
|
+
verticalAlign: "middle"
|
|
255
|
+
// 2
|
|
256
|
+
},
|
|
257
|
+
// Constrain images and videos to the parent width and preserve their intrinsic aspect ratio.
|
|
258
|
+
"img, video": {
|
|
259
|
+
maxWidth: "100%",
|
|
260
|
+
height: "auto"
|
|
261
|
+
},
|
|
262
|
+
// Make elements with the HTML hidden attribute stay hidden by default.
|
|
263
|
+
"[hidden]:where(:not([hidden='until-found']))": {
|
|
264
|
+
display: "none"
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
export {
|
|
268
|
+
Preflight
|
|
269
|
+
};
|
package/dist/theme/provider.js
CHANGED
|
@@ -45,263 +45,6 @@ const createGlobalStyle = ({ palette, typography }) => {
|
|
|
45
45
|
)
|
|
46
46
|
);
|
|
47
47
|
return {
|
|
48
|
-
// ─── Reset / Preflight ───────────────────────────────────────────────────
|
|
49
|
-
// 1. Prevent padding and border from affecting element width.
|
|
50
|
-
// 2. Allow adding a border to an element by just adding a border-width.
|
|
51
|
-
"*, ::before, ::after": {
|
|
52
|
-
boxSizing: "border-box",
|
|
53
|
-
// 1
|
|
54
|
-
borderWidth: 0,
|
|
55
|
-
// 2
|
|
56
|
-
borderStyle: "solid",
|
|
57
|
-
// 2
|
|
58
|
-
borderColor: getColorVar("border.default")
|
|
59
|
-
},
|
|
60
|
-
// 1. Use a consistent sensible line-height in all browsers.
|
|
61
|
-
// 2. Prevent adjustments of font size after orientation changes in iOS.
|
|
62
|
-
// 3. Use a more readable tab size.
|
|
63
|
-
// 4. Use the user's configured `sans` font-family by default.
|
|
64
|
-
// 5. Use the user's configured `sans` font-feature-settings by default.
|
|
65
|
-
// 6. Use the user's configured `sans` font-variation-settings by default.
|
|
66
|
-
// 7. Disable tap highlights on iOS
|
|
67
|
-
"html, :host": {
|
|
68
|
-
lineHeight: 1.5,
|
|
69
|
-
// 1
|
|
70
|
-
WebkitTextSizeAdjust: "100%",
|
|
71
|
-
// 2
|
|
72
|
-
MozTabSize: 4,
|
|
73
|
-
// 3
|
|
74
|
-
tabSize: 4,
|
|
75
|
-
// 3
|
|
76
|
-
fontFamily: 'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',
|
|
77
|
-
// 4
|
|
78
|
-
fontFeatureSettings: "normal",
|
|
79
|
-
// 5
|
|
80
|
-
fontVariationSettings: "normal",
|
|
81
|
-
// 6
|
|
82
|
-
WebkitTapHighlightColor: "transparent"
|
|
83
|
-
// 7
|
|
84
|
-
},
|
|
85
|
-
// 1. Remove the margin in all browsers.
|
|
86
|
-
// 2. Inherit line-height from `html` — overridden below by app-level typography.
|
|
87
|
-
body: {
|
|
88
|
-
margin: 0,
|
|
89
|
-
// 1
|
|
90
|
-
// ─── App-level styles ───────────────────────────────────────────
|
|
91
|
-
display: "flex",
|
|
92
|
-
flexDirection: "column",
|
|
93
|
-
minHeight: "100dvh",
|
|
94
|
-
color: getColorVar("neutral.600"),
|
|
95
|
-
backgroundColor: getColorVar("background.default"),
|
|
96
|
-
fontSize: getTypographyVar("sm").fontSize,
|
|
97
|
-
lineHeight: getTypographyVar("sm").lineHeight
|
|
98
|
-
},
|
|
99
|
-
// 1. Add the correct height in Firefox.
|
|
100
|
-
// 2. Correct the inheritance of border color in Firefox.
|
|
101
|
-
// 3. Ensure horizontal rules are visible by default.
|
|
102
|
-
hr: {
|
|
103
|
-
height: 0,
|
|
104
|
-
// 1
|
|
105
|
-
color: "inherit",
|
|
106
|
-
// 2
|
|
107
|
-
borderTopWidth: "1px"
|
|
108
|
-
// 3
|
|
109
|
-
},
|
|
110
|
-
// Add the correct text decoration in Chrome, Edge, and Safari.
|
|
111
|
-
"abbr:where([title])": {
|
|
112
|
-
textDecoration: "underline dotted"
|
|
113
|
-
},
|
|
114
|
-
// Remove the default font size and weight for headings.
|
|
115
|
-
"h1, h2, h3, h4, h5, h6": {
|
|
116
|
-
fontSize: "inherit",
|
|
117
|
-
fontWeight: "inherit"
|
|
118
|
-
},
|
|
119
|
-
// Reset links to optimize for opt-in styling instead of opt-out.
|
|
120
|
-
a: {
|
|
121
|
-
color: "inherit",
|
|
122
|
-
textDecoration: "inherit"
|
|
123
|
-
},
|
|
124
|
-
// Add the correct font weight in Edge and Safari.
|
|
125
|
-
"b, strong": {
|
|
126
|
-
fontWeight: "bolder"
|
|
127
|
-
},
|
|
128
|
-
// 1. Use the user's configured `mono` font-family by default.
|
|
129
|
-
// 2. Use the user's configured `mono` font-feature-settings by default.
|
|
130
|
-
// 3. Use the user's configured `mono` font-variation-settings by default.
|
|
131
|
-
// 4. Correct the odd `em` font sizing in all browsers.
|
|
132
|
-
"code, kbd, samp, pre": {
|
|
133
|
-
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
|
|
134
|
-
// 1
|
|
135
|
-
fontFeatureSettings: "normal",
|
|
136
|
-
// 2
|
|
137
|
-
fontVariationSettings: "normal",
|
|
138
|
-
// 3
|
|
139
|
-
fontSize: "1em"
|
|
140
|
-
// 4
|
|
141
|
-
},
|
|
142
|
-
// Add the correct font size in all browsers.
|
|
143
|
-
small: {
|
|
144
|
-
fontSize: "80%"
|
|
145
|
-
},
|
|
146
|
-
// Prevent `sub` and `sup` elements from affecting the line height in all browsers.
|
|
147
|
-
"sub, sup": {
|
|
148
|
-
fontSize: "75%",
|
|
149
|
-
lineHeight: 0,
|
|
150
|
-
position: "relative",
|
|
151
|
-
verticalAlign: "baseline"
|
|
152
|
-
},
|
|
153
|
-
sub: {
|
|
154
|
-
bottom: "-0.25em"
|
|
155
|
-
},
|
|
156
|
-
sup: {
|
|
157
|
-
top: "-0.5em"
|
|
158
|
-
},
|
|
159
|
-
// 1. Remove text indentation from table contents in Chrome and Safari.
|
|
160
|
-
// 2. Correct table border color inheritance in all Chrome and Safari.
|
|
161
|
-
// 3. Remove gaps between table borders by default.
|
|
162
|
-
table: {
|
|
163
|
-
textIndent: 0,
|
|
164
|
-
// 1
|
|
165
|
-
borderColor: "inherit",
|
|
166
|
-
// 2
|
|
167
|
-
borderCollapse: "collapse"
|
|
168
|
-
// 3
|
|
169
|
-
},
|
|
170
|
-
// 1. Change the font styles in all browsers.
|
|
171
|
-
// 2. Remove the margin in Firefox and Safari.
|
|
172
|
-
// 3. Remove default padding in all browsers.
|
|
173
|
-
"button, input, optgroup, select, textarea": {
|
|
174
|
-
fontFamily: "inherit",
|
|
175
|
-
// 1
|
|
176
|
-
fontFeatureSettings: "inherit",
|
|
177
|
-
// 1
|
|
178
|
-
fontVariationSettings: "inherit",
|
|
179
|
-
// 1
|
|
180
|
-
fontSize: "100%",
|
|
181
|
-
// 1
|
|
182
|
-
fontWeight: "inherit",
|
|
183
|
-
// 1
|
|
184
|
-
lineHeight: "inherit",
|
|
185
|
-
// 1
|
|
186
|
-
letterSpacing: "inherit",
|
|
187
|
-
// 1
|
|
188
|
-
color: "inherit",
|
|
189
|
-
// 1
|
|
190
|
-
margin: 0,
|
|
191
|
-
// 2
|
|
192
|
-
padding: 0
|
|
193
|
-
// 3
|
|
194
|
-
},
|
|
195
|
-
// Remove the inheritance of text transform in Edge and Firefox.
|
|
196
|
-
"button, select": {
|
|
197
|
-
textTransform: "none"
|
|
198
|
-
},
|
|
199
|
-
// 1. Correct the inability to style clickable types in iOS and Safari.
|
|
200
|
-
// 2. Remove default button styles.
|
|
201
|
-
"button, input:where([type='button']), input:where([type='reset']), input:where([type='submit'])": {
|
|
202
|
-
WebkitAppearance: "button",
|
|
203
|
-
// 1
|
|
204
|
-
backgroundColor: "transparent",
|
|
205
|
-
// 2
|
|
206
|
-
backgroundImage: "none"
|
|
207
|
-
// 2
|
|
208
|
-
},
|
|
209
|
-
// Use the modern Firefox focus style for all focusable elements.
|
|
210
|
-
":-moz-focusring": {
|
|
211
|
-
outline: "auto"
|
|
212
|
-
},
|
|
213
|
-
// Remove the additional `:invalid` styles in Firefox.
|
|
214
|
-
":-moz-ui-invalid": {
|
|
215
|
-
boxShadow: "none"
|
|
216
|
-
},
|
|
217
|
-
// Add the correct vertical alignment in Chrome and Firefox.
|
|
218
|
-
progress: {
|
|
219
|
-
verticalAlign: "baseline"
|
|
220
|
-
},
|
|
221
|
-
// Correct the cursor style of increment and decrement buttons in Safari.
|
|
222
|
-
"::-webkit-inner-spin-button, ::-webkit-outer-spin-button": {
|
|
223
|
-
height: "auto"
|
|
224
|
-
},
|
|
225
|
-
// 1. Correct the odd appearance in Chrome and Safari.
|
|
226
|
-
// 2. Correct the outline style in Safari.
|
|
227
|
-
"[type='search']": {
|
|
228
|
-
WebkitAppearance: "textfield",
|
|
229
|
-
// 1
|
|
230
|
-
outlineOffset: "-2px"
|
|
231
|
-
// 2
|
|
232
|
-
},
|
|
233
|
-
// Remove the inner padding in Chrome and Safari on macOS.
|
|
234
|
-
"::-webkit-search-decoration": {
|
|
235
|
-
WebkitAppearance: "none"
|
|
236
|
-
},
|
|
237
|
-
// 1. Correct the inability to style clickable types in iOS and Safari.
|
|
238
|
-
// 2. Change font properties to `inherit` in Safari.
|
|
239
|
-
"::-webkit-file-upload-button": {
|
|
240
|
-
WebkitAppearance: "button",
|
|
241
|
-
// 1
|
|
242
|
-
font: "inherit"
|
|
243
|
-
// 2
|
|
244
|
-
},
|
|
245
|
-
// Add the correct display in Chrome and Safari.
|
|
246
|
-
summary: {
|
|
247
|
-
display: "list-item"
|
|
248
|
-
},
|
|
249
|
-
// Removes the default spacing and border for appropriate elements.
|
|
250
|
-
"blockquote, dl, dd, h1, h2, h3, h4, h5, h6, hr, figure, p, pre": {
|
|
251
|
-
margin: 0
|
|
252
|
-
},
|
|
253
|
-
fieldset: {
|
|
254
|
-
margin: 0,
|
|
255
|
-
padding: 0
|
|
256
|
-
},
|
|
257
|
-
legend: {
|
|
258
|
-
padding: 0
|
|
259
|
-
},
|
|
260
|
-
"ol, ul, menu": {
|
|
261
|
-
listStyle: "none",
|
|
262
|
-
margin: 0,
|
|
263
|
-
padding: 0
|
|
264
|
-
},
|
|
265
|
-
// Reset default styling for dialogs.
|
|
266
|
-
dialog: {
|
|
267
|
-
padding: 0
|
|
268
|
-
},
|
|
269
|
-
// Prevent resizing textareas horizontally by default.
|
|
270
|
-
textarea: {
|
|
271
|
-
resize: "vertical"
|
|
272
|
-
},
|
|
273
|
-
// 1. Reset the default placeholder opacity in Firefox.
|
|
274
|
-
// 2. Set the default placeholder color to gray 400.
|
|
275
|
-
"input::placeholder, textarea::placeholder": {
|
|
276
|
-
opacity: 1,
|
|
277
|
-
// 1
|
|
278
|
-
color: getColorVar("neutral.400")
|
|
279
|
-
},
|
|
280
|
-
// Set the default cursor for buttons.
|
|
281
|
-
"button, [role='button']": {
|
|
282
|
-
cursor: "pointer"
|
|
283
|
-
},
|
|
284
|
-
// Make sure disabled buttons don't get the pointer cursor.
|
|
285
|
-
":disabled": {
|
|
286
|
-
cursor: "default"
|
|
287
|
-
},
|
|
288
|
-
// 1. Make replaced elements `display: block` by default.
|
|
289
|
-
// 2. Add `vertical-align: middle` to align replaced elements more sensibly by default.
|
|
290
|
-
"img, svg, video, canvas, audio, iframe, embed, object": {
|
|
291
|
-
display: "block",
|
|
292
|
-
// 1
|
|
293
|
-
verticalAlign: "middle"
|
|
294
|
-
// 2
|
|
295
|
-
},
|
|
296
|
-
// Constrain images and videos to the parent width and preserve their intrinsic aspect ratio.
|
|
297
|
-
"img, video": {
|
|
298
|
-
maxWidth: "100%",
|
|
299
|
-
height: "auto"
|
|
300
|
-
},
|
|
301
|
-
// Make elements with the HTML hidden attribute stay hidden by default.
|
|
302
|
-
"[hidden]:where(:not([hidden='until-found']))": {
|
|
303
|
-
display: "none"
|
|
304
|
-
},
|
|
305
48
|
// ─── CSS Variables ───────────────────────────────────────────────────────
|
|
306
49
|
":root": {
|
|
307
50
|
...colorVars,
|