@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.
Files changed (211) hide show
  1. package/README.md +2 -1
  2. package/dist/doc-metadata.json +334 -94
  3. package/dist/docs/components/accentBar.md +110 -116
  4. package/dist/docs/components/activity.md +1 -1
  5. package/dist/docs/components/analyticsAnalysisOverlay.md +630 -0
  6. package/dist/docs/components/animatedNumber.md +2 -2
  7. package/dist/docs/components/animatedTextReveal.md +53 -55
  8. package/dist/docs/components/animations.md +21 -21
  9. package/dist/docs/components/appHeader.md +27 -38
  10. package/dist/docs/components/appLayout.md +23 -77
  11. package/dist/docs/components/appNavigationBar.md +1 -1
  12. package/dist/docs/components/areaCharts.md +57 -61
  13. package/dist/docs/components/aspectRatioPlaceholder.md +1 -1
  14. package/dist/docs/components/assetTree.md +429 -342
  15. package/dist/docs/components/autosuggests.md +1 -1
  16. package/dist/docs/components/avatar.md +1 -1
  17. package/dist/docs/components/banner.md +2 -2
  18. package/dist/docs/components/barCharts.md +530 -414
  19. package/dist/docs/components/barList.md +10 -10
  20. package/dist/docs/components/basicMap.md +104 -39
  21. package/dist/docs/components/bottomSheet.md +2 -2
  22. package/dist/docs/components/button.md +8 -2
  23. package/dist/docs/components/buttonToolbar.md +1 -1
  24. package/dist/docs/components/calendarStripe.md +59 -63
  25. package/dist/docs/components/card.md +1 -1
  26. package/dist/docs/components/carousel.md +1 -1
  27. package/dist/docs/components/chartColors.md +1 -1
  28. package/dist/docs/components/chartsGettingStarted.md +1 -1
  29. package/dist/docs/components/chat.md +2 -2
  30. package/dist/docs/components/checkbox.md +15 -10
  31. package/dist/docs/components/circularProgress.md +6 -6
  32. package/dist/docs/components/clearableInput.md +1 -1
  33. package/dist/docs/components/collapse.md +2 -2
  34. package/dist/docs/components/composedCharts.md +63 -51
  35. package/dist/docs/components/contentLoader.md +1 -1
  36. package/dist/docs/components/dataTabs.md +33 -33
  37. package/dist/docs/components/datepickers.md +693 -685
  38. package/dist/docs/components/dayPicker.md +5624 -0
  39. package/dist/docs/components/dayPickerCalendar.md +5289 -0
  40. package/dist/docs/components/dialogs.md +17 -19
  41. package/dist/docs/components/divider.md +1 -1
  42. package/dist/docs/components/dropdowns.md +3264 -3276
  43. package/dist/docs/components/editableContent.md +91 -91
  44. package/dist/docs/components/expander.md +4 -1
  45. package/dist/docs/components/fade.md +1 -1
  46. package/dist/docs/components/fadeExpander.md +1 -1
  47. package/dist/docs/components/fadeUp.md +32 -36
  48. package/dist/docs/components/feedback.md +1 -1
  49. package/dist/docs/components/filePickers.md +1 -1
  50. package/dist/docs/components/formLabel.md +29 -31
  51. package/dist/docs/components/groupedItemList.md +3 -7
  52. package/dist/docs/components/htmlTable.md +5074 -0
  53. package/dist/docs/components/iconList.md +4 -4
  54. package/dist/docs/components/imagePreloader.md +1 -1
  55. package/dist/docs/components/labeledElement.md +1 -1
  56. package/dist/docs/components/licensePlate.md +1 -1
  57. package/dist/docs/components/lineCharts.md +172 -170
  58. package/dist/docs/components/listMenu.md +15 -12
  59. package/dist/docs/components/loadMore.md +4 -2
  60. package/dist/docs/components/mainNavigation.md +1 -1
  61. package/dist/docs/components/mapCircle.md +10 -1
  62. package/dist/docs/components/mapCluster.md +25 -1
  63. package/dist/docs/components/mapContext.md +12 -4
  64. package/dist/docs/components/mapDraggableMarker.md +12 -1
  65. package/dist/docs/components/mapGettingStarted.md +39 -1
  66. package/dist/docs/components/mapInfoBubble.md +129 -2
  67. package/dist/docs/components/mapLayerGroup.md +10 -1
  68. package/dist/docs/components/mapMarker.md +10 -1
  69. package/dist/docs/components/mapPolygon.md +288 -85
  70. package/dist/docs/components/mapRoute.md +262 -172
  71. package/dist/docs/components/mapSettings.md +28 -1
  72. package/dist/docs/components/mapUtils.md +1 -1
  73. package/dist/docs/components/mapViewportHistory.md +287 -0
  74. package/dist/docs/components/multiselects.md +217 -18
  75. package/dist/docs/components/noData.md +1 -1
  76. package/dist/docs/components/notifications.md +2 -2
  77. package/dist/docs/components/numbercontrol.md +15 -15
  78. package/dist/docs/components/onboarding.md +1 -1
  79. package/dist/docs/components/page.md +1 -1
  80. package/dist/docs/components/pager.md +1 -1
  81. package/dist/docs/components/pieCharts.md +237 -211
  82. package/dist/docs/components/popover.md +1 -1
  83. package/dist/docs/components/position.md +1 -1
  84. package/dist/docs/components/radialBarCharts.md +446 -398
  85. package/dist/docs/components/radioCardGroup.md +1 -1
  86. package/dist/docs/components/radiobutton.md +98 -98
  87. package/dist/docs/components/releaseNotes.md +1 -1
  88. package/dist/docs/components/resizer.md +1 -1
  89. package/dist/docs/components/responsiveColumnStripe.md +1 -1
  90. package/dist/docs/components/responsiveVideo.md +1 -1
  91. package/dist/docs/components/rioglyph.md +1 -1
  92. package/dist/docs/components/rules.md +41 -47
  93. package/dist/docs/components/saveableInput.md +252 -252
  94. package/dist/docs/components/selects.md +332 -161
  95. package/dist/docs/components/sidebar.md +1 -1
  96. package/dist/docs/components/sliders.md +1 -1
  97. package/dist/docs/components/smoothScrollbars.md +19 -13
  98. package/dist/docs/components/spinners.md +1 -1
  99. package/dist/docs/components/states.md +15 -1
  100. package/dist/docs/components/statsWidgets.md +1 -1
  101. package/dist/docs/components/statusBar.md +3 -1
  102. package/dist/docs/components/stepButton.md +1 -1
  103. package/dist/docs/components/steppedProgressBars.md +9 -11
  104. package/dist/docs/components/subNavigation.md +1 -1
  105. package/dist/docs/components/supportMarker.md +1 -1
  106. package/dist/docs/components/svgImage.md +1 -1
  107. package/dist/docs/components/switch.md +5 -1
  108. package/dist/docs/components/table.md +21361 -0
  109. package/dist/docs/components/tableControls.md +982 -0
  110. package/dist/docs/components/tagManager.md +1 -1
  111. package/dist/docs/components/tags.md +1 -1
  112. package/dist/docs/components/teaser.md +1 -1
  113. package/dist/docs/components/textTruncateMiddle.md +1 -1
  114. package/dist/docs/components/timeline.md +1 -1
  115. package/dist/docs/components/timepicker.md +3 -1
  116. package/dist/docs/components/toggleButton.md +3 -1
  117. package/dist/docs/components/tooltip.md +8 -2
  118. package/dist/docs/components/tracker.md +1 -1
  119. package/dist/docs/components/virtualList.md +60 -60
  120. package/dist/docs/foundations.md +761 -3077
  121. package/dist/docs/start/changelog.md +73 -3
  122. package/dist/docs/start/goodtoknow.md +5 -1
  123. package/dist/docs/start/guidelines/color-combinations.md +5 -1
  124. package/dist/docs/start/guidelines/custom-css.md +26 -2
  125. package/dist/docs/start/guidelines/custom-rioglyph.md +20 -2
  126. package/dist/docs/start/guidelines/formatting.md +2254 -249
  127. package/dist/docs/start/guidelines/iframe.md +53 -19
  128. package/dist/docs/start/guidelines/obfuscate-data.md +24 -2
  129. package/dist/docs/start/guidelines/print-css.md +16 -2
  130. package/dist/docs/start/guidelines/spinner.md +1 -1
  131. package/dist/docs/start/guidelines/state-in-url.md +1138 -11
  132. package/dist/docs/start/guidelines/supported-browsers.md +9 -2
  133. package/dist/docs/start/guidelines/writing.md +228 -2
  134. package/dist/docs/start/howto.md +155 -13
  135. package/dist/docs/start/intro.md +40 -2
  136. package/dist/docs/start/responsiveness.md +27 -1
  137. package/dist/docs/templates/ai-assistant.md +311 -0
  138. package/dist/docs/templates/common-table.md +814 -0
  139. package/dist/docs/templates/detail-views.md +846 -0
  140. package/dist/docs/templates/expandable-details.md +214 -0
  141. package/dist/docs/templates/feature-cards.md +479 -0
  142. package/dist/docs/templates/form-summary.md +179 -0
  143. package/dist/docs/templates/form-toggle.md +329 -0
  144. package/dist/docs/templates/list-blocks.md +872 -0
  145. package/dist/docs/templates/loading-progress.md +100 -0
  146. package/dist/docs/templates/options-panel.md +132 -0
  147. package/dist/docs/templates/panel-variants.md +137 -0
  148. package/dist/docs/templates/progress-cards.md +541 -0
  149. package/dist/docs/templates/progress-success.md +125 -0
  150. package/dist/docs/templates/settings-form.md +401 -0
  151. package/dist/docs/templates/stats-blocks.md +1245 -0
  152. package/dist/docs/templates/table-panel.md +310 -0
  153. package/dist/docs/templates/usage-cards.md +199 -0
  154. package/dist/docs/utilities/classNames.md +89 -1
  155. package/dist/docs/utilities/deviceUtils.md +2 -2
  156. package/dist/docs/utilities/featureToggles.md +182 -2
  157. package/dist/docs/utilities/fuelTypeUtils.md +27 -29
  158. package/dist/docs/utilities/getTrackingAttributes.md +322 -0
  159. package/dist/docs/utilities/routeUtils.md +211 -3
  160. package/dist/docs/utilities/useAfterMount.md +1 -1
  161. package/dist/docs/utilities/useAutoAnimate.md +1 -1
  162. package/dist/docs/utilities/useAverage.md +1 -1
  163. package/dist/docs/utilities/useClickOutside.md +1 -1
  164. package/dist/docs/utilities/useClipboard.md +2 -2
  165. package/dist/docs/utilities/useCookies.md +1 -1
  166. package/dist/docs/utilities/useCount.md +1 -1
  167. package/dist/docs/utilities/useDarkMode.md +5 -4
  168. package/dist/docs/utilities/useDebugInfo.md +3 -3
  169. package/dist/docs/utilities/useDraggableElement.md +281 -0
  170. package/dist/docs/utilities/useEffectOnce.md +1 -1
  171. package/dist/docs/utilities/useElapsedTime.md +1 -1
  172. package/dist/docs/utilities/useElementSize.md +1 -1
  173. package/dist/docs/utilities/useEsc.md +1 -1
  174. package/dist/docs/utilities/useEvent.md +1 -1
  175. package/dist/docs/utilities/useFocusTrap.md +1 -1
  176. package/dist/docs/utilities/useFullscreen.md +1 -1
  177. package/dist/docs/utilities/useHover.md +1 -1
  178. package/dist/docs/utilities/useIncomingPostMessages.md +1 -1
  179. package/dist/docs/utilities/useInterval.md +1 -1
  180. package/dist/docs/utilities/useIsFocusWithin.md +1 -1
  181. package/dist/docs/utilities/useKey.md +8 -10
  182. package/dist/docs/utilities/useLocalStorage.md +1 -1
  183. package/dist/docs/utilities/useLocationSuggestions.md +1 -1
  184. package/dist/docs/utilities/useMax.md +1 -1
  185. package/dist/docs/utilities/useMin.md +1 -1
  186. package/dist/docs/utilities/useMutationObserver.md +1 -1
  187. package/dist/docs/utilities/useOnScreen.md +1 -1
  188. package/dist/docs/utilities/useOnlineStatus.md +1 -1
  189. package/dist/docs/utilities/usePostMessage.md +2 -2
  190. package/dist/docs/utilities/usePostMessageSender.md +1 -1
  191. package/dist/docs/utilities/usePrevious.md +110 -2
  192. package/dist/docs/utilities/useResizeObserver.md +35 -15
  193. package/dist/docs/utilities/useRioCookieConsent.md +1 -1
  194. package/dist/docs/utilities/useScrollPosition.md +3 -6
  195. package/dist/docs/utilities/useSearch.md +1 -3
  196. package/dist/docs/utilities/useSearchHighlight.md +1 -1
  197. package/dist/docs/utilities/useSorting.md +370 -239
  198. package/dist/docs/utilities/useStateWithValidation.md +1 -1
  199. package/dist/docs/utilities/useSum.md +1 -1
  200. package/dist/docs/utilities/useTableExport.md +364 -288
  201. package/dist/docs/utilities/useTableSelection.md +88 -92
  202. package/dist/docs/utilities/useTimeout.md +1 -1
  203. package/dist/docs/utilities/useToggle.md +1 -1
  204. package/dist/docs/utilities/useUrlState.md +1 -1
  205. package/dist/docs/utilities/useWindowResize.md +1 -1
  206. package/dist/index.mjs +173 -69
  207. package/dist/search-synonyms.json +214 -76
  208. package/dist/version.json +2 -2
  209. package/package.json +4 -5
  210. package/dist/docs/components/mapRouteGenerator.md +0 -6
  211. 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/featureToggles
