@rio-cloud/uikit-mcp 1.1.5 → 1.1.7
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/doc-metadata.json +129 -29
- package/dist/docs/components/accentBar.md +2 -2
- package/dist/docs/components/activity.md +2 -2
- package/dist/docs/components/animatedNumber.md +3 -3
- package/dist/docs/components/animatedTextReveal.md +7 -7
- package/dist/docs/components/animations.md +33 -33
- package/dist/docs/components/appHeader.md +8 -8
- package/dist/docs/components/appLayout.md +106 -89
- package/dist/docs/components/appNavigationBar.md +2 -2
- package/dist/docs/components/areaCharts.md +14 -14
- package/dist/docs/components/aspectRatioPlaceholder.md +2 -2
- package/dist/docs/components/assetTree.md +209 -404
- package/dist/docs/components/autosuggests.md +2 -2
- package/dist/docs/components/avatar.md +2 -2
- package/dist/docs/components/banner.md +3 -3
- package/dist/docs/components/barCharts.md +24 -24
- package/dist/docs/components/barList.md +11 -11
- package/dist/docs/components/basicMap.md +2 -2
- package/dist/docs/components/bottomSheet.md +2 -2
- package/dist/docs/components/button.md +400 -32
- package/dist/docs/components/buttonToolbar.md +2 -2
- package/dist/docs/components/calendarStripe.md +96 -36
- package/dist/docs/components/card.md +2 -2
- package/dist/docs/components/carousel.md +2 -2
- package/dist/docs/components/chartColors.md +2 -2
- package/dist/docs/components/chartsGettingStarted.md +2 -2
- package/dist/docs/components/chat.md +3 -3
- package/dist/docs/components/checkbox.md +17 -20
- package/dist/docs/components/circularProgress.md +465 -0
- package/dist/docs/components/clearableInput.md +2 -2
- package/dist/docs/components/collapse.md +3 -3
- package/dist/docs/components/composedCharts.md +20 -20
- package/dist/docs/components/contentLoader.md +102 -102
- package/dist/docs/components/dataTabs.md +10 -10
- package/dist/docs/components/datepickers.md +31 -31
- package/dist/docs/components/dialogs.md +2 -2
- package/dist/docs/components/divider.md +2 -2
- package/dist/docs/components/dropdowns.md +4354 -4387
- package/dist/docs/components/editableContent.md +2 -2
- package/dist/docs/components/expander.md +2 -2
- package/dist/docs/components/fade.md +2 -2
- package/dist/docs/components/fadeExpander.md +3 -3
- package/dist/docs/components/fadeUp.md +3 -3
- package/dist/docs/components/feedback.md +2 -2
- package/dist/docs/components/filePickers.md +2 -2
- package/dist/docs/components/formLabel.md +5 -4
- package/dist/docs/components/groupedItemList.md +2 -2
- package/dist/docs/components/iconList.md +4 -4
- package/dist/docs/components/imagePreloader.md +2 -2
- package/dist/docs/components/labeledElement.md +2 -2
- package/dist/docs/components/licensePlate.md +2 -2
- package/dist/docs/components/lineCharts.md +11 -11
- package/dist/docs/components/listMenu.md +7 -7
- package/dist/docs/components/loadMore.md +2 -2
- package/dist/docs/components/mainNavigation.md +5 -5
- package/dist/docs/components/mapCircle.md +2 -2
- package/dist/docs/components/mapCluster.md +2 -2
- package/dist/docs/components/mapContext.md +2 -2
- package/dist/docs/components/mapDraggableMarker.md +2 -2
- package/dist/docs/components/mapGettingStarted.md +2 -2
- package/dist/docs/components/mapInfoBubble.md +2 -2
- package/dist/docs/components/mapLayerGroup.md +2 -2
- package/dist/docs/components/mapMarker.md +2 -2
- package/dist/docs/components/mapPolygon.md +2 -2
- package/dist/docs/components/mapRoute.md +2 -2
- package/dist/docs/components/mapRouteGenerator.md +2 -2
- package/dist/docs/components/mapSettings.md +9 -9
- package/dist/docs/components/mapUtils.md +2 -2
- package/dist/docs/components/multiselects.md +2 -2
- package/dist/docs/components/noData.md +2 -2
- package/dist/docs/components/notifications.md +2 -2
- package/dist/docs/components/numbercontrol.md +5 -4
- package/dist/docs/components/onboarding.md +2 -2
- package/dist/docs/components/page.md +2 -2
- package/dist/docs/components/pager.md +2 -2
- package/dist/docs/components/pieCharts.md +89 -78
- package/dist/docs/components/popover.md +2 -2
- package/dist/docs/components/position.md +2 -2
- package/dist/docs/components/radialBarCharts.md +2054 -2012
- package/dist/docs/components/radioCardGroup.md +487 -0
- package/dist/docs/components/radiobutton.md +2 -2
- package/dist/docs/components/releaseNotes.md +2 -2
- package/dist/docs/components/resizer.md +2 -2
- package/dist/docs/components/responsiveColumnStripe.md +2 -2
- package/dist/docs/components/responsiveVideo.md +2 -2
- package/dist/docs/components/rioglyph.md +2 -2
- package/dist/docs/components/rules.md +2 -2
- package/dist/docs/components/saveableInput.md +20 -20
- package/dist/docs/components/selects.md +2 -2
- package/dist/docs/components/sidebar.md +2 -2
- package/dist/docs/components/sliders.md +2 -2
- package/dist/docs/components/smoothScrollbars.md +2 -2
- package/dist/docs/components/spinners.md +2 -2
- package/dist/docs/components/states.md +2 -2
- package/dist/docs/components/statsWidgets.md +2 -2
- package/dist/docs/components/statusBar.md +2 -2
- package/dist/docs/components/stepButton.md +2 -2
- package/dist/docs/components/steppedProgressBars.md +2 -2
- package/dist/docs/components/subNavigation.md +17 -17
- package/dist/docs/components/supportMarker.md +2 -2
- package/dist/docs/components/svgImage.md +38 -2
- package/dist/docs/components/switch.md +210 -83
- package/dist/docs/components/tables.md +2 -2
- package/dist/docs/components/tagManager.md +2 -2
- package/dist/docs/components/tags.md +2 -2
- package/dist/docs/components/teaser.md +2 -2
- package/dist/docs/components/textTruncateMiddle.md +151 -0
- package/dist/docs/components/timeline.md +2 -2
- package/dist/docs/components/timepicker.md +660 -64
- package/dist/docs/components/toggleButton.md +37 -9
- package/dist/docs/components/tooltip.md +5 -4
- package/dist/docs/components/tracker.md +631 -0
- package/dist/docs/components/virtualList.md +77 -77
- package/dist/docs/foundations.md +594 -222
- package/dist/docs/start/changelog.md +54 -2
- package/dist/docs/start/goodtoknow.md +2 -2
- package/dist/docs/start/guidelines/color-combinations.md +2 -2
- package/dist/docs/start/guidelines/custom-css.md +2 -2
- package/dist/docs/start/guidelines/custom-rioglyph.md +2 -2
- package/dist/docs/start/guidelines/formatting.md +2 -2
- package/dist/docs/start/guidelines/iframe.md +3 -3
- package/dist/docs/start/guidelines/obfuscate-data.md +2 -2
- package/dist/docs/start/guidelines/print-css.md +2 -2
- package/dist/docs/start/guidelines/spinner.md +82 -82
- package/dist/docs/start/guidelines/state-in-url.md +263 -0
- package/dist/docs/start/guidelines/supported-browsers.md +2 -2
- package/dist/docs/start/guidelines/writing.md +2 -2
- package/dist/docs/start/howto.md +10 -10
- package/dist/docs/start/intro.md +2 -2
- package/dist/docs/start/responsiveness.md +2 -2
- package/dist/docs/templates/common-table.md +15 -14
- package/dist/docs/templates/detail-views.md +3 -3
- package/dist/docs/templates/expandable-details.md +2 -2
- package/dist/docs/templates/feature-cards.md +56 -56
- package/dist/docs/templates/form-summary.md +23 -23
- package/dist/docs/templates/form-toggle.md +2 -2
- package/dist/docs/templates/list-blocks.md +204 -204
- package/dist/docs/templates/loading-progress.md +2 -2
- package/dist/docs/templates/options-panel.md +2 -2
- package/dist/docs/templates/panel-variants.md +2 -2
- package/dist/docs/templates/progress-cards.md +2 -2
- package/dist/docs/templates/progress-success.md +2 -2
- package/dist/docs/templates/settings-form.md +24 -24
- package/dist/docs/templates/stats-blocks.md +15 -15
- package/dist/docs/templates/table-panel.md +2 -2
- package/dist/docs/templates/table-row-animation.md +2 -2
- package/dist/docs/templates/usage-cards.md +2 -2
- package/dist/docs/utilities/classNames.md +191 -0
- package/dist/docs/utilities/deviceUtils.md +2 -2
- package/dist/docs/utilities/featureToggles.md +2 -2
- package/dist/docs/utilities/fuelTypeUtils.md +2 -2
- package/dist/docs/utilities/routeUtils.md +326 -90
- package/dist/docs/utilities/useAfterMount.md +2 -2
- package/dist/docs/utilities/useAutoAnimate.md +2 -2
- package/dist/docs/utilities/useAverage.md +2 -2
- package/dist/docs/utilities/useClickOutside.md +2 -2
- package/dist/docs/utilities/useClipboard.md +3 -3
- package/dist/docs/utilities/useCookies.md +188 -0
- package/dist/docs/utilities/useCount.md +2 -2
- package/dist/docs/utilities/useDarkMode.md +2 -2
- package/dist/docs/utilities/useDebugInfo.md +5 -5
- package/dist/docs/utilities/useEffectOnce.md +2 -2
- package/dist/docs/utilities/useElapsedTime.md +2 -2
- package/dist/docs/utilities/useElementSize.md +2 -2
- package/dist/docs/utilities/useEsc.md +2 -2
- package/dist/docs/utilities/useEvent.md +2 -2
- package/dist/docs/utilities/useFocusTrap.md +2 -2
- package/dist/docs/utilities/useFullscreen.md +2 -2
- package/dist/docs/utilities/useHover.md +2 -2
- package/dist/docs/utilities/useIncomingPostMessages.md +2 -2
- package/dist/docs/utilities/useInterval.md +2 -2
- package/dist/docs/utilities/useIsFocusWithin.md +2 -2
- package/dist/docs/utilities/useKey.md +2 -2
- package/dist/docs/utilities/useLocalStorage.md +2 -2
- package/dist/docs/utilities/useLocationSuggestions.md +2 -2
- package/dist/docs/utilities/useMax.md +2 -2
- package/dist/docs/utilities/useMin.md +2 -2
- package/dist/docs/utilities/useMutationObserver.md +2 -2
- package/dist/docs/utilities/useOnScreen.md +2 -2
- package/dist/docs/utilities/useOnlineStatus.md +2 -2
- package/dist/docs/utilities/usePostMessage.md +3 -3
- package/dist/docs/utilities/usePostMessageSender.md +2 -2
- package/dist/docs/utilities/usePrevious.md +2 -2
- package/dist/docs/utilities/useResizeObserver.md +2 -2
- package/dist/docs/utilities/useRioCookieConsent.md +90 -0
- package/dist/docs/utilities/useScrollPosition.md +2 -2
- package/dist/docs/utilities/useSearch.md +2 -2
- package/dist/docs/utilities/useSearchHighlight.md +815 -0
- package/dist/docs/utilities/useSorting.md +2 -2
- package/dist/docs/utilities/useStateWithValidation.md +2 -2
- package/dist/docs/utilities/useSum.md +2 -2
- package/dist/docs/utilities/useTableExport.md +52 -52
- package/dist/docs/utilities/useTableSelection.md +90 -90
- package/dist/docs/utilities/useTimeout.md +2 -2
- package/dist/docs/utilities/useToggle.md +3 -3
- package/dist/docs/utilities/useUrlState.md +418 -0
- package/dist/docs/utilities/useWindowResize.md +2 -2
- package/dist/index.mjs +1 -1
- package/dist/version.json +2 -2
- package/package.json +9 -9
|
@@ -0,0 +1,815 @@
|
|
|
1
|
+
# useSearchHighlight
|
|
2
|
+
|
|
3
|
+
*Category:* Utilities
|
|
4
|
+
*Section:* UI state & input hooks
|
|
5
|
+
*Source:* https://uikit.developers.rio.cloud/#/utilities/useSearchHighlight
|
|
6
|
+
*Captured:* 2026-02-23T15:50:00.718Z
|
|
7
|
+
|
|
8
|
+
The useSearchHighlight hook applies native CSS Highlight API ranges to matching text in a referenced container. It progressively enhances supported browsers without mutating markup and can be scoped or made case-sensitive as needed.
|
|
9
|
+
|
|
10
|
+
## useSearchHighlight
|
|
11
|
+
|
|
12
|
+
For simple cases, the <SearchHighlightText> component wraps the hook and provides amark fallback when the Highlight API is unavailable.
|
|
13
|
+
|
|
14
|
+
Use it when you just need to highlight a single string without managing refs or DOM scopes. For complex layouts (tables, lists, or rich markup), prefer useSearchHighlight so you can target a container and control when highlights refresh.
|
|
15
|
+
|
|
16
|
+
### Example: Example 1
|
|
17
|
+
|
|
18
|
+
Shipments8
|
|
19
|
+
|
|
20
|
+
Shipment idOriginDestinationStatus
|
|
21
|
+
|
|
22
|
+
RIO-100284Hamburg, DERotterdam, NLIn transit
|
|
23
|
+
RIO-100317Berlin, DEPrague, CZDelivered
|
|
24
|
+
RIO-100411Munich, DEVienna, ATDelayed
|
|
25
|
+
RIO-100512Cologne, DEParis, FRCustoms
|
|
26
|
+
RIO-100640Leipzig, DEZurich, CHIn transit
|
|
27
|
+
RIO-100771Stuttgart, DEMilan, ITDelivered
|
|
28
|
+
RIO-100889Frankfurt, DEWarsaw, PLIn transit
|
|
29
|
+
RIO-101002Dresden, DECopenhagen, DKDelayed
|
|
30
|
+
|
|
31
|
+
Case-sensitive search
|
|
32
|
+
|
|
33
|
+
#### Summary
|
|
34
|
+
|
|
35
|
+
Shipments8
|
|
36
|
+
|
|
37
|
+
Shipment idOriginDestinationStatus
|
|
38
|
+
|
|
39
|
+
RIO-100284Hamburg, DERotterdam, NLIn transit
|
|
40
|
+
RIO-100317Berlin, DEPrague, CZDelivered
|
|
41
|
+
RIO-100411Munich, DEVienna, ATDelayed
|
|
42
|
+
RIO-100512Cologne, DEParis, FRCustoms
|
|
43
|
+
RIO-100640Leipzig, DEZurich, CHIn transit
|
|
44
|
+
RIO-100771Stuttgart, DEMilan, ITDelivered
|
|
45
|
+
RIO-100889Frankfurt, DEWarsaw, PLIn transit
|
|
46
|
+
RIO-101002Dresden, DECopenhagen, DKDelayed
|
|
47
|
+
|
|
48
|
+
Case-sensitive search
|
|
49
|
+
|
|
50
|
+
#### React (tsx)
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { useRef, useState } from 'react';
|
|
54
|
+
|
|
55
|
+
import Checkbox from '@rio-cloud/rio-uikit/Checkbox';
|
|
56
|
+
import TableSearch from '@rio-cloud/rio-uikit/TableSearch';
|
|
57
|
+
import useSearch from '@rio-cloud/rio-uikit/useSearch';
|
|
58
|
+
import useSearchHighlight from '@rio-cloud/rio-uikit/useSearchHighlight';
|
|
59
|
+
|
|
60
|
+
type ShipmentStatus = 'In transit' | 'Delivered' | 'Delayed' | 'Customs';
|
|
61
|
+
|
|
62
|
+
type LogisticsRow = {
|
|
63
|
+
shipmentId: string;
|
|
64
|
+
origin: string;
|
|
65
|
+
destination: string;
|
|
66
|
+
status: ShipmentStatus;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const tableData: LogisticsRow[] = [
|
|
70
|
+
{ shipmentId: 'RIO-100284', origin: 'Hamburg, DE', destination: 'Rotterdam, NL', status: 'In transit' },
|
|
71
|
+
{ shipmentId: 'RIO-100317', origin: 'Berlin, DE', destination: 'Prague, CZ', status: 'Delivered' },
|
|
72
|
+
{ shipmentId: 'RIO-100411', origin: 'Munich, DE', destination: 'Vienna, AT', status: 'Delayed' },
|
|
73
|
+
{ shipmentId: 'RIO-100512', origin: 'Cologne, DE', destination: 'Paris, FR', status: 'Customs' },
|
|
74
|
+
{ shipmentId: 'RIO-100640', origin: 'Leipzig, DE', destination: 'Zurich, CH', status: 'In transit' },
|
|
75
|
+
{ shipmentId: 'RIO-100771', origin: 'Stuttgart, DE', destination: 'Milan, IT', status: 'Delivered' },
|
|
76
|
+
{ shipmentId: 'RIO-100889', origin: 'Frankfurt, DE', destination: 'Warsaw, PL', status: 'In transit' },
|
|
77
|
+
{ shipmentId: 'RIO-101002', origin: 'Dresden, DE', destination: 'Copenhagen, DK', status: 'Delayed' },
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
export default () => {
|
|
81
|
+
const tableBodyRef = useRef<HTMLTableSectionElement | null>(null);
|
|
82
|
+
const [isCaseSensitive, setIsCaseSensitive] = useState(false);
|
|
83
|
+
|
|
84
|
+
const { searchValue, setSearchValue, filteredList } = useSearch<LogisticsRow>(tableData, {
|
|
85
|
+
fields: ['shipmentId', 'origin', 'destination', 'status'],
|
|
86
|
+
debounceMs: 100,
|
|
87
|
+
caseSensitive: isCaseSensitive,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// progressive enhancement – always safe to call
|
|
91
|
+
useSearchHighlight({
|
|
92
|
+
ref: tableBodyRef,
|
|
93
|
+
query: searchValue,
|
|
94
|
+
caseSensitive: isCaseSensitive,
|
|
95
|
+
deps: [filteredList],
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<div className='padding-15'>
|
|
100
|
+
{/* table toolbar */}
|
|
101
|
+
<div className='table-toolbar'>
|
|
102
|
+
<div className='table-toolbar-container'>
|
|
103
|
+
<div className='table-toolbar-group-left'>
|
|
104
|
+
<div className='table-toolbar-column'>
|
|
105
|
+
<div className='display-flex gap-10 align-items-center'>
|
|
106
|
+
<span className='text-medium'>Shipments</span>
|
|
107
|
+
<span className='label label-muted label-filled'>{filteredList.length}</span>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div className='table-toolbar-group-right'>
|
|
113
|
+
<div className='table-toolbar-column'>
|
|
114
|
+
<TableSearch
|
|
115
|
+
value={searchValue}
|
|
116
|
+
onChange={setSearchValue}
|
|
117
|
+
onClear={() => setSearchValue('')}
|
|
118
|
+
placeholder='Search in table'
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
{/* table */}
|
|
126
|
+
<div className='table-responsive'>
|
|
127
|
+
<table className='table table-bordered table-head-filled'>
|
|
128
|
+
<thead>
|
|
129
|
+
<tr>
|
|
130
|
+
<th>Shipment id</th>
|
|
131
|
+
<th>Origin</th>
|
|
132
|
+
<th>Destination</th>
|
|
133
|
+
<th>Status</th>
|
|
134
|
+
</tr>
|
|
135
|
+
</thead>
|
|
136
|
+
|
|
137
|
+
<tbody ref={tableBodyRef}>
|
|
138
|
+
{filteredList.map(row => (
|
|
139
|
+
<tr key={row.shipmentId}>
|
|
140
|
+
<td>{row.shipmentId}</td>
|
|
141
|
+
<td>{row.origin}</td>
|
|
142
|
+
<td>{row.destination}</td>
|
|
143
|
+
<td>{row.status}</td>
|
|
144
|
+
</tr>
|
|
145
|
+
))}
|
|
146
|
+
|
|
147
|
+
{!filteredList.length && (
|
|
148
|
+
<tr>
|
|
149
|
+
<td colSpan={4} className='text-center text-color-gray padding-25'>
|
|
150
|
+
No matching shipments
|
|
151
|
+
</td>
|
|
152
|
+
</tr>
|
|
153
|
+
)}
|
|
154
|
+
</tbody>
|
|
155
|
+
</table>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<div className='margin-top-10'>
|
|
159
|
+
<Checkbox
|
|
160
|
+
checked={isCaseSensitive}
|
|
161
|
+
onChange={event => setIsCaseSensitive((event.target as HTMLInputElement).checked)}
|
|
162
|
+
>
|
|
163
|
+
Case-sensitive search
|
|
164
|
+
</Checkbox>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
);
|
|
168
|
+
};
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
#### HTML (html)
|
|
172
|
+
|
|
173
|
+
```html
|
|
174
|
+
<div class="padding-15">
|
|
175
|
+
<div class="table-toolbar">
|
|
176
|
+
<div class="table-toolbar-container">
|
|
177
|
+
<div class="table-toolbar-group-left">
|
|
178
|
+
<div class="table-toolbar-column">
|
|
179
|
+
<div class="display-flex gap-10 align-items-center">
|
|
180
|
+
<span class="text-medium">Shipments</span>
|
|
181
|
+
<span class="label label-muted label-filled">8</span>
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
<div class="table-toolbar-group-right">
|
|
186
|
+
<div class="table-toolbar-column">
|
|
187
|
+
<div class="table-toolbar-search input-group">
|
|
188
|
+
<span class="input-group-addon">
|
|
189
|
+
<span class="rioglyph rioglyph-search">
|
|
190
|
+
</span>
|
|
191
|
+
</span>
|
|
192
|
+
<div class="ClearableInput input-group">
|
|
193
|
+
<input placeholder="Search in table" class="form-control" type="text" tabindex="0" value="">
|
|
194
|
+
<span class="clearButton hide">
|
|
195
|
+
<span class="clearButtonIcon rioglyph rioglyph-remove-sign">
|
|
196
|
+
</span>
|
|
197
|
+
</span>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
<div class="table-responsive">
|
|
205
|
+
<table class="table table-bordered table-head-filled">
|
|
206
|
+
<thead>
|
|
207
|
+
<tr>
|
|
208
|
+
<th>Shipment id</th>
|
|
209
|
+
<th>Origin</th>
|
|
210
|
+
<th>Destination</th>
|
|
211
|
+
<th>Status</th>
|
|
212
|
+
</tr>
|
|
213
|
+
</thead>
|
|
214
|
+
<tbody>
|
|
215
|
+
<tr>
|
|
216
|
+
<td>RIO-100284</td>
|
|
217
|
+
<td>Hamburg, DE</td>
|
|
218
|
+
<td>Rotterdam, NL</td>
|
|
219
|
+
<td>In transit</td>
|
|
220
|
+
</tr>
|
|
221
|
+
<tr>
|
|
222
|
+
<td>RIO-100317</td>
|
|
223
|
+
<td>Berlin, DE</td>
|
|
224
|
+
<td>Prague, CZ</td>
|
|
225
|
+
<td>Delivered</td>
|
|
226
|
+
</tr>
|
|
227
|
+
<tr>
|
|
228
|
+
<td>RIO-100411</td>
|
|
229
|
+
<td>Munich, DE</td>
|
|
230
|
+
<td>Vienna, AT</td>
|
|
231
|
+
<td>Delayed</td>
|
|
232
|
+
</tr>
|
|
233
|
+
<tr>
|
|
234
|
+
<td>RIO-100512</td>
|
|
235
|
+
<td>Cologne, DE</td>
|
|
236
|
+
<td>Paris, FR</td>
|
|
237
|
+
<td>Customs</td>
|
|
238
|
+
</tr>
|
|
239
|
+
<tr>
|
|
240
|
+
<td>RIO-100640</td>
|
|
241
|
+
<td>Leipzig, DE</td>
|
|
242
|
+
<td>Zurich, CH</td>
|
|
243
|
+
<td>In transit</td>
|
|
244
|
+
</tr>
|
|
245
|
+
<tr>
|
|
246
|
+
<td>RIO-100771</td>
|
|
247
|
+
<td>Stuttgart, DE</td>
|
|
248
|
+
<td>Milan, IT</td>
|
|
249
|
+
<td>Delivered</td>
|
|
250
|
+
</tr>
|
|
251
|
+
<tr>
|
|
252
|
+
<td>RIO-100889</td>
|
|
253
|
+
<td>Frankfurt, DE</td>
|
|
254
|
+
<td>Warsaw, PL</td>
|
|
255
|
+
<td>In transit</td>
|
|
256
|
+
</tr>
|
|
257
|
+
<tr>
|
|
258
|
+
<td>RIO-101002</td>
|
|
259
|
+
<td>Dresden, DE</td>
|
|
260
|
+
<td>Copenhagen, DK</td>
|
|
261
|
+
<td>Delayed</td>
|
|
262
|
+
</tr>
|
|
263
|
+
</tbody>
|
|
264
|
+
</table>
|
|
265
|
+
</div>
|
|
266
|
+
<div class="margin-top-10">
|
|
267
|
+
<label class="checkbox" tabindex="0">
|
|
268
|
+
<input type="checkbox" class="">
|
|
269
|
+
<span class="checkbox-text">
|
|
270
|
+
<span>Case-sensitive search</span>
|
|
271
|
+
</span>
|
|
272
|
+
</label>
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
#### Props: useSearchHighlight
|
|
278
|
+
|
|
279
|
+
### useSearchHighlight
|
|
280
|
+
|
|
281
|
+
| Name | Type | Default | Description |
|
|
282
|
+
| --- | --- | --- | --- |
|
|
283
|
+
| ref | React.RefObject<HTMLElement> | — | Ref to the element whose text content should be searched. |
|
|
284
|
+
| query | string | — | Search query used for highlighting. |
|
|
285
|
+
| highlightClassName | string | 'search-result-highlight' | Name of the CSS highlight. |
|
|
286
|
+
| scopeSelector | string | — | Optional selector to limit the search scope (e.g. '.ListMenuGroup' or '.OptionLabel'). |
|
|
287
|
+
| caseSensitive | boolean | false | Whether to perform a case-sensitive match. |
|
|
288
|
+
| deps | unknown[] | — | Optional dependencies that should trigger re-collecting and applying ranges. Useful when the DOM changes after the query changes (e.g. debounced filtering). |
|
|
289
|
+
|
|
290
|
+
#### Props: SearchHighlightText
|
|
291
|
+
|
|
292
|
+
### SearchHighlightText
|
|
293
|
+
|
|
294
|
+
| Name | Type | Default | Description |
|
|
295
|
+
| --- | --- | --- | --- |
|
|
296
|
+
| text | string | — | Full text content to render and highlight. |
|
|
297
|
+
| query | string | — | Search query used to highlight matches within the text. |
|
|
298
|
+
| caseSensitive | boolean | false | Whether to perform a case-sensitive match. |
|
|
299
|
+
| highlightClassName | string | 'search-result-highlight' | Optional CSS highlight class name (used by the Highlight API). |
|
|
300
|
+
| classNames | string | — | Optional additional classes applied to the wrapper element. |
|
|
301
|
+
|
|
302
|
+
### Example: Example 2
|
|
303
|
+
|
|
304
|
+
Shipments8
|
|
305
|
+
|
|
306
|
+
RIO-100284
|
|
307
|
+
In transit
|
|
308
|
+
Origin: Hamburg, DE
|
|
309
|
+
Destination: Rotterdam, NL
|
|
310
|
+
|
|
311
|
+
RIO-100317
|
|
312
|
+
Delivered
|
|
313
|
+
Origin: Berlin, DE
|
|
314
|
+
Destination: Prague, CZ
|
|
315
|
+
|
|
316
|
+
RIO-100411
|
|
317
|
+
Delayed
|
|
318
|
+
Origin: Munich, DE
|
|
319
|
+
Destination: Vienna, AT
|
|
320
|
+
|
|
321
|
+
RIO-100512
|
|
322
|
+
Customs
|
|
323
|
+
Origin: Cologne, DE
|
|
324
|
+
Destination: Paris, FR
|
|
325
|
+
|
|
326
|
+
RIO-100640
|
|
327
|
+
In transit
|
|
328
|
+
Origin: Leipzig, DE
|
|
329
|
+
Destination: Zurich, CH
|
|
330
|
+
|
|
331
|
+
RIO-100771
|
|
332
|
+
Delivered
|
|
333
|
+
Origin: Stuttgart, DE
|
|
334
|
+
Destination: Milan, IT
|
|
335
|
+
|
|
336
|
+
RIO-100889
|
|
337
|
+
In transit
|
|
338
|
+
Origin: Frankfurt, DE
|
|
339
|
+
Destination: Warsaw, PL
|
|
340
|
+
|
|
341
|
+
RIO-101002
|
|
342
|
+
Delayed
|
|
343
|
+
Origin: Dresden, DE
|
|
344
|
+
Destination: Copenhagen, DK
|
|
345
|
+
|
|
346
|
+
#### Summary
|
|
347
|
+
|
|
348
|
+
Shipments8
|
|
349
|
+
|
|
350
|
+
RIO-100284
|
|
351
|
+
In transit
|
|
352
|
+
Origin: Hamburg, DE
|
|
353
|
+
Destination: Rotterdam, NL
|
|
354
|
+
|
|
355
|
+
RIO-100317
|
|
356
|
+
Delivered
|
|
357
|
+
Origin: Berlin, DE
|
|
358
|
+
Destination: Prague, CZ
|
|
359
|
+
|
|
360
|
+
RIO-100411
|
|
361
|
+
Delayed
|
|
362
|
+
Origin: Munich, DE
|
|
363
|
+
Destination: Vienna, AT
|
|
364
|
+
|
|
365
|
+
RIO-100512
|
|
366
|
+
Customs
|
|
367
|
+
Origin: Cologne, DE
|
|
368
|
+
Destination: Paris, FR
|
|
369
|
+
|
|
370
|
+
RIO-100640
|
|
371
|
+
In transit
|
|
372
|
+
Origin: Leipzig, DE
|
|
373
|
+
Destination: Zurich, CH
|
|
374
|
+
|
|
375
|
+
RIO-100771
|
|
376
|
+
Delivered
|
|
377
|
+
Origin: Stuttgart, DE
|
|
378
|
+
Destination: Milan, IT
|
|
379
|
+
|
|
380
|
+
RIO-100889
|
|
381
|
+
In transit
|
|
382
|
+
Origin: Frankfurt, DE
|
|
383
|
+
Destination: Warsaw, PL
|
|
384
|
+
|
|
385
|
+
RIO-101002
|
|
386
|
+
Delayed
|
|
387
|
+
Origin: Dresden, DE
|
|
388
|
+
Destination: Copenhagen, DK
|
|
389
|
+
|
|
390
|
+
#### React (tsx)
|
|
391
|
+
|
|
392
|
+
```tsx
|
|
393
|
+
import { useRef } from 'react';
|
|
394
|
+
|
|
395
|
+
import TableSearch from '@rio-cloud/rio-uikit/TableSearch';
|
|
396
|
+
import useSearch from '@rio-cloud/rio-uikit/useSearch';
|
|
397
|
+
import useSearchHighlight from '@rio-cloud/rio-uikit/useSearchHighlight';
|
|
398
|
+
|
|
399
|
+
type ShipmentStatus = 'In transit' | 'Delivered' | 'Delayed' | 'Customs';
|
|
400
|
+
|
|
401
|
+
type LogisticsRow = {
|
|
402
|
+
shipmentId: string;
|
|
403
|
+
origin: string;
|
|
404
|
+
destination: string;
|
|
405
|
+
status: ShipmentStatus;
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
const listData: LogisticsRow[] = [
|
|
409
|
+
{ shipmentId: 'RIO-100284', origin: 'Hamburg, DE', destination: 'Rotterdam, NL', status: 'In transit' },
|
|
410
|
+
{ shipmentId: 'RIO-100317', origin: 'Berlin, DE', destination: 'Prague, CZ', status: 'Delivered' },
|
|
411
|
+
{ shipmentId: 'RIO-100411', origin: 'Munich, DE', destination: 'Vienna, AT', status: 'Delayed' },
|
|
412
|
+
{ shipmentId: 'RIO-100512', origin: 'Cologne, DE', destination: 'Paris, FR', status: 'Customs' },
|
|
413
|
+
{ shipmentId: 'RIO-100640', origin: 'Leipzig, DE', destination: 'Zurich, CH', status: 'In transit' },
|
|
414
|
+
{ shipmentId: 'RIO-100771', origin: 'Stuttgart, DE', destination: 'Milan, IT', status: 'Delivered' },
|
|
415
|
+
{ shipmentId: 'RIO-100889', origin: 'Frankfurt, DE', destination: 'Warsaw, PL', status: 'In transit' },
|
|
416
|
+
{ shipmentId: 'RIO-101002', origin: 'Dresden, DE', destination: 'Copenhagen, DK', status: 'Delayed' },
|
|
417
|
+
];
|
|
418
|
+
|
|
419
|
+
export default () => {
|
|
420
|
+
const listRef = useRef<HTMLUListElement | null>(null);
|
|
421
|
+
|
|
422
|
+
const { searchValue, setSearchValue, filteredList } = useSearch<LogisticsRow>(listData, {
|
|
423
|
+
fields: ['shipmentId', 'origin', 'destination', 'status'],
|
|
424
|
+
debounceMs: 150,
|
|
425
|
+
caseSensitive: false,
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
// progressive enhancement – always safe to call
|
|
429
|
+
useSearchHighlight({
|
|
430
|
+
ref: listRef,
|
|
431
|
+
query: searchValue,
|
|
432
|
+
deps: [filteredList],
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
return (
|
|
436
|
+
<div className='padding-15'>
|
|
437
|
+
<div className='table-toolbar'>
|
|
438
|
+
<div className='table-toolbar-container'>
|
|
439
|
+
<div className='table-toolbar-group-left'>
|
|
440
|
+
<div className='table-toolbar-column'>
|
|
441
|
+
<div className='display-flex gap-10 align-items-center'>
|
|
442
|
+
<span className='text-medium'>Shipments</span>
|
|
443
|
+
<span className='label label-muted label-filled'>{filteredList.length}</span>
|
|
444
|
+
</div>
|
|
445
|
+
</div>
|
|
446
|
+
</div>
|
|
447
|
+
|
|
448
|
+
<div className='table-toolbar-group-right'>
|
|
449
|
+
<div className='table-toolbar-column'>
|
|
450
|
+
<TableSearch
|
|
451
|
+
value={searchValue}
|
|
452
|
+
onChange={setSearchValue}
|
|
453
|
+
onClear={() => setSearchValue('')}
|
|
454
|
+
placeholder='Search in list'
|
|
455
|
+
/>
|
|
456
|
+
</div>
|
|
457
|
+
</div>
|
|
458
|
+
</div>
|
|
459
|
+
</div>
|
|
460
|
+
|
|
461
|
+
<ul ref={listRef} className='list-group border rounded'>
|
|
462
|
+
{filteredList.map(row => (
|
|
463
|
+
<li className='list-group-item' key={row.shipmentId}>
|
|
464
|
+
<div className='display-flex align-items-center gap-15'>
|
|
465
|
+
<div className='height-50 width-50 bg-lightest rounded-circle display-grid place-items-center'>
|
|
466
|
+
<div className='text-size-14 text-color-darkest'>
|
|
467
|
+
<span className='rioglyph rioglyph-order text-size-h2' />
|
|
468
|
+
</div>
|
|
469
|
+
</div>
|
|
470
|
+
<div className='flex-1-1 margin-bottom-5'>
|
|
471
|
+
<div className='display-flex flex-wrap justify-content-between align-items-center gap-10'>
|
|
472
|
+
<div className='text-medium'>{row.shipmentId}</div>
|
|
473
|
+
<span className='label label-muted label-filled'>{row.status}</span>
|
|
474
|
+
</div>
|
|
475
|
+
<div className='text-color-gray'>
|
|
476
|
+
<span className='text-color-darker'>Origin:</span> {row.origin}
|
|
477
|
+
</div>
|
|
478
|
+
<div className='text-color-gray'>
|
|
479
|
+
<span className='text-color-darker'>Destination:</span> {row.destination}
|
|
480
|
+
</div>
|
|
481
|
+
</div>
|
|
482
|
+
</div>
|
|
483
|
+
</li>
|
|
484
|
+
))}
|
|
485
|
+
|
|
486
|
+
{!filteredList.length && (
|
|
487
|
+
<li className='list-group-item text-center text-color-gray padding-25'>No matching shipments</li>
|
|
488
|
+
)}
|
|
489
|
+
</ul>
|
|
490
|
+
</div>
|
|
491
|
+
);
|
|
492
|
+
};
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
#### HTML (html)
|
|
496
|
+
|
|
497
|
+
```html
|
|
498
|
+
<div class="padding-15">
|
|
499
|
+
<div class="table-toolbar">
|
|
500
|
+
<div class="table-toolbar-container">
|
|
501
|
+
<div class="table-toolbar-group-left">
|
|
502
|
+
<div class="table-toolbar-column">
|
|
503
|
+
<div class="display-flex gap-10 align-items-center">
|
|
504
|
+
<span class="text-medium">Shipments</span>
|
|
505
|
+
<span class="label label-muted label-filled">8</span>
|
|
506
|
+
</div>
|
|
507
|
+
</div>
|
|
508
|
+
</div>
|
|
509
|
+
<div class="table-toolbar-group-right">
|
|
510
|
+
<div class="table-toolbar-column">
|
|
511
|
+
<div class="table-toolbar-search input-group">
|
|
512
|
+
<span class="input-group-addon">
|
|
513
|
+
<span class="rioglyph rioglyph-search">
|
|
514
|
+
</span>
|
|
515
|
+
</span>
|
|
516
|
+
<div class="ClearableInput input-group">
|
|
517
|
+
<input placeholder="Search in list" class="form-control" type="text" tabindex="0" value="">
|
|
518
|
+
<span class="clearButton hide">
|
|
519
|
+
<span class="clearButtonIcon rioglyph rioglyph-remove-sign">
|
|
520
|
+
</span>
|
|
521
|
+
</span>
|
|
522
|
+
</div>
|
|
523
|
+
</div>
|
|
524
|
+
</div>
|
|
525
|
+
</div>
|
|
526
|
+
</div>
|
|
527
|
+
</div>
|
|
528
|
+
<ul class="list-group border rounded">
|
|
529
|
+
<li class="list-group-item">
|
|
530
|
+
<div class="display-flex align-items-center gap-15">
|
|
531
|
+
<div class="height-50 width-50 bg-lightest rounded-circle display-grid place-items-center">
|
|
532
|
+
<div class="text-size-14 text-color-darkest">
|
|
533
|
+
<span class="rioglyph rioglyph-order text-size-h2">
|
|
534
|
+
</span>
|
|
535
|
+
</div>
|
|
536
|
+
</div>
|
|
537
|
+
<div class="flex-1-1 margin-bottom-5">
|
|
538
|
+
<div class="display-flex flex-wrap justify-content-between align-items-center gap-10">
|
|
539
|
+
<div class="text-medium">RIO-100284</div>
|
|
540
|
+
<span class="label label-muted label-filled">In transit</span>
|
|
541
|
+
</div>
|
|
542
|
+
<div class="text-color-gray">
|
|
543
|
+
<span class="text-color-darker">Origin:</span> Hamburg, DE
|
|
544
|
+
</div>
|
|
545
|
+
<div class="text-color-gray">
|
|
546
|
+
<span class="text-color-darker">Destination:</span> Rotterdam, NL
|
|
547
|
+
</div>
|
|
548
|
+
</div>
|
|
549
|
+
</div>
|
|
550
|
+
</li>
|
|
551
|
+
<li class="list-group-item">
|
|
552
|
+
<div class="display-flex align-items-center gap-15">
|
|
553
|
+
<div class="height-50 width-50 bg-lightest rounded-circle display-grid place-items-center">
|
|
554
|
+
<div class="text-size-14 text-color-darkest">
|
|
555
|
+
<span class="rioglyph rioglyph-order text-size-h2">
|
|
556
|
+
</span>
|
|
557
|
+
</div>
|
|
558
|
+
</div>
|
|
559
|
+
<div class="flex-1-1 margin-bottom-5">
|
|
560
|
+
<div class="display-flex flex-wrap justify-content-between align-items-center gap-10">
|
|
561
|
+
<div class="text-medium">RIO-100317</div>
|
|
562
|
+
<span class="label label-muted label-filled">Delivered</span>
|
|
563
|
+
</div>
|
|
564
|
+
<div class="text-color-gray">
|
|
565
|
+
<span class="text-color-darker">Origin:</span> Berlin, DE
|
|
566
|
+
</div>
|
|
567
|
+
<div class="text-color-gray">
|
|
568
|
+
<span class="text-color-darker">Destination:</span> Prague, CZ
|
|
569
|
+
</div>
|
|
570
|
+
</div>
|
|
571
|
+
</div>
|
|
572
|
+
</li>
|
|
573
|
+
<li class="list-group-item">
|
|
574
|
+
<div class="display-flex align-items-center gap-15">
|
|
575
|
+
<div class="height-50 width-50 bg-lightest rounded-circle display-grid place-items-center">
|
|
576
|
+
<div class="text-size-14 text-color-darkest">
|
|
577
|
+
<span class="rioglyph rioglyph-order text-size-h2">
|
|
578
|
+
</span>
|
|
579
|
+
</div>
|
|
580
|
+
</div>
|
|
581
|
+
<div class="flex-1-1 margin-bottom-5">
|
|
582
|
+
<div class="display-flex flex-wrap justify-content-between align-items-center gap-10">
|
|
583
|
+
<div class="text-medium">RIO-100411</div>
|
|
584
|
+
<span class="label label-muted label-filled">Delayed</span>
|
|
585
|
+
</div>
|
|
586
|
+
<div class="text-color-gray">
|
|
587
|
+
<span class="text-color-darker">Origin:</span> Munich, DE
|
|
588
|
+
</div>
|
|
589
|
+
<div class="text-color-gray">
|
|
590
|
+
<span class="text-color-darker">Destination:</span> Vienna, AT
|
|
591
|
+
</div>
|
|
592
|
+
</div>
|
|
593
|
+
</div>
|
|
594
|
+
</li>
|
|
595
|
+
<li class="list-group-item">
|
|
596
|
+
<div class="display-flex align-items-center gap-15">
|
|
597
|
+
<div class="height-50 width-50 bg-lightest rounded-circle display-grid place-items-center">
|
|
598
|
+
<div class="text-size-14 text-color-darkest">
|
|
599
|
+
<span class="rioglyph rioglyph-order text-size-h2">
|
|
600
|
+
</span>
|
|
601
|
+
</div>
|
|
602
|
+
</div>
|
|
603
|
+
<div class="flex-1-1 margin-bottom-5">
|
|
604
|
+
<div class="display-flex flex-wrap justify-content-between align-items-center gap-10">
|
|
605
|
+
<div class="text-medium">RIO-100512</div>
|
|
606
|
+
<span class="label label-muted label-filled">Customs</span>
|
|
607
|
+
</div>
|
|
608
|
+
<div class="text-color-gray">
|
|
609
|
+
<span class="text-color-darker">Origin:</span> Cologne, DE
|
|
610
|
+
</div>
|
|
611
|
+
<div class="text-color-gray">
|
|
612
|
+
<span class="text-color-darker">Destination:</span> Paris, FR
|
|
613
|
+
</div>
|
|
614
|
+
</div>
|
|
615
|
+
</div>
|
|
616
|
+
</li>
|
|
617
|
+
<li class="list-group-item">
|
|
618
|
+
<div class="display-flex align-items-center gap-15">
|
|
619
|
+
<div class="height-50 width-50 bg-lightest rounded-circle display-grid place-items-center">
|
|
620
|
+
<div class="text-size-14 text-color-darkest">
|
|
621
|
+
<span class="rioglyph rioglyph-order text-size-h2">
|
|
622
|
+
</span>
|
|
623
|
+
</div>
|
|
624
|
+
</div>
|
|
625
|
+
<div class="flex-1-1 margin-bottom-5">
|
|
626
|
+
<div class="display-flex flex-wrap justify-content-between align-items-center gap-10">
|
|
627
|
+
<div class="text-medium">RIO-100640</div>
|
|
628
|
+
<span class="label label-muted label-filled">In transit</span>
|
|
629
|
+
</div>
|
|
630
|
+
<div class="text-color-gray">
|
|
631
|
+
<span class="text-color-darker">Origin:</span> Leipzig, DE
|
|
632
|
+
</div>
|
|
633
|
+
<div class="text-color-gray">
|
|
634
|
+
<span class="text-color-darker">Destination:</span> Zurich, CH
|
|
635
|
+
</div>
|
|
636
|
+
</div>
|
|
637
|
+
</div>
|
|
638
|
+
</li>
|
|
639
|
+
<li class="list-group-item">
|
|
640
|
+
<div class="display-flex align-items-center gap-15">
|
|
641
|
+
<div class="height-50 width-50 bg-lightest rounded-circle display-grid place-items-center">
|
|
642
|
+
<div class="text-size-14 text-color-darkest">
|
|
643
|
+
<span class="rioglyph rioglyph-order text-size-h2">
|
|
644
|
+
</span>
|
|
645
|
+
</div>
|
|
646
|
+
</div>
|
|
647
|
+
<div class="flex-1-1 margin-bottom-5">
|
|
648
|
+
<div class="display-flex flex-wrap justify-content-between align-items-center gap-10">
|
|
649
|
+
<div class="text-medium">RIO-100771</div>
|
|
650
|
+
<span class="label label-muted label-filled">Delivered</span>
|
|
651
|
+
</div>
|
|
652
|
+
<div class="text-color-gray">
|
|
653
|
+
<span class="text-color-darker">Origin:</span> Stuttgart, DE
|
|
654
|
+
</div>
|
|
655
|
+
<div class="text-color-gray">
|
|
656
|
+
<span class="text-color-darker">Destination:</span> Milan, IT
|
|
657
|
+
</div>
|
|
658
|
+
</div>
|
|
659
|
+
</div>
|
|
660
|
+
</li>
|
|
661
|
+
<li class="list-group-item">
|
|
662
|
+
<div class="display-flex align-items-center gap-15">
|
|
663
|
+
<div class="height-50 width-50 bg-lightest rounded-circle display-grid place-items-center">
|
|
664
|
+
<div class="text-size-14 text-color-darkest">
|
|
665
|
+
<span class="rioglyph rioglyph-order text-size-h2">
|
|
666
|
+
</span>
|
|
667
|
+
</div>
|
|
668
|
+
</div>
|
|
669
|
+
<div class="flex-1-1 margin-bottom-5">
|
|
670
|
+
<div class="display-flex flex-wrap justify-content-between align-items-center gap-10">
|
|
671
|
+
<div class="text-medium">RIO-100889</div>
|
|
672
|
+
<span class="label label-muted label-filled">In transit</span>
|
|
673
|
+
</div>
|
|
674
|
+
<div class="text-color-gray">
|
|
675
|
+
<span class="text-color-darker">Origin:</span> Frankfurt, DE
|
|
676
|
+
</div>
|
|
677
|
+
<div class="text-color-gray">
|
|
678
|
+
<span class="text-color-darker">Destination:</span> Warsaw, PL
|
|
679
|
+
</div>
|
|
680
|
+
</div>
|
|
681
|
+
</div>
|
|
682
|
+
</li>
|
|
683
|
+
<li class="list-group-item">
|
|
684
|
+
<div class="display-flex align-items-center gap-15">
|
|
685
|
+
<div class="height-50 width-50 bg-lightest rounded-circle display-grid place-items-center">
|
|
686
|
+
<div class="text-size-14 text-color-darkest">
|
|
687
|
+
<span class="rioglyph rioglyph-order text-size-h2">
|
|
688
|
+
</span>
|
|
689
|
+
</div>
|
|
690
|
+
</div>
|
|
691
|
+
<div class="flex-1-1 margin-bottom-5">
|
|
692
|
+
<div class="display-flex flex-wrap justify-content-between align-items-center gap-10">
|
|
693
|
+
<div class="text-medium">RIO-101002</div>
|
|
694
|
+
<span class="label label-muted label-filled">Delayed</span>
|
|
695
|
+
</div>
|
|
696
|
+
<div class="text-color-gray">
|
|
697
|
+
<span class="text-color-darker">Origin:</span> Dresden, DE
|
|
698
|
+
</div>
|
|
699
|
+
<div class="text-color-gray">
|
|
700
|
+
<span class="text-color-darker">Destination:</span> Copenhagen, DK
|
|
701
|
+
</div>
|
|
702
|
+
</div>
|
|
703
|
+
</div>
|
|
704
|
+
</li>
|
|
705
|
+
</ul>
|
|
706
|
+
</div>
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
#### Props: useSearchHighlight
|
|
710
|
+
|
|
711
|
+
### useSearchHighlight
|
|
712
|
+
|
|
713
|
+
| Name | Type | Default | Description |
|
|
714
|
+
| --- | --- | --- | --- |
|
|
715
|
+
| ref | React.RefObject<HTMLElement> | — | Ref to the element whose text content should be searched. |
|
|
716
|
+
| query | string | — | Search query used for highlighting. |
|
|
717
|
+
| highlightClassName | string | 'search-result-highlight' | Name of the CSS highlight. |
|
|
718
|
+
| scopeSelector | string | — | Optional selector to limit the search scope (e.g. '.ListMenuGroup' or '.OptionLabel'). |
|
|
719
|
+
| caseSensitive | boolean | false | Whether to perform a case-sensitive match. |
|
|
720
|
+
| deps | unknown[] | — | Optional dependencies that should trigger re-collecting and applying ranges. Useful when the DOM changes after the query changes (e.g. debounced filtering). |
|
|
721
|
+
|
|
722
|
+
#### Props: SearchHighlightText
|
|
723
|
+
|
|
724
|
+
### SearchHighlightText
|
|
725
|
+
|
|
726
|
+
| Name | Type | Default | Description |
|
|
727
|
+
| --- | --- | --- | --- |
|
|
728
|
+
| text | string | — | Full text content to render and highlight. |
|
|
729
|
+
| query | string | — | Search query used to highlight matches within the text. |
|
|
730
|
+
| caseSensitive | boolean | false | Whether to perform a case-sensitive match. |
|
|
731
|
+
| highlightClassName | string | 'search-result-highlight' | Optional CSS highlight class name (used by the Highlight API). |
|
|
732
|
+
| classNames | string | — | Optional additional classes applied to the wrapper element. |
|
|
733
|
+
|
|
734
|
+
## SearchHighlightText
|
|
735
|
+
|
|
736
|
+
### Example: Example 3
|
|
737
|
+
|
|
738
|
+
Highlight in textShipment RIO-100284 departed Hamburg, DE and is scheduled to arrive in Rotterdam, NL. The next leg routes through Cologne, DE with customs clearance pending. Contact the logistics desk for status updates or delays.
|
|
739
|
+
|
|
740
|
+
#### Summary
|
|
741
|
+
|
|
742
|
+
Highlight in textShipment RIO-100284 departed Hamburg, DE and is scheduled to arrive in Rotterdam, NL. The next leg routes through Cologne, DE with customs clearance pending. Contact the logistics desk for status updates or delays.
|
|
743
|
+
|
|
744
|
+
#### React (tsx)
|
|
745
|
+
|
|
746
|
+
```tsx
|
|
747
|
+
import { useState } from 'react';
|
|
748
|
+
|
|
749
|
+
import SearchHighlightText from '@rio-cloud/rio-uikit/SearchHighlightText';
|
|
750
|
+
|
|
751
|
+
const logisticsText =
|
|
752
|
+
'Shipment RIO-100284 departed Hamburg, DE and is scheduled to arrive in Rotterdam, NL. ' +
|
|
753
|
+
'The next leg routes through Cologne, DE with customs clearance pending. ' +
|
|
754
|
+
'Contact the logistics desk for status updates or delays.';
|
|
755
|
+
|
|
756
|
+
export default () => {
|
|
757
|
+
const [searchValue, setSearchValue] = useState('');
|
|
758
|
+
|
|
759
|
+
return (
|
|
760
|
+
<div className='padding-15 max-width-800'>
|
|
761
|
+
<label className='text-medium margin-bottom-5' htmlFor='highlight-search'>
|
|
762
|
+
Highlight in text
|
|
763
|
+
</label>
|
|
764
|
+
<input
|
|
765
|
+
id='highlight-search'
|
|
766
|
+
className='form-control margin-bottom-15'
|
|
767
|
+
value={searchValue}
|
|
768
|
+
onChange={event => setSearchValue(event.target.value)}
|
|
769
|
+
placeholder='Search text'
|
|
770
|
+
/>
|
|
771
|
+
|
|
772
|
+
<div className='panel panel-default panel-body margin-bottom-0'>
|
|
773
|
+
<SearchHighlightText text={logisticsText} query={searchValue} />
|
|
774
|
+
</div>
|
|
775
|
+
</div>
|
|
776
|
+
);
|
|
777
|
+
};
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
#### HTML (html)
|
|
781
|
+
|
|
782
|
+
```html
|
|
783
|
+
<div class="padding-15 max-width-800">
|
|
784
|
+
<label class="text-medium margin-bottom-5" for="highlight-search">Highlight in text</label>
|
|
785
|
+
<input id="highlight-search" class="form-control margin-bottom-15" placeholder="Search text" value="">
|
|
786
|
+
<div class="panel panel-default panel-body margin-bottom-0">
|
|
787
|
+
<span class="">Shipment RIO-100284 departed Hamburg, DE and is scheduled to arrive in Rotterdam, NL. The next leg routes through Cologne, DE with customs clearance pending. Contact the logistics desk for status updates or delays.</span>
|
|
788
|
+
</div>
|
|
789
|
+
</div>
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
#### Props: useSearchHighlight
|
|
793
|
+
|
|
794
|
+
### useSearchHighlight
|
|
795
|
+
|
|
796
|
+
| Name | Type | Default | Description |
|
|
797
|
+
| --- | --- | --- | --- |
|
|
798
|
+
| ref | React.RefObject<HTMLElement> | — | Ref to the element whose text content should be searched. |
|
|
799
|
+
| query | string | — | Search query used for highlighting. |
|
|
800
|
+
| highlightClassName | string | 'search-result-highlight' | Name of the CSS highlight. |
|
|
801
|
+
| scopeSelector | string | — | Optional selector to limit the search scope (e.g. '.ListMenuGroup' or '.OptionLabel'). |
|
|
802
|
+
| caseSensitive | boolean | false | Whether to perform a case-sensitive match. |
|
|
803
|
+
| deps | unknown[] | — | Optional dependencies that should trigger re-collecting and applying ranges. Useful when the DOM changes after the query changes (e.g. debounced filtering). |
|
|
804
|
+
|
|
805
|
+
#### Props: SearchHighlightText
|
|
806
|
+
|
|
807
|
+
### SearchHighlightText
|
|
808
|
+
|
|
809
|
+
| Name | Type | Default | Description |
|
|
810
|
+
| --- | --- | --- | --- |
|
|
811
|
+
| text | string | — | Full text content to render and highlight. |
|
|
812
|
+
| query | string | — | Search query used to highlight matches within the text. |
|
|
813
|
+
| caseSensitive | boolean | false | Whether to perform a case-sensitive match. |
|
|
814
|
+
| highlightClassName | string | 'search-result-highlight' | Optional CSS highlight class name (used by the Highlight API). |
|
|
815
|
+
| classNames | string | — | Optional additional classes applied to the wrapper element. |
|