@scalewing/react 1.67.0 → 1.68.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,27 @@
1
1
  # @scalewing/react
2
2
 
3
+ ## 1.68.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5bee8a2: `ScreenPreview frame="device"`, from FutMas's F-024 review (`teisoro-screen-preview.md`):
8
+
9
+ - The bezel is near black in both schemes: the inverse colour (was the text colour, a near-white ring in the dark scheme), with a hairline rim in the border colour so it stands apart from the black dark page. The phone's screen sits on the grouped canvas (black in the dark scheme). A theme overlay of `inverse` recolours the bezel along with the dark band.
10
+ - The phone is drawn at every width. Below `md` it was the card (by design, the viewport being a phone already), so two screenshots side by side on a phone page drew as bare cards; it now takes its column's width with a thinner `space-2` bezel there, and stays 20rem with the `space-3` bezel from `md`.
11
+ - A `PreviewImage` alone fills the phone's screen edge to edge, with no quiet mat round it.
12
+
13
+ - 5bee8a2: `SiteHeader` search, from FutMas's F-024 review (`futmas-site-header-search.md`):
14
+
15
+ - From `lg` the search field gives up its width first on a crowded bar. It now starts at its 10rem floor and grows up to 16rem into the bar's spare room (`flex: 1 1 10rem; max-width: 16rem`, was `flex: 0 1 16rem`), so long destinations and actions (FutMas's Spanish header at 1366 px) no longer wrap while the field keeps 16rem. They shrink only once the field is at 10rem.
16
+ - New optional `labels.cancel` (`search={{ …, labels: { open, close, cancel: 'Cancel' } }}`): the open search's button below `lg` shows that word instead of the ✕ glyph, as an iPhone app's search does beside the field's own clear ✕. The word is the button's only name (no `aria-label`), drawn in the accent at label size, 44 px tall, with the new class `sw-site-header-search-cancel`. Without it the glyph named `labels.close` stays. A blank or non-string `cancel` throws a `RangeError`.
17
+ - The results' row template's link carries `tabindex="0"`, as every Scalewing link does, so Safari's default Tab order reaches a result the site's script clones from it.
18
+
19
+ ## 1.67.1
20
+
21
+ ### Patch Changes
22
+
23
+ - 9f8a835: A tile Checkbox's box now sits above the layer that stretches its press target over the tile, so a press aimed at the box lands on its input. Pointer-driven tests and tools can click a tile's checkbox directly instead of being intercepted by the label.
24
+
3
25
  ## 1.67.0
4
26
 
5
27
  ### Minor Changes
