@rio-cloud/uikit-mcp 1.0.0
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/LICENSE +202 -0
- package/README.md +91 -0
- package/bin/uikit-mcp.mjs +23 -0
- package/data/pages/Components/components/accentbar.json +207 -0
- package/data/pages/Components/components/activity.json +87 -0
- package/data/pages/Components/components/animatednumber.json +99 -0
- package/data/pages/Components/components/animations.json +87 -0
- package/data/pages/Components/components/appheader.json +291 -0
- package/data/pages/Components/components/applayout.json +1198 -0
- package/data/pages/Components/components/appnavigationbar.json +327 -0
- package/data/pages/Components/components/areacharts.json +563 -0
- package/data/pages/Components/components/aspectratioplaceholder.json +75 -0
- package/data/pages/Components/components/assettree.json +3080 -0
- package/data/pages/Components/components/autosuggests.json +710 -0
- package/data/pages/Components/components/avatar.json +157 -0
- package/data/pages/Components/components/banner.json +599 -0
- package/data/pages/Components/components/barcharts.json +1507 -0
- package/data/pages/Components/components/barlist.json +223 -0
- package/data/pages/Components/components/basicmap.json +68 -0
- package/data/pages/Components/components/bottomsheet.json +601 -0
- package/data/pages/Components/components/button.json +583 -0
- package/data/pages/Components/components/buttontoolbar.json +63 -0
- package/data/pages/Components/components/calendarstripe.json +235 -0
- package/data/pages/Components/components/card.json +69 -0
- package/data/pages/Components/components/carousel.json +39 -0
- package/data/pages/Components/components/chartcolors.json +34 -0
- package/data/pages/Components/components/chartsgettingstarted.json +32 -0
- package/data/pages/Components/components/chat.json +39 -0
- package/data/pages/Components/components/checkbox.json +847 -0
- package/data/pages/Components/components/clearableinput.json +789 -0
- package/data/pages/Components/components/collapse.json +175 -0
- package/data/pages/Components/components/composedcharts.json +159 -0
- package/data/pages/Components/components/contentloader.json +233 -0
- package/data/pages/Components/components/datatabs.json +680 -0
- package/data/pages/Components/components/datepickers.json +287 -0
- package/data/pages/Components/components/dialogs.json +1492 -0
- package/data/pages/Components/components/divider.json +93 -0
- package/data/pages/Components/components/dropdowns.json +936 -0
- package/data/pages/Components/components/editablecontent.json +1117 -0
- package/data/pages/Components/components/expander.json +377 -0
- package/data/pages/Components/components/fade.json +403 -0
- package/data/pages/Components/components/fadeexpander.json +75 -0
- package/data/pages/Components/components/fadeup.json +127 -0
- package/data/pages/Components/components/feedback.json +269 -0
- package/data/pages/Components/components/filepickers.json +269 -0
- package/data/pages/Components/components/formlabel.json +115 -0
- package/data/pages/Components/components/fullscreenmap.json +22 -0
- package/data/pages/Components/components/groupeditemlist.json +323 -0
- package/data/pages/Components/components/iconlist.json +45 -0
- package/data/pages/Components/components/imagepreloader.json +81 -0
- package/data/pages/Components/components/labeledelement.json +75 -0
- package/data/pages/Components/components/licenseplate.json +69 -0
- package/data/pages/Components/components/linecharts.json +987 -0
- package/data/pages/Components/components/listmenu.json +313 -0
- package/data/pages/Components/components/loadmore.json +175 -0
- package/data/pages/Components/components/mainnavigation.json +39 -0
- package/data/pages/Components/components/mapcircle.json +34 -0
- package/data/pages/Components/components/mapcluster.json +51 -0
- package/data/pages/Components/components/mapcontext.json +105 -0
- package/data/pages/Components/components/mapdraggablemarker.json +34 -0
- package/data/pages/Components/components/mapgettingstarted.json +27 -0
- package/data/pages/Components/components/mapgroup.json +1198 -0
- package/data/pages/Components/components/mapinfobubble.json +34 -0
- package/data/pages/Components/components/maplayergroup.json +34 -0
- package/data/pages/Components/components/mapmarker.json +700 -0
- package/data/pages/Components/components/mappolygon.json +45 -0
- package/data/pages/Components/components/maproute.json +623 -0
- package/data/pages/Components/components/maproutegenerator.json +16 -0
- package/data/pages/Components/components/mapsettings.json +51 -0
- package/data/pages/Components/components/maputils.json +34 -0
- package/data/pages/Components/components/multiselects.json +1451 -0
- package/data/pages/Components/components/nodata.json +139 -0
- package/data/pages/Components/components/notifications.json +65 -0
- package/data/pages/Components/components/numbercontrol.json +301 -0
- package/data/pages/Components/components/onboarding.json +302 -0
- package/data/pages/Components/components/page.json +197 -0
- package/data/pages/Components/components/pager.json +93 -0
- package/data/pages/Components/components/piecharts.json +731 -0
- package/data/pages/Components/components/popover.json +251 -0
- package/data/pages/Components/components/position.json +69 -0
- package/data/pages/Components/components/radialbarcharts.json +1304 -0
- package/data/pages/Components/components/radiobutton.json +1105 -0
- package/data/pages/Components/components/releasenotes.json +44 -0
- package/data/pages/Components/components/resizer.json +93 -0
- package/data/pages/Components/components/responsivecolumnstripe.json +123 -0
- package/data/pages/Components/components/responsivevideo.json +75 -0
- package/data/pages/Components/components/rioglyph.json +93 -0
- package/data/pages/Components/components/rules.json +410 -0
- package/data/pages/Components/components/saveableinput.json +703 -0
- package/data/pages/Components/components/selects.json +701 -0
- package/data/pages/Components/components/sidebar.json +243 -0
- package/data/pages/Components/components/sliders.json +235 -0
- package/data/pages/Components/components/smoothscrollbars.json +335 -0
- package/data/pages/Components/components/spinners.json +343 -0
- package/data/pages/Components/components/states.json +1705 -0
- package/data/pages/Components/components/statswidgets.json +314 -0
- package/data/pages/Components/components/statusbar.json +177 -0
- package/data/pages/Components/components/stepbutton.json +57 -0
- package/data/pages/Components/components/steppedprogressbars.json +417 -0
- package/data/pages/Components/components/subnavigation.json +107 -0
- package/data/pages/Components/components/supportmarker.json +45 -0
- package/data/pages/Components/components/svgimage.json +81 -0
- package/data/pages/Components/components/switch.json +111 -0
- package/data/pages/Components/components/tables.json +144 -0
- package/data/pages/Components/components/tagmanager.json +86 -0
- package/data/pages/Components/components/tags.json +146 -0
- package/data/pages/Components/components/teaser.json +188 -0
- package/data/pages/Components/components/timeline.json +45 -0
- package/data/pages/Components/components/timepicker.json +163 -0
- package/data/pages/Components/components/togglebutton.json +247 -0
- package/data/pages/Components/components/tooltip.json +270 -0
- package/data/pages/Components/components/virtuallist.json +175 -0
- package/data/pages/Foundations/foundations.json +2475 -0
- package/data/pages/Getting-started/start/changelog.json +22 -0
- package/data/pages/Getting-started/start/goodtoknow.json +32 -0
- package/data/pages/Getting-started/start/guidelines/color-combinations.json +58 -0
- package/data/pages/Getting-started/start/guidelines/custom-css.json +27 -0
- package/data/pages/Getting-started/start/guidelines/custom-rioglyph.json +22 -0
- package/data/pages/Getting-started/start/guidelines/formatting.json +97 -0
- package/data/pages/Getting-started/start/guidelines/iframe.json +93 -0
- package/data/pages/Getting-started/start/guidelines/obfuscate-data.json +22 -0
- package/data/pages/Getting-started/start/guidelines/print-css.json +37 -0
- package/data/pages/Getting-started/start/guidelines/spinner.json +144 -0
- package/data/pages/Getting-started/start/guidelines/supported-browsers.json +22 -0
- package/data/pages/Getting-started/start/guidelines/writing.json +242 -0
- package/data/pages/Getting-started/start/howto.json +72 -0
- package/data/pages/Getting-started/start/intro.json +37 -0
- package/data/pages/Getting-started/start/responsiveness.json +52 -0
- package/data/pages/Templates/templates/common-table.json +39 -0
- package/data/pages/Templates/templates/detail-views.json +71 -0
- package/data/pages/Templates/templates/expandable-details.json +39 -0
- package/data/pages/Templates/templates/feature-cards.json +103 -0
- package/data/pages/Templates/templates/form-summary.json +39 -0
- package/data/pages/Templates/templates/form-toggle.json +39 -0
- package/data/pages/Templates/templates/list-blocks.json +119 -0
- package/data/pages/Templates/templates/loading-progress.json +39 -0
- package/data/pages/Templates/templates/options-panel.json +39 -0
- package/data/pages/Templates/templates/panel-variants.json +39 -0
- package/data/pages/Templates/templates/progress-cards.json +71 -0
- package/data/pages/Templates/templates/progress-success.json +39 -0
- package/data/pages/Templates/templates/settings-form.json +39 -0
- package/data/pages/Templates/templates/stats-blocks.json +135 -0
- package/data/pages/Templates/templates/table-panel.json +39 -0
- package/data/pages/Templates/templates/table-row-animation.json +39 -0
- package/data/pages/Templates/templates/usage-cards.json +39 -0
- package/data/pages/Utilities/utilities/deviceutils.json +39 -0
- package/data/pages/Utilities/utilities/featuretoggles.json +42 -0
- package/data/pages/Utilities/utilities/fueltypeutils.json +118 -0
- package/data/pages/Utilities/utilities/routeutils.json +34 -0
- package/data/pages/Utilities/utilities/useaftermount.json +63 -0
- package/data/pages/Utilities/utilities/useaverage.json +86 -0
- package/data/pages/Utilities/utilities/useclickoutside.json +69 -0
- package/data/pages/Utilities/utilities/useclipboard.json +57 -0
- package/data/pages/Utilities/utilities/usecount.json +92 -0
- package/data/pages/Utilities/utilities/usedarkmode.json +50 -0
- package/data/pages/Utilities/utilities/usedebuginfo.json +63 -0
- package/data/pages/Utilities/utilities/useeffectonce.json +57 -0
- package/data/pages/Utilities/utilities/useelapsedtime.json +57 -0
- package/data/pages/Utilities/utilities/useelementsize.json +63 -0
- package/data/pages/Utilities/utilities/useesc.json +57 -0
- package/data/pages/Utilities/utilities/useevent.json +75 -0
- package/data/pages/Utilities/utilities/usefocustrap.json +57 -0
- package/data/pages/Utilities/utilities/usefullscreen.json +197 -0
- package/data/pages/Utilities/utilities/usehover.json +57 -0
- package/data/pages/Utilities/utilities/useinterval.json +63 -0
- package/data/pages/Utilities/utilities/useisfocuswithin.json +75 -0
- package/data/pages/Utilities/utilities/usekey.json +75 -0
- package/data/pages/Utilities/utilities/uselocalstorage.json +69 -0
- package/data/pages/Utilities/utilities/uselocationsuggestions.json +110 -0
- package/data/pages/Utilities/utilities/usemax.json +86 -0
- package/data/pages/Utilities/utilities/usemin.json +86 -0
- package/data/pages/Utilities/utilities/usemutationobserver.json +69 -0
- package/data/pages/Utilities/utilities/useonlinestatus.json +39 -0
- package/data/pages/Utilities/utilities/useonscreen.json +63 -0
- package/data/pages/Utilities/utilities/usepostmessage.json +80 -0
- package/data/pages/Utilities/utilities/useprevious.json +63 -0
- package/data/pages/Utilities/utilities/useresizeobserver.json +65 -0
- package/data/pages/Utilities/utilities/usescrollposition.json +103 -0
- package/data/pages/Utilities/utilities/usesearch.json +197 -0
- package/data/pages/Utilities/utilities/usesorting.json +139 -0
- package/data/pages/Utilities/utilities/usestatewithvalidation.json +69 -0
- package/data/pages/Utilities/utilities/usesum.json +86 -0
- package/data/pages/Utilities/utilities/usetableexport.json +87 -0
- package/data/pages/Utilities/utilities/usetableselection.json +311 -0
- package/data/pages/Utilities/utilities/usetimeout.json +63 -0
- package/data/pages/Utilities/utilities/usetoggle.json +75 -0
- package/data/pages/Utilities/utilities/usewindowresize.json +63 -0
- package/data/version.json +4 -0
- package/docs/content-schema.md +147 -0
- package/docs/navigation-inventory.json +1310 -0
- package/docs/search-synonyms.json +43 -0
- package/package.json +38 -0
- package/server/index.mjs +268 -0
- package/server/lib/load-docs.mjs +48 -0
- package/server/lib/normalise-doc.mjs +220 -0
- package/server/lib/render-markdown.mjs +82 -0
- package/server/lib/search-index.mjs +49 -0
- package/server/lib/types.js +99 -0
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata": {
|
|
3
|
+
"captured_at": "2025-11-21T12:07:06.258Z",
|
|
4
|
+
"source": "https://uikit.developers.rio.cloud/#components/bottomSheet",
|
|
5
|
+
"category": "Components",
|
|
6
|
+
"section": "Application",
|
|
7
|
+
"slug": "components/bottomsheet",
|
|
8
|
+
"version": "v1.13.2",
|
|
9
|
+
"hash_algorithm": "sha256",
|
|
10
|
+
"hash": "effff902e08b3c2d6d902b78379167333d96848b8e4ee05b1a85a7d03f4bc720"
|
|
11
|
+
},
|
|
12
|
+
"title": "BottomSheet",
|
|
13
|
+
"lead": "The TimedBottomSheet is a wrapper component for the BottomSheet that allows to control it's visibility via timers and to use the localStorage to save user interaction for handling it's visibility.",
|
|
14
|
+
"content": [
|
|
15
|
+
{
|
|
16
|
+
"heading": "BottomSheet",
|
|
17
|
+
"body": "",
|
|
18
|
+
"examples": [
|
|
19
|
+
{
|
|
20
|
+
"caption": "Example 1",
|
|
21
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div><p class=\"margin-top-0\">This demonstrates a small bottom sheet use case on <b>desktop.</b> This can be used for providing additional information, upselling, feedback etc.</p><button class=\"btn btn-primary\" type=\"button\">Trigger small BottomSheet</button></div></div>",
|
|
22
|
+
"tabs": [
|
|
23
|
+
{
|
|
24
|
+
"label": "React",
|
|
25
|
+
"language": "tsx",
|
|
26
|
+
"code": "import React, { useState } from 'react';\n\nimport BottomSheet from '@rio-cloud/rio-uikit/BottomSheet';\n\nexport default () => {\n const [showBottomSheet, setShowBottomSheet] = useState(false);\n return (\n <div>\n <p className='margin-top-0'>\n This demonstrates a small bottom sheet use case on <b>desktop.</b> This can be used for providing\n additional information, upselling, feedback etc.\n </p>\n <button className='btn btn-primary' type='button' onClick={() => setShowBottomSheet(true)}>\n Trigger small BottomSheet\n </button>\n\n <BottomSheet\n show={showBottomSheet}\n width={400}\n onClose={() => setShowBottomSheet(false)}\n detach\n bodyClassName='padding-25 margin-right-25'\n >\n {content}\n </BottomSheet>\n </div>\n );\n};\n\nconst content = (\n <React.Fragment>\n <div>Hi there! Would you be interested in the latest features?</div>\n <div className='btn-toolbar margin-top-15 display-flex justify-content-end'>\n <button type='button' className='btn btn-link btn-sm'>\n No, thanks\n </button>\n <button type='button' className='btn btn-default btn-sm'>\n <span className='rioglyph rioglyph-heart' />\n Yes, show me more\n </button>\n </div>\n </React.Fragment>\n);"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"label": "HTML",
|
|
30
|
+
"language": "html",
|
|
31
|
+
"code": "<div>\n <p class=\"margin-top-0\">This demonstrates a small bottom sheet use case on <b>desktop.</b> This can be used for providing additional information, upselling, feedback etc.</p>\n <button class=\"btn btn-primary\" type=\"button\">Trigger small BottomSheet</button>\n</div>"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"label": "Props",
|
|
35
|
+
"language": "json",
|
|
36
|
+
"code": null,
|
|
37
|
+
"props": [
|
|
38
|
+
{
|
|
39
|
+
"heading": null,
|
|
40
|
+
"rows": [
|
|
41
|
+
{
|
|
42
|
+
"name": "show",
|
|
43
|
+
"type": "Boolean",
|
|
44
|
+
"default": "false",
|
|
45
|
+
"description": "Set the visibility of the bottom sheet. The component is already mounted and just moved offscreen."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "onClose",
|
|
49
|
+
"type": "Function",
|
|
50
|
+
"default": "() => {})",
|
|
51
|
+
"description": "Callback for when the sheet closes."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "width",
|
|
55
|
+
"type": "Number / String",
|
|
56
|
+
"default": "",
|
|
57
|
+
"description": "The width of the bottom sheet. This is useful for desktop when not using the entire screen width. When no width is given it will take the width of the content and maximum 100% of the screen. So it this case you might want to apply a \"max-width-xxx\" via className to control it better."
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "height",
|
|
61
|
+
"type": "Number / String",
|
|
62
|
+
"default": "",
|
|
63
|
+
"description": "The height of the bottom sheet. If no height is given, the height is automatically calculated from the content."
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "title",
|
|
67
|
+
"type": "Node / String",
|
|
68
|
+
"default": "",
|
|
69
|
+
"description": "The title content shown in the header. If no title is given, the bottom sheet header is not shown."
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "showCloseButton",
|
|
73
|
+
"type": "Boolean",
|
|
74
|
+
"default": "true",
|
|
75
|
+
"description": "Defines whether or not the close button is shown."
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "showMaximizeButton",
|
|
79
|
+
"type": "Boolean",
|
|
80
|
+
"default": "false",
|
|
81
|
+
"description": "Defines whether or not the maximize button in the header is shown."
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "onHeightChange",
|
|
85
|
+
"type": "Function",
|
|
86
|
+
"default": "() => {}",
|
|
87
|
+
"description": "The callback function triggered when the maximize button is clicked and the height changes."
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "detach",
|
|
91
|
+
"type": "Boolean",
|
|
92
|
+
"default": "false",
|
|
93
|
+
"description": "Set to \"true\" to detach the bottom sheet from the left side and the bottom and create a little offset."
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "detachOffset",
|
|
97
|
+
"type": "Number",
|
|
98
|
+
"default": "15",
|
|
99
|
+
"description": "Defines the amount of pixels for the sheet."
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"name": "hasBackdrop",
|
|
103
|
+
"type": "Boolean",
|
|
104
|
+
"default": "false",
|
|
105
|
+
"description": "Set to \"true\" to render a modal like backdrop to emphasize the bottom sheet."
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "onBackdropClick",
|
|
109
|
+
"type": "Function",
|
|
110
|
+
"default": "() => {}",
|
|
111
|
+
"description": "Callback function triggered when the backdrop is clicked. Usually used to close the bottom sheet."
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "bodyRef",
|
|
115
|
+
"type": "React Ref",
|
|
116
|
+
"default": "",
|
|
117
|
+
"description": "A react ref added to the bottom sheet body."
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "bodyClassName",
|
|
121
|
+
"type": "String",
|
|
122
|
+
"default": "",
|
|
123
|
+
"description": "Additional classes to be set on the body element."
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "className",
|
|
127
|
+
"type": "String",
|
|
128
|
+
"default": "",
|
|
129
|
+
"description": "Additional classes to be set on the wrapping element."
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"caption": "Example 2",
|
|
139
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div data-capture-callout=\"true\"><p class=\"margin-top-0\">This demonstrates a bottom sheet use case on <b>mobile. </b>This can be used for providing additional information on mobile instead of using a sidebar, onboarding, alternative for dialogs etc.</p><p><span class=\"label label-info label-condensed margin-right-5\">Note</span>This example does not make sense on desktop with wider screens. Handle responsive modes and use a dialog or sidebar on desktop instead.</p><button class=\"btn btn-primary\" type=\"button\">Trigger mobile BottomSheet</button></div></div>",
|
|
140
|
+
"tabs": [
|
|
141
|
+
{
|
|
142
|
+
"label": "React",
|
|
143
|
+
"language": "tsx",
|
|
144
|
+
"code": "import React, { useState, useRef, useEffect, type MutableRefObject } from 'react';\nimport throttle from 'lodash/fp/throttle';\n\nimport BottomSheet from '@rio-cloud/rio-uikit/BottomSheet';\nimport useElementSize from '@rio-cloud/rio-uikit/useElementSize';\n\nexport default () => {\n const [showBottomSheet, setShowBottomSheet] = useState(false);\n const [listHeight, setListHeight] = useState(300);\n\n const sheetBodyRef = useRef<HTMLDivElement>(null);\n const [_, bodyHeight] = useElementSize(sheetBodyRef);\n\n // To adjust the height of the list elements according to the current height of the bottom sheet body,\n // we use the element size hook and check for the body height. When it changes, we set the height of the\n // list throttled to skip some renderings in between\n useEffect(() => {\n // Note that we need to subtract the height of the menu from the sheet body height since it fix.\n // In this example we assume roughly a height of 130 pixels for the nav pills menu\n const navPillsHeight = 130;\n const throttledHeightChange = throttle(1000, newHeight => setListHeight(newHeight - navPillsHeight));\n\n if (bodyHeight) {\n throttledHeightChange(bodyHeight);\n }\n }, [bodyHeight]);\n\n return (\n <div>\n <p className='margin-top-0'>\n {'This demonstrates a bottom sheet use case on '}\n <b>{'mobile. '}</b>\n {'This can be used for providing additional information on mobile instead of using a sidebar, '}\n onboarding, alternative for dialogs etc.\n </p>\n <p>\n <span className='label label-info label-condensed margin-right-5'>Note</span>\n {'This example does not make sense on desktop with wider screens. '}\n Handle responsive modes and use a dialog or sidebar on desktop instead.\n </p>\n <button className='btn btn-primary' type='button' onClick={() => setShowBottomSheet(true)}>\n Trigger mobile BottomSheet\n </button>\n\n <BottomSheet\n show={showBottomSheet}\n onClose={() => setShowBottomSheet(false)}\n title={\n <div>\n <div className='text-medium'>Lorem ipsum dolor sit amet</div>\n <div className='text-size-14 text-color-darker'>consectetur adipiscing elit</div>\n </div>\n }\n height={500}\n showMaximizeButton\n className='max-width-800'\n bodyRef={sheetBodyRef}\n >\n <div>\n <div className='padding-15'>\n <ul className='nav nav-pills nav-pills-filled nav-justified'>\n <li className='active shadow-default'>\n <span>First tab</span>\n </li>\n <li>\n <span>Second tab with longer content</span>\n </li>\n <li>\n <span>Third tab</span>\n </li>\n </ul>\n </div>\n <div\n className='padding-15 padding-top-0 padding-bottom-25 overflow-scroll'\n style={{ height: listHeight }}\n >\n <div>Content for Pill 1 ...</div>\n <ul className='panel-list margin-top-10 margin-bottom-0'>\n {Array.from({ length: 15 }, (_, index) => (\n <li key={index}>\n <div className='text-medium'>{`${index + 1}. Lorem ipsum dolor sit amet`}</div>\n <div>\n {'consectetur adipiscing elit. In pharetra dui eget massa efficitur aliquam '}\n condimentum in felis.\n </div>\n </li>\n ))}\n </ul>\n </div>\n </div>\n </BottomSheet>\n </div>\n );\n};"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"label": "HTML",
|
|
148
|
+
"language": "html",
|
|
149
|
+
"code": "<div data-capture-callout=\"true\">\n <p class=\"margin-top-0\">This demonstrates a bottom sheet use case on <b>mobile. </b>This can be used for providing additional information on mobile instead of using a sidebar, onboarding, alternative for dialogs etc.</p>\n <p>\n <span class=\"label label-info label-condensed margin-right-5\">Note</span>This example does not make sense on desktop with wider screens. Handle responsive modes and use a dialog or sidebar on desktop instead.\n </p>\n <button class=\"btn btn-primary\" type=\"button\">Trigger mobile BottomSheet</button>\n</div>"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"label": "Props",
|
|
153
|
+
"language": "json",
|
|
154
|
+
"code": null,
|
|
155
|
+
"props": [
|
|
156
|
+
{
|
|
157
|
+
"heading": null,
|
|
158
|
+
"rows": [
|
|
159
|
+
{
|
|
160
|
+
"name": "show",
|
|
161
|
+
"type": "Boolean",
|
|
162
|
+
"default": "false",
|
|
163
|
+
"description": "Set the visibility of the bottom sheet. The component is already mounted and just moved offscreen."
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"name": "onClose",
|
|
167
|
+
"type": "Function",
|
|
168
|
+
"default": "() => {})",
|
|
169
|
+
"description": "Callback for when the sheet closes."
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "width",
|
|
173
|
+
"type": "Number / String",
|
|
174
|
+
"default": "",
|
|
175
|
+
"description": "The width of the bottom sheet. This is useful for desktop when not using the entire screen width. When no width is given it will take the width of the content and maximum 100% of the screen. So it this case you might want to apply a \"max-width-xxx\" via className to control it better."
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"name": "height",
|
|
179
|
+
"type": "Number / String",
|
|
180
|
+
"default": "",
|
|
181
|
+
"description": "The height of the bottom sheet. If no height is given, the height is automatically calculated from the content."
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"name": "title",
|
|
185
|
+
"type": "Node / String",
|
|
186
|
+
"default": "",
|
|
187
|
+
"description": "The title content shown in the header. If no title is given, the bottom sheet header is not shown."
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "showCloseButton",
|
|
191
|
+
"type": "Boolean",
|
|
192
|
+
"default": "true",
|
|
193
|
+
"description": "Defines whether or not the close button is shown."
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"name": "showMaximizeButton",
|
|
197
|
+
"type": "Boolean",
|
|
198
|
+
"default": "false",
|
|
199
|
+
"description": "Defines whether or not the maximize button in the header is shown."
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "onHeightChange",
|
|
203
|
+
"type": "Function",
|
|
204
|
+
"default": "() => {}",
|
|
205
|
+
"description": "The callback function triggered when the maximize button is clicked and the height changes."
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"name": "detach",
|
|
209
|
+
"type": "Boolean",
|
|
210
|
+
"default": "false",
|
|
211
|
+
"description": "Set to \"true\" to detach the bottom sheet from the left side and the bottom and create a little offset."
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"name": "detachOffset",
|
|
215
|
+
"type": "Number",
|
|
216
|
+
"default": "15",
|
|
217
|
+
"description": "Defines the amount of pixels for the sheet."
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"name": "hasBackdrop",
|
|
221
|
+
"type": "Boolean",
|
|
222
|
+
"default": "false",
|
|
223
|
+
"description": "Set to \"true\" to render a modal like backdrop to emphasize the bottom sheet."
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"name": "onBackdropClick",
|
|
227
|
+
"type": "Function",
|
|
228
|
+
"default": "() => {}",
|
|
229
|
+
"description": "Callback function triggered when the backdrop is clicked. Usually used to close the bottom sheet."
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"name": "bodyRef",
|
|
233
|
+
"type": "React Ref",
|
|
234
|
+
"default": "",
|
|
235
|
+
"description": "A react ref added to the bottom sheet body."
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"name": "bodyClassName",
|
|
239
|
+
"type": "String",
|
|
240
|
+
"default": "",
|
|
241
|
+
"description": "Additional classes to be set on the body element."
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"name": "className",
|
|
245
|
+
"type": "String",
|
|
246
|
+
"default": "",
|
|
247
|
+
"description": "Additional classes to be set on the wrapping element."
|
|
248
|
+
}
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
]
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"caption": "Example 3",
|
|
257
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div><p class=\"margin-top-0\">This demonstrates a bottom sheet use case on <b>mobile.</b> It demonstrates a bottom sheet for smartphones to perform an action.</p><button class=\"btn btn-primary\" type=\"button\">Trigger mobile BottomSheet</button></div></div>",
|
|
258
|
+
"tabs": [
|
|
259
|
+
{
|
|
260
|
+
"label": "React",
|
|
261
|
+
"language": "tsx",
|
|
262
|
+
"code": "import React, { useState } from 'react';\n\nimport BottomSheet from '@rio-cloud/rio-uikit/BottomSheet';\nimport Switch from '@rio-cloud/rio-uikit/Switch';\nimport RadioButton from '@rio-cloud/rio-uikit/RadioButton';\nimport Button from '@rio-cloud/rio-uikit/Button';\n\nexport default () => {\n const [showBottomSheet, setShowBottomSheet] = useState(false);\n\n return (\n <div>\n <p className='margin-top-0'>\n This demonstrates a bottom sheet use case on <b>mobile.</b> It demonstrates a bottom sheet for\n smartphones to perform an action.\n </p>\n <button className='btn btn-primary' type='button' onClick={() => setShowBottomSheet(true)}>\n Trigger mobile BottomSheet\n </button>\n\n <BottomSheet\n show={showBottomSheet}\n onClose={() => setShowBottomSheet(false)}\n title='New Collection'\n hasBackdrop\n onBackdropClick={() => console.log('foobar')}\n className='max-width-400'\n >\n <div className='padding-15'>\n <div className='display-flex justify-content-between align-items-center margin-top-15 margin-bottom-15 padding-15 bg-lightest rounded'>\n <div>\n <div className='text-medium text-size-16 text-color-darker'>Private</div>\n <div className='text-size-12 text-color-dark margin-top-5'>\n Only viewable by people you invite\n </div>\n </div>\n <Switch checked />\n </div>\n\n <label className='margin-left-10 margin-top-20 margin-bottom-0'>Contribution Settings</label>\n <div className='display-flex justify-content-between align-items-center margin-top-15 margin-bottom-15 padding-15 bg-lightest rounded'>\n <div>\n <div className='text-medium text-size-16 text-color-darker'>Controlled</div>\n <div className='text-size-12 text-color-dark margin-top-5'>\n Only allow members that are contributors to add content\n </div>\n </div>\n <RadioButton name='radioGroup' id='onlyMember' defaultChecked />\n </div>\n <div className='display-flex justify-content-between align-items-center margin-top-15 margin-bottom-15 padding-15 bg-lightest rounded'>\n <div>\n <div className='text-medium text-size-16 text-color-darker'>Open</div>\n <div className='text-size-12 text-color-dark margin-top-5'>\n Allow all members to add content\n </div>\n </div>\n <RadioButton name='radioGroup' id='open' />\n </div>\n\n <Button\n bsStyle='primary'\n bsSize={Button.LG}\n block\n className='margin-top-25'\n onClick={() => setShowBottomSheet(false)}\n >\n Create Collection\n </Button>\n </div>\n </BottomSheet>\n </div>\n );\n};"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"label": "HTML",
|
|
266
|
+
"language": "html",
|
|
267
|
+
"code": "<div>\n <p class=\"margin-top-0\">This demonstrates a bottom sheet use case on <b>mobile.</b> It demonstrates a bottom sheet for smartphones to perform an action.</p>\n <button class=\"btn btn-primary\" type=\"button\">Trigger mobile BottomSheet</button>\n</div>"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"label": "Props",
|
|
271
|
+
"language": "json",
|
|
272
|
+
"code": null,
|
|
273
|
+
"props": [
|
|
274
|
+
{
|
|
275
|
+
"heading": null,
|
|
276
|
+
"rows": [
|
|
277
|
+
{
|
|
278
|
+
"name": "show",
|
|
279
|
+
"type": "Boolean",
|
|
280
|
+
"default": "false",
|
|
281
|
+
"description": "Set the visibility of the bottom sheet. The component is already mounted and just moved offscreen."
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"name": "onClose",
|
|
285
|
+
"type": "Function",
|
|
286
|
+
"default": "() => {})",
|
|
287
|
+
"description": "Callback for when the sheet closes."
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"name": "width",
|
|
291
|
+
"type": "Number / String",
|
|
292
|
+
"default": "",
|
|
293
|
+
"description": "The width of the bottom sheet. This is useful for desktop when not using the entire screen width. When no width is given it will take the width of the content and maximum 100% of the screen. So it this case you might want to apply a \"max-width-xxx\" via className to control it better."
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"name": "height",
|
|
297
|
+
"type": "Number / String",
|
|
298
|
+
"default": "",
|
|
299
|
+
"description": "The height of the bottom sheet. If no height is given, the height is automatically calculated from the content."
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"name": "title",
|
|
303
|
+
"type": "Node / String",
|
|
304
|
+
"default": "",
|
|
305
|
+
"description": "The title content shown in the header. If no title is given, the bottom sheet header is not shown."
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"name": "showCloseButton",
|
|
309
|
+
"type": "Boolean",
|
|
310
|
+
"default": "true",
|
|
311
|
+
"description": "Defines whether or not the close button is shown."
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"name": "showMaximizeButton",
|
|
315
|
+
"type": "Boolean",
|
|
316
|
+
"default": "false",
|
|
317
|
+
"description": "Defines whether or not the maximize button in the header is shown."
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"name": "onHeightChange",
|
|
321
|
+
"type": "Function",
|
|
322
|
+
"default": "() => {}",
|
|
323
|
+
"description": "The callback function triggered when the maximize button is clicked and the height changes."
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"name": "detach",
|
|
327
|
+
"type": "Boolean",
|
|
328
|
+
"default": "false",
|
|
329
|
+
"description": "Set to \"true\" to detach the bottom sheet from the left side and the bottom and create a little offset."
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"name": "detachOffset",
|
|
333
|
+
"type": "Number",
|
|
334
|
+
"default": "15",
|
|
335
|
+
"description": "Defines the amount of pixels for the sheet."
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"name": "hasBackdrop",
|
|
339
|
+
"type": "Boolean",
|
|
340
|
+
"default": "false",
|
|
341
|
+
"description": "Set to \"true\" to render a modal like backdrop to emphasize the bottom sheet."
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"name": "onBackdropClick",
|
|
345
|
+
"type": "Function",
|
|
346
|
+
"default": "() => {}",
|
|
347
|
+
"description": "Callback function triggered when the backdrop is clicked. Usually used to close the bottom sheet."
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"name": "bodyRef",
|
|
351
|
+
"type": "React Ref",
|
|
352
|
+
"default": "",
|
|
353
|
+
"description": "A react ref added to the bottom sheet body."
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"name": "bodyClassName",
|
|
357
|
+
"type": "String",
|
|
358
|
+
"default": "",
|
|
359
|
+
"description": "Additional classes to be set on the body element."
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"name": "className",
|
|
363
|
+
"type": "String",
|
|
364
|
+
"default": "",
|
|
365
|
+
"description": "Additional classes to be set on the wrapping element."
|
|
366
|
+
}
|
|
367
|
+
]
|
|
368
|
+
}
|
|
369
|
+
]
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"caption": "Example 4",
|
|
375
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div><p class=\"margin-top-0\">This demonstrates a bottom sheet use case on <b>mobile. </b>It demonstrates a bottom sheet for an example of how you could do onboarding on smartphones.</p><button class=\"btn btn-primary\" type=\"button\">Trigger mobile onboarding BottomSheet</button></div></div>",
|
|
376
|
+
"tabs": [
|
|
377
|
+
{
|
|
378
|
+
"label": "React",
|
|
379
|
+
"language": "tsx",
|
|
380
|
+
"code": "import React, { useState } from 'react';\n\nimport imageSliderDemoService1 from '../../demoService/assets/imageSliderDemoService1.png';\nimport imageSliderDemoService2 from '../../demoService/assets/imageSliderDemoService2.png';\nimport imageSliderDemoService3 from '../../demoService/assets/imageSliderDemoService3.png';\nimport imageSliderDemoService4 from '../../demoService/assets/imageSliderDemoService4.png';\n\nimport BottomSheet from '@rio-cloud/rio-uikit/BottomSheet';\nimport Carousel from '@rio-cloud/rio-uikit/Carousel';\n\nexport default () => {\n const [showBottomSheet, setShowBottomSheet] = useState(false);\n return (\n <div>\n <p className='margin-top-0'>\n {'This demonstrates a bottom sheet use case on '}\n <b>{'mobile. '}</b>\n It demonstrates a bottom sheet for an example of how you could do onboarding on smartphones.\n </p>\n <button className='btn btn-primary' type='button' onClick={() => setShowBottomSheet(true)}>\n Trigger mobile onboarding BottomSheet\n </button>\n\n <BottomSheet\n show={showBottomSheet}\n onClose={() => setShowBottomSheet(false)}\n hasBackdrop\n className='max-width-400'\n >\n <div className='padding-25 padding-bottom-10 margin-top-20'>\n <Carousel className='arrow-color-dark show-indicators offset-indicators shadow-default'>\n <Carousel.Item>\n <div className='panel panel-default margin-bottom-0 overflow-hidden'>\n <img className='img-responsive' src={imageSliderDemoService1} />\n </div>\n </Carousel.Item>\n\n <Carousel.Item>\n <div className='panel panel-default margin-bottom-0 overflow-hidden'>\n <img className='img-responsive' src={imageSliderDemoService2} />\n </div>\n </Carousel.Item>\n\n <Carousel.Item>\n <div className='panel panel-default margin-bottom-0 overflow-hidden'>\n <img className='img-responsive' src={imageSliderDemoService3} />\n </div>\n </Carousel.Item>\n\n <Carousel.Item>\n <div className='panel panel-default margin-bottom-0 overflow-hidden'>\n <img className='img-responsive' src={imageSliderDemoService4} />\n </div>\n </Carousel.Item>\n </Carousel>\n </div>\n </BottomSheet>\n </div>\n );\n};"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"label": "HTML",
|
|
384
|
+
"language": "html",
|
|
385
|
+
"code": "<div>\n <p class=\"margin-top-0\">This demonstrates a bottom sheet use case on <b>mobile. </b>It demonstrates a bottom sheet for an example of how you could do onboarding on smartphones.</p>\n <button class=\"btn btn-primary\" type=\"button\">Trigger mobile onboarding BottomSheet</button>\n</div>"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"label": "Props",
|
|
389
|
+
"language": "json",
|
|
390
|
+
"code": null,
|
|
391
|
+
"props": [
|
|
392
|
+
{
|
|
393
|
+
"heading": null,
|
|
394
|
+
"rows": [
|
|
395
|
+
{
|
|
396
|
+
"name": "show",
|
|
397
|
+
"type": "Boolean",
|
|
398
|
+
"default": "false",
|
|
399
|
+
"description": "Set the visibility of the bottom sheet. The component is already mounted and just moved offscreen."
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
"name": "onClose",
|
|
403
|
+
"type": "Function",
|
|
404
|
+
"default": "() => {})",
|
|
405
|
+
"description": "Callback for when the sheet closes."
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
"name": "width",
|
|
409
|
+
"type": "Number / String",
|
|
410
|
+
"default": "",
|
|
411
|
+
"description": "The width of the bottom sheet. This is useful for desktop when not using the entire screen width. When no width is given it will take the width of the content and maximum 100% of the screen. So it this case you might want to apply a \"max-width-xxx\" via className to control it better."
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"name": "height",
|
|
415
|
+
"type": "Number / String",
|
|
416
|
+
"default": "",
|
|
417
|
+
"description": "The height of the bottom sheet. If no height is given, the height is automatically calculated from the content."
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
"name": "title",
|
|
421
|
+
"type": "Node / String",
|
|
422
|
+
"default": "",
|
|
423
|
+
"description": "The title content shown in the header. If no title is given, the bottom sheet header is not shown."
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"name": "showCloseButton",
|
|
427
|
+
"type": "Boolean",
|
|
428
|
+
"default": "true",
|
|
429
|
+
"description": "Defines whether or not the close button is shown."
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"name": "showMaximizeButton",
|
|
433
|
+
"type": "Boolean",
|
|
434
|
+
"default": "false",
|
|
435
|
+
"description": "Defines whether or not the maximize button in the header is shown."
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"name": "onHeightChange",
|
|
439
|
+
"type": "Function",
|
|
440
|
+
"default": "() => {}",
|
|
441
|
+
"description": "The callback function triggered when the maximize button is clicked and the height changes."
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"name": "detach",
|
|
445
|
+
"type": "Boolean",
|
|
446
|
+
"default": "false",
|
|
447
|
+
"description": "Set to \"true\" to detach the bottom sheet from the left side and the bottom and create a little offset."
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"name": "detachOffset",
|
|
451
|
+
"type": "Number",
|
|
452
|
+
"default": "15",
|
|
453
|
+
"description": "Defines the amount of pixels for the sheet."
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"name": "hasBackdrop",
|
|
457
|
+
"type": "Boolean",
|
|
458
|
+
"default": "false",
|
|
459
|
+
"description": "Set to \"true\" to render a modal like backdrop to emphasize the bottom sheet."
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"name": "onBackdropClick",
|
|
463
|
+
"type": "Function",
|
|
464
|
+
"default": "() => {}",
|
|
465
|
+
"description": "Callback function triggered when the backdrop is clicked. Usually used to close the bottom sheet."
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
"name": "bodyRef",
|
|
469
|
+
"type": "React Ref",
|
|
470
|
+
"default": "",
|
|
471
|
+
"description": "A react ref added to the bottom sheet body."
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"name": "bodyClassName",
|
|
475
|
+
"type": "String",
|
|
476
|
+
"default": "",
|
|
477
|
+
"description": "Additional classes to be set on the body element."
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"name": "className",
|
|
481
|
+
"type": "String",
|
|
482
|
+
"default": "",
|
|
483
|
+
"description": "Additional classes to be set on the wrapping element."
|
|
484
|
+
}
|
|
485
|
+
]
|
|
486
|
+
}
|
|
487
|
+
]
|
|
488
|
+
}
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
]
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
"heading": "TimedBottomSheet",
|
|
495
|
+
"body": "",
|
|
496
|
+
"examples": [
|
|
497
|
+
{
|
|
498
|
+
"caption": "Example 5",
|
|
499
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><p>Showcase of a timed bottom sheet used for requesting feedback from the user after a major feature was released or updated.</p><button type=\"button\" class=\"btn btn-primary btn-component\" tabindex=\"0\">Trigger timed bottom sheet</button></div>",
|
|
500
|
+
"tabs": [
|
|
501
|
+
{
|
|
502
|
+
"label": "React",
|
|
503
|
+
"language": "tsx",
|
|
504
|
+
"code": "import { useState, useRef, useEffect, type MutableRefObject } from 'react';\nimport throttle from 'lodash/fp/throttle';\n\nimport Button from '@rio-cloud/rio-uikit/Button';\nimport ToggleButton from '@rio-cloud/rio-uikit/ToggleButton';\nimport SimpleTooltip from '@rio-cloud/rio-uikit/SimpleTooltip';\nimport TimedBottomSheet from '@rio-cloud/rio-uikit/TimedBottomSheet';\nimport { motion } from '@rio-cloud/rio-uikit/framer-motion';\nimport useLocalStorage from '@rio-cloud/rio-uikit/useLocalStorage';\n\n/*\n * Don't forget to cleanup the localStorage for the user when removing a feature\n * by setting \"cleanupLocalStorage\" to \"true\" and deploy it like this.\n * The cleanup will remove the localStorage flag on mount and will not show the bottom sheet.\n */\n\nconst IS_DISABLED = false;\n\nconst SHOW_AFTER_IN_MS = 2_000; // 2 seconds\nconst HIDE_AFTER_IN_MS = 120_000; // 2 minutes\nconst HIDE_AFTER_SUBMIT_IN_MS = 2_000;\n\nexport const FeedbackBottomSheet = ({ onClose }: { onClose: VoidFunction }) => {\n const [isDismissed, setIsDismissed] = useState(false);\n const [isSubmitted, setIsSubmitted] = useState(false);\n const [isPostponed, setIsPostponed] = useState(false);\n\n const [rating, setRating] = useState<number>();\n\n // Don't close itself if the user types in into the textfield or\n // interacts with the bottom sheet\n const [isDirty, setIsDirty] = useState(false);\n\n const handleCloseBottomSheet = () => {\n setIsDismissed(true);\n onClose();\n };\n\n const handlePostpone = () => {\n setIsPostponed(true);\n onClose();\n };\n\n const handleRating = (value: number | undefined) => {\n setIsDirty(true);\n setRating(value);\n };\n\n const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {\n // Avoid page reload on submit\n event.preventDefault();\n\n // Get form data of all inputs\n const data = new FormData(event.target as HTMLFormElement);\n console.log(Object.fromEntries(data.entries()));\n\n sendFeedback(data.get('mapFeedbackText')?.toString() || '', rating);\n\n // show thank you message and close bottom sheet after 5 sec\n setIsSubmitted(true);\n\n // After showing the thank you message, set the bottom sheet to dismissed, so it won't be\n // shown again on next page load\n setTimeout(() => {\n setIsDismissed(true);\n onClose();\n }, HIDE_AFTER_SUBMIT_IN_MS);\n };\n\n const sendFeedback = (messageToSend: string, featureRating: number | undefined) => {\n console.log(`Sending email with message \\n${messageToSend}`);\n };\n\n let hideTimeout: number | undefined = isSubmitted ? HIDE_AFTER_SUBMIT_IN_MS : HIDE_AFTER_IN_MS;\n if (isDirty) {\n hideTimeout = undefined;\n }\n\n if (isPostponed) {\n return null;\n }\n\n return (\n <TimedBottomSheet\n featureName='mapUpdateFeedbackBottomSheet'\n localStoragePrefix='uikit.'\n dismissed={isDismissed}\n showAfter={SHOW_AFTER_IN_MS}\n hideAfter={hideTimeout}\n onClose={handleCloseBottomSheet}\n bodyClassName='padding-25'\n className='width-400'\n cleanupLocalStorage={IS_DISABLED}\n >\n {!isSubmitted && !isPostponed && (\n <form onSubmit={handleSubmit}>\n <div className='text-size-18 text-medium'>Map update feedback</div>\n <p className='margin-top-5 margin-bottom-25 text-color-darker'>\n Please take a moment to tell us what you think of the new map update. Haven't noticed a change?{' '}\n <a href='#'>Read here what's new...</a>\n </p>\n <div className='text-color-darker text-medium'>Rate your experience with the map</div>\n <div className='btn-toolbar text-size-14 align-items-center margin-top-5 margin-bottom-25'>\n <div className='text-size-200pct text-color-danger rioglyph rioglyph-thumbs-down' />\n <ToggleButton\n active={rating === 1}\n onClick={(toggled: boolean) => handleRating(toggled ? 1 : undefined)}\n >\n 1\n </ToggleButton>\n <ToggleButton\n active={rating === 2}\n onClick={(toggled: boolean) => handleRating(toggled ? 2 : undefined)}\n >\n 2\n </ToggleButton>\n <ToggleButton\n active={rating === 3}\n onClick={(toggled: boolean) => handleRating(toggled ? 3 : undefined)}\n >\n 3\n </ToggleButton>\n <ToggleButton\n active={rating === 4}\n onClick={(toggled: boolean) => handleRating(toggled ? 4 : undefined)}\n >\n 4\n </ToggleButton>\n <ToggleButton\n active={rating === 5}\n onClick={(toggled: boolean) => handleRating(toggled ? 5 : undefined)}\n >\n 5\n </ToggleButton>\n <div className='text-size-200pct text-color-success rioglyph rioglyph-thumbs-up' />\n </div>\n <div className='margin-bottom-15'>\n <div className='text-color-darker text-medium margin-bottom-5 margin-right-20'>\n Anything that can be improved or something you want to tell us\n </div>\n <textarea\n name='mapFeedbackText'\n className='form-control'\n cols={3}\n placeholder='Your feedback (optional)'\n onClick={() => setIsDirty(true)}\n />\n </div>\n <div className='btn-toolbar display-flex justify-content-end align-items-center margin-top-15'>\n <Button\n bsStyle='muted'\n className='hover-bg-lightest text-color-dark hover-text-color-darker'\n onClick={handlePostpone}\n >\n Ask me later\n </Button>\n {rating === undefined ? (\n <SimpleTooltip content='Please give a rating' placement='top'>\n <div>\n <Button bsStyle='primary' type='submit' disabled>\n Send feedback\n </Button>\n </div>\n </SimpleTooltip>\n ) : (\n <Button bsStyle='primary' type='submit'>\n Send feedback\n </Button>\n )}\n </div>\n </form>\n )}\n {isSubmitted && (\n <motion.div\n initial={{ opacity: 0, x: 20 }}\n animate={{ opacity: 1, x: 0 }}\n className='display-flex gap-10 align-items-center'\n >\n <div className='text-color-success text-size-20'>\n <span className='rioglyph rioglyph-ok-sign' />\n </div>\n <div className='text-medium text-color-darker text-size-16'>Thank you for your feedback</div>\n </motion.div>\n )}\n </TimedBottomSheet>\n );\n};\n\nexport default () => {\n const [showFeedback, setShowFeedback] = useState(false);\n\n // For demo purpose, we have to cleanup the local storage to show the bottom sheet again\n const [, , removeFlag] = useLocalStorage('uikit.hideMapUpdateFeedbackBottomSheet', false);\n\n const handleShowFeedback = () => {\n removeFlag();\n\n setTimeout(() => {\n setShowFeedback(true);\n });\n };\n\n const handleCloseFeedback = () => {\n removeFlag();\n setShowFeedback(false);\n };\n\n return (\n <>\n <p>\n Showcase of a timed bottom sheet used for requesting feedback from the user after a major feature was\n released or updated.\n </p>\n <Button bsStyle='primary' onClick={handleShowFeedback}>\n Trigger timed bottom sheet\n </Button>\n {showFeedback && <FeedbackBottomSheet onClose={handleCloseFeedback} />}\n </>\n );\n};"
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
"label": "HTML",
|
|
508
|
+
"language": "html",
|
|
509
|
+
"code": "<p>Showcase of a timed bottom sheet used for requesting feedback from the user after a major feature was released or updated.</p>\n<button type=\"button\" class=\"btn btn-primary btn-component\" tabindex=\"0\">Trigger timed bottom sheet</button>"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"label": "Props",
|
|
513
|
+
"language": "json",
|
|
514
|
+
"code": null,
|
|
515
|
+
"props": [
|
|
516
|
+
{
|
|
517
|
+
"heading": null,
|
|
518
|
+
"rows": [
|
|
519
|
+
{
|
|
520
|
+
"name": "dismissed",
|
|
521
|
+
"type": "Boolean",
|
|
522
|
+
"default": "false",
|
|
523
|
+
"description": "The \"dismissed\" flag can be used to tell this component that the user has clicked on the content of the component like a button or a link. In this case, the bottom sheet will store a flag in the localStorage to hide the bottom sheet for the next time and it will close the sheet right away."
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
"name": "featureName",
|
|
527
|
+
"type": "String",
|
|
528
|
+
"default": "0",
|
|
529
|
+
"description": "The \"featureName\" prop is used to name the localStorage flag that is used to control the visibility. It should be unique to avoid conflicts with other timed bottom sheets."
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"name": "localStoragePrefix",
|
|
533
|
+
"type": "String",
|
|
534
|
+
"default": "",
|
|
535
|
+
"description": "A prefix that will be used for the local storage flag to store whether the bottom sheet should be hidden. Use this prefix for your service name for instance."
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"name": "showAfter",
|
|
539
|
+
"type": "Number",
|
|
540
|
+
"default": "0",
|
|
541
|
+
"description": "Defines the time in milliseconds when the bottom sheet shall be shown. Default value is 0 to show it right away."
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"name": "hideAfter",
|
|
545
|
+
"type": "Number",
|
|
546
|
+
"default": "3_600_000",
|
|
547
|
+
"description": "Defines the time in milliseconds when the bottom sheet hides itself automatically. Default value is 3_600_000 to hide it after 1 hour. In this case, the localStorage flag is not set and the bottom sheet will be shown on the next page load."
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
"name": "alwaysOn",
|
|
551
|
+
"type": "Boolean",
|
|
552
|
+
"default": "false",
|
|
553
|
+
"description": "With this enabled, the BottomSheet will not hide automatically."
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"name": "showCloseButton",
|
|
557
|
+
"type": "Boolean",
|
|
558
|
+
"default": "true",
|
|
559
|
+
"description": "Enables or disabled the close button."
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
"name": "width",
|
|
563
|
+
"type": "Number",
|
|
564
|
+
"default": "",
|
|
565
|
+
"description": "Optional width of the bottom sheet. Alternatively, you can set a `max-width-xxx` via className instead."
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
"name": "cleanupLocalStorage",
|
|
569
|
+
"type": "Boolean",
|
|
570
|
+
"default": "false",
|
|
571
|
+
"description": "Flag to allow to remove the localStorage flag again once the component is not needed anymore."
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
"name": "onClose",
|
|
575
|
+
"type": "() => void",
|
|
576
|
+
"default": "",
|
|
577
|
+
"description": "Callback function that gets triggered when the user closed the bottom sheet with the close button."
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
"name": "bodyClassName",
|
|
581
|
+
"type": "String",
|
|
582
|
+
"default": "",
|
|
583
|
+
"description": "Optional className to be set on the body."
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"name": "className",
|
|
587
|
+
"type": "String",
|
|
588
|
+
"default": "",
|
|
589
|
+
"description": "Optional className to be set on the component. Use this to define a max-width value."
|
|
590
|
+
}
|
|
591
|
+
]
|
|
592
|
+
}
|
|
593
|
+
]
|
|
594
|
+
}
|
|
595
|
+
]
|
|
596
|
+
}
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
],
|
|
600
|
+
"see_also": []
|
|
601
|
+
}
|