6
- *Captured:* 2026-03-06T10:41:33.236Z
6
+ *Captured:* 2026-04-27T14:59:29.244Z
7
7
 
8
8
  URL-based feature toggles (also known as feature flags) are a powerful development technique that allows you to enable or disable features in your application dynamically, without deploying new code.
9
9
 
@@ -16,6 +16,10 @@ The feature toggle detection system in your application is designed to handle th
16
16
  - URL Query Parameters Toggles can be passed through the URL as query parameters (e.g., ?ft_demo=true), allowing for easy testing or overriding of features without modifying code
17
17
  - LocalStorage If a toggle is not present in the URL, the system falls back to using stored values in the browser's localStorage, ensuring that user preferences or feature states are preserved across sessions
18
18
 
19
+ Toggles can be passed through the URL as query parameters (e.g., ?ft_demo=true), allowing for easy testing or overriding of features without modifying code
20
+
21
+ If a toggle is not present in the URL, the system falls back to using stored values in the browser's localStorage, ensuring that user preferences or feature states are preserved across sessions
22
+
19
23
  ## Defining feature toggles
20
24
 
21
25
  Feature toggles are defined in a centralized configuration map, with each toggle specifying its corresponding query parameter name, its data type (boolean, string, or number) and an optional default value. This allows you to easily configure new toggles.
