@rio-cloud/uikit-mcp 1.1.4 → 1.1.6
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/README.md +1 -0
- package/dist/doc-metadata.json +188 -88
- package/dist/docs/components/accentBar.md +35 -3
- package/dist/docs/components/activity.md +14 -3
- package/dist/docs/components/animatedNumber.md +17 -4
- package/dist/docs/components/animatedTextReveal.md +54 -8
- package/dist/docs/components/animations.md +33 -33
- package/dist/docs/components/appHeader.md +65 -9
- package/dist/docs/components/appLayout.md +566 -61
- package/dist/docs/components/appNavigationBar.md +55 -3
- package/dist/docs/components/areaCharts.md +14 -14
- package/dist/docs/components/aspectRatioPlaceholder.md +11 -3
- package/dist/docs/components/assetTree.md +1174 -328
- package/dist/docs/components/autosuggests.md +2 -2
- package/dist/docs/components/avatar.md +25 -3
- package/dist/docs/components/banner.md +3 -3
- package/dist/docs/components/barCharts.md +38 -38
- package/dist/docs/components/barList.md +22 -10
- package/dist/docs/components/basicMap.md +2 -2
- package/dist/docs/components/bottomSheet.md +100 -3
- package/dist/docs/components/button.md +549 -36
- package/dist/docs/components/buttonToolbar.md +10 -3
- package/dist/docs/components/calendarStripe.md +127 -85
- package/dist/docs/components/card.md +11 -3
- 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 +67 -45
- package/dist/docs/components/circularProgress.md +465 -0
- package/dist/docs/components/clearableInput.md +18 -18
- package/dist/docs/components/collapse.md +28 -4
- package/dist/docs/components/composedCharts.md +20 -20
- package/dist/docs/components/contentLoader.md +126 -105
- package/dist/docs/components/dataTabs.md +191 -11
- package/dist/docs/components/datepickers.md +735 -723
- package/dist/docs/components/dialogs.md +362 -2
- package/dist/docs/components/divider.md +15 -3
- package/dist/docs/components/dropdowns.md +4548 -4355
- package/dist/docs/components/editableContent.md +187 -3
- package/dist/docs/components/expander.md +52 -5
- package/dist/docs/components/fade.md +42 -7
- package/dist/docs/components/fadeExpander.md +13 -4
- package/dist/docs/components/fadeUp.md +22 -4
- package/dist/docs/components/feedback.md +44 -3
- package/dist/docs/components/filePickers.md +45 -3
- package/dist/docs/components/formLabel.md +20 -5
- package/dist/docs/components/groupedItemList.md +54 -3
- package/dist/docs/components/iconList.md +5 -5
- package/dist/docs/components/imagePreloader.md +7 -3
- package/dist/docs/components/labeledElement.md +13 -3
- package/dist/docs/components/licensePlate.md +11 -3
- package/dist/docs/components/lineCharts.md +10 -10
- package/dist/docs/components/listMenu.md +78 -8
- package/dist/docs/components/loadMore.md +29 -3
- 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 +23 -3
- package/dist/docs/components/notifications.md +2 -2
- package/dist/docs/components/numbercontrol.md +54 -5
- package/dist/docs/components/onboarding.md +26 -2
- package/dist/docs/components/page.md +33 -3
- package/dist/docs/components/pager.md +15 -3
- package/dist/docs/components/pieCharts.md +89 -78
- package/dist/docs/components/popover.md +40 -2
- package/dist/docs/components/position.md +11 -3
- package/dist/docs/components/radialBarCharts.md +2054 -2012
- package/dist/docs/components/radioCardGroup.md +487 -0
- package/dist/docs/components/radiobutton.md +138 -10
- package/dist/docs/components/releaseNotes.md +19 -2
- package/dist/docs/components/resizer.md +14 -3
- package/dist/docs/components/responsiveColumnStripe.md +20 -3
- package/dist/docs/components/responsiveVideo.md +12 -3
- package/dist/docs/components/rioglyph.md +13 -3
- package/dist/docs/components/rules.md +95 -5
- package/dist/docs/components/saveableInput.md +400 -276
- package/dist/docs/components/selects.md +2 -2
- package/dist/docs/components/sidebar.md +39 -3
- package/dist/docs/components/sliders.md +38 -3
- package/dist/docs/components/smoothScrollbars.md +93 -3
- package/dist/docs/components/spinners.md +51 -3
- package/dist/docs/components/states.md +217 -2
- package/dist/docs/components/statsWidgets.md +123 -3
- package/dist/docs/components/statusBar.md +29 -3
- package/dist/docs/components/stepButton.md +9 -3
- package/dist/docs/components/steppedProgressBars.md +67 -3
- package/dist/docs/components/subNavigation.md +24 -17
- package/dist/docs/components/supportMarker.md +2 -2
- package/dist/docs/components/svgImage.md +13 -3
- package/dist/docs/components/switch.md +218 -82
- package/dist/docs/components/tables.md +2 -2
- package/dist/docs/components/tagManager.md +56 -2
- package/dist/docs/components/tags.md +33 -3
- package/dist/docs/components/teaser.md +30 -3
- package/dist/docs/components/textTruncateMiddle.md +151 -0
- package/dist/docs/components/timeline.md +2 -2
- package/dist/docs/components/timepicker.md +687 -63
- package/dist/docs/components/toggleButton.md +96 -10
- package/dist/docs/components/tooltip.md +30 -21
- package/dist/docs/components/tracker.md +631 -0
- package/dist/docs/components/virtualList.md +107 -84
- package/dist/docs/foundations.md +647 -275
- package/dist/docs/start/changelog.md +2 -738
- 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 +2 -2
- 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 +18 -18
- 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 +53 -53
- 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 +8 -8
- package/dist/version.json +2 -2
- package/package.json +9 -9
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
# useUrlState
|
|
2
|
+
|
|
3
|
+
*Category:* Utilities
|
|
4
|
+
*Section:* UI state & input hooks
|
|
5
|
+
*Source:* https://uikit.developers.rio.cloud/#/utilities/useUrlState
|
|
6
|
+
*Captured:* 2026-02-23T13:49:01.022Z
|
|
7
|
+
|
|
8
|
+
The useUrlState hook keeps store state and URL search params in sync. Define a config once and use the hook to read URL state into the store and write store changes back to the URL.
|
|
9
|
+
|
|
10
|
+
## useUrlState
|
|
11
|
+
|
|
12
|
+
This example uses React Router (useLocation, useNavigate, useNavigationType), but the hook also works without it.
|
|
13
|
+
|
|
14
|
+
In this demo, useReducer is used as a lightweight stand-in for a Redux store.
|
|
15
|
+
|
|
16
|
+
Prefer a single useUrlState instance as the writer and share its state via props or context. Multiple components writing independently can overwrite each other’s URL updates.
|
|
17
|
+
|
|
18
|
+
Each UrlConfigItem requires an explicit defaultValue so removed URL params can reliably reset state.
|
|
19
|
+
|
|
20
|
+
History behavior: history: 'push' always creates a new entry. history: 'replace' replaces updates, but still pushes once when a value changes from default to non-default, so users can navigate back to the pre-edit state.
|
|
21
|
+
|
|
22
|
+
> Further information For guidance on what should live in URLs, see the State in URL guideline. For route-specific parsing examples, visit the Route utils page.
|
|
23
|
+
|
|
24
|
+
### Example: Tags (picklist)
|
|
25
|
+
|
|
26
|
+
URL
|
|
27
|
+
Search query
|
|
28
|
+
|
|
29
|
+
View modelistgrid
|
|
30
|
+
Amount (default: 1)
|
|
31
|
+
Tags (picklist)
|
|
32
|
+
Banana
|
|
33
|
+
Peach
|
|
34
|
+
Pear
|
|
35
|
+
Strawberry
|
|
36
|
+
|
|
37
|
+
Show archived
|
|
38
|
+
(default: "false" - will be omitted from the URL)
|
|
39
|
+
Current URL state (stored in my-service/#)
|
|
40
|
+
{
|
|
41
|
+
"query": "",
|
|
42
|
+
"view": "list",
|
|
43
|
+
"amount": 1,
|
|
44
|
+
"tags": [],
|
|
45
|
+
"showArchived": false
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#### Summary
|
|
49
|
+
|
|
50
|
+
URL
|
|
51
|
+
Search query
|
|
52
|
+
|
|
53
|
+
View modelistgrid
|
|
54
|
+
Amount (default: 1)
|
|
55
|
+
Tags (picklist)
|
|
56
|
+
Banana
|
|
57
|
+
Peach
|
|
58
|
+
Pear
|
|
59
|
+
Strawberry
|
|
60
|
+
|
|
61
|
+
Show archived
|
|
62
|
+
(default: "false" - will be omitted from the URL)
|
|
63
|
+
Current URL state (stored in my-service/#)
|
|
64
|
+
{
|
|
65
|
+
"query": "",
|
|
66
|
+
"view": "list",
|
|
67
|
+
"amount": 1,
|
|
68
|
+
"tags": [],
|
|
69
|
+
"showArchived": false
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
#### React (tsx)
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
import { useMemo, useReducer } from 'react';
|
|
76
|
+
import { useLocation, useNavigate, useNavigationType } from 'react-router-dom';
|
|
77
|
+
|
|
78
|
+
import useUrlState from '@rio-cloud/rio-uikit/useUrlState';
|
|
79
|
+
import LabeledElement from '@rio-cloud/rio-uikit/LabeledElement';
|
|
80
|
+
import Card from '@rio-cloud/rio-uikit/Card';
|
|
81
|
+
import Checkbox from '@rio-cloud/rio-uikit/Checkbox';
|
|
82
|
+
import ClearableInput from '@rio-cloud/rio-uikit/ClearableInput';
|
|
83
|
+
import type { UrlConfigItem } from '@rio-cloud/rio-uikit/routeUtils';
|
|
84
|
+
|
|
85
|
+
const BASE_PATH = 'my-service/#';
|
|
86
|
+
|
|
87
|
+
const VIEW_OPTIONS = ['list', 'grid'] as const;
|
|
88
|
+
|
|
89
|
+
type ViewType = (typeof VIEW_OPTIONS)[number];
|
|
90
|
+
const DEFAULT_VIEW: ViewType = 'list';
|
|
91
|
+
const DEFAULT_AMOUNT = 1;
|
|
92
|
+
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
// State handling
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
type DemoState = {
|
|
97
|
+
query: string;
|
|
98
|
+
view: ViewType;
|
|
99
|
+
amount: number;
|
|
100
|
+
tags: string[];
|
|
101
|
+
showArchived: boolean;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const initialState: DemoState = {
|
|
105
|
+
query: '',
|
|
106
|
+
view: DEFAULT_VIEW,
|
|
107
|
+
amount: DEFAULT_AMOUNT,
|
|
108
|
+
tags: [],
|
|
109
|
+
showArchived: false,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const actions = {
|
|
113
|
+
setQuery: (value: string) => ({ type: 'setQuery' as const, payload: value }),
|
|
114
|
+
setView: (value: ViewType) => ({ type: 'setView' as const, payload: value }),
|
|
115
|
+
setAmount: (value: number) => ({ type: 'setAmount' as const, payload: value }),
|
|
116
|
+
setTags: (value: string[]) => ({ type: 'setTags' as const, payload: value }),
|
|
117
|
+
setShowArchived: (value: boolean) => ({ type: 'setShowArchived' as const, payload: value }),
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
type DemoAction = ReturnType<(typeof actions)[keyof typeof actions]>;
|
|
121
|
+
type DemoConfigItem =
|
|
122
|
+
| UrlConfigItem<DemoState, string>
|
|
123
|
+
| UrlConfigItem<DemoState, ViewType>
|
|
124
|
+
| UrlConfigItem<DemoState, number>
|
|
125
|
+
| UrlConfigItem<DemoState, string[]>
|
|
126
|
+
| UrlConfigItem<DemoState, boolean>;
|
|
127
|
+
|
|
128
|
+
const reducer = (state: DemoState, action: DemoAction): DemoState => {
|
|
129
|
+
switch (action.type) {
|
|
130
|
+
case 'setQuery':
|
|
131
|
+
return { ...state, query: action.payload };
|
|
132
|
+
case 'setView':
|
|
133
|
+
return { ...state, view: action.payload };
|
|
134
|
+
case 'setAmount':
|
|
135
|
+
return { ...state, amount: action.payload };
|
|
136
|
+
case 'setTags':
|
|
137
|
+
return { ...state, tags: action.payload };
|
|
138
|
+
case 'setShowArchived':
|
|
139
|
+
return { ...state, showArchived: action.payload };
|
|
140
|
+
default:
|
|
141
|
+
return state;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
// URL configuration & demo
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
|
|
149
|
+
const config: DemoConfigItem[] = [
|
|
150
|
+
{ key: 'q', selector: state => state.query, action: actions.setQuery, defaultValue: '', history: 'replace' },
|
|
151
|
+
{ key: 'view', selector: state => state.view, action: actions.setView, defaultValue: DEFAULT_VIEW },
|
|
152
|
+
{
|
|
153
|
+
key: 'amount',
|
|
154
|
+
selector: state => state.amount,
|
|
155
|
+
action: actions.setAmount,
|
|
156
|
+
type: 'number',
|
|
157
|
+
defaultValue: DEFAULT_AMOUNT,
|
|
158
|
+
},
|
|
159
|
+
{ key: 'tags', selector: state => state.tags, action: actions.setTags, type: 'array', defaultValue: [] },
|
|
160
|
+
{
|
|
161
|
+
key: 'archived',
|
|
162
|
+
selector: state => state.showArchived,
|
|
163
|
+
action: actions.setShowArchived,
|
|
164
|
+
type: 'boolean',
|
|
165
|
+
defaultValue: false,
|
|
166
|
+
},
|
|
167
|
+
];
|
|
168
|
+
|
|
169
|
+
export const UrlStateDemo = () => {
|
|
170
|
+
const [urlState, dispatch] = useReducer(reducer, initialState);
|
|
171
|
+
|
|
172
|
+
const location = useLocation();
|
|
173
|
+
const navigate = useNavigate();
|
|
174
|
+
const navigationType = useNavigationType();
|
|
175
|
+
|
|
176
|
+
// Example of how to get the values from the redux store (in this demo it's just React)
|
|
177
|
+
const reduxValues = useMemo(
|
|
178
|
+
() =>
|
|
179
|
+
config.reduce<Record<string, unknown>>((acc, item) => {
|
|
180
|
+
acc[item.key] = item.selector(urlState);
|
|
181
|
+
return acc;
|
|
182
|
+
}, {}),
|
|
183
|
+
[urlState]
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
// The actual hook for managing the URL state and the callbacks to react on URL changes
|
|
187
|
+
useUrlState({
|
|
188
|
+
config,
|
|
189
|
+
searchString: location.search,
|
|
190
|
+
storeValues: reduxValues,
|
|
191
|
+
navigationType,
|
|
192
|
+
onUpdateStore: action => dispatch(action as DemoAction),
|
|
193
|
+
onNavigate: (search, mode) => navigate({ search }, { replace: mode === 'replace' }),
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
const urlValue = `${BASE_PATH}/${location.search || ''}`;
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<div className='padding-15 max-width-800'>
|
|
200
|
+
<LabeledElement label='URL' htmlFor='url-state-url' className='margin-bottom-15'>
|
|
201
|
+
<input id='url-state-url' className='form-control' value={urlValue} readOnly />
|
|
202
|
+
</LabeledElement>
|
|
203
|
+
|
|
204
|
+
<div className='display-grid grid-cols-1 grid-cols-2-md gap-25'>
|
|
205
|
+
<Card>
|
|
206
|
+
<LabeledElement label='Search query' htmlFor='url-state-query' className='margin-bottom-15'>
|
|
207
|
+
<ClearableInput
|
|
208
|
+
id='url-state-query'
|
|
209
|
+
value={urlState.query}
|
|
210
|
+
onChange={(newValue: string) => dispatch(actions.setQuery(newValue))}
|
|
211
|
+
onClear={() => dispatch(actions.setQuery(''))}
|
|
212
|
+
placeholder='Enter search value'
|
|
213
|
+
/>
|
|
214
|
+
</LabeledElement>
|
|
215
|
+
|
|
216
|
+
<LabeledElement label='View mode' htmlFor='url-state-view' className='margin-bottom-15'>
|
|
217
|
+
<select
|
|
218
|
+
id='url-state-view'
|
|
219
|
+
className='form-control'
|
|
220
|
+
value={urlState.view}
|
|
221
|
+
onChange={event => dispatch(actions.setView(event.target.value as ViewType))}
|
|
222
|
+
>
|
|
223
|
+
{VIEW_OPTIONS.map(option => (
|
|
224
|
+
<option key={option} value={option}>
|
|
225
|
+
{option}
|
|
226
|
+
</option>
|
|
227
|
+
))}
|
|
228
|
+
</select>
|
|
229
|
+
</LabeledElement>
|
|
230
|
+
|
|
231
|
+
<LabeledElement label='Amount (default: 1)' htmlFor='url-state-amount' className='margin-bottom-15'>
|
|
232
|
+
<input
|
|
233
|
+
id='url-state-amount'
|
|
234
|
+
className='form-control'
|
|
235
|
+
type='number'
|
|
236
|
+
min='1'
|
|
237
|
+
value={urlState.amount}
|
|
238
|
+
onChange={event => {
|
|
239
|
+
const nextAmount = Number.parseInt(event.target.value, 10);
|
|
240
|
+
dispatch(actions.setAmount(Number.isFinite(nextAmount) ? nextAmount : DEFAULT_AMOUNT));
|
|
241
|
+
}}
|
|
242
|
+
/>
|
|
243
|
+
</LabeledElement>
|
|
244
|
+
|
|
245
|
+
<LabeledElement label='Tags (picklist)' className='margin-bottom-15'>
|
|
246
|
+
<TagPicklist value={urlState.tags} onChange={tags => dispatch(actions.setTags(tags))} />
|
|
247
|
+
</LabeledElement>
|
|
248
|
+
|
|
249
|
+
<Checkbox
|
|
250
|
+
checked={urlState.showArchived}
|
|
251
|
+
onChange={event => dispatch(actions.setShowArchived(event.target.checked))}
|
|
252
|
+
>
|
|
253
|
+
Show archived <br />
|
|
254
|
+
(default: "false" - will be omitted from the URL)
|
|
255
|
+
</Checkbox>
|
|
256
|
+
</Card>
|
|
257
|
+
<Card className='margin-bottom-0'>
|
|
258
|
+
<LabeledElement label={`Current URL state (stored in ${BASE_PATH})`}>
|
|
259
|
+
<pre className='text-size-12'>{JSON.stringify(urlState, null, 2)}</pre>
|
|
260
|
+
</LabeledElement>
|
|
261
|
+
</Card>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
);
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
// ---------------------------------------------------------------------------
|
|
268
|
+
// Demo components
|
|
269
|
+
// ---------------------------------------------------------------------------
|
|
270
|
+
|
|
271
|
+
const TAG_OPTIONS = [
|
|
272
|
+
{ value: 'banana', label: 'Banana' },
|
|
273
|
+
{ value: 'peach', label: 'Peach' },
|
|
274
|
+
{ value: 'pear', label: 'Pear' },
|
|
275
|
+
{ value: 'strawberry', label: 'Strawberry' },
|
|
276
|
+
] as const;
|
|
277
|
+
|
|
278
|
+
type TagPicklistProps = {
|
|
279
|
+
value: string[];
|
|
280
|
+
onChange: (nextValue: string[]) => void;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const getPicklistCheckboxClasses = (isSelected: boolean) =>
|
|
284
|
+
`padding-x-15 padding-y-5 user-select-none rounded shadow-accent bg-white ${
|
|
285
|
+
isSelected
|
|
286
|
+
? 'border-color-highlight bg-highlight text-color-white'
|
|
287
|
+
: 'hover-bg-highlight-decent text-color-darker'
|
|
288
|
+
}`;
|
|
289
|
+
|
|
290
|
+
const TagPicklist = ({ value, onChange }: TagPicklistProps) => {
|
|
291
|
+
const handleSelect = (selectedValue: string) => {
|
|
292
|
+
const selected = new Set(value);
|
|
293
|
+
if (selected.has(selectedValue)) {
|
|
294
|
+
selected.delete(selectedValue);
|
|
295
|
+
} else {
|
|
296
|
+
selected.add(selectedValue);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const nextTags = TAG_OPTIONS.filter(option => selected.has(option.value)).map(option => option.value);
|
|
300
|
+
onChange(nextTags);
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
return (
|
|
304
|
+
<div className='display-flex gap-5 flex-wrap'>
|
|
305
|
+
{TAG_OPTIONS.map(option => (
|
|
306
|
+
<Checkbox
|
|
307
|
+
key={option.value}
|
|
308
|
+
onChange={() => handleSelect(option.value)}
|
|
309
|
+
checked={value.includes(option.value)}
|
|
310
|
+
custom
|
|
311
|
+
className={getPicklistCheckboxClasses(value.includes(option.value))}
|
|
312
|
+
>
|
|
313
|
+
<div className='checkbox-text-wrapper'>{option.label}</div>
|
|
314
|
+
</Checkbox>
|
|
315
|
+
))}
|
|
316
|
+
</div>
|
|
317
|
+
);
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
export default UrlStateDemo;
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
#### HTML (html)
|
|
324
|
+
|
|
325
|
+
```html
|
|
326
|
+
<div class="padding-15 max-width-800">
|
|
327
|
+
<div class="LabeledElement display-flex flex-column margin-bottom-15">
|
|
328
|
+
<label for="url-state-url" class="display-inline-block">
|
|
329
|
+
<span>URL</span>
|
|
330
|
+
</label>
|
|
331
|
+
<input id="url-state-url" class="form-control" readonly="" value="my-service/#/">
|
|
332
|
+
</div>
|
|
333
|
+
<div class="display-grid grid-cols-1 grid-cols-2-md gap-25">
|
|
334
|
+
<div class="bg-white rounded border shadow-default padding-15">
|
|
335
|
+
<div class="LabeledElement display-flex flex-column margin-bottom-15">
|
|
336
|
+
<label for="url-state-query" class="display-inline-block">
|
|
337
|
+
<span>Search query</span>
|
|
338
|
+
</label>
|
|
339
|
+
<div class="ClearableInput input-group">
|
|
340
|
+
<input id="url-state-query" placeholder="Enter search value" class="form-control" type="text" tabindex="0" value="">
|
|
341
|
+
<span class="clearButton hide">
|
|
342
|
+
<span class="clearButtonIcon rioglyph rioglyph-remove-sign">
|
|
343
|
+
</span>
|
|
344
|
+
</span>
|
|
345
|
+
</div>
|
|
346
|
+
</div>
|
|
347
|
+
<div class="LabeledElement display-flex flex-column margin-bottom-15">
|
|
348
|
+
<label for="url-state-view" class="display-inline-block">
|
|
349
|
+
<span>View mode</span>
|
|
350
|
+
</label>
|
|
351
|
+
<select id="url-state-view" class="form-control">
|
|
352
|
+
<option value="list">list</option>
|
|
353
|
+
<option value="grid">grid</option>
|
|
354
|
+
</select>
|
|
355
|
+
</div>
|
|
356
|
+
<div class="LabeledElement display-flex flex-column margin-bottom-15">
|
|
357
|
+
<label for="url-state-amount" class="display-inline-block">
|
|
358
|
+
<span>Amount (default: 1)</span>
|
|
359
|
+
</label>
|
|
360
|
+
<input id="url-state-amount" class="form-control" type="number" min="1" value="1">
|
|
361
|
+
</div>
|
|
362
|
+
<div class="LabeledElement display-flex flex-column margin-bottom-15">
|
|
363
|
+
<div class="text-color-dark max-width-100pct text-size-12 display-inline-block margin-bottom-5">Tags (picklist)</div>
|
|
364
|
+
<div class="display-flex gap-5 flex-wrap">
|
|
365
|
+
<label class="checkbox padding-x-15 padding-y-5 user-select-none rounded shadow-accent bg-white hover-bg-highlight-decent text-color-darker" tabindex="0">
|
|
366
|
+
<input type="checkbox" class="padding-x-15 padding-y-5 user-select-none rounded shadow-accent bg-white hover-bg-highlight-decent text-color-darker">
|
|
367
|
+
<div class="checkbox-text-wrapper">Banana</div>
|
|
368
|
+
</label>
|
|
369
|
+
<label class="checkbox padding-x-15 padding-y-5 user-select-none rounded shadow-accent bg-white hover-bg-highlight-decent text-color-darker" tabindex="0">
|
|
370
|
+
<input type="checkbox" class="padding-x-15 padding-y-5 user-select-none rounded shadow-accent bg-white hover-bg-highlight-decent text-color-darker">
|
|
371
|
+
<div class="checkbox-text-wrapper">Peach</div>
|
|
372
|
+
</label>
|
|
373
|
+
<label class="checkbox padding-x-15 padding-y-5 user-select-none rounded shadow-accent bg-white hover-bg-highlight-decent text-color-darker" tabindex="0">
|
|
374
|
+
<input type="checkbox" class="padding-x-15 padding-y-5 user-select-none rounded shadow-accent bg-white hover-bg-highlight-decent text-color-darker">
|
|
375
|
+
<div class="checkbox-text-wrapper">Pear</div>
|
|
376
|
+
</label>
|
|
377
|
+
<label class="checkbox padding-x-15 padding-y-5 user-select-none rounded shadow-accent bg-white hover-bg-highlight-decent text-color-darker" tabindex="0">
|
|
378
|
+
<input type="checkbox" class="padding-x-15 padding-y-5 user-select-none rounded shadow-accent bg-white hover-bg-highlight-decent text-color-darker">
|
|
379
|
+
<div class="checkbox-text-wrapper">Strawberry</div>
|
|
380
|
+
</label>
|
|
381
|
+
</div>
|
|
382
|
+
</div>
|
|
383
|
+
<label class="checkbox" tabindex="0">
|
|
384
|
+
<input type="checkbox" class="">
|
|
385
|
+
<span class="checkbox-text">
|
|
386
|
+
<span>Show archived <br>(default: "false" - will be omitted from the URL)</span>
|
|
387
|
+
</span>
|
|
388
|
+
</label>
|
|
389
|
+
</div>
|
|
390
|
+
<div class="bg-white rounded border shadow-default padding-15 margin-bottom-0">
|
|
391
|
+
<div class="LabeledElement display-flex flex-column">
|
|
392
|
+
<div class="text-color-dark max-width-100pct text-size-12 display-inline-block margin-bottom-5">Current URL state (stored in my-service/#)</div>
|
|
393
|
+
<pre class="text-size-12">{
|
|
394
|
+
"query": "",
|
|
395
|
+
"view": "list",
|
|
396
|
+
"amount": 1,
|
|
397
|
+
"tags": [],
|
|
398
|
+
"showArchived": false
|
|
399
|
+
}</pre>
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
</div>
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
#### Props: useUrlState
|
|
407
|
+
|
|
408
|
+
### useUrlState
|
|
409
|
+
|
|
410
|
+
| Name | Type | Default | Description |
|
|
411
|
+
| --- | --- | --- | --- |
|
|
412
|
+
| config | readonly UrlConfigItem<TState, any>[] | — | URL sync configuration. Each entry maps one query param key to a store selector and update action. |
|
|
413
|
+
| searchString | QueryString | — | Current URL search string (for example location.search). Expected shape: '?q=test&sort=-name' or ''. |
|
|
414
|
+
| storeValues | Record<string, unknown> | — | Current store values used by the configured selectors. This could be values from a redux store. Keys should match the config keys, values are compared against URL/defaults. |
|
|
415
|
+
| localStorageKey | string | — | Optional localStorage key for sticky URL state restore on initial load when managed URL params are missing. |
|
|
416
|
+
| navigationType | 'POP' \| 'PUSH' \| 'REPLACE' \| string | — | Router navigation type (typically from React Router useNavigationType). POP indicates browser back/forward navigation. |
|
|
417
|
+
| onUpdateStore | (action: any) => void | — | Store update callback invoked when URL -> store sync detects a change. Usually wraps dispatch(...). |
|
|
418
|
+
| onNavigate | (search: string, historyMode: 'push' \| 'replace') => void | — | Navigation callback used for store -> URL sync writes. historyMode controls whether to push or replace the history entry. |
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* DOM behavior hooks
|
|
5
|
-
*Source:* https://uikit.developers.rio.cloud
|
|
6
|
-
*Captured:* 2026-
|
|
5
|
+
*Source:* https://uikit.developers.rio.cloud/#/utilities/useWindowResize
|
|
6
|
+
*Captured:* 2026-02-23T13:48:55.527Z
|
|
7
7
|
|
|
8
8
|
The useWindowResize hook allows to react on window size changes.
|
|
9
9
|
|
package/dist/index.mjs
CHANGED
|
@@ -32,17 +32,17 @@ function readRequiredJson(distRoot, filename) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
function loadCompiledData(distRoot) {
|
|
35
|
-
const metadata
|
|
36
|
-
const synonyms
|
|
37
|
-
let version
|
|
35
|
+
const metadata = readRequiredJson(distRoot, "doc-metadata.json");
|
|
36
|
+
const synonyms = readRequiredJson(distRoot, "search-synonyms.json");
|
|
37
|
+
let version = null;
|
|
38
38
|
const versionPath = path.join(distRoot, "version.json");
|
|
39
39
|
if (existsSync(versionPath)) try {
|
|
40
|
-
version
|
|
40
|
+
version = JSON.parse(readFileSync(versionPath, "utf8"));
|
|
41
41
|
} catch {}
|
|
42
42
|
return {
|
|
43
|
-
metadata
|
|
44
|
-
synonyms
|
|
45
|
-
version
|
|
43
|
+
metadata,
|
|
44
|
+
synonyms,
|
|
45
|
+
version
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
/** Markdown path is computed: docs/${id}.md */
|
|
@@ -119,7 +119,7 @@ function buildSearchIndex(entries) {
|
|
|
119
119
|
|
|
120
120
|
//#endregion
|
|
121
121
|
//#region package.json
|
|
122
|
-
var version = "1.1.
|
|
122
|
+
var version = "1.1.6";
|
|
123
123
|
|
|
124
124
|
//#endregion
|
|
125
125
|
//#region server/index.ts
|
package/dist/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rio-cloud/uikit-mcp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "MCP server that serves the captured RIO UI Kit documentation to Model Context Protocol clients.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"mcp:server": "npm run build:server && node dist/index.mjs"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@modelcontextprotocol/sdk": "
|
|
32
|
-
"flexsearch": "
|
|
33
|
-
"zod": "
|
|
31
|
+
"@modelcontextprotocol/sdk": "1.26.0",
|
|
32
|
+
"flexsearch": "0.8.212",
|
|
33
|
+
"zod": "4.3.6"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "
|
|
37
|
-
"playwright": "
|
|
38
|
-
"tsdown": "
|
|
39
|
-
"tsx": "
|
|
40
|
-
"typescript": "
|
|
36
|
+
"@types/node": "22.19.11",
|
|
37
|
+
"playwright": "1.58.2",
|
|
38
|
+
"tsdown": "0.20.3",
|
|
39
|
+
"tsx": "4.21.0",
|
|
40
|
+
"typescript": "5.9.3"
|
|
41
41
|
}
|
|
42
42
|
}
|