@slotted/react 0.1.0-beta.42 → 0.1.0-beta.43
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/dist/{app-shell-D54YkU7E.js → app-shell-DsWhsSMU.js} +3 -2
- package/dist/app-shell.js +1 -1
- package/dist/attachment-TZykYNu5.js +300 -0
- package/dist/attachment.js +2 -2
- package/dist/{avatar-group-bJaZE1_C.js → avatar-group-Bzmmj2HI.js} +2 -1
- package/dist/avatar-group.js +1 -1
- package/dist/{carousel-B9nMK7Yf.js → carousel-CRNz-T3g.js} +1 -1
- package/dist/carousel.js +1 -1
- package/dist/{command-palette-C90CzfQi.js → command-palette-Bgf5tfCI.js} +160 -156
- package/dist/command-palette.js +1 -1
- package/dist/{data-grid-D106baPp.js → data-grid-DUft3rJb.js} +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/{data-list-BA0xrySM.js → data-list-Dv3orBtf.js} +15 -15
- package/dist/data-list.js +1 -1
- package/dist/detail-panel-Cke3ZFU3.js +342 -0
- package/dist/detail-panel.js +2 -2
- package/dist/docs/action-bar.examples.md +768 -0
- package/dist/docs/action-bar.json +74 -50
- package/dist/docs/action-bar.md +49 -311
- package/dist/docs/app-shell.examples.md +1221 -64
- package/dist/docs/app-shell.json +92 -60
- package/dist/docs/app-shell.md +92 -57
- package/dist/docs/attachment.examples.md +689 -0
- package/dist/docs/attachment.json +69 -37
- package/dist/docs/attachment.md +44 -203
- package/dist/docs/avatar-group.json +111 -23
- package/dist/docs/avatar-group.md +487 -28
- package/dist/docs/button-group.json +98 -2
- package/dist/docs/button-group.md +411 -8
- package/dist/docs/calendar.examples.md +512 -0
- package/dist/docs/calendar.json +72 -24
- package/dist/docs/calendar.md +18 -147
- package/dist/docs/carousel.examples.md +868 -0
- package/dist/docs/carousel.json +58 -50
- package/dist/docs/carousel.md +66 -300
- package/dist/docs/cascader.examples.md +1269 -0
- package/dist/docs/cascader.json +72 -16
- package/dist/docs/cascader.md +78 -154
- package/dist/docs/chart.examples.md +734 -24
- package/dist/docs/chart.json +93 -13
- package/dist/docs/chart.md +28 -7
- package/dist/docs/clock.json +71 -15
- package/dist/docs/clock.md +326 -21
- package/dist/docs/code-block.json +79 -55
- package/dist/docs/code-block.md +417 -74
- package/dist/docs/color-picker.json +60 -12
- package/dist/docs/color-picker.md +245 -22
- package/dist/docs/column-manager.examples.md +764 -0
- package/dist/docs/column-manager.json +68 -12
- package/dist/docs/column-manager.md +44 -203
- package/dist/docs/command-palette.examples.md +747 -0
- package/dist/docs/command-palette.json +48 -24
- package/dist/docs/command-palette.md +60 -339
- package/dist/docs/currency-field.examples.md +355 -73
- package/dist/docs/currency-field.json +96 -64
- package/dist/docs/currency-field.md +57 -50
- package/dist/docs/dashboard-grid.examples.md +629 -0
- package/dist/docs/dashboard-grid.json +64 -16
- package/dist/docs/dashboard-grid.md +34 -152
- package/dist/docs/data-list.examples.md +1556 -0
- package/dist/docs/data-list.json +58 -18
- package/dist/docs/data-list.md +139 -224
- package/dist/docs/date-field.examples.md +543 -0
- package/dist/docs/date-field.json +64 -24
- package/dist/docs/date-field.md +22 -168
- package/dist/docs/datetime-field.examples.md +699 -0
- package/dist/docs/datetime-field.json +79 -31
- package/dist/docs/datetime-field.md +24 -269
- package/dist/docs/datetime-range-picker.examples.md +682 -0
- package/dist/docs/datetime-range-picker.json +117 -61
- package/dist/docs/datetime-range-picker.md +59 -224
- package/dist/docs/description-list.examples.md +652 -0
- package/dist/docs/description-list.json +49 -25
- package/dist/docs/description-list.md +33 -188
- package/dist/docs/detail-panel.examples.md +1177 -0
- package/dist/docs/detail-panel.json +69 -53
- package/dist/docs/detail-panel.md +114 -324
- package/dist/docs/entity-picker.examples.md +1037 -0
- package/dist/docs/entity-picker.json +66 -18
- package/dist/docs/entity-picker.md +56 -246
- package/dist/docs/event-calendar.examples.md +749 -49
- package/dist/docs/event-calendar.json +46 -22
- package/dist/docs/event-calendar.md +81 -11
- package/dist/docs/field-group.examples.md +554 -0
- package/dist/docs/field-group.json +98 -34
- package/dist/docs/field-group.md +55 -133
- package/dist/docs/filter-bar.examples.md +772 -0
- package/dist/docs/filter-bar.json +41 -25
- package/dist/docs/filter-bar.md +42 -246
- package/dist/docs/form.examples.md +579 -0
- package/dist/docs/form.json +87 -39
- package/dist/docs/form.md +53 -177
- package/dist/docs/fullscreen.examples.md +558 -0
- package/dist/docs/fullscreen.json +58 -18
- package/dist/docs/fullscreen.md +50 -169
- package/dist/docs/highlight.json +57 -25
- package/dist/docs/highlight.md +402 -50
- package/dist/docs/icon.json +85 -5
- package/dist/docs/icon.md +401 -10
- package/dist/docs/image.examples.md +670 -0
- package/dist/docs/image.json +44 -28
- package/dist/docs/image.md +24 -176
- package/dist/docs/import-export-center.examples.md +1280 -0
- package/dist/docs/import-export-center.json +67 -27
- package/dist/docs/import-export-center.md +121 -226
- package/dist/docs/list-item.examples.md +769 -0
- package/dist/docs/list-item.json +110 -38
- package/dist/docs/list-item.md +84 -201
- package/dist/docs/listbox.examples.md +858 -0
- package/dist/docs/listbox.json +76 -28
- package/dist/docs/listbox.md +41 -263
- package/dist/docs/markdown.json +79 -55
- package/dist/docs/markdown.md +581 -85
- package/dist/docs/media-viewer.examples.md +1038 -0
- package/dist/docs/media-viewer.json +70 -15
- package/dist/docs/media-viewer.md +84 -135
- package/dist/docs/message-scroller.examples.md +1193 -0
- package/dist/docs/message-scroller.json +41 -17
- package/dist/docs/message-scroller.md +80 -134
- package/dist/docs/message.examples.md +944 -0
- package/dist/docs/message.json +64 -16
- package/dist/docs/message.md +34 -326
- package/dist/docs/meter.json +58 -26
- package/dist/docs/meter.md +312 -32
- package/dist/docs/navigation-menu.examples.md +1107 -0
- package/dist/docs/navigation-menu.json +57 -41
- package/dist/docs/navigation-menu.md +105 -298
- package/dist/docs/notification-center.examples.md +1045 -0
- package/dist/docs/notification-center.json +71 -15
- package/dist/docs/notification-center.md +76 -266
- package/dist/docs/otp-input.examples.md +490 -0
- package/dist/docs/otp-input.json +65 -25
- package/dist/docs/otp-input.md +20 -191
- package/dist/docs/page-header.examples.md +1041 -0
- package/dist/docs/page-header.json +75 -43
- package/dist/docs/page-header.md +79 -291
- package/dist/docs/page.examples.md +633 -0
- package/dist/docs/page.json +48 -16
- package/dist/docs/page.md +62 -129
- package/dist/docs/prompt-composer.examples.md +630 -0
- package/dist/docs/prompt-composer.json +66 -18
- package/dist/docs/prompt-composer.md +35 -161
- package/dist/docs/prose.json +69 -37
- package/dist/docs/prose.md +393 -75
- package/dist/docs/rating.examples.md +525 -0
- package/dist/docs/rating.json +92 -28
- package/dist/docs/rating.md +27 -241
- package/dist/docs/saved-views.examples.md +1108 -0
- package/dist/docs/saved-views.json +53 -21
- package/dist/docs/saved-views.md +86 -171
- package/dist/docs/scroll-area.examples.md +837 -0
- package/dist/docs/scroll-area.json +64 -24
- package/dist/docs/scroll-area.md +57 -140
- package/dist/docs/section.examples.md +676 -0
- package/dist/docs/section.json +68 -20
- package/dist/docs/section.md +39 -162
- package/dist/docs/segmented-control.examples.md +480 -0
- package/dist/docs/segmented-control.json +76 -28
- package/dist/docs/segmented-control.md +20 -191
- package/dist/docs/side-navigation.examples.md +1468 -0
- package/dist/docs/side-navigation.json +53 -53
- package/dist/docs/side-navigation.md +79 -354
- package/dist/docs/slider.examples.md +505 -0
- package/dist/docs/slider.json +91 -51
- package/dist/docs/slider.md +47 -212
- package/dist/docs/sparkline.json +60 -36
- package/dist/docs/sparkline.md +447 -71
- package/dist/docs/split-button.examples.md +509 -0
- package/dist/docs/split-button.json +73 -41
- package/dist/docs/split-button.md +64 -194
- package/dist/docs/splitter.examples.md +921 -0
- package/dist/docs/splitter.json +94 -46
- package/dist/docs/splitter.md +75 -182
- package/dist/docs/stat-card.examples.md +725 -0
- package/dist/docs/stat-card.json +89 -41
- package/dist/docs/stat-card.md +55 -227
- package/dist/docs/status-indicator.json +80 -32
- package/dist/docs/status-indicator.md +409 -65
- package/dist/docs/stepper.json +53 -21
- package/dist/docs/stepper.md +369 -48
- package/dist/docs/table-of-contents.examples.md +550 -0
- package/dist/docs/table-of-contents.json +60 -28
- package/dist/docs/table-of-contents.md +70 -205
- package/dist/docs/tags-input.examples.md +541 -0
- package/dist/docs/tags-input.json +64 -16
- package/dist/docs/tags-input.md +15 -262
- package/dist/docs/time-field.examples.md +587 -0
- package/dist/docs/time-field.json +69 -29
- package/dist/docs/time-field.md +21 -223
- package/dist/docs/time-picker.json +117 -53
- package/dist/docs/time-picker.md +499 -54
- package/dist/docs/time-range-picker.examples.md +750 -0
- package/dist/docs/time-range-picker.json +139 -75
- package/dist/docs/time-range-picker.md +63 -225
- package/dist/docs/timeline.examples.md +617 -0
- package/dist/docs/timeline.json +44 -28
- package/dist/docs/timeline.md +34 -208
- package/dist/docs/toolbar.json +56 -16
- package/dist/docs/toolbar.md +357 -63
- package/dist/docs/top-navigation.examples.md +1206 -140
- package/dist/docs/top-navigation.json +49 -33
- package/dist/docs/top-navigation.md +87 -36
- package/dist/docs/tour.examples.md +960 -0
- package/dist/docs/tour.json +57 -25
- package/dist/docs/tour.md +60 -244
- package/dist/docs/transfer.examples.md +631 -0
- package/dist/docs/transfer.json +80 -16
- package/dist/docs/transfer.md +41 -170
- package/dist/docs/typography.json +96 -0
- package/dist/docs/typography.md +352 -4
- package/dist/docs/upload.examples.md +555 -53
- package/dist/docs/upload.json +62 -30
- package/dist/docs/upload.md +46 -11
- package/dist/docs/wizard.examples.md +1389 -0
- package/dist/docs/wizard.json +89 -49
- package/dist/docs/wizard.md +122 -263
- package/dist/{entity-picker-CC4VoC3p.js → entity-picker-C78f3Z0o.js} +9 -6
- package/dist/entity-picker.js +1 -1
- package/dist/{event-calendar-CjmF_e0H.js → event-calendar-DJPoCi-O.js} +1 -1
- package/dist/event-calendar.js +1 -1
- package/dist/{filter-bar-B3QJD7SZ.js → filter-bar-D61wiQFP.js} +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/{import-export-center-CW8YVZev.js → import-export-center-mqvmlzwB.js} +44 -36
- package/dist/import-export-center.js +1 -1
- package/dist/index.js +58 -58
- package/dist/{markdown-BdskE4-L.js → markdown-8CtV4k44.js} +2 -2
- package/dist/markdown.js +1 -1
- package/dist/{media-viewer-zEXcwfEY.js → media-viewer-C_cbuAq-.js} +64 -60
- package/dist/media-viewer.js +2 -2
- package/dist/message-P91bEGyV.js +455 -0
- package/dist/message.js +2 -2
- package/dist/{page-header-DmwBGwlm.js → page-header-jeAIQSZM.js} +103 -108
- package/dist/page-header.js +1 -1
- package/dist/section-CVTQdWBl.js +216 -0
- package/dist/section.js +2 -2
- package/dist/{segmented-control-CbK7SurB.js → segmented-control-BSMVjukr.js} +1 -1
- package/dist/segmented-control.js +1 -1
- package/dist/{side-navigation-CKRETc8E.js → side-navigation-BQzBxz2B.js} +179 -179
- package/dist/side-navigation.js +1 -1
- package/dist/{stat-card-CL3Xe6pV.js → stat-card-BpGZiFbG.js} +12 -14
- package/dist/stat-card.js +1 -1
- package/dist/{stepper-DHdrANZI.js → stepper-Cxb_tHnA.js} +130 -127
- package/dist/stepper.js +2 -2
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/{timeline-BiL2CXfn.js → timeline-ZngK6zLC.js} +9 -6
- package/dist/timeline.js +1 -1
- package/dist/top-navigation-YSEQzBhD.js +744 -0
- package/dist/top-navigation.js +2 -2
- package/dist/{transfer-sKUvmEKe.js → transfer-Cv5yQuTN.js} +1 -1
- package/dist/transfer.js +1 -1
- package/dist/types/attachment/attachment-parts.d.ts +24 -11
- package/dist/types/attachment/attachment-parts.d.ts.map +1 -1
- package/dist/types/attachment/attachment.d.ts +3 -3
- package/dist/types/attachment/attachment.d.ts.map +1 -1
- package/dist/types/avatar-group/avatar-group.d.ts.map +1 -1
- package/dist/types/carousel/carousel-parts.d.ts +2 -2
- package/dist/types/command-palette/command-palette.d.ts.map +1 -1
- package/dist/types/data-list/data-list.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel-parts.d.ts +10 -3
- package/dist/types/detail-panel/detail-panel-parts.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel.types.d.ts +7 -0
- package/dist/types/detail-panel/detail-panel.types.d.ts.map +1 -1
- package/dist/types/entity-picker/entity-picker.d.ts.map +1 -1
- package/dist/types/import-export-center/import-export-center.d.ts.map +1 -1
- package/dist/types/media-viewer/index.d.ts +2 -2
- package/dist/types/media-viewer/index.d.ts.map +1 -1
- package/dist/types/media-viewer/media-viewer-bar.d.ts +3 -1
- package/dist/types/media-viewer/media-viewer-bar.d.ts.map +1 -1
- package/dist/types/media-viewer/media-viewer.types.d.ts +1 -0
- package/dist/types/media-viewer/media-viewer.types.d.ts.map +1 -1
- package/dist/types/message/message-parts.d.ts +7 -0
- package/dist/types/message/message-parts.d.ts.map +1 -1
- package/dist/types/message/message.d.ts.map +1 -1
- package/dist/types/page-header/page-header-parts.d.ts.map +1 -1
- package/dist/types/section/section-parts.d.ts +16 -8
- package/dist/types/section/section-parts.d.ts.map +1 -1
- package/dist/types/section/section.d.ts.map +1 -1
- package/dist/types/segmented-control/segmented-control-parts.d.ts.map +1 -1
- package/dist/types/side-navigation/side-navigation-parts.d.ts.map +1 -1
- package/dist/types/stat-card/stat-card-delta.d.ts.map +1 -1
- package/dist/types/stat-card/stat-card-parts.d.ts +3 -3
- package/dist/types/stat-card/stat-card-parts.d.ts.map +1 -1
- package/dist/types/stepper/stepper-parts.d.ts +11 -2
- package/dist/types/stepper/stepper-parts.d.ts.map +1 -1
- package/dist/types/stepper/stepper.d.ts.map +1 -1
- package/dist/types/timeline/timeline-parts.d.ts.map +1 -1
- package/dist/types/top-navigation/top-navigation.d.ts.map +1 -1
- package/dist/{wizard-4c0X7Bx_.js → wizard-Dfryz1id.js} +214 -214
- package/dist/wizard.js +1 -1
- package/package.json +6 -6
- package/dist/attachment-MqczA38F.js +0 -292
- package/dist/detail-panel-EImAtksY.js +0 -327
- package/dist/message-D1Dd6Y2k.js +0 -452
- package/dist/section-D_qOfdxR.js +0 -213
- package/dist/top-navigation-D8IHPOmm.js +0 -744
package/dist/docs/highlight.json
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"type": "string",
|
|
69
69
|
"defaultValue": "—",
|
|
70
70
|
"appliesTo": "Highlight",
|
|
71
|
-
"description": "The text, whole. The only content
|
|
71
|
+
"description": "The text, whole. The only content Highlight renders; nothing in it is HTML, and every run is a slice of it"
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
"name": "query",
|
|
@@ -159,9 +159,9 @@
|
|
|
159
159
|
],
|
|
160
160
|
"events": [],
|
|
161
161
|
"accessibility": [
|
|
162
|
-
"There is no highlight pattern in the WAI-ARIA Authoring Practices, and the HTML Standard defines mark for exactly this — “a run of text marked or highlighted for reference purposes, due to its relevance in another context”, with the term searched for inside a result as its example.
|
|
162
|
+
"There is no highlight pattern in the WAI-ARIA Authoring Practices, and the HTML Standard defines mark for exactly this — “a run of text marked or highlighted for reference purposes, due to its relevance in another context”, with the term searched for inside a result as its example. Highlight therefore renders mark and writes no role, no aria-label and no aria-hidden.",
|
|
163
163
|
"The text a reader hears is the text: every run is a slice of the string handed in, nothing is parsed and nothing is hidden. A label holding <b> reads <b>.",
|
|
164
|
-
"Most screen readers do not announce mark by default (MDN, Accessibility).
|
|
164
|
+
"Most screen readers do not announce mark by default (MDN, Accessibility). Highlight injects no hidden “highlight start” before each match: a five-match option would become ten announcements. An application that needs the announcement writes the ::before rule in its own scope, over [data-ui=\"highlight\"] [data-part=\"match\"].",
|
|
165
165
|
"The mark changes no metric of the word — weight, spacing and padding are the label’s own — so a filter that marks a different span on every keystroke never reflows the label under the reader’s eyes.",
|
|
166
166
|
"The current match is not a stronger band: 0.075 is the share the 7:1 promise caps in high-contrast, and doubling it leaves 6.5:1. It takes the accent’s solid ground and the ink the theme pairs with it, and under forced colors the Highlight and HighlightText pair the user agent draws its own find match in.",
|
|
167
167
|
"A disabled row’s mark gives up the tone and keeps the rule, so the reader still sees which span matched on the one option they cannot take, and the loudest color on the surface is not on it."
|
|
@@ -198,80 +198,112 @@
|
|
|
198
198
|
"title": "A query, compared the way the reader’s locale compares",
|
|
199
199
|
"note": "The comparison is Intl.Collator at base sensitivity: aca finds Açaí, resume finds Résumé and strasse finds Straße. Nothing is a regular expression — C++ and a.b are text.",
|
|
200
200
|
"language": "tsx",
|
|
201
|
-
"source": "
|
|
202
|
-
"verdict": "
|
|
201
|
+
"source": "import { Highlight } from '@slotted/react/highlight';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nconst ROWS = [\n { text: 'Montréal Café Ltd.', query: 'cafe' },\n { text: 'Résumé Services', query: 'RESUME' },\n { text: 'Straße 12 Warehouse', query: 'strasse' },\n { text: 'C++ Consulting a.b', query: 'c++' },\n { text: 'Northwind Freight', query: ' ' },\n];\n\nexport default function HighlightQuery() {\n return (\n <Stack gap={3}>\n {ROWS.map((row) => (\n <Inline justify=\"between\" key={row.text}>\n <Highlight query={row.query} text={row.text} />\n <Text size=\"sm\" tone=\"muted\">\n {row.query.trim() === '' ? 'blank' : row.query}\n </Text>\n </Inline>\n ))}\n </Stack>\n );\n}\n",
|
|
202
|
+
"verdict": "example"
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
205
|
"id": "multiple",
|
|
206
206
|
"title": "Several queries at once",
|
|
207
207
|
"note": "An array marks every query, and two that overlap or touch become one run: an and na over banana is one mark, never a mark inside a mark.",
|
|
208
208
|
"language": "tsx",
|
|
209
|
-
"source": "
|
|
210
|
-
"verdict": "
|
|
209
|
+
"source": "import { Highlight } from '@slotted/react/highlight';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nconst ROWS = [\n { text: 'Banana Brazil Foods', query: ['an', 'na'] },\n { text: 'Invoice no. 2026-0441', query: ['invoice', '0441'] },\n];\n\nexport default function HighlightMultiple() {\n return (\n <Stack gap={3}>\n {ROWS.map((row) => (\n <Inline justify=\"between\" key={row.text}>\n <Highlight query={row.query} text={row.text} />\n <Text size=\"sm\" tone=\"muted\">\n {row.query.join(' + ')}\n </Text>\n </Inline>\n ))}\n </Stack>\n );\n}\n",
|
|
210
|
+
"verdict": "example"
|
|
211
211
|
},
|
|
212
212
|
{
|
|
213
213
|
"id": "occurrences",
|
|
214
214
|
"title": "Every occurrence, or the first",
|
|
215
215
|
"note": "all marks every place the query appears, which is the default; first marks one span per query, for a list that reads the mark as “why this row is here”.",
|
|
216
216
|
"language": "tsx",
|
|
217
|
-
"source": "
|
|
218
|
-
"verdict": "
|
|
217
|
+
"source": "import { Highlight } from '@slotted/react/highlight';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nconst OCCURRENCES = ['all', 'first'] as const;\n\nexport default function HighlightOccurrences() {\n return (\n <Stack gap={3}>\n {OCCURRENCES.map((occurrences) => (\n <Inline justify=\"between\" key={occurrences}>\n <Highlight occurrences={occurrences} query=\"an\" text=\"Ana Banana Santana\" />\n <Text size=\"sm\" tone=\"muted\">\n {occurrences}\n </Text>\n </Inline>\n ))}\n </Stack>\n );\n}\n",
|
|
218
|
+
"verdict": "example"
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
221
|
"id": "ranges",
|
|
222
222
|
"title": "Spans a server already found",
|
|
223
223
|
"note": "ranges wins over query: the marks are the indexes the search engine returned, in the text’s own code units. A span past the end is clipped, an inverted one is turned round, and one inside an emoji is widened to the whole character.",
|
|
224
224
|
"language": "tsx",
|
|
225
|
-
"source": "
|
|
226
|
-
"verdict": "
|
|
225
|
+
"source": "import { Highlight, type HighlightRange } from '@slotted/react/highlight';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nconst ROWS: { text: string; ranges: HighlightRange[] }[] = [\n { text: 'Contractor authorized in 2024', ranges: [[11, 21]] },\n {\n text: '🇧🇷 Brazil Cables',\n ranges: [\n [1, 2],\n [12, 40],\n ],\n },\n {\n text: 'Shipment 4471 delivered',\n ranges: [\n [23, 14],\n [9, 13],\n ],\n },\n];\n\nexport default function HighlightRanges() {\n return (\n <Stack gap={3}>\n {ROWS.map((row) => (\n <Inline justify=\"between\" key={row.text}>\n <Highlight ranges={row.ranges} text={row.text} />\n <Text size=\"sm\" tone=\"muted\">\n {row.ranges.map(([start, end]) => `${start}–${end}`).join(', ')}\n </Text>\n </Inline>\n ))}\n </Stack>\n );\n}\n",
|
|
226
|
+
"verdict": "example"
|
|
227
227
|
},
|
|
228
228
|
{
|
|
229
229
|
"id": "matcher",
|
|
230
230
|
"title": "A matcher of the consumer’s own",
|
|
231
|
-
"note": "matcher replaces the collator scan and receives the queries already trimmed of empties. Here it marks whole words only —
|
|
231
|
+
"note": "matcher replaces the collator scan and receives the queries already trimmed of empties. Here it marks whole words only — written in a few lines over matchRanges from @slotted/core/highlight.",
|
|
232
232
|
"language": "tsx",
|
|
233
|
-
"source": "import { matchRanges } from '@slotted/core/highlight';\n\nfunction boundary(text: string, at: number) {\n const around = text.slice(Math.max(0, at - 1), at + 1);\n return at === 0 || at === text.length || /\\W/.test(around);\n}\nfunction wholeWords(text: string, queries: readonly string[]) {\n
|
|
234
|
-
"verdict": "
|
|
233
|
+
"source": "import { matchRanges } from '@slotted/core/highlight';\nimport { Highlight, type HighlightRange } from '@slotted/react/highlight';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nconst TEXT = 'Supplier terms cover the supplier and its suppliers, including subsuppliers.';\n\nfunction boundary(text: string, at: number) {\n const around = text.slice(Math.max(0, at - 1), at + 1);\n\n return at === 0 || at === text.length || /\\W/.test(around);\n}\n\nfunction wholeWords(text: string, queries: readonly string[]): HighlightRange[] {\n return matchRanges(text, queries).filter(\n ([start, end]) => boundary(text, start) && boundary(text, end),\n );\n}\n\nexport default function HighlightMatcher() {\n return (\n <Stack gap={3}>\n <Stack gap={1}>\n <Text size=\"sm\" tone=\"muted\">\n Default matcher\n </Text>\n <Highlight query=\"supplier\" text={TEXT} />\n </Stack>\n <Stack gap={1}>\n <Text size=\"sm\" tone=\"muted\">\n Whole words only\n </Text>\n <Highlight matcher={wholeWords} query=\"supplier\" text={TEXT} />\n </Stack>\n </Stack>\n );\n}\n",
|
|
234
|
+
"verdict": "example"
|
|
235
235
|
},
|
|
236
236
|
{
|
|
237
237
|
"id": "current",
|
|
238
238
|
"title": "The match a find bar is standing on",
|
|
239
|
-
"note": "current names one match by index, counting matches only, and that mark takes the accent’s solid ground and ink.
|
|
239
|
+
"note": "current names one match by index, counting matches only, and that mark takes the accent’s solid ground and ink. Highlight never moves it: the arrows belong to the find bar, and scrolling to it is the consumer’s, through the ref.",
|
|
240
240
|
"language": "tsx",
|
|
241
|
-
"source": "const [current, setCurrent] = useState(1);\n\n<Highlight
|
|
242
|
-
"verdict": "
|
|
241
|
+
"source": "import { useState } from 'react';\n\nimport { matchRanges } from '@slotted/core/highlight';\nimport { Button } from '@slotted/react/button';\nimport { Highlight } from '@slotted/react/highlight';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nconst CLAUSE =\n 'Supplier agreement: the supplier delivers within ten days, the supplier invoices monthly, and Supplier audit rights apply.';\nconst TOTAL = matchRanges(CLAUSE, 'supplier').length;\n\nexport default function HighlightCurrent() {\n const [current, setCurrent] = useState(1);\n\n function handlePrevious() {\n setCurrent((index) => (index + TOTAL - 1) % TOTAL);\n }\n\n function handleNext() {\n setCurrent((index) => (index + 1) % TOTAL);\n }\n\n return (\n <Stack gap={4}>\n <Inline justify=\"between\">\n <Text size=\"sm\" tone=\"muted\">\n {`${current + 1} of ${TOTAL}`}\n </Text>\n <Inline gap={2}>\n <Button onClick={handlePrevious} size=\"sm\" tone=\"secondary\" variant=\"outline\">\n Previous\n </Button>\n <Button onClick={handleNext} size=\"sm\" tone=\"secondary\" variant=\"outline\">\n Next\n </Button>\n </Inline>\n </Inline>\n <Highlight current={current} query=\"supplier\" text={CLAUSE} />\n </Stack>\n );\n}\n",
|
|
242
|
+
"verdict": "example"
|
|
243
243
|
},
|
|
244
244
|
{
|
|
245
245
|
"id": "states",
|
|
246
246
|
"title": "Disabled, from the root or from the row above it",
|
|
247
247
|
"note": "A disabled mark gives up the tone and keeps the rule, so the reader still sees which span matched on an option they cannot take. The state is read from data-disabled on the root or on any ancestor, so a host’s option says it once.",
|
|
248
248
|
"language": "tsx",
|
|
249
|
-
"source": "
|
|
250
|
-
"verdict": "
|
|
249
|
+
"source": "import { Highlight } from '@slotted/react/highlight';\nimport { List } from '@slotted/react/list';\nimport { ListItem, ListItemBody, ListItemContent, ListItemLabel } from '@slotted/react/list-item';\n\nexport default function HighlightStates() {\n return (\n <List aria-label=\"Suppliers matching berr\" variant=\"ruled\">\n <ListItem>\n <ListItemContent>\n <ListItemBody>\n <ListItemLabel>\n <Highlight query=\"berr\" text=\"Blueberry Foods\" />\n </ListItemLabel>\n </ListItemBody>\n </ListItemContent>\n </ListItem>\n <ListItem>\n <ListItemContent>\n <ListItemBody>\n <ListItemLabel>\n <Highlight disabled query=\"berr\" text=\"Cloudberry Logistics\" />\n </ListItemLabel>\n </ListItemBody>\n </ListItemContent>\n </ListItem>\n <ListItem disabled>\n <ListItemContent>\n <ListItemBody>\n <ListItemLabel>\n <Highlight query=\"berr\" text=\"Gooseberry Transport\" />\n </ListItemLabel>\n </ListItemBody>\n </ListItemContent>\n </ListItem>\n </List>\n );\n}\n",
|
|
250
|
+
"verdict": "example"
|
|
251
251
|
},
|
|
252
252
|
{
|
|
253
253
|
"id": "context",
|
|
254
|
-
"title": "Where
|
|
255
|
-
"note": "A supplier search: the results list is what combobox, select, multi-select and command-palette render, one root inside each label.
|
|
254
|
+
"title": "Where Highlight is used",
|
|
255
|
+
"note": "A supplier search: the results list is what combobox, select, multi-select and command-palette render, one root inside each label. Highlight is content inside a host; the host owns the row, the keyboard and the count.",
|
|
256
256
|
"language": "tsx",
|
|
257
257
|
"source": "<Combobox>\n <ComboboxItem value=\"acai\">Açaí Valley Ltd.</ComboboxItem>\n</Combobox>;\n\n// What the item renders once the reader has typed \"aca\":\n<span data-part=\"label\">\n <Highlight text=\"Açaí Valley Ltd.\" query=\"aca\" />\n</span>;\n",
|
|
258
258
|
"verdict": "excerpt"
|
|
259
259
|
},
|
|
260
260
|
{
|
|
261
261
|
"id": "content",
|
|
262
|
-
"title": "Content
|
|
262
|
+
"title": "Content Highlight does not choose",
|
|
263
263
|
"note": "A run that wraps is two boxes and both carry the band; a mark inside Arabic sits where the logical indexes put it in either direction; a query inside a flag or a decomposed accent widens to the whole character; a thousand-character label with a one-letter query answers under a millisecond.",
|
|
264
264
|
"language": "tsx",
|
|
265
|
-
"source": "
|
|
266
|
-
"verdict": "
|
|
265
|
+
"source": "import { Highlight } from '@slotted/react/highlight';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nconst ROWS = [\n {\n label: 'A run that wraps',\n text: 'Consolidated annual sales report for the northern distribution region',\n query: 'annual sales report for the northern',\n },\n { label: 'Right to left', text: 'شركة النور للتجارة', query: 'النور' },\n { label: 'Decomposed accents', text: 'Crème Brulée Desserts', query: 'e' },\n];\n\nexport default function HighlightContent() {\n return (\n <Stack gap={4}>\n {ROWS.map((row) => (\n <Stack gap={1} key={row.label}>\n <Text size=\"sm\" tone=\"muted\">\n {row.label}\n </Text>\n <Highlight query={row.query} text={row.text} />\n </Stack>\n ))}\n </Stack>\n );\n}\n",
|
|
266
|
+
"verdict": "example"
|
|
267
267
|
},
|
|
268
268
|
{
|
|
269
269
|
"id": "accessibility",
|
|
270
270
|
"title": "What a reader hears",
|
|
271
|
-
"note": "The text is the text: the runs are slices of the string and nothing is hidden. mark is not announced by most screen readers by default, and
|
|
271
|
+
"note": "The text is the text: the runs are slices of the string and nothing is hidden. mark is not announced by most screen readers by default, and Highlight injects no hidden “highlight start” — five matches in an option would be ten announcements.",
|
|
272
272
|
"language": "css",
|
|
273
273
|
"source": "/* In the application's own stylesheet, where the announcement is wanted. */\n[data-ui='highlight'] [data-part='match']::before {\n content: ' [match] ';\n clip-path: inset(100%);\n position: absolute;\n}\n",
|
|
274
274
|
"verdict": "excerpt"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"id": "basic",
|
|
278
|
+
"title": "basic.tsx",
|
|
279
|
+
"note": null,
|
|
280
|
+
"language": "tsx",
|
|
281
|
+
"source": "import { Highlight } from '@slotted/react/highlight';\nimport { Stack } from '@slotted/react/stack';\n\nconst SUPPLIERS = [\n 'Blueberry Foods',\n 'Gooseberry Transport',\n 'Cloudberry Logistics',\n 'Harbor Pine',\n];\n\nexport default function HighlightBasic() {\n return (\n <Stack gap={2}>\n {SUPPLIERS.map((supplier) => (\n <Highlight key={supplier} query=\"berr\" text={supplier} />\n ))}\n </Stack>\n );\n}\n",
|
|
282
|
+
"verdict": "example"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"id": "defaults",
|
|
286
|
+
"title": "defaults.tsx",
|
|
287
|
+
"note": null,
|
|
288
|
+
"language": "tsx",
|
|
289
|
+
"source": "import { Highlight, HighlightDefaultsProvider } from '@slotted/react/highlight';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nexport default function HighlightDefaultsExample() {\n return (\n <HighlightDefaultsProvider locale=\"sv\">\n <Stack gap={3}>\n <Inline justify=\"between\">\n <Highlight query=\"ar\" text=\"Åre Ärla Arboga\" />\n <Text size=\"sm\" tone=\"muted\">\n provider: sv\n </Text>\n </Inline>\n <Inline justify=\"between\">\n <Highlight locale=\"en\" query=\"ar\" text=\"Åre Ärla Arboga\" />\n <Text size=\"sm\" tone=\"muted\">\n locale: en\n </Text>\n </Inline>\n </Stack>\n </HighlightDefaultsProvider>\n );\n}\n",
|
|
290
|
+
"verdict": "example"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"id": "search",
|
|
294
|
+
"title": "search.tsx",
|
|
295
|
+
"note": null,
|
|
296
|
+
"language": "tsx",
|
|
297
|
+
"source": "import { useState } from 'react';\n\nimport { Field, FieldLabel } from '@slotted/react/field';\nimport { Highlight } from '@slotted/react/highlight';\nimport { List } from '@slotted/react/list';\nimport { ListItem, ListItemBody, ListItemContent, ListItemLabel } from '@slotted/react/list-item';\nimport { Stack } from '@slotted/react/stack';\nimport { TextField } from '@slotted/react/text-field';\n\nconst SUPPLIERS = [\n 'Blueberry Foods',\n 'Gooseberry Transport',\n 'Cloudberry Logistics',\n 'Northwind Freight',\n 'Harbor Pine Trading',\n 'Brightline Packaging',\n];\n\nexport default function HighlightSearch() {\n const [query, setQuery] = useState('ber');\n\n return (\n <Stack gap={3}>\n <Field>\n <FieldLabel>Search suppliers</FieldLabel>\n <TextField clearable onValueChange={setQuery} value={query} />\n </Field>\n <List aria-label=\"Suppliers\" variant=\"ruled\">\n {SUPPLIERS.map((supplier) => (\n <ListItem key={supplier}>\n <ListItemContent>\n <ListItemBody>\n <ListItemLabel>\n <Highlight query={query} text={supplier} />\n </ListItemLabel>\n </ListItemBody>\n </ListItemContent>\n </ListItem>\n ))}\n </List>\n </Stack>\n );\n}\n",
|
|
298
|
+
"verdict": "example"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"id": "sensitivity",
|
|
302
|
+
"title": "sensitivity.tsx",
|
|
303
|
+
"note": null,
|
|
304
|
+
"language": "tsx",
|
|
305
|
+
"source": "import { Highlight } from '@slotted/react/highlight';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\n\nconst SENSITIVITIES = ['base', 'accent', 'case', 'variant'] as const;\n\nexport default function HighlightSensitivity() {\n return (\n <Stack gap={3}>\n {SENSITIVITIES.map((sensitivity) => (\n <Inline justify=\"between\" key={sensitivity}>\n <Highlight query=\"cafe\" sensitivity={sensitivity} text=\"Cafe Café CAFÉ cafe cafè\" />\n <Text size=\"sm\" tone=\"muted\">\n {sensitivity}\n </Text>\n </Inline>\n ))}\n </Stack>\n );\n}\n",
|
|
306
|
+
"verdict": "example"
|
|
275
307
|
}
|
|
276
308
|
]
|
|
277
309
|
}
|