@scalewing/react 1.67.1 → 1.69.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 +22 -0
- package/README.md +4 -4
- package/dist/components/Box.d.ts +8 -2
- package/dist/components/ScreenPreview.d.ts +1 -1
- package/dist/components/site-header/SiteHeaderSearch.d.ts +2 -2
- package/dist/components/site-header/SiteHeaderSearch.js +11 -3
- package/dist/components/site-header/types.d.ts +8 -1
- package/dist/components/site-header/validate.js +3 -0
- package/dist/css/css-box-link.d.ts +3 -1
- package/dist/css/css-box-link.js +47 -4
- package/dist/css/css-screen-preview.d.ts +1 -1
- package/dist/css/css-screen-preview.js +55 -40
- package/dist/css/css-site-header-search.js +37 -5
- package/dist/styles.css +73 -34
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @scalewing/react
|
|
2
2
|
|
|
3
|
+
## 1.69.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 324ad2c: `Box as="a" link="inline"` (`sw-link-inline`) is a link inside a sentence: the accent colour, always underlined, so it never depends on colour alone and passes axe's `link-in-text-block` where the accent is under 3:1 against the text around it. The line is 1px, 0.18em below the baseline, in the accent at 60 %; hover and keyboard focus draw it in the full accent at the focus ring's width, and the words stay in the accent. Focus keeps the canvas ring, forced colours paint it as any link, and `external` keeps its arrow. Requested by FutMas for its docs' body text (`docs/requests/futmas-box-link-inline.md`).
|
|
8
|
+
|
|
9
|
+
## 1.68.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 5bee8a2: `ScreenPreview frame="device"`, from FutMas's F-024 review (`teisoro-screen-preview.md`):
|
|
14
|
+
|
|
15
|
+
- 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.
|
|
16
|
+
- 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`.
|
|
17
|
+
- A `PreviewImage` alone fills the phone's screen edge to edge, with no quiet mat round it.
|
|
18
|
+
|
|
19
|
+
- 5bee8a2: `SiteHeader` search, from FutMas's F-024 review (`futmas-site-header-search.md`):
|
|
20
|
+
|
|
21
|
+
- 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.
|
|
22
|
+
- 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`.
|
|
23
|
+
- 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.
|
|
24
|
+
|
|
3
25
|
## 1.67.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -120,7 +120,7 @@ Import the CSS once at the application entry. Do not copy it into your source tr
|
|
|
120
120
|
|
|
121
121
|
`AppHeader` is the page's top chrome, sticky by default (`sticky={false}` leaves it in flow). Its default `appearance="glass"` is a rounded frosted card. `appearance="bar"` (`AppHeaderAppearance`, `appHeaderAppearances`) is a full-width band of the solid surface with the border hairline under it: no blur, no rounding, no side or top border, the same under Reduce Transparency, and the hairline kept in forced colors. Set it against the page's edges (no side gutter round it) and put the gutter inside it. A `ref` reaches its `header` element. An unknown `appearance` throws a `RangeError`.
|
|
122
122
|
|
|
123
|
-
`Box hideBelow="md"` hides a region under 48rem and `hideFrom="md"` hides it at 48rem and wider, so a product can swap a wide layout for a narrow one without its own stylesheet. They also take `lg` (64rem), for content that fits only from a laptop up, such as a row of labelled destinations that a tablet shows as glyphs (name each glyph-only control, for example with `Tooltip relationship="label"`); the layout props keep `md`. `breakpointQuery('below', 'lg')` returns the query a hide class uses (`not all and (min-width: 64rem)`), for an app whose script must follow the same width. An unknown breakpoint throws a `RangeError`. Hidden regions leave the accessibility tree; do not use this to protect data. `Box as="a"` is a layout link. Use `Button` for press actions. `Box as="a" link="quiet"` (opt-in; `link="accent"`, the default, is the canvas link) is a title that opens something, such as a table row's title: it keeps the surrounding text's colour at weight 600 (`sw-link-quiet`) and is underlined on hover and keyboard focus. Its weight is the non-colour cue WCAG 1.4.1 asks for (axe's `link-in-text-block` passes it on colour, the same colour and background as its text, or on its weight; the weight is what keeps it visibly a link), so use it in text lighter than 600. In text already at 600 the quiet look has no cue: an accent link there needs at least 3:1 contrast against the text. `link` on a box that is not `as="a"` throws a `TypeError`, an unknown value a `RangeError`. `Box as="a" external` (opt-in) opens the address in a new tab: it sets `target="_blank"` (always), adds `noopener noreferrer` to your `rel` words (each once), draws a decorative arrow (↗, `sw-link-external-mark`, `aria-hidden`) right after the words with no space, so it never wraps alone, and reads `newTabLabel` after the link's name from a visually hidden span ("Check the marsh map (opens in a new tab)"). The arrow is drawn with borders in the link's colour (accent, the hover colour, a quiet link's), so forced colours keep it, and is mirrored in right-to-left text. `newTabLabel` is your words in your language; it is required with `external` (blank throws a `RangeError`) and refused without it (`TypeError`); `external` on a box that is not `as="a"` throws a `TypeError`. `Field` associates a native `<input>` or `<select>` with a label and token gap; native text controls inherit the generated document canvas. `Steps` is a one-page vertical stepper: an `ol` of `Step` panels in order, numbered by their place, a line joining each marker to the next (in the success color below a done step). A `Step` takes `status` (`'upcoming' | 'current' | 'done' | 'error' | 'skipped'`) and `title` (a heading at the list's `headingLevel`, 2 by default, or the step's own). The current step is open with its `children` and has `aria-current="step"`; an error step stays open with a "!" marker. A done step folds to one line: a check, the title, its `summary` (truncated) and, with `onEdit` and `editLabel`, a ghost small `Button` at the end named by its label and the title ("Edit The site"). A step ahead is greyed with its number in a ring; a skipped step is greyed with its `skippedReason` after the title (pass your own separator, such as "· not needed"). A folded step's heading ends in its status word for assistive technology (visually hidden; English by default, `labels` on `Steps` takes your words): its name is one visually hidden line, the title, a comma and the word ("The site, Done"), and the drawn title is `aria-hidden`, because a browser lays a hidden box out as a block and would put a space before the comma ("The site , Done"). The step's region and its Edit button are still named by the drawn title. A current step, and a skipped step showing its reason, draw and read their words as they are. The heading's text content now holds the title twice (drawn, then in the spoken line), so a test reading a folded heading's `textContent` or finding its title with a pattern (`getByText(/The site/)`) finds both: query headings by role and name (`getByRole('heading', { name: 'The site, Done' })`). Copying a folded heading, or finding its title in the page, meets the words twice too. The comma after the title is Scalewing's, as before; the word is yours. When a step becomes current from a folded state (upcoming, done or skipped), focus moves to its heading, a programmatic focus target; if several do in one update, the first in the list takes it. A first render, a move between current and error, and a step that turns to error leave focus alone: after a refused submit, move focus to the first invalid field yourself, as with `Field`. An error step has no `aria-current`; its heading's status word says it needs attention. Scalewing holds no order rules: the consumer sets each step's status. `Steps open` (off by default) keeps every step open at once, for a form whose sections are all filled on one page: each step shows its `children` whatever its status, inside a `section` named by its title (a region, class `sw-steps-region`), every title at the open size; the marker still follows the status (a number to fill, a check when done, "!" in error, a grey ring and muted title when greyed, such as after a blocking step), no step is `aria-current`, and no step takes focus when its status changes. `titleDetail` (opt-in) is muted words after an open step's title, on its line, such as "Optional" on a step a person may skip, or "Wetlands done · Woodlands empty" on a step with a part per habitat: the label size at the body's weight in the muted colour, a space-2 after the title on its baseline, or on a line of their own under the title where they do not fit beside it (a long title on a phone), never past the panel (a long word breaks). They are drawn while the step is open (current or error, or every step of an open list, with fields or without) and stay as the step turns done in an open list; a folded step draws its summary or reason instead. They sit outside the heading, so the heading's name stays the title (and its status word) and a heading list reads the titles alone; an open list's region keeps the title as its name and is described by the words, read as a person enters it, and in a stepped list they follow the heading in reading order. Write your own separators inside the words; Scalewing draws only the gap after the title. The words share a skipped step's reason's muted colour, not its size: a reason is part of the title, these are a note beside it. Give a step its `titleDetail` from its first render: setting or clearing it later moves the heading into or out of the title line, which remounts it (and drops its focus if it has it). A blank `titleDetail` throws a `RangeError`. Pass the `Step`s as direct children (a Fragment around several would share one number). A `Step` outside `Steps`, a Fragment child, a blank title or reason, an unknown status or heading level, `onEdit` without `editLabel`, or a blank status word throws a `RangeError`.
|
|
123
|
+
`Box hideBelow="md"` hides a region under 48rem and `hideFrom="md"` hides it at 48rem and wider, so a product can swap a wide layout for a narrow one without its own stylesheet. They also take `lg` (64rem), for content that fits only from a laptop up, such as a row of labelled destinations that a tablet shows as glyphs (name each glyph-only control, for example with `Tooltip relationship="label"`); the layout props keep `md`. `breakpointQuery('below', 'lg')` returns the query a hide class uses (`not all and (min-width: 64rem)`), for an app whose script must follow the same width. An unknown breakpoint throws a `RangeError`. Hidden regions leave the accessibility tree; do not use this to protect data. `Box as="a"` is a layout link. Use `Button` for press actions. `Box as="a" link="quiet"` (opt-in; `link="accent"`, the default, is the canvas link) is a title that opens something, such as a table row's title: it keeps the surrounding text's colour at weight 600 (`sw-link-quiet`) and is underlined on hover and keyboard focus. Its weight is the non-colour cue WCAG 1.4.1 asks for (axe's `link-in-text-block` passes it on colour, the same colour and background as its text, or on its weight; the weight is what keeps it visibly a link), so use it in text lighter than 600. In text already at 600 the quiet look has no cue: an accent link there needs at least 3:1 contrast against the text. `Box as="a" link="inline"` (opt-in) is a link inside a sentence, such as a docs paragraph: the accent colour, always underlined (`sw-link-inline`), so it never depends on colour alone, wherever the accent falls under 3:1 against the words around it (axe's `link-in-text-block`, WCAG 1.4.1). The line is 1 px, 0.18em below the baseline, in the accent at 60 %; hover and keyboard focus draw it in the full accent at the focus ring's width, and the words stay in the accent (the canvas link's hover turns them the text colour). Focus keeps the canvas focus ring, forced colours paint the words and the line in the system link colour, and `external` adds its arrow after the underlined words. Use `inline` in running text, `quiet` for a title that opens something, and the default canvas link for a link that stands alone. `link` on a box that is not `as="a"` throws a `TypeError`, an unknown value a `RangeError`. `Box as="a" external` (opt-in) opens the address in a new tab: it sets `target="_blank"` (always), adds `noopener noreferrer` to your `rel` words (each once), draws a decorative arrow (↗, `sw-link-external-mark`, `aria-hidden`) right after the words with no space, so it never wraps alone, and reads `newTabLabel` after the link's name from a visually hidden span ("Check the marsh map (opens in a new tab)"). The arrow is drawn with borders in the link's colour (accent, the hover colour, a quiet link's, an inline link's), so forced colours keep it, and is mirrored in right-to-left text. `newTabLabel` is your words in your language; it is required with `external` (blank throws a `RangeError`) and refused without it (`TypeError`); `external` on a box that is not `as="a"` throws a `TypeError`. `Field` associates a native `<input>` or `<select>` with a label and token gap; native text controls inherit the generated document canvas. `Steps` is a one-page vertical stepper: an `ol` of `Step` panels in order, numbered by their place, a line joining each marker to the next (in the success color below a done step). A `Step` takes `status` (`'upcoming' | 'current' | 'done' | 'error' | 'skipped'`) and `title` (a heading at the list's `headingLevel`, 2 by default, or the step's own). The current step is open with its `children` and has `aria-current="step"`; an error step stays open with a "!" marker. A done step folds to one line: a check, the title, its `summary` (truncated) and, with `onEdit` and `editLabel`, a ghost small `Button` at the end named by its label and the title ("Edit The site"). A step ahead is greyed with its number in a ring; a skipped step is greyed with its `skippedReason` after the title (pass your own separator, such as "· not needed"). A folded step's heading ends in its status word for assistive technology (visually hidden; English by default, `labels` on `Steps` takes your words): its name is one visually hidden line, the title, a comma and the word ("The site, Done"), and the drawn title is `aria-hidden`, because a browser lays a hidden box out as a block and would put a space before the comma ("The site , Done"). The step's region and its Edit button are still named by the drawn title. A current step, and a skipped step showing its reason, draw and read their words as they are. The heading's text content now holds the title twice (drawn, then in the spoken line), so a test reading a folded heading's `textContent` or finding its title with a pattern (`getByText(/The site/)`) finds both: query headings by role and name (`getByRole('heading', { name: 'The site, Done' })`). Copying a folded heading, or finding its title in the page, meets the words twice too. The comma after the title is Scalewing's, as before; the word is yours. When a step becomes current from a folded state (upcoming, done or skipped), focus moves to its heading, a programmatic focus target; if several do in one update, the first in the list takes it. A first render, a move between current and error, and a step that turns to error leave focus alone: after a refused submit, move focus to the first invalid field yourself, as with `Field`. An error step has no `aria-current`; its heading's status word says it needs attention. Scalewing holds no order rules: the consumer sets each step's status. `Steps open` (off by default) keeps every step open at once, for a form whose sections are all filled on one page: each step shows its `children` whatever its status, inside a `section` named by its title (a region, class `sw-steps-region`), every title at the open size; the marker still follows the status (a number to fill, a check when done, "!" in error, a grey ring and muted title when greyed, such as after a blocking step), no step is `aria-current`, and no step takes focus when its status changes. `titleDetail` (opt-in) is muted words after an open step's title, on its line, such as "Optional" on a step a person may skip, or "Wetlands done · Woodlands empty" on a step with a part per habitat: the label size at the body's weight in the muted colour, a space-2 after the title on its baseline, or on a line of their own under the title where they do not fit beside it (a long title on a phone), never past the panel (a long word breaks). They are drawn while the step is open (current or error, or every step of an open list, with fields or without) and stay as the step turns done in an open list; a folded step draws its summary or reason instead. They sit outside the heading, so the heading's name stays the title (and its status word) and a heading list reads the titles alone; an open list's region keeps the title as its name and is described by the words, read as a person enters it, and in a stepped list they follow the heading in reading order. Write your own separators inside the words; Scalewing draws only the gap after the title. The words share a skipped step's reason's muted colour, not its size: a reason is part of the title, these are a note beside it. Give a step its `titleDetail` from its first render: setting or clearing it later moves the heading into or out of the title line, which remounts it (and drops its focus if it has it). A blank `titleDetail` throws a `RangeError`. Pass the `Step`s as direct children (a Fragment around several would share one number). A `Step` outside `Steps`, a Fragment child, a blank title or reason, an unknown status or heading level, `onEdit` without `editLabel`, or a blank status word throws a `RangeError`.
|
|
124
124
|
|
|
125
125
|
```tsx
|
|
126
126
|
<Steps aria-label="Heron survey">
|
|
@@ -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
|
|
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
|
|
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
|
|
package/dist/components/Box.d.ts
CHANGED
|
@@ -21,7 +21,10 @@ export type BoxProps = SpacingProps & VisibilityProps & ColumnSpanProps & HTMLAt
|
|
|
21
21
|
* `quiet` keeps the surrounding text's colour at weight 600 and
|
|
22
22
|
* underlines on hover and focus, for a title that opens something,
|
|
23
23
|
* such as a table row's. Weight is its non-colour cue, so use it in
|
|
24
|
-
* text lighter than 600.
|
|
24
|
+
* text lighter than 600. `inline` is a link inside a sentence: the
|
|
25
|
+
* accent colour, always underlined (the non-colour cue), the line
|
|
26
|
+
* stronger on hover and focus. Only for `as="a"`; an unknown value
|
|
27
|
+
* throws.
|
|
25
28
|
*/
|
|
26
29
|
link?: BoxLink;
|
|
27
30
|
/**
|
|
@@ -55,7 +58,10 @@ export declare const Box: import("react").ForwardRefExoticComponent<SpacingProps
|
|
|
55
58
|
* `quiet` keeps the surrounding text's colour at weight 600 and
|
|
56
59
|
* underlines on hover and focus, for a title that opens something,
|
|
57
60
|
* such as a table row's. Weight is its non-colour cue, so use it in
|
|
58
|
-
* text lighter than 600.
|
|
61
|
+
* text lighter than 600. `inline` is a link inside a sentence: the
|
|
62
|
+
* accent colour, always underlined (the non-colour cue), the line
|
|
63
|
+
* stronger on hover and focus. Only for `as="a"`; an unknown value
|
|
64
|
+
* throws.
|
|
59
65
|
*/
|
|
60
66
|
link?: BoxLink;
|
|
61
67
|
/**
|
|
@@ -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
|
|
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,
|
|
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,
|
|
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(
|
|
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
|
-
/**
|
|
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 ||
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
* canvas link: the accent colour, no underline. `quiet` is a title that
|
|
4
4
|
* opens something, such as the title of a table row: the surrounding
|
|
5
5
|
* text's colour at weight 600, underlined while hovered or focused.
|
|
6
|
+
* `inline` is a link inside a sentence: the accent colour, always
|
|
7
|
+
* underlined.
|
|
6
8
|
*/
|
|
7
|
-
export declare const boxLinkAppearances: readonly ["accent", "quiet"];
|
|
9
|
+
export declare const boxLinkAppearances: readonly ["accent", "quiet", "inline"];
|
|
8
10
|
export type BoxLinkAppearance = (typeof boxLinkAppearances)[number];
|
|
9
11
|
/** The decorative new-tab mark after an external link's words. */
|
|
10
12
|
export declare const externalLinkMarkClass = "sw-link-external-mark";
|
package/dist/css/css-box-link.js
CHANGED
|
@@ -4,9 +4,18 @@ import { typographyVariants } from '@scalewing/tokens';
|
|
|
4
4
|
* canvas link: the accent colour, no underline. `quiet` is a title that
|
|
5
5
|
* opens something, such as the title of a table row: the surrounding
|
|
6
6
|
* text's colour at weight 600, underlined while hovered or focused.
|
|
7
|
+
* `inline` is a link inside a sentence: the accent colour, always
|
|
8
|
+
* underlined.
|
|
7
9
|
*/
|
|
8
|
-
export const boxLinkAppearances = ['accent', 'quiet'];
|
|
10
|
+
export const boxLinkAppearances = ['accent', 'quiet', 'inline'];
|
|
9
11
|
const quietLinkClass = 'sw-link-quiet';
|
|
12
|
+
const inlineLinkClass = 'sw-link-inline';
|
|
13
|
+
/** The generated class of each look; the canvas link has none. */
|
|
14
|
+
const boxLinkClasses = {
|
|
15
|
+
accent: undefined,
|
|
16
|
+
quiet: quietLinkClass,
|
|
17
|
+
inline: inlineLinkClass,
|
|
18
|
+
};
|
|
10
19
|
/** The decorative new-tab mark after an external link's words. */
|
|
11
20
|
export const externalLinkMarkClass = 'sw-link-external-mark';
|
|
12
21
|
export function assertBoxLink(link, as) {
|
|
@@ -19,7 +28,7 @@ export function assertBoxLink(link, as) {
|
|
|
19
28
|
}
|
|
20
29
|
/** The generated class for a Box `link` prop, or none for the canvas link. */
|
|
21
30
|
export function boxLinkClass(link) {
|
|
22
|
-
return link ===
|
|
31
|
+
return link === undefined ? undefined : boxLinkClasses[link];
|
|
23
32
|
}
|
|
24
33
|
/*
|
|
25
34
|
* A quiet link keeps the colour of the text around it, so colour cannot
|
|
@@ -35,6 +44,13 @@ export function boxLinkClass(link) {
|
|
|
35
44
|
* Forced colours paint it in the system link colour, as any link.
|
|
36
45
|
*/
|
|
37
46
|
export function cssBoxLinkClasses() {
|
|
47
|
+
return `${cssQuietLinkClasses()}
|
|
48
|
+
|
|
49
|
+
${cssInlineLinkClasses()}
|
|
50
|
+
|
|
51
|
+
${cssExternalLinkMarkClasses()}`;
|
|
52
|
+
}
|
|
53
|
+
function cssQuietLinkClasses() {
|
|
38
54
|
const quiet = `[data-theme] a.${quietLinkClass}`;
|
|
39
55
|
return `${quiet} {
|
|
40
56
|
color: inherit;
|
|
@@ -45,9 +61,36 @@ ${quiet}:hover,
|
|
|
45
61
|
${quiet}:focus-visible {
|
|
46
62
|
color: inherit;
|
|
47
63
|
text-decoration-line: underline;
|
|
64
|
+
}`;
|
|
65
|
+
}
|
|
66
|
+
/*
|
|
67
|
+
* An inline link sits in a sentence, among words in the text colour. Its
|
|
68
|
+
* accent alone may be under 3:1 against them (axe's link-in-text-block),
|
|
69
|
+
* so it is always underlined: the non-colour cue WCAG 1.4.1 asks for. The
|
|
70
|
+
* line is a hairline a little below the baseline in the accent at 60 %,
|
|
71
|
+
* as the inverse band's links; hover and keyboard focus draw it in the
|
|
72
|
+
* full accent at the focus ring's width, as a Markdown link's hover. The
|
|
73
|
+
* words stay in the accent while hovered, unlike the canvas link's hover.
|
|
74
|
+
* Focus keeps the canvas focus ring. The rules outrank the canvas
|
|
75
|
+
* `[data-theme] a` rules, hover included. Forced colours paint the words
|
|
76
|
+
* and the line in the system link colour, as any link.
|
|
77
|
+
*/
|
|
78
|
+
function cssInlineLinkClasses() {
|
|
79
|
+
const inline = `[data-theme] a.${inlineLinkClass}`;
|
|
80
|
+
return `${inline} {
|
|
81
|
+
color: var(--sw-color-accent);
|
|
82
|
+
text-decoration-color: color-mix(in srgb, currentColor 60%, transparent);
|
|
83
|
+
text-decoration-line: underline;
|
|
84
|
+
text-decoration-thickness: 1px;
|
|
85
|
+
text-underline-offset: 0.18em;
|
|
48
86
|
}
|
|
49
87
|
|
|
50
|
-
${
|
|
88
|
+
${inline}:hover,
|
|
89
|
+
${inline}:focus-visible {
|
|
90
|
+
color: var(--sw-color-accent);
|
|
91
|
+
text-decoration-color: currentColor;
|
|
92
|
+
text-decoration-thickness: var(--sw-focus-ring-width);
|
|
93
|
+
}`;
|
|
51
94
|
}
|
|
52
95
|
/*
|
|
53
96
|
* An external link's new-tab mark: an arrow to the inline end and up (↗),
|
|
@@ -85,5 +128,5 @@ ${mark}::after {
|
|
|
85
128
|
${mark}:dir(rtl) { transform: scaleX(-1); }`;
|
|
86
129
|
}
|
|
87
130
|
export function boxLinkClassCatalog() {
|
|
88
|
-
return [quietLinkClass, externalLinkMarkClass];
|
|
131
|
+
return [quietLinkClass, inlineLinkClass, externalLinkMarkClass];
|
|
89
132
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** How a drawn screen is framed: a plain card, or a phone
|
|
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
|
|
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
|
|
23
|
-
*
|
|
24
|
-
*
|
|
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
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* a
|
|
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 [
|
|
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
|
-
|
|
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
|
-
|
|
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
|
@@ -671,6 +671,21 @@ body {
|
|
|
671
671
|
text-decoration-line: underline;
|
|
672
672
|
}
|
|
673
673
|
|
|
674
|
+
[data-theme] a.sw-link-inline {
|
|
675
|
+
color: var(--sw-color-accent);
|
|
676
|
+
text-decoration-color: color-mix(in srgb, currentColor 60%, transparent);
|
|
677
|
+
text-decoration-line: underline;
|
|
678
|
+
text-decoration-thickness: 1px;
|
|
679
|
+
text-underline-offset: 0.18em;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
[data-theme] a.sw-link-inline:hover,
|
|
683
|
+
[data-theme] a.sw-link-inline:focus-visible {
|
|
684
|
+
color: var(--sw-color-accent);
|
|
685
|
+
text-decoration-color: currentColor;
|
|
686
|
+
text-decoration-thickness: var(--sw-focus-ring-width);
|
|
687
|
+
}
|
|
688
|
+
|
|
674
689
|
.sw-link-external-mark {
|
|
675
690
|
border-right: 2px solid currentColor;
|
|
676
691
|
border-top: 2px solid currentColor;
|
|
@@ -5547,42 +5562,44 @@ button.sw-date-toggle-day[aria-disabled='true'] {
|
|
|
5547
5562
|
line-height: 18px;
|
|
5548
5563
|
}
|
|
5549
5564
|
|
|
5565
|
+
.sw-screen-preview-device { --sw-screen-preview-bezel: var(--sw-space-2); }
|
|
5566
|
+
.sw-screen-preview-device .sw-screen-preview-bezel {
|
|
5567
|
+
background: var(--sw-color-inverse);
|
|
5568
|
+
border-radius: calc(var(--sw-radius-lg) + var(--sw-screen-preview-bezel));
|
|
5569
|
+
box-shadow: inset 0 0 0 1px var(--sw-color-border);
|
|
5570
|
+
padding: var(--sw-screen-preview-bezel);
|
|
5571
|
+
}
|
|
5572
|
+
.sw-screen-preview-device .sw-screen-preview-screen {
|
|
5573
|
+
background: var(--sw-canvas-grouped);
|
|
5574
|
+
border-radius: var(--sw-radius-lg);
|
|
5575
|
+
gap: 0;
|
|
5576
|
+
overflow: hidden;
|
|
5577
|
+
padding: 0;
|
|
5578
|
+
}
|
|
5579
|
+
.sw-screen-preview-device .sw-screen-preview-header {
|
|
5580
|
+
background: var(--sw-color-surface);
|
|
5581
|
+
border-bottom: 1px solid var(--sw-color-border);
|
|
5582
|
+
padding: var(--sw-space-4);
|
|
5583
|
+
}
|
|
5584
|
+
.sw-screen-preview-device .sw-screen-preview-body { gap: var(--sw-space-3); padding: var(--sw-space-3); }
|
|
5585
|
+
.sw-screen-preview-device .sw-screen-preview-body:has(> .sw-preview-image:only-child) { padding: 0; }
|
|
5586
|
+
.sw-screen-preview-device .sw-preview-image { border-radius: 0; }
|
|
5587
|
+
.sw-screen-preview-device .sw-preview-group {
|
|
5588
|
+
background: var(--sw-color-surface);
|
|
5589
|
+
border-radius: var(--sw-radius-md);
|
|
5590
|
+
padding: var(--sw-space-3);
|
|
5591
|
+
}
|
|
5592
|
+
.sw-screen-preview-device .sw-preview-group + .sw-preview-group { border-top: 0; }
|
|
5593
|
+
.sw-screen-preview-device .sw-screen-preview-caption { text-align: center; }
|
|
5594
|
+
|
|
5550
5595
|
@media (min-width: 48rem) {
|
|
5551
5596
|
.sw-screen-preview-card .sw-screen-preview-screen { padding: var(--sw-space-5); }
|
|
5552
5597
|
.sw-preview-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
|
|
5553
|
-
.sw-screen-preview-device { width: 20rem; }
|
|
5554
|
-
.sw-screen-preview-device .sw-screen-preview-bezel {
|
|
5555
|
-
background: var(--sw-color-text);
|
|
5556
|
-
border-radius: calc(var(--sw-radius-lg) + var(--sw-space-3));
|
|
5557
|
-
padding: var(--sw-space-3);
|
|
5558
|
-
}
|
|
5559
|
-
.sw-screen-preview-device .sw-screen-preview-screen {
|
|
5560
|
-
background: var(--sw-color-subtle);
|
|
5561
|
-
border-radius: var(--sw-radius-lg);
|
|
5562
|
-
gap: 0;
|
|
5563
|
-
overflow: hidden;
|
|
5564
|
-
padding: 0;
|
|
5565
|
-
}
|
|
5566
|
-
.sw-screen-preview-device .sw-screen-preview-header {
|
|
5567
|
-
background: var(--sw-color-surface);
|
|
5568
|
-
border-bottom: 1px solid var(--sw-color-border);
|
|
5569
|
-
padding: var(--sw-space-4);
|
|
5570
|
-
}
|
|
5571
|
-
.sw-screen-preview-device .sw-screen-preview-body { gap: var(--sw-space-3); padding: var(--sw-space-3); }
|
|
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; }
|
|
5598
|
+
.sw-screen-preview-device { --sw-screen-preview-bezel: var(--sw-space-3); width: 20rem; }
|
|
5579
5599
|
}
|
|
5580
5600
|
|
|
5581
5601
|
@media (forced-colors: active) {
|
|
5582
5602
|
.sw-screen-preview-screen { border: 1px solid CanvasText; }
|
|
5583
|
-
}
|
|
5584
|
-
|
|
5585
|
-
@media (forced-colors: active) and (min-width: 48rem) {
|
|
5586
5603
|
.sw-screen-preview-device .sw-screen-preview-screen { border: 0; }
|
|
5587
5604
|
.sw-screen-preview-device .sw-screen-preview-bezel { border: 1px solid CanvasText; }
|
|
5588
5605
|
}
|
|
@@ -6098,6 +6115,25 @@ html:has(.sw-site-header-sticky) {
|
|
|
6098
6115
|
background: color-mix(in srgb, var(--sw-color-muted) 16%, transparent);
|
|
6099
6116
|
}
|
|
6100
6117
|
|
|
6118
|
+
/*
|
|
6119
|
+
* The Cancel word in place of the close glyph: the accent's words, as
|
|
6120
|
+
* clickable words read, at label size on the same 44 px height, as wide as
|
|
6121
|
+
* the word (never narrower than the glyph's button). It follows the
|
|
6122
|
+
* close button's rule so its width, padding and colour win over it.
|
|
6123
|
+
*/
|
|
6124
|
+
.sw-site-header-search-cancel {
|
|
6125
|
+
color: var(--sw-color-accent);
|
|
6126
|
+
font-family: inherit;
|
|
6127
|
+
font-size: 15px;
|
|
6128
|
+
font-weight: 600;
|
|
6129
|
+
letter-spacing: -0.2px;
|
|
6130
|
+
line-height: 20px;
|
|
6131
|
+
padding-inline: var(--sw-space-2);
|
|
6132
|
+
min-width: var(--sw-control-md-min-height);
|
|
6133
|
+
white-space: nowrap;
|
|
6134
|
+
width: auto;
|
|
6135
|
+
}
|
|
6136
|
+
|
|
6101
6137
|
.sw-site-header-search-button:focus-visible,
|
|
6102
6138
|
.sw-site-header-search-close:focus-visible {
|
|
6103
6139
|
outline: var(--sw-focus-ring-width) solid var(--sw-color-accent);
|
|
@@ -6121,9 +6157,10 @@ html:has(.sw-site-header-sticky) {
|
|
|
6121
6157
|
@media (min-width: 64rem) {
|
|
6122
6158
|
.sw-site-header-search {
|
|
6123
6159
|
display: block;
|
|
6124
|
-
flex:
|
|
6125
|
-
|
|
6160
|
+
flex: 1 1 10rem;
|
|
6161
|
+
max-width: 16rem;
|
|
6126
6162
|
min-width: 10rem;
|
|
6163
|
+
margin-inline: auto 0;
|
|
6127
6164
|
position: relative;
|
|
6128
6165
|
}
|
|
6129
6166
|
}
|
|
@@ -6276,13 +6313,13 @@ html:has(.sw-site-header-sticky) {
|
|
|
6276
6313
|
border: 0;
|
|
6277
6314
|
color: inherit;
|
|
6278
6315
|
display: block;
|
|
6279
|
-
flex:
|
|
6280
|
-
|
|
6316
|
+
flex: 1 1 10rem;
|
|
6317
|
+
max-width: 16rem;
|
|
6281
6318
|
min-width: 10rem;
|
|
6319
|
+
height: auto;
|
|
6282
6320
|
inset: auto;
|
|
6283
6321
|
margin-inline: auto 0;
|
|
6284
6322
|
max-height: none;
|
|
6285
|
-
max-width: none;
|
|
6286
6323
|
overflow: visible;
|
|
6287
6324
|
padding: 0;
|
|
6288
6325
|
position: relative;
|
|
@@ -6351,6 +6388,8 @@ html:has(.sw-site-header-sticky) {
|
|
|
6351
6388
|
border: 1px solid ButtonText;
|
|
6352
6389
|
}
|
|
6353
6390
|
|
|
6391
|
+
.sw-site-header-search-cancel { color: ButtonText; }
|
|
6392
|
+
|
|
6354
6393
|
[data-theme] .sw-site-header-search-result { color: LinkText; }
|
|
6355
6394
|
}
|
|
6356
6395
|
|