@rio-cloud/uikit-mcp 1.1.9 → 1.1.11
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 +2 -1
- package/dist/doc-metadata.json +334 -94
- package/dist/docs/components/accentBar.md +110 -116
- package/dist/docs/components/activity.md +1 -1
- package/dist/docs/components/analyticsAnalysisOverlay.md +630 -0
- package/dist/docs/components/animatedNumber.md +2 -2
- package/dist/docs/components/animatedTextReveal.md +53 -55
- package/dist/docs/components/animations.md +21 -21
- package/dist/docs/components/appHeader.md +27 -38
- package/dist/docs/components/appLayout.md +23 -77
- package/dist/docs/components/appNavigationBar.md +1 -1
- package/dist/docs/components/areaCharts.md +57 -61
- package/dist/docs/components/aspectRatioPlaceholder.md +1 -1
- package/dist/docs/components/assetTree.md +429 -342
- package/dist/docs/components/autosuggests.md +1 -1
- package/dist/docs/components/avatar.md +1 -1
- package/dist/docs/components/banner.md +2 -2
- package/dist/docs/components/barCharts.md +530 -414
- package/dist/docs/components/barList.md +10 -10
- package/dist/docs/components/basicMap.md +104 -39
- package/dist/docs/components/bottomSheet.md +2 -2
- package/dist/docs/components/button.md +8 -2
- package/dist/docs/components/buttonToolbar.md +1 -1
- package/dist/docs/components/calendarStripe.md +59 -63
- package/dist/docs/components/card.md +1 -1
- package/dist/docs/components/carousel.md +1 -1
- package/dist/docs/components/chartColors.md +1 -1
- package/dist/docs/components/chartsGettingStarted.md +1 -1
- package/dist/docs/components/chat.md +2 -2
- package/dist/docs/components/checkbox.md +15 -10
- package/dist/docs/components/circularProgress.md +6 -6
- package/dist/docs/components/clearableInput.md +1 -1
- package/dist/docs/components/collapse.md +2 -2
- package/dist/docs/components/composedCharts.md +63 -51
- package/dist/docs/components/contentLoader.md +1 -1
- package/dist/docs/components/dataTabs.md +33 -33
- package/dist/docs/components/datepickers.md +693 -685
- package/dist/docs/components/dayPicker.md +5624 -0
- package/dist/docs/components/dayPickerCalendar.md +5289 -0
- package/dist/docs/components/dialogs.md +17 -19
- package/dist/docs/components/divider.md +1 -1
- package/dist/docs/components/dropdowns.md +3264 -3276
- package/dist/docs/components/editableContent.md +91 -91
- package/dist/docs/components/expander.md +4 -1
- package/dist/docs/components/fade.md +1 -1
- package/dist/docs/components/fadeExpander.md +1 -1
- package/dist/docs/components/fadeUp.md +32 -36
- package/dist/docs/components/feedback.md +1 -1
- package/dist/docs/components/filePickers.md +1 -1
- package/dist/docs/components/formLabel.md +29 -31
- package/dist/docs/components/groupedItemList.md +3 -7
- package/dist/docs/components/htmlTable.md +5074 -0
- package/dist/docs/components/iconList.md +4 -4
- package/dist/docs/components/imagePreloader.md +1 -1
- package/dist/docs/components/labeledElement.md +1 -1
- package/dist/docs/components/licensePlate.md +1 -1
- package/dist/docs/components/lineCharts.md +172 -170
- package/dist/docs/components/listMenu.md +15 -12
- package/dist/docs/components/loadMore.md +4 -2
- package/dist/docs/components/mainNavigation.md +1 -1
- package/dist/docs/components/mapCircle.md +10 -1
- package/dist/docs/components/mapCluster.md +25 -1
- package/dist/docs/components/mapContext.md +12 -4
- package/dist/docs/components/mapDraggableMarker.md +12 -1
- package/dist/docs/components/mapGettingStarted.md +39 -1
- package/dist/docs/components/mapInfoBubble.md +129 -2
- package/dist/docs/components/mapLayerGroup.md +10 -1
- package/dist/docs/components/mapMarker.md +10 -1
- package/dist/docs/components/mapPolygon.md +288 -85
- package/dist/docs/components/mapRoute.md +262 -172
- package/dist/docs/components/mapSettings.md +28 -1
- package/dist/docs/components/mapUtils.md +1 -1
- package/dist/docs/components/mapViewportHistory.md +287 -0
- package/dist/docs/components/multiselects.md +217 -18
- package/dist/docs/components/noData.md +1 -1
- package/dist/docs/components/notifications.md +2 -2
- package/dist/docs/components/numbercontrol.md +15 -15
- package/dist/docs/components/onboarding.md +1 -1
- package/dist/docs/components/page.md +1 -1
- package/dist/docs/components/pager.md +1 -1
- package/dist/docs/components/pieCharts.md +237 -211
- package/dist/docs/components/popover.md +1 -1
- package/dist/docs/components/position.md +1 -1
- package/dist/docs/components/radialBarCharts.md +446 -398
- package/dist/docs/components/radioCardGroup.md +1 -1
- package/dist/docs/components/radiobutton.md +98 -98
- package/dist/docs/components/releaseNotes.md +1 -1
- package/dist/docs/components/resizer.md +1 -1
- package/dist/docs/components/responsiveColumnStripe.md +1 -1
- package/dist/docs/components/responsiveVideo.md +1 -1
- package/dist/docs/components/rioglyph.md +1 -1
- package/dist/docs/components/rules.md +41 -47
- package/dist/docs/components/saveableInput.md +252 -252
- package/dist/docs/components/selects.md +332 -161
- package/dist/docs/components/sidebar.md +1 -1
- package/dist/docs/components/sliders.md +1 -1
- package/dist/docs/components/smoothScrollbars.md +19 -13
- package/dist/docs/components/spinners.md +1 -1
- package/dist/docs/components/states.md +15 -1
- package/dist/docs/components/statsWidgets.md +1 -1
- package/dist/docs/components/statusBar.md +3 -1
- package/dist/docs/components/stepButton.md +1 -1
- package/dist/docs/components/steppedProgressBars.md +9 -11
- package/dist/docs/components/subNavigation.md +1 -1
- package/dist/docs/components/supportMarker.md +1 -1
- package/dist/docs/components/svgImage.md +1 -1
- package/dist/docs/components/switch.md +5 -1
- package/dist/docs/components/table.md +21361 -0
- package/dist/docs/components/tableControls.md +982 -0
- package/dist/docs/components/tagManager.md +1 -1
- package/dist/docs/components/tags.md +1 -1
- package/dist/docs/components/teaser.md +1 -1
- package/dist/docs/components/textTruncateMiddle.md +1 -1
- package/dist/docs/components/timeline.md +1 -1
- package/dist/docs/components/timepicker.md +3 -1
- package/dist/docs/components/toggleButton.md +3 -1
- package/dist/docs/components/tooltip.md +8 -2
- package/dist/docs/components/tracker.md +1 -1
- package/dist/docs/components/virtualList.md +60 -60
- package/dist/docs/foundations.md +761 -3077
- package/dist/docs/start/changelog.md +73 -3
- package/dist/docs/start/goodtoknow.md +5 -1
- package/dist/docs/start/guidelines/color-combinations.md +5 -1
- package/dist/docs/start/guidelines/custom-css.md +26 -2
- package/dist/docs/start/guidelines/custom-rioglyph.md +20 -2
- package/dist/docs/start/guidelines/formatting.md +2254 -249
- package/dist/docs/start/guidelines/iframe.md +53 -19
- package/dist/docs/start/guidelines/obfuscate-data.md +24 -2
- package/dist/docs/start/guidelines/print-css.md +16 -2
- package/dist/docs/start/guidelines/spinner.md +1 -1
- package/dist/docs/start/guidelines/state-in-url.md +1138 -11
- package/dist/docs/start/guidelines/supported-browsers.md +9 -2
- package/dist/docs/start/guidelines/writing.md +228 -2
- package/dist/docs/start/howto.md +155 -13
- package/dist/docs/start/intro.md +40 -2
- package/dist/docs/start/responsiveness.md +27 -1
- package/dist/docs/templates/ai-assistant.md +311 -0
- package/dist/docs/templates/common-table.md +814 -0
- package/dist/docs/templates/detail-views.md +846 -0
- package/dist/docs/templates/expandable-details.md +214 -0
- package/dist/docs/templates/feature-cards.md +479 -0
- package/dist/docs/templates/form-summary.md +179 -0
- package/dist/docs/templates/form-toggle.md +329 -0
- package/dist/docs/templates/list-blocks.md +872 -0
- package/dist/docs/templates/loading-progress.md +100 -0
- package/dist/docs/templates/options-panel.md +132 -0
- package/dist/docs/templates/panel-variants.md +137 -0
- package/dist/docs/templates/progress-cards.md +541 -0
- package/dist/docs/templates/progress-success.md +125 -0
- package/dist/docs/templates/settings-form.md +401 -0
- package/dist/docs/templates/stats-blocks.md +1245 -0
- package/dist/docs/templates/table-panel.md +310 -0
- package/dist/docs/templates/usage-cards.md +199 -0
- package/dist/docs/utilities/classNames.md +89 -1
- package/dist/docs/utilities/deviceUtils.md +2 -2
- package/dist/docs/utilities/featureToggles.md +182 -2
- package/dist/docs/utilities/fuelTypeUtils.md +27 -29
- package/dist/docs/utilities/getTrackingAttributes.md +322 -0
- package/dist/docs/utilities/routeUtils.md +211 -3
- package/dist/docs/utilities/useAfterMount.md +1 -1
- package/dist/docs/utilities/useAutoAnimate.md +1 -1
- package/dist/docs/utilities/useAverage.md +1 -1
- package/dist/docs/utilities/useClickOutside.md +1 -1
- package/dist/docs/utilities/useClipboard.md +2 -2
- package/dist/docs/utilities/useCookies.md +1 -1
- package/dist/docs/utilities/useCount.md +1 -1
- package/dist/docs/utilities/useDarkMode.md +5 -4
- package/dist/docs/utilities/useDebugInfo.md +3 -3
- package/dist/docs/utilities/useDraggableElement.md +281 -0
- package/dist/docs/utilities/useEffectOnce.md +1 -1
- package/dist/docs/utilities/useElapsedTime.md +1 -1
- package/dist/docs/utilities/useElementSize.md +1 -1
- package/dist/docs/utilities/useEsc.md +1 -1
- package/dist/docs/utilities/useEvent.md +1 -1
- package/dist/docs/utilities/useFocusTrap.md +1 -1
- package/dist/docs/utilities/useFullscreen.md +1 -1
- package/dist/docs/utilities/useHover.md +1 -1
- package/dist/docs/utilities/useIncomingPostMessages.md +1 -1
- package/dist/docs/utilities/useInterval.md +1 -1
- package/dist/docs/utilities/useIsFocusWithin.md +1 -1
- package/dist/docs/utilities/useKey.md +8 -10
- package/dist/docs/utilities/useLocalStorage.md +1 -1
- package/dist/docs/utilities/useLocationSuggestions.md +1 -1
- package/dist/docs/utilities/useMax.md +1 -1
- package/dist/docs/utilities/useMin.md +1 -1
- package/dist/docs/utilities/useMutationObserver.md +1 -1
- package/dist/docs/utilities/useOnScreen.md +1 -1
- package/dist/docs/utilities/useOnlineStatus.md +1 -1
- package/dist/docs/utilities/usePostMessage.md +2 -2
- package/dist/docs/utilities/usePostMessageSender.md +1 -1
- package/dist/docs/utilities/usePrevious.md +110 -2
- package/dist/docs/utilities/useResizeObserver.md +35 -15
- package/dist/docs/utilities/useRioCookieConsent.md +1 -1
- package/dist/docs/utilities/useScrollPosition.md +3 -6
- package/dist/docs/utilities/useSearch.md +1 -3
- package/dist/docs/utilities/useSearchHighlight.md +1 -1
- package/dist/docs/utilities/useSorting.md +370 -239
- package/dist/docs/utilities/useStateWithValidation.md +1 -1
- package/dist/docs/utilities/useSum.md +1 -1
- package/dist/docs/utilities/useTableExport.md +364 -288
- package/dist/docs/utilities/useTableSelection.md +88 -92
- package/dist/docs/utilities/useTimeout.md +1 -1
- package/dist/docs/utilities/useToggle.md +1 -1
- package/dist/docs/utilities/useUrlState.md +1 -1
- package/dist/docs/utilities/useWindowResize.md +1 -1
- package/dist/index.mjs +173 -69
- package/dist/search-synonyms.json +214 -76
- package/dist/version.json +2 -2
- package/package.json +4 -5
- package/dist/docs/components/mapRouteGenerator.md +0 -6
- package/dist/docs/components/tables.md +0 -8
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* Helper
|
|
5
5
|
*Source:* https://uikit.developers.rio.cloud/#/utilities/routeUtils
|
|
6
|
-
*Captured:* 2026-
|
|
6
|
+
*Captured:* 2026-04-27T14:59:28.978Z
|
|
7
7
|
|
|
8
8
|
Utility helpers for parsing and serializing URL state. These are low-level building blocks for service-specific mapping.
|
|
9
9
|
|
|
@@ -17,6 +17,19 @@ If you use UrlConfigItem with useUrlState, set an explicit defaultValue for ever
|
|
|
17
17
|
|
|
18
18
|
## Route utils overview
|
|
19
19
|
|
|
20
|
+
| Export | Good for |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| getSortDirShort | Serialize sort direction into compact empty / - prefixes. |
|
|
23
|
+
| serializeSorting | Serialize sort state into a compact URL value like -name. |
|
|
24
|
+
| parseSorting | Parse +name / -name into sortBy and sortDir values. |
|
|
25
|
+
| mapColumnsSettingsToStrings | Serialize table column order, visibility, and widths into compact strings. |
|
|
26
|
+
| parseColumnsSettingsStrings | Parse compact column strings back into column settings with defaults. |
|
|
27
|
+
| serializeValue | Serialize primitive/array/object values to URL-compatible strings. |
|
|
28
|
+
| deserializeValue | Parse URL strings into typed values (number, boolean, arrays, object). |
|
|
29
|
+
| toQueryString | Build readable query strings (keeps commas/colons readable for complex values). |
|
|
30
|
+
| isEqual | Deep compare helper re-exported for state diffing in URL sync code. |
|
|
31
|
+
| UrlTypeMap, UrlValueType, UrlConfigItem | Core typing primitives for typed URL config definitions, including mandatory defaults and history behavior. |
|
|
32
|
+
|
|
20
33
|
## Simple state in URL
|
|
21
34
|
|
|
22
35
|
Example for manual parse/stringify helpers in a service file.
|
|
@@ -53,6 +66,107 @@ params . set ( 'tabId' , tabId ) ; } } const tags = serializeValue ( state . tag
|
|
|
53
66
|
params . set ( 'tags' , tags ) ; } if ( state . showArchived ) { const archived = serializeValue ( state . showArchived , 'boolean' ) ; if ( archived ) {
|
|
54
67
|
params . set ( 'archived' , archived ) ; } } const queryString = params . toString ( ) ; return ` ${ BASE_PATH } / ${ queryString ? ` ? ${ queryString } ` : '' } ` ; } ;
|
|
55
68
|
|
|
69
|
+
#### Code (text)
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
import { deserializeValue, serializeValue } from '@rio-cloud/rio-uikit/routeUtils';
|
|
73
|
+
|
|
74
|
+
// Adapt to your configuration
|
|
75
|
+
const BASE_PATH = 'my-service';
|
|
76
|
+
const VIEW_OPTIONS = ['list', 'grid'] as const;
|
|
77
|
+
|
|
78
|
+
type ViewType = (typeof VIEW_OPTIONS)[number];
|
|
79
|
+
const DEFAULT_VIEW: ViewType = 'list';
|
|
80
|
+
const DEFAULT_TAB_ID = 1;
|
|
81
|
+
|
|
82
|
+
type RouterLike = { location?: Location };
|
|
83
|
+
type RouteState = {
|
|
84
|
+
query: string;
|
|
85
|
+
view: ViewType;
|
|
86
|
+
tabId: number;
|
|
87
|
+
tags: string[];
|
|
88
|
+
showArchived: boolean;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const isViewType = (value: string): value is ViewType => (VIEW_OPTIONS as readonly string[]).includes(value);
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Reads URL state from a router-like object.
|
|
95
|
+
* Useful when you want a lightweight parser without a hook.
|
|
96
|
+
*
|
|
97
|
+
* Note: Optional service helper when you only need a one-off parse.
|
|
98
|
+
* For reactive state sync, use the `useUrlState` hook instead.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* const state = parseRoute({ location: window.location });
|
|
102
|
+
*/
|
|
103
|
+
export const parseRoute = (router: RouterLike): RouteState => {
|
|
104
|
+
const location = (router?.location ?? {}) as Location;
|
|
105
|
+
const params = new URLSearchParams(location.search || '');
|
|
106
|
+
|
|
107
|
+
const parsedView = deserializeValue(params.get('view'), 'string');
|
|
108
|
+
const parsedTabId = deserializeValue(params.get('tabId'), 'number');
|
|
109
|
+
const parsedTags = deserializeValue(params.get('tags'), 'array');
|
|
110
|
+
const parsedArchived = deserializeValue(params.get('archived'), 'boolean');
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
query: deserializeValue(params.get('q'), 'string') ?? '',
|
|
114
|
+
view: parsedView && isViewType(parsedView) ? parsedView : DEFAULT_VIEW,
|
|
115
|
+
tabId: parsedTabId ?? DEFAULT_TAB_ID,
|
|
116
|
+
tags: parsedTags ?? [],
|
|
117
|
+
showArchived: parsedArchived ?? false,
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Builds a deep-link URL for a given state.
|
|
123
|
+
* Useful for linking to a screen with preselected filters.
|
|
124
|
+
*
|
|
125
|
+
* Note: Optional service helper when you only need to build a link.
|
|
126
|
+
* For reactive state sync, use the `useUrlState` hook instead.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* const url = makeRoute({ query: 'rio', view: 'list', tabId: 2, tags: ['banana'], showArchived: false });
|
|
130
|
+
*/
|
|
131
|
+
export const makeRoute = (state: RouteState) => {
|
|
132
|
+
const params = new URLSearchParams();
|
|
133
|
+
|
|
134
|
+
const query = serializeValue(state.query, 'string');
|
|
135
|
+
if (query) {
|
|
136
|
+
params.set('q', query);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (state.view !== DEFAULT_VIEW) {
|
|
140
|
+
const view = serializeValue(state.view, 'string');
|
|
141
|
+
if (view) {
|
|
142
|
+
params.set('view', view);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (state.tabId !== DEFAULT_TAB_ID) {
|
|
147
|
+
const tabId = serializeValue(state.tabId, 'number');
|
|
148
|
+
if (tabId) {
|
|
149
|
+
params.set('tabId', tabId);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const tags = serializeValue(state.tags, 'array');
|
|
154
|
+
if (tags) {
|
|
155
|
+
params.set('tags', tags);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (state.showArchived) {
|
|
159
|
+
const archived = serializeValue(state.showArchived, 'boolean');
|
|
160
|
+
if (archived) {
|
|
161
|
+
params.set('archived', archived);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const queryString = params.toString();
|
|
166
|
+
return `${BASE_PATH}/${queryString ? `?${queryString}` : ''}`;
|
|
167
|
+
};
|
|
168
|
+
```
|
|
169
|
+
|
|
56
170
|
## TableSettingsDialog state
|
|
57
171
|
|
|
58
172
|
Example for compact sort + table settings mapping with dedicated helpers.
|
|
@@ -86,7 +200,101 @@ type mapRouteProps = { sortBy : string ; sortDir : SortDirectionType ; columns :
|
|
|
86
200
|
* For reactive state sync, use the `useUrlState` hook instead.
|
|
87
201
|
*
|
|
88
202
|
* @example
|
|
89
|
-
* const url = makeRoute({ sortBy: 'name', sortDir: '
|
|
203
|
+
* const url = makeRoute({ sortBy: 'name', sortDir: 'asc', columns });
|
|
90
204
|
*/ export const makeRoute = ( { sortBy , sortDir , columns } : mapRouteProps ) => { const params = new URLSearchParams ( ) ; if ( sortBy ) { // Use serializeSorting for compact empty / - prefix behavior. const serializedSort = serializeSorting ( { sortBy , sortDir } ) ; if ( serializedSort ) {
|
|
91
205
|
params . set ( 'sort' , serializedSort ) ; } } const mappedColumns = mapColumnsSettingsToStrings ( columns ) ; const serializedColumns = serializeValue ( mappedColumns , 'array' ) ; if ( serializedColumns ) {
|
|
92
|
-
params . set ( 'columns' , serializedColumns ) ; } const queryString = params . toString ( ) ; const searchFragment = queryString ? ` ? ${ queryString } ` : '' ; return ` ${ BASE_PATH } / ${ searchFragment } ` ; } ;
|
|
206
|
+
params . set ( 'columns' , serializedColumns ) ; } const queryString = params . toString ( ) ; const searchFragment = queryString ? ` ? ${ queryString } ` : '' ; return ` ${ BASE_PATH } / ${ searchFragment } ` ; } ;
|
|
207
|
+
|
|
208
|
+
#### Code (text)
|
|
209
|
+
|
|
210
|
+
```text
|
|
211
|
+
import {
|
|
212
|
+
deserializeValue,
|
|
213
|
+
mapColumnsSettingsToStrings,
|
|
214
|
+
parseColumnsSettingsStrings,
|
|
215
|
+
parseSorting,
|
|
216
|
+
serializeSorting,
|
|
217
|
+
serializeValue,
|
|
218
|
+
} from '@rio-cloud/rio-uikit/routeUtils';
|
|
219
|
+
import type { SortDirectionType } from '@rio-cloud/rio-uikit/SortUtils';
|
|
220
|
+
import type { TableColumnsSettings } from '@rio-cloud/rio-uikit/TableSettingsDialog';
|
|
221
|
+
|
|
222
|
+
// TableSettingsDialog state example.
|
|
223
|
+
// Adapt to your configuration
|
|
224
|
+
const BASE_PATH = 'my-service';
|
|
225
|
+
const defaultColumnsDetails: Record<string, { width: number; defaultWidth?: number }> = {
|
|
226
|
+
name: {
|
|
227
|
+
width: 250,
|
|
228
|
+
defaultWidth: 250,
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// Sample code for parsing the route just for illustration how to use the utils functions
|
|
233
|
+
// Feel free to modify this to your needs.
|
|
234
|
+
// Note: the "parseRoute" and "makeRoute" functions may contain more props which are left out in this demo
|
|
235
|
+
type RouterLike = { location?: Location };
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Reads table settings state from a router-like object.
|
|
239
|
+
*
|
|
240
|
+
* Note: Optional service helper when you only need a one-off parse.
|
|
241
|
+
* For reactive state sync, use the `useUrlState` hook instead.
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* const state = parseRoute({ location: window.location });
|
|
245
|
+
*/
|
|
246
|
+
export const parseRoute = (router: RouterLike) => {
|
|
247
|
+
const location = (router?.location ?? {}) as Location;
|
|
248
|
+
const params = new URLSearchParams(location.search || '');
|
|
249
|
+
|
|
250
|
+
const sortValue = deserializeValue(params.get('sort'), 'string');
|
|
251
|
+
const sorting = sortValue ? parseSorting(sortValue) : undefined;
|
|
252
|
+
|
|
253
|
+
const columnsList = deserializeValue(params.get('columns'), 'array');
|
|
254
|
+
const columns = columnsList ? parseColumnsSettingsStrings(columnsList, defaultColumnsDetails) : undefined;
|
|
255
|
+
|
|
256
|
+
return {
|
|
257
|
+
sortBy: sorting?.sortBy,
|
|
258
|
+
sortDir: sorting?.sortDir,
|
|
259
|
+
columns,
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
type mapRouteProps = {
|
|
264
|
+
sortBy: string;
|
|
265
|
+
sortDir: SortDirectionType;
|
|
266
|
+
columns: TableColumnsSettings;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Builds a deep-link URL for a given table settings state.
|
|
271
|
+
*
|
|
272
|
+
* Note: Optional service helper when you only need to build a link.
|
|
273
|
+
* For reactive state sync, use the `useUrlState` hook instead.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* const url = makeRoute({ sortBy: 'name', sortDir: 'asc', columns });
|
|
277
|
+
*/
|
|
278
|
+
export const makeRoute = ({ sortBy, sortDir, columns }: mapRouteProps) => {
|
|
279
|
+
const params = new URLSearchParams();
|
|
280
|
+
|
|
281
|
+
if (sortBy) {
|
|
282
|
+
// Use serializeSorting for compact empty / - prefix behavior.
|
|
283
|
+
const serializedSort = serializeSorting({ sortBy, sortDir });
|
|
284
|
+
if (serializedSort) {
|
|
285
|
+
params.set('sort', serializedSort);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const mappedColumns = mapColumnsSettingsToStrings(columns);
|
|
290
|
+
const serializedColumns = serializeValue(mappedColumns, 'array');
|
|
291
|
+
if (serializedColumns) {
|
|
292
|
+
params.set('columns', serializedColumns);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const queryString = params.toString();
|
|
296
|
+
const searchFragment = queryString ? `?${queryString}` : '';
|
|
297
|
+
|
|
298
|
+
return `${BASE_PATH}/${searchFragment}`;
|
|
299
|
+
};
|
|
300
|
+
```
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* Lifecycle & execution hooks
|
|
5
5
|
*Source:* https://uikit.developers.rio.cloud/#/utilities/useAfterMount
|
|
6
|
-
*Captured:* 2026-
|
|
6
|
+
*Captured:* 2026-04-27T14:59:30.051Z
|
|
7
7
|
|
|
8
8
|
The useAfterMount hook allows to use a side effect after the component has been mounted and rendered. The effect will not be triggered on mount and only when the dependencies change.
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* DOM behavior hooks
|
|
5
5
|
*Source:* https://uikit.developers.rio.cloud/#/utilities/useAutoAnimate
|
|
6
|
-
*Captured:* 2026-
|
|
6
|
+
*Captured:* 2026-04-27T14:59:33.149Z
|
|
7
7
|
|
|
8
8
|
The useAutoAnimate hook is a thin re-export of the @formkit/auto-animate utility to quickly add enter/leave animations to a container. This page shows a simple example; for full configuration options, check the official documentation.
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* Data aggregation hooks
|
|
5
5
|
*Source:* https://uikit.developers.rio.cloud/#/utilities/useAverage
|
|
6
|
-
*Captured:* 2026-
|
|
6
|
+
*Captured:* 2026-04-27T14:59:45.572Z
|
|
7
7
|
|
|
8
8
|
Calculates the arithmetic mean of numeric values extracted from a list of objects using a dot-separated path. Supports localized number formats through optional locale configuration.
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* DOM behavior hooks
|
|
5
5
|
*Source:* https://uikit.developers.rio.cloud/#/utilities/useClickOutside
|
|
6
|
-
*Captured:* 2026-
|
|
6
|
+
*Captured:* 2026-04-27T14:59:33.323Z
|
|
7
7
|
|
|
8
8
|
The useClickOutside hook allows to easily detect events outside a referenced element.
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* Browser & device hooks
|
|
5
5
|
*Source:* https://uikit.developers.rio.cloud/#/utilities/useClipboard
|
|
6
|
-
*Captured:* 2026-
|
|
6
|
+
*Captured:* 2026-04-27T14:59:38.703Z
|
|
7
7
|
|
|
8
8
|
The useClipboard hook allows to easily copy something to the browsers clipboard.
|
|
9
9
|
|
|
@@ -71,7 +71,7 @@ export default () => {
|
|
|
71
71
|
<span>Random UUID</span>
|
|
72
72
|
</label>
|
|
73
73
|
<div class="input-group">
|
|
74
|
-
<input id="random-uuid" class="form-control" type="text" value="
|
|
74
|
+
<input id="random-uuid" class="form-control" type="text" value="6e2d4717-221f-4475-864f-973f1cb5f24e">
|
|
75
75
|
<div class="input-group-addon">
|
|
76
76
|
<button type="button" class="btn btn-muted btn-sm btn-icon-only btn-component position-absolute top-1 right-1" tabindex="0">
|
|
77
77
|
<span class="rioglyph rioglyph-duplicate">
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* Browser & device hooks
|
|
5
5
|
*Source:* https://uikit.developers.rio.cloud/#/utilities/useCookies
|
|
6
|
-
*Captured:* 2026-
|
|
6
|
+
*Captured:* 2026-04-27T14:59:39.991Z
|
|
7
7
|
|
|
8
8
|
The useCookies hook allows you to set cookies, delete cookies and check whether a cookie exists in the browser.
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* Data aggregation hooks
|
|
5
5
|
*Source:* https://uikit.developers.rio.cloud/#/utilities/useCount
|
|
6
|
-
*Captured:* 2026-
|
|
6
|
+
*Captured:* 2026-04-27T14:59:46.251Z
|
|
7
7
|
|
|
8
8
|
useCount is a utility hook for counting how many objects in a list contain a specific value or match a custom condition at a given property path. It supports exact value matching (e.g. true, 0, 'PENDING') or predicate-based logic using a match function. By default, all values that are not null or undefined are counted.
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* Browser & device hooks
|
|
5
5
|
*Source:* https://uikit.developers.rio.cloud/#/utilities/useDarkMode
|
|
6
|
-
*Captured:* 2026-
|
|
6
|
+
*Captured:* 2026-04-27T14:59:40.173Z
|
|
7
7
|
|
|
8
8
|
The useDarkMode hook enables you to listen for the color scheme change and react accordingly.
|
|
9
9
|
|
|
@@ -39,7 +39,8 @@ export default () => {
|
|
|
39
39
|
</div>
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
#### Props
|
|
42
|
+
#### Props (json)
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
```json
|
|
45
|
+
isDarkMode
|
|
46
|
+
```
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* UI state & input hooks
|
|
5
5
|
*Source:* https://uikit.developers.rio.cloud/#/utilities/useDebugInfo
|
|
6
|
-
*Captured:* 2026-
|
|
6
|
+
*Captured:* 2026-04-27T14:59:43.208Z
|
|
7
7
|
|
|
8
8
|
The useDebugInfo hook allows to return detailed information about render count, render time and changed component props and also to print these information to the console.
|
|
9
9
|
|
|
@@ -18,7 +18,7 @@ Debug Info: {
|
|
|
18
18
|
"renderCount": 1,
|
|
19
19
|
"changedProps": {},
|
|
20
20
|
"timeSinceLastRender": 0,
|
|
21
|
-
"lastRenderTimestamp":
|
|
21
|
+
"lastRenderTimestamp": 1777301982498
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
Toggle Increment
|
|
@@ -93,7 +93,7 @@ export default () => {
|
|
|
93
93
|
"renderCount": 1,
|
|
94
94
|
"changedProps": {},
|
|
95
95
|
"timeSinceLastRender": 0,
|
|
96
|
-
"lastRenderTimestamp":
|
|
96
|
+
"lastRenderTimestamp": 1777301982498
|
|
97
97
|
}</pre>
|
|
98
98
|
</div>
|
|
99
99
|
</div>
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# useDraggableElement
|
|
2
|
+
|
|
3
|
+
*Category:* Utilities
|
|
4
|
+
*Section:* DOM behavior hooks
|
|
5
|
+
*Source:* https://uikit.developers.rio.cloud/#/utilities/useDraggableElement
|
|
6
|
+
*Captured:* 2026-04-27T14:59:34.226Z
|
|
7
|
+
|
|
8
|
+
The useDraggableElement hook provides drag behavior for an element. It manages pointer events, viewport clamping and draggable position state for UI elements like floating panels or overlays. Viewport mode renders through the shared portal root, while container mode is intended for absolutely positioned elements that must stay aligned with a scrollable boundary. The hook can also apply an initial position, including centered placement. The renderElement helper is mainly relevant for viewport mode; in container mode it simply returns the element unchanged.
|
|
9
|
+
|
|
10
|
+
## useDraggableElement
|
|
11
|
+
|
|
12
|
+
### Example: Example 1
|
|
13
|
+
|
|
14
|
+
Use the drag icon to move the fixed panel around the viewport. Viewport mode automatically renders through the shared portal root.
|
|
15
|
+
Show draggable element Reset panel position
|
|
16
|
+
|
|
17
|
+
#### React (tsx)
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { useState, type CSSProperties } from 'react';
|
|
21
|
+
|
|
22
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
23
|
+
import useDraggableElement from '@rio-cloud/rio-uikit/hooks/useDraggableElement';
|
|
24
|
+
import ButtonToolbar from '@rio-cloud/rio-uikit/ButtonToolbar';
|
|
25
|
+
import classNames from '@rio-cloud/rio-uikit/classNames';
|
|
26
|
+
|
|
27
|
+
const defaultPositionStyle: CSSProperties = {
|
|
28
|
+
top: '180px',
|
|
29
|
+
left: '50%',
|
|
30
|
+
transform: 'translateX(-50%)',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const DraggablePanel = () => {
|
|
34
|
+
const { draggableRef, isDragging, position, onDragHandleDown, renderElement } = useDraggableElement();
|
|
35
|
+
|
|
36
|
+
const positionStyle = position.hasDragged ? { ...position } : defaultPositionStyle;
|
|
37
|
+
|
|
38
|
+
return renderElement(
|
|
39
|
+
<div
|
|
40
|
+
ref={draggableRef}
|
|
41
|
+
className='position-fixed rounded bg-primary padding-left-10 padding-right-20 padding-y-10 shadow-focused z-index-max'
|
|
42
|
+
style={positionStyle}
|
|
43
|
+
>
|
|
44
|
+
<div className='display-flex align-items-center gap-10'>
|
|
45
|
+
<span
|
|
46
|
+
role='button'
|
|
47
|
+
aria-label='Drag panel'
|
|
48
|
+
className={classNames(
|
|
49
|
+
'rioglyph rioglyph-drag-n-drop text-size-20',
|
|
50
|
+
isDragging ? 'cursor-grabbing' : 'cursor-grab'
|
|
51
|
+
)}
|
|
52
|
+
onPointerDown={onDragHandleDown}
|
|
53
|
+
/>
|
|
54
|
+
<div className='display-flex flex-column line-height-14'>
|
|
55
|
+
<b>Draggable demo panel</b>
|
|
56
|
+
<span className='text-size-12'>Drag only with the icon on the left</span>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default () => {
|
|
64
|
+
const [show, setShow] = useState(false);
|
|
65
|
+
const [instanceKey, setInstanceKey] = useState(0);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div>
|
|
69
|
+
<p>
|
|
70
|
+
Use the drag icon to move the fixed panel around the viewport. Viewport mode automatically renders
|
|
71
|
+
through the shared portal root.
|
|
72
|
+
</p>
|
|
73
|
+
<ButtonToolbar>
|
|
74
|
+
<Button onClick={() => setShow(!show)}>{show ? 'Hide' : 'Show'} draggable element</Button>
|
|
75
|
+
<Button onClick={() => setInstanceKey(previous => previous + 1)}>Reset panel position</Button>
|
|
76
|
+
</ButtonToolbar>
|
|
77
|
+
{show && <DraggablePanel key={instanceKey} />}
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### HTML (html)
|
|
84
|
+
|
|
85
|
+
```html
|
|
86
|
+
<div>
|
|
87
|
+
<p>Use the drag icon to move the fixed panel around the viewport. Viewport mode automatically renders through the shared portal root.</p>
|
|
88
|
+
<div class="btn-toolbar">
|
|
89
|
+
<button type="button" class="btn btn-default btn-component" tabindex="0">Show draggable element</button>
|
|
90
|
+
<button type="button" class="btn btn-default btn-component" tabindex="0">Reset panel position</button>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### Props: Options (UseDraggableElementOptions)
|
|
96
|
+
|
|
97
|
+
### Options (UseDraggableElementOptions)
|
|
98
|
+
|
|
99
|
+
| Name | Type | Default | Description |
|
|
100
|
+
| --- | --- | --- | --- |
|
|
101
|
+
| positioning | 'viewport' \| 'container' | — | Defines whether drag coordinates are resolved against the viewport or a collision container. Viewport mode also enables portal rendering via renderElement. |
|
|
102
|
+
| initialPosition | 'center' \| Pick<DraggablePosition, 'top' \| 'left'> | — | Optional initial position for the draggable element. Use center to center the element inside the active positioning context on mount. |
|
|
103
|
+
| collisionContainerRef | RefObject<HTMLElement \| null> | — | Optional container whose visible client rect is used as the drag boundary in container mode. |
|
|
104
|
+
|
|
105
|
+
#### Props: Return value (UseDraggableResult)
|
|
106
|
+
|
|
107
|
+
### Return value (UseDraggableResult)
|
|
108
|
+
|
|
109
|
+
| Name | Type | Default | Description |
|
|
110
|
+
| --- | --- | --- | --- |
|
|
111
|
+
| draggableRef | MutableRefObject<T \| null> | — | Ref that must be attached to the draggable element container. |
|
|
112
|
+
| isDragging | boolean | — | Indicates whether a drag interaction is currently active. |
|
|
113
|
+
| position | DraggablePosition | — | Current draggable coordinates and drag-state metadata. |
|
|
114
|
+
| onDragHandleDown | (event: ReactPointerEvent<HTMLElement>) => void | — | Pointer down handler for the dedicated drag handle element. |
|
|
115
|
+
| renderElement | (element: ReactNode, target?: HTMLElement \| null) => ReactNode | — | Renders the provided element through the shared portal root in viewport mode. An optional custom target can be passed for specialized overlay hosts. In container mode, the element is returned unchanged and this helper is usually not needed. |
|
|
116
|
+
|
|
117
|
+
#### Props: Position object (DraggablePosition)
|
|
118
|
+
|
|
119
|
+
### Position object (DraggablePosition)
|
|
120
|
+
|
|
121
|
+
| Name | Type | Default | Description |
|
|
122
|
+
| --- | --- | --- | --- |
|
|
123
|
+
| top | number | — | Top offset in pixels relative to the active positioning context. |
|
|
124
|
+
| left | number | — | Left offset in pixels relative to the active positioning context. |
|
|
125
|
+
| hasDragged | boolean | — | Indicates whether the element has been moved by dragging at least once. |
|
|
126
|
+
|
|
127
|
+
## Draggable element inside container
|
|
128
|
+
|
|
129
|
+
### Example: Example 2
|
|
130
|
+
|
|
131
|
+
Use the drag icon to move the card inside the dashed boundary container.
|
|
132
|
+
Show draggable card Reset card position
|
|
133
|
+
Drag boundary container
|
|
134
|
+
Container mode keeps the draggable element inside this box and aligned correctly while the page scrolls.
|
|
135
|
+
|
|
136
|
+
#### React (tsx)
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import { useRef, useState, type RefObject } from 'react';
|
|
140
|
+
|
|
141
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
142
|
+
import ButtonToolbar from '@rio-cloud/rio-uikit/ButtonToolbar';
|
|
143
|
+
import Card from '@rio-cloud/rio-uikit/Card';
|
|
144
|
+
import useDraggableElement from '@rio-cloud/rio-uikit/hooks/useDraggableElement';
|
|
145
|
+
|
|
146
|
+
type DraggableCardProps = {
|
|
147
|
+
onClose: () => void;
|
|
148
|
+
collisionContainerRef: RefObject<HTMLDivElement | null>;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const DraggableCard = (props: DraggableCardProps) => {
|
|
152
|
+
const { onClose, collisionContainerRef } = props;
|
|
153
|
+
|
|
154
|
+
const { draggableRef, isDragging, position, onDragHandleDown } = useDraggableElement<HTMLDivElement>({
|
|
155
|
+
positioning: 'container',
|
|
156
|
+
initialPosition: 'center',
|
|
157
|
+
collisionContainerRef,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
return (
|
|
161
|
+
<div ref={draggableRef} className='position-absolute z-index-1' style={{ ...position }}>
|
|
162
|
+
<Card className='width-350 shadow-smooth' padding={20}>
|
|
163
|
+
<div className='display-flex align-items-center justify-content-between gap-10'>
|
|
164
|
+
<div className='display-flex align-items-center gap-10'>
|
|
165
|
+
<div className='margin-left--5'>
|
|
166
|
+
<span
|
|
167
|
+
role='button'
|
|
168
|
+
aria-label='Drag card'
|
|
169
|
+
className='rioglyph rioglyph-drag-n-drop text-size-20 text-color-dark hover-text-color-darker'
|
|
170
|
+
style={{
|
|
171
|
+
cursor: isDragging ? 'grabbing' : 'grab',
|
|
172
|
+
touchAction: 'none',
|
|
173
|
+
}}
|
|
174
|
+
onPointerDown={onDragHandleDown}
|
|
175
|
+
/>
|
|
176
|
+
</div>
|
|
177
|
+
<div className='text-size-16 text-medium text-color-darker'>Draggable card</div>
|
|
178
|
+
</div>
|
|
179
|
+
<Button
|
|
180
|
+
bsSize='xs'
|
|
181
|
+
bsStyle='muted'
|
|
182
|
+
onClick={onClose}
|
|
183
|
+
iconName='rioglyph-remove'
|
|
184
|
+
iconOnly
|
|
185
|
+
className='position-absolute top-15 right-15 hover-bg-none'
|
|
186
|
+
/>
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<div className='margin-top-15'>
|
|
190
|
+
This card is absolutely positioned inside the dashed container, so scrolling keeps it in sync with
|
|
191
|
+
its boundary.
|
|
192
|
+
</div>
|
|
193
|
+
</Card>
|
|
194
|
+
</div>
|
|
195
|
+
);
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export default () => {
|
|
199
|
+
const [show, setShow] = useState(false);
|
|
200
|
+
const [instanceKey, setInstanceKey] = useState(0);
|
|
201
|
+
|
|
202
|
+
const collisionContainerRef = useRef<HTMLDivElement>(null);
|
|
203
|
+
|
|
204
|
+
const handleResetPosition = () => setInstanceKey(previous => previous + 1);
|
|
205
|
+
|
|
206
|
+
return (
|
|
207
|
+
<div>
|
|
208
|
+
<p>Use the drag icon to move the card inside the dashed boundary container.</p>
|
|
209
|
+
<ButtonToolbar>
|
|
210
|
+
<Button onClick={() => setShow(!show)}>{show ? 'Hide' : 'Show'} draggable card</Button>
|
|
211
|
+
<Button onClick={handleResetPosition}>Reset card position</Button>
|
|
212
|
+
</ButtonToolbar>
|
|
213
|
+
<div
|
|
214
|
+
ref={collisionContainerRef}
|
|
215
|
+
className='position-relative margin-top-20 min-height-300 rounded border border-style-dashed border-color-info bg-highlight-decent padding-20'
|
|
216
|
+
>
|
|
217
|
+
<div className='text-size-16 text-medium text-color-info'>Drag boundary container</div>
|
|
218
|
+
<div className='margin-top-10 max-width-450 text-size-13 text-color-darker'>
|
|
219
|
+
Container mode keeps the draggable element inside this box and aligned correctly while the page
|
|
220
|
+
scrolls.
|
|
221
|
+
</div>
|
|
222
|
+
{show && (
|
|
223
|
+
<DraggableCard
|
|
224
|
+
key={instanceKey}
|
|
225
|
+
onClose={() => setShow(false)}
|
|
226
|
+
collisionContainerRef={collisionContainerRef}
|
|
227
|
+
/>
|
|
228
|
+
)}
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
);
|
|
232
|
+
};
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### HTML (html)
|
|
236
|
+
|
|
237
|
+
```html
|
|
238
|
+
<div>
|
|
239
|
+
<p>Use the drag icon to move the card inside the dashed boundary container.</p>
|
|
240
|
+
<div class="btn-toolbar">
|
|
241
|
+
<button type="button" class="btn btn-default btn-component" tabindex="0">Show draggable card</button>
|
|
242
|
+
<button type="button" class="btn btn-default btn-component" tabindex="0">Reset card position</button>
|
|
243
|
+
</div>
|
|
244
|
+
<div class="position-relative margin-top-20 min-height-300 rounded border border-style-dashed border-color-info bg-highlight-decent padding-20">
|
|
245
|
+
<div class="text-size-16 text-medium text-color-info">Drag boundary container</div>
|
|
246
|
+
<div class="margin-top-10 max-width-450 text-size-13 text-color-darker">Container mode keeps the draggable element inside this box and aligned correctly while the page scrolls.</div>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### Props: Options (UseDraggableElementOptions)
|
|
252
|
+
|
|
253
|
+
### Options (UseDraggableElementOptions)
|
|
254
|
+
|
|
255
|
+
| Name | Type | Default | Description |
|
|
256
|
+
| --- | --- | --- | --- |
|
|
257
|
+
| positioning | 'viewport' \| 'container' | — | Defines whether drag coordinates are resolved against the viewport or a collision container. Viewport mode also enables portal rendering via renderElement. |
|
|
258
|
+
| initialPosition | 'center' \| Pick<DraggablePosition, 'top' \| 'left'> | — | Optional initial position for the draggable element. Use center to center the element inside the active positioning context on mount. |
|
|
259
|
+
| collisionContainerRef | RefObject<HTMLElement \| null> | — | Optional container whose visible client rect is used as the drag boundary in container mode. |
|
|
260
|
+
|
|
261
|
+
#### Props: Return value (UseDraggableResult)
|
|
262
|
+
|
|
263
|
+
### Return value (UseDraggableResult)
|
|
264
|
+
|
|
265
|
+
| Name | Type | Default | Description |
|
|
266
|
+
| --- | --- | --- | --- |
|
|
267
|
+
| draggableRef | MutableRefObject<T \| null> | — | Ref that must be attached to the draggable element container. |
|
|
268
|
+
| isDragging | boolean | — | Indicates whether a drag interaction is currently active. |
|
|
269
|
+
| position | DraggablePosition | — | Current draggable coordinates and drag-state metadata. |
|
|
270
|
+
| onDragHandleDown | (event: ReactPointerEvent<HTMLElement>) => void | — | Pointer down handler for the dedicated drag handle element. |
|
|
271
|
+
| renderElement | (element: ReactNode, target?: HTMLElement \| null) => ReactNode | — | Renders the provided element through the shared portal root in viewport mode. An optional custom target can be passed for specialized overlay hosts. In container mode, the element is returned unchanged and this helper is usually not needed. |
|
|
272
|
+
|
|
273
|
+
#### Props: Position object (DraggablePosition)
|
|
274
|
+
|
|
275
|
+
### Position object (DraggablePosition)
|
|
276
|
+
|
|
277
|
+
| Name | Type | Default | Description |
|
|
278
|
+
| --- | --- | --- | --- |
|
|
279
|
+
| top | number | — | Top offset in pixels relative to the active positioning context. |
|
|
280
|
+
| left | number | — | Left offset in pixels relative to the active positioning context. |
|
|
281
|
+
| hasDragged | boolean | — | Indicates whether the element has been moved by dragging at least once. |
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*Category:* Utilities
|
|
4
4
|
*Section:* Lifecycle & execution hooks
|
|
5
5
|
*Source:* https://uikit.developers.rio.cloud/#/utilities/useEffectOnce
|
|
6
|
-
*Captured:* 2026-
|
|
6
|
+
*Captured:* 2026-04-27T14:59:30.393Z
|
|
7
7
|
|
|
8
8
|
The useEffectOnce hook allows to use a side effect only once after the component has been mounted.
|
|
9
9
|
|