@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,1117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata": {
|
|
3
|
+
"captured_at": "2025-11-21T12:07:15.360Z",
|
|
4
|
+
"source": "https://uikit.developers.rio.cloud/#components/editableContent",
|
|
5
|
+
"category": "Components",
|
|
6
|
+
"section": "Interaction",
|
|
7
|
+
"slug": "components/editablecontent",
|
|
8
|
+
"version": "v1.13.2",
|
|
9
|
+
"hash_algorithm": "sha256",
|
|
10
|
+
"hash": "ecc18046a1c8197fe3cf4141d6d85dcd65191e3ed6b34885628332f7bdf31fb3"
|
|
11
|
+
},
|
|
12
|
+
"title": "EditableContent",
|
|
13
|
+
"lead": "The EditableContent component allows for inline editing text or other values. To make sure the user can recognize such an element, it's best to mark the text or content with a dotted line depending on the situation and where it is placed. Alternatively, you can place the \"pencil\" icon next to the content. Especially on mobile where no hover is available, the editable content must be marked permanently.",
|
|
14
|
+
"content": [
|
|
15
|
+
{
|
|
16
|
+
"heading": "EditableContent",
|
|
17
|
+
"body": "Please also check out the usage guidelines below.",
|
|
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><label>Simple editable content</label></div><span class=\"\"><span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Click Me!</span></span></div>",
|
|
22
|
+
"tabs": [
|
|
23
|
+
{
|
|
24
|
+
"label": "React",
|
|
25
|
+
"language": "tsx",
|
|
26
|
+
"code": "/* eslint-disable max-len */\nimport { useState } from 'react';\n\nimport EditableContent from '@rio-cloud/rio-uikit/EditableContent';\n\nexport default () => {\n const [text, setText] = useState('Click Me!');\n\n const handleSaveText = (value: string) => setText(value);\n\n return (\n <>\n <div>\n <label>Simple editable content</label>\n </div>\n <EditableContent onSave={handleSaveText}>\n <span className='border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted'>\n {text || <i> </i>}\n </span>\n </EditableContent>\n </>\n );\n};"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"label": "HTML",
|
|
30
|
+
"language": "html",
|
|
31
|
+
"code": "<div>\n <label>Simple editable content</label>\n</div>\n<span class=\"\">\n <span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Click Me!</span>\n</span>"
|
|
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": "",
|
|
45
|
+
"description": "Visibility flag used to control edit mode from outside."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "onSave",
|
|
49
|
+
"type": "(value: string) => void",
|
|
50
|
+
"default": "",
|
|
51
|
+
"description": "Callback function triggered when the save button is clicked."
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "onCancel",
|
|
55
|
+
"type": "VoidFunction",
|
|
56
|
+
"default": "",
|
|
57
|
+
"description": "Callback function triggered when the cancel button is clicked."
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "onFocus",
|
|
61
|
+
"type": "VoidFunction",
|
|
62
|
+
"default": "",
|
|
63
|
+
"description": "Callback function triggered when the input gets focused."
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "onBlur",
|
|
67
|
+
"type": "VoidFunction",
|
|
68
|
+
"default": "",
|
|
69
|
+
"description": "Callback function triggered when input looses the focus."
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "onEditMode",
|
|
73
|
+
"type": "VoidFunction",
|
|
74
|
+
"default": "",
|
|
75
|
+
"description": "Callback function triggered when entering the edit mode."
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "onSaveValidation",
|
|
79
|
+
"type": "(value: string) => boolean",
|
|
80
|
+
"default": "",
|
|
81
|
+
"description": "Validation function to intercept saving and prevent save on error."
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "isValid",
|
|
85
|
+
"type": "boolean",
|
|
86
|
+
"default": "true",
|
|
87
|
+
"description": "Controls the error message visibility from outside. This is useful when using a custom input where the validation happens outside of this component."
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "errorMessage",
|
|
91
|
+
"type": "ReactNode",
|
|
92
|
+
"default": "",
|
|
93
|
+
"description": "The error message that shall be shown to the user in case the validation fails."
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "customEditor",
|
|
97
|
+
"type": "ReactNode",
|
|
98
|
+
"default": "",
|
|
99
|
+
"description": "Use this prop to define a custom editor input component like Select, NumberInput, TimePicker or DatePicker. Handling input state changes of a custom editor need to be handled outside of this component. By default the EditableContent uses a built-in textarea to allow resizing for larger text. the text element has borders, spacings different text sizes."
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"name": "editorOffsetTop",
|
|
103
|
+
"type": "Number",
|
|
104
|
+
"default": "0",
|
|
105
|
+
"description": "Offset value to control the vertical position for the editor in case the text element has borders, spacings different text sizes."
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "editorOffsetLeft",
|
|
109
|
+
"type": "Number",
|
|
110
|
+
"default": "0",
|
|
111
|
+
"description": "Offset value to control the horizontal position for the editor in case the text element has borders, spacings different text sizes."
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "size",
|
|
115
|
+
"type": "String",
|
|
116
|
+
"default": "md",
|
|
117
|
+
"description": "Defines the input and button size. Use \"lg\" for headlines."
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "allowResize",
|
|
121
|
+
"type": "Boolean",
|
|
122
|
+
"default": "false",
|
|
123
|
+
"description": "Defines if the internal textarea is allowed to resize vertically. This comes in handy for larger text and when using multiple input rows."
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "inputRows",
|
|
127
|
+
"type": "Number",
|
|
128
|
+
"default": "1",
|
|
129
|
+
"description": "Defines the number of rows to use by the internal textarea component."
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "inputClassName",
|
|
133
|
+
"type": "String",
|
|
134
|
+
"default": "",
|
|
135
|
+
"description": "Additional classes to be set on the editor input itself."
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "editorClassName",
|
|
139
|
+
"type": "String",
|
|
140
|
+
"default": "",
|
|
141
|
+
"description": "Additional classes to be set on the editor wrapper element."
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "className",
|
|
145
|
+
"type": "String",
|
|
146
|
+
"default": "",
|
|
147
|
+
"description": "Additional classes to be set on the text wrapper element."
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"caption": "Headline that can change",
|
|
157
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div><label>Editable headline - like dialog or panel header</label></div><div class=\"panel panel-default\"><div class=\"panel-heading\"><span class=\"\"><h4 class=\"display-flex align-items-center gap-5 text-color-darker hover-text-color-darkest text-thin cursor-pointer margin-0\"><span>Headline that can change</span><span class=\"rioglyph rioglyph-pencil text-size-20\"></span></h4></span></div><div class=\"panel-body\">\nLorem ipsum dolor sit amet, consectetur adipiscing elit. In pharetra dui eget massa efficitur aliquam condimentum in felis. Integer eget metus vel nunc efficitur iaculis. Vivamus elementum ante et est sagittis semper. Ut consectetur enim nec tortor scelerisque tincidunt. Fusce ac ligula bibendum, rutrum libero quis, viverra sem. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis ut hendrerit massa, in molestie elit. Sed vitae orci ac purus volutpat posuere ac ut neque. Mauris ante orci, semper finibus lorem in, fringilla pretium velit.</div></div></div>",
|
|
158
|
+
"tabs": [
|
|
159
|
+
{
|
|
160
|
+
"label": "React",
|
|
161
|
+
"language": "tsx",
|
|
162
|
+
"code": "/* eslint-disable max-len */\nimport { useState } from 'react';\n\nimport EditableContent from '@rio-cloud/rio-uikit/EditableContent';\nimport { dummyText } from '../../../utils/data';\n\nexport default () => {\n const [text, setText] = useState('Headline that can change');\n\n const handleSaveText = (value: string) => setText(value);\n\n return (\n <>\n <div>\n <label>Editable headline - like dialog or panel header</label>\n </div>\n <div className='panel panel-default'>\n <div className='panel-heading'>\n <EditableContent\n onSave={handleSaveText}\n editorOffsetTop={-3}\n inputClassName='min-width-300'\n size='lg'\n >\n <h4 className='display-flex align-items-center gap-5 text-color-darker hover-text-color-darkest text-thin cursor-pointer margin-0'>\n <span>{text}</span>\n <span className='rioglyph rioglyph-pencil text-size-20' />\n </h4>\n </EditableContent>\n </div>\n <div className='panel-body'>{dummyText}</div>\n </div>\n </>\n );\n};"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"label": "HTML",
|
|
166
|
+
"language": "html",
|
|
167
|
+
"code": "<div>\n <label>Editable headline - like dialog or panel header</label>\n</div>\n<div class=\"panel panel-default\">\n <div class=\"panel-heading\">\n <span class=\"\">\n <h4 class=\"display-flex align-items-center gap-5 text-color-darker hover-text-color-darkest text-thin cursor-pointer margin-0\">\n <span>Headline that can change</span>\n <span class=\"rioglyph rioglyph-pencil text-size-20\">\n </span>\n </h4>\n </span>\n </div>\n <div class=\"panel-body\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. In pharetra dui eget massa efficitur aliquam condimentum in felis. Integer eget metus vel nunc efficitur iaculis. Vivamus elementum ante et est sagittis semper. Ut consectetur enim nec tortor scelerisque tincidunt. Fusce ac ligula bibendum, rutrum libero quis, viverra sem. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis ut hendrerit massa, in molestie elit. Sed vitae orci ac purus volutpat posuere ac ut neque. Mauris ante orci, semper finibus lorem in, fringilla pretium velit.</div>\n</div>"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"label": "Props",
|
|
171
|
+
"language": "json",
|
|
172
|
+
"code": null,
|
|
173
|
+
"props": [
|
|
174
|
+
{
|
|
175
|
+
"heading": null,
|
|
176
|
+
"rows": [
|
|
177
|
+
{
|
|
178
|
+
"name": "show",
|
|
179
|
+
"type": "Boolean",
|
|
180
|
+
"default": "",
|
|
181
|
+
"description": "Visibility flag used to control edit mode from outside."
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"name": "onSave",
|
|
185
|
+
"type": "(value: string) => void",
|
|
186
|
+
"default": "",
|
|
187
|
+
"description": "Callback function triggered when the save button is clicked."
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"name": "onCancel",
|
|
191
|
+
"type": "VoidFunction",
|
|
192
|
+
"default": "",
|
|
193
|
+
"description": "Callback function triggered when the cancel button is clicked."
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"name": "onFocus",
|
|
197
|
+
"type": "VoidFunction",
|
|
198
|
+
"default": "",
|
|
199
|
+
"description": "Callback function triggered when the input gets focused."
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "onBlur",
|
|
203
|
+
"type": "VoidFunction",
|
|
204
|
+
"default": "",
|
|
205
|
+
"description": "Callback function triggered when input looses the focus."
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"name": "onEditMode",
|
|
209
|
+
"type": "VoidFunction",
|
|
210
|
+
"default": "",
|
|
211
|
+
"description": "Callback function triggered when entering the edit mode."
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"name": "onSaveValidation",
|
|
215
|
+
"type": "(value: string) => boolean",
|
|
216
|
+
"default": "",
|
|
217
|
+
"description": "Validation function to intercept saving and prevent save on error."
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"name": "isValid",
|
|
221
|
+
"type": "boolean",
|
|
222
|
+
"default": "true",
|
|
223
|
+
"description": "Controls the error message visibility from outside. This is useful when using a custom input where the validation happens outside of this component."
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"name": "errorMessage",
|
|
227
|
+
"type": "ReactNode",
|
|
228
|
+
"default": "",
|
|
229
|
+
"description": "The error message that shall be shown to the user in case the validation fails."
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"name": "customEditor",
|
|
233
|
+
"type": "ReactNode",
|
|
234
|
+
"default": "",
|
|
235
|
+
"description": "Use this prop to define a custom editor input component like Select, NumberInput, TimePicker or DatePicker. Handling input state changes of a custom editor need to be handled outside of this component. By default the EditableContent uses a built-in textarea to allow resizing for larger text. the text element has borders, spacings different text sizes."
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"name": "editorOffsetTop",
|
|
239
|
+
"type": "Number",
|
|
240
|
+
"default": "0",
|
|
241
|
+
"description": "Offset value to control the vertical position for the editor in case the text element has borders, spacings different text sizes."
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"name": "editorOffsetLeft",
|
|
245
|
+
"type": "Number",
|
|
246
|
+
"default": "0",
|
|
247
|
+
"description": "Offset value to control the horizontal position for the editor in case the text element has borders, spacings different text sizes."
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"name": "size",
|
|
251
|
+
"type": "String",
|
|
252
|
+
"default": "md",
|
|
253
|
+
"description": "Defines the input and button size. Use \"lg\" for headlines."
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"name": "allowResize",
|
|
257
|
+
"type": "Boolean",
|
|
258
|
+
"default": "false",
|
|
259
|
+
"description": "Defines if the internal textarea is allowed to resize vertically. This comes in handy for larger text and when using multiple input rows."
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"name": "inputRows",
|
|
263
|
+
"type": "Number",
|
|
264
|
+
"default": "1",
|
|
265
|
+
"description": "Defines the number of rows to use by the internal textarea component."
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"name": "inputClassName",
|
|
269
|
+
"type": "String",
|
|
270
|
+
"default": "",
|
|
271
|
+
"description": "Additional classes to be set on the editor input itself."
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"name": "editorClassName",
|
|
275
|
+
"type": "String",
|
|
276
|
+
"default": "",
|
|
277
|
+
"description": "Additional classes to be set on the editor wrapper element."
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"name": "className",
|
|
281
|
+
"type": "String",
|
|
282
|
+
"default": "",
|
|
283
|
+
"description": "Additional classes to be set on the text wrapper element."
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
]
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"caption": "Example 3",
|
|
293
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div><label>Editable content using a resizable textarea</label></div><div class=\"bg-lightest rounded padding-10\"><span class=\"\"><div><span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">This text can be edited on multiple lines</span></div></span></div></div>",
|
|
294
|
+
"tabs": [
|
|
295
|
+
{
|
|
296
|
+
"label": "React",
|
|
297
|
+
"language": "tsx",
|
|
298
|
+
"code": "/* eslint-disable max-len */\nimport { useState } from 'react';\n\nimport EditableContent from '@rio-cloud/rio-uikit/EditableContent';\n\nexport default () => {\n const [text, setText] = useState('This text can be edited on multiple lines');\n\n const handleSaveText = (value: string) => setText(value);\n\n return (\n <>\n <div>\n <label>Editable content using a resizable textarea</label>\n </div>\n <div className='bg-lightest rounded padding-10'>\n <EditableContent\n onSave={handleSaveText}\n inputClassName='min-width-300'\n inputRows={2}\n editorOffsetTop={1}\n allowResize\n >\n <div>\n <span className='border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted'>\n {text}\n </span>\n </div>\n </EditableContent>\n </div>\n </>\n );\n};"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"label": "HTML",
|
|
302
|
+
"language": "html",
|
|
303
|
+
"code": "<div>\n <label>Editable content using a resizable textarea</label>\n</div>\n<div class=\"bg-lightest rounded padding-10\">\n <span class=\"\">\n <div>\n <span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">This text can be edited on multiple lines</span>\n </div>\n </span>\n</div>"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"label": "Props",
|
|
307
|
+
"language": "json",
|
|
308
|
+
"code": null,
|
|
309
|
+
"props": [
|
|
310
|
+
{
|
|
311
|
+
"heading": null,
|
|
312
|
+
"rows": [
|
|
313
|
+
{
|
|
314
|
+
"name": "show",
|
|
315
|
+
"type": "Boolean",
|
|
316
|
+
"default": "",
|
|
317
|
+
"description": "Visibility flag used to control edit mode from outside."
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"name": "onSave",
|
|
321
|
+
"type": "(value: string) => void",
|
|
322
|
+
"default": "",
|
|
323
|
+
"description": "Callback function triggered when the save button is clicked."
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"name": "onCancel",
|
|
327
|
+
"type": "VoidFunction",
|
|
328
|
+
"default": "",
|
|
329
|
+
"description": "Callback function triggered when the cancel button is clicked."
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"name": "onFocus",
|
|
333
|
+
"type": "VoidFunction",
|
|
334
|
+
"default": "",
|
|
335
|
+
"description": "Callback function triggered when the input gets focused."
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"name": "onBlur",
|
|
339
|
+
"type": "VoidFunction",
|
|
340
|
+
"default": "",
|
|
341
|
+
"description": "Callback function triggered when input looses the focus."
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"name": "onEditMode",
|
|
345
|
+
"type": "VoidFunction",
|
|
346
|
+
"default": "",
|
|
347
|
+
"description": "Callback function triggered when entering the edit mode."
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"name": "onSaveValidation",
|
|
351
|
+
"type": "(value: string) => boolean",
|
|
352
|
+
"default": "",
|
|
353
|
+
"description": "Validation function to intercept saving and prevent save on error."
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"name": "isValid",
|
|
357
|
+
"type": "boolean",
|
|
358
|
+
"default": "true",
|
|
359
|
+
"description": "Controls the error message visibility from outside. This is useful when using a custom input where the validation happens outside of this component."
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"name": "errorMessage",
|
|
363
|
+
"type": "ReactNode",
|
|
364
|
+
"default": "",
|
|
365
|
+
"description": "The error message that shall be shown to the user in case the validation fails."
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"name": "customEditor",
|
|
369
|
+
"type": "ReactNode",
|
|
370
|
+
"default": "",
|
|
371
|
+
"description": "Use this prop to define a custom editor input component like Select, NumberInput, TimePicker or DatePicker. Handling input state changes of a custom editor need to be handled outside of this component. By default the EditableContent uses a built-in textarea to allow resizing for larger text. the text element has borders, spacings different text sizes."
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"name": "editorOffsetTop",
|
|
375
|
+
"type": "Number",
|
|
376
|
+
"default": "0",
|
|
377
|
+
"description": "Offset value to control the vertical position for the editor in case the text element has borders, spacings different text sizes."
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"name": "editorOffsetLeft",
|
|
381
|
+
"type": "Number",
|
|
382
|
+
"default": "0",
|
|
383
|
+
"description": "Offset value to control the horizontal position for the editor in case the text element has borders, spacings different text sizes."
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"name": "size",
|
|
387
|
+
"type": "String",
|
|
388
|
+
"default": "md",
|
|
389
|
+
"description": "Defines the input and button size. Use \"lg\" for headlines."
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"name": "allowResize",
|
|
393
|
+
"type": "Boolean",
|
|
394
|
+
"default": "false",
|
|
395
|
+
"description": "Defines if the internal textarea is allowed to resize vertically. This comes in handy for larger text and when using multiple input rows."
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"name": "inputRows",
|
|
399
|
+
"type": "Number",
|
|
400
|
+
"default": "1",
|
|
401
|
+
"description": "Defines the number of rows to use by the internal textarea component."
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"name": "inputClassName",
|
|
405
|
+
"type": "String",
|
|
406
|
+
"default": "",
|
|
407
|
+
"description": "Additional classes to be set on the editor input itself."
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"name": "editorClassName",
|
|
411
|
+
"type": "String",
|
|
412
|
+
"default": "",
|
|
413
|
+
"description": "Additional classes to be set on the editor wrapper element."
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"name": "className",
|
|
417
|
+
"type": "String",
|
|
418
|
+
"default": "",
|
|
419
|
+
"description": "Additional classes to be set on the text wrapper element."
|
|
420
|
+
}
|
|
421
|
+
]
|
|
422
|
+
}
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
]
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"caption": "Example 4",
|
|
429
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div><label>Focusable editable content with input validation</label><span class=\"\"><div class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\" tabindex=\"0\"><span>This content must not contain numbers.</span></div></span></div></div>",
|
|
430
|
+
"tabs": [
|
|
431
|
+
{
|
|
432
|
+
"label": "React",
|
|
433
|
+
"language": "tsx",
|
|
434
|
+
"code": "/* eslint-disable max-len */\nimport { useRef, useState } from 'react';\n\nimport EditableContent from '@rio-cloud/rio-uikit/EditableContent';\nimport { useKey } from '@rio-cloud/rio-uikit';\n\nexport default () => {\n const [isEditMode, setIsEditMode] = useState(false);\n const [text, setText] = useState('This content must not contain numbers.');\n\n const ref = useRef<HTMLDivElement>(null);\n\n useKey(event => {\n if (event.key === 'Enter' && document.activeElement === ref.current) {\n setIsEditMode(true);\n }\n });\n\n const handleSaveText = (value: string) => {\n setText(value);\n setIsEditMode(false);\n };\n\n const handleCancelText = () => setIsEditMode(false);\n\n const handleValidation = (value: string) => !/\\d/.test(value);\n\n return (\n <div>\n <label>Focusable editable content with input validation</label>\n <EditableContent\n show={isEditMode}\n onSave={handleSaveText}\n onCancel={handleCancelText}\n onSaveValidation={handleValidation}\n editorOffsetTop={1}\n errorMessage={<span>Numbers are not allowed</span>}\n inputClassName='min-width-200'\n editorClassName='max-width-350'\n >\n <div\n ref={ref}\n className='border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted'\n tabIndex={0}\n >\n <span>{text}</span>\n </div>\n </EditableContent>\n </div>\n );\n};"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"label": "HTML",
|
|
438
|
+
"language": "html",
|
|
439
|
+
"code": "<div>\n <label>Focusable editable content with input validation</label>\n <span class=\"\">\n <div class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\" tabindex=\"0\">\n <span>This content must not contain numbers.</span>\n </div>\n </span>\n</div>"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"label": "Props",
|
|
443
|
+
"language": "json",
|
|
444
|
+
"code": null,
|
|
445
|
+
"props": [
|
|
446
|
+
{
|
|
447
|
+
"heading": null,
|
|
448
|
+
"rows": [
|
|
449
|
+
{
|
|
450
|
+
"name": "show",
|
|
451
|
+
"type": "Boolean",
|
|
452
|
+
"default": "",
|
|
453
|
+
"description": "Visibility flag used to control edit mode from outside."
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"name": "onSave",
|
|
457
|
+
"type": "(value: string) => void",
|
|
458
|
+
"default": "",
|
|
459
|
+
"description": "Callback function triggered when the save button is clicked."
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"name": "onCancel",
|
|
463
|
+
"type": "VoidFunction",
|
|
464
|
+
"default": "",
|
|
465
|
+
"description": "Callback function triggered when the cancel button is clicked."
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
"name": "onFocus",
|
|
469
|
+
"type": "VoidFunction",
|
|
470
|
+
"default": "",
|
|
471
|
+
"description": "Callback function triggered when the input gets focused."
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"name": "onBlur",
|
|
475
|
+
"type": "VoidFunction",
|
|
476
|
+
"default": "",
|
|
477
|
+
"description": "Callback function triggered when input looses the focus."
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"name": "onEditMode",
|
|
481
|
+
"type": "VoidFunction",
|
|
482
|
+
"default": "",
|
|
483
|
+
"description": "Callback function triggered when entering the edit mode."
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"name": "onSaveValidation",
|
|
487
|
+
"type": "(value: string) => boolean",
|
|
488
|
+
"default": "",
|
|
489
|
+
"description": "Validation function to intercept saving and prevent save on error."
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
"name": "isValid",
|
|
493
|
+
"type": "boolean",
|
|
494
|
+
"default": "true",
|
|
495
|
+
"description": "Controls the error message visibility from outside. This is useful when using a custom input where the validation happens outside of this component."
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
"name": "errorMessage",
|
|
499
|
+
"type": "ReactNode",
|
|
500
|
+
"default": "",
|
|
501
|
+
"description": "The error message that shall be shown to the user in case the validation fails."
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
"name": "customEditor",
|
|
505
|
+
"type": "ReactNode",
|
|
506
|
+
"default": "",
|
|
507
|
+
"description": "Use this prop to define a custom editor input component like Select, NumberInput, TimePicker or DatePicker. Handling input state changes of a custom editor need to be handled outside of this component. By default the EditableContent uses a built-in textarea to allow resizing for larger text. the text element has borders, spacings different text sizes."
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"name": "editorOffsetTop",
|
|
511
|
+
"type": "Number",
|
|
512
|
+
"default": "0",
|
|
513
|
+
"description": "Offset value to control the vertical position for the editor in case the text element has borders, spacings different text sizes."
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
"name": "editorOffsetLeft",
|
|
517
|
+
"type": "Number",
|
|
518
|
+
"default": "0",
|
|
519
|
+
"description": "Offset value to control the horizontal position for the editor in case the text element has borders, spacings different text sizes."
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
"name": "size",
|
|
523
|
+
"type": "String",
|
|
524
|
+
"default": "md",
|
|
525
|
+
"description": "Defines the input and button size. Use \"lg\" for headlines."
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"name": "allowResize",
|
|
529
|
+
"type": "Boolean",
|
|
530
|
+
"default": "false",
|
|
531
|
+
"description": "Defines if the internal textarea is allowed to resize vertically. This comes in handy for larger text and when using multiple input rows."
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"name": "inputRows",
|
|
535
|
+
"type": "Number",
|
|
536
|
+
"default": "1",
|
|
537
|
+
"description": "Defines the number of rows to use by the internal textarea component."
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
"name": "inputClassName",
|
|
541
|
+
"type": "String",
|
|
542
|
+
"default": "",
|
|
543
|
+
"description": "Additional classes to be set on the editor input itself."
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"name": "editorClassName",
|
|
547
|
+
"type": "String",
|
|
548
|
+
"default": "",
|
|
549
|
+
"description": "Additional classes to be set on the editor wrapper element."
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
"name": "className",
|
|
553
|
+
"type": "String",
|
|
554
|
+
"default": "",
|
|
555
|
+
"description": "Additional classes to be set on the text wrapper element."
|
|
556
|
+
}
|
|
557
|
+
]
|
|
558
|
+
}
|
|
559
|
+
]
|
|
560
|
+
}
|
|
561
|
+
]
|
|
562
|
+
},
|
|
563
|
+
{
|
|
564
|
+
"caption": "Example 5",
|
|
565
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><label>Editable text inside of another text</label><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In pharetra dui eget massa efficitur aliquam condimentum in felis. Integer eget metus vel nunc efficitur iaculis. Vivamus elementum ante et est sagittis semper. <span class=\"\"><span class=\"border border-bottom-only border-color-dark border-style-dotted hover-bg-lighter\">This text can be edited</span></span> Ut consectetur enim nec tortor scelerisque tincidunt. Fusce ac ligula bibendum, rutrum libero quis, viverra sem. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis ut hendrerit massa, in molestie elit. Sed vitae orci ac purus volutpat posuere ac ut neque. Mauris ante orci, semper finibus lorem in, fringilla pretium velit.`;</p></div>",
|
|
566
|
+
"tabs": [
|
|
567
|
+
{
|
|
568
|
+
"label": "React",
|
|
569
|
+
"language": "tsx",
|
|
570
|
+
"code": "import { useState } from 'react';\n\nimport EditableContent from '@rio-cloud/rio-uikit/EditableContent';\n\nexport default () => {\n const [text, setText] = useState('This text can be edited');\n\n const handleSaveText = (value: string) => setText(value);\n\n return (\n <>\n <label>Editable text inside of another text</label>\n <p>\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. In pharetra dui eget massa efficitur aliquam\n condimentum in felis. Integer eget metus vel nunc efficitur iaculis. Vivamus elementum ante et est\n sagittis semper.{' '}\n <EditableContent onSave={handleSaveText}>\n <span className='border border-bottom-only border-color-dark border-style-dotted hover-bg-lighter'>\n {text}\n </span>\n </EditableContent>{' '}\n Ut consectetur enim nec tortor scelerisque tincidunt. Fusce ac ligula bibendum, rutrum libero quis,\n viverra sem. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis ut hendrerit massa, in\n molestie elit. Sed vitae orci ac purus volutpat posuere ac ut neque. Mauris ante orci, semper finibus\n lorem in, fringilla pretium velit.`;\n </p>\n </>\n );\n};"
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
"label": "HTML",
|
|
574
|
+
"language": "html",
|
|
575
|
+
"code": "<label>Editable text inside of another text</label>\n<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In pharetra dui eget massa efficitur aliquam condimentum in felis. Integer eget metus vel nunc efficitur iaculis. Vivamus elementum ante et est sagittis semper. <span class=\"\">\n <span class=\"border border-bottom-only border-color-dark border-style-dotted hover-bg-lighter\">This text can be edited</span>\n </span> Ut consectetur enim nec tortor scelerisque tincidunt. Fusce ac ligula bibendum, rutrum libero quis, viverra sem. Interdum et malesuada fames ac ante ipsum primis in faucibus. Duis ut hendrerit massa, in molestie elit. Sed vitae orci ac purus volutpat posuere ac ut neque. Mauris ante orci, semper finibus lorem in, fringilla pretium velit.`;</p>"
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
"label": "Props",
|
|
579
|
+
"language": "json",
|
|
580
|
+
"code": null,
|
|
581
|
+
"props": [
|
|
582
|
+
{
|
|
583
|
+
"heading": null,
|
|
584
|
+
"rows": [
|
|
585
|
+
{
|
|
586
|
+
"name": "show",
|
|
587
|
+
"type": "Boolean",
|
|
588
|
+
"default": "",
|
|
589
|
+
"description": "Visibility flag used to control edit mode from outside."
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
"name": "onSave",
|
|
593
|
+
"type": "(value: string) => void",
|
|
594
|
+
"default": "",
|
|
595
|
+
"description": "Callback function triggered when the save button is clicked."
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
"name": "onCancel",
|
|
599
|
+
"type": "VoidFunction",
|
|
600
|
+
"default": "",
|
|
601
|
+
"description": "Callback function triggered when the cancel button is clicked."
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
"name": "onFocus",
|
|
605
|
+
"type": "VoidFunction",
|
|
606
|
+
"default": "",
|
|
607
|
+
"description": "Callback function triggered when the input gets focused."
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
"name": "onBlur",
|
|
611
|
+
"type": "VoidFunction",
|
|
612
|
+
"default": "",
|
|
613
|
+
"description": "Callback function triggered when input looses the focus."
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
"name": "onEditMode",
|
|
617
|
+
"type": "VoidFunction",
|
|
618
|
+
"default": "",
|
|
619
|
+
"description": "Callback function triggered when entering the edit mode."
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
"name": "onSaveValidation",
|
|
623
|
+
"type": "(value: string) => boolean",
|
|
624
|
+
"default": "",
|
|
625
|
+
"description": "Validation function to intercept saving and prevent save on error."
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
"name": "isValid",
|
|
629
|
+
"type": "boolean",
|
|
630
|
+
"default": "true",
|
|
631
|
+
"description": "Controls the error message visibility from outside. This is useful when using a custom input where the validation happens outside of this component."
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
"name": "errorMessage",
|
|
635
|
+
"type": "ReactNode",
|
|
636
|
+
"default": "",
|
|
637
|
+
"description": "The error message that shall be shown to the user in case the validation fails."
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
"name": "customEditor",
|
|
641
|
+
"type": "ReactNode",
|
|
642
|
+
"default": "",
|
|
643
|
+
"description": "Use this prop to define a custom editor input component like Select, NumberInput, TimePicker or DatePicker. Handling input state changes of a custom editor need to be handled outside of this component. By default the EditableContent uses a built-in textarea to allow resizing for larger text. the text element has borders, spacings different text sizes."
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
"name": "editorOffsetTop",
|
|
647
|
+
"type": "Number",
|
|
648
|
+
"default": "0",
|
|
649
|
+
"description": "Offset value to control the vertical position for the editor in case the text element has borders, spacings different text sizes."
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
"name": "editorOffsetLeft",
|
|
653
|
+
"type": "Number",
|
|
654
|
+
"default": "0",
|
|
655
|
+
"description": "Offset value to control the horizontal position for the editor in case the text element has borders, spacings different text sizes."
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
"name": "size",
|
|
659
|
+
"type": "String",
|
|
660
|
+
"default": "md",
|
|
661
|
+
"description": "Defines the input and button size. Use \"lg\" for headlines."
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
"name": "allowResize",
|
|
665
|
+
"type": "Boolean",
|
|
666
|
+
"default": "false",
|
|
667
|
+
"description": "Defines if the internal textarea is allowed to resize vertically. This comes in handy for larger text and when using multiple input rows."
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
"name": "inputRows",
|
|
671
|
+
"type": "Number",
|
|
672
|
+
"default": "1",
|
|
673
|
+
"description": "Defines the number of rows to use by the internal textarea component."
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
"name": "inputClassName",
|
|
677
|
+
"type": "String",
|
|
678
|
+
"default": "",
|
|
679
|
+
"description": "Additional classes to be set on the editor input itself."
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
"name": "editorClassName",
|
|
683
|
+
"type": "String",
|
|
684
|
+
"default": "",
|
|
685
|
+
"description": "Additional classes to be set on the editor wrapper element."
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
"name": "className",
|
|
689
|
+
"type": "String",
|
|
690
|
+
"default": "",
|
|
691
|
+
"description": "Additional classes to be set on the text wrapper element."
|
|
692
|
+
}
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
]
|
|
696
|
+
}
|
|
697
|
+
]
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
"caption": "Example 6",
|
|
701
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div><div><label class=\"margin-right-20\">Render NumberControl as custom editor component</label></div><div class=\"display-flex gap-25\"><span class=\"\"><span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">234</span></span></div></div></div>",
|
|
702
|
+
"tabs": [
|
|
703
|
+
{
|
|
704
|
+
"label": "React",
|
|
705
|
+
"language": "tsx",
|
|
706
|
+
"code": "/* eslint-disable max-len */\nimport { forwardRef, useEffect, useRef, useState, type ForwardedRef } from 'react';\n\nimport EditableContent from '@rio-cloud/rio-uikit/EditableContent';\nimport NumberControl from '@rio-cloud/rio-uikit/NumberControl';\n\ntype CustomContentProps = {\n value: number;\n onChange: (newValue?: number | undefined) => void;\n onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n};\n\nconst CustomContent = forwardRef((props: CustomContentProps, ref: ForwardedRef<HTMLInputElement>) => {\n const { value, onChange, onKeyDown } = props;\n\n return (\n <NumberControl\n ref={ref}\n value={value}\n onChange={onChange}\n onKeyDown={onKeyDown}\n className='margin-0 min-width-100'\n />\n );\n});\n\nexport default () => {\n const [data, setData] = useState(234);\n const [transientData, setTransientData] = useState(0);\n\n const [isEditMode, setIsEditMode] = useState(false);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (isEditMode) {\n inputRef.current?.focus();\n }\n }, [isEditMode]);\n\n const handleChange = (value: number | undefined) => setTransientData(value || 0);\n\n const handleCancel = () => setIsEditMode(false);\n\n const handleSaveText = () => {\n setData(transientData);\n setIsEditMode(false);\n };\n\n const handleEnterEditMode = () => {\n setTransientData(data);\n setIsEditMode(true);\n };\n\n // Since we use a custom input instead of the built-in textarea, we need to handle keyboard\n // events ourself for instance in order to save on enter.\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n handleSaveText();\n }\n };\n\n return (\n <div>\n <div>\n <label className='margin-right-20'>Render NumberControl as custom editor component</label>\n </div>\n <div className='display-flex gap-25'>\n <EditableContent\n show={isEditMode}\n onSave={handleSaveText}\n onCancel={handleCancel}\n onEditMode={handleEnterEditMode}\n customEditor={\n <CustomContent\n ref={inputRef}\n value={transientData}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n />\n }\n editorOffsetTop={1}\n >\n <span className='border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted'>\n {data}\n </span>\n </EditableContent>\n </div>\n </div>\n );\n};"
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
"label": "HTML",
|
|
710
|
+
"language": "html",
|
|
711
|
+
"code": "<div>\n <div>\n <label class=\"margin-right-20\">Render NumberControl as custom editor component</label>\n </div>\n <div class=\"display-flex gap-25\">\n <span class=\"\">\n <span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">234</span>\n </span>\n </div>\n</div>"
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
"label": "Props",
|
|
715
|
+
"language": "json",
|
|
716
|
+
"code": null,
|
|
717
|
+
"props": [
|
|
718
|
+
{
|
|
719
|
+
"heading": null,
|
|
720
|
+
"rows": [
|
|
721
|
+
{
|
|
722
|
+
"name": "show",
|
|
723
|
+
"type": "Boolean",
|
|
724
|
+
"default": "",
|
|
725
|
+
"description": "Visibility flag used to control edit mode from outside."
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
"name": "onSave",
|
|
729
|
+
"type": "(value: string) => void",
|
|
730
|
+
"default": "",
|
|
731
|
+
"description": "Callback function triggered when the save button is clicked."
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
"name": "onCancel",
|
|
735
|
+
"type": "VoidFunction",
|
|
736
|
+
"default": "",
|
|
737
|
+
"description": "Callback function triggered when the cancel button is clicked."
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
"name": "onFocus",
|
|
741
|
+
"type": "VoidFunction",
|
|
742
|
+
"default": "",
|
|
743
|
+
"description": "Callback function triggered when the input gets focused."
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
"name": "onBlur",
|
|
747
|
+
"type": "VoidFunction",
|
|
748
|
+
"default": "",
|
|
749
|
+
"description": "Callback function triggered when input looses the focus."
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
"name": "onEditMode",
|
|
753
|
+
"type": "VoidFunction",
|
|
754
|
+
"default": "",
|
|
755
|
+
"description": "Callback function triggered when entering the edit mode."
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"name": "onSaveValidation",
|
|
759
|
+
"type": "(value: string) => boolean",
|
|
760
|
+
"default": "",
|
|
761
|
+
"description": "Validation function to intercept saving and prevent save on error."
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
"name": "isValid",
|
|
765
|
+
"type": "boolean",
|
|
766
|
+
"default": "true",
|
|
767
|
+
"description": "Controls the error message visibility from outside. This is useful when using a custom input where the validation happens outside of this component."
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
"name": "errorMessage",
|
|
771
|
+
"type": "ReactNode",
|
|
772
|
+
"default": "",
|
|
773
|
+
"description": "The error message that shall be shown to the user in case the validation fails."
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
"name": "customEditor",
|
|
777
|
+
"type": "ReactNode",
|
|
778
|
+
"default": "",
|
|
779
|
+
"description": "Use this prop to define a custom editor input component like Select, NumberInput, TimePicker or DatePicker. Handling input state changes of a custom editor need to be handled outside of this component. By default the EditableContent uses a built-in textarea to allow resizing for larger text. the text element has borders, spacings different text sizes."
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
"name": "editorOffsetTop",
|
|
783
|
+
"type": "Number",
|
|
784
|
+
"default": "0",
|
|
785
|
+
"description": "Offset value to control the vertical position for the editor in case the text element has borders, spacings different text sizes."
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
"name": "editorOffsetLeft",
|
|
789
|
+
"type": "Number",
|
|
790
|
+
"default": "0",
|
|
791
|
+
"description": "Offset value to control the horizontal position for the editor in case the text element has borders, spacings different text sizes."
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
"name": "size",
|
|
795
|
+
"type": "String",
|
|
796
|
+
"default": "md",
|
|
797
|
+
"description": "Defines the input and button size. Use \"lg\" for headlines."
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
"name": "allowResize",
|
|
801
|
+
"type": "Boolean",
|
|
802
|
+
"default": "false",
|
|
803
|
+
"description": "Defines if the internal textarea is allowed to resize vertically. This comes in handy for larger text and when using multiple input rows."
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
"name": "inputRows",
|
|
807
|
+
"type": "Number",
|
|
808
|
+
"default": "1",
|
|
809
|
+
"description": "Defines the number of rows to use by the internal textarea component."
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
"name": "inputClassName",
|
|
813
|
+
"type": "String",
|
|
814
|
+
"default": "",
|
|
815
|
+
"description": "Additional classes to be set on the editor input itself."
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
"name": "editorClassName",
|
|
819
|
+
"type": "String",
|
|
820
|
+
"default": "",
|
|
821
|
+
"description": "Additional classes to be set on the editor wrapper element."
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
"name": "className",
|
|
825
|
+
"type": "String",
|
|
826
|
+
"default": "",
|
|
827
|
+
"description": "Additional classes to be set on the text wrapper element."
|
|
828
|
+
}
|
|
829
|
+
]
|
|
830
|
+
}
|
|
831
|
+
]
|
|
832
|
+
}
|
|
833
|
+
]
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
"caption": "Example 7",
|
|
837
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div><div><label class=\"margin-right-20\">Render NumberInput as custom editor component with input validation</label></div><div class=\"display-flex gap-25\"><span class=\"\"><span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">234</span></span></div></div></div>",
|
|
838
|
+
"tabs": [
|
|
839
|
+
{
|
|
840
|
+
"label": "React",
|
|
841
|
+
"language": "tsx",
|
|
842
|
+
"code": "/* eslint-disable max-len */\nimport { useEffect, useRef, useState } from 'react';\n\nimport EditableContent from '@rio-cloud/rio-uikit/EditableContent';\nimport NumberInput from '@rio-cloud/rio-uikit/NumberInput';\n\nexport default () => {\n const [data, setData] = useState(234);\n const [transientData, setTransientData] = useState(0);\n\n const [isEditMode, setIsEditMode] = useState(false);\n const [isValid, setIsValid] = useState(true);\n\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Focus on the custom input element when entering the edit mode\n useEffect(() => {\n isEditMode && inputRef.current?.focus();\n }, [isEditMode]);\n\n // Handle change of unsaved entered input values as we control the input ourself\n const handleChange = (value: number | undefined) => setTransientData(value || 0);\n\n const handleCancel = () => setIsEditMode(false);\n\n const handleSaveText = () => {\n setData(transientData);\n setIsEditMode(false);\n };\n\n const handleEnterEditMode = () => {\n setTransientData(data);\n setIsEditMode(true);\n };\n\n // Since we use a custom input instead of the built-in textarea, we need to handle keyboard\n // events ourself for instance in order to save on enter.\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n validateInput() ? handleSaveText() : setIsValid(false);\n }\n };\n\n // We have to take care of the input validation here as we use a custom input\n // and render the error message in case.\n const handleValidateOnSave = () => {\n const result = validateInput();\n setIsValid(result);\n return result;\n };\n\n // Simple input validation for demo purpose. Replace it with a more meaningful validation.\n const validateInput = (): boolean => transientData <= 999;\n\n return (\n <div>\n <div>\n <label className='margin-right-20'>\n Render NumberInput as custom editor component with input validation\n </label>\n </div>\n <div className='display-flex gap-25'>\n <EditableContent\n show={isEditMode}\n onSave={handleSaveText}\n onCancel={handleCancel}\n onEditMode={handleEnterEditMode}\n onSaveValidation={handleValidateOnSave}\n isValid={isValid}\n errorMessage='Please insert maximum 3 digit number'\n customEditor={\n <div className='margin-0 min-width-150'>\n <NumberInput\n ref={inputRef}\n value={transientData}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n digitPrecision={0}\n unit='km'\n />\n </div>\n }\n editorOffsetTop={1}\n >\n <span className='border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted'>\n {data}\n </span>\n </EditableContent>\n </div>\n </div>\n );\n};"
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
"label": "HTML",
|
|
846
|
+
"language": "html",
|
|
847
|
+
"code": "<div>\n <div>\n <label class=\"margin-right-20\">Render NumberInput as custom editor component with input validation</label>\n </div>\n <div class=\"display-flex gap-25\">\n <span class=\"\">\n <span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">234</span>\n </span>\n </div>\n</div>"
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
"label": "Props",
|
|
851
|
+
"language": "json",
|
|
852
|
+
"code": null,
|
|
853
|
+
"props": [
|
|
854
|
+
{
|
|
855
|
+
"heading": null,
|
|
856
|
+
"rows": [
|
|
857
|
+
{
|
|
858
|
+
"name": "show",
|
|
859
|
+
"type": "Boolean",
|
|
860
|
+
"default": "",
|
|
861
|
+
"description": "Visibility flag used to control edit mode from outside."
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
"name": "onSave",
|
|
865
|
+
"type": "(value: string) => void",
|
|
866
|
+
"default": "",
|
|
867
|
+
"description": "Callback function triggered when the save button is clicked."
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
"name": "onCancel",
|
|
871
|
+
"type": "VoidFunction",
|
|
872
|
+
"default": "",
|
|
873
|
+
"description": "Callback function triggered when the cancel button is clicked."
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
"name": "onFocus",
|
|
877
|
+
"type": "VoidFunction",
|
|
878
|
+
"default": "",
|
|
879
|
+
"description": "Callback function triggered when the input gets focused."
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
"name": "onBlur",
|
|
883
|
+
"type": "VoidFunction",
|
|
884
|
+
"default": "",
|
|
885
|
+
"description": "Callback function triggered when input looses the focus."
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
"name": "onEditMode",
|
|
889
|
+
"type": "VoidFunction",
|
|
890
|
+
"default": "",
|
|
891
|
+
"description": "Callback function triggered when entering the edit mode."
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
"name": "onSaveValidation",
|
|
895
|
+
"type": "(value: string) => boolean",
|
|
896
|
+
"default": "",
|
|
897
|
+
"description": "Validation function to intercept saving and prevent save on error."
|
|
898
|
+
},
|
|
899
|
+
{
|
|
900
|
+
"name": "isValid",
|
|
901
|
+
"type": "boolean",
|
|
902
|
+
"default": "true",
|
|
903
|
+
"description": "Controls the error message visibility from outside. This is useful when using a custom input where the validation happens outside of this component."
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
"name": "errorMessage",
|
|
907
|
+
"type": "ReactNode",
|
|
908
|
+
"default": "",
|
|
909
|
+
"description": "The error message that shall be shown to the user in case the validation fails."
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
"name": "customEditor",
|
|
913
|
+
"type": "ReactNode",
|
|
914
|
+
"default": "",
|
|
915
|
+
"description": "Use this prop to define a custom editor input component like Select, NumberInput, TimePicker or DatePicker. Handling input state changes of a custom editor need to be handled outside of this component. By default the EditableContent uses a built-in textarea to allow resizing for larger text. the text element has borders, spacings different text sizes."
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
"name": "editorOffsetTop",
|
|
919
|
+
"type": "Number",
|
|
920
|
+
"default": "0",
|
|
921
|
+
"description": "Offset value to control the vertical position for the editor in case the text element has borders, spacings different text sizes."
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
"name": "editorOffsetLeft",
|
|
925
|
+
"type": "Number",
|
|
926
|
+
"default": "0",
|
|
927
|
+
"description": "Offset value to control the horizontal position for the editor in case the text element has borders, spacings different text sizes."
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
"name": "size",
|
|
931
|
+
"type": "String",
|
|
932
|
+
"default": "md",
|
|
933
|
+
"description": "Defines the input and button size. Use \"lg\" for headlines."
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
"name": "allowResize",
|
|
937
|
+
"type": "Boolean",
|
|
938
|
+
"default": "false",
|
|
939
|
+
"description": "Defines if the internal textarea is allowed to resize vertically. This comes in handy for larger text and when using multiple input rows."
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
"name": "inputRows",
|
|
943
|
+
"type": "Number",
|
|
944
|
+
"default": "1",
|
|
945
|
+
"description": "Defines the number of rows to use by the internal textarea component."
|
|
946
|
+
},
|
|
947
|
+
{
|
|
948
|
+
"name": "inputClassName",
|
|
949
|
+
"type": "String",
|
|
950
|
+
"default": "",
|
|
951
|
+
"description": "Additional classes to be set on the editor input itself."
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
"name": "editorClassName",
|
|
955
|
+
"type": "String",
|
|
956
|
+
"default": "",
|
|
957
|
+
"description": "Additional classes to be set on the editor wrapper element."
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
"name": "className",
|
|
961
|
+
"type": "String",
|
|
962
|
+
"default": "",
|
|
963
|
+
"description": "Additional classes to be set on the text wrapper element."
|
|
964
|
+
}
|
|
965
|
+
]
|
|
966
|
+
}
|
|
967
|
+
]
|
|
968
|
+
}
|
|
969
|
+
]
|
|
970
|
+
}
|
|
971
|
+
]
|
|
972
|
+
},
|
|
973
|
+
{
|
|
974
|
+
"heading": "Usage guidelines",
|
|
975
|
+
"body": "",
|
|
976
|
+
"examples": [
|
|
977
|
+
{
|
|
978
|
+
"caption": "Example 8",
|
|
979
|
+
"rendered_html": "<div class=\"playground-content bg-white padding-20 padding-bottom-25\" style=\"width: 100%;\"><div class=\"display-grid grid-cols-2 grid-cols-3-md grid-auto-rows gap-15 margin-bottom-20\"><div><div class=\"text-size-16 text-color-danger\">Don't</div><p>Avoid overuse in lists or tables. Avoid many repetitions of edit icons.</p><ul class=\"list-group rounded border\"><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span>Lorem ipsum dolor</span><span class=\"rioglyph rioglyph-pencil\"></span></div></span></li><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span>Lorem ipsum dolor</span><span class=\"rioglyph rioglyph-pencil\"></span></div></span></li><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span>Lorem ipsum dolor</span><span class=\"rioglyph rioglyph-pencil\"></span></div></span></li><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span>Lorem ipsum dolor</span><span class=\"rioglyph rioglyph-pencil\"></span></div></span></li><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span>Lorem ipsum dolor</span><span class=\"rioglyph rioglyph-pencil\"></span></div></span></li><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span>Lorem ipsum dolor</span><span class=\"rioglyph rioglyph-pencil\"></span></div></span></li><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span>Lorem ipsum dolor</span><span class=\"rioglyph rioglyph-pencil\"></span></div></span></li></ul></div><div><div class=\"text-size-16 text-color-success\">Do</div><p>Use an underline to indicate editable text and use a hover icon on Desktop if possible.</p><ul class=\"list-group rounded border\"><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span></div></span></li><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span></div></span></li><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span></div></span></li><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span></div></span></li><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span></div></span></li><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span></div></span></li><li class=\"list-group-item\"><span class=\"\"><div class=\"display-flex align-items-center gap-5 cursor-pointer\"><span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span></div></span></li></ul></div><div class=\"grid-colspan-2 grid-colspan-1-md\"><div class=\"text-size-16 text-color-success\">Do</div><p>Using the editable field in isolation like inside a panel header or a like, you can permanently show a edit icon.</p><span class=\"\"><h5 class=\"display-flex align-items-center gap-5 text-thin cursor-pointer\"><span>Lorem ipsum dolor</span><span class=\"rioglyph rioglyph-pencil\"></span></h5></span><hr><span class=\"\"><div class=\"display-flex align-items-center gap-5 text-size-h4 text-thin cursor-pointer\"><span>Lorem ipsum dolor</span><span class=\"rioglyph rioglyph-pencil\"></span></div></span><hr></div></div><b><div class=\"display-flex gap-10 max-width-1000 margin-bottom-10 last-child-margin-bottom-0\" data-capture-callout=\"true\"><div><span class=\"label label-info label-condensed label-filled\">Note</span></div><div class=\"width-100pct children-first-margin-top-0 children-last-margin-bottom-0 padding-top-1\">In general, don't make every cell in a table editable. The indication style would be too repetitive and the user does not expect this behavior as it is not implemented in other services like so. Strive for a common look and feel with regards to other services.</div></div></b></div>",
|
|
980
|
+
"tabs": [
|
|
981
|
+
{
|
|
982
|
+
"label": "React",
|
|
983
|
+
"language": "tsx",
|
|
984
|
+
"code": "/* eslint-disable max-len */\nimport { useRef } from 'react';\n\nimport { Note } from '../../../components/Note';\n\nimport EditableContent from '@rio-cloud/rio-uikit/EditableContent';\nimport useHover from '@rio-cloud/rio-uikit/useHover';\n\nconst Demo1 = () => (\n <EditableContent editorOffsetTop={1}>\n <div className='display-flex align-items-center gap-5 cursor-pointer'>\n <span>Lorem ipsum dolor</span>\n <span className='rioglyph rioglyph-pencil' />\n </div>\n </EditableContent>\n);\n\nconst Demo2 = () => {\n const targetRef = useRef<HTMLDivElement>(null);\n const isHover = useHover(targetRef);\n\n return (\n <EditableContent editorOffsetTop={1}>\n <div ref={targetRef} className='display-flex align-items-center gap-5 cursor-pointer'>\n <span className='border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted'>\n Lorem ipsum dolor\n </span>\n {isHover && <span className='rioglyph rioglyph-pencil' />}\n </div>\n </EditableContent>\n );\n};\n\nexport default () => {\n return (\n <>\n <div className='display-grid grid-cols-2 grid-cols-3-md grid-auto-rows gap-15 margin-bottom-20'>\n <div>\n <div className='text-size-16 text-color-danger'>Don't</div>\n <p>Avoid overuse in lists or tables. Avoid many repetitions of edit icons.</p>\n <ul className='list-group rounded border'>\n <li className='list-group-item'>\n <Demo1 />\n </li>\n <li className='list-group-item'>\n <Demo1 />\n </li>\n <li className='list-group-item'>\n <Demo1 />\n </li>\n <li className='list-group-item'>\n <Demo1 />\n </li>\n <li className='list-group-item'>\n <Demo1 />\n </li>\n <li className='list-group-item'>\n <Demo1 />\n </li>\n <li className='list-group-item'>\n <Demo1 />\n </li>\n </ul>\n </div>\n <div>\n <div className='text-size-16 text-color-success'>Do</div>\n <p>Use an underline to indicate editable text and use a hover icon on Desktop if possible.</p>\n <ul className='list-group rounded border'>\n <li className='list-group-item'>\n <Demo2 />\n </li>\n <li className='list-group-item'>\n <Demo2 />\n </li>\n <li className='list-group-item'>\n <Demo2 />\n </li>\n <li className='list-group-item'>\n <Demo2 />\n </li>\n <li className='list-group-item'>\n <Demo2 />\n </li>\n <li className='list-group-item'>\n <Demo2 />\n </li>\n <li className='list-group-item'>\n <Demo2 />\n </li>\n </ul>\n </div>\n <div className='grid-colspan-2 grid-colspan-1-md'>\n <div className='text-size-16 text-color-success'>Do</div>\n <p>\n Using the editable field in isolation like inside a panel header or a like, you can permanently\n show a edit icon.\n </p>\n <EditableContent editorOffsetTop={1}>\n <h5 className='display-flex align-items-center gap-5 text-thin cursor-pointer'>\n <span>Lorem ipsum dolor</span>\n <span className='rioglyph rioglyph-pencil' />\n </h5>\n </EditableContent>\n <hr />\n <EditableContent editorOffsetTop={1}>\n <div className='display-flex align-items-center gap-5 text-size-h4 text-thin cursor-pointer'>\n <span>Lorem ipsum dolor</span>\n <span className='rioglyph rioglyph-pencil' />\n </div>\n </EditableContent>\n <hr />\n </div>\n </div>\n <b>\n <Note>\n In general, don't make every cell in a table editable. The indication style would be too repetitive\n and the user does not expect this behavior as it is not implemented in other services like so.\n Strive for a common look and feel with regards to other services.\n </Note>\n </b>\n </>\n );\n};"
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
"label": "HTML",
|
|
988
|
+
"language": "html",
|
|
989
|
+
"code": "<div class=\"display-grid grid-cols-2 grid-cols-3-md grid-auto-rows gap-15 margin-bottom-20\">\n <div>\n <div class=\"text-size-16 text-color-danger\">Don't</div>\n <p>Avoid overuse in lists or tables. Avoid many repetitions of edit icons.</p>\n <ul class=\"list-group rounded border\">\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span>Lorem ipsum dolor</span>\n <span class=\"rioglyph rioglyph-pencil\">\n </span>\n </div>\n </span>\n </li>\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span>Lorem ipsum dolor</span>\n <span class=\"rioglyph rioglyph-pencil\">\n </span>\n </div>\n </span>\n </li>\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span>Lorem ipsum dolor</span>\n <span class=\"rioglyph rioglyph-pencil\">\n </span>\n </div>\n </span>\n </li>\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span>Lorem ipsum dolor</span>\n <span class=\"rioglyph rioglyph-pencil\">\n </span>\n </div>\n </span>\n </li>\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span>Lorem ipsum dolor</span>\n <span class=\"rioglyph rioglyph-pencil\">\n </span>\n </div>\n </span>\n </li>\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span>Lorem ipsum dolor</span>\n <span class=\"rioglyph rioglyph-pencil\">\n </span>\n </div>\n </span>\n </li>\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span>Lorem ipsum dolor</span>\n <span class=\"rioglyph rioglyph-pencil\">\n </span>\n </div>\n </span>\n </li>\n </ul>\n </div>\n <div>\n <div class=\"text-size-16 text-color-success\">Do</div>\n <p>Use an underline to indicate editable text and use a hover icon on Desktop if possible.</p>\n <ul class=\"list-group rounded border\">\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span>\n </div>\n </span>\n </li>\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span>\n </div>\n </span>\n </li>\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span>\n </div>\n </span>\n </li>\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span>\n </div>\n </span>\n </li>\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span>\n </div>\n </span>\n </li>\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span>\n </div>\n </span>\n </li>\n <li class=\"list-group-item\">\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 cursor-pointer\">\n <span class=\"border border-bottom-only border-color-gray hover-border-color-darkest border-style-dotted\">Lorem ipsum dolor</span>\n </div>\n </span>\n </li>\n </ul>\n </div>\n <div class=\"grid-colspan-2 grid-colspan-1-md\">\n <div class=\"text-size-16 text-color-success\">Do</div>\n <p>Using the editable field in isolation like inside a panel header or a like, you can permanently show a edit icon.</p>\n <span class=\"\">\n <h5 class=\"display-flex align-items-center gap-5 text-thin cursor-pointer\">\n <span>Lorem ipsum dolor</span>\n <span class=\"rioglyph rioglyph-pencil\">\n </span>\n </h5>\n </span>\n <hr>\n <span class=\"\">\n <div class=\"display-flex align-items-center gap-5 text-size-h4 text-thin cursor-pointer\">\n <span>Lorem ipsum dolor</span>\n <span class=\"rioglyph rioglyph-pencil\">\n </span>\n </div>\n </span>\n <hr>\n </div>\n</div>\n<b>\n <div class=\"display-flex gap-10 max-width-1000 margin-bottom-10 last-child-margin-bottom-0\" data-capture-callout=\"true\">\n <div>\n <span class=\"label label-info label-condensed label-filled\">Note</span>\n </div>\n <div class=\"width-100pct children-first-margin-top-0 children-last-margin-bottom-0 padding-top-1\">In general, don't make every cell in a table editable. The indication style would be too repetitive and the user does not expect this behavior as it is not implemented in other services like so. Strive for a common look and feel with regards to other services.</div>\n </div>\n</b>"
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
"label": "Props",
|
|
993
|
+
"language": "json",
|
|
994
|
+
"code": null,
|
|
995
|
+
"props": [
|
|
996
|
+
{
|
|
997
|
+
"heading": null,
|
|
998
|
+
"rows": [
|
|
999
|
+
{
|
|
1000
|
+
"name": "show",
|
|
1001
|
+
"type": "Boolean",
|
|
1002
|
+
"default": "",
|
|
1003
|
+
"description": "Visibility flag used to control edit mode from outside."
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
"name": "onSave",
|
|
1007
|
+
"type": "(value: string) => void",
|
|
1008
|
+
"default": "",
|
|
1009
|
+
"description": "Callback function triggered when the save button is clicked."
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
"name": "onCancel",
|
|
1013
|
+
"type": "VoidFunction",
|
|
1014
|
+
"default": "",
|
|
1015
|
+
"description": "Callback function triggered when the cancel button is clicked."
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
"name": "onFocus",
|
|
1019
|
+
"type": "VoidFunction",
|
|
1020
|
+
"default": "",
|
|
1021
|
+
"description": "Callback function triggered when the input gets focused."
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
"name": "onBlur",
|
|
1025
|
+
"type": "VoidFunction",
|
|
1026
|
+
"default": "",
|
|
1027
|
+
"description": "Callback function triggered when input looses the focus."
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
"name": "onEditMode",
|
|
1031
|
+
"type": "VoidFunction",
|
|
1032
|
+
"default": "",
|
|
1033
|
+
"description": "Callback function triggered when entering the edit mode."
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
"name": "onSaveValidation",
|
|
1037
|
+
"type": "(value: string) => boolean",
|
|
1038
|
+
"default": "",
|
|
1039
|
+
"description": "Validation function to intercept saving and prevent save on error."
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
"name": "isValid",
|
|
1043
|
+
"type": "boolean",
|
|
1044
|
+
"default": "true",
|
|
1045
|
+
"description": "Controls the error message visibility from outside. This is useful when using a custom input where the validation happens outside of this component."
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
"name": "errorMessage",
|
|
1049
|
+
"type": "ReactNode",
|
|
1050
|
+
"default": "",
|
|
1051
|
+
"description": "The error message that shall be shown to the user in case the validation fails."
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
"name": "customEditor",
|
|
1055
|
+
"type": "ReactNode",
|
|
1056
|
+
"default": "",
|
|
1057
|
+
"description": "Use this prop to define a custom editor input component like Select, NumberInput, TimePicker or DatePicker. Handling input state changes of a custom editor need to be handled outside of this component. By default the EditableContent uses a built-in textarea to allow resizing for larger text. the text element has borders, spacings different text sizes."
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
"name": "editorOffsetTop",
|
|
1061
|
+
"type": "Number",
|
|
1062
|
+
"default": "0",
|
|
1063
|
+
"description": "Offset value to control the vertical position for the editor in case the text element has borders, spacings different text sizes."
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
"name": "editorOffsetLeft",
|
|
1067
|
+
"type": "Number",
|
|
1068
|
+
"default": "0",
|
|
1069
|
+
"description": "Offset value to control the horizontal position for the editor in case the text element has borders, spacings different text sizes."
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
"name": "size",
|
|
1073
|
+
"type": "String",
|
|
1074
|
+
"default": "md",
|
|
1075
|
+
"description": "Defines the input and button size. Use \"lg\" for headlines."
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
"name": "allowResize",
|
|
1079
|
+
"type": "Boolean",
|
|
1080
|
+
"default": "false",
|
|
1081
|
+
"description": "Defines if the internal textarea is allowed to resize vertically. This comes in handy for larger text and when using multiple input rows."
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
"name": "inputRows",
|
|
1085
|
+
"type": "Number",
|
|
1086
|
+
"default": "1",
|
|
1087
|
+
"description": "Defines the number of rows to use by the internal textarea component."
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
"name": "inputClassName",
|
|
1091
|
+
"type": "String",
|
|
1092
|
+
"default": "",
|
|
1093
|
+
"description": "Additional classes to be set on the editor input itself."
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
"name": "editorClassName",
|
|
1097
|
+
"type": "String",
|
|
1098
|
+
"default": "",
|
|
1099
|
+
"description": "Additional classes to be set on the editor wrapper element."
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
"name": "className",
|
|
1103
|
+
"type": "String",
|
|
1104
|
+
"default": "",
|
|
1105
|
+
"description": "Additional classes to be set on the text wrapper element."
|
|
1106
|
+
}
|
|
1107
|
+
]
|
|
1108
|
+
}
|
|
1109
|
+
]
|
|
1110
|
+
}
|
|
1111
|
+
]
|
|
1112
|
+
}
|
|
1113
|
+
]
|
|
1114
|
+
}
|
|
1115
|
+
],
|
|
1116
|
+
"see_also": []
|
|
1117
|
+
}
|