@@ -47,6 +51,126 @@ oldToggles
47
51
  );
48
52
  ```
49
53
 
54
+ import
55
+
56
+ {
57
+
58
+ ,
59
+
60
+ ,
61
+
62
+ ,
63
+
64
+ }
65
+
66
+ from
67
+
68
+ '@rio-cloud/rio-uikit/urlFeatureToggles'
69
+
70
+ ;
71
+
72
+ // Define old toggles to clean up
73
+
74
+ const
75
+
76
+ =
77
+
78
+ [
79
+
80
+ 'ft_eventTeaser'
81
+
82
+ ,
83
+
84
+ 'ft_survey'
85
+
86
+ ,
87
+
88
+ 'ft_menu'
89
+
90
+ ]
91
+
92
+ ;
93
+
94
+ // Define toggle transformation functions with their respective names and
95
+
96
+ // export the detected feature toggles as a singleton
97
+
98
+ export
99
+
100
+ const
101
+
102
+ =
103
+
104
+ detectFeatureToggles
105
+
106
+ (
107
+
108
+ {
109
+
110
+ :
111
+
112
+ asString
113
+
114
+ (
115
+
116
+ 'ft_enforceLocale'
117
+
118
+ )
119
+
120
+ ,
121
+
122
+ :
123
+
124
+ asBoolean
125
+
126
+ (
127
+
128
+ 'ft_tracing'
129
+
130
+ )
131
+
132
+ ,
133
+
134
+ :
135
+
136
+ asBooleanWithDefault
137
+
138
+ (
139
+
140
+ 'ft_demo'
141
+
142
+ ,
143
+
144
+ false
145
+
146
+ )
147
+
148
+ ,
149
+
150
+ :
151
+
152
+ asNumberWithDefault
153
+
154
+ (
155
+
156
+ 'ft_maxItems'
157
+
158
+ ,
159
+
160
+ 10
161
+
162
+ )
163
+
164
+ ,
165
+
166
+ }
167
+
168
+ ,
169
+
170
+ )
171
+
172
+ ;
173
+
50
174
  **Default values**
51
175
 
52
176
  For each type of transformer there is a *WithDefault variant. This function accepts a default value as second parameter. The default value is only returned if neither the query parameter nor the local storage contain a value for the feature toggle. A feature toggle with a default value will never be null. This fact is also reflected in the type of the feature toggle properties in the object returned by detectFeatureToggles.
@@ -63,6 +187,40 @@ oldToggles,
63
187
  );
64
188
  ```