package/README.md CHANGED
@@ -1181,7 +1181,7 @@ const { headings, omissions } = inspectMarkdown(page.body, {
1181
1181
  />
1182
1182
  ```
1183
1183
 
1184
- 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`.
1184
+ An optional `search` (`SiteHeaderSearchOptions`: `{ action, name?, label, placeholder, labels: { open, close, cancel? }, 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`. The field starts at a 10rem floor and grows up to 16rem into the bar's spare room, so on a crowded bar (long words in another language) it gives up its width before any destination or action wraps; only once it is at 10rem do they shrink. 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. With `labels.cancel` (such as `'Cancel'`) that button shows the word instead of the glyph, as an iPhone app's search does beside the field's own clear ✕: the word in the accent, at label size and 44 px tall, its visible words its only name (no `aria-label`). 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 (`cancel` included when given), a `name` that is not a plain parameter name, or no `icon` throws a `RangeError`.
1185
1185
 
1186
1186
  ```tsx
1187
1187
  <SiteHeader
@@ -1190,7 +1190,7 @@ An optional `search` (`SiteHeaderSearchOptions`: `{ action, name?, label, placeh
1190
1190
  action: '/docs/search/',
1191
1191
  label: 'Search the docs',
1192
1192
  placeholder: 'Search the docs',
1193
- labels: { open: 'Search', close: 'Close search' },
1193
+ labels: { open: 'Search', close: 'Close search', cancel: 'Cancel' },
1194
1194
  icon: <SearchIcon />,
1195
1195
  }}
1196
1196
  />
@@ -1208,7 +1208,7 @@ An optional `search` (`SiteHeaderSearchOptions`: `{ action, name?, label, placeh
1208
1208
  />
1209
1209
  ```
1210
1210
 
1211
- `ScreenPreview` is a drawn stand-in for an app's screen on a public page, until a real screenshot replaces it: a `figure` whose screen is one image (`role="img"`) named by `label`, its alternative text, so a screen reader hears that sentence instead of the rows; an optional `caption` shows under it as the `figcaption`. An optional `eyebrow` and `title` head the screen. Its content is `PreviewGroup`s of `PreviewRow`s (`label` at the start, `value` at the end in tabular numerals; `kind` `plain`, `total` in bold past a hairline, `note` a small label over its words, `filled` on the quiet fill, or `alert` on the danger tint) and `PreviewTiles` (`items` of `{ id, label, value }`, three to a row on a phone, six from `md`). `frame="card"` (default) is a surface card whose groups are parted by hairlines; `frame="device"` draws a 20rem phone from `md` (a bezel in the text colour round a quiet screen with a surface header and each group a card) and the card below `md`. A blank `label`, an unknown `frame` or `kind`, no tiles, or a blank or repeated tile id throws a `RangeError`.
1211
+ `ScreenPreview` is a drawn stand-in for an app's screen on a public page, until a real screenshot replaces it: a `figure` whose screen is one image (`role="img"`) named by `label`, its alternative text, so a screen reader hears that sentence instead of the rows; an optional `caption` shows under it as the `figcaption`. An optional `eyebrow` and `title` head the screen. Its content is `PreviewGroup`s of `PreviewRow`s (`label` at the start, `value` at the end in tabular numerals; `kind` `plain`, `total` in bold past a hairline, `note` a small label over its words, `filled` on the quiet fill, or `alert` on the danger tint) and `PreviewTiles` (`items` of `{ id, label, value }`, three to a row on a phone, six from `md`). `frame="card"` (default) is a surface card whose groups are parted by hairlines; `frame="device"` draws a phone at every width: a near-black bezel in the inverse colour (dark in both schemes, with a hairline rim so it stands apart from a black page) round a screen on the grouped canvas with a surface header and each group a card; a `PreviewImage` alone fills that screen edge to edge. Below `md` the phone takes its column's width with a thinner bezel, so two side by side on a phone page stay phones; from `md` it is 20rem wide. A theme overlay of `inverse` recolours the bezel with the dark band. A blank `label`, an unknown `frame` or `kind`, no tiles, or a blank or repeated tile id throws a `RangeError`.
1212
1212
 
1213
1213
  When the real screenshot exists, a `PreviewImage` (`src`, `width`, `height`) holds it in the same frame, filling the screen's body with its height following. It is decorative: `label` stays the alternative text.
1214
1214
 
@@ -4,7 +4,7 @@ export { screenPreviewFrames, type ScreenPreviewFrame };
4
4
  export type ScreenPreviewProps = Omit<HTMLAttributes<HTMLElement>, 'children' | 'role' | 'style' | 'title'> & {
5
5
  /** What the drawn screen shows, said in words: its alternative text. */
6
6
  label: string;
7
- /** `card` (default), or `device`, a phone's bezel from `md`. */
7
+ /** `card` (default), or `device`, a phone's near-black bezel at every width. */
8
8
  frame?: ScreenPreviewFrame;
9
9
  /** A small line above the screen's title, such as where in the app it is. */
10
10
  eyebrow?: ReactNode;
@@ -4,8 +4,8 @@ import { type SiteHeaderSearchOptions } from './types.js';
4
4
  * The header's search: one form drawn once. From `lg` it sits in the bar as
5
5
  * a search field; below `lg` it is a native popover that the search button
6
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
7
+ * (or a Cancel word) beside it and the results under it, so it opens,
8
+ * closes on Escape and closes from its button with no script. Submitting sends the query to
9
9
  * `action` as `name` (a results page). The results panel and its row
10
10
  * template are empty until the consumer's script fills them; with no
11
11
  * script the form still works.
@@ -1,12 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useId } from 'react';
3
+ import { cx } from '../../class-names.js';
3
4
  import { tabStop } from '../../tab-stop.js';
4
5
  /**
5
6
  * The header's search: one form drawn once. From `lg` it sits in the bar as
6
7
  * a search field; below `lg` it is a native popover that the search button
7
8
  * 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
9
+ * (or a Cancel word) beside it and the results under it, so it opens,
10
+ * closes on Escape and closes from its button with no script. Submitting sends the query to
10
11
  * `action` as `name` (a results page). The results panel and its row
11
12
  * template are empty until the consumer's script fills them; with no
12
13
  * script the form still works.
@@ -15,5 +16,12 @@ export function SiteHeaderSearch({ search, closeIcon, }) {
15
16
  const id = useId();
16
17
  const panelId = `${id}search`;
17
18
  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
+ 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(SearchCloseButton, { cancel: search.labels.cancel, close: search.labels.close, closeIcon: closeIcon, panelId: panelId })] }), _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: "/", tabIndex: tabStop, children: [_jsx("span", { className: "sw-site-header-search-result-title" }), _jsx("span", { className: "sw-site-header-search-result-text" })] }) }) })] })] })] }));
20
+ }
21
+ /**
22
+ * Closes the open search below `lg`: the word `cancel` when given, which
23
+ * is then the button's name, or else the ✕ glyph named `close`.
24
+ */
25
+ function SearchCloseButton({ cancel, close, closeIcon, panelId, }) {
26
+ return (_jsx("button", { "aria-label": cancel === undefined ? close : undefined, className: cx('sw-site-header-search-close', cancel !== undefined && 'sw-site-header-search-cancel'), popoverTarget: panelId, popoverTargetAction: "hide", tabIndex: tabStop, type: "button", children: cancel === undefined ? (_jsx("span", { "aria-hidden": "true", className: "sw-site-header-glyph", children: closeIcon })) : (cancel) }));
19
27
  }
@@ -39,10 +39,17 @@ export type SiteHeaderSearchOptions = {
39
39
  label: string;
40
40
  /** The empty field's hint, such as "Search the docs". */
41
41
  placeholder: string;
42
- /** The button names: `open` below `lg` ("Search"), `close` in the open search ("Close search"). */
42
+ /**
43
+ * The button names: `open` below `lg` ("Search"), `close` in the open
44
+ * search ("Close search"), the name of its ✕ glyph. With `cancel`
45
+ * ("Cancel") the open search's button shows that word instead of the
46
+ * glyph, as an iPhone app's search does beside the field's own clear ✕,
47
+ * and the word is its name.
48
+ */
43
49
  labels: {
44
50
  open: string;
45
51
  close: string;
52
+ cancel?: string;
46
53
  };
47
54
  /** The magnifier glyph, decorative, in the button and the field. */
48
55
  icon: ReactNode;
@@ -32,6 +32,9 @@ function assertSearch(search) {
32
32
  ];
33
33
  if (words.some((word) => !word.trim()))
34
34
  throw new RangeError('SiteHeader search needs a nonempty action, label, placeholder and open and close labels');
35
+ if (search.labels.cancel !== undefined &&
36
+ (typeof search.labels.cancel !== 'string' || !search.labels.cancel.trim()))
37
+ throw new RangeError('SiteHeader search labels.cancel must be nonempty words when given');
35
38
  if (search.name !== undefined && !/^[\w-]+$/.test(search.name))
36
39
  throw new RangeError('SiteHeader search name must be a plain parameter name');
37
40
  if (search.icon === null ||
@@ -9,7 +9,10 @@ function edge(color) {
9
9
  * A tile Checkbox: the box, the label and the description inside one
10
10
  * bordered tile as wide as its column, at least the 44 px target plus its
11
11
  * padding. The label's `::after` stretches over the whole tile, so a press
12
- * anywhere on it (the description included) toggles the box. A chosen or
12
+ * anywhere on it (the description included) toggles the box; the box itself
13
+ * sits above that layer, so a press aimed at the box lands on its input
14
+ * (what a pointer-driven test or tool hits first). The tile isolates its
15
+ * layers, so the box never paints over a header or popover. A chosen or
13
16
  * mixed tile takes the accent edge, an invalid one the danger edge (which
14
17
  * wins), twice the hairline through an inset shadow. The description and
15
18
  * the error start under the label's words. Forced colours keep the edges
@@ -21,6 +24,7 @@ export function cssCheckboxTileClasses() {
21
24
  border-radius: var(--sw-radius-md);
22
25
  box-sizing: border-box;
23
26
  gap: 0;
27
+ isolation: isolate;
24
28
  padding: var(--sw-space-2) var(--sw-space-3);
25
29
  position: relative;
26
30
  width: 100%;
@@ -31,6 +35,8 @@ export function cssCheckboxTileClasses() {
31
35
  width: 100%;
32
36
  }
33
37
 
38
+ .sw-checkbox-tile .sw-checkbox-control { z-index: 1; }
39
+
34
40
  .sw-checkbox-tile .sw-checkbox-label::after {
35
41
  border-radius: inherit;
36
42
  content: '';
@@ -1,4 +1,4 @@
1
- /** How a drawn screen is framed: a plain card, or a phone from `md`. */
1
+ /** How a drawn screen is framed: a plain card, or a phone. */
2
2
  export declare const screenPreviewFrames: readonly ["card", "device"];
3
3
  export type ScreenPreviewFrame = (typeof screenPreviewFrames)[number];
4
4
  /** What a drawn row shows: a figure, a total, a note, a filled or an alert row. */
@@ -1,8 +1,9 @@
1
1
  import { typographyVariants } from '@scalewing/tokens';
2
2
  import { breakpointQuery } from './breakpoints.js';
3
+ import { groupedCanvasFill } from './css-canvas-grouped.js';
3
4
  import { toneTintFill, toneTintInk } from './tone-tint.js';
4
5
  const { caption, label, title } = typographyVariants;
5
- /** How a drawn screen is framed: a plain card, or a phone from `md`. */
6
+ /** How a drawn screen is framed: a plain card, or a phone. */
6
7
  export const screenPreviewFrames = ['card', 'device'];
7
8
  /** What a drawn row shows: a figure, a total, a note, a filled or an alert row. */
8
9
  export const previewRowKinds = [
@@ -19,9 +20,9 @@ export function previewRowKindClass(kind) {
19
20
  return `sw-preview-row-${kind}`;
20
21
  }
21
22
  /*
22
- * The card frame, and the device frame below `md`: one surface card whose
23
- * groups are parted by hairlines. Rows set their label at the start and
24
- * their figure at the end in tabular numerals.
23
+ * The card frame: one surface card whose groups are parted by hairlines.
24
+ * Rows set their label at the start and their figure at the end in
25
+ * tabular numerals.
25
26
  */
26
27
  function cardRules() {
27
28
  return `.sw-screen-preview {
@@ -168,55 +169,69 @@ function rowRules() {
168
169
  }`;
169
170
  }
170
171
  /*
171
- * From `md` the device frame draws a phone: a dark bezel (the text colour)
172
- * round a quiet screen whose header is a surface strip and whose groups
173
- * are surface cards. Below `md` it is the card, since the page is already
174
- * a phone.
172
+ * The device frame draws a phone at every width: a near-black bezel (the
173
+ * inverse band's colour, dark in either scheme, a hairline at its edge so
174
+ * it stands apart from a black page) round a screen on the grouped canvas
175
+ * (a quiet grey, black in the dark scheme) whose header is a surface strip
176
+ * and whose groups are surface cards. A screenshot alone fills the screen
177
+ * edge to edge. Below `md` the phone takes its column's width with a
178
+ * thinner bezel, so two side by side on a phone stay phones; from `md` it
179
+ * is 20rem wide.
175
180
  */
181
+ function deviceRules() {
182
+ const device = `.${screenPreviewFrameClass('device')}`;
183
+ return `${device} { --sw-screen-preview-bezel: var(--sw-space-2); }
184
+ ${device} .sw-screen-preview-bezel {
185
+ background: var(--sw-color-inverse);
186
+ border-radius: calc(var(--sw-radius-lg) + var(--sw-screen-preview-bezel));
187
+ box-shadow: inset 0 0 0 1px var(--sw-color-border);
188
+ padding: var(--sw-screen-preview-bezel);
189
+ }
190
+ ${device} .sw-screen-preview-screen {
191
+ background: ${groupedCanvasFill};
192
+ border-radius: var(--sw-radius-lg);
193
+ gap: 0;
194
+ overflow: hidden;
195
+ padding: 0;
196
+ }
197
+ ${device} .sw-screen-preview-header {
198
+ background: var(--sw-color-surface);
199
+ border-bottom: 1px solid var(--sw-color-border);
200
+ padding: var(--sw-space-4);
201
+ }
202
+ ${device} .sw-screen-preview-body { gap: var(--sw-space-3); padding: var(--sw-space-3); }
203
+ ${device} .sw-screen-preview-body:has(> .sw-preview-image:only-child) { padding: 0; }
204
+ ${device} .sw-preview-image { border-radius: 0; }
205
+ ${device} .sw-preview-group {
206
+ background: var(--sw-color-surface);
207
+ border-radius: var(--sw-radius-md);
208
+ padding: var(--sw-space-3);
209
+ }
210
+ ${device} .sw-preview-group + .sw-preview-group { border-top: 0; }
211
+ ${device} .sw-screen-preview-caption { text-align: center; }`;
212
+ }
176
213
  function wideRules() {
177
214
  const device = `.${screenPreviewFrameClass('device')}`;
178
215
  return `@media ${breakpointQuery('from', 'md')} {
179
216
  .${screenPreviewFrameClass('card')} .sw-screen-preview-screen { padding: var(--sw-space-5); }
180
217
  .sw-preview-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
181
- ${device} { width: 20rem; }
182
- ${device} .sw-screen-preview-bezel {
183
- background: var(--sw-color-text);
184
- border-radius: calc(var(--sw-radius-lg) + var(--sw-space-3));
185
- padding: var(--sw-space-3);
186
- }
187
- ${device} .sw-screen-preview-screen {
188
- background: var(--sw-color-subtle);
189
- border-radius: var(--sw-radius-lg);
190
- gap: 0;
191
- overflow: hidden;
192
- padding: 0;
193
- }
194
- ${device} .sw-screen-preview-header {
195
- background: var(--sw-color-surface);
196
- border-bottom: 1px solid var(--sw-color-border);
197
- padding: var(--sw-space-4);
198
- }
199
- ${device} .sw-screen-preview-body { gap: var(--sw-space-3); padding: var(--sw-space-3); }
200
- ${device} .sw-preview-group {
201
- background: var(--sw-color-surface);
202
- border-radius: var(--sw-radius-md);
203
- padding: var(--sw-space-3);
204
- }
205
- ${device} .sw-preview-group + .sw-preview-group { border-top: 0; }
206
- ${device} .sw-screen-preview-caption { text-align: center; }
218
+ ${device} { --sw-screen-preview-bezel: var(--sw-space-3); width: 20rem; }
207
219
  }
208
220
 
209
221
  @media (forced-colors: active) {
210
222
  .sw-screen-preview-screen { border: 1px solid CanvasText; }
211
- }
212
-
213
- @media (forced-colors: active) and ${breakpointQuery('from', 'md')} {
214
- .${screenPreviewFrameClass('device')} .sw-screen-preview-screen { border: 0; }
215
- .${screenPreviewFrameClass('device')} .sw-screen-preview-bezel { border: 1px solid CanvasText; }
223
+ ${device} .sw-screen-preview-screen { border: 0; }
224
+ ${device} .sw-screen-preview-bezel { border: 1px solid CanvasText; }
216
225
  }`;
217
226
  }
218
227
  export function cssScreenPreviewClasses() {
219
- return [cardRules(), imageRules(), rowRules(), wideRules()].join('\n\n');
228
+ return [
229
+ cardRules(),
230
+ imageRules(),
231
+ rowRules(),
232
+ deviceRules(),
233
+ wideRules(),
234
+ ].join('\n\n');
220
235
  }
221
236
  export function screenPreviewClassCatalog() {
222
237
  return [
@@ -9,6 +9,19 @@ const label = typographyVariants.label;
9
9
  const search = '.sw-site-header-search';
10
10
  const results = '.sw-site-header-search-results';
11
11
  const result = '[data-theme] .sw-site-header-search-result';
12
+ /*
13
+ * The field's width in the bar from `lg`: it starts at its 10rem floor and
14
+ * grows into the bar's spare room up to 16rem, so the destinations and the
15
+ * actions keep their words on one line. While the bar has less room than
16
+ * they need beside a 16rem field the field gives it up first; only once it
17
+ * is at its floor (the bar is then short of room in any case) do the
18
+ * destinations and the actions shrink and their words wrap. A field that
19
+ * shrank by `flex-shrink` alone would still take a sliver from them, enough
20
+ * to wrap a label.
21
+ */
22
+ function wideSearchSize(indent) {
23
+ return ['flex: 1 1 10rem;', 'max-width: 16rem;', 'min-width: 10rem;'].join(`\n${indent}`);
24
+ }
12
25
  /*
13
26
  * Below `lg`: a round quiet search button in the bar, before the compact
14
27
  * actions, and the search itself a native popover over the whole window
@@ -47,6 +60,25 @@ function compactRules() {
47
60
  background: ${quietFill};
48
61
  }
49
62
 
63
+ /*
64
+ * The Cancel word in place of the close glyph: the accent's words, as
65
+ * clickable words read, at label size on the same 44 px height, as wide as
66
+ * the word (never narrower than the glyph's button). It follows the
67
+ * close button's rule so its width, padding and colour win over it.
68
+ */
69
+ .sw-site-header-search-cancel {
70
+ color: var(--sw-color-accent);
71
+ font-family: inherit;
72
+ font-size: ${label.fontSize}px;
73
+ font-weight: ${label.fontWeight};
74
+ letter-spacing: ${label.letterSpacing}px;
75
+ line-height: ${label.lineHeight}px;
76
+ padding-inline: var(--sw-space-2);
77
+ min-width: var(--sw-control-md-min-height);
78
+ white-space: nowrap;
79
+ width: auto;
80
+ }
81
+
50
82
  .sw-site-header-search-button:focus-visible,
51
83
  .sw-site-header-search-close:focus-visible {
52
84
  outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
@@ -70,9 +102,8 @@ function compactRules() {
70
102
  @media ${wide} {
71
103
  ${search} {
72
104
  display: block;
73
- flex: 0 1 16rem;
105
+ ${wideSearchSize(' ')}
74
106
  margin-inline: auto 0;
75
- min-width: 10rem;
76
107
  position: relative;
77
108
  }
78
109
  }
@@ -233,13 +264,11 @@ function wideRules() {
233
264
  border: 0;
234
265
  color: inherit;
235
266
  display: block;
236
- flex: 0 1 16rem;
267
+ ${wideSearchSize(' ')}
237
268
  height: auto;
238
- min-width: 10rem;
239
269
  inset: auto;
240
270
  margin-inline: auto 0;
241
271
  max-height: none;
242
- max-width: none;
243
272
  overflow: visible;
244
273
  padding: 0;
245
274
  position: relative;
@@ -313,6 +342,8 @@ ${wideRules()}
313
342
  border: 1px solid ButtonText;
314
343
  }
315
344
 
345
+ .sw-site-header-search-cancel { color: ButtonText; }
346
+
316
347
  ${result} { color: LinkText; }
317
348
  }`;
318
349
  }
@@ -325,6 +356,7 @@ export function siteHeaderSearchClassCatalog() {
325
356
  'sw-site-header-search-icon',
326
357
  'sw-site-header-search-input',
327
358
  'sw-site-header-search-close',
359
+ 'sw-site-header-search-cancel',
328
360
  'sw-site-header-search-results',
329
361
  'sw-site-header-search-status',
330
362
  'sw-site-header-search-list',
package/dist/styles.css CHANGED
@@ -1301,6 +1301,7 @@ body {
1301
1301
  border-radius: var(--sw-radius-md);
1302
1302
  box-sizing: border-box;
1303
1303
  gap: 0;
1304
+ isolation: isolate;
1304
1305
  padding: var(--sw-space-2) var(--sw-space-3);
1305
1306
  position: relative;
1306
1307
  width: 100%;
@@ -1311,6 +1312,8 @@ body {
1311
1312
  width: 100%;
1312
1313
  }
1313
1314
 
1315
+ .sw-checkbox-tile .sw-checkbox-control { z-index: 1; }
1316
+
1314
1317
  .sw-checkbox-tile .sw-checkbox-label::after {
1315
1318
  border-radius: inherit;
1316
1319
  content: '';
@@ -5544,42 +5547,44 @@ button.sw-date-toggle-day[aria-disabled='true'] {
5544
5547
  line-height: 18px;
5545
5548
  }
5546
5549
 
5550
+ .sw-screen-preview-device { --sw-screen-preview-bezel: var(--sw-space-2); }
5551
+ .sw-screen-preview-device .sw-screen-preview-bezel {
5552
+ background: var(--sw-color-inverse);
5553
+ border-radius: calc(var(--sw-radius-lg) + var(--sw-screen-preview-bezel));
5554
+ box-shadow: inset 0 0 0 1px var(--sw-color-border);
5555
+ padding: var(--sw-screen-preview-bezel);
5556
+ }
5557
+ .sw-screen-preview-device .sw-screen-preview-screen {
5558
+ background: var(--sw-canvas-grouped);
5559
+ border-radius: var(--sw-radius-lg);
5560
+ gap: 0;
5561
+ overflow: hidden;
5562
+ padding: 0;
5563
+ }
5564
+ .sw-screen-preview-device .sw-screen-preview-header {
5565
+ background: var(--sw-color-surface);
5566
+ border-bottom: 1px solid var(--sw-color-border);
5567
+ padding: var(--sw-space-4);
5568
+ }
5569
+ .sw-screen-preview-device .sw-screen-preview-body { gap: var(--sw-space-3); padding: var(--sw-space-3); }
5570
+ .sw-screen-preview-device .sw-screen-preview-body:has(> .sw-preview-image:only-child) { padding: 0; }
5571
+ .sw-screen-preview-device .sw-preview-image { border-radius: 0; }
5572
+ .sw-screen-preview-device .sw-preview-group {
5573
+ background: var(--sw-color-surface);
5574
+ border-radius: var(--sw-radius-md);
5575
+ padding: var(--sw-space-3);
5576
+ }
5577
+ .sw-screen-preview-device .sw-preview-group + .sw-preview-group { border-top: 0; }
5578
+ .sw-screen-preview-device .sw-screen-preview-caption { text-align: center; }
5579
+
5547
5580
  @media (min-width: 48rem) {
5548
5581
  .sw-screen-preview-card .sw-screen-preview-screen { padding: var(--sw-space-5); }
5549
5582
  .sw-preview-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
5550
- .sw-screen-preview-device { width: 20rem; }
5551
- .sw-screen-preview-device .sw-screen-preview-bezel {
5552
- background: var(--sw-color-text);
5553
- border-radius: calc(var(--sw-radius-lg) + var(--sw-space-3));
5554
- padding: var(--sw-space-3);
5555
- }
5556
- .sw-screen-preview-device .sw-screen-preview-screen {
5557
- background: var(--sw-color-subtle);
5558
- border-radius: var(--sw-radius-lg);
5559
- gap: 0;
5560
- overflow: hidden;
5561
- padding: 0;
5562
- }
5563
- .sw-screen-preview-device .sw-screen-preview-header {
5564
- background: var(--sw-color-surface);
5565
- border-bottom: 1px solid var(--sw-color-border);
5566
- padding: var(--sw-space-4);
5567
- }
5568
- .sw-screen-preview-device .sw-screen-preview-body { gap: var(--sw-space-3); padding: var(--sw-space-3); }
5569
- .sw-screen-preview-device .sw-preview-group {
5570
- background: var(--sw-color-surface);
5571
- border-radius: var(--sw-radius-md);
5572
- padding: var(--sw-space-3);
5573
- }
5574
- .sw-screen-preview-device .sw-preview-group + .sw-preview-group { border-top: 0; }
5575
- .sw-screen-preview-device .sw-screen-preview-caption { text-align: center; }
5583
+ .sw-screen-preview-device { --sw-screen-preview-bezel: var(--sw-space-3); width: 20rem; }
5576
5584
  }
5577
5585
 
5578
5586
  @media (forced-colors: active) {
5579
5587
  .sw-screen-preview-screen { border: 1px solid CanvasText; }
5580
- }
5581
-
5582
- @media (forced-colors: active) and (min-width: 48rem) {
5583
5588
  .sw-screen-preview-device .sw-screen-preview-screen { border: 0; }
5584
5589
  .sw-screen-preview-device .sw-screen-preview-bezel { border: 1px solid CanvasText; }
5585
5590
  }
@@ -6095,6 +6100,25 @@ html:has(.sw-site-header-sticky) {
6095
6100
  background: color-mix(in srgb, var(--sw-color-muted) 16%, transparent);
6096
6101
  }
6097
6102
 
6103
+ /*
6104
+ * The Cancel word in place of the close glyph: the accent's words, as
6105
+ * clickable words read, at label size on the same 44 px height, as wide as
6106
+ * the word (never narrower than the glyph's button). It follows the
6107
+ * close button's rule so its width, padding and colour win over it.
6108
+ */
6109
+ .sw-site-header-search-cancel {
6110
+ color: var(--sw-color-accent);
6111
+ font-family: inherit;
6112
+ font-size: 15px;
6113
+ font-weight: 600;
6114
+ letter-spacing: -0.2px;
6115
+ line-height: 20px;
6116
+ padding-inline: var(--sw-space-2);
6117
+ min-width: var(--sw-control-md-min-height);
6118
+ white-space: nowrap;
6119
+ width: auto;
6120
+ }
6121
+
6098
6122
  .sw-site-header-search-button:focus-visible,
6099
6123
  .sw-site-header-search-close:focus-visible {
6100
6124
  outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
@@ -6118,9 +6142,10 @@ html:has(.sw-site-header-sticky) {
6118
6142
  @media (min-width: 64rem) {
6119
6143
  .sw-site-header-search {
6120
6144
  display: block;
6121
- flex: 0 1 16rem;
6122
- margin-inline: auto 0;
6145
+ flex: 1 1 10rem;
6146
+ max-width: 16rem;
6123
6147
  min-width: 10rem;
6148
+ margin-inline: auto 0;
6124
6149
  position: relative;
6125
6150
  }
6126
6151
  }
@@ -6273,13 +6298,13 @@ html:has(.sw-site-header-sticky) {
6273
6298
  border: 0;
6274
6299
  color: inherit;
6275
6300
  display: block;
6276
- flex: 0 1 16rem;
6277
- height: auto;
6301
+ flex: 1 1 10rem;
6302
+ max-width: 16rem;
6278
6303
  min-width: 10rem;
6304
+ height: auto;
6279
6305
  inset: auto;
6280
6306
  margin-inline: auto 0;
6281
6307
  max-height: none;
6282
- max-width: none;
6283
6308
  overflow: visible;
6284
6309
  padding: 0;
6285
6310
  position: relative;
@@ -6348,6 +6373,8 @@ html:has(.sw-site-header-sticky) {
6348
6373
  border: 1px solid ButtonText;
6349
6374
  }
6350
6375
 
6376
+ .sw-site-header-search-cancel { color: ButtonText; }
6377
+
6351
6378
  [data-theme] .sw-site-header-search-result { color: LinkText; }
6352
6379
  }
6353
6380
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalewing/react",
3
- "version": "1.67.0",
3
+ "version": "1.68.0",
4
4
  "description": "Scalewing DOM components and package-owned CSS utilities.",
5
5
  "type": "module",
6
6
  "license": "MIT",