@rio-cloud/uikit-mcp 1.0.1 → 1.1.1
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 +75 -39
- package/dist/doc-metadata.json +1872 -0
- package/dist/docs/components/accentBar.md +582 -0
- package/dist/docs/components/activity.md +330 -0
- package/dist/docs/components/animatedNumber.md +88 -0
- package/dist/docs/components/animatedTextReveal.md +381 -0
- package/dist/docs/components/animations.md +459 -0
- package/dist/docs/components/appHeader.md +737 -0
- package/dist/docs/components/appLayout.md +2033 -0
- package/dist/docs/components/appNavigationBar.md +274 -0
- package/dist/docs/components/areaCharts.md +828 -0
- package/dist/docs/components/aspectRatioPlaceholder.md +106 -0
- package/dist/docs/components/assetTree.md +3132 -0
- package/dist/docs/components/autosuggests.md +1177 -0
- package/dist/docs/components/avatar.md +206 -0
- package/dist/docs/components/banner.md +668 -0
- package/dist/docs/components/barCharts.md +2765 -0
- package/dist/docs/components/barList.md +517 -0
- package/dist/docs/components/basicMap.md +167 -0
- package/dist/docs/components/bottomSheet.md +721 -0
- package/dist/docs/components/button.md +775 -0
- package/dist/docs/components/buttonToolbar.md +134 -0
- package/dist/docs/components/calendarStripe.md +533 -0
- package/dist/docs/components/card.md +86 -0
- package/dist/docs/components/carousel.md +128 -0
- package/dist/docs/components/chartColors.md +716 -0
- package/dist/docs/components/chartsGettingStarted.md +28 -0
- package/dist/docs/components/chat.md +935 -0
- package/dist/docs/components/checkbox.md +996 -0
- package/dist/docs/components/clearableInput.md +806 -0
- package/dist/docs/components/collapse.md +189 -0
- package/dist/docs/components/composedCharts.md +424 -0
- package/dist/docs/components/contentLoader.md +674 -0
- package/dist/docs/components/dataTabs.md +1251 -0
- package/dist/docs/components/datepickers.md +2543 -0
- package/dist/docs/components/dialogs.md +2244 -0
- package/dist/docs/components/divider.md +219 -0
- package/dist/docs/components/dropdowns.md +17538 -0
- package/dist/docs/components/editableContent.md +1127 -0
- package/dist/docs/components/expander.md +970 -0
- package/dist/docs/components/fade.md +836 -0
- package/dist/docs/components/fadeExpander.md +180 -0
- package/dist/docs/components/fadeUp.md +396 -0
- package/dist/docs/components/feedback.md +758 -0
- package/dist/docs/components/filePickers.md +370 -0
- package/dist/docs/components/formLabel.md +251 -0
- package/dist/docs/components/fullscreenMap.md +10 -0
- package/dist/docs/components/groupedItemList.md +1001 -0
- package/dist/docs/components/iconList.md +306 -0
- package/dist/docs/components/imagePreloader.md +167 -0
- package/dist/docs/components/labeledElement.md +115 -0
- package/dist/docs/components/licensePlate.md +412 -0
- package/dist/docs/components/lineCharts.md +2014 -0
- package/dist/docs/components/listMenu.md +392 -0
- package/dist/docs/components/loadMore.md +219 -0
- package/dist/docs/components/mainNavigation.md +129 -0
- package/dist/docs/components/mapCircle.md +93 -0
- package/dist/docs/components/mapCluster.md +337 -0
- package/dist/docs/components/mapContext.md +284 -0
- package/dist/docs/components/mapDraggableMarker.md +150 -0
- package/dist/docs/components/mapGettingStarted.md +39 -0
- package/dist/docs/components/mapInfoBubble.md +135 -0
- package/dist/docs/components/mapLayerGroup.md +94 -0
- package/dist/docs/components/mapMarker.md +1814 -0
- package/dist/docs/components/mapPolygon.md +959 -0
- package/dist/docs/components/mapRoute.md +3816 -0
- package/dist/docs/components/mapRouteGenerator.md +6 -0
- package/dist/docs/components/mapSettings.md +1040 -0
- package/dist/docs/components/mapUtils.md +132 -0
- package/dist/docs/components/multiselects.md +1921 -0
- package/dist/docs/components/noData.md +210 -0
- package/dist/docs/components/notifications.md +314 -0
- package/dist/docs/components/numbercontrol.md +706 -0
- package/dist/docs/components/onboarding.md +297 -0
- package/dist/docs/components/page.md +241 -0
- package/dist/docs/components/pager.md +133 -0
- package/dist/docs/components/pieCharts.md +1284 -0
- package/dist/docs/components/popover.md +222 -0
- package/dist/docs/components/position.md +50 -0
- package/dist/docs/components/radialBarCharts.md +3663 -0
- package/dist/docs/components/radiobutton.md +1271 -0
- package/dist/docs/components/releaseNotes.md +135 -0
- package/dist/docs/components/resizer.md +162 -0
- package/dist/docs/components/responsiveColumnStripe.md +435 -0
- package/dist/docs/components/responsiveVideo.md +71 -0
- package/dist/docs/components/rioglyph.md +331 -0
- package/dist/docs/components/rules.md +965 -0
- package/dist/docs/components/saveableInput.md +1721 -0
- package/dist/docs/components/selects.md +1993 -0
- package/dist/docs/components/sidebar.md +332 -0
- package/dist/docs/components/sliders.md +376 -0
- package/dist/docs/components/smoothScrollbars.md +1180 -0
- package/dist/docs/components/spinners.md +506 -0
- package/dist/docs/components/states.md +1176 -0
- package/dist/docs/components/statsWidgets.md +636 -0
- package/dist/docs/components/statusBar.md +644 -0
- package/dist/docs/components/stepButton.md +61 -0
- package/dist/docs/components/steppedProgressBars.md +1064 -0
- package/dist/docs/components/subNavigation.md +470 -0
- package/dist/docs/components/supportMarker.md +115 -0
- package/dist/docs/components/svgImage.md +248 -0
- package/dist/docs/components/switch.md +554 -0
- package/dist/docs/components/tables.md +8 -0
- package/dist/docs/components/tagManager.md +476 -0
- package/dist/docs/components/tags.md +785 -0
- package/dist/docs/components/teaser.md +925 -0
- package/dist/docs/components/timeline.md +514 -0
- package/dist/docs/components/timepicker.md +262 -0
- package/dist/docs/components/toggleButton.md +178 -0
- package/dist/docs/components/tooltip.md +454 -0
- package/dist/docs/components/virtualList.md +486 -0
- package/dist/docs/foundations.md +20901 -0
- package/dist/docs/start/changelog.md +714 -0
- package/dist/docs/start/goodtoknow.md +14 -0
- package/dist/docs/start/guidelines/color-combinations.md +678 -0
- package/dist/docs/start/guidelines/custom-css.md +42 -0
- package/dist/docs/start/guidelines/custom-rioglyph.md +35 -0
- package/dist/docs/start/guidelines/formatting.md +587 -0
- package/dist/docs/start/guidelines/iframe.md +323 -0
- package/dist/docs/start/guidelines/obfuscate-data.md +30 -0
- package/dist/docs/start/guidelines/print-css.md +36 -0
- package/dist/docs/start/guidelines/spinner.md +710 -0
- package/dist/docs/start/guidelines/supported-browsers.md +10 -0
- package/dist/docs/start/guidelines/writing.md +635 -0
- package/dist/docs/start/howto.md +187 -0
- package/dist/docs/start/intro.md +43 -0
- package/dist/docs/start/responsiveness.md +98 -0
- package/dist/docs/templates/common-table.md +1111 -0
- package/dist/docs/templates/detail-views.md +942 -0
- package/dist/docs/templates/expandable-details.md +228 -0
- package/dist/docs/templates/feature-cards.md +549 -0
- package/dist/docs/templates/form-summary.md +199 -0
- package/dist/docs/templates/form-toggle.md +367 -0
- package/dist/docs/templates/list-blocks.md +1021 -0
- package/dist/docs/templates/loading-progress.md +109 -0
- package/dist/docs/templates/options-panel.md +152 -0
- package/dist/docs/templates/panel-variants.md +164 -0
- package/dist/docs/templates/progress-cards.md +607 -0
- package/dist/docs/templates/progress-success.md +142 -0
- package/dist/docs/templates/settings-form.md +434 -0
- package/dist/docs/templates/stats-blocks.md +1381 -0
- package/dist/docs/templates/table-panel.md +184 -0
- package/dist/docs/templates/table-row-animation.md +317 -0
- package/dist/docs/templates/usage-cards.md +227 -0
- package/dist/docs/utilities/deviceUtils.md +123 -0
- package/dist/docs/utilities/featureToggles.md +90 -0
- package/dist/docs/utilities/fuelTypeUtils.md +186 -0
- package/dist/docs/utilities/routeUtils.md +138 -0
- package/dist/docs/utilities/useAfterMount.md +66 -0
- package/dist/docs/utilities/useAutoAnimate.md +193 -0
- package/dist/docs/utilities/useAverage.md +95 -0
- package/dist/docs/utilities/useClickOutside.md +61 -0
- package/dist/docs/utilities/useClipboard.md +93 -0
- package/dist/docs/utilities/useCount.md +178 -0
- package/dist/docs/utilities/useDarkMode.md +49 -0
- package/dist/docs/utilities/useDebugInfo.md +126 -0
- package/dist/docs/utilities/useEffectOnce.md +58 -0
- package/dist/docs/utilities/useElapsedTime.md +58 -0
- package/dist/docs/utilities/useElementSize.md +71 -0
- package/dist/docs/utilities/useEsc.md +58 -0
- package/dist/docs/utilities/useEvent.md +64 -0
- package/dist/docs/utilities/useFocusTrap.md +85 -0
- package/dist/docs/utilities/useFullscreen.md +198 -0
- package/dist/docs/utilities/useHover.md +55 -0
- package/dist/docs/utilities/useIncomingPostMessages.md +237 -0
- package/dist/docs/utilities/useInterval.md +85 -0
- package/dist/docs/utilities/useIsFocusWithin.md +114 -0
- package/dist/docs/utilities/useKey.md +151 -0
- package/dist/docs/utilities/useLocalStorage.md +91 -0
- package/dist/docs/utilities/useLocationSuggestions.md +114 -0
- package/dist/docs/utilities/useMax.md +62 -0
- package/dist/docs/utilities/useMin.md +78 -0
- package/dist/docs/utilities/useMutationObserver.md +113 -0
- package/dist/docs/utilities/useOnScreen.md +138 -0
- package/dist/docs/utilities/useOnlineStatus.md +49 -0
- package/dist/docs/utilities/usePostMessage.md +117 -0
- package/dist/docs/utilities/usePostMessageSender.md +257 -0
- package/dist/docs/utilities/usePrevious.md +101 -0
- package/dist/docs/utilities/useResizeObserver.md +151 -0
- package/dist/docs/utilities/useScrollPosition.md +252 -0
- package/dist/docs/utilities/useSearch.md +228 -0
- package/dist/docs/utilities/useSorting.md +389 -0
- package/dist/docs/utilities/useStateWithValidation.md +83 -0
- package/dist/docs/utilities/useSum.md +155 -0
- package/dist/docs/utilities/useTableExport.md +404 -0
- package/dist/docs/utilities/useTableSelection.md +1120 -0
- package/dist/docs/utilities/useTimeout.md +55 -0
- package/dist/docs/utilities/useToggle.md +115 -0
- package/dist/docs/utilities/useWindowResize.md +70 -0
- package/dist/index.mjs +271 -0
- package/dist/search-synonyms.json +134 -0
- package/dist/version.json +4 -0
- package/package.json +23 -19
- package/bin/uikit-mcp.mjs +0 -23
- package/data/pages/Components/components/accentbar.json +0 -207
- package/data/pages/Components/components/activity.json +0 -87
- package/data/pages/Components/components/animatednumber.json +0 -99
- package/data/pages/Components/components/animations.json +0 -87
- package/data/pages/Components/components/appheader.json +0 -291
- package/data/pages/Components/components/applayout.json +0 -1198
- package/data/pages/Components/components/appnavigationbar.json +0 -327
- package/data/pages/Components/components/areacharts.json +0 -563
- package/data/pages/Components/components/aspectratioplaceholder.json +0 -75
- package/data/pages/Components/components/assettree.json +0 -3080
- package/data/pages/Components/components/autosuggests.json +0 -710
- package/data/pages/Components/components/avatar.json +0 -157
- package/data/pages/Components/components/banner.json +0 -599
- package/data/pages/Components/components/barcharts.json +0 -1507
- package/data/pages/Components/components/barlist.json +0 -223
- package/data/pages/Components/components/basicmap.json +0 -68
- package/data/pages/Components/components/bottomsheet.json +0 -601
- package/data/pages/Components/components/button.json +0 -583
- package/data/pages/Components/components/buttontoolbar.json +0 -63
- package/data/pages/Components/components/calendarstripe.json +0 -235
- package/data/pages/Components/components/card.json +0 -69
- package/data/pages/Components/components/carousel.json +0 -39
- package/data/pages/Components/components/chartcolors.json +0 -34
- package/data/pages/Components/components/chartsgettingstarted.json +0 -32
- package/data/pages/Components/components/chat.json +0 -39
- package/data/pages/Components/components/checkbox.json +0 -847
- package/data/pages/Components/components/clearableinput.json +0 -789
- package/data/pages/Components/components/collapse.json +0 -175
- package/data/pages/Components/components/composedcharts.json +0 -159
- package/data/pages/Components/components/contentloader.json +0 -233
- package/data/pages/Components/components/datatabs.json +0 -680
- package/data/pages/Components/components/datepickers.json +0 -287
- package/data/pages/Components/components/dialogs.json +0 -1492
- package/data/pages/Components/components/divider.json +0 -93
- package/data/pages/Components/components/dropdowns.json +0 -936
- package/data/pages/Components/components/editablecontent.json +0 -1117
- package/data/pages/Components/components/expander.json +0 -377
- package/data/pages/Components/components/fade.json +0 -403
- package/data/pages/Components/components/fadeexpander.json +0 -75
- package/data/pages/Components/components/fadeup.json +0 -127
- package/data/pages/Components/components/feedback.json +0 -269
- package/data/pages/Components/components/filepickers.json +0 -269
- package/data/pages/Components/components/formlabel.json +0 -115
- package/data/pages/Components/components/fullscreenmap.json +0 -22
- package/data/pages/Components/components/groupeditemlist.json +0 -323
- package/data/pages/Components/components/iconlist.json +0 -45
- package/data/pages/Components/components/imagepreloader.json +0 -81
- package/data/pages/Components/components/labeledelement.json +0 -75
- package/data/pages/Components/components/licenseplate.json +0 -69
- package/data/pages/Components/components/linecharts.json +0 -987
- package/data/pages/Components/components/listmenu.json +0 -313
- package/data/pages/Components/components/loadmore.json +0 -175
- package/data/pages/Components/components/mainnavigation.json +0 -39
- package/data/pages/Components/components/mapcircle.json +0 -34
- package/data/pages/Components/components/mapcluster.json +0 -51
- package/data/pages/Components/components/mapcontext.json +0 -105
- package/data/pages/Components/components/mapdraggablemarker.json +0 -34
- package/data/pages/Components/components/mapgettingstarted.json +0 -27
- package/data/pages/Components/components/mapgroup.json +0 -1198
- package/data/pages/Components/components/mapinfobubble.json +0 -34
- package/data/pages/Components/components/maplayergroup.json +0 -34
- package/data/pages/Components/components/mapmarker.json +0 -700
- package/data/pages/Components/components/mappolygon.json +0 -45
- package/data/pages/Components/components/maproute.json +0 -623
- package/data/pages/Components/components/maproutegenerator.json +0 -16
- package/data/pages/Components/components/mapsettings.json +0 -51
- package/data/pages/Components/components/maputils.json +0 -34
- package/data/pages/Components/components/multiselects.json +0 -1451
- package/data/pages/Components/components/nodata.json +0 -139
- package/data/pages/Components/components/notifications.json +0 -65
- package/data/pages/Components/components/numbercontrol.json +0 -301
- package/data/pages/Components/components/onboarding.json +0 -302
- package/data/pages/Components/components/page.json +0 -197
- package/data/pages/Components/components/pager.json +0 -93
- package/data/pages/Components/components/piecharts.json +0 -731
- package/data/pages/Components/components/popover.json +0 -251
- package/data/pages/Components/components/position.json +0 -69
- package/data/pages/Components/components/radialbarcharts.json +0 -1304
- package/data/pages/Components/components/radiobutton.json +0 -1105
- package/data/pages/Components/components/releasenotes.json +0 -44
- package/data/pages/Components/components/resizer.json +0 -93
- package/data/pages/Components/components/responsivecolumnstripe.json +0 -123
- package/data/pages/Components/components/responsivevideo.json +0 -75
- package/data/pages/Components/components/rioglyph.json +0 -93
- package/data/pages/Components/components/rules.json +0 -410
- package/data/pages/Components/components/saveableinput.json +0 -703
- package/data/pages/Components/components/selects.json +0 -701
- package/data/pages/Components/components/sidebar.json +0 -243
- package/data/pages/Components/components/sliders.json +0 -235
- package/data/pages/Components/components/smoothscrollbars.json +0 -335
- package/data/pages/Components/components/spinners.json +0 -343
- package/data/pages/Components/components/states.json +0 -1705
- package/data/pages/Components/components/statswidgets.json +0 -314
- package/data/pages/Components/components/statusbar.json +0 -177
- package/data/pages/Components/components/stepbutton.json +0 -57
- package/data/pages/Components/components/steppedprogressbars.json +0 -417
- package/data/pages/Components/components/subnavigation.json +0 -107
- package/data/pages/Components/components/supportmarker.json +0 -45
- package/data/pages/Components/components/svgimage.json +0 -81
- package/data/pages/Components/components/switch.json +0 -111
- package/data/pages/Components/components/tables.json +0 -144
- package/data/pages/Components/components/tagmanager.json +0 -86
- package/data/pages/Components/components/tags.json +0 -146
- package/data/pages/Components/components/teaser.json +0 -188
- package/data/pages/Components/components/timeline.json +0 -45
- package/data/pages/Components/components/timepicker.json +0 -163
- package/data/pages/Components/components/togglebutton.json +0 -247
- package/data/pages/Components/components/tooltip.json +0 -270
- package/data/pages/Components/components/virtuallist.json +0 -175
- package/data/pages/Foundations/foundations.json +0 -2475
- package/data/pages/Getting-started/start/changelog.json +0 -22
- package/data/pages/Getting-started/start/goodtoknow.json +0 -32
- package/data/pages/Getting-started/start/guidelines/color-combinations.json +0 -58
- package/data/pages/Getting-started/start/guidelines/custom-css.json +0 -27
- package/data/pages/Getting-started/start/guidelines/custom-rioglyph.json +0 -22
- package/data/pages/Getting-started/start/guidelines/formatting.json +0 -97
- package/data/pages/Getting-started/start/guidelines/iframe.json +0 -93
- package/data/pages/Getting-started/start/guidelines/obfuscate-data.json +0 -22
- package/data/pages/Getting-started/start/guidelines/print-css.json +0 -37
- package/data/pages/Getting-started/start/guidelines/spinner.json +0 -144
- package/data/pages/Getting-started/start/guidelines/supported-browsers.json +0 -22
- package/data/pages/Getting-started/start/guidelines/writing.json +0 -242
- package/data/pages/Getting-started/start/howto.json +0 -72
- package/data/pages/Getting-started/start/intro.json +0 -37
- package/data/pages/Getting-started/start/responsiveness.json +0 -52
- package/data/pages/Templates/templates/common-table.json +0 -39
- package/data/pages/Templates/templates/detail-views.json +0 -71
- package/data/pages/Templates/templates/expandable-details.json +0 -39
- package/data/pages/Templates/templates/feature-cards.json +0 -103
- package/data/pages/Templates/templates/form-summary.json +0 -39
- package/data/pages/Templates/templates/form-toggle.json +0 -39
- package/data/pages/Templates/templates/list-blocks.json +0 -119
- package/data/pages/Templates/templates/loading-progress.json +0 -39
- package/data/pages/Templates/templates/options-panel.json +0 -39
- package/data/pages/Templates/templates/panel-variants.json +0 -39
- package/data/pages/Templates/templates/progress-cards.json +0 -71
- package/data/pages/Templates/templates/progress-success.json +0 -39
- package/data/pages/Templates/templates/settings-form.json +0 -39
- package/data/pages/Templates/templates/stats-blocks.json +0 -135
- package/data/pages/Templates/templates/table-panel.json +0 -39
- package/data/pages/Templates/templates/table-row-animation.json +0 -39
- package/data/pages/Templates/templates/usage-cards.json +0 -39
- package/data/pages/Utilities/utilities/deviceutils.json +0 -39
- package/data/pages/Utilities/utilities/featuretoggles.json +0 -42
- package/data/pages/Utilities/utilities/fueltypeutils.json +0 -118
- package/data/pages/Utilities/utilities/routeutils.json +0 -34
- package/data/pages/Utilities/utilities/useaftermount.json +0 -63
- package/data/pages/Utilities/utilities/useaverage.json +0 -86
- package/data/pages/Utilities/utilities/useclickoutside.json +0 -69
- package/data/pages/Utilities/utilities/useclipboard.json +0 -57
- package/data/pages/Utilities/utilities/usecount.json +0 -92
- package/data/pages/Utilities/utilities/usedarkmode.json +0 -50
- package/data/pages/Utilities/utilities/usedebuginfo.json +0 -63
- package/data/pages/Utilities/utilities/useeffectonce.json +0 -57
- package/data/pages/Utilities/utilities/useelapsedtime.json +0 -57
- package/data/pages/Utilities/utilities/useelementsize.json +0 -63
- package/data/pages/Utilities/utilities/useesc.json +0 -57
- package/data/pages/Utilities/utilities/useevent.json +0 -75
- package/data/pages/Utilities/utilities/usefocustrap.json +0 -57
- package/data/pages/Utilities/utilities/usefullscreen.json +0 -197
- package/data/pages/Utilities/utilities/usehover.json +0 -57
- package/data/pages/Utilities/utilities/useinterval.json +0 -63
- package/data/pages/Utilities/utilities/useisfocuswithin.json +0 -75
- package/data/pages/Utilities/utilities/usekey.json +0 -75
- package/data/pages/Utilities/utilities/uselocalstorage.json +0 -69
- package/data/pages/Utilities/utilities/uselocationsuggestions.json +0 -110
- package/data/pages/Utilities/utilities/usemax.json +0 -86
- package/data/pages/Utilities/utilities/usemin.json +0 -86
- package/data/pages/Utilities/utilities/usemutationobserver.json +0 -69
- package/data/pages/Utilities/utilities/useonlinestatus.json +0 -39
- package/data/pages/Utilities/utilities/useonscreen.json +0 -63
- package/data/pages/Utilities/utilities/usepostmessage.json +0 -80
- package/data/pages/Utilities/utilities/useprevious.json +0 -63
- package/data/pages/Utilities/utilities/useresizeobserver.json +0 -65
- package/data/pages/Utilities/utilities/usescrollposition.json +0 -103
- package/data/pages/Utilities/utilities/usesearch.json +0 -197
- package/data/pages/Utilities/utilities/usesorting.json +0 -139
- package/data/pages/Utilities/utilities/usestatewithvalidation.json +0 -69
- package/data/pages/Utilities/utilities/usesum.json +0 -86
- package/data/pages/Utilities/utilities/usetableexport.json +0 -87
- package/data/pages/Utilities/utilities/usetableselection.json +0 -311
- package/data/pages/Utilities/utilities/usetimeout.json +0 -63
- package/data/pages/Utilities/utilities/usetoggle.json +0 -75
- package/data/pages/Utilities/utilities/usewindowresize.json +0 -63
- package/data/version.json +0 -4
- package/docs/content-schema.md +0 -147
- package/docs/navigation-inventory.json +0 -1310
- package/docs/search-synonyms.json +0 -43
- package/server/index.mjs +0 -268
- package/server/lib/load-docs.mjs +0 -48
- package/server/lib/normalise-doc.mjs +0 -220
- package/server/lib/render-markdown.mjs +0 -82
- package/server/lib/search-index.mjs +0 -49
- package/server/lib/types.js +0 -99
|
@@ -0,0 +1,2244 @@
|
|
|
1
|
+
# Dialog
|
|
2
|
+
|
|
3
|
+
*Category:* Components
|
|
4
|
+
*Section:* Content
|
|
5
|
+
*Source:* https://uikit.developers.rio.cloud/#components/dialogs
|
|
6
|
+
*Captured:* 2025-12-12T14:20:50.101Z
|
|
7
|
+
|
|
8
|
+
This component allows the user to create a generic modal dialog.
|
|
9
|
+
|
|
10
|
+
## Dialog
|
|
11
|
+
|
|
12
|
+
You can create React nodes and pass those as title, body or footer props to the Dialog component.
|
|
13
|
+
|
|
14
|
+
### Example: Example 1
|
|
15
|
+
|
|
16
|
+
DialogSubtitle dialogLong dialogLong dialog with overflowDialog with overflow and light background
|
|
17
|
+
Dialog sizesSize xs (320px)Size sm (480px)Size md (768px - default)Size lg (1280px)Size xl (1440px)Size fullwidthSize fullheightSize fullheight lgSize fullheight xlSize fullscreen
|
|
18
|
+
|
|
19
|
+
#### Summary
|
|
20
|
+
|
|
21
|
+
DialogSubtitle dialogLong dialogLong dialog with overflowDialog with overflow and light background
|
|
22
|
+
Dialog sizesSize xs (320px)Size sm (480px)Size md (768px - default)Size lg (1280px)Size xl (1440px)Size fullwidthSize fullheightSize fullheight lgSize fullheight xlSize fullscreen
|
|
23
|
+
|
|
24
|
+
#### React (tsx)
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { useState } from 'react';
|
|
28
|
+
|
|
29
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
30
|
+
import Dialog from '@rio-cloud/rio-uikit/Dialog';
|
|
31
|
+
import Tooltip from '@rio-cloud/rio-uikit/Tooltip';
|
|
32
|
+
import OverlayTrigger from '@rio-cloud/rio-uikit/OverlayTrigger';
|
|
33
|
+
|
|
34
|
+
import { dummyTextExtraLong } from '../../../utils/data';
|
|
35
|
+
import { exampleTitle, exampleSubtitle, ExampleBody, exampleFullScreenBody, exampleFooter } from './DialogData';
|
|
36
|
+
|
|
37
|
+
export default () => {
|
|
38
|
+
const [showDialog, setShowDialog] = useState(false);
|
|
39
|
+
const [showSubtitleDialog, setShowSubtitleDialog] = useState(false);
|
|
40
|
+
const [showLongDialog, setShowLongDialog] = useState(false);
|
|
41
|
+
const [showLongOverflowDialog, setShowLongOverflowDialog] = useState(false);
|
|
42
|
+
const [showLongOverflow2Dialog, setShowLongOverflow2Dialog] = useState(false);
|
|
43
|
+
const [showSizeXSDialog, setShowSizeXSDialog] = useState(false);
|
|
44
|
+
const [showSizeSMDialog, setShowSizeSMDialog] = useState(false);
|
|
45
|
+
const [showSizeLGDialog, setShowSizeLGDialog] = useState(false);
|
|
46
|
+
const [showSizeXLDialog, setShowSizeXLDialog] = useState(false);
|
|
47
|
+
const [showSizeFullWidthDialog, setShowSizeFullWidthDialog] = useState(false);
|
|
48
|
+
const [showSizeFullHeightDialog, setShowSizeFullHeightDialog] = useState(false);
|
|
49
|
+
const [showSizeFullHeightLGDialog, setShowSizeFullHeightLGDialog] = useState(false);
|
|
50
|
+
const [showSizeFullHeightXLDialog, setShowSizeFullHeightXLDialog] = useState(false);
|
|
51
|
+
const [showSizeFullScreenDialog, setShowSizeFullScreenDialog] = useState(false);
|
|
52
|
+
|
|
53
|
+
const renderDialog = () => {
|
|
54
|
+
const onClose = () => setShowDialog(false);
|
|
55
|
+
|
|
56
|
+
const headerButtons = (
|
|
57
|
+
<>
|
|
58
|
+
<OverlayTrigger placement='bottom' overlay={<Tooltip width='auto'>Download</Tooltip>}>
|
|
59
|
+
<Button bsStyle='muted' iconOnly iconName='rioglyph-cloud-download' />
|
|
60
|
+
</OverlayTrigger>
|
|
61
|
+
<OverlayTrigger placement='bottom' overlay={<Tooltip width='auto'>More options</Tooltip>}>
|
|
62
|
+
<Button bsStyle='muted' iconOnly iconName='rioglyph-option-horizontal' />
|
|
63
|
+
</OverlayTrigger>
|
|
64
|
+
</>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Dialog
|
|
69
|
+
show={showDialog}
|
|
70
|
+
title={exampleTitle}
|
|
71
|
+
footer={exampleFooter(onClose)}
|
|
72
|
+
body={<ExampleBody />}
|
|
73
|
+
headerButtons={headerButtons}
|
|
74
|
+
onClose={onClose}
|
|
75
|
+
className='exampleDialog'
|
|
76
|
+
showCloseButton
|
|
77
|
+
bsSize='md'
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const renderSubtitleDialog = () => (
|
|
83
|
+
<Dialog
|
|
84
|
+
show={showSubtitleDialog}
|
|
85
|
+
title={exampleTitle}
|
|
86
|
+
subtitle={exampleSubtitle}
|
|
87
|
+
footer={exampleFooter(() => setShowSubtitleDialog(false))}
|
|
88
|
+
body={<ExampleBody />}
|
|
89
|
+
onClose={() => setShowSubtitleDialog(false)}
|
|
90
|
+
bodyClassName='exampleDialog'
|
|
91
|
+
showCloseButton
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const renderLongDialog = () => (
|
|
96
|
+
<Dialog
|
|
97
|
+
show={showLongDialog}
|
|
98
|
+
title={exampleTitle}
|
|
99
|
+
body={dummyTextExtraLong}
|
|
100
|
+
footer={exampleFooter(() => setShowLongDialog(false))}
|
|
101
|
+
onClose={() => setShowLongDialog(false)}
|
|
102
|
+
className='longExampleDialog'
|
|
103
|
+
showCloseButton
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const renderLongOverflowDialog = () => (
|
|
108
|
+
<Dialog
|
|
109
|
+
show={showLongOverflowDialog}
|
|
110
|
+
title={exampleTitle}
|
|
111
|
+
body={dummyTextExtraLong}
|
|
112
|
+
footer={exampleFooter(() => setShowLongOverflowDialog(false))}
|
|
113
|
+
onClose={() => setShowLongOverflowDialog(false)}
|
|
114
|
+
className='longExampleDialog'
|
|
115
|
+
showCloseButton
|
|
116
|
+
useOverflow
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
const renderLongOverflow2Dialog = () => (
|
|
121
|
+
<Dialog
|
|
122
|
+
show={showLongOverflow2Dialog}
|
|
123
|
+
title={exampleTitle}
|
|
124
|
+
body={dummyTextExtraLong}
|
|
125
|
+
bodyClassName='no-overflow-gradient bg-lightest'
|
|
126
|
+
footerClassName='shadow-smooth-up'
|
|
127
|
+
footer={exampleFooter(() => setShowLongOverflow2Dialog(false))}
|
|
128
|
+
onClose={() => setShowLongOverflow2Dialog(false)}
|
|
129
|
+
className='longExample2Dialog'
|
|
130
|
+
showCloseButton
|
|
131
|
+
useOverflow
|
|
132
|
+
/>
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const renderSizeXSDialog = () => (
|
|
136
|
+
<Dialog
|
|
137
|
+
show={showSizeXSDialog}
|
|
138
|
+
title='The smallest dialog'
|
|
139
|
+
footer={
|
|
140
|
+
<div className='display-flex justify-content-end'>
|
|
141
|
+
<Button bsStyle='primary' onClick={() => setShowSizeXSDialog(false)}>
|
|
142
|
+
Ok
|
|
143
|
+
</Button>
|
|
144
|
+
</div>
|
|
145
|
+
}
|
|
146
|
+
body="This is our smallest dialog. Please treat it lightly and don't scare him"
|
|
147
|
+
bsSize={Dialog.SIZE_XS}
|
|
148
|
+
onClose={() => setShowSizeXSDialog(false)}
|
|
149
|
+
/>
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
const renderSizeSMDialog = () => (
|
|
153
|
+
<Dialog
|
|
154
|
+
show={showSizeSMDialog}
|
|
155
|
+
title={exampleTitle}
|
|
156
|
+
footer={exampleFooter(() => setShowSizeSMDialog(false))}
|
|
157
|
+
body={<ExampleBody />}
|
|
158
|
+
bsSize={Dialog.SIZE_SM}
|
|
159
|
+
onClose={() => setShowSizeSMDialog(false)}
|
|
160
|
+
className='exampleDialog'
|
|
161
|
+
showCloseButton
|
|
162
|
+
/>
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
const renderSizeLGDialog = () => (
|
|
166
|
+
<Dialog
|
|
167
|
+
show={showSizeLGDialog}
|
|
168
|
+
title={exampleTitle}
|
|
169
|
+
footer={exampleFooter(() => setShowSizeLGDialog(false))}
|
|
170
|
+
body={<ExampleBody />}
|
|
171
|
+
bsSize={Dialog.SIZE_LG}
|
|
172
|
+
onClose={() => setShowSizeLGDialog(false)}
|
|
173
|
+
className='exampleDialog'
|
|
174
|
+
showCloseButton
|
|
175
|
+
/>
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
const renderSizeXLDialog = () => (
|
|
179
|
+
<Dialog
|
|
180
|
+
show={showSizeXLDialog}
|
|
181
|
+
title={exampleTitle}
|
|
182
|
+
footer={exampleFooter(() => setShowSizeXLDialog(false))}
|
|
183
|
+
body={<ExampleBody />}
|
|
184
|
+
bsSize={Dialog.SIZE_XL}
|
|
185
|
+
onClose={() => setShowSizeXLDialog(false)}
|
|
186
|
+
className='exampleDialog'
|
|
187
|
+
showCloseButton
|
|
188
|
+
/>
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
const renderSizeFullWidthDialog = () => (
|
|
192
|
+
<Dialog
|
|
193
|
+
show={showSizeFullWidthDialog}
|
|
194
|
+
title={exampleTitle}
|
|
195
|
+
footer={exampleFooter(() => setShowSizeFullWidthDialog(false))}
|
|
196
|
+
body={<ExampleBody />}
|
|
197
|
+
bsSize={Dialog.SIZE_FULL_WIDTH}
|
|
198
|
+
onClose={() => setShowSizeFullWidthDialog(false)}
|
|
199
|
+
className='exampleDialog'
|
|
200
|
+
showCloseButton
|
|
201
|
+
/>
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
const renderSizeFullHeightDialog = () => (
|
|
205
|
+
<Dialog
|
|
206
|
+
show={showSizeFullHeightDialog}
|
|
207
|
+
title={exampleTitle}
|
|
208
|
+
footer={exampleFooter(() => setShowSizeFullHeightDialog(false))}
|
|
209
|
+
body={<ExampleBody />}
|
|
210
|
+
bsSize={Dialog.SIZE_FULL_HEIGHT}
|
|
211
|
+
onClose={() => setShowSizeFullHeightDialog(false)}
|
|
212
|
+
className='exampleDialog'
|
|
213
|
+
showCloseButton
|
|
214
|
+
/>
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
const renderSizeFullHeightLGDialog = () => (
|
|
218
|
+
<Dialog
|
|
219
|
+
show={showSizeFullHeightLGDialog}
|
|
220
|
+
title={exampleTitle}
|
|
221
|
+
footer={exampleFooter(() => setShowSizeFullHeightLGDialog(false))}
|
|
222
|
+
body={<ExampleBody />}
|
|
223
|
+
bsSize={Dialog.SIZE_FULL_HEIGHT_LG}
|
|
224
|
+
onClose={() => setShowSizeFullHeightLGDialog(false)}
|
|
225
|
+
className='foobar'
|
|
226
|
+
showCloseButton
|
|
227
|
+
/>
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
const renderSizeFullHeightXLDialog = () => (
|
|
231
|
+
<Dialog
|
|
232
|
+
show={showSizeFullHeightXLDialog}
|
|
233
|
+
title={exampleTitle}
|
|
234
|
+
footer={exampleFooter(() => setShowSizeFullHeightXLDialog(false))}
|
|
235
|
+
body={<ExampleBody />}
|
|
236
|
+
bsSize={Dialog.SIZE_FULL_HEIGHT_XL}
|
|
237
|
+
onClose={() => setShowSizeFullHeightXLDialog(false)}
|
|
238
|
+
showCloseButton
|
|
239
|
+
/>
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
const renderSizeFullScreenDialog = () => (
|
|
243
|
+
<Dialog
|
|
244
|
+
show={showSizeFullScreenDialog}
|
|
245
|
+
title={exampleTitle}
|
|
246
|
+
body={exampleFullScreenBody}
|
|
247
|
+
footer={exampleFooter(() => setShowSizeFullScreenDialog(false))}
|
|
248
|
+
className='exampleDialog'
|
|
249
|
+
bodyClassName='padding-0'
|
|
250
|
+
bsSize={Dialog.SIZE_FULL_SCREEN}
|
|
251
|
+
onClose={() => setShowSizeFullScreenDialog(false)}
|
|
252
|
+
showCloseButton
|
|
253
|
+
/>
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
return (
|
|
257
|
+
<div>
|
|
258
|
+
<div className='btn-toolbar margin-bottom-20'>
|
|
259
|
+
<Button bsStyle='primary' onClick={() => setShowDialog(true)}>
|
|
260
|
+
Dialog
|
|
261
|
+
</Button>
|
|
262
|
+
{renderDialog()}
|
|
263
|
+
|
|
264
|
+
<Button bsStyle='primary' onClick={() => setShowSubtitleDialog(true)}>
|
|
265
|
+
Subtitle dialog
|
|
266
|
+
</Button>
|
|
267
|
+
{renderSubtitleDialog()}
|
|
268
|
+
|
|
269
|
+
<Button bsStyle='primary' onClick={() => setShowLongDialog(true)}>
|
|
270
|
+
Long dialog
|
|
271
|
+
</Button>
|
|
272
|
+
{renderLongDialog()}
|
|
273
|
+
|
|
274
|
+
<Button bsStyle='primary' onClick={() => setShowLongOverflowDialog(true)}>
|
|
275
|
+
Long dialog with overflow
|
|
276
|
+
</Button>
|
|
277
|
+
{renderLongOverflowDialog()}
|
|
278
|
+
|
|
279
|
+
<Button bsStyle='primary' onClick={() => setShowLongOverflow2Dialog(true)}>
|
|
280
|
+
Dialog with overflow and light background
|
|
281
|
+
</Button>
|
|
282
|
+
{renderLongOverflow2Dialog()}
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
<label>Dialog sizes</label>
|
|
286
|
+
<div className='btn-toolbar'>
|
|
287
|
+
<Button bsStyle='primary' onClick={() => setShowSizeXSDialog(true)}>
|
|
288
|
+
Size xs (320px)
|
|
289
|
+
</Button>
|
|
290
|
+
{renderSizeXSDialog()}
|
|
291
|
+
|
|
292
|
+
<Button bsStyle='primary' onClick={() => setShowSizeSMDialog(true)}>
|
|
293
|
+
Size sm (480px)
|
|
294
|
+
</Button>
|
|
295
|
+
{renderSizeSMDialog()}
|
|
296
|
+
|
|
297
|
+
<Button bsStyle='primary' onClick={() => setShowDialog(true)}>
|
|
298
|
+
Size md (768px - default)
|
|
299
|
+
</Button>
|
|
300
|
+
<Button type='button' bsStyle='primary' onClick={() => setShowSizeLGDialog(true)}>
|
|
301
|
+
Size lg (1280px)
|
|
302
|
+
</Button>
|
|
303
|
+
{renderSizeLGDialog()}
|
|
304
|
+
|
|
305
|
+
<Button bsStyle='primary' onClick={() => setShowSizeXLDialog(true)}>
|
|
306
|
+
Size xl (1440px)
|
|
307
|
+
</Button>
|
|
308
|
+
{renderSizeXLDialog()}
|
|
309
|
+
|
|
310
|
+
<Button bsStyle='primary' onClick={() => setShowSizeFullWidthDialog(true)}>
|
|
311
|
+
Size fullwidth
|
|
312
|
+
</Button>
|
|
313
|
+
{renderSizeFullWidthDialog()}
|
|
314
|
+
|
|
315
|
+
<Button bsStyle='primary' onClick={() => setShowSizeFullHeightDialog(true)}>
|
|
316
|
+
Size fullheight
|
|
317
|
+
</Button>
|
|
318
|
+
{renderSizeFullHeightDialog()}
|
|
319
|
+
|
|
320
|
+
<Button bsStyle='primary' onClick={() => setShowSizeFullHeightLGDialog(true)}>
|
|
321
|
+
Size fullheight lg
|
|
322
|
+
</Button>
|
|
323
|
+
{renderSizeFullHeightLGDialog()}
|
|
324
|
+
|
|
325
|
+
<Button bsStyle='primary' onClick={() => setShowSizeFullHeightXLDialog(true)}>
|
|
326
|
+
Size fullheight xl
|
|
327
|
+
</Button>
|
|
328
|
+
{renderSizeFullHeightXLDialog()}
|
|
329
|
+
|
|
330
|
+
<Button bsStyle='primary' onClick={() => setShowSizeFullScreenDialog(true)}>
|
|
331
|
+
Size fullscreen
|
|
332
|
+
</Button>
|
|
333
|
+
{renderSizeFullScreenDialog()}
|
|
334
|
+
</div>
|
|
335
|
+
</div>
|
|
336
|
+
);
|
|
337
|
+
};
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
#### HTML (html)
|
|
341
|
+
|
|
342
|
+
```html
|
|
343
|
+
<div class='modal show exampleDialog modal-enter-done' tabindex='1' role='dialog'>
|
|
344
|
+
<div class='modal-dialog' role='document'>
|
|
345
|
+
<div class='modal-content'>
|
|
346
|
+
<div class='modal-header'>
|
|
347
|
+
<div class='modal-header-text'>
|
|
348
|
+
<div class='modal-header-title'>Dialog title</div>
|
|
349
|
+
</div>
|
|
350
|
+
<div class='modal-header-buttons'>
|
|
351
|
+
<button type='button' class='btn btn-muted btn-icon-only'>
|
|
352
|
+
<span class='rioglyph rioglyph-cloud-download'></span>
|
|
353
|
+
</button>
|
|
354
|
+
<button type='button' class='btn btn-muted btn-icon-only'>
|
|
355
|
+
<span class='rioglyph rioglyph-option-horizontal'></span>
|
|
356
|
+
</button>
|
|
357
|
+
<div class='modal-header-buttons-spacer'></div>
|
|
358
|
+
<button
|
|
359
|
+
type='button'
|
|
360
|
+
class='btn btn-icon-only btn-muted modal-header-close close'
|
|
361
|
+
data-testid='close'
|
|
362
|
+
>
|
|
363
|
+
<span class='rioglyph rioglyph-remove' aria-hidden='true'></span>
|
|
364
|
+
</button>
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
<div class='modal-body'>
|
|
368
|
+
{/* Body Content */}
|
|
369
|
+
</div>
|
|
370
|
+
<div class='modal-footer'>
|
|
371
|
+
{/* Footer Content */}
|
|
372
|
+
</div>
|
|
373
|
+
</div>
|
|
374
|
+
</div>
|
|
375
|
+
<div class='modal-backdrop'></div>
|
|
376
|
+
</div>
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
#### Props
|
|
380
|
+
|
|
381
|
+
| Name | Type | Default | Description |
|
|
382
|
+
| --- | --- | --- | --- |
|
|
383
|
+
| show | Boolean | false | Opens the dialog when set to true |
|
|
384
|
+
| title | Node | — | The dialog title (can also be a FormattedMessage component) |
|
|
385
|
+
| subtitle | Node | — | The subtitle content |
|
|
386
|
+
| body | Node | — | The dialog body content |
|
|
387
|
+
| footer | Node | — | The dialog footer content |
|
|
388
|
+
| onClose | Function | () => {} | A callback function invoked when the dialog closes |
|
|
389
|
+
| onCloseValidation | Function | () => true | A callback function to be executed before closing the dialog. If the function returns false the dialog will not be closed. |
|
|
390
|
+
| showCloseButton | Boolean | true | Shows a close button when set to true |
|
|
391
|
+
| disableEsc | Boolean | false | Enables or disabled closing the dialog via esc key |
|
|
392
|
+
| onEsc | Function | () => {} | A callback fired when esc key is pressed and the dialog is about to close |
|
|
393
|
+
| useOverflow | Boolean | false | Enables the modal body to overflow and use inline scrolling if needed.Set the class "no-overflow-gradient" to remove the overflow gradient in case it is problematic like when the background is gray. |
|
|
394
|
+
| bsSize | String | md | Defined how large the dialog will be rendered. By default, the dialog has a medium size and thus it can be omitted. Possible values are: Dialog.SIZE_XS, Dialog.SIZE_SM, Dialog.SIZE_LG, Dialog.SIZE_XL, Dialog.SIZE_FULL_WIDTH, Dialog.SIZE_FULL_HEIGHT, Dialog.SIZE_FULL_SCREEN or 'xs', 'sm', 'lg', 'xl', 'fullwidth', 'fullheight', 'fullheight-lg', 'fullheight-xl', 'fullscreen' |
|
|
395
|
+
| headerButtons | ReactNode | — | Allows to add additional buttons to the dialog header |
|
|
396
|
+
| className | String | — | Additional classes for the modal element |
|
|
397
|
+
| bodyClassName | String | — | Additional classes for the modal-body element |
|
|
398
|
+
| footerClassName | String | — | Additional classes for the modal-footer element |
|
|
399
|
+
|
|
400
|
+
## Dialog compound components
|
|
401
|
+
|
|
402
|
+
To accommodate forms within the dialog body and have the submit button in the footer or wrapping individual parts of the dialog, a more flexible approach to rendering its individual components is needed. In this scenario, you can make use of the dialog compound components.
|
|
403
|
+
|
|
404
|
+
### Example: Example 2
|
|
405
|
+
|
|
406
|
+
Dialog with form
|
|
407
|
+
|
|
408
|
+
#### Summary
|
|
409
|
+
|
|
410
|
+
Dialog with form
|
|
411
|
+
|
|
412
|
+
#### React (tsx)
|
|
413
|
+
|
|
414
|
+
```tsx
|
|
415
|
+
import { useState } from 'react';
|
|
416
|
+
|
|
417
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
418
|
+
import Dialog from '@rio-cloud/rio-uikit/Dialog';
|
|
419
|
+
|
|
420
|
+
import { exampleTitle } from './DialogData';
|
|
421
|
+
|
|
422
|
+
export default () => {
|
|
423
|
+
const [showDialog, setShowDialog] = useState(false);
|
|
424
|
+
const [enableSubmit, setEnableSubmit] = useState(false);
|
|
425
|
+
const [submittedFormData, setSubmittedFormData] = useState<{ [k: string]: FormDataEntryValue } | undefined>();
|
|
426
|
+
|
|
427
|
+
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
|
428
|
+
// Avoid page reload on form submit
|
|
429
|
+
event.preventDefault();
|
|
430
|
+
|
|
431
|
+
// Get form data of all input elements
|
|
432
|
+
const formData = new FormData(event.target as HTMLFormElement);
|
|
433
|
+
|
|
434
|
+
// Convert all form data into an object for further use
|
|
435
|
+
const entries = Object.fromEntries(formData.entries());
|
|
436
|
+
setSubmittedFormData(entries);
|
|
437
|
+
|
|
438
|
+
// Individual debug output of the form inputs
|
|
439
|
+
for (const [key, value] of formData) {
|
|
440
|
+
console.log({ key, value });
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
445
|
+
setEnableSubmit(Boolean(event.currentTarget.value));
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
const handleClose = () => {
|
|
449
|
+
setShowDialog(false);
|
|
450
|
+
setSubmittedFormData(undefined);
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
return (
|
|
454
|
+
<div>
|
|
455
|
+
<div className='btn-toolbar margin-bottom-20'>
|
|
456
|
+
<Button bsStyle='primary' onClick={() => setShowDialog(true)}>
|
|
457
|
+
Dialog with form
|
|
458
|
+
</Button>
|
|
459
|
+
<Dialog show={showDialog} onClose={handleClose} showCloseButton bsSize='md'>
|
|
460
|
+
<form onSubmit={handleSubmit}>
|
|
461
|
+
<Dialog.Title
|
|
462
|
+
title={exampleTitle}
|
|
463
|
+
subtitle='This is a subtitle'
|
|
464
|
+
headerButtons={<Button bsStyle='muted' iconOnly iconName='rioglyph-cloud-download' />}
|
|
465
|
+
/>
|
|
466
|
+
<Dialog.Body className='foo'>
|
|
467
|
+
<div>
|
|
468
|
+
<div className='form-group'>
|
|
469
|
+
<label htmlFor='demoInput'>Some random input to submit (required)</label>
|
|
470
|
+
<input
|
|
471
|
+
className='form-control'
|
|
472
|
+
name='demoInput'
|
|
473
|
+
placeholder='Please add something to continue'
|
|
474
|
+
onChange={handleInputChange}
|
|
475
|
+
required
|
|
476
|
+
/>
|
|
477
|
+
</div>
|
|
478
|
+
<div className='text-italic margin-top-25'>{JSON.stringify(submittedFormData)}</div>
|
|
479
|
+
</div>
|
|
480
|
+
</Dialog.Body>
|
|
481
|
+
<Dialog.Footer className='foobar'>
|
|
482
|
+
<div>
|
|
483
|
+
<Button bsStyle='primary' type='submit' disabled={!enableSubmit}>
|
|
484
|
+
Submit
|
|
485
|
+
</Button>
|
|
486
|
+
</div>
|
|
487
|
+
</Dialog.Footer>
|
|
488
|
+
</form>
|
|
489
|
+
</Dialog>
|
|
490
|
+
</div>
|
|
491
|
+
</div>
|
|
492
|
+
);
|
|
493
|
+
};
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
#### HTML (html)
|
|
497
|
+
|
|
498
|
+
```html
|
|
499
|
+
<div class='modal show exampleDialog modal-enter-done' tabindex='1' role='dialog'>
|
|
500
|
+
<div class='modal-dialog' role='document'>
|
|
501
|
+
<div class='modal-content'>
|
|
502
|
+
<div class='modal-header'>
|
|
503
|
+
<div class='modal-header-text'>
|
|
504
|
+
<div class='modal-header-title'>Dialog title</div>
|
|
505
|
+
</div>
|
|
506
|
+
<div class='modal-header-buttons'>
|
|
507
|
+
<button type='button' class='btn btn-muted btn-icon-only'>
|
|
508
|
+
<span class='rioglyph rioglyph-cloud-download'></span>
|
|
509
|
+
</button>
|
|
510
|
+
<button type='button' class='btn btn-muted btn-icon-only'>
|
|
511
|
+
<span class='rioglyph rioglyph-option-horizontal'></span>
|
|
512
|
+
</button>
|
|
513
|
+
<div class='modal-header-buttons-spacer'></div>
|
|
514
|
+
<button
|
|
515
|
+
type='button'
|
|
516
|
+
class='btn btn-icon-only btn-muted modal-header-close close'
|
|
517
|
+
data-testid='close'
|
|
518
|
+
>
|
|
519
|
+
<span class='rioglyph rioglyph-remove' aria-hidden='true'></span>
|
|
520
|
+
</button>
|
|
521
|
+
</div>
|
|
522
|
+
</div>
|
|
523
|
+
<div class='modal-body'>
|
|
524
|
+
{/* Body Content */}
|
|
525
|
+
</div>
|
|
526
|
+
<div class='modal-footer'>
|
|
527
|
+
{/* Footer Content */}
|
|
528
|
+
</div>
|
|
529
|
+
</div>
|
|
530
|
+
</div>
|
|
531
|
+
<div class='modal-backdrop'></div>
|
|
532
|
+
</div>
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
#### Props: Dialog.Title
|
|
536
|
+
|
|
537
|
+
### Dialog.Title
|
|
538
|
+
|
|
539
|
+
| Name | Type | Default | Description |
|
|
540
|
+
| --- | --- | --- | --- |
|
|
541
|
+
| title | Node | — | The dialog title (can also be a FormattedMessage component) |
|
|
542
|
+
| subtitle | Node | — | The subtitle content |
|
|
543
|
+
| headerButtons | ReactNode | — | Allows to add additional buttons to the dialog header |
|
|
544
|
+
|
|
545
|
+
#### Props: Dialog.Body
|
|
546
|
+
|
|
547
|
+
### Dialog.Body
|
|
548
|
+
|
|
549
|
+
| Name | Type | Default | Description |
|
|
550
|
+
| --- | --- | --- | --- |
|
|
551
|
+
| className | String | — | Additional classes set on the wrapper element |
|
|
552
|
+
|
|
553
|
+
#### Props: Dialog.Footer
|
|
554
|
+
|
|
555
|
+
### Dialog.Footer
|
|
556
|
+
|
|
557
|
+
| Name | Type | Default | Description |
|
|
558
|
+
| --- | --- | --- | --- |
|
|
559
|
+
| className | String | — | Additional classes set on the wrapper element |
|
|
560
|
+
|
|
561
|
+
## Dialogs with validation
|
|
562
|
+
|
|
563
|
+
### Example: Example 3
|
|
564
|
+
|
|
565
|
+
Open dialog
|
|
566
|
+
|
|
567
|
+
#### Summary
|
|
568
|
+
|
|
569
|
+
Open dialog
|
|
570
|
+
|
|
571
|
+
#### React (tsx)
|
|
572
|
+
|
|
573
|
+
```tsx
|
|
574
|
+
import type React from 'react';
|
|
575
|
+
import { useEffect, useRef, useState } from 'react';
|
|
576
|
+
|
|
577
|
+
import Dialog from '@rio-cloud/rio-uikit/Dialog';
|
|
578
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
579
|
+
|
|
580
|
+
type DemoContentProps = {
|
|
581
|
+
inputValue: string;
|
|
582
|
+
showError: boolean;
|
|
583
|
+
onInputChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
const DemoContent = (props: DemoContentProps) => {
|
|
587
|
+
const { inputValue, showError, onInputChange } = props;
|
|
588
|
+
|
|
589
|
+
// Set the focus on the input.
|
|
590
|
+
// Note: the dialog body need to be in the component that re-renders,
|
|
591
|
+
// otherwise the focus is not set initially.
|
|
592
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
593
|
+
useEffect(() => {
|
|
594
|
+
if (inputRef.current) {
|
|
595
|
+
console.log('focus input');
|
|
596
|
+
inputRef.current.focus();
|
|
597
|
+
}
|
|
598
|
+
}, [inputRef.current]);
|
|
599
|
+
|
|
600
|
+
return (
|
|
601
|
+
<div className={`form-group has-feedback ${showError ? 'has-error' : ''} margin-bottom-15`}>
|
|
602
|
+
<label htmlFor='input'>Some input</label>
|
|
603
|
+
<div className='input-group'>
|
|
604
|
+
<input
|
|
605
|
+
className='form-control'
|
|
606
|
+
value={inputValue}
|
|
607
|
+
id='input'
|
|
608
|
+
type='text'
|
|
609
|
+
placeholder='Please type in something'
|
|
610
|
+
onChange={onInputChange}
|
|
611
|
+
ref={inputRef}
|
|
612
|
+
/>
|
|
613
|
+
</div>
|
|
614
|
+
{showError && (
|
|
615
|
+
<span className='help-block'>
|
|
616
|
+
<span>Please enter something</span>
|
|
617
|
+
</span>
|
|
618
|
+
)}
|
|
619
|
+
</div>
|
|
620
|
+
);
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
export default () => {
|
|
624
|
+
const [state, setState] = useState({
|
|
625
|
+
showDialog: false,
|
|
626
|
+
hasError: false,
|
|
627
|
+
inputValue: '',
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
const handleValidation = () => {
|
|
631
|
+
if (!state.inputValue) {
|
|
632
|
+
setState({ ...state, hasError: true });
|
|
633
|
+
return false;
|
|
634
|
+
}
|
|
635
|
+
return true;
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
639
|
+
const inputValue = event.currentTarget.value;
|
|
640
|
+
setState({ ...state, inputValue, hasError: !inputValue });
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
return (
|
|
644
|
+
<>
|
|
645
|
+
<Button bsStyle='primary' onClick={() => setState({ ...state, showDialog: true })}>
|
|
646
|
+
Open dialog
|
|
647
|
+
</Button>
|
|
648
|
+
<Dialog
|
|
649
|
+
show={state.showDialog}
|
|
650
|
+
title='Dialog with validation example'
|
|
651
|
+
body={
|
|
652
|
+
<DemoContent
|
|
653
|
+
inputValue={state.inputValue}
|
|
654
|
+
showError={state.hasError}
|
|
655
|
+
onInputChange={handleInputChange}
|
|
656
|
+
/>
|
|
657
|
+
}
|
|
658
|
+
onClose={() => setState({ ...state, showDialog: false, inputValue: '' })}
|
|
659
|
+
onCloseValidation={handleValidation}
|
|
660
|
+
/>
|
|
661
|
+
</>
|
|
662
|
+
);
|
|
663
|
+
};
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
#### HTML (html)
|
|
667
|
+
|
|
668
|
+
```html
|
|
669
|
+
<button type="button" class="btn btn-primary btn-component" tabindex="0">Open dialog</button>
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
#### Props
|
|
673
|
+
|
|
674
|
+
| Name | Type | Default | Description |
|
|
675
|
+
| --- | --- | --- | --- |
|
|
676
|
+
| show | Boolean | false | Opens the dialog when set to true |
|
|
677
|
+
| title | Node | — | The dialog title (can also be a FormattedMessage component) |
|
|
678
|
+
| subtitle | Node | — | The subtitle content |
|
|
679
|
+
| body | Node | — | The dialog body content |
|
|
680
|
+
| footer | Node | — | The dialog footer content |
|
|
681
|
+
| onClose | Function | () => {} | A callback function invoked when the dialog closes |
|
|
682
|
+
| onCloseValidation | Function | () => true | A callback function to be executed before closing the dialog. If the function returns false the dialog will not be closed. |
|
|
683
|
+
| showCloseButton | Boolean | true | Shows a close button when set to true |
|
|
684
|
+
| disableEsc | Boolean | false | Enables or disabled closing the dialog via esc key |
|
|
685
|
+
| onEsc | Function | () => {} | A callback fired when esc key is pressed and the dialog is about to close |
|
|
686
|
+
| useOverflow | Boolean | false | Enables the modal body to overflow and use inline scrolling if needed.Set the class "no-overflow-gradient" to remove the overflow gradient in case it is problematic like when the background is gray. |
|
|
687
|
+
| bsSize | String | md | Defined how large the dialog will be rendered. By default, the dialog has a medium size and thus it can be omitted. Possible values are: Dialog.SIZE_XS, Dialog.SIZE_SM, Dialog.SIZE_LG, Dialog.SIZE_XL, Dialog.SIZE_FULL_WIDTH, Dialog.SIZE_FULL_HEIGHT, Dialog.SIZE_FULL_SCREEN or 'xs', 'sm', 'lg', 'xl', 'fullwidth', 'fullheight', 'fullheight-lg', 'fullheight-xl', 'fullscreen' |
|
|
688
|
+
| headerButtons | ReactNode | — | Allows to add additional buttons to the dialog header |
|
|
689
|
+
| className | String | — | Additional classes for the modal element |
|
|
690
|
+
| bodyClassName | String | — | Additional classes for the modal-body element |
|
|
691
|
+
| footerClassName | String | — | Additional classes for the modal-footer element |
|
|
692
|
+
|
|
693
|
+
### Example: Example 4
|
|
694
|
+
|
|
695
|
+
Validation with separate validation error dialog
|
|
696
|
+
Open dialog
|
|
697
|
+
|
|
698
|
+
#### Summary
|
|
699
|
+
|
|
700
|
+
Validation with separate validation error dialog
|
|
701
|
+
Open dialog
|
|
702
|
+
|
|
703
|
+
#### React (tsx)
|
|
704
|
+
|
|
705
|
+
```tsx
|
|
706
|
+
import type React from 'react';
|
|
707
|
+
import { useState, useRef, useEffect } from 'react';
|
|
708
|
+
|
|
709
|
+
import Dialog from '@rio-cloud/rio-uikit/Dialog';
|
|
710
|
+
import SimpleDialog from '@rio-cloud/rio-uikit/SimpleDialog';
|
|
711
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
712
|
+
|
|
713
|
+
type DemoContentProps = {
|
|
714
|
+
inputRef: React.MutableRefObject<HTMLInputElement>;
|
|
715
|
+
inputValue: string;
|
|
716
|
+
showError: boolean;
|
|
717
|
+
onInputChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
const DemoContent = (props: DemoContentProps) => {
|
|
721
|
+
const { inputRef, inputValue, showError, onInputChange } = props;
|
|
722
|
+
|
|
723
|
+
// Set the focus on the input.
|
|
724
|
+
// Note: the dialog body need to be in the component that re-renders,
|
|
725
|
+
// otherwise the focus is not set initially.
|
|
726
|
+
useEffect(() => {
|
|
727
|
+
if (inputRef.current) {
|
|
728
|
+
console.log('focus input');
|
|
729
|
+
inputRef.current.focus();
|
|
730
|
+
}
|
|
731
|
+
}, [inputRef.current]);
|
|
732
|
+
|
|
733
|
+
return (
|
|
734
|
+
<div className={`form-group has-feedback ${showError ? 'has-error' : ''} margin-bottom-15`}>
|
|
735
|
+
<label htmlFor='input'>Some input</label>
|
|
736
|
+
<div className='input-group'>
|
|
737
|
+
<input
|
|
738
|
+
className='form-control'
|
|
739
|
+
value={inputValue}
|
|
740
|
+
id='input'
|
|
741
|
+
type='text'
|
|
742
|
+
placeholder='Please type in something'
|
|
743
|
+
onChange={onInputChange}
|
|
744
|
+
ref={inputRef}
|
|
745
|
+
/>
|
|
746
|
+
</div>
|
|
747
|
+
{showError && (
|
|
748
|
+
<span className='help-block'>
|
|
749
|
+
<span>Please enter something</span>
|
|
750
|
+
</span>
|
|
751
|
+
)}
|
|
752
|
+
</div>
|
|
753
|
+
);
|
|
754
|
+
};
|
|
755
|
+
|
|
756
|
+
export default () => {
|
|
757
|
+
const [state, setState] = useState({
|
|
758
|
+
showDialog: false,
|
|
759
|
+
hasError: false,
|
|
760
|
+
showErrorDialog: false,
|
|
761
|
+
inputValue: '',
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
765
|
+
|
|
766
|
+
const handleValidation = () => {
|
|
767
|
+
if (!state.inputValue) {
|
|
768
|
+
setState({ ...state, hasError: true, showErrorDialog: true });
|
|
769
|
+
return false;
|
|
770
|
+
}
|
|
771
|
+
return true;
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
775
|
+
const inputValue = event.currentTarget.value;
|
|
776
|
+
setState({ ...state, inputValue, hasError: !inputValue });
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
const handleCloseErrorDialog = () => {
|
|
780
|
+
setState({ ...state, showErrorDialog: false });
|
|
781
|
+
inputRef?.current?.focus();
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
const handleClose = () => {
|
|
785
|
+
handleValidation() && setState({ ...state, showDialog: false, inputValue: '' });
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
const showError = state.hasError && !state.showErrorDialog;
|
|
789
|
+
|
|
790
|
+
return (
|
|
791
|
+
<>
|
|
792
|
+
<div>
|
|
793
|
+
<label>Validation with separate validation error dialog</label>
|
|
794
|
+
</div>
|
|
795
|
+
<Button bsStyle='primary' onClick={() => setState({ ...state, showDialog: true })}>
|
|
796
|
+
Open dialog
|
|
797
|
+
</Button>
|
|
798
|
+
|
|
799
|
+
<Dialog
|
|
800
|
+
show={state.showDialog}
|
|
801
|
+
title='Dialog with validation example'
|
|
802
|
+
body={
|
|
803
|
+
<DemoContent
|
|
804
|
+
inputRef={inputRef}
|
|
805
|
+
inputValue={state.inputValue}
|
|
806
|
+
showError={showError}
|
|
807
|
+
onInputChange={handleInputChange}
|
|
808
|
+
/>
|
|
809
|
+
}
|
|
810
|
+
footer={
|
|
811
|
+
<Button bsStyle='primary' onClick={handleClose}>
|
|
812
|
+
Close
|
|
813
|
+
</Button>
|
|
814
|
+
}
|
|
815
|
+
onClose={handleClose}
|
|
816
|
+
onCloseValidation={handleValidation}
|
|
817
|
+
/>
|
|
818
|
+
<SimpleDialog
|
|
819
|
+
show={state.showErrorDialog}
|
|
820
|
+
bsSize='xs'
|
|
821
|
+
title='Validation failed'
|
|
822
|
+
content='Input may not be empty. Please enter some value.'
|
|
823
|
+
footer={
|
|
824
|
+
<Button bsStyle='primary' onClick={handleCloseErrorDialog}>
|
|
825
|
+
Got it
|
|
826
|
+
</Button>
|
|
827
|
+
}
|
|
828
|
+
/>
|
|
829
|
+
</>
|
|
830
|
+
);
|
|
831
|
+
};
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
#### HTML (html)
|
|
835
|
+
|
|
836
|
+
```html
|
|
837
|
+
<div>
|
|
838
|
+
<label>Validation with separate validation error dialog</label>
|
|
839
|
+
</div>
|
|
840
|
+
<button type="button" class="btn btn-primary btn-component" tabindex="0">Open dialog</button>
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
#### Props
|
|
844
|
+
|
|
845
|
+
| Name | Type | Default | Description |
|
|
846
|
+
| --- | --- | --- | --- |
|
|
847
|
+
| show | Boolean | false | Opens the dialog when set to true |
|
|
848
|
+
| title | Node | — | The dialog title (can also be a FormattedMessage component) |
|
|
849
|
+
| subtitle | Node | — | The subtitle content |
|
|
850
|
+
| body | Node | — | The dialog body content |
|
|
851
|
+
| footer | Node | — | The dialog footer content |
|
|
852
|
+
| onClose | Function | () => {} | A callback function invoked when the dialog closes |
|
|
853
|
+
| onCloseValidation | Function | () => true | A callback function to be executed before closing the dialog. If the function returns false the dialog will not be closed. |
|
|
854
|
+
| showCloseButton | Boolean | true | Shows a close button when set to true |
|
|
855
|
+
| disableEsc | Boolean | false | Enables or disabled closing the dialog via esc key |
|
|
856
|
+
| onEsc | Function | () => {} | A callback fired when esc key is pressed and the dialog is about to close |
|
|
857
|
+
| useOverflow | Boolean | false | Enables the modal body to overflow and use inline scrolling if needed.Set the class "no-overflow-gradient" to remove the overflow gradient in case it is problematic like when the background is gray. |
|
|
858
|
+
| bsSize | String | md | Defined how large the dialog will be rendered. By default, the dialog has a medium size and thus it can be omitted. Possible values are: Dialog.SIZE_XS, Dialog.SIZE_SM, Dialog.SIZE_LG, Dialog.SIZE_XL, Dialog.SIZE_FULL_WIDTH, Dialog.SIZE_FULL_HEIGHT, Dialog.SIZE_FULL_SCREEN or 'xs', 'sm', 'lg', 'xl', 'fullwidth', 'fullheight', 'fullheight-lg', 'fullheight-xl', 'fullscreen' |
|
|
859
|
+
| headerButtons | ReactNode | — | Allows to add additional buttons to the dialog header |
|
|
860
|
+
| className | String | — | Additional classes for the modal element |
|
|
861
|
+
| bodyClassName | String | — | Additional classes for the modal-body element |
|
|
862
|
+
| footerClassName | String | — | Additional classes for the modal-footer element |
|
|
863
|
+
|
|
864
|
+
## SimpleDialog
|
|
865
|
+
|
|
866
|
+
This component allows the user to create a simple dialog. It uses the dialog component described above.
|
|
867
|
+
|
|
868
|
+
### Example: Example 5
|
|
869
|
+
|
|
870
|
+
Simple dialog button
|
|
871
|
+
|
|
872
|
+
#### Summary
|
|
873
|
+
|
|
874
|
+
Simple dialog button
|
|
875
|
+
|
|
876
|
+
#### React (tsx)
|
|
877
|
+
|
|
878
|
+
```tsx
|
|
879
|
+
import { useState } from 'react';
|
|
880
|
+
|
|
881
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
882
|
+
import SimpleDialog from '@rio-cloud/rio-uikit/SimpleDialog';
|
|
883
|
+
|
|
884
|
+
export default () => {
|
|
885
|
+
const [show, setShow] = useState(false);
|
|
886
|
+
|
|
887
|
+
return (
|
|
888
|
+
<>
|
|
889
|
+
<Button bsStyle='primary' onClick={() => setShow(true)}>
|
|
890
|
+
Simple dialog button
|
|
891
|
+
</Button>
|
|
892
|
+
<SimpleDialog
|
|
893
|
+
show={show}
|
|
894
|
+
title='Simple dialog title'
|
|
895
|
+
content='Simple dialog body content'
|
|
896
|
+
bodyClassName='my-content'
|
|
897
|
+
onClose={() => setShow(false)}
|
|
898
|
+
/>
|
|
899
|
+
</>
|
|
900
|
+
);
|
|
901
|
+
};
|
|
902
|
+
```
|
|
903
|
+
|
|
904
|
+
#### HTML (html)
|
|
905
|
+
|
|
906
|
+
```html
|
|
907
|
+
<div content='Save Dialog Body Content' class='modal show simple-dialog modal-enter-done' tabindex='1' role='dialog'>
|
|
908
|
+
<div class='modal-dialog' role='document'>
|
|
909
|
+
<div class='modal-content'>
|
|
910
|
+
<div class='modal-header'>
|
|
911
|
+
<div class='modal-header-text'>
|
|
912
|
+
<div class='modal-header-title'>Save Dialog Title</div>
|
|
913
|
+
</div>
|
|
914
|
+
<div class='modal-header-buttons'>
|
|
915
|
+
<button
|
|
916
|
+
type='button'
|
|
917
|
+
class='btn btn-icon-only btn-muted modal-header-close close'
|
|
918
|
+
data-testid='close'
|
|
919
|
+
>
|
|
920
|
+
<span class='rioglyph rioglyph-remove' aria-hidden='true'></span>
|
|
921
|
+
</button>
|
|
922
|
+
</div>
|
|
923
|
+
</div>
|
|
924
|
+
<div class='modal-body'>Save Dialog Body Content</div>
|
|
925
|
+
</div>
|
|
926
|
+
</div>
|
|
927
|
+
<div class='modal-backdrop'></div>
|
|
928
|
+
</div>;
|
|
929
|
+
```
|
|
930
|
+
|
|
931
|
+
#### Props
|
|
932
|
+
|
|
933
|
+
| Name | Type | Default | Description |
|
|
934
|
+
| --- | --- | --- | --- |
|
|
935
|
+
| show | Boolean | false | Opens the dialog when set to true |
|
|
936
|
+
| title | Node | — | The dialog title (can also be a FormattedMessage component) |
|
|
937
|
+
| subtitle | Node | — | The subtitle content |
|
|
938
|
+
| content | Node | — | The content of the dialog body itself |
|
|
939
|
+
| footer | Node | — | The dialog footer content |
|
|
940
|
+
| footerClassName | String | — | Additional classes for the modal-footer element |
|
|
941
|
+
| bodyClassName | String | — | Additional classes for the modal-body element |
|
|
942
|
+
| onClose | Function | () => {} | A callback function invoked when the dialog closes |
|
|
943
|
+
| onCloseValidation | Function | () => true | A callback function to be executed before closing the dialog. If the function returns false the dialog will not be closed. |
|
|
944
|
+
| showCloseButton | Boolean | true | Shows a close button when set to true |
|
|
945
|
+
| disableEsc | Boolean | false | Enables or disabled closing the dialog via esc key |
|
|
946
|
+
| onEsc | Function | () => {} | A callback fired when esc key is pressed and the dialog is about to close |
|
|
947
|
+
| useOverflow | Boolean | false | Enables the modal body to overflow and use inline scrolling if needed.Set the class "no-overflow-gradient" to remove the overflow gradient in case it is problematic like when the background is gray. |
|
|
948
|
+
| bsSize | String | md | Defined how large the dialog will be rendered. By default, the dialog has a medium size and thus it can be omitted. Possible values are: Dialog.SIZE_XS, Dialog.SIZE_SM, Dialog.SIZE_LG, Dialog.SIZE_XL, Dialog.SIZE_FULL_WIDTH, Dialog.SIZE_FULL_HEIGHT, Dialog.SIZE_FULL_SCREEN or 'xs', 'sm', 'lg', 'xl', 'fullwidth', 'fullheight', 'fullheight-lg', 'fullheight-xl', 'fullscreen' |
|
|
949
|
+
| className | String | — | Additional classes for the modal element |
|
|
950
|
+
|
|
951
|
+
## ConfirmationDialog
|
|
952
|
+
|
|
953
|
+
This component allows the user to create a confirmation dialog. It uses the dialog component described above.
|
|
954
|
+
|
|
955
|
+
### Example: Example 6
|
|
956
|
+
|
|
957
|
+
Confirmation dialog
|
|
958
|
+
|
|
959
|
+
#### Summary
|
|
960
|
+
|
|
961
|
+
Confirmation dialog
|
|
962
|
+
|
|
963
|
+
#### React (tsx)
|
|
964
|
+
|
|
965
|
+
```tsx
|
|
966
|
+
import { useState } from 'react';
|
|
967
|
+
|
|
968
|
+
import Dialog from '@rio-cloud/rio-uikit/Dialog';
|
|
969
|
+
import ConfirmationDialog from '@rio-cloud/rio-uikit/ConfirmationDialog';
|
|
970
|
+
|
|
971
|
+
export default () => {
|
|
972
|
+
const [show, setShow] = useState(false);
|
|
973
|
+
|
|
974
|
+
return (
|
|
975
|
+
<div>
|
|
976
|
+
<button type='button' className='btn btn-primary' onClick={() => setShow(true)}>
|
|
977
|
+
Confirmation dialog
|
|
978
|
+
</button>
|
|
979
|
+
<ConfirmationDialog
|
|
980
|
+
show={show}
|
|
981
|
+
title='ConfirmationDialog title'
|
|
982
|
+
content='ConfirmationDialog body content'
|
|
983
|
+
bsSize={Dialog.SIZE_SM}
|
|
984
|
+
onClickConfirm={() => setShow(false)}
|
|
985
|
+
onClickCancel={() => setShow(false)}
|
|
986
|
+
cancelButtonText='Abort the action'
|
|
987
|
+
confirmButtonText={
|
|
988
|
+
<>
|
|
989
|
+
<span className='rioglyph rioglyph-ok margin-right-5' />
|
|
990
|
+
<span>Confirm the action</span>
|
|
991
|
+
</>
|
|
992
|
+
}
|
|
993
|
+
useOverflow
|
|
994
|
+
/>
|
|
995
|
+
</div>
|
|
996
|
+
);
|
|
997
|
+
};
|
|
998
|
+
```
|
|
999
|
+
|
|
1000
|
+
#### HTML (html)
|
|
1001
|
+
|
|
1002
|
+
```html
|
|
1003
|
+
<div class='modal show confirmation-dialog modal-enter-done' tabindex='1' role='dialog'>
|
|
1004
|
+
<div class='modal-dialog modal-overflow modal-sm' role='document'>
|
|
1005
|
+
<div class='modal-content'>
|
|
1006
|
+
<div class='modal-header'>
|
|
1007
|
+
<div class='modal-header-text'>
|
|
1008
|
+
<div class='modal-header-title'>Confirmation dialog title</div>
|
|
1009
|
+
</div>
|
|
1010
|
+
<div class='modal-header-buttons'></div>
|
|
1011
|
+
</div>
|
|
1012
|
+
<div class='modal-body'>Confirmation dialog body content</div>
|
|
1013
|
+
<div class='modal-footer'>
|
|
1014
|
+
<div class='btn-toolbar'>
|
|
1015
|
+
<button type='button' class='CancelButton btn btn-default'>
|
|
1016
|
+
Abort the action
|
|
1017
|
+
</button>
|
|
1018
|
+
<button type='button' class='ConfirmationButton btn btn-primary'>
|
|
1019
|
+
Confirm the action
|
|
1020
|
+
</button>
|
|
1021
|
+
</div>
|
|
1022
|
+
</div>
|
|
1023
|
+
</div>
|
|
1024
|
+
</div>
|
|
1025
|
+
<div class='modal-backdrop'></div>
|
|
1026
|
+
</div>;
|
|
1027
|
+
```
|
|
1028
|
+
|
|
1029
|
+
#### Props
|
|
1030
|
+
|
|
1031
|
+
| Name | Type | Default | Description |
|
|
1032
|
+
| --- | --- | --- | --- |
|
|
1033
|
+
| show | Boolean | false | Opens the dialog when set to true |
|
|
1034
|
+
| title | Node | — | The dialog title (can also be a FormattedMessage component) |
|
|
1035
|
+
| subtitle | Node | — | The subtitle content |
|
|
1036
|
+
| content | Node | — | The content of the dialog body itself |
|
|
1037
|
+
| useOverflow | Boolean | false | Enables the modal body to overflow and use inline scrolling if needed.Set the class "no-overflow-gradient" to remove the overflow gradient in case it is problematic like when the background is gray. |
|
|
1038
|
+
| onClickConfirm | Function | () => {} | A callback fired when the confirmation button is clicked. |
|
|
1039
|
+
| onClickCancel | Function | () => {} | A callback fired when the cancel button is clicked or the dialog is closed. |
|
|
1040
|
+
| cancelButtonText | Node | — | The content of the cancel button. (Usually a text, can also be a FormattedMessage component). |
|
|
1041
|
+
| confirmButtonText | Node | — | The content of the confirmation button. Since it is a node, it can be a simple text or any JSX node like a div element with an icon and a text. |
|
|
1042
|
+
| disableConfirm | Boolean | — | When set to true the confirmation button will be disabled |
|
|
1043
|
+
| bsSize | String | md | Defined how large the dialog will be rendered. By default, the dialog has a medium size and thus it can be omitted. Possible values are: Dialog.SIZE_XS, Dialog.SIZE_SM, Dialog.SIZE_LG, Dialog.SIZE_XL, Dialog.SIZE_FULL_WIDTH, Dialog.SIZE_FULL_HEIGHT, Dialog.SIZE_FULL_SCREEN or 'xs', 'sm', 'lg', 'xl', 'fullwidth', 'fullheight', 'fullheight-lg', 'fullheight-xl', 'fullscreen' |
|
|
1044
|
+
|
|
1045
|
+
## SaveDialog
|
|
1046
|
+
|
|
1047
|
+
This component allows the user to create a save dialog. It uses the dialog component described above.
|
|
1048
|
+
|
|
1049
|
+
### Example: Example 7
|
|
1050
|
+
|
|
1051
|
+
Save dialog
|
|
1052
|
+
|
|
1053
|
+
#### Summary
|
|
1054
|
+
|
|
1055
|
+
Save dialog
|
|
1056
|
+
|
|
1057
|
+
#### React (tsx)
|
|
1058
|
+
|
|
1059
|
+
```tsx
|
|
1060
|
+
import { useState } from 'react';
|
|
1061
|
+
|
|
1062
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
1063
|
+
import SaveDialog from '@rio-cloud/rio-uikit/SaveDialog';
|
|
1064
|
+
|
|
1065
|
+
export default () => {
|
|
1066
|
+
const [show, setShow] = useState(false);
|
|
1067
|
+
|
|
1068
|
+
return (
|
|
1069
|
+
<>
|
|
1070
|
+
<Button bsStyle='primary' onClick={() => setShow(true)}>
|
|
1071
|
+
Save dialog
|
|
1072
|
+
</Button>
|
|
1073
|
+
<SaveDialog
|
|
1074
|
+
show={show}
|
|
1075
|
+
title='Save Dialog Title'
|
|
1076
|
+
content='Save Dialog Body Content'
|
|
1077
|
+
onClickConfirm={() => setShow(false)}
|
|
1078
|
+
onClickCancel={() => setShow(false)}
|
|
1079
|
+
onClickDiscard={() => setShow(false)}
|
|
1080
|
+
discardButtonText='Discard changes'
|
|
1081
|
+
cancelButtonText='Continue editing'
|
|
1082
|
+
confirmButtonText={
|
|
1083
|
+
<>
|
|
1084
|
+
<span className='rioglyph rioglyph-save margin-right-5' />
|
|
1085
|
+
<span>Save changes</span>
|
|
1086
|
+
</>
|
|
1087
|
+
}
|
|
1088
|
+
/>
|
|
1089
|
+
</>
|
|
1090
|
+
);
|
|
1091
|
+
};
|
|
1092
|
+
```
|
|
1093
|
+
|
|
1094
|
+
#### HTML (html)
|
|
1095
|
+
|
|
1096
|
+
```html
|
|
1097
|
+
<div class='modal show save-dialog modal-enter-done' tabindex='1' role='dialog'>
|
|
1098
|
+
<div class='modal-dialog' role='document'>
|
|
1099
|
+
<div class='modal-content'>
|
|
1100
|
+
<div class='modal-header'>
|
|
1101
|
+
<div class='modal-header-text'>
|
|
1102
|
+
<div class='modal-header-title'>Save Dialog Title</div>
|
|
1103
|
+
</div>
|
|
1104
|
+
<div class='modal-header-buttons'>
|
|
1105
|
+
<button
|
|
1106
|
+
type='button'
|
|
1107
|
+
class='btn btn-icon-only btn-muted modal-header-close close'
|
|
1108
|
+
data-testid='close'
|
|
1109
|
+
>
|
|
1110
|
+
<span class='rioglyph rioglyph-remove' aria-hidden='true'></span>
|
|
1111
|
+
</button>
|
|
1112
|
+
</div>
|
|
1113
|
+
</div>
|
|
1114
|
+
<div class='modal-body'>Save Dialog Body Content</div>
|
|
1115
|
+
<div class='modal-footer'>
|
|
1116
|
+
<div class='btn-toolbar'>
|
|
1117
|
+
<button type='button' class='DiscardButton btn btn-default'>
|
|
1118
|
+
Discard
|
|
1119
|
+
</button>
|
|
1120
|
+
<button type='button' class='CancelButton btn btn-default'>
|
|
1121
|
+
Abort
|
|
1122
|
+
</button>
|
|
1123
|
+
<button type='button' class='ConfirmationButton btn btn-primary'>
|
|
1124
|
+
<span> Save</span>
|
|
1125
|
+
</button>
|
|
1126
|
+
</div>
|
|
1127
|
+
</div>
|
|
1128
|
+
</div>
|
|
1129
|
+
</div>
|
|
1130
|
+
<div class='modal-backdrop'></div>
|
|
1131
|
+
</div>;
|
|
1132
|
+
```
|
|
1133
|
+
|
|
1134
|
+
#### Props
|
|
1135
|
+
|
|
1136
|
+
| Name | Type | Default | Description |
|
|
1137
|
+
| --- | --- | --- | --- |
|
|
1138
|
+
| show | Boolean | false | Opens the dialog when set to true |
|
|
1139
|
+
| title | Node | — | The dialog title (can also be a FormattedMessage component) |
|
|
1140
|
+
| subtitle | Node | — | The subtitle content |
|
|
1141
|
+
| content | Node | — | The content of the dialog body itself |
|
|
1142
|
+
| onClickCancel | Function | () => {} | A callback fired when the cancel button is clicked or the dialog is closed. |
|
|
1143
|
+
| onClickDiscard | Function | () => {} | A callback fired when the discard button is clicked. |
|
|
1144
|
+
| onClickConfirm | Function | () => {} | A callback fired when the confirmation button is clicked. |
|
|
1145
|
+
| discardButtonText | Node | — | The content of the discard button. (Usually a text, can also be a FormattedMessage component). |
|
|
1146
|
+
| cancelButtonText | Node | — | The content of the cancel button. (Usually a text, can also be a FormattedMessage component). |
|
|
1147
|
+
| confirmButtonText | Node | — | The content of the confirmation button. Since it is a node, it can be a simple text or any JSX node like a div element with an icon and a text. |
|
|
1148
|
+
| bsSize | String | md | Defined how large the dialog will be rendered. By default, the dialog has a medium size and thus it can be omitted. Possible values are: Dialog.SIZE_XS, Dialog.SIZE_SM, Dialog.SIZE_LG, Dialog.SIZE_XL, Dialog.SIZE_FULL_WIDTH, Dialog.SIZE_FULL_HEIGHT, Dialog.SIZE_FULL_SCREEN or 'xs', 'sm', 'lg', 'xl', 'fullwidth', 'fullheight', 'fullheight-lg', 'fullheight-xl', 'fullscreen' |
|
|
1149
|
+
| onClose | Function | () => {} | A callback function invoked when the dialog closes |
|
|
1150
|
+
| onCloseValidation | Function | () => true | A callback function to be executed before closing the dialog. If the function returns false the dialog will not be closed. |
|
|
1151
|
+
| showCloseButton | Boolean | true | Shows a close button when set to true |
|
|
1152
|
+
| useOverflow | Boolean | false | Enables the modal body to overflow and use inline scrolling if needed.Set the class "no-overflow-gradient" to remove the overflow gradient in case it is problematic like when the background is gray. |
|
|
1153
|
+
| className | String | — | Additional classes for the modal element |
|
|
1154
|
+
|
|
1155
|
+
## SplitDialog
|
|
1156
|
+
|
|
1157
|
+
This component allows the user to create a split dialog. It uses the dialog component described above.
|
|
1158
|
+
|
|
1159
|
+
### Example: Example 8
|
|
1160
|
+
|
|
1161
|
+
Split dialogSplit dialog large
|
|
1162
|
+
|
|
1163
|
+
#### Summary
|
|
1164
|
+
|
|
1165
|
+
Split dialogSplit dialog large
|
|
1166
|
+
|
|
1167
|
+
#### React (tsx)
|
|
1168
|
+
|
|
1169
|
+
```tsx
|
|
1170
|
+
import { useState } from 'react';
|
|
1171
|
+
|
|
1172
|
+
import composition from '../../../assets/getting_started_composition.webp';
|
|
1173
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
1174
|
+
import SplitDialog from '@rio-cloud/rio-uikit/SplitDialog';
|
|
1175
|
+
import ListMenu from '@rio-cloud/rio-uikit/ListMenu';
|
|
1176
|
+
import Notification from '@rio-cloud/rio-uikit/Notification';
|
|
1177
|
+
import { dummyTextLong, dummyTextShort } from '../../../utils/data';
|
|
1178
|
+
|
|
1179
|
+
export default () => {
|
|
1180
|
+
const [show, setShow] = useState(false);
|
|
1181
|
+
const [showLg, setShowLg] = useState(false);
|
|
1182
|
+
|
|
1183
|
+
const handleClose = () => {
|
|
1184
|
+
setShow(false);
|
|
1185
|
+
console.log('dialog closed');
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1188
|
+
return (
|
|
1189
|
+
<div className='btn-toolbar'>
|
|
1190
|
+
<Button bsStyle='primary' onClick={() => setShow(true)}>
|
|
1191
|
+
Split dialog
|
|
1192
|
+
</Button>
|
|
1193
|
+
<SplitDialog
|
|
1194
|
+
show={show}
|
|
1195
|
+
title='Split dialog title'
|
|
1196
|
+
onClose={handleClose}
|
|
1197
|
+
leftContent={<ListMenu menuItems={menuItems} groupClassName='padding-left-0' />}
|
|
1198
|
+
rightContentClassName='bg-lightest'
|
|
1199
|
+
footer={<div>Sample footer</div>}
|
|
1200
|
+
rightContent={
|
|
1201
|
+
<>
|
|
1202
|
+
<div className='h4'>Dolor sit amet</div>
|
|
1203
|
+
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy</p>
|
|
1204
|
+
<div className='padding-top-15'>
|
|
1205
|
+
<div className='panel panel-default shadow-default'>
|
|
1206
|
+
<div className='panel-heading text-color-darkest text-bold'>Admin</div>
|
|
1207
|
+
<div className='panel-body'>
|
|
1208
|
+
<ul className='padding-left-20 margin-0'>
|
|
1209
|
+
<li>Permission to read all vehicles and their master data.</li>
|
|
1210
|
+
<li>Permission to change driver emails.</li>
|
|
1211
|
+
</ul>
|
|
1212
|
+
</div>
|
|
1213
|
+
</div>
|
|
1214
|
+
<div className='panel panel-default shadow-default'>
|
|
1215
|
+
<div className='panel-heading text-color-darkest text-bold'>Reader</div>
|
|
1216
|
+
<div className='panel-body'>
|
|
1217
|
+
<ul className='padding-left-20 margin-0'>
|
|
1218
|
+
<li>Permission to read all reports</li>
|
|
1219
|
+
</ul>
|
|
1220
|
+
</div>
|
|
1221
|
+
</div>
|
|
1222
|
+
<div className='panel panel-default shadow-default'>
|
|
1223
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1224
|
+
<div className='panel-body' />
|
|
1225
|
+
</div>
|
|
1226
|
+
<div className='panel panel-default shadow-default'>
|
|
1227
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1228
|
+
<div className='panel-body' />
|
|
1229
|
+
</div>
|
|
1230
|
+
<div className='panel panel-default shadow-default'>
|
|
1231
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1232
|
+
<div className='panel-body' />
|
|
1233
|
+
</div>
|
|
1234
|
+
<div className='panel panel-default shadow-default'>
|
|
1235
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1236
|
+
<div className='panel-body' />
|
|
1237
|
+
</div>
|
|
1238
|
+
<div className='panel panel-default shadow-default'>
|
|
1239
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1240
|
+
<div className='panel-body' />
|
|
1241
|
+
</div>
|
|
1242
|
+
<div className='panel panel-default shadow-default'>
|
|
1243
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1244
|
+
<div className='panel-body' />
|
|
1245
|
+
</div>
|
|
1246
|
+
<div className='panel panel-default shadow-default'>
|
|
1247
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1248
|
+
<div className='panel-body' />
|
|
1249
|
+
</div>
|
|
1250
|
+
<div className='panel panel-default shadow-default'>
|
|
1251
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1252
|
+
<div className='panel-body' />
|
|
1253
|
+
</div>
|
|
1254
|
+
<div className='panel panel-default shadow-default'>
|
|
1255
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1256
|
+
<div className='panel-body' />
|
|
1257
|
+
</div>
|
|
1258
|
+
<div className='panel panel-default shadow-default'>
|
|
1259
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1260
|
+
<div className='panel-body' />
|
|
1261
|
+
</div>
|
|
1262
|
+
<div className='panel panel-default shadow-default'>
|
|
1263
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1264
|
+
<div className='panel-body' />
|
|
1265
|
+
</div>
|
|
1266
|
+
<div className='panel panel-default shadow-default'>
|
|
1267
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1268
|
+
<div className='panel-body' />
|
|
1269
|
+
</div>
|
|
1270
|
+
<div className='panel panel-default shadow-default'>
|
|
1271
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1272
|
+
<div className='panel-body' />
|
|
1273
|
+
</div>
|
|
1274
|
+
<div className='panel panel-default shadow-default'>
|
|
1275
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1276
|
+
<div className='panel-body' />
|
|
1277
|
+
</div>
|
|
1278
|
+
<div className='panel panel-default shadow-default'>
|
|
1279
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1280
|
+
<div className='panel-body' />
|
|
1281
|
+
</div>
|
|
1282
|
+
<div className='panel panel-default shadow-default'>
|
|
1283
|
+
<div className='panel-heading text-color-darkest text-bold'>Lorem ipsum</div>
|
|
1284
|
+
<div className='panel-body' />
|
|
1285
|
+
</div>
|
|
1286
|
+
</div>
|
|
1287
|
+
</>
|
|
1288
|
+
}
|
|
1289
|
+
/>
|
|
1290
|
+
|
|
1291
|
+
<Button bsStyle='primary' onClick={() => setShowLg(true)}>
|
|
1292
|
+
Split dialog large
|
|
1293
|
+
</Button>
|
|
1294
|
+
<SplitDialog
|
|
1295
|
+
show={showLg}
|
|
1296
|
+
bsSize='lg'
|
|
1297
|
+
title='Split dialog title'
|
|
1298
|
+
onClose={() => setShowLg(false)}
|
|
1299
|
+
leftContent={
|
|
1300
|
+
<ListMenu menuItems={menuItems2} groupClassName='padding-left-0' className='padding-top-5' />
|
|
1301
|
+
}
|
|
1302
|
+
leftContentClassName='padding-top-25'
|
|
1303
|
+
showDivider={false}
|
|
1304
|
+
rightContent={
|
|
1305
|
+
<>
|
|
1306
|
+
<div className='text-size-h2 text-medium margin-bottom-15'>Dolor sit amet</div>
|
|
1307
|
+
<p>{dummyTextShort}</p>
|
|
1308
|
+
<img className='img-responsive border rounded' alt='Intro' src={composition} />
|
|
1309
|
+
<div className='display-flex gap-50 margin-top-25'>
|
|
1310
|
+
<div className='flex-1-1'>
|
|
1311
|
+
<p className='h4'>Lorem ipsum dolor sit amet</p>
|
|
1312
|
+
<div>{dummyTextLong}</div>
|
|
1313
|
+
</div>
|
|
1314
|
+
<div className='flex-1-1'>
|
|
1315
|
+
<p className='h4'>Lorem ipsum dolor sit amet</p>
|
|
1316
|
+
<div>{dummyTextLong}</div>
|
|
1317
|
+
</div>
|
|
1318
|
+
</div>
|
|
1319
|
+
</>
|
|
1320
|
+
}
|
|
1321
|
+
/>
|
|
1322
|
+
</div>
|
|
1323
|
+
);
|
|
1324
|
+
};
|
|
1325
|
+
|
|
1326
|
+
const menuItems = [
|
|
1327
|
+
{
|
|
1328
|
+
group: 'Rolls',
|
|
1329
|
+
navItems: [
|
|
1330
|
+
{
|
|
1331
|
+
key: '1',
|
|
1332
|
+
item: (
|
|
1333
|
+
<span className='active' onClick={() => Notification.info('Fleetadmin clicked')}>
|
|
1334
|
+
Fleetadmin
|
|
1335
|
+
</span>
|
|
1336
|
+
),
|
|
1337
|
+
},
|
|
1338
|
+
{
|
|
1339
|
+
key: '2',
|
|
1340
|
+
item: <span onClick={() => Notification.info('Fleetuser clicked')}>Fleetuser</span>,
|
|
1341
|
+
},
|
|
1342
|
+
{
|
|
1343
|
+
key: '3',
|
|
1344
|
+
item: <span onClick={() => Notification.info('Fleetdriver clicked')}>Fleetdriver</span>,
|
|
1345
|
+
},
|
|
1346
|
+
],
|
|
1347
|
+
},
|
|
1348
|
+
];
|
|
1349
|
+
|
|
1350
|
+
const menuItems2 = [
|
|
1351
|
+
{
|
|
1352
|
+
group: 'Service name',
|
|
1353
|
+
navItems: [
|
|
1354
|
+
{
|
|
1355
|
+
key: '1',
|
|
1356
|
+
item: <span className='active'>Welcome</span>,
|
|
1357
|
+
},
|
|
1358
|
+
{
|
|
1359
|
+
key: '2',
|
|
1360
|
+
item: <span>What's new</span>,
|
|
1361
|
+
},
|
|
1362
|
+
],
|
|
1363
|
+
},
|
|
1364
|
+
{
|
|
1365
|
+
group: 'Features',
|
|
1366
|
+
navItems: [
|
|
1367
|
+
{
|
|
1368
|
+
key: '1',
|
|
1369
|
+
item: <span>Feature name one</span>,
|
|
1370
|
+
},
|
|
1371
|
+
{
|
|
1372
|
+
key: '2',
|
|
1373
|
+
item: <span>Another cool feature for this</span>,
|
|
1374
|
+
},
|
|
1375
|
+
{
|
|
1376
|
+
key: '2',
|
|
1377
|
+
item: <span>That is a nice feature</span>,
|
|
1378
|
+
},
|
|
1379
|
+
],
|
|
1380
|
+
},
|
|
1381
|
+
];
|
|
1382
|
+
```
|
|
1383
|
+
|
|
1384
|
+
#### HTML (html)
|
|
1385
|
+
|
|
1386
|
+
```html
|
|
1387
|
+
<div class='modal show split-dialog modal-enter-done' tabindex='1' role='dialog'>
|
|
1388
|
+
<div class='modal-dialog modal-overflow' role='document'>
|
|
1389
|
+
<div class='modal-content'>
|
|
1390
|
+
<div class='modal-header'>
|
|
1391
|
+
<div class='modal-header-text'>
|
|
1392
|
+
<div class='modal-header-title'>Split Dialog Title</div>
|
|
1393
|
+
</div>
|
|
1394
|
+
<div class='modal-header-buttons'>
|
|
1395
|
+
<button
|
|
1396
|
+
type='button'
|
|
1397
|
+
class='btn btn-icon-only btn-muted modal-header-close close'
|
|
1398
|
+
data-testid='close'
|
|
1399
|
+
>
|
|
1400
|
+
<span class='rioglyph rioglyph-remove' aria-hidden='true'></span>
|
|
1401
|
+
</button>
|
|
1402
|
+
</div>
|
|
1403
|
+
</div>
|
|
1404
|
+
<div class='modal-body'>
|
|
1405
|
+
<div class='split-wrapper'>
|
|
1406
|
+
<div class='split-left '>
|
|
1407
|
+
{/* <!-- Left Content --> */}
|
|
1408
|
+
<div class='split-divider bg-lighter'></div>
|
|
1409
|
+
</div>
|
|
1410
|
+
<div class='split-right bg-lightest'>
|
|
1411
|
+
{/* <!-- Right Content --> */}
|
|
1412
|
+
</div>
|
|
1413
|
+
</div>
|
|
1414
|
+
</div>
|
|
1415
|
+
</div>
|
|
1416
|
+
</div>
|
|
1417
|
+
<div class='modal-backdrop'></div>
|
|
1418
|
+
</div>;
|
|
1419
|
+
```
|
|
1420
|
+
|
|
1421
|
+
#### Props
|
|
1422
|
+
|
|
1423
|
+
| Name | Type | Default | Description |
|
|
1424
|
+
| --- | --- | --- | --- |
|
|
1425
|
+
| show | Boolean | false | Opens the dialog when set to true |
|
|
1426
|
+
| title | Node | — | The dialog title (can also be a FormattedMessage component) |
|
|
1427
|
+
| subtitle | Node | — | The subtitle content |
|
|
1428
|
+
| leftContent | Node | — | The content to be shown on the left side. |
|
|
1429
|
+
| leftContentClassName | String | — | Additional classes for the left content element. |
|
|
1430
|
+
| rightContent | Node | — | The content to be shown on the right side. |
|
|
1431
|
+
| rightContentClassName | String | — | Additional classes for the right content element. |
|
|
1432
|
+
| onClose | Function | () => {} | A callback function invoked when the dialog closes |
|
|
1433
|
+
| onCloseValidation | Function | () => true | A callback function to be executed before closing the dialog. If the function returns false the dialog will not be closed. |
|
|
1434
|
+
| showCloseButton | Boolean | true | Shows a close button when set to true |
|
|
1435
|
+
| disableEsc | Boolean | false | Enables or disabled closing the dialog via esc key |
|
|
1436
|
+
| onEsc | Function | () => {} | A callback fired when esc key is pressed and the dialog is about to close |
|
|
1437
|
+
| useOverflow | Boolean | true | Enables the modal body to overflow and use inline scrolling if needed.Set the class "no-overflow-gradient" to remove the overflow gradient in case it is problematic like when the background is gray. |
|
|
1438
|
+
| bsSize | String | md | Defined how large the dialog will be rendered. By default, the dialog has a medium size and thus it can be omitted. Possible values are: Dialog.SIZE_XS, Dialog.SIZE_SM, Dialog.SIZE_LG, Dialog.SIZE_XL, Dialog.SIZE_FULL_WIDTH, Dialog.SIZE_FULL_HEIGHT, Dialog.SIZE_FULL_SCREEN or 'xs', 'sm', 'lg', 'xl', 'fullwidth', 'fullheight', 'fullheight-lg', 'fullheight-xl', 'fullscreen' |
|
|
1439
|
+
| className | String | — | Additional classes for the modal element |
|
|
1440
|
+
| footerClassName | String | — | Additional classes for the modal-footer element |
|
|
1441
|
+
| footer | Node | — | The dialog footer content |
|
|
1442
|
+
|
|
1443
|
+
## InfoDialog
|
|
1444
|
+
|
|
1445
|
+
This component allows the user to create a dialog without title and footer. It uses the dialog component described above.
|
|
1446
|
+
|
|
1447
|
+
### Example: Example 9
|
|
1448
|
+
|
|
1449
|
+
Info dialog
|
|
1450
|
+
|
|
1451
|
+
#### Summary
|
|
1452
|
+
|
|
1453
|
+
Info dialog
|
|
1454
|
+
|
|
1455
|
+
#### React (tsx)
|
|
1456
|
+
|
|
1457
|
+
```tsx
|
|
1458
|
+
import { useState } from 'react';
|
|
1459
|
+
|
|
1460
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
1461
|
+
import InfoDialog from '@rio-cloud/rio-uikit/InfoDialog';
|
|
1462
|
+
|
|
1463
|
+
const InfoDialogExample = () => {
|
|
1464
|
+
const [show, setShow] = useState(false);
|
|
1465
|
+
|
|
1466
|
+
const handleShow = () => setShow(true);
|
|
1467
|
+
const handleHide = () => setShow(false);
|
|
1468
|
+
|
|
1469
|
+
return (
|
|
1470
|
+
<div>
|
|
1471
|
+
<Button bsStyle='primary' onClick={handleShow}>
|
|
1472
|
+
Info dialog
|
|
1473
|
+
</Button>
|
|
1474
|
+
<InfoDialog
|
|
1475
|
+
show={show}
|
|
1476
|
+
onClose={handleHide}
|
|
1477
|
+
content={
|
|
1478
|
+
<div className='text-center'>
|
|
1479
|
+
<div className='margin-bottom-25'>
|
|
1480
|
+
<h2>Lorem ipsum dolor sit amet</h2>
|
|
1481
|
+
<p>
|
|
1482
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit.Aliquam laoreet nec neque ut
|
|
1483
|
+
fermentum. Vestibulum erat enim.
|
|
1484
|
+
</p>
|
|
1485
|
+
</div>
|
|
1486
|
+
<Button className='margin-bottom-20' onClick={handleHide}>
|
|
1487
|
+
Got it
|
|
1488
|
+
</Button>
|
|
1489
|
+
</div>
|
|
1490
|
+
}
|
|
1491
|
+
/>
|
|
1492
|
+
</div>
|
|
1493
|
+
);
|
|
1494
|
+
};
|
|
1495
|
+
|
|
1496
|
+
export default InfoDialogExample;
|
|
1497
|
+
```
|
|
1498
|
+
|
|
1499
|
+
#### HTML (html)
|
|
1500
|
+
|
|
1501
|
+
```html
|
|
1502
|
+
<div class='modal show info-dialog modal-enter-done' tabindex='1' role='dialog'>
|
|
1503
|
+
<div class='modal-dialog' role='document'>
|
|
1504
|
+
<div class='modal-content'>
|
|
1505
|
+
<div class='modal-body'>
|
|
1506
|
+
<div class='text-center'>
|
|
1507
|
+
<div class='margin-bottom-25'>
|
|
1508
|
+
<h2>Lorem ipsum dolor sit amet</h2>
|
|
1509
|
+
<p>
|
|
1510
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam laoreet nec neque ut
|
|
1511
|
+
fermentum. Vestibulum erat enim.
|
|
1512
|
+
</p>
|
|
1513
|
+
</div>
|
|
1514
|
+
<button type='button' class='btn btn-primary margin-bottom-20'>
|
|
1515
|
+
Understood, close me
|
|
1516
|
+
</button>
|
|
1517
|
+
</div>
|
|
1518
|
+
</div>
|
|
1519
|
+
</div>
|
|
1520
|
+
</div>
|
|
1521
|
+
<div class='modal-backdrop'></div>
|
|
1522
|
+
</div>;
|
|
1523
|
+
```
|
|
1524
|
+
|
|
1525
|
+
#### Props
|
|
1526
|
+
|
|
1527
|
+
| Name | Type | Default | Description |
|
|
1528
|
+
| --- | --- | --- | --- |
|
|
1529
|
+
| show | Boolean | false | Opens the dialog when set to true |
|
|
1530
|
+
| title | Node | — | The dialog title (can also be a FormattedMessage component) |
|
|
1531
|
+
| subtitle | Node | — | The subtitle content |
|
|
1532
|
+
| content | Node | — | The content of the dialog body itself |
|
|
1533
|
+
| footer | Node | — | The dialog footer content |
|
|
1534
|
+
| footerClassName | String | — | Additional classes for the modal-footer element |
|
|
1535
|
+
| bodyClassName | String | — | Additional classes for the modal-body element |
|
|
1536
|
+
| onClose | Function | () => {} | A callback function invoked when the dialog closes |
|
|
1537
|
+
| onCloseValidation | Function | () => true | A callback function to be executed before closing the dialog. If the function returns false the dialog will not be closed. |
|
|
1538
|
+
| showCloseButton | Boolean | true | Shows a close button when set to true |
|
|
1539
|
+
| disableEsc | Boolean | false | Enables or disabled closing the dialog via esc key |
|
|
1540
|
+
| onEsc | Function | () => {} | A callback fired when esc key is pressed and the dialog is about to close |
|
|
1541
|
+
| useOverflow | Boolean | false | Enables the modal body to overflow and use inline scrolling if needed.Set the class "no-overflow-gradient" to remove the overflow gradient in case it is problematic like when the background is gray. |
|
|
1542
|
+
| bsSize | String | md | Defined how large the dialog will be rendered. By default, the dialog has a medium size and thus it can be omitted. Possible values are: Dialog.SIZE_XS, Dialog.SIZE_SM, Dialog.SIZE_LG, Dialog.SIZE_XL, Dialog.SIZE_FULL_WIDTH, Dialog.SIZE_FULL_HEIGHT, Dialog.SIZE_FULL_SCREEN or 'xs', 'sm', 'lg', 'xl', 'fullwidth', 'fullheight', 'fullheight-lg', 'fullheight-xl', 'fullscreen' |
|
|
1543
|
+
| className | String | — | Additional classes for the modal element |
|
|
1544
|
+
|
|
1545
|
+
### Example: Example 10
|
|
1546
|
+
|
|
1547
|
+
Feature info dialog
|
|
1548
|
+
|
|
1549
|
+
#### Summary
|
|
1550
|
+
|
|
1551
|
+
Feature info dialog
|
|
1552
|
+
|
|
1553
|
+
#### React (tsx)
|
|
1554
|
+
|
|
1555
|
+
```tsx
|
|
1556
|
+
import { useState } from 'react';
|
|
1557
|
+
|
|
1558
|
+
import composition from '../../../assets/getting_started_composition.webp';
|
|
1559
|
+
import InfoDialog from '@rio-cloud/rio-uikit/InfoDialog';
|
|
1560
|
+
import SimpleTooltip from '@rio-cloud/rio-uikit/SimpleTooltip';
|
|
1561
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
1562
|
+
import { dummyText } from '../../../utils/data';
|
|
1563
|
+
|
|
1564
|
+
const InfoDialogFeatureExample = () => {
|
|
1565
|
+
const [show, setShow] = useState(false);
|
|
1566
|
+
|
|
1567
|
+
const handleShow = () => setShow(true);
|
|
1568
|
+
const handleHide = () => setShow(false);
|
|
1569
|
+
|
|
1570
|
+
return (
|
|
1571
|
+
<div>
|
|
1572
|
+
<Button bsStyle='primary' onClick={handleShow}>
|
|
1573
|
+
Feature info dialog
|
|
1574
|
+
</Button>
|
|
1575
|
+
<InfoDialog
|
|
1576
|
+
show={show}
|
|
1577
|
+
onClose={handleHide}
|
|
1578
|
+
bodyClassName='padding-0'
|
|
1579
|
+
content={
|
|
1580
|
+
<div>
|
|
1581
|
+
<div>
|
|
1582
|
+
<img
|
|
1583
|
+
className='img-responsive rounded-top-right-extra-large rounded-top-left-extra-large'
|
|
1584
|
+
src={composition}
|
|
1585
|
+
/>
|
|
1586
|
+
</div>
|
|
1587
|
+
<div className='position-relative padding-20 margin-top-10 margin-x-20'>
|
|
1588
|
+
<SimpleTooltip placement='bottom' content='Close'>
|
|
1589
|
+
<div
|
|
1590
|
+
className='position-absolute top-20 right-20 text-color-gray cursor-pointer'
|
|
1591
|
+
onClick={handleHide}
|
|
1592
|
+
>
|
|
1593
|
+
<span className='rioglyph rioglyph-remove' />
|
|
1594
|
+
</div>
|
|
1595
|
+
</SimpleTooltip>
|
|
1596
|
+
<div className='text-size-h3 text-medium margin-bottom-15 margin-right-20'>
|
|
1597
|
+
Feature Lorem Ipsum dolor sit amet (Beta)
|
|
1598
|
+
</div>
|
|
1599
|
+
<p>{dummyText}</p>
|
|
1600
|
+
</div>
|
|
1601
|
+
<div
|
|
1602
|
+
className={
|
|
1603
|
+
'display-flex flex-row-sm flex-column gap-10 justify-content-between ' +
|
|
1604
|
+
'align-items-start align-items-center-sm width-100pct bg-lightest ' +
|
|
1605
|
+
'padding-20 rounded-bottom-right-extra-large rounded-bottom-left-extra-large'
|
|
1606
|
+
}
|
|
1607
|
+
>
|
|
1608
|
+
<div className='btn-toolbar text-transform-uppercase margin-x-20 text-medium'>
|
|
1609
|
+
How important is this feature to you?
|
|
1610
|
+
</div>
|
|
1611
|
+
<div className='btn-toolbar text-transform-uppercase margin-x-20'>
|
|
1612
|
+
<SimpleTooltip placement='top' content='This would be cool, convenient or useful'>
|
|
1613
|
+
<Button bsStyle={Button.INFO} onClick={handleHide}>
|
|
1614
|
+
Nice-to-have
|
|
1615
|
+
</Button>
|
|
1616
|
+
</SimpleTooltip>
|
|
1617
|
+
<SimpleTooltip placement='top' content='This would solve a major need'>
|
|
1618
|
+
<Button bsStyle={Button.INFO} onClick={handleHide}>
|
|
1619
|
+
Important
|
|
1620
|
+
</Button>
|
|
1621
|
+
</SimpleTooltip>
|
|
1622
|
+
<SimpleTooltip placement='top' content='Withou it, we cannot use the service'>
|
|
1623
|
+
<Button bsStyle={Button.INFO} onClick={handleHide}>
|
|
1624
|
+
Critical
|
|
1625
|
+
</Button>
|
|
1626
|
+
</SimpleTooltip>
|
|
1627
|
+
</div>
|
|
1628
|
+
</div>
|
|
1629
|
+
</div>
|
|
1630
|
+
}
|
|
1631
|
+
/>
|
|
1632
|
+
</div>
|
|
1633
|
+
);
|
|
1634
|
+
};
|
|
1635
|
+
|
|
1636
|
+
export default InfoDialogFeatureExample;
|
|
1637
|
+
```
|
|
1638
|
+
|
|
1639
|
+
#### HTML (html)
|
|
1640
|
+
|
|
1641
|
+
```html
|
|
1642
|
+
<div class='modal show info-dialog modal-enter-done' tabindex='1' role='dialog'>
|
|
1643
|
+
<div class='modal-dialog' role='document'>
|
|
1644
|
+
<div class='modal-content'>
|
|
1645
|
+
<div class='modal-body'>
|
|
1646
|
+
<div class='text-center'>
|
|
1647
|
+
<div class='margin-bottom-25'>
|
|
1648
|
+
<h2>Lorem ipsum dolor sit amet</h2>
|
|
1649
|
+
<p>
|
|
1650
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam laoreet nec neque ut
|
|
1651
|
+
fermentum. Vestibulum erat enim.
|
|
1652
|
+
</p>
|
|
1653
|
+
</div>
|
|
1654
|
+
<button type='button' class='btn btn-primary margin-bottom-20'>
|
|
1655
|
+
Understood, close me
|
|
1656
|
+
</button>
|
|
1657
|
+
</div>
|
|
1658
|
+
</div>
|
|
1659
|
+
</div>
|
|
1660
|
+
</div>
|
|
1661
|
+
<div class='modal-backdrop'></div>
|
|
1662
|
+
</div>;
|
|
1663
|
+
```
|
|
1664
|
+
|
|
1665
|
+
#### Props
|
|
1666
|
+
|
|
1667
|
+
| Name | Type | Default | Description |
|
|
1668
|
+
| --- | --- | --- | --- |
|
|
1669
|
+
| show | Boolean | false | Opens the dialog when set to true |
|
|
1670
|
+
| title | Node | — | The dialog title (can also be a FormattedMessage component) |
|
|
1671
|
+
| subtitle | Node | — | The subtitle content |
|
|
1672
|
+
| content | Node | — | The content of the dialog body itself |
|
|
1673
|
+
| footer | Node | — | The dialog footer content |
|
|
1674
|
+
| footerClassName | String | — | Additional classes for the modal-footer element |
|
|
1675
|
+
| bodyClassName | String | — | Additional classes for the modal-body element |
|
|
1676
|
+
| onClose | Function | () => {} | A callback function invoked when the dialog closes |
|
|
1677
|
+
| onCloseValidation | Function | () => true | A callback function to be executed before closing the dialog. If the function returns false the dialog will not be closed. |
|
|
1678
|
+
| showCloseButton | Boolean | true | Shows a close button when set to true |
|
|
1679
|
+
| disableEsc | Boolean | false | Enables or disabled closing the dialog via esc key |
|
|
1680
|
+
| onEsc | Function | () => {} | A callback fired when esc key is pressed and the dialog is about to close |
|
|
1681
|
+
| useOverflow | Boolean | false | Enables the modal body to overflow and use inline scrolling if needed.Set the class "no-overflow-gradient" to remove the overflow gradient in case it is problematic like when the background is gray. |
|
|
1682
|
+
| bsSize | String | md | Defined how large the dialog will be rendered. By default, the dialog has a medium size and thus it can be omitted. Possible values are: Dialog.SIZE_XS, Dialog.SIZE_SM, Dialog.SIZE_LG, Dialog.SIZE_XL, Dialog.SIZE_FULL_WIDTH, Dialog.SIZE_FULL_HEIGHT, Dialog.SIZE_FULL_SCREEN or 'xs', 'sm', 'lg', 'xl', 'fullwidth', 'fullheight', 'fullheight-lg', 'fullheight-xl', 'fullscreen' |
|
|
1683
|
+
| className | String | — | Additional classes for the modal element |
|
|
1684
|
+
|
|
1685
|
+
## OnboardingDialog
|
|
1686
|
+
|
|
1687
|
+
The OnboardingDialog component is a customizable dialog designed to guide users through the initial steps of an onboarding tour. It displays a welcome message, a brief description of the onboarding process, and action buttons to either start the tour or skip it.
|
|
1688
|
+
|
|
1689
|
+
### Example: Example 11
|
|
1690
|
+
|
|
1691
|
+
Onboarding dialog
|
|
1692
|
+
|
|
1693
|
+
#### Summary
|
|
1694
|
+
|
|
1695
|
+
Onboarding dialog
|
|
1696
|
+
|
|
1697
|
+
#### React (tsx)
|
|
1698
|
+
|
|
1699
|
+
```tsx
|
|
1700
|
+
import { useState } from 'react';
|
|
1701
|
+
|
|
1702
|
+
import composition from '../../../assets/getting_started_composition.webp';
|
|
1703
|
+
import OnboardingDialog from '@rio-cloud/rio-uikit/OnboardingDialog';
|
|
1704
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
1705
|
+
|
|
1706
|
+
export default () => {
|
|
1707
|
+
const [show, setShow] = useState(false);
|
|
1708
|
+
|
|
1709
|
+
const handleShow = () => setShow(true);
|
|
1710
|
+
const handleHide = () => setShow(false);
|
|
1711
|
+
|
|
1712
|
+
const handleTakeTour = () => {
|
|
1713
|
+
// Start onboarding tour - see useOnboardingTour() hook
|
|
1714
|
+
setShow(false);
|
|
1715
|
+
};
|
|
1716
|
+
|
|
1717
|
+
return (
|
|
1718
|
+
<div>
|
|
1719
|
+
<Button bsStyle='primary' onClick={handleShow}>
|
|
1720
|
+
Onboarding dialog
|
|
1721
|
+
</Button>
|
|
1722
|
+
<OnboardingDialog
|
|
1723
|
+
show={show}
|
|
1724
|
+
imageSrc={composition}
|
|
1725
|
+
imageAlt='Onboarding hero'
|
|
1726
|
+
title='Welcome to the RIO UIKIT!'
|
|
1727
|
+
description={
|
|
1728
|
+
<span>
|
|
1729
|
+
<span className='text-medium'>Get started with a quick tour</span> to explore UIKIT and discover
|
|
1730
|
+
its key features. It's the easiest way to get familiar with the service and make the most of
|
|
1731
|
+
your experience.
|
|
1732
|
+
</span>
|
|
1733
|
+
}
|
|
1734
|
+
onboardingRestartHint='Not ready to take the tour now?'
|
|
1735
|
+
onboardingRestartDescription='If you choose to skip the tour now, don’t worry — you can always start it later from the service info option in the application header.'
|
|
1736
|
+
skipButtonText='Skip it'
|
|
1737
|
+
tourButtonText='Take the tour'
|
|
1738
|
+
onClose={handleHide}
|
|
1739
|
+
onStartTour={handleTakeTour}
|
|
1740
|
+
/>
|
|
1741
|
+
</div>
|
|
1742
|
+
);
|
|
1743
|
+
};
|
|
1744
|
+
```
|
|
1745
|
+
|
|
1746
|
+
#### HTML (html)
|
|
1747
|
+
|
|
1748
|
+
```html
|
|
1749
|
+
<div>
|
|
1750
|
+
<button type="button" class="btn btn-primary btn-component" tabindex="0">Onboarding dialog</button>
|
|
1751
|
+
</div>
|
|
1752
|
+
```
|
|
1753
|
+
|
|
1754
|
+
#### Props
|
|
1755
|
+
|
|
1756
|
+
| Name | Type | Default | Description |
|
|
1757
|
+
| --- | --- | --- | --- |
|
|
1758
|
+
| show | Boolean | false | Opens the dialog when set to true |
|
|
1759
|
+
| imageSrc | string | — | The source URL of the image to be displayed in the dialog. |
|
|
1760
|
+
| imageAlt | string | — | Alternative text for the image, used for accessibility. |
|
|
1761
|
+
| title | string \| React.ReactNode | — | The title of the dialog. A welcome message. |
|
|
1762
|
+
| description | string \| React.ReactNode | — | A short description of the service and its onboarding. |
|
|
1763
|
+
| onboardingRestartHint | string \| React.ReactNode | — | Hint text for restarting the onboarding process. |
|
|
1764
|
+
| onboardingRestartDescription | string \| React.ReactNode | — | Detailed description for restarting the onboarding process. |
|
|
1765
|
+
| skipButtonText | string \| React.ReactNode | — | Text for the skip button. |
|
|
1766
|
+
| tourButtonText | string \| React.ReactNode | — | Text for the button to start the tour. |
|
|
1767
|
+
| onStartTour | () => void | — | Callback function to be called when the tour starts. |
|
|
1768
|
+
| onClose | Function | () => {} | A callback function invoked when the dialog closes |
|
|
1769
|
+
| className | String | — | Additional classes for the modal element |
|
|
1770
|
+
|
|
1771
|
+
## MediaDialog
|
|
1772
|
+
|
|
1773
|
+
This component allows the user to show media inside a dialog like a set of images or a video. It uses the dialog component described above.
|
|
1774
|
+
|
|
1775
|
+
### Example: Example 12
|
|
1776
|
+
|
|
1777
|
+
Media dialog with multiple imagesMedia dialog with single imageMedia dialog with video
|
|
1778
|
+
|
|
1779
|
+
#### Summary
|
|
1780
|
+
|
|
1781
|
+
Media dialog with multiple imagesMedia dialog with single imageMedia dialog with video
|
|
1782
|
+
|
|
1783
|
+
#### React (tsx)
|
|
1784
|
+
|
|
1785
|
+
```tsx
|
|
1786
|
+
import { useState } from 'react';
|
|
1787
|
+
|
|
1788
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
1789
|
+
import MediaDialog from '@rio-cloud/rio-uikit/MediaDialog';
|
|
1790
|
+
import ResponsiveVideo from '@rio-cloud/rio-uikit/ResponsiveVideo';
|
|
1791
|
+
import Notification from '@rio-cloud/rio-uikit/Notification';
|
|
1792
|
+
|
|
1793
|
+
export default () => {
|
|
1794
|
+
const [showMediaDialog, setShowMediaDialog] = useState(false);
|
|
1795
|
+
const [showSingleMediaDialog, setShowSingleMediaDialog] = useState(false);
|
|
1796
|
+
const [showVideoMediaDialog, setShowVideoMediaDialog] = useState(false);
|
|
1797
|
+
|
|
1798
|
+
return (
|
|
1799
|
+
<div>
|
|
1800
|
+
<div className='btn-toolbar'>
|
|
1801
|
+
<Button bsStyle='primary' onClick={() => setShowMediaDialog(true)}>
|
|
1802
|
+
Media dialog with multiple images
|
|
1803
|
+
</Button>
|
|
1804
|
+
<Button bsStyle='primary' onClick={() => setShowSingleMediaDialog(true)}>
|
|
1805
|
+
Media dialog with single image
|
|
1806
|
+
</Button>
|
|
1807
|
+
<Button bsStyle='primary' onClick={() => setShowVideoMediaDialog(true)}>
|
|
1808
|
+
Media dialog with video
|
|
1809
|
+
</Button>
|
|
1810
|
+
</div>
|
|
1811
|
+
|
|
1812
|
+
{/* Multiple images */}
|
|
1813
|
+
<MediaDialog
|
|
1814
|
+
show={showMediaDialog}
|
|
1815
|
+
onClose={() => setShowMediaDialog(false)}
|
|
1816
|
+
previousButtonText='Previous'
|
|
1817
|
+
useOverflow={false}
|
|
1818
|
+
previousButtonCallback={(mediaIndex: number) => mediaIndex === 1 && Notification.info('Cycled through')}
|
|
1819
|
+
nextButtonText='Next'
|
|
1820
|
+
nextButtonCallback={(mediaIndex: number) => mediaIndex === 0 && Notification.info('Cycled through')}
|
|
1821
|
+
media={[
|
|
1822
|
+
{
|
|
1823
|
+
src: 'https://picsum.photos/1920/1080',
|
|
1824
|
+
type: MediaDialog.MEDIA_TYPE_IMAGE,
|
|
1825
|
+
title: 'Image 1',
|
|
1826
|
+
},
|
|
1827
|
+
{
|
|
1828
|
+
src: 'https://picsum.photos/1080/1920',
|
|
1829
|
+
type: MediaDialog.MEDIA_TYPE_IMAGE,
|
|
1830
|
+
title: 'Image 2',
|
|
1831
|
+
subtitle: 'Lorem ipsum dolor sit amet',
|
|
1832
|
+
},
|
|
1833
|
+
]}
|
|
1834
|
+
/>
|
|
1835
|
+
|
|
1836
|
+
{/* Single image */}
|
|
1837
|
+
<MediaDialog
|
|
1838
|
+
show={showSingleMediaDialog}
|
|
1839
|
+
previousButtonText='Previous'
|
|
1840
|
+
nextButtonText='Next'
|
|
1841
|
+
onClose={() => setShowSingleMediaDialog(false)}
|
|
1842
|
+
media={[
|
|
1843
|
+
{
|
|
1844
|
+
src: 'https://picsum.photos/1920/1080',
|
|
1845
|
+
type: MediaDialog.MEDIA_TYPE_IMAGE,
|
|
1846
|
+
title: 'Lonely Image',
|
|
1847
|
+
},
|
|
1848
|
+
]}
|
|
1849
|
+
/>
|
|
1850
|
+
|
|
1851
|
+
{/* Embedded video */}
|
|
1852
|
+
<MediaDialog
|
|
1853
|
+
show={showVideoMediaDialog}
|
|
1854
|
+
previousButtonText='Previous'
|
|
1855
|
+
nextButtonText='Next'
|
|
1856
|
+
onClose={() => setShowVideoMediaDialog(false)}
|
|
1857
|
+
media={[
|
|
1858
|
+
{
|
|
1859
|
+
title: 'Video',
|
|
1860
|
+
src: 'https://www.youtube.com/embed/znckWdXTbTk',
|
|
1861
|
+
type: MediaDialog.MEDIA_TYPE_VIDEO,
|
|
1862
|
+
aspectRatio: ResponsiveVideo.ASPECT_RATIO_16_BY_9,
|
|
1863
|
+
className: 'foobar',
|
|
1864
|
+
},
|
|
1865
|
+
]}
|
|
1866
|
+
/>
|
|
1867
|
+
</div>
|
|
1868
|
+
);
|
|
1869
|
+
};
|
|
1870
|
+
```
|
|
1871
|
+
|
|
1872
|
+
#### HTML (html)
|
|
1873
|
+
|
|
1874
|
+
```html
|
|
1875
|
+
<div class='modal show media-dialog' tabindex='1' role='dialog'>
|
|
1876
|
+
<div class='modal-dialog modal-lg' role='document'>
|
|
1877
|
+
<div class='modal-content'>
|
|
1878
|
+
<div class='modal-header'>
|
|
1879
|
+
<div class='modal-header-text'>
|
|
1880
|
+
<div class='modal-header-title'>Image 1</div>
|
|
1881
|
+
</div>
|
|
1882
|
+
<div class='modal-header-buttons'>
|
|
1883
|
+
<button
|
|
1884
|
+
type='button'
|
|
1885
|
+
class='btn btn-icon-only btn-muted modal-header-close close'
|
|
1886
|
+
data-testid='close'>
|
|
1887
|
+
<span class='rioglyph rioglyph-remove' aria-hidden='true'></span>
|
|
1888
|
+
</button>
|
|
1889
|
+
</div>
|
|
1890
|
+
</div>
|
|
1891
|
+
<div class='modal-body padding-0'>
|
|
1892
|
+
<div class='media-content content-center'>
|
|
1893
|
+
<img class='ani-fade-in' src='https://......' />
|
|
1894
|
+
</div>
|
|
1895
|
+
</div>
|
|
1896
|
+
<div class="modal-footer" aria-label="dialog footer"><button type="button" class="btn btn-primary btn-link pull-left"><span class="rioglyph rioglyph-chevron-left"></span>Previous</button>
|
|
1897
|
+
<div>1 / 2</div><button type="button" class="btn btn-primary btn-link btn-icon-right"><span class="rioglyph rioglyph-chevron-right"></span>Next</button>
|
|
1898
|
+
</div>
|
|
1899
|
+
</div>
|
|
1900
|
+
</div>
|
|
1901
|
+
<div class='modal-backdrop'></div>
|
|
1902
|
+
</div>;
|
|
1903
|
+
```
|
|
1904
|
+
|
|
1905
|
+
#### Props
|
|
1906
|
+
|
|
1907
|
+
| Name | Type | Default | Description |
|
|
1908
|
+
| --- | --- | --- | --- |
|
|
1909
|
+
| show | Boolean | false | Opens the dialog when set to true |
|
|
1910
|
+
| title | Node | — | The dialog title (can also be a FormattedMessage component) |
|
|
1911
|
+
| subtitle | Node | — | The subtitle content |
|
|
1912
|
+
| useOverflow | Boolean | false | Enables the modal body to overflow and use inline scrolling if needed.Set the class "no-overflow-gradient" to remove the overflow gradient in case it is problematic like when the background is gray. |
|
|
1913
|
+
| onClose | Function | () => {} | A callback function invoked when the dialog closes |
|
|
1914
|
+
| disableEsc | Boolean | false | Enables or disabled closing the dialog via esc key |
|
|
1915
|
+
| bsSize | String | md | Defined how large the dialog will be rendered. By default, the dialog has a medium size and thus it can be omitted. Possible values are: Dialog.SIZE_XS, Dialog.SIZE_SM, Dialog.SIZE_LG, Dialog.SIZE_XL, Dialog.SIZE_FULL_WIDTH, Dialog.SIZE_FULL_HEIGHT, Dialog.SIZE_FULL_SCREEN or 'xs', 'sm', 'lg', 'xl', 'fullwidth', 'fullheight', 'fullheight-lg', 'fullheight-xl', 'fullscreen' |
|
|
1916
|
+
| previousButtonText | String / Node | — | The button text for switching to the previous media if there are multiple. |
|
|
1917
|
+
| previousButtonCallback | Function | () => {} | Callback function for when the previous button is clicked. |
|
|
1918
|
+
| nextButtonText | String / Node | — | The button text for switching to the next media if there are multiple. |
|
|
1919
|
+
| nextButtonCallback | Function | () => {} | Callback function for when the next button is clicked. |
|
|
1920
|
+
| media | Array of Objects | — | List of media objects. |
|
|
1921
|
+
| └type | String | — | Defines the media type that is going to be displayed. Possible values are: MediaDialog.MEDIA_TYPE_IMAGE, MediaDialog.MEDIA_TYPE_VIDEO or 'image', 'video' |
|
|
1922
|
+
| └src | String | — | The source location for the media data. |
|
|
1923
|
+
| └aspectRatio | String | — | Only relevant for videos where the aspect of the video is defined. Possible values are: ResponsiveVideo.ASPECT_RATIO_4_BY_3, ResponsiveVideo.ASPECT_RATIO_16_BY_9 or '4by3', '16by9' |
|
|
1924
|
+
| └className | String | — | Additional classes for the image element. |
|
|
1925
|
+
|
|
1926
|
+
## FrameDialog
|
|
1927
|
+
|
|
1928
|
+
This component allows the user to create a dialog in a parent window triggered and controlled by a widget iframe.
|
|
1929
|
+
|
|
1930
|
+
For more details, please visit iframe guidlines
|
|
1931
|
+
|
|
1932
|
+
### Example: Example 13
|
|
1933
|
+
|
|
1934
|
+
|
|
1935
|
+
|
|
1936
|
+
#### Summary
|
|
1937
|
+
|
|
1938
|
+
|
|
1939
|
+
|
|
1940
|
+
#### React (tsx)
|
|
1941
|
+
|
|
1942
|
+
```tsx
|
|
1943
|
+
import React from 'react';
|
|
1944
|
+
import IframeResizer from 'iframe-resizer-react';
|
|
1945
|
+
|
|
1946
|
+
import FrameDialog from '../../../../../../src/FrameDialog';
|
|
1947
|
+
import { PREFIX } from '../../../widgets/WidgetDemo';
|
|
1948
|
+
|
|
1949
|
+
const IFrameWidgetExample = React.memo(() => {
|
|
1950
|
+
return (
|
|
1951
|
+
<>
|
|
1952
|
+
<div className='iframe-wrapper'>
|
|
1953
|
+
<IframeResizer
|
|
1954
|
+
id='widgetDialogFrame'
|
|
1955
|
+
src={`${window.location.origin}${window.location.pathname}#widgetDemo`}
|
|
1956
|
+
className='unstyled width-100pct'
|
|
1957
|
+
style={{ width: '1px', minWidth: '100%' }}
|
|
1958
|
+
/>
|
|
1959
|
+
</div>
|
|
1960
|
+
<FrameDialog
|
|
1961
|
+
eventPrefix={PREFIX}
|
|
1962
|
+
getSourceFrame={() => document.getElementById('widgetDialogFrame') as HTMLIFrameElement}
|
|
1963
|
+
/>
|
|
1964
|
+
</>
|
|
1965
|
+
);
|
|
1966
|
+
});
|
|
1967
|
+
|
|
1968
|
+
export default IFrameWidgetExample;
|
|
1969
|
+
|
|
1970
|
+
// ----------------------------------------------------------
|
|
1971
|
+
import { useState } from 'react';
|
|
1972
|
+
|
|
1973
|
+
import Button from '../../../../src/Button';
|
|
1974
|
+
import { OPEN_DIALOG_EVENT, CLOSE_DIALOG_EVENT, type OPEN_DIALOG_EVENT_TYPE } from '../../../../src/FrameDialog';
|
|
1975
|
+
import usePostMessage, { type RemoteAction } from '../../../../src/usePostMessage';
|
|
1976
|
+
|
|
1977
|
+
export const PREFIX = 'EVENT_UIKIT_WIDGET_DEMO';
|
|
1978
|
+
|
|
1979
|
+
const WidgetDemo = () => {
|
|
1980
|
+
const [messageFromDialog, setMessageFromDialog] = useState('-');
|
|
1981
|
+
|
|
1982
|
+
const { sendMessageToParent } = usePostMessage(PREFIX, (remoteAction: RemoteAction) => {
|
|
1983
|
+
console.log(remoteAction);
|
|
1984
|
+
|
|
1985
|
+
if (remoteAction.type === `${PREFIX}${CLOSE_DIALOG_EVENT}`) {
|
|
1986
|
+
setMessageFromDialog(remoteAction.payload);
|
|
1987
|
+
}
|
|
1988
|
+
});
|
|
1989
|
+
|
|
1990
|
+
const handleOpenDialog = () => {
|
|
1991
|
+
const payload: OPEN_DIALOG_EVENT_TYPE = {
|
|
1992
|
+
src: `${window.location.origin}${window.location.pathname}#widgetDemoDialog`,
|
|
1993
|
+
dialogProps: {
|
|
1994
|
+
bsSize: 'sm',
|
|
1995
|
+
},
|
|
1996
|
+
};
|
|
1997
|
+
|
|
1998
|
+
sendMessageToParent({
|
|
1999
|
+
type: `${PREFIX}${OPEN_DIALOG_EVENT}`,
|
|
2000
|
+
payload,
|
|
2001
|
+
});
|
|
2002
|
+
};
|
|
2003
|
+
|
|
2004
|
+
return (
|
|
2005
|
+
<div className='bg-white border rounded padding-20 height-200'>
|
|
2006
|
+
<div className='text-medium'>This is a widget embedded via an iframe</div>
|
|
2007
|
+
<div className='btn-toolbar margin-top-20'>
|
|
2008
|
+
<Button onClick={handleOpenDialog}>Open dialog in parent frame</Button>
|
|
2009
|
+
</div>
|
|
2010
|
+
<div className='margin-top-20'>
|
|
2011
|
+
<label>Closing message from dialog:</label>
|
|
2012
|
+
<div>{messageFromDialog}</div>
|
|
2013
|
+
</div>
|
|
2014
|
+
</div>
|
|
2015
|
+
);
|
|
2016
|
+
};
|
|
2017
|
+
|
|
2018
|
+
export default WidgetDemo;
|
|
2019
|
+
|
|
2020
|
+
// ----------------------------------------------------------
|
|
2021
|
+
import Button from '../../../../src/Button';
|
|
2022
|
+
import Dialog from '../../../../src/Dialog';
|
|
2023
|
+
import usePostMessage from '../../../../src/usePostMessage';
|
|
2024
|
+
import { CLOSE_DIALOG_EVENT } from '../../../../src/FrameDialog';
|
|
2025
|
+
|
|
2026
|
+
import { dummyText } from '../../utils/data';
|
|
2027
|
+
import { PREFIX } from './WidgetDemo';
|
|
2028
|
+
|
|
2029
|
+
const WidgetDemo = () => {
|
|
2030
|
+
const { sendMessageToParent } = usePostMessage(PREFIX);
|
|
2031
|
+
|
|
2032
|
+
const handleCloseDialog = () => {
|
|
2033
|
+
sendMessageToParent({
|
|
2034
|
+
type: `${PREFIX}${CLOSE_DIALOG_EVENT}`,
|
|
2035
|
+
payload: 'hello from the dialog view',
|
|
2036
|
+
});
|
|
2037
|
+
};
|
|
2038
|
+
|
|
2039
|
+
return (
|
|
2040
|
+
<div className='bg-white min-height-200'>
|
|
2041
|
+
<Dialog.Title title='Widget dialog' onCloseButtonClick={handleCloseDialog} />
|
|
2042
|
+
|
|
2043
|
+
<Dialog.Body className='padding-20'>
|
|
2044
|
+
<div className='text-medium'>This is the widget dialog content embedded via an iframe</div>
|
|
2045
|
+
<p>{dummyText}</p>
|
|
2046
|
+
</Dialog.Body>
|
|
2047
|
+
|
|
2048
|
+
<Dialog.Footer>
|
|
2049
|
+
<div>
|
|
2050
|
+
<Button onClick={handleCloseDialog}>Close dialog in parent frame</Button>
|
|
2051
|
+
</div>
|
|
2052
|
+
</Dialog.Footer>
|
|
2053
|
+
</div>
|
|
2054
|
+
);
|
|
2055
|
+
};
|
|
2056
|
+
|
|
2057
|
+
export default WidgetDemo;
|
|
2058
|
+
```
|
|
2059
|
+
|
|
2060
|
+
#### HTML (html)
|
|
2061
|
+
|
|
2062
|
+
```html
|
|
2063
|
+
<div class="iframe-wrapper">
|
|
2064
|
+
<iframe title="iframe" id="widgetDialogFrame" src="https://uikit.developers.rio.cloud/#widgetDemo" class="unstyled width-100pct" style="width: 1px; min-width: 100%; overflow: hidden; height: 200px;" scrolling="no">
|
|
2065
|
+
</iframe>
|
|
2066
|
+
</div>
|
|
2067
|
+
```
|
|
2068
|
+
|
|
2069
|
+
## ReleaseNotesDialog
|
|
2070
|
+
|
|
2071
|
+
The ReleaseNotesDialog component is meant to be used for the release notes of a service.Note there exists also a separate ReleaseNotes component.
|
|
2072
|
+
|
|
2073
|
+
### Example: Example 14
|
|
2074
|
+
|
|
2075
|
+
Service
|
|
2076
|
+
|
|
2077
|
+
1
|
|
2078
|
+
|
|
2079
|
+
#### Summary
|
|
2080
|
+
|
|
2081
|
+
Service
|
|
2082
|
+
|
|
2083
|
+
1
|
|
2084
|
+
|
|
2085
|
+
#### React (tsx)
|
|
2086
|
+
|
|
2087
|
+
```tsx
|
|
2088
|
+
import { useState } from 'react';
|
|
2089
|
+
|
|
2090
|
+
import ReleaseNotesDialog from '@rio-cloud/rio-uikit/ReleaseNotesDialog';
|
|
2091
|
+
import ApplicationLayout from '@rio-cloud/rio-uikit/ApplicationLayout';
|
|
2092
|
+
import ActionBarItem from '@rio-cloud/rio-uikit/ActionBarItem';
|
|
2093
|
+
import ApplicationHeader from '@rio-cloud/rio-uikit/ApplicationHeader';
|
|
2094
|
+
|
|
2095
|
+
import packageJson from '../../../../package.json';
|
|
2096
|
+
const currentVersion = packageJson.version;
|
|
2097
|
+
|
|
2098
|
+
const RELEASE_NOTES_ITEM = 'TEAMNAME.RELEASENOTES';
|
|
2099
|
+
|
|
2100
|
+
const currentVersionNumbers = currentVersion.split('.');
|
|
2101
|
+
|
|
2102
|
+
const isNewVersion = (localVersion: string | null) => {
|
|
2103
|
+
if (!localVersion) {
|
|
2104
|
+
return true;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
const localVersionNumbers = localVersion.split('.');
|
|
2108
|
+
|
|
2109
|
+
return !(
|
|
2110
|
+
currentVersionNumbers[0] === localVersionNumbers[0] && currentVersionNumbers[1] === localVersionNumbers[1]
|
|
2111
|
+
);
|
|
2112
|
+
};
|
|
2113
|
+
|
|
2114
|
+
const releaseNotes = {
|
|
2115
|
+
'en-GB': {
|
|
2116
|
+
'1.1.0': {
|
|
2117
|
+
date: '23.07.2018',
|
|
2118
|
+
content: (
|
|
2119
|
+
<div>{`Map view within the tour history table
|
|
2120
|
+
• Modern map design as used in the Beta of the fleet monitor
|
|
2121
|
+
• Works with all event types
|
|
2122
|
+
• Event specific map marker
|
|
2123
|
+
• Map size adjustable via slider`}</div>
|
|
2124
|
+
),
|
|
2125
|
+
},
|
|
2126
|
+
'1.0.0': {
|
|
2127
|
+
date: '27.06.2018',
|
|
2128
|
+
content: [
|
|
2129
|
+
<div key='1'>New feature XYZ has been added ...</div>,
|
|
2130
|
+
<div key='2'>fixed bugs in ...</div>,
|
|
2131
|
+
<div key='3'>Another feature has been added</div>,
|
|
2132
|
+
],
|
|
2133
|
+
},
|
|
2134
|
+
},
|
|
2135
|
+
};
|
|
2136
|
+
|
|
2137
|
+
const translationKey = 'en-GB';
|
|
2138
|
+
|
|
2139
|
+
const translations = {
|
|
2140
|
+
whatsNew: 'What`s new?',
|
|
2141
|
+
close: 'Close',
|
|
2142
|
+
'module.name': 'Modulename',
|
|
2143
|
+
};
|
|
2144
|
+
|
|
2145
|
+
const handleRemoveReleaseNotesItem = () => {
|
|
2146
|
+
window.localStorage.removeItem(RELEASE_NOTES_ITEM);
|
|
2147
|
+
};
|
|
2148
|
+
|
|
2149
|
+
export default () => {
|
|
2150
|
+
const [show, setShow] = useState(false);
|
|
2151
|
+
|
|
2152
|
+
const hasNewReleaseNotes = isNewVersion(window.localStorage.getItem(RELEASE_NOTES_ITEM));
|
|
2153
|
+
const actionBarItemTitle = `${translations['module.name']} v.${currentVersion}`;
|
|
2154
|
+
|
|
2155
|
+
const actionBarItem = (
|
|
2156
|
+
<ActionBarItem id='serviceInfoReleaseNotes'>
|
|
2157
|
+
<ActionBarItem.Icon>
|
|
2158
|
+
<span className='icon rioglyph rioglyph-info-sign' />
|
|
2159
|
+
{hasNewReleaseNotes && <span className='badge bg-primary badge-indicator'>1</span>}
|
|
2160
|
+
</ActionBarItem.Icon>
|
|
2161
|
+
<ActionBarItem.Popover title={actionBarItemTitle}>
|
|
2162
|
+
<ActionBarItem.List>
|
|
2163
|
+
<ActionBarItem.ListItem icon='rioglyph-exclamation-sign' onClick={() => setShow(true)}>
|
|
2164
|
+
{translations.whatsNew ?? 'What`s new?'}
|
|
2165
|
+
{hasNewReleaseNotes && <span className='badge badge-primary margin-left-5'>1</span>}
|
|
2166
|
+
</ActionBarItem.ListItem>
|
|
2167
|
+
</ActionBarItem.List>
|
|
2168
|
+
<ActionBarItem.List>
|
|
2169
|
+
<ActionBarItem.ListItem icon='rioglyph-erase' onClick={handleRemoveReleaseNotesItem}>
|
|
2170
|
+
Remove Release Notes flag
|
|
2171
|
+
</ActionBarItem.ListItem>
|
|
2172
|
+
</ActionBarItem.List>
|
|
2173
|
+
</ActionBarItem.Popover>
|
|
2174
|
+
</ActionBarItem>
|
|
2175
|
+
);
|
|
2176
|
+
|
|
2177
|
+
return (
|
|
2178
|
+
<>
|
|
2179
|
+
<ApplicationLayout>
|
|
2180
|
+
<ApplicationLayout.Header>
|
|
2181
|
+
<ApplicationHeader label='Service' actionBarItems={[actionBarItem]} />
|
|
2182
|
+
</ApplicationLayout.Header>
|
|
2183
|
+
</ApplicationLayout>
|
|
2184
|
+
|
|
2185
|
+
<ReleaseNotesDialog
|
|
2186
|
+
showReleaseNotes={show}
|
|
2187
|
+
setShowReleaseNotes={setShow}
|
|
2188
|
+
moduleName={translations['module.name']}
|
|
2189
|
+
whatsNewTitle={translations.whatsNew}
|
|
2190
|
+
closeButtonText={translations.close}
|
|
2191
|
+
translatedReleaseNotes={releaseNotes[translationKey]}
|
|
2192
|
+
currentVersion={currentVersion}
|
|
2193
|
+
RELEASE_NOTES_ITEM={RELEASE_NOTES_ITEM}
|
|
2194
|
+
/>
|
|
2195
|
+
</>
|
|
2196
|
+
);
|
|
2197
|
+
};
|
|
2198
|
+
```
|
|
2199
|
+
|
|
2200
|
+
#### HTML (html)
|
|
2201
|
+
|
|
2202
|
+
```html
|
|
2203
|
+
<div class="ApplicationLayout">
|
|
2204
|
+
<div class="ApplicationLayoutHeader" id="ApplicationLayoutHeader">
|
|
2205
|
+
<nav class="ApplicationHeader user-select-none">
|
|
2206
|
+
<div class="navbar-header">
|
|
2207
|
+
<span class="navbar-brand home-icon">
|
|
2208
|
+
</span>
|
|
2209
|
+
</div>
|
|
2210
|
+
<ul class="ModuleNavigation AppMenu user-select-none pointer-events-none">
|
|
2211
|
+
<li class="dropdown">
|
|
2212
|
+
<a class="ModuleNavigation-dropdown dropdown-toggle justify-content-between inactive" role="button" id="basic-nav-dropdown">
|
|
2213
|
+
<span>Service</span>
|
|
2214
|
+
</a>
|
|
2215
|
+
</li>
|
|
2216
|
+
</ul>
|
|
2217
|
+
<ul class="SubmoduleNavigation nav">
|
|
2218
|
+
</ul>
|
|
2219
|
+
<ul class="ApplicationActionBar nav navbar-nav navbar-right ">
|
|
2220
|
+
<li role="presentation" class="navigationItem">
|
|
2221
|
+
<div class="ActionBarItem">
|
|
2222
|
+
<div class="ActionBarItemIcon">
|
|
2223
|
+
<span class="icon rioglyph rioglyph-info-sign">
|
|
2224
|
+
</span>
|
|
2225
|
+
<span class="badge bg-primary badge-indicator">1</span>
|
|
2226
|
+
</div>
|
|
2227
|
+
</div>
|
|
2228
|
+
</li>
|
|
2229
|
+
</ul>
|
|
2230
|
+
</nav>
|
|
2231
|
+
</div>
|
|
2232
|
+
</div>
|
|
2233
|
+
```
|
|
2234
|
+
|
|
2235
|
+
#### Props (json)
|
|
2236
|
+
|
|
2237
|
+
```json
|
|
2238
|
+
{
|
|
2239
|
+
"0.1.2": {
|
|
2240
|
+
date: String,
|
|
2241
|
+
content: arrayOf(nodes) or single node,
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
```
|