@scalewing/react 1.64.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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # @scalewing/react
2
2
 
3
+ ## 1.65.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3cfbc90: `SiteHeader search`: the site's search in the header, rendered on the server
8
+ with no script. `search` (`SiteHeaderSearchOptions`: `{ action, name?, label,
9
+ placeholder, labels: { open, close }, icon }`) is one GET form drawn once:
10
+ from `lg` an sm search field in the bar after the destinations, pushed to the
11
+ end with the actions; below `lg` a 44 px search button before the compact
12
+ actions that opens the same form over the whole window as a native popover
13
+ (the field at the body size so an iPhone does not zoom in, a close button
14
+ drawn with `closeIcon`, the results under it). Opening, Escape, closing and
15
+ submitting need no script (the consumer's script focuses the field on
16
+ `toggle`), and the form submits to `action` as `name` (default `q`). An
17
+ empty `hidden` results panel with a polite status, a list and a row
18
+ `template` is the consumer's script to fill: from `lg` it drops down under
19
+ the field as a raised panel, below `lg` it fills the window. New classes
20
+ `sw-site-header-search*`; blank words, a `name` that is not a plain
21
+ parameter name, or no `icon` throw a `RangeError`. No new tokens or
22
+ dependencies. Request: `docs/requests/futmas-site-header-search.md`.
23
+
3
24
  ## 1.64.0
4
25
 
5
26
  ### Minor Changes