65
189
 
190
+ export
191
+
192
+ const
193
+
194
+ =
195
+
196
+ detectFeatureToggles
197
+
198
+ (
199
+
200
+ {
201
+
202
+ :
203
+
204
+ asBoolean
205
+
206
+ (
207
+
208
+ 'ft_demo'
209
+
210
+ )
211
+
212
+ }
213
+
214
+ ,
215
+
216
+ ,
217
+
218
+ 'myCustomPrefix.'
219
+
220
+ )
221
+
222
+ ;
223
+
66
224
  ## Usage
67
225
 
68
226
  Suppose you want to enable or disable a demo mode in your application. You can pass ?ft_demo=true in the URL or rely on the value previously stored in localStorage.
@@ -82,9 +240,31 @@ if (featureToggles.demo) {
82
240
  }
83
241
  ```
84
242
 
243
+ if
244
+
245
+ (
246
+
247
+ .
248
+
249
+ )
250
+
251
+ {
252
+
253
+ // Render demo feature
254
+
255
+ }
256
+
85
257
  ## Benefits
86
258
 
87
259
  - Flexibility This approach allows toggles to be easily overridden via URL for testing or debugging purposes without changing the codebase
88
260
  - Persistence By leveraging localStorage, feature toggles persist across browser sessions, ensuring a consistent experience for users
89
261
  - Type safety Type transformation functions (asBoolean, asString, asNumber) ensure that toggles are correctly interpreted based on the expected data type
90
- - Clean state management Unused toggles can be cleaned up from localStorage, ensuring there is no unnecessary buildup of outdated data
262
+ - Clean state management Unused toggles can be cleaned up from localStorage, ensuring there is no unnecessary buildup of outdated data
263
+
264
+ This approach allows toggles to be easily overridden via URL for testing or debugging purposes without changing the codebase
265
+
266
+ By leveraging localStorage, feature toggles persist across browser sessions, ensuring a consistent experience for users
267
+
268
+ Type transformation functions (asBoolean, asString, asNumber) ensure that toggles are correctly interpreted based on the expected data type
269
+
270
+ Unused toggles can be cleaned up from localStorage, ensuring there is no unnecessary buildup of outdated data
@@ -3,7 +3,7 @@
3
3
  *Category:* Utilities
4
4
  *Section:* Helper
5
5
  *Source:* https://uikit.developers.rio.cloud/#/utilities/fuelTypeUtils
6
- *Captured:* 2026-03-06T10:41:32.458Z
6
+ *Captured:* 2026-04-27T14:59:28.552Z
7
7
 
8
8
  There is a wide variety of standardized fuel types, and on top of that, some projects or systems introduce their own custom definitions. While the naming can differ, many of these values carry the same semantic meaning. To avoid confusion and ensure consistent visual representation, we provide a centralized mapping of fuel types to icons.
9
9
 
@@ -53,38 +53,36 @@ Unknown paired fuel icon
53
53
  import Rioglyph from '@rio-cloud/rio-uikit/Rioglyph';
54
54
  import { getFuelIcon } from '@rio-cloud/rio-uikit/fuelTypeUtils';
55
55
 
56
- export default () => {
57
- return (
58
- <div className='display-flex flex-column gap-15'>
59
- <div>
60
- <label>Single rioglyph fuel icon</label>
61
- <div className='display-flex gap-5 align-items-center text-size-20'>
62
- This is a diesel truck <span className={`rioglyph ${getFuelIcon('diesel')}`} />
63
- </div>
64
- <div className='display-flex gap-5 align-items-center text-size-20'>
65
- This is a gasoline truck <span className={`rioglyph ${getFuelIcon('gas')}`} />
66
- </div>
67
- <div className='display-flex gap-5 align-items-center text-size-20'>
68
- This is an electric bus <span className={`rioglyph ${getFuelIcon('electric')}`} />
69
- </div>
56
+ export default () => (
57
+ <div className='display-flex flex-column gap-15'>
58
+ <div>
59
+ <label>Single rioglyph fuel icon</label>
60
+ <div className='display-flex gap-5 align-items-center text-size-20'>
61
+ This is a diesel truck <span className={`rioglyph ${getFuelIcon('diesel')}`} />
70
62
  </div>
71
- <div>
72
- <label>Paired rioglyph fuel icon</label>
73
- <div className='display-flex gap-10'>
74
- <Rioglyph size='h1' icon={'rioglyph-truck'} pairIcon={getFuelIcon('diesel')} />
75
- <Rioglyph size='h1' icon={'rioglyph-truck'} pairIcon={getFuelIcon('gas')} />
76
- <Rioglyph size='h1' icon={'rioglyph-bus'} pairIcon={getFuelIcon('electric')} />
77
- </div>
63
+ <div className='display-flex gap-5 align-items-center text-size-20'>
64
+ This is a gasoline truck <span className={`rioglyph ${getFuelIcon('gas')}`} />
78
65
  </div>
79
- <div>
80
- <label>Unknown paired fuel icon</label>
81
- <div className='display-flex gap-10'>
82
- <Rioglyph size='h1' icon={'rioglyph-truck'} pairIcon={getFuelIcon('whatever')} />
83
- </div>
66
+ <div className='display-flex gap-5 align-items-center text-size-20'>
67
+ This is an electric bus <span className={`rioglyph ${getFuelIcon('electric')}`} />
84
68
  </div>
85
69
  </div>
86
- );
87
- };
70
+ <div>
71
+ <label>Paired rioglyph fuel icon</label>
72
+ <div className='display-flex gap-10'>
73
+ <Rioglyph size='h1' icon={'rioglyph-truck'} pairIcon={getFuelIcon('diesel')} />
74
+ <Rioglyph size='h1' icon={'rioglyph-truck'} pairIcon={getFuelIcon('gas')} />
75
+ <Rioglyph size='h1' icon={'rioglyph-bus'} pairIcon={getFuelIcon('electric')} />
76
+ </div>
77
+ </div>
78
+ <div>
79
+ <label>Unknown paired fuel icon</label>
80
+ <div className='display-flex gap-10'>
81
+ <Rioglyph size='h1' icon={'rioglyph-truck'} pairIcon={getFuelIcon('whatever')} />
82
+ </div>
83
+ </div>
84
+ </div>
85
+ );
88
86
  ```
