@scalewing/react 1.63.0 → 1.65.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/CHANGELOG.md +41 -0
- package/README.md +56 -1
- package/dist/components/DocsLayout.d.ts +14 -0
- package/dist/components/DocsLayout.js +20 -0
- package/dist/components/SiteHeader.d.ts +8 -4
- package/dist/components/SiteHeader.js +10 -5
- package/dist/components/docs-layout/DocsLayoutNav.d.ts +11 -0
- package/dist/components/docs-layout/DocsLayoutNav.js +16 -0
- package/dist/components/docs-layout/types.d.ts +43 -0
- package/dist/components/docs-layout/types.js +1 -0
- package/dist/components/docs-layout/validate.d.ts +8 -0
- package/dist/components/docs-layout/validate.js +27 -0
- package/dist/components/site-header/SiteHeaderSearch.d.ts +16 -0
- package/dist/components/site-header/SiteHeaderSearch.js +19 -0
- package/dist/components/site-header/types.d.ts +24 -0
- package/dist/components/site-header/validate.d.ts +1 -1
- package/dist/components/site-header/validate.js +22 -1
- package/dist/css/css-components.js +3 -0
- package/dist/css/css-docs-layout-nav.d.ts +1 -0
- package/dist/css/css-docs-layout-nav.js +109 -0
- package/dist/css/css-docs-layout.d.ts +2 -0
- package/dist/css/css-docs-layout.js +193 -0
- package/dist/css/css-site-header-search.d.ts +2 -0
- package/dist/css/css-site-header-search.js +336 -0
- package/dist/css/css-site-header.js +6 -1
- package/dist/css/stylesheet.js +2 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -0
- package/dist/styles.css +508 -0
- package/package.json +1 -1
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { typographyVariants } from '@scalewing/tokens';
|
|
2
|
+
import { breakpointQuery } from './breakpoints.js';
|
|
3
|
+
import { chevronStroke } from './chevron.js';
|
|
4
|
+
import { cssDocsLayoutNavRules } from './css-docs-layout-nav.js';
|
|
5
|
+
import { quietFill } from './quiet-fill.js';
|
|
6
|
+
import { siteHeaderBarMaxWidth, siteHeaderGutter, siteHeaderGutterQuery, siteHeaderWideHeight, } from './site-header-geometry.js';
|
|
7
|
+
const label = typographyVariants.label;
|
|
8
|
+
/** From `lg` the navigation is a side column. */
|
|
9
|
+
const fromLg = breakpointQuery('from', 'lg');
|
|
10
|
+
/*
|
|
11
|
+
* The width from which the `aside` column shows: an internal media query
|
|
12
|
+
* of the component (as AppShell's 75rem), not a public breakpoint.
|
|
13
|
+
*/
|
|
14
|
+
const docsLayoutWideQuery = '(min-width: 80rem)';
|
|
15
|
+
/* The side column's and the aside column's widths, geometry of this frame. */
|
|
16
|
+
const sideWidth = '15rem';
|
|
17
|
+
const asideWidth = '13rem';
|
|
18
|
+
/*
|
|
19
|
+
* The frame: centred at the site header bar's width with its gutters, so
|
|
20
|
+
* the navigation's start lines up with the brand. Below \`lg\` one column;
|
|
21
|
+
* from \`lg\` the side navigation and the content (its article at most the
|
|
22
|
+
* reading width); from 80rem, when an aside is given, a third column at
|
|
23
|
+
* the end. The side and aside columns stick below the window's top, below a
|
|
24
|
+
* sticky SiteHeader's wide bar and hairline when one is on the page
|
|
25
|
+
* (\`html:has(.sw-site-header-sticky)\`, as its scroll padding does), and
|
|
26
|
+
* scroll themselves only when taller than the window.
|
|
27
|
+
*/
|
|
28
|
+
function frameRules() {
|
|
29
|
+
return `.sw-docs-layout {
|
|
30
|
+
--sw-docs-layout-top: var(--sw-space-5);
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
margin-inline: auto;
|
|
33
|
+
max-width: ${siteHeaderBarMaxWidth};
|
|
34
|
+
padding-block: var(--sw-space-5);
|
|
35
|
+
padding-inline: ${siteHeaderGutter.compact};
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
html:has(.sw-site-header-sticky) .sw-docs-layout {
|
|
40
|
+
--sw-docs-layout-top: calc(${siteHeaderWideHeight} + 1px + var(--sw-space-5));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.sw-docs-layout-content {
|
|
44
|
+
min-width: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.sw-docs-layout-body {
|
|
48
|
+
max-width: var(--sw-reading-max);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.sw-docs-layout-side,
|
|
52
|
+
.sw-docs-layout-aside {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media ${siteHeaderGutterQuery} {
|
|
57
|
+
.sw-docs-layout { padding-inline: ${siteHeaderGutter.wide}; }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media ${fromLg} {
|
|
61
|
+
.sw-docs-layout {
|
|
62
|
+
align-items: start;
|
|
63
|
+
column-gap: var(--sw-space-8);
|
|
64
|
+
display: grid;
|
|
65
|
+
grid-template-columns: ${sideWidth} minmax(0, 1fr);
|
|
66
|
+
padding-block: var(--sw-space-6);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.sw-docs-layout-side {
|
|
70
|
+
display: block;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.sw-docs-layout-side,
|
|
74
|
+
.sw-docs-layout-aside {
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
max-height: calc(100dvh - var(--sw-docs-layout-top) - var(--sw-space-5));
|
|
77
|
+
overflow-y: auto;
|
|
78
|
+
overscroll-behavior: contain;
|
|
79
|
+
position: sticky;
|
|
80
|
+
top: var(--sw-docs-layout-top);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.sw-docs-layout-disclosure {
|
|
84
|
+
display: none;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@media ${docsLayoutWideQuery} {
|
|
89
|
+
.sw-docs-layout-with-aside {
|
|
90
|
+
column-gap: var(--sw-space-6);
|
|
91
|
+
grid-template-columns: ${sideWidth} minmax(0, 1fr) ${asideWidth};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.sw-docs-layout-aside {
|
|
95
|
+
display: block;
|
|
96
|
+
}
|
|
97
|
+
}`;
|
|
98
|
+
}
|
|
99
|
+
/*
|
|
100
|
+
* Below \`lg\` the navigation is a native \`details\` at the top of the
|
|
101
|
+
* content: its \`summary\` a full-width row on the surface with a hairline,
|
|
102
|
+
* the consumer's words at the start and a chevron at the end (down while
|
|
103
|
+
* closed, up while open), at least the md control tall. Opening it shows
|
|
104
|
+
* the navigation's large rows under it in the page flow.
|
|
105
|
+
*/
|
|
106
|
+
function disclosureRules() {
|
|
107
|
+
return `.sw-docs-layout-disclosure {
|
|
108
|
+
margin-bottom: var(--sw-space-5);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.sw-docs-layout-summary {
|
|
112
|
+
align-items: center;
|
|
113
|
+
background: var(--sw-color-surface);
|
|
114
|
+
border: 1px solid var(--sw-color-border);
|
|
115
|
+
border-radius: var(--sw-radius-md);
|
|
116
|
+
box-sizing: border-box;
|
|
117
|
+
color: var(--sw-color-text);
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
display: flex;
|
|
120
|
+
font-family: var(--sw-font-sans);
|
|
121
|
+
font-size: ${label.fontSize}px;
|
|
122
|
+
font-weight: ${label.fontWeight};
|
|
123
|
+
gap: var(--sw-space-3);
|
|
124
|
+
justify-content: space-between;
|
|
125
|
+
letter-spacing: ${label.letterSpacing}px;
|
|
126
|
+
line-height: ${label.lineHeight}px;
|
|
127
|
+
list-style: none;
|
|
128
|
+
min-height: var(--sw-control-md-min-height);
|
|
129
|
+
padding: var(--sw-space-2) var(--sw-space-4);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.sw-docs-layout-summary::-webkit-details-marker {
|
|
133
|
+
display: none;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.sw-docs-layout-summary:hover {
|
|
137
|
+
background: ${quietFill};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.sw-docs-layout-summary:focus-visible {
|
|
141
|
+
outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
|
|
142
|
+
outline-offset: var(--sw-focus-ring-offset);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.sw-docs-layout-marker {
|
|
146
|
+
${chevronStroke}
|
|
147
|
+
flex: none;
|
|
148
|
+
margin-block-end: var(--sw-space-1);
|
|
149
|
+
transform: rotate(45deg);
|
|
150
|
+
transition: transform var(--sw-motion-default) var(--sw-motion-easing);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.sw-docs-layout-disclosure[open] .sw-docs-layout-marker {
|
|
154
|
+
margin-block: var(--sw-space-1) 0;
|
|
155
|
+
transform: rotate(-135deg);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@media (prefers-reduced-motion: reduce) {
|
|
159
|
+
.sw-docs-layout-marker { transition: none; }
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@media (forced-colors: active) {
|
|
163
|
+
.sw-docs-layout-summary { border-color: ButtonText; }
|
|
164
|
+
.sw-docs-layout-marker { border-color: CanvasText; }
|
|
165
|
+
}`;
|
|
166
|
+
}
|
|
167
|
+
export function cssDocsLayoutClasses() {
|
|
168
|
+
return `${frameRules()}
|
|
169
|
+
|
|
170
|
+
${disclosureRules()}
|
|
171
|
+
|
|
172
|
+
${cssDocsLayoutNavRules()}`;
|
|
173
|
+
}
|
|
174
|
+
export function docsLayoutClassCatalog() {
|
|
175
|
+
return [
|
|
176
|
+
'sw-docs-layout',
|
|
177
|
+
'sw-docs-layout-with-aside',
|
|
178
|
+
'sw-docs-layout-side',
|
|
179
|
+
'sw-docs-layout-content',
|
|
180
|
+
'sw-docs-layout-body',
|
|
181
|
+
'sw-docs-layout-aside',
|
|
182
|
+
'sw-docs-layout-disclosure',
|
|
183
|
+
'sw-docs-layout-summary',
|
|
184
|
+
'sw-docs-layout-summary-label',
|
|
185
|
+
'sw-docs-layout-marker',
|
|
186
|
+
'sw-docs-layout-nav',
|
|
187
|
+
'sw-docs-layout-nav-compact',
|
|
188
|
+
'sw-docs-layout-group',
|
|
189
|
+
'sw-docs-layout-group-label',
|
|
190
|
+
'sw-docs-layout-list',
|
|
191
|
+
'sw-docs-layout-link',
|
|
192
|
+
];
|
|
193
|
+
}
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { typographyVariants } from '@scalewing/tokens';
|
|
2
|
+
import { quietFill } from './quiet-fill.js';
|
|
3
|
+
import { siteHeaderCompactHeight as compactHeight, siteHeaderGutter, siteHeaderWideQuery as wide, } from './site-header-geometry.js';
|
|
4
|
+
import { zIndex } from './stacking.js';
|
|
5
|
+
import { coarsePointerQuery, touchTarget } from './touch-target.js';
|
|
6
|
+
const body = typographyVariants.body;
|
|
7
|
+
const caption = typographyVariants.caption;
|
|
8
|
+
const label = typographyVariants.label;
|
|
9
|
+
const search = '.sw-site-header-search';
|
|
10
|
+
const results = '.sw-site-header-search-results';
|
|
11
|
+
const result = '[data-theme] .sw-site-header-search-result';
|
|
12
|
+
/*
|
|
13
|
+
* Below `lg`: a round quiet search button in the bar, before the compact
|
|
14
|
+
* actions, and the search itself a native popover over the whole window
|
|
15
|
+
* (the browser's top layer): a bar the compact header's height holding the
|
|
16
|
+
* filled field and a close button, the results under it scrolling on their
|
|
17
|
+
* own, each a row with a hairline. The field's words are the body size, so
|
|
18
|
+
* an iPhone does not zoom into it.
|
|
19
|
+
*/
|
|
20
|
+
function compactRules() {
|
|
21
|
+
return `.sw-site-header-search-button,
|
|
22
|
+
.sw-site-header-search-close {
|
|
23
|
+
align-items: center;
|
|
24
|
+
appearance: none;
|
|
25
|
+
background: transparent;
|
|
26
|
+
border: 0;
|
|
27
|
+
border-radius: var(--sw-radius-pill);
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
color: var(--sw-color-text);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
flex: none;
|
|
33
|
+
height: var(--sw-control-md-min-height);
|
|
34
|
+
justify-content: center;
|
|
35
|
+
margin: 0;
|
|
36
|
+
padding: 0;
|
|
37
|
+
width: var(--sw-control-md-min-height);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.sw-site-header-search-button {
|
|
41
|
+
margin-inline-start: auto;
|
|
42
|
+
margin-inline-end: calc(-1 * var(--sw-space-4));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.sw-site-header-search-button:hover,
|
|
46
|
+
.sw-site-header-search-close:hover {
|
|
47
|
+
background: ${quietFill};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.sw-site-header-search-button:focus-visible,
|
|
51
|
+
.sw-site-header-search-close:focus-visible {
|
|
52
|
+
outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
|
|
53
|
+
outline-offset: calc(-1 * var(--sw-focus-ring-width));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.sw-site-header-bar:has(.sw-site-header-menu[open]) > .sw-site-header-search-button {
|
|
57
|
+
display: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
* With no popover support the closed search would show in the bar below
|
|
62
|
+
* \`lg\`, so only the field from \`lg\` is drawn there.
|
|
63
|
+
*/
|
|
64
|
+
@supports not selector(:popover-open) {
|
|
65
|
+
.sw-site-header-search-button,
|
|
66
|
+
${search} {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media ${wide} {
|
|
71
|
+
${search} {
|
|
72
|
+
display: block;
|
|
73
|
+
flex: 0 1 16rem;
|
|
74
|
+
margin-inline: auto 0;
|
|
75
|
+
min-width: 10rem;
|
|
76
|
+
position: relative;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
${search}:popover-open {
|
|
82
|
+
background: var(--sw-color-surface);
|
|
83
|
+
border: 0;
|
|
84
|
+
box-sizing: border-box;
|
|
85
|
+
color: var(--sw-color-text);
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
font-family: var(--sw-font-sans);
|
|
89
|
+
height: 100dvh;
|
|
90
|
+
inset: 0;
|
|
91
|
+
margin: 0;
|
|
92
|
+
max-height: none;
|
|
93
|
+
max-width: none;
|
|
94
|
+
overflow: hidden;
|
|
95
|
+
padding: env(safe-area-inset-top, 0px) 0 0;
|
|
96
|
+
width: 100%;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.sw-site-header-search-form {
|
|
100
|
+
align-items: center;
|
|
101
|
+
border-bottom: 1px solid var(--sw-color-border);
|
|
102
|
+
box-sizing: border-box;
|
|
103
|
+
display: flex;
|
|
104
|
+
flex: none;
|
|
105
|
+
gap: var(--sw-space-2);
|
|
106
|
+
margin: 0;
|
|
107
|
+
min-height: ${compactHeight};
|
|
108
|
+
padding-inline: ${siteHeaderGutter.compact} var(--sw-space-2);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.sw-site-header-search-field {
|
|
112
|
+
align-items: center;
|
|
113
|
+
background: ${quietFill};
|
|
114
|
+
border: 1px solid transparent;
|
|
115
|
+
border-radius: var(--sw-radius-pill);
|
|
116
|
+
box-sizing: border-box;
|
|
117
|
+
color: var(--sw-color-muted);
|
|
118
|
+
display: flex;
|
|
119
|
+
flex: 1 1 auto;
|
|
120
|
+
gap: var(--sw-space-2);
|
|
121
|
+
min-height: var(--sw-control-md-min-height);
|
|
122
|
+
min-width: 0;
|
|
123
|
+
padding-inline: var(--sw-space-3);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.sw-site-header-search-field:focus-within {
|
|
127
|
+
outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
|
|
128
|
+
outline-offset: var(--sw-focus-ring-offset);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.sw-site-header-search-icon {
|
|
132
|
+
display: inline-flex;
|
|
133
|
+
flex: none;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
[data-theme] input.sw-site-header-search-input {
|
|
137
|
+
appearance: none;
|
|
138
|
+
background: transparent;
|
|
139
|
+
border: 0;
|
|
140
|
+
color: var(--sw-color-text);
|
|
141
|
+
flex: 1 1 auto;
|
|
142
|
+
font-family: inherit;
|
|
143
|
+
font-size: ${body.fontSize}px;
|
|
144
|
+
line-height: ${body.lineHeight}px;
|
|
145
|
+
margin: 0;
|
|
146
|
+
min-width: 0;
|
|
147
|
+
outline: none;
|
|
148
|
+
padding: 0;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
[data-theme] input.sw-site-header-search-input:focus-visible {
|
|
152
|
+
outline: none;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
[data-theme] input.sw-site-header-search-input::placeholder {
|
|
156
|
+
color: var(--sw-color-muted);
|
|
157
|
+
opacity: 1;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
${results}:not([hidden]) {
|
|
161
|
+
box-sizing: border-box;
|
|
162
|
+
display: flex;
|
|
163
|
+
flex: 1 1 auto;
|
|
164
|
+
flex-direction: column;
|
|
165
|
+
min-height: 0;
|
|
166
|
+
overflow-y: auto;
|
|
167
|
+
padding: var(--sw-space-2) ${siteHeaderGutter.compact} var(--sw-space-6);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.sw-site-header-search-status {
|
|
171
|
+
color: var(--sw-color-muted);
|
|
172
|
+
font-size: ${caption.fontSize}px;
|
|
173
|
+
line-height: ${caption.lineHeight}px;
|
|
174
|
+
margin: 0;
|
|
175
|
+
padding-block: var(--sw-space-2);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.sw-site-header-search-status:empty {
|
|
179
|
+
padding: 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.sw-site-header-search-list {
|
|
183
|
+
list-style: none;
|
|
184
|
+
margin: 0;
|
|
185
|
+
padding: 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
${result} {
|
|
189
|
+
border-bottom: 1px solid var(--sw-color-border);
|
|
190
|
+
color: var(--sw-color-text);
|
|
191
|
+
display: flex;
|
|
192
|
+
flex-direction: column;
|
|
193
|
+
gap: var(--sw-space-1);
|
|
194
|
+
min-height: ${touchTarget};
|
|
195
|
+
padding-block: var(--sw-space-3);
|
|
196
|
+
text-decoration: none;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
${result}:focus-visible {
|
|
200
|
+
outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
|
|
201
|
+
outline-offset: calc(-1 * var(--sw-focus-ring-width));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.sw-site-header-search-result-title {
|
|
205
|
+
font-size: ${label.fontSize}px;
|
|
206
|
+
font-weight: ${label.fontWeight};
|
|
207
|
+
letter-spacing: ${label.letterSpacing}px;
|
|
208
|
+
line-height: ${label.lineHeight}px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.sw-site-header-search-result-text {
|
|
212
|
+
color: var(--sw-color-muted);
|
|
213
|
+
font-size: ${caption.fontSize}px;
|
|
214
|
+
line-height: ${caption.lineHeight}px;
|
|
215
|
+
}`;
|
|
216
|
+
}
|
|
217
|
+
/*
|
|
218
|
+
* From \`lg\`: the popover is laid out in the bar as a plain box, after the
|
|
219
|
+
* destinations and before the actions, pushed to the end with them; the
|
|
220
|
+
* buttons are gone, and the field is an sm pill with a hairline. The
|
|
221
|
+
* results drop down under the field's end as a raised panel over the page,
|
|
222
|
+
* each a row that takes the quiet fill on hover.
|
|
223
|
+
*/
|
|
224
|
+
function wideRules() {
|
|
225
|
+
return `@media ${wide} {
|
|
226
|
+
.sw-site-header-search-button,
|
|
227
|
+
.sw-site-header-search-close {
|
|
228
|
+
display: none;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
${search}[popover]:not(:popover-open) {
|
|
232
|
+
background: transparent;
|
|
233
|
+
border: 0;
|
|
234
|
+
color: inherit;
|
|
235
|
+
display: block;
|
|
236
|
+
flex: 0 1 16rem;
|
|
237
|
+
height: auto;
|
|
238
|
+
min-width: 10rem;
|
|
239
|
+
inset: auto;
|
|
240
|
+
margin-inline: auto 0;
|
|
241
|
+
max-height: none;
|
|
242
|
+
max-width: none;
|
|
243
|
+
overflow: visible;
|
|
244
|
+
padding: 0;
|
|
245
|
+
position: relative;
|
|
246
|
+
width: auto;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.sw-site-header-search-form {
|
|
250
|
+
border: 0;
|
|
251
|
+
min-height: 0;
|
|
252
|
+
padding: 0;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.sw-site-header-search-field {
|
|
256
|
+
background: var(--sw-color-surface);
|
|
257
|
+
border-color: var(--sw-color-border);
|
|
258
|
+
min-height: var(--sw-control-sm-min-height);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
[data-theme] input.sw-site-header-search-input {
|
|
262
|
+
font-size: ${label.fontSize}px;
|
|
263
|
+
line-height: ${label.lineHeight}px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
${results}:not([hidden]) {
|
|
267
|
+
background: var(--sw-color-surface);
|
|
268
|
+
border: 1px solid var(--sw-color-border);
|
|
269
|
+
border-radius: var(--sw-radius-lg);
|
|
270
|
+
box-shadow: var(--sw-elevation-md);
|
|
271
|
+
inset-inline-end: 0;
|
|
272
|
+
max-height: min(70vh, 32rem);
|
|
273
|
+
padding: var(--sw-space-2);
|
|
274
|
+
position: absolute;
|
|
275
|
+
top: calc(100% + var(--sw-space-2));
|
|
276
|
+
width: min(28rem, calc(100vw - 2 * ${siteHeaderGutter.wide}));
|
|
277
|
+
${zIndex('popup')}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.sw-site-header-search-status {
|
|
281
|
+
padding-inline: var(--sw-space-3);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
${result} {
|
|
285
|
+
border: 0;
|
|
286
|
+
border-radius: var(--sw-radius-md);
|
|
287
|
+
min-height: 0;
|
|
288
|
+
padding: var(--sw-space-2) var(--sw-space-3);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
${result}:hover {
|
|
292
|
+
background: ${quietFill};
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
@media ${wide} and ${coarsePointerQuery} {
|
|
297
|
+
.sw-site-header-search-field { min-height: ${touchTarget}; }
|
|
298
|
+
}`;
|
|
299
|
+
}
|
|
300
|
+
export function cssSiteHeaderSearchRules() {
|
|
301
|
+
return `${compactRules()}
|
|
302
|
+
|
|
303
|
+
${wideRules()}
|
|
304
|
+
|
|
305
|
+
@media (forced-colors: active) {
|
|
306
|
+
.sw-site-header-search-field,
|
|
307
|
+
${results}:not([hidden]) {
|
|
308
|
+
border: 1px solid CanvasText;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.sw-site-header-search-button,
|
|
312
|
+
.sw-site-header-search-close {
|
|
313
|
+
border: 1px solid ButtonText;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
${result} { color: LinkText; }
|
|
317
|
+
}`;
|
|
318
|
+
}
|
|
319
|
+
export function siteHeaderSearchClassCatalog() {
|
|
320
|
+
return [
|
|
321
|
+
'sw-site-header-search-button',
|
|
322
|
+
'sw-site-header-search',
|
|
323
|
+
'sw-site-header-search-form',
|
|
324
|
+
'sw-site-header-search-field',
|
|
325
|
+
'sw-site-header-search-icon',
|
|
326
|
+
'sw-site-header-search-input',
|
|
327
|
+
'sw-site-header-search-close',
|
|
328
|
+
'sw-site-header-search-results',
|
|
329
|
+
'sw-site-header-search-status',
|
|
330
|
+
'sw-site-header-search-list',
|
|
331
|
+
'sw-site-header-search-row',
|
|
332
|
+
'sw-site-header-search-result',
|
|
333
|
+
'sw-site-header-search-result-title',
|
|
334
|
+
'sw-site-header-search-result-text',
|
|
335
|
+
];
|
|
336
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { typographyVariants } from '@scalewing/tokens';
|
|
2
2
|
import { cssSiteHeaderAnchorRules } from './css-site-header-anchors.js';
|
|
3
|
+
import { cssSiteHeaderSearchRules, siteHeaderSearchClassCatalog, } from './css-site-header-search.js';
|
|
3
4
|
import { cssSiteHeaderSkipLinkRules } from './css-site-header-skip-link.js';
|
|
4
5
|
import { quietFill } from './quiet-fill.js';
|
|
5
6
|
import { siteHeaderBarMaxWidth, siteHeaderCompactHeight as compactHeight, siteHeaderGutter, siteHeaderGutterQuery, siteHeaderWideHeight as wideHeight, siteHeaderWideQuery as wide, } from './site-header-geometry.js';
|
|
@@ -123,7 +124,8 @@ function barRules() {
|
|
|
123
124
|
* rows with hairlines and the menu's actions at the panel's foot. It
|
|
124
125
|
* scrolls on its own when the window is short. While it is open the bar's
|
|
125
126
|
* compact actions step aside, since the menu holds its own actions, so the
|
|
126
|
-
* bar shows only the brand and the close button
|
|
127
|
+
* bar shows only the brand and the close button (the search button
|
|
128
|
+
* steps aside too).
|
|
127
129
|
*/
|
|
128
130
|
function menuRules() {
|
|
129
131
|
return `.sw-site-header-menu > summary {
|
|
@@ -227,6 +229,8 @@ ${cssSiteHeaderSkipLinkRules()}
|
|
|
227
229
|
|
|
228
230
|
${cssSiteHeaderAnchorRules()}
|
|
229
231
|
|
|
232
|
+
${cssSiteHeaderSearchRules()}
|
|
233
|
+
|
|
230
234
|
/*
|
|
231
235
|
* Forced colours drop box shadows, so the current destination's bar is a
|
|
232
236
|
* thick underline there.
|
|
@@ -273,5 +277,6 @@ export function siteHeaderClassCatalog() {
|
|
|
273
277
|
'sw-site-header-panel',
|
|
274
278
|
'sw-site-header-menu-nav',
|
|
275
279
|
'sw-site-header-menu-actions',
|
|
280
|
+
...siteHeaderSearchClassCatalog(),
|
|
276
281
|
];
|
|
277
282
|
}
|
package/dist/css/stylesheet.js
CHANGED
|
@@ -35,6 +35,7 @@ import { heroClassCatalog } from './css-hero.js';
|
|
|
35
35
|
import { pageHeaderClassCatalog } from './css-page-header.js';
|
|
36
36
|
import { siteFooterClassCatalog } from './css-site-footer.js';
|
|
37
37
|
import { siteHeaderClassCatalog } from './css-site-header.js';
|
|
38
|
+
import { docsLayoutClassCatalog } from './css-docs-layout.js';
|
|
38
39
|
import { statTileClassCatalog } from './css-stat-tile.js';
|
|
39
40
|
import { descriptionListClassCatalog } from './css-description-list.js';
|
|
40
41
|
import { tabsClassCatalog } from './css-tabs.js';
|
|
@@ -158,6 +159,7 @@ export function utilityClassCatalog() {
|
|
|
158
159
|
...pageHeaderClassCatalog(),
|
|
159
160
|
...siteFooterClassCatalog(),
|
|
160
161
|
...siteHeaderClassCatalog(),
|
|
162
|
+
...docsLayoutClassCatalog(),
|
|
161
163
|
...statTileClassCatalog(),
|
|
162
164
|
...descriptionListClassCatalog(),
|
|
163
165
|
...tabsClassCatalog(),
|
package/dist/index.d.ts
CHANGED
|
@@ -89,7 +89,9 @@ export { breakpointQuery } from './css/breakpoints.js';
|
|
|
89
89
|
export { Band, bandElements, bandTones, bandWidths, } from './components/Band.js';
|
|
90
90
|
export type { BandElement, BandProps, BandTone, BandWidth, } from './components/Band.js';
|
|
91
91
|
export { SiteHeader } from './components/SiteHeader.js';
|
|
92
|
-
export
|
|
92
|
+
export { DocsLayout } from './components/DocsLayout.js';
|
|
93
|
+
export type { DocsLayoutGroup, DocsLayoutItem, DocsLayoutLabels, DocsLayoutProps, } from './components/DocsLayout.js';
|
|
94
|
+
export type { SiteHeaderItem, SiteHeaderLabels, SiteHeaderProps, SiteHeaderSearchOptions, SiteHeaderSkipLink, } from './components/SiteHeader.js';
|
|
93
95
|
export { ScreenPreview, screenPreviewFrames, } from './components/ScreenPreview.js';
|
|
94
96
|
export type { ScreenPreviewFrame, ScreenPreviewProps, } from './components/ScreenPreview.js';
|
|
95
97
|
export { PreviewGroup } from './components/screen-preview/PreviewGroup.js';
|
package/dist/index.js
CHANGED
|
@@ -82,6 +82,7 @@ export { utilityClassCatalog } from './css/stylesheet.js';
|
|
|
82
82
|
export { breakpointQuery } from './css/breakpoints.js';
|
|
83
83
|
export { Band, bandElements, bandTones, bandWidths, } from './components/Band.js';
|
|
84
84
|
export { SiteHeader } from './components/SiteHeader.js';
|
|
85
|
+
export { DocsLayout } from './components/DocsLayout.js';
|
|
85
86
|
export { ScreenPreview, screenPreviewFrames, } from './components/ScreenPreview.js';
|
|
86
87
|
export { PreviewGroup } from './components/screen-preview/PreviewGroup.js';
|
|
87
88
|
export { PreviewImage } from './components/screen-preview/PreviewImage.js';
|