package/README.md CHANGED
@@ -1148,7 +1148,7 @@ const { headings, omissions } = inspectMarkdown(page.body, {
1148
1148
  </Band>
1149
1149
  ```
1150
1150
 
1151
- `SiteHeader` is a public site's header. Supply `brand` (such as a logo linked to the home page), `navLabel` and `items` (`{ id, label, href, current? }`, `current` as SectionNav's: `page`, `location` or `true` sets `aria-current`), `labels` (`openMenu`, `closeMenu`) and the decorative `menuIcon` and `closeIcon` glyphs. From `lg` the bar shows the brand, the destinations as a row of links (the current one at label weight over a bar in the words' colour, a thick underline in forced colours) and `actions` at its end, such as a language switch, Sign in (`Box as="a" link="quiet"`) and a `ButtonLink`. Below `lg` it shows the brand, `compactActions` and a menu button that opens, under the bar over the rest of the window, the destinations as large rows (the current one in the accent) and `menuActions` at the panel's foot, such as full-width `ButtonLink`s. The menu is a native `details`, so it opens and closes by touch, click and keyboard with no script, as a page rendered on the server needs; its `summary` is the button, named `openMenu` or `closeMenu` by its state. Script adds Escape (focus back on the button), and closes it when a link in it is chosen, focus leaves it, a press lands outside it, or the window widens to `lg`; nothing traps focus. A page rendered on the server has the no-script menu until it hydrates; a site that never hydrates keeps it, which still opens and closes. While the menu is open the bar's `compactActions` step aside (the menu holds its own `menuActions`), so the bar shows only the brand and the close button. The bar is 56 px tall below `lg` and 72 px from it, on the solid surface with a hairline under it; `sticky` (default `true`) keeps it at the window's top. While a sticky header is on the page the document's `scroll-padding-top` clears the bar, its hairline and a small gap, so a `#fragment` link, `:target` and `scrollIntoView` land below the bar instead of under it; a header with `sticky={false}` leaves the scroll padding alone. An optional `skipLink` (`{ label, href }`, such as `{ label: 'Skip to content', href: '#main' }`) is the header's first focusable element: visually hidden until it has focus, then a pill on the surface with the focus ring over the bar's start. Give the target (usually `main`) the matching `id`, and `tabIndex={-1}` so every browser moves focus there with the jump. No items, blank or repeated ids, blank labels or hrefs, a blank `navLabel` or menu label, or a skip link with a blank label or an `href` that is not a `#fragment` throw a `RangeError`.
1151
+ `SiteHeader` is a public site's header. Supply `brand` (such as a logo linked to the home page), `navLabel` and `items` (`{ id, label, href, current? }`, `current` as SectionNav's: `page`, `location` or `true` sets `aria-current`), `labels` (`openMenu`, `closeMenu`) and the decorative `menuIcon` and `closeIcon` glyphs. From `lg` the bar shows the brand, the destinations as a row of links (the current one at label weight over a bar in the words' colour, a thick underline in forced colours) and `actions` at its end, such as a language switch, Sign in (`Box as="a" link="quiet"`) and a `ButtonLink`. Below `lg` it shows the brand, `compactActions` and a menu button that opens, under the bar over the rest of the window, the destinations as large rows (the current one in the accent) and `menuActions` at the panel's foot, such as full-width `ButtonLink`s. The menu is a native `details`, so it opens and closes by touch, click and keyboard with no script, as a page rendered on the server needs; its `summary` is the button, named `openMenu` or `closeMenu` by its state. Script adds Escape (focus back on the button), and closes it when a link in it is chosen, focus leaves it, a press lands outside it, or the window widens to `lg`; nothing traps focus. A page rendered on the server has the no-script menu until it hydrates; a site that never hydrates keeps it, which still opens and closes. While the menu is open the bar's `compactActions` step aside (the menu holds its own `menuActions`), as does a `search` button, so the bar shows only the brand and the close button. The bar is 56 px tall below `lg` and 72 px from it, on the solid surface with a hairline under it; `sticky` (default `true`) keeps it at the window's top. While a sticky header is on the page the document's `scroll-padding-top` clears the bar, its hairline and a small gap, so a `#fragment` link, `:target` and `scrollIntoView` land below the bar instead of under it; a header with `sticky={false}` leaves the scroll padding alone. An optional `skipLink` (`{ label, href }`, such as `{ label: 'Skip to content', href: '#main' }`) is the header's first focusable element: visually hidden until it has focus, then a pill on the surface with the focus ring over the bar's start. Give the target (usually `main`) the matching `id`, and `tabIndex={-1}` so every browser moves focus there with the jump. No items, blank or repeated ids, blank labels or hrefs, a blank `navLabel` or menu label, or a skip link with a blank label or an `href` that is not a `#fragment` throw a `RangeError`.
1152
1152
 
1153
1153
  ```tsx
1154
1154
  <SiteHeader
@@ -1173,6 +1173,21 @@ const { headings, omissions } = inspectMarkdown(page.body, {
1173
1173
  />
1174
1174
  ```
1175
1175
 
1176
+ An optional `search` (`SiteHeaderSearchOptions`: `{ action, name?, label, placeholder, labels: { open, close }, icon }`) adds the site's search. It is one GET form drawn once: from `lg` a search field in the bar (an sm pill with a hairline and the decorative `icon`, named `label`, showing `placeholder`), after the destinations and pushed to the bar's end with the `actions`; below `lg` a round search button (named `labels.open`, 44 px on touch) before the compact actions that opens the same form over the whole window as a native popover on the top layer, with the filled field at the top (the body size, so an iPhone does not zoom in), a close button beside it (named `labels.close`, drawn with `closeIcon`) and the results under it. Opening, closing (Escape or the close button) and submitting need no script: the form sends the query to `action` as `name` (default `q`), the site's results page. The popover is not modal and the browser moves no focus into it, so the site's script should focus the field on the popover's `toggle` event; with no script the reader taps the field. It needs Popover support (Safari 17, Firefox 125, Chrome 114); without it only the field from `lg` is drawn. An open search stays a full-window overlay if the window widens past `lg` until it is closed. The results are the consumer's: Scalewing draws an empty, `hidden` panel (`.sw-site-header-search-results`, which the field's `aria-controls` names) holding a polite status line (`.sw-site-header-search-status`), a list (`.sw-site-header-search-list`) and a row `template` (`.sw-site-header-search-row`: an `li` holding an `a.sw-site-header-search-result` with a `-title` and a `-text` span); a site's script fills them as the reader types and un-hides the panel. The status is a polite live region inside the panel, so write its final words after un-hiding it, in a later task (after the search resolves), or the first announcement may be missed. From `lg` the panel drops down under the field's end as a raised panel over the page, each result a row that takes the quiet fill on hover; below `lg` the results fill the window under the field, each a row with a hairline. A server render puts the row in the template's `content`; a client render leaves it as the template's child. A blank `action`, `label`, `placeholder` or button name, a `name` that is not a plain parameter name, or no `icon` throws a `RangeError`.
1177
+
1178
+ ```tsx
1179
+ <SiteHeader
1180
+ …
1181
+ search={{
1182
+ action: '/docs/search/',
1183
+ label: 'Search the docs',
1184
+ placeholder: 'Search the docs',
1185
+ labels: { open: 'Search', close: 'Close search' },
1186
+ icon: <SearchIcon />,
1187
+ }}
1188
+ />
1189
+ ```
1190
+
1176
1191
  `Hero` is a public page's opening, a `section` named by its title: an optional `eyebrow` (muted label words), the `title` (the page's one `h1`, in the `hero` size), an optional `lead` (the `lead` size) and `actions` (links or buttons in a wrapping row, stacked to the full width below `md`), with an optional `media` picture. From `md` the picture keeps its own width at the row's end and the words take the rest; below `md` it sits centred under the words. With no picture the words keep the reading width (`--sw-reading-max`). Put it in the page's column (`sw-container`); it sets no gutter or fill of its own. The title always names the section (`aria-labelledby` is not a prop). Leave out `actions` or `media` rather than passing an empty fragment, which keeps its row or column. A blank `title` throws a `RangeError`.
1177
1192
 
1178
1193
  ```tsx
@@ -1,5 +1,5 @@
1
1
  import { type SiteHeaderProps } from './site-header/types.js';
2
- export type { SiteHeaderItem, SiteHeaderLabels, SiteHeaderProps, SiteHeaderSkipLink, } from './site-header/types.js';
2
+ export type { SiteHeaderItem, SiteHeaderLabels, SiteHeaderProps, SiteHeaderSearchOptions, SiteHeaderSkipLink, } from './site-header/types.js';
3
3
  /**
4
4
  * A public site's header: the brand at the start; from `lg` the main
5
5
  * destinations as a row of links (the current one marked by weight and a
@@ -10,8 +10,12 @@ export type { SiteHeaderItem, SiteHeaderLabels, SiteHeaderProps, SiteHeaderSkipL
10
10
  * page rendered on the server needs; script adds Escape (focus back on the
11
11
  * button) and closes it when a link is chosen or focus leaves it. It traps
12
12
  * no focus. While the menu is open the compact actions step aside, so the
13
- * bar shows only the brand and the close button. An optional skip link
14
- * comes first, hidden until it has focus. Invalid items or words throw a
13
+ * bar shows only the brand and the close button (the search button
14
+ * steps aside too). An optional skip link
15
+ * comes first, hidden until it has focus. An optional `search` is a field
16
+ * in the bar from `lg` and a search button below it that opens the same
17
+ * form over the window as a native popover (no script); its results panel
18
+ * is the consumer script's to fill. Invalid items or words throw a
15
19
  * `RangeError`.
16
20
  */
17
- export declare function SiteHeader({ actions, brand, closeIcon, compactActions, items, labels, menuActions, menuIcon, navLabel, skipLink, sticky, }: SiteHeaderProps): import("react").JSX.Element;
21
+ export declare function SiteHeader({ actions, brand, closeIcon, compactActions, items, labels, menuActions, menuIcon, navLabel, search, skipLink, sticky, }: SiteHeaderProps): import("react").JSX.Element;
@@ -4,6 +4,7 @@ import { useRef } from 'react';
4
4
  import { cx } from '../class-names.js';
5
5
  import { tabStop } from '../tab-stop.js';
6
6
  import { SiteHeaderLinks } from './site-header/SiteHeaderLinks.js';
7
+ import { SiteHeaderSearch } from './site-header/SiteHeaderSearch.js';
7
8
  import { useMenuDismiss } from './site-header/use-menu-dismiss.js';
8
9
  import { assertSiteHeaderProps } from './site-header/validate.js';
9
10
  /**
@@ -16,13 +17,17 @@ import { assertSiteHeaderProps } from './site-header/validate.js';
16
17
  * page rendered on the server needs; script adds Escape (focus back on the
17
18
  * button) and closes it when a link is chosen or focus leaves it. It traps
18
19
  * no focus. While the menu is open the compact actions step aside, so the
19
- * bar shows only the brand and the close button. An optional skip link
20
- * comes first, hidden until it has focus. Invalid items or words throw a
20
+ * bar shows only the brand and the close button (the search button
21
+ * steps aside too). An optional skip link
22
+ * comes first, hidden until it has focus. An optional `search` is a field
23
+ * in the bar from `lg` and a search button below it that opens the same
24
+ * form over the window as a native popover (no script); its results panel
25
+ * is the consumer script's to fill. Invalid items or words throw a
21
26
  * `RangeError`.
22
27
  */
23
- export function SiteHeader({ actions, brand, closeIcon, compactActions, items, labels, menuActions, menuIcon, navLabel, skipLink, sticky = true, }) {
24
- assertSiteHeaderProps({ items, labels, navLabel, skipLink });
28
+ export function SiteHeader({ actions, brand, closeIcon, compactActions, items, labels, menuActions, menuIcon, navLabel, search, skipLink, sticky = true, }) {
29
+ assertSiteHeaderProps({ items, labels, navLabel, search, skipLink });
25
30
  const menuRef = useRef(null);
26
31
  useMenuDismiss(menuRef);
27
- return (_jsxs("header", { className: cx('sw-site-header', sticky && 'sw-site-header-sticky'), children: [skipLink ? (_jsx("a", { className: "sw-site-header-skip-link", href: skipLink.href, tabIndex: tabStop, children: skipLink.label })) : null, _jsxs("div", { className: "sw-site-header-bar", children: [_jsx("div", { className: "sw-site-header-brand", children: brand }), _jsx(SiteHeaderLinks, { className: "sw-site-header-nav", items: items, navLabel: navLabel }), actions ? (_jsx("div", { className: "sw-site-header-actions", children: actions })) : null, _jsxs("div", { className: "sw-site-header-compact", children: [compactActions ? (_jsx("div", { className: "sw-site-header-compact-actions", children: compactActions })) : null, _jsxs("details", { className: "sw-site-header-menu", ref: menuRef, children: [_jsxs("summary", { className: "sw-site-header-menu-button", children: [_jsxs("span", { className: "sw-site-header-menu-open", children: [_jsx("span", { "aria-hidden": "true", className: "sw-site-header-glyph", children: menuIcon }), _jsx("span", { className: "sw-sr-only", children: labels.openMenu })] }), _jsxs("span", { className: "sw-site-header-menu-close", children: [_jsx("span", { "aria-hidden": "true", className: "sw-site-header-glyph", children: closeIcon }), _jsx("span", { className: "sw-sr-only", children: labels.closeMenu })] })] }), _jsxs("div", { className: "sw-site-header-panel", children: [_jsx(SiteHeaderLinks, { className: "sw-site-header-menu-nav", items: items, navLabel: navLabel }), menuActions ? (_jsx("div", { className: "sw-site-header-menu-actions", children: menuActions })) : null] })] })] })] })] }));
32
+ return (_jsxs("header", { className: cx('sw-site-header', sticky && 'sw-site-header-sticky'), children: [skipLink ? (_jsx("a", { className: "sw-site-header-skip-link", href: skipLink.href, tabIndex: tabStop, children: skipLink.label })) : null, _jsxs("div", { className: "sw-site-header-bar", children: [_jsx("div", { className: "sw-site-header-brand", children: brand }), _jsx(SiteHeaderLinks, { className: "sw-site-header-nav", items: items, navLabel: navLabel }), search ? (_jsx(SiteHeaderSearch, { closeIcon: closeIcon, search: search })) : null, actions ? (_jsx("div", { className: "sw-site-header-actions", children: actions })) : null, _jsxs("div", { className: "sw-site-header-compact", children: [compactActions ? (_jsx("div", { className: "sw-site-header-compact-actions", children: compactActions })) : null, _jsxs("details", { className: "sw-site-header-menu", ref: menuRef, children: [_jsxs("summary", { className: "sw-site-header-menu-button", children: [_jsxs("span", { className: "sw-site-header-menu-open", children: [_jsx("span", { "aria-hidden": "true", className: "sw-site-header-glyph", children: menuIcon }), _jsx("span", { className: "sw-sr-only", children: labels.openMenu })] }), _jsxs("span", { className: "sw-site-header-menu-close", children: [_jsx("span", { "aria-hidden": "true", className: "sw-site-header-glyph", children: closeIcon }), _jsx("span", { className: "sw-sr-only", children: labels.closeMenu })] })] }), _jsxs("div", { className: "sw-site-header-panel", children: [_jsx(SiteHeaderLinks, { className: "sw-site-header-menu-nav", items: items, navLabel: navLabel }), menuActions ? (_jsx("div", { className: "sw-site-header-menu-actions", children: menuActions })) : null] })] })] })] })] }));
28
33
  }
@@ -0,0 +1,16 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type SiteHeaderSearchOptions } from './types.js';
3
+ /**
4
+ * The header's search: one form drawn once. From `lg` it sits in the bar as
5
+ * a search field; below `lg` it is a native popover that the search button
6
+ * opens over the whole window, with the field at the top, a close button
7
+ * beside it and the results under it, so it opens, closes on Escape and
8
+ * closes from its button with no script. Submitting sends the query to
9
+ * `action` as `name` (a results page). The results panel and its row
10
+ * template are empty until the consumer's script fills them; with no
11
+ * script the form still works.
12
+ */
13
+ export declare function SiteHeaderSearch({ search, closeIcon, }: {
14
+ search: SiteHeaderSearchOptions;
15
+ closeIcon: ReactNode;
16
+ }): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useId } from 'react';
3
+ import { tabStop } from '../../tab-stop.js';
4
+ /**
5
+ * The header's search: one form drawn once. From `lg` it sits in the bar as
6
+ * a search field; below `lg` it is a native popover that the search button
7
+ * opens over the whole window, with the field at the top, a close button
8
+ * beside it and the results under it, so it opens, closes on Escape and
9
+ * closes from its button with no script. Submitting sends the query to
10
+ * `action` as `name` (a results page). The results panel and its row
11
+ * template are empty until the consumer's script fills them; with no
12
+ * script the form still works.
13
+ */
14
+ export function SiteHeaderSearch({ search, closeIcon, }) {
15
+ const id = useId();
16
+ const panelId = `${id}search`;
17
+ const resultsId = `${id}results`;
18
+ return (_jsxs(_Fragment, { children: [_jsx("button", { "aria-label": search.labels.open, className: "sw-site-header-search-button", popoverTarget: panelId, popoverTargetAction: "show", tabIndex: tabStop, type: "button", children: _jsx("span", { "aria-hidden": "true", className: "sw-site-header-glyph", children: search.icon }) }), _jsxs("div", { className: "sw-site-header-search", id: panelId, popover: "auto", children: [_jsxs("form", { action: search.action, className: "sw-site-header-search-form", method: "get", role: "search", children: [_jsxs("div", { className: "sw-site-header-search-field", children: [_jsx("span", { "aria-hidden": "true", className: "sw-site-header-search-icon", children: search.icon }), _jsx("input", { "aria-controls": resultsId, "aria-label": search.label, autoComplete: "off", className: "sw-site-header-search-input", enterKeyHint: "search", name: search.name ?? 'q', placeholder: search.placeholder, tabIndex: tabStop, type: "search" })] }), _jsx("button", { "aria-label": search.labels.close, className: "sw-site-header-search-close", popoverTarget: panelId, popoverTargetAction: "hide", tabIndex: tabStop, type: "button", children: _jsx("span", { "aria-hidden": "true", className: "sw-site-header-glyph", children: closeIcon }) })] }), _jsxs("div", { className: "sw-site-header-search-results", hidden: true, id: resultsId, children: [_jsx("p", { "aria-live": "polite", className: "sw-site-header-search-status" }), _jsx("ul", { className: "sw-site-header-search-list" }), _jsx("template", { className: "sw-site-header-search-row", children: _jsx("li", { children: _jsxs("a", { className: "sw-site-header-search-result", href: "/", children: [_jsx("span", { className: "sw-site-header-search-result-title" }), _jsx("span", { className: "sw-site-header-search-result-text" })] }) }) })] })] })] }));
19
+ }
@@ -25,6 +25,28 @@ export type SiteHeaderSkipLink = {
25
25
  /** The main content's fragment, such as `#main`. */
26
26
  href: string;
27
27
  };
28
+ /**
29
+ * The header's search form: a field in the bar from `lg`, a search button
30
+ * opening a full-window search below it. Submitting goes to `action` (the
31
+ * site's results page) with the query as `name`.
32
+ */
33
+ export type SiteHeaderSearchOptions = {
34
+ /** The results page the form submits to with GET, such as `/docs/search/`. */
35
+ action: string;
36
+ /** The query's parameter name (default `q`). */
37
+ name?: string;
38
+ /** The field's accessible name, such as "Search the docs". */
39
+ label: string;
40
+ /** The empty field's hint, such as "Search the docs". */
41
+ placeholder: string;
42
+ /** The button names: `open` below `lg` ("Search"), `close` in the open search ("Close search"). */
43
+ labels: {
44
+ open: string;
45
+ close: string;
46
+ };
47
+ /** The magnifier glyph, decorative, in the button and the field. */
48
+ icon: ReactNode;
49
+ };
28
50
  export type SiteHeaderProps = {
29
51
  /** The site's mark at the start, such as a logo linked to the home page. */
30
52
  brand: ReactNode;
@@ -50,4 +72,6 @@ export type SiteHeaderProps = {
50
72
  sticky?: boolean;
51
73
  /** A "skip to content" link before everything else in the header. */
52
74
  skipLink?: SiteHeaderSkipLink;
75
+ /** A search field in the bar from `lg`; a search button below it. */
76
+ search?: SiteHeaderSearchOptions;
53
77
  };
@@ -5,4 +5,4 @@ import { type SiteHeaderProps } from './types.js';
5
5
  * button name, and a skip link with blank words or an address that is not
6
6
  * a fragment on the page.
7
7
  */
8
- export declare function assertSiteHeaderProps({ items, labels, navLabel, skipLink, }: Pick<SiteHeaderProps, 'items' | 'labels' | 'navLabel' | 'skipLink'>): void;
8
+ export declare function assertSiteHeaderProps({ items, labels, navLabel, search, skipLink, }: Pick<SiteHeaderProps, 'items' | 'labels' | 'navLabel' | 'search' | 'skipLink'>): void;
@@ -5,7 +5,7 @@ import { assertNavItems } from '../nav-items.js';
5
5
  * button name, and a skip link with blank words or an address that is not
6
6
  * a fragment on the page.
7
7
  */
8
- export function assertSiteHeaderProps({ items, labels, navLabel, skipLink, }) {
8
+ export function assertSiteHeaderProps({ items, labels, navLabel, search, skipLink, }) {
9
9
  if (items.length === 0)
10
10
  throw new RangeError('SiteHeader needs at least one item');
11
11
  assertNavItems('SiteHeader', items);
@@ -17,6 +17,27 @@ export function assertSiteHeaderProps({ items, labels, navLabel, skipLink, }) {
17
17
  throw new RangeError('SiteHeader labels need nonempty openMenu and closeMenu');
18
18
  if (skipLink)
19
19
  assertSkipLink(skipLink);
20
+ if (search)
21
+ assertSearch(search);
22
+ }
23
+ function assertSearch(search) {
24
+ if (typeof search.labels !== 'object' || search.labels === null)
25
+ throw new RangeError('SiteHeader search needs a nonempty action, label, placeholder and open and close labels');
26
+ const words = [
27
+ search.action,
28
+ search.label,
29
+ search.placeholder,
30
+ search.labels.open,
31
+ search.labels.close,
32
+ ];
33
+ if (words.some((word) => !word.trim()))
34
+ throw new RangeError('SiteHeader search needs a nonempty action, label, placeholder and open and close labels');
35
+ if (search.name !== undefined && !/^[\w-]+$/.test(search.name))
36
+ throw new RangeError('SiteHeader search name must be a plain parameter name');
37
+ if (search.icon === null ||
38
+ search.icon === undefined ||
39
+ search.icon === false)
40
+ throw new RangeError('SiteHeader search needs an icon');
20
41
  }
21
42
  function assertSkipLink({ href, label }) {
22
43
  if (!label.trim())
@@ -0,0 +1,2 @@
1
+ export declare function cssSiteHeaderSearchRules(): string;
2
+ export declare function siteHeaderSearchClassCatalog(): string[];
@@ -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/index.d.ts CHANGED
@@ -91,7 +91,7 @@ export type { BandElement, BandProps, BandTone, BandWidth, } from './components/
91
91
  export { SiteHeader } from './components/SiteHeader.js';
92
92
  export { DocsLayout } from './components/DocsLayout.js';
93
93
  export type { DocsLayoutGroup, DocsLayoutItem, DocsLayoutLabels, DocsLayoutProps, } from './components/DocsLayout.js';
94
- export type { SiteHeaderItem, SiteHeaderLabels, SiteHeaderProps, SiteHeaderSkipLink, } from './components/SiteHeader.js';
94
+ export type { SiteHeaderItem, SiteHeaderLabels, SiteHeaderProps, SiteHeaderSearchOptions, SiteHeaderSkipLink, } from './components/SiteHeader.js';
95
95
  export { ScreenPreview, screenPreviewFrames, } from './components/ScreenPreview.js';
96
96
  export type { ScreenPreviewFrame, ScreenPreviewProps, } from './components/ScreenPreview.js';
97
97
  export { PreviewGroup } from './components/screen-preview/PreviewGroup.js';
package/dist/styles.css CHANGED
@@ -6019,6 +6019,291 @@ html:has(.sw-site-header-sticky) {
6019
6019
  }
6020
6020
  }
6021
6021
 
6022
+ .sw-site-header-search-button,
6023
+ .sw-site-header-search-close {
6024
+ align-items: center;
6025
+ appearance: none;
6026
+ background: transparent;
6027
+ border: 0;
6028
+ border-radius: var(--sw-radius-pill);
6029
+ box-sizing: border-box;
6030
+ color: var(--sw-color-text);
6031
+ cursor: pointer;
6032
+ display: inline-flex;
6033
+ flex: none;
6034
+ height: var(--sw-control-md-min-height);
6035
+ justify-content: center;
6036
+ margin: 0;
6037
+ padding: 0;
6038
+ width: var(--sw-control-md-min-height);
6039
+ }
6040
+
6041
+ .sw-site-header-search-button {
6042
+ margin-inline-start: auto;
6043
+ margin-inline-end: calc(-1 * var(--sw-space-4));
6044
+ }
6045
+
6046
+ .sw-site-header-search-button:hover,
6047
+ .sw-site-header-search-close:hover {
6048
+ background: color-mix(in srgb, var(--sw-color-muted) 16%, transparent);
6049
+ }
6050
+
6051
+ .sw-site-header-search-button:focus-visible,
6052
+ .sw-site-header-search-close:focus-visible {
6053
+ outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
6054
+ outline-offset: calc(-1 * var(--sw-focus-ring-width));
6055
+ }
6056
+
6057
+ .sw-site-header-bar:has(.sw-site-header-menu[open]) > .sw-site-header-search-button {
6058
+ display: none;
6059
+ }
6060
+
6061
+ /*
6062
+ * With no popover support the closed search would show in the bar below
6063
+ * `lg`, so only the field from `lg` is drawn there.
6064
+ */
6065
+ @supports not selector(:popover-open) {
6066
+ .sw-site-header-search-button,
6067
+ .sw-site-header-search {
6068
+ display: none;
6069
+ }
6070
+
6071
+ @media (min-width: 64rem) {
6072
+ .sw-site-header-search {
6073
+ display: block;
6074
+ flex: 0 1 16rem;
6075
+ margin-inline: auto 0;
6076
+ min-width: 10rem;
6077
+ position: relative;
6078
+ }
6079
+ }
6080
+ }
6081
+
6082
+ .sw-site-header-search:popover-open {
6083
+ background: var(--sw-color-surface);
6084
+ border: 0;
6085
+ box-sizing: border-box;
6086
+ color: var(--sw-color-text);
6087
+ display: flex;
6088
+ flex-direction: column;
6089
+ font-family: var(--sw-font-sans);
6090
+ height: 100dvh;
6091
+ inset: 0;
6092
+ margin: 0;
6093
+ max-height: none;
6094
+ max-width: none;
6095
+ overflow: hidden;
6096
+ padding: env(safe-area-inset-top, 0px) 0 0;
6097
+ width: 100%;
6098
+ }
6099
+
6100
+ .sw-site-header-search-form {
6101
+ align-items: center;
6102
+ border-bottom: 1px solid var(--sw-color-border);
6103
+ box-sizing: border-box;
6104
+ display: flex;
6105
+ flex: none;
6106
+ gap: var(--sw-space-2);
6107
+ margin: 0;
6108
+ min-height: calc(var(--sw-control-md-min-height) + var(--sw-space-3));
6109
+ padding-inline: var(--sw-space-4) var(--sw-space-2);
6110
+ }
6111
+
6112
+ .sw-site-header-search-field {
6113
+ align-items: center;
6114
+ background: color-mix(in srgb, var(--sw-color-muted) 16%, transparent);
6115
+ border: 1px solid transparent;
6116
+ border-radius: var(--sw-radius-pill);
6117
+ box-sizing: border-box;
6118
+ color: var(--sw-color-muted);
6119
+ display: flex;
6120
+ flex: 1 1 auto;
6121
+ gap: var(--sw-space-2);
6122
+ min-height: var(--sw-control-md-min-height);
6123
+ min-width: 0;
6124
+ padding-inline: var(--sw-space-3);
6125
+ }
6126
+
6127
+ .sw-site-header-search-field:focus-within {
6128
+ outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
6129
+ outline-offset: var(--sw-focus-ring-offset);
6130
+ }
6131
+
6132
+ .sw-site-header-search-icon {
6133
+ display: inline-flex;
6134
+ flex: none;
6135
+ }
6136
+
6137
+ [data-theme] input.sw-site-header-search-input {
6138
+ appearance: none;
6139
+ background: transparent;
6140
+ border: 0;
6141
+ color: var(--sw-color-text);
6142
+ flex: 1 1 auto;
6143
+ font-family: inherit;
6144
+ font-size: 17px;
6145
+ line-height: 25px;
6146
+ margin: 0;
6147
+ min-width: 0;
6148
+ outline: none;
6149
+ padding: 0;
6150
+ }
6151
+
6152
+ [data-theme] input.sw-site-header-search-input:focus-visible {
6153
+ outline: none;
6154
+ }
6155
+
6156
+ [data-theme] input.sw-site-header-search-input::placeholder {
6157
+ color: var(--sw-color-muted);
6158
+ opacity: 1;
6159
+ }
6160
+
6161
+ .sw-site-header-search-results:not([hidden]) {
6162
+ box-sizing: border-box;
6163
+ display: flex;
6164
+ flex: 1 1 auto;
6165
+ flex-direction: column;
6166
+ min-height: 0;
6167
+ overflow-y: auto;
6168
+ padding: var(--sw-space-2) var(--sw-space-4) var(--sw-space-6);
6169
+ }
6170
+
6171
+ .sw-site-header-search-status {
6172
+ color: var(--sw-color-muted);
6173
+ font-size: 13px;
6174
+ line-height: 18px;
6175
+ margin: 0;
6176
+ padding-block: var(--sw-space-2);
6177
+ }
6178
+
6179
+ .sw-site-header-search-status:empty {
6180
+ padding: 0;
6181
+ }
6182
+
6183
+ .sw-site-header-search-list {
6184
+ list-style: none;
6185
+ margin: 0;
6186
+ padding: 0;
6187
+ }
6188
+
6189
+ [data-theme] .sw-site-header-search-result {
6190
+ border-bottom: 1px solid var(--sw-color-border);
6191
+ color: var(--sw-color-text);
6192
+ display: flex;
6193
+ flex-direction: column;
6194
+ gap: var(--sw-space-1);
6195
+ min-height: var(--sw-control-md-min-height);
6196
+ padding-block: var(--sw-space-3);
6197
+ text-decoration: none;
6198
+ }
6199
+
6200
+ [data-theme] .sw-site-header-search-result:focus-visible {
6201
+ outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
6202
+ outline-offset: calc(-1 * var(--sw-focus-ring-width));
6203
+ }
6204
+
6205
+ .sw-site-header-search-result-title {
6206
+ font-size: 15px;
6207
+ font-weight: 600;
6208
+ letter-spacing: -0.2px;
6209
+ line-height: 20px;
6210
+ }
6211
+
6212
+ .sw-site-header-search-result-text {
6213
+ color: var(--sw-color-muted);
6214
+ font-size: 13px;
6215
+ line-height: 18px;
6216
+ }
6217
+
6218
+ @media (min-width: 64rem) {
6219
+ .sw-site-header-search-button,
6220
+ .sw-site-header-search-close {
6221
+ display: none;
6222
+ }
6223
+
6224
+ .sw-site-header-search[popover]:not(:popover-open) {
6225
+ background: transparent;
6226
+ border: 0;
6227
+ color: inherit;
6228
+ display: block;
6229
+ flex: 0 1 16rem;
6230
+ height: auto;
6231
+ min-width: 10rem;
6232
+ inset: auto;
6233
+ margin-inline: auto 0;
6234
+ max-height: none;
6235
+ max-width: none;
6236
+ overflow: visible;
6237
+ padding: 0;
6238
+ position: relative;
6239
+ width: auto;
6240
+ }
6241
+
6242
+ .sw-site-header-search-form {
6243
+ border: 0;
6244
+ min-height: 0;
6245
+ padding: 0;
6246
+ }
6247
+
6248
+ .sw-site-header-search-field {
6249
+ background: var(--sw-color-surface);
6250
+ border-color: var(--sw-color-border);
6251
+ min-height: var(--sw-control-sm-min-height);
6252
+ }
6253
+
6254
+ [data-theme] input.sw-site-header-search-input {
6255
+ font-size: 15px;
6256
+ line-height: 20px;
6257
+ }
6258
+
6259
+ .sw-site-header-search-results:not([hidden]) {
6260
+ background: var(--sw-color-surface);
6261
+ border: 1px solid var(--sw-color-border);
6262
+ border-radius: var(--sw-radius-lg);
6263
+ box-shadow: var(--sw-elevation-md);
6264
+ inset-inline-end: 0;
6265
+ max-height: min(70vh, 32rem);
6266
+ padding: var(--sw-space-2);
6267
+ position: absolute;
6268
+ top: calc(100% + var(--sw-space-2));
6269
+ width: min(28rem, calc(100vw - 2 * var(--sw-space-5)));
6270
+ z-index: 10;
6271
+ }
6272
+
6273
+ .sw-site-header-search-status {
6274
+ padding-inline: var(--sw-space-3);
6275
+ }
6276
+
6277
+ [data-theme] .sw-site-header-search-result {
6278
+ border: 0;
6279
+ border-radius: var(--sw-radius-md);
6280
+ min-height: 0;
6281
+ padding: var(--sw-space-2) var(--sw-space-3);
6282
+ }
6283
+
6284
+ [data-theme] .sw-site-header-search-result:hover {
6285
+ background: color-mix(in srgb, var(--sw-color-muted) 16%, transparent);
6286
+ }
6287
+ }
6288
+
6289
+ @media (min-width: 64rem) and (pointer: coarse) {
6290
+ .sw-site-header-search-field { min-height: var(--sw-control-md-min-height); }
6291
+ }
6292
+
6293
+ @media (forced-colors: active) {
6294
+ .sw-site-header-search-field,
6295
+ .sw-site-header-search-results:not([hidden]) {
6296
+ border: 1px solid CanvasText;
6297
+ }
6298
+
6299
+ .sw-site-header-search-button,
6300
+ .sw-site-header-search-close {
6301
+ border: 1px solid ButtonText;
6302
+ }
6303
+
6304
+ [data-theme] .sw-site-header-search-result { color: LinkText; }
6305
+ }
6306
+
6022
6307
  /*
6023
6308
  * Forced colours drop box shadows, so the current destination's bar is a
6024
6309
  * thick underline there.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalewing/react",
3
- "version": "1.64.0",
3
+ "version": "1.65.0",
4
4
  "description": "Scalewing DOM components and package-owned CSS utilities.",
5
5
  "type": "module",
6
6
  "license": "MIT",