89
87
 
90
88
  #### HTML (html)
@@ -0,0 +1,322 @@
1
+ # Google Analytics Utils
2
+
3
+ *Category:* Utilities
4
+ *Section:* Helper
5
+ *Source:* https://uikit.developers.rio.cloud/#/utilities/getTrackingAttributes
6
+ *Captured:* 2026-04-27T14:59:29.682Z
7
+
8
+ Utility helpers for Google Analytics integration, including attribute generation and push helpers.
9
+
10
+ ## Google Analytics Utils
11
+
12
+ Use these helpers to create consistent tracking attributes, push events intowindow.dataLayer, and wrap business logic with tracking in one call.
13
+
14
+ > Important: getTrackingAttributes is the preferred and required way to add GA tracking attributes to UI elements in this project. AnalyticsAnalysisOverlay only works when elements use thedata-track-ga-event-* attributes.
15
+
16
+ ## Available helpers
17
+
18
+ NameExampleDescriptiongetTrackingAttributes(...)getTrackingAttributes({ trigger: 'click', category: 'demo' })Creates the data-track-ga-event-* attributes for declarative tracking on DOM elements. This is the preferred approach for UI elements.gaPush(...)gaPush({ category: 'demo', action: 'click', label: 'cta' })Pushes an event into window.dataLayer programmatically. Use this when tracking should happen from imperative code, including hover interactions.executeAndTrack(...)executeAndTrack(myFn, { category: 'demo', action: 'run', label: 'myFn' })Wraps a function so it still runs normally and also sends a GA event afterward. Useful when you want tracking and business logic wired together in one call.
19
+
20
+ ## Tracking attributesRecommended
21
+
22
+ Tracking attributes
23
+
24
+ > Recommended
25
+
26
+ **TRACKING_TRIGGER**
27
+
28
+ TRACKING_TRIGGER defines the allowed values for trigger ingetTrackingAttributes.
29
+
30
+ ```typescript
31
+ type TRACKING_TRIGGER = 'click' | 'visibility';
32
+ ```
33
+
34
+ type
35
+
36
+ TRACKING_TRIGGER
37
+
38
+ =
39
+
40
+ 'click'
41
+
42
+ |
43
+
44
+ 'visibility'
45
+
46
+ ;
47
+
48
+ Hover is intentionally not part of TRACKING_TRIGGER. If you need to track hover interactions, send the event programmatically with gaPush or executeAndTrackfrom the relevant UI callback.
49
+
50
+ | Trigger | Use for |
51
+ | --- | --- |
52
+ | click | User actively clicks an element (buttons, links, controls). |
53
+ | visibility | Element becomes visible in the viewport. |
54
+
55
+ **TRACKING_ACTIONS and TRACKING_LABELS**
56
+
57
+ These exports are optional app-level maps that consuming applications can fill with shared action and label values. They are configuration points, not required runtime state.
58
+
59
+ ```typescript
60
+ TRACKING_ACTIONS.dialogClose = 'dialog clicked';
61
+ TRACKING_LABELS.dialogClose = 'Dialog closed via close button';
62
+ ```
63
+
64
+ TRACKING_ACTIONS
65
+
66
+ .
67
+
68
+ =
69
+
70
+ 'dialog clicked'
71
+
72
+ ;
73
+
74
+ TRACKING_LABELS
75
+
76
+ .
77
+
78
+ =
79
+
80
+ 'Dialog closed via close button'
81
+
82
+ ;
83
+
84
+ ### Example: getTrackingAttributes()
85
+
86
+ getTrackingAttributes()
87
+ click visibility Disable value Tracked button {
88
+ "data-track-ga-event-trigger": "click",
89
+ "data-track-ga-event-category": "uikit demo",
90
+ "data-track-ga-event-action": "button click",
91
+ "data-track-ga-event-label": "utility_getTrackingAttributes_demo",
92
+ "data-track-ga-event-value": "1"
93
+ }
94
+
95
+ #### React (tsx)
96
+
97
+ ```tsx
98
+ import { useMemo, useState } from 'react';
99
+
100
+ import Button from '@rio-cloud/rio-uikit/Button';
101
+ import { getTrackingAttributes, type TRACKING_TRIGGER } from '@rio-cloud/rio-uikit/googleAnalyticsUtils';
102
+
103
+ const triggerOptions: TRACKING_TRIGGER[] = ['click', 'visibility'];
104
+
105
+ const GoogleAnalyticsUtilsExample = () => {
106
+ const [trigger, setTrigger] = useState<TRACKING_TRIGGER>('click');
107
+ const [includeValue, setIncludeValue] = useState(true);
108
+
109
+ const trackingAttributes = useMemo(
110
+ () =>
111
+ getTrackingAttributes({
112
+ trigger,
113
+ category: 'uikit demo',
114
+ action: `button ${trigger}`,
115
+ label: 'utility_getTrackingAttributes_demo',
116
+ value: includeValue ? '1' : undefined,
117
+ }),
118
+ [includeValue, trigger]
119
+ );
120
+
121
+ return (
122
+ <div className='bg-white border rounded padding-15'>
123
+ <h4 className='margin-top-0'>getTrackingAttributes()</h4>
124
+ <div className='display-flex gap-10 margin-bottom-15'>
125
+ {triggerOptions.map(option => (
126
+ <Button
127
+ key={option}
128
+ bsSize='xs'
129
+ bsStyle='default'
130
+ className={option === trigger ? 'active' : ''}
131
+ onClick={() => setTrigger(option)}
132
+ >
133
+ {option}
134
+ </Button>
135
+ ))}
136
+ <Button bsSize='xs' bsStyle='default' onClick={() => setIncludeValue(previousValue => !previousValue)}>
137
+ {includeValue ? 'Disable value' : 'Enable value'}
138
+ </Button>
139
+ </div>
140
+
141
+ <Button bsStyle='primary' {...trackingAttributes}>
142
+ Tracked button
143
+ </Button>
144
+
145
+ <pre className='margin-top-15 bg-white border rounded padding-10 text-size-12'>
146
+ {JSON.stringify(trackingAttributes, null, 2)}
147
+ </pre>
148
+ </div>
149
+ );
150
+ };
151
+
152
+ export default GoogleAnalyticsUtilsExample;
153
+ ```
154
+
155
+ #### HTML (html)
156
+
157
+ ```html
158
+ <div class="bg-white border rounded padding-15">
159
+ <h4 class="margin-top-0">getTrackingAttributes()</h4>
160
+ <div class="display-flex gap-10 margin-bottom-15">
161
+ <button type="button" class="btn btn-default btn-xs btn-component active" tabindex="0">click</button>
162
+ <button type="button" class="btn btn-default btn-xs btn-component" tabindex="0">visibility</button>
163
+ <button type="button" class="btn btn-default btn-xs btn-component" tabindex="0">Disable value</button>
164
+ </div>
165
+ <button type="button" data-track-ga-event-trigger="click" data-track-ga-event-category="uikit demo" data-track-ga-event-action="button click" data-track-ga-event-label="utility_getTrackingAttributes_demo" data-track-ga-event-value="1" class="btn btn-primary btn-component" tabindex="0">Tracked button</button>
166
+ <pre class="margin-top-15 bg-white border rounded padding-10 text-size-12">{
167
+ "data-track-ga-event-trigger": "click",
168
+ "data-track-ga-event-category": "uikit demo",
169
+ "data-track-ga-event-action": "button click",
170
+ "data-track-ga-event-label": "utility_getTrackingAttributes_demo",
171
+ "data-track-ga-event-value": "1"
172
+ }</pre>
173
+ </div>
174
+ ```
175
+
176
+ ## Imperative tracking
177
+
178
+ ### Example: gaPush() and executeAndTrack()
179
+
180
+ gaPush() and executeAndTrack()
181
+ Use gaPush for direct imperative tracking, including hover interactions. Use executeAndTrack when the event should always be emitted together with a function call.
182
+ click visibility hover Disable value
183
+ Push event with gaPush executeAndTrack counter: 0 Clear dataLayer
184
+ []
185
+
186
+ #### React (tsx)
187
+
188
+ ```tsx
189
+ import { useMemo, useState } from 'react';
190
+
191
+ import Button from '@rio-cloud/rio-uikit/Button';
192
+ import { executeAndTrack, gaPush } from '@rio-cloud/rio-uikit/googleAnalyticsUtils';
193
+
194
+ type GaPushInteraction = 'click' | 'visibility' | 'hover';
195
+
196
+ const interactionOptions: GaPushInteraction[] = ['click', 'visibility', 'hover'];
197
+
198
+ const getDataLayer = () => {
199
+ if (typeof window === 'undefined') {
200
+ return [] as unknown[];
201
+ }
202
+
203
+ if (!Array.isArray(window.dataLayer)) {
204
+ window.dataLayer = [];
205
+ }
206
+
207
+ return window.dataLayer;
208
+ };
209
+
210
+ const GoogleAnalyticsUtilsGaPushExample = () => {
211
+ const [interaction, setInteraction] = useState<GaPushInteraction>('click');
212
+ const [includeValue, setIncludeValue] = useState(true);
213
+ const [dataLayerSnapshot, setDataLayerSnapshot] = useState<unknown[]>(() => [...getDataLayer()]);
214
+ const [trackedCounter, setTrackedCounter] = useState(0);
215
+
216
+ const refreshDataLayer = () => {
217
+ setDataLayerSnapshot([...getDataLayer()]);
218
+ };
219
+
220
+ const trackedIncrement = useMemo(
221
+ () =>
222
+ executeAndTrack((value: number) => value + 1, {
223
+ category: 'uikit demo',
224
+ action: 'button click',
225
+ label: 'utility_executeAndTrack_demo',
226
+ value: 1,
227
+ }),
228
+ []
229
+ );
230
+
231
+ const handleGaPush = () => {
232
+ gaPush({
233
+ category: 'uikit demo',
234
+ action: `manual ${interaction}`,
235
+ label: 'utility_gaPush_demo',
236
+ value: includeValue ? 1 : undefined,
237
+ });
238
+
239
+ refreshDataLayer();
240
+ };
241
+
242
+ const handleExecuteAndTrack = () => {
243
+ const nextValue = trackedIncrement(trackedCounter);
244
+ setTrackedCounter(nextValue);
245
+ refreshDataLayer();
246
+ };
247
+
248
+ const handleClearDataLayer = () => {
249
+ if (typeof window !== 'undefined') {
250
+ window.dataLayer = [];
251
+ }
252
+
253
+ refreshDataLayer();
254
+ };
255
+
256
+ return (
257
+ <div className='bg-white border rounded padding-15'>
258
+ <h4 className='margin-top-0'>gaPush() and executeAndTrack()</h4>
259
+ <p className='margin-bottom-15'>
260
+ Use <code>gaPush</code> for direct imperative tracking, including hover interactions. Use
261
+ <code>executeAndTrack</code> when the event should always be emitted together with a function call.
262
+ </p>
263
+
264
+ <div className='display-flex gap-10 margin-bottom-15'>
265
+ {interactionOptions.map(option => (
266
+ <Button
267
+ key={option}
268
+ bsSize='xs'
269
+ bsStyle='default'
270
+ className={option === interaction ? 'active' : ''}
271
+ onClick={() => setInteraction(option)}
272
+ >
273
+ {option}
274
+ </Button>
275
+ ))}
276
+ <Button bsSize='xs' bsStyle='default' onClick={() => setIncludeValue(previousValue => !previousValue)}>
277
+ {includeValue ? 'Disable value' : 'Enable value'}
278
+ </Button>
279
+ </div>
280
+
281
+ <div className='display-flex gap-10 margin-bottom-15'>
282
+ <Button bsStyle='default' onClick={handleGaPush}>
283
+ Push event with gaPush
284
+ </Button>
285
+ <Button bsStyle='default' onClick={handleExecuteAndTrack}>
286
+ executeAndTrack counter: {trackedCounter}
287
+ </Button>
288
+ <Button bsStyle='muted' onClick={handleClearDataLayer}>
289
+ Clear dataLayer
290
+ </Button>
291
+ </div>
292
+
293
+ <pre className='bg-white border rounded padding-10 margin-bottom-0 text-size-12'>
294
+ {JSON.stringify(dataLayerSnapshot, null, 2)}
295
+ </pre>
296
+ </div>
297
+ );
298
+ };
299
+
300
+ export default GoogleAnalyticsUtilsGaPushExample;
301
+ ```
302
+
303
+ #### HTML (html)
304
+
305
+ ```html
306
+ <div class="bg-white border rounded padding-15">
307
+ <h4 class="margin-top-0">gaPush() and executeAndTrack()</h4>
308
+ <p class="margin-bottom-15">Use <code>gaPush</code> for direct imperative tracking, including hover interactions. Use<code>executeAndTrack</code> when the event should always be emitted together with a function call.</p>
309
+ <div class="display-flex gap-10 margin-bottom-15">
310
+ <button type="button" class="btn btn-default btn-xs btn-component active" tabindex="0">click</button>
311
+ <button type="button" class="btn btn-default btn-xs btn-component" tabindex="0">visibility</button>
312
+ <button type="button" class="btn btn-default btn-xs btn-component" tabindex="0">hover</button>
313
+ <button type="button" class="btn btn-default btn-xs btn-component" tabindex="0">Disable value</button>
314
+ </div>
315
+ <div class="display-flex gap-10 margin-bottom-15">
316
+ <button type="button" class="btn btn-default btn-component" tabindex="0">Push event with gaPush</button>
317
+ <button type="button" class="btn btn-default btn-component" tabindex="0">executeAndTrack counter: 0</button>
318
+ <button type="button" class="btn btn-muted btn-component" tabindex="0">Clear dataLayer</button>
319
+ </div>
320
+ <pre class="bg-white border rounded padding-10 margin-bottom-0 text-size-12">[]</pre>
321
+ </div>
322
+ ```