Skip to content

Commit e10e545

Browse files
authored
fix: enable preflight styles for component examples (#36035)
1 parent 4756919 commit e10e545

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,99 @@
11
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
22
<style type="text/tailwindcss">
3+
@layer theme, base, utilities;
34
@import 'tailwindcss/theme' layer(theme);
45
@import 'tailwindcss/utilities' layer(utilities);
56
:root {
67
interpolate-size: allow-keywords;
78
}
89
</style>
10+
<!--
11+
Tailwind's Preflight is omitted above because it resets h1/h2/p/a in
12+
MDX docs (which rely on typography from react-storybook-addon/src/styles.css).
13+
Re-apply the essential resets here inside `@layer base`, scoped to
14+
`.docs-story` so rendered Canvas examples get border/box-sizing/form-element
15+
normalization without affecting the surrounding MDX page. -->
16+
<style>
17+
@layer base {
18+
@scope (.docs-story) {
19+
*,
20+
::before,
21+
::after,
22+
::backdrop,
23+
::file-selector-button {
24+
box-sizing: border-box;
25+
border: 0 solid currentColor;
26+
}
27+
28+
img,
29+
svg,
30+
video,
31+
canvas,
32+
audio,
33+
iframe,
34+
embed,
35+
object {
36+
display: block;
37+
vertical-align: middle;
38+
}
39+
40+
img,
41+
video {
42+
max-width: 100%;
43+
height: auto;
44+
}
45+
46+
button,
47+
input,
48+
optgroup,
49+
select,
50+
textarea,
51+
::file-selector-button {
52+
font-family: inherit;
53+
font-feature-settings: inherit;
54+
font-variation-settings: inherit;
55+
font-size: 100%;
56+
font-weight: inherit;
57+
line-height: inherit;
58+
letter-spacing: inherit;
59+
color: inherit;
60+
}
61+
62+
button,
63+
select {
64+
text-transform: none;
65+
}
66+
67+
button,
68+
input:where([type='button'], [type='reset'], [type='submit']),
69+
::file-selector-button {
70+
appearance: button;
71+
background-color: transparent;
72+
background-image: none;
73+
}
74+
75+
:-moz-focusring {
76+
outline: auto;
77+
}
78+
79+
::placeholder {
80+
opacity: 1;
81+
color: color-mix(in oklab, currentColor 50%, transparent);
82+
}
83+
84+
textarea {
85+
resize: vertical;
86+
}
87+
88+
ol,
89+
ul,
90+
menu {
91+
list-style: none;
92+
}
93+
94+
[hidden]:where(:not([hidden='until-found'])) {
95+
display: none !important;
96+
}
97+
}
98+
}
99+
</style>

0 commit comments

Comments
 (0)