@bigbinary/neeto-molecules 1.2.5 → 1.3.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/README.md +1 -0
- package/dist/SuffixedInput.js +151 -0
- package/dist/SuffixedInput.js.map +1 -0
- package/package.json +1 -1
- package/types/SuffixedInput.d.ts +46 -0
package/README.md
CHANGED
|
@@ -63,6 +63,7 @@ https://neeto-molecules.neeto.com/
|
|
|
63
63
|
- [Metadata](./docs/components.md#metadata)
|
|
64
64
|
- [DocumentEditor](./docs/components.md#DocumentEditor)
|
|
65
65
|
- [Taxonomy](./docs/components.md#Taxonomy)
|
|
66
|
+
- [SuffixedInput](./docs/components.md#SuffixedInput
|
|
66
67
|
|
|
67
68
|
## Installation Instructions
|
|
68
69
|
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import { isPresent, isNotPresent } from '@bigbinary/neeto-cist';
|
|
3
|
+
import { Info } from '@bigbinary/neeto-icons';
|
|
4
|
+
import CopyToClipboardButton from '@bigbinary/neeto-molecules/CopyToClipboardButton';
|
|
5
|
+
import { Input } from '@bigbinary/neetoui/formik';
|
|
6
|
+
import { isEmpty } from 'ramda';
|
|
7
|
+
|
|
8
|
+
function _arrayWithHoles(arr) {
|
|
9
|
+
if (Array.isArray(arr)) return arr;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function _iterableToArrayLimit(r, l) {
|
|
13
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
14
|
+
if (null != t) {
|
|
15
|
+
var e,
|
|
16
|
+
n,
|
|
17
|
+
i,
|
|
18
|
+
u,
|
|
19
|
+
a = [],
|
|
20
|
+
f = !0,
|
|
21
|
+
o = !1;
|
|
22
|
+
try {
|
|
23
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
24
|
+
if (Object(t) !== t) return;
|
|
25
|
+
f = !1;
|
|
26
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
27
|
+
} catch (r) {
|
|
28
|
+
o = !0, n = r;
|
|
29
|
+
} finally {
|
|
30
|
+
try {
|
|
31
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
32
|
+
} finally {
|
|
33
|
+
if (o) throw n;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return a;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function _arrayLikeToArray(arr, len) {
|
|
41
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
42
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
43
|
+
return arr2;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
47
|
+
if (!o) return;
|
|
48
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
49
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
50
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
51
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
52
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function _nonIterableRest() {
|
|
56
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function _slicedToArray(arr, i) {
|
|
60
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
var INPUT_FIELD_MIN_WIDTH = 60;
|
|
64
|
+
|
|
65
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
66
|
+
|
|
67
|
+
var css = ".nm-suffixed-input-field{max-width:100%;min-width:0;width:-moz-max-content;width:max-content}.nm-suffixed-input-field .neeto-ui-input{align-items:stretch}.nm-suffixed-input-field .neeto-ui-input .neeto-ui-input__suffix{background-color:rgb(var(--neeto-ui-gray-200));cursor:not-allowed;margin:0 0 0 4px!important;padding:5px 8px;white-space:nowrap}.nm-suffixed-input-field input{padding-right:0!important}";
|
|
68
|
+
n(css,{});
|
|
69
|
+
|
|
70
|
+
var SuffixedInput = function SuffixedInput(_ref) {
|
|
71
|
+
var _placeholderRef$curre2, _placeholderRef$curre3;
|
|
72
|
+
var placeholder = _ref.placeholder,
|
|
73
|
+
helpUrl = _ref.helpUrl,
|
|
74
|
+
helpIconTooltipContent = _ref.helpIconTooltipContent,
|
|
75
|
+
label = _ref.label,
|
|
76
|
+
value = _ref.value,
|
|
77
|
+
getInputRef = _ref.getInputRef,
|
|
78
|
+
suffix = _ref.suffix,
|
|
79
|
+
_ref$isCopyToClipboar = _ref.isCopyToClipboardEnabled,
|
|
80
|
+
isCopyToClipboardEnabled = _ref$isCopyToClipboar === void 0 ? false : _ref$isCopyToClipboar,
|
|
81
|
+
_ref$name = _ref.name,
|
|
82
|
+
name = _ref$name === void 0 ? "email" : _ref$name,
|
|
83
|
+
_ref$dataCy = _ref.dataCy,
|
|
84
|
+
dataCy = _ref$dataCy === void 0 ? "" : _ref$dataCy;
|
|
85
|
+
var _useState = useState(INPUT_FIELD_MIN_WIDTH),
|
|
86
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
87
|
+
initialInputWidth = _useState2[0],
|
|
88
|
+
setInitialInputWidth = _useState2[1];
|
|
89
|
+
var inputRef = useRef(null);
|
|
90
|
+
var placeholderRef = useRef(null);
|
|
91
|
+
var setInputRef = function setInputRef(ref) {
|
|
92
|
+
inputRef.current = ref;
|
|
93
|
+
getInputRef === null || getInputRef === void 0 ? void 0 : getInputRef(ref);
|
|
94
|
+
};
|
|
95
|
+
useEffect(function () {
|
|
96
|
+
var _placeholderRef$curre;
|
|
97
|
+
//To handle the input width on initial render.
|
|
98
|
+
var placeholderSpanWidth = (_placeholderRef$curre = placeholderRef.current) === null || _placeholderRef$curre === void 0 ? void 0 : _placeholderRef$curre.offsetWidth;
|
|
99
|
+
setInitialInputWidth(placeholderSpanWidth);
|
|
100
|
+
}, []);
|
|
101
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
102
|
+
// Dummy element to calculate the width to be set for the input. Do not remove.
|
|
103
|
+
className: "pointer-events-none invisible absolute pl-2",
|
|
104
|
+
ref: placeholderRef
|
|
105
|
+
}, value || placeholder), /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: "inline-flex max-w-full items-end gap-2"
|
|
107
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
108
|
+
label: label,
|
|
109
|
+
name: name,
|
|
110
|
+
placeholder: placeholder,
|
|
111
|
+
className: "nm-suffixed-input-field",
|
|
112
|
+
"data-cy": dataCy,
|
|
113
|
+
ref: setInputRef,
|
|
114
|
+
type: "text",
|
|
115
|
+
labelProps: {
|
|
116
|
+
helpIconProps: isPresent(helpUrl) && {
|
|
117
|
+
icon: Info,
|
|
118
|
+
className: "cursor-pointer opacity-75 hover:opacity-100 transition-opacity duration-300 ease-in-out",
|
|
119
|
+
onClick: function onClick() {
|
|
120
|
+
return window.open(helpUrl, "_blank");
|
|
121
|
+
},
|
|
122
|
+
tooltipProps: {
|
|
123
|
+
content: helpIconTooltipContent,
|
|
124
|
+
position: "right",
|
|
125
|
+
disabled: isNotPresent(helpUrl)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
style: {
|
|
130
|
+
minWidth: isEmpty(value) ? INPUT_FIELD_MIN_WIDTH : 0,
|
|
131
|
+
width: (_placeholderRef$curre2 = (_placeholderRef$curre3 = placeholderRef.current) === null || _placeholderRef$curre3 === void 0 ? void 0 : _placeholderRef$curre3.offsetWidth) !== null && _placeholderRef$curre2 !== void 0 ? _placeholderRef$curre2 : initialInputWidth // Additional 2px to act as a buffer.
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
suffix:
|
|
135
|
+
/*#__PURE__*/
|
|
136
|
+
// Added onClick to focus the input even when the suffix part is clicked.
|
|
137
|
+
React.createElement("span", {
|
|
138
|
+
onClick: function onClick() {
|
|
139
|
+
var _inputRef$current;
|
|
140
|
+
return (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
141
|
+
}
|
|
142
|
+
}, suffix)
|
|
143
|
+
}), isCopyToClipboardEnabled && /*#__PURE__*/React.createElement(CopyToClipboardButton, {
|
|
144
|
+
disabled: isEmpty(value),
|
|
145
|
+
style: "text",
|
|
146
|
+
value: "".concat(value).concat(suffix)
|
|
147
|
+
})));
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export { SuffixedInput as default };
|
|
151
|
+
//# sourceMappingURL=SuffixedInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SuffixedInput.js","sources":["../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","../node_modules/@babel/runtime/helpers/esm/slicedToArray.js","../src/components/SuffixedInput/constants.js","../node_modules/rollup-plugin-styles/dist/runtime/inject-css.js","../src/components/SuffixedInput/index.jsx"],"sourcesContent":["export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(r, l) {\n var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (null != t) {\n var e,\n n,\n i,\n u,\n a = [],\n f = !0,\n o = !1;\n try {\n if (i = (t = t.call(r)).next, 0 === l) {\n if (Object(t) !== t) return;\n f = !1;\n } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);\n } catch (r) {\n o = !0, n = r;\n } finally {\n try {\n if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return;\n } finally {\n if (o) throw n;\n }\n }\n return a;\n }\n}","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithHoles from \"./arrayWithHoles.js\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableRest from \"./nonIterableRest.js\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","export const INPUT_FIELD_MIN_WIDTH = 60;\n","var e=[],t=[];function n(n,r){if(n&&\"undefined\"!=typeof document){var a,s=!0===r.prepend?\"prepend\":\"append\",d=!0===r.singleTag,i=\"string\"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName(\"head\")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c()}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n))}function c(){var e=document.createElement(\"style\");if(e.setAttribute(\"type\",\"text/css\"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a=\"prepend\"===s?\"afterbegin\":\"beforeend\";return i.insertAdjacentElement(a,e),e}}export{n as default};\n","import React, { useEffect, useRef, useState } from \"react\";\n\nimport { isPresent, isNotPresent } from \"neetocist\";\nimport { Info } from \"neetoicons\";\nimport CopyToClipboardButton from \"neetomolecules/CopyToClipboardButton\";\nimport { Input } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { isEmpty } from \"ramda\";\n\nimport { INPUT_FIELD_MIN_WIDTH } from \"./constants\";\nimport \"./suffixed-input.scss\";\n\nconst SuffixedInput = ({\n placeholder,\n helpUrl,\n helpIconTooltipContent,\n label,\n value,\n getInputRef,\n suffix,\n isCopyToClipboardEnabled = false,\n name = \"email\",\n dataCy = \"\",\n}) => {\n const [initialInputWidth, setInitialInputWidth] = useState(\n INPUT_FIELD_MIN_WIDTH\n );\n const inputRef = useRef(null);\n const placeholderRef = useRef(null);\n\n const setInputRef = ref => {\n inputRef.current = ref;\n getInputRef?.(ref);\n };\n\n useEffect(() => {\n //To handle the input width on initial render.\n const placeholderSpanWidth = placeholderRef.current?.offsetWidth;\n setInitialInputWidth(placeholderSpanWidth);\n }, []);\n\n return (\n <>\n <span // Dummy element to calculate the width to be set for the input. Do not remove.\n className=\"pointer-events-none invisible absolute pl-2\"\n ref={placeholderRef}\n >\n {value || placeholder}\n </span>\n <div className=\"inline-flex max-w-full items-end gap-2\">\n <Input\n {...{ label, name, placeholder }}\n className=\"nm-suffixed-input-field\"\n data-cy={dataCy}\n ref={setInputRef}\n type=\"text\"\n labelProps={{\n helpIconProps: isPresent(helpUrl) && {\n icon: Info,\n className:\n \"cursor-pointer opacity-75 hover:opacity-100 transition-opacity duration-300 ease-in-out\",\n onClick: () => window.open(helpUrl, \"_blank\"),\n tooltipProps: {\n content: helpIconTooltipContent,\n position: \"right\",\n disabled: isNotPresent(helpUrl),\n },\n },\n }}\n style={{\n minWidth: isEmpty(value) ? INPUT_FIELD_MIN_WIDTH : 0,\n width: placeholderRef.current?.offsetWidth ?? initialInputWidth, // Additional 2px to act as a buffer.\n }}\n suffix={\n // Added onClick to focus the input even when the suffix part is clicked.\n <span onClick={() => inputRef.current?.focus()}>{suffix}</span>\n }\n />\n {isCopyToClipboardEnabled && (\n <CopyToClipboardButton\n disabled={isEmpty(value)}\n style=\"text\"\n value={`${value}${suffix}`}\n />\n )}\n </div>\n </>\n );\n};\n\nSuffixedInput.propTypes = {\n /**\n * Placeholder of the input field.\n */\n placeholder: PropTypes.string,\n /**\n * A help icon will be displayed next to the label if helpUrl is present. On clicking the icon will take the user to the URL.\n */\n helpUrl: PropTypes.string,\n /**\n * Text to be displayed inside the tooltip of the help icon.\n */\n helpIconTooltipContent: PropTypes.string,\n /**\n * Label of the input field.\n */\n label: PropTypes.string,\n /**\n * The value entered by the user, eg: email.\n */\n value: PropTypes.string,\n /**\n * A method to get the ref of the input field.\n */\n getInputRef: PropTypes.func,\n /**\n * Domain name to be rendered next to the input field.\n */\n suffix: PropTypes.string,\n /**\n * Whether to show the copy to clipboard button.\n */\n isCopyToClipboardEnabled: PropTypes.bool,\n /**\n * Formik field name of the input field.\n */\n name: PropTypes.string,\n /**\n * Value will be set as `data-cy` of input field.\n */\n dataCy: PropTypes.string,\n};\n\nexport default SuffixedInput;\n"],"names":["arrayLikeToArray","arrayWithHoles","iterableToArrayLimit","unsupportedIterableToArray","nonIterableRest","INPUT_FIELD_MIN_WIDTH","SuffixedInput","_ref","_placeholderRef$curre2","_placeholderRef$curre3","placeholder","helpUrl","helpIconTooltipContent","label","value","getInputRef","suffix","_ref$isCopyToClipboar","isCopyToClipboardEnabled","_ref$name","name","_ref$dataCy","dataCy","_useState","useState","_useState2","_slicedToArray","initialInputWidth","setInitialInputWidth","inputRef","useRef","placeholderRef","setInputRef","ref","current","useEffect","_placeholderRef$curre","placeholderSpanWidth","offsetWidth","React","createElement","Fragment","className","Input","type","labelProps","helpIconProps","isPresent","icon","Info","onClick","window","open","tooltipProps","content","position","disabled","isNotPresent","style","minWidth","isEmpty","width","_inputRef$current","focus","CopyToClipboardButton","concat"],"mappings":";;;;;;;AAAe,SAAS,eAAe,CAAC,GAAG,EAAE;AAC7C,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,CAAC;AACrC;;ACFe,SAAS,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE;AACpD,EAAE,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,IAAI,GAAG,WAAW,IAAI,OAAO,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC;AACnG,EAAE,IAAI,IAAI,IAAI,CAAC,EAAE;AACjB,IAAI,IAAI,CAAC;AACT,MAAM,CAAC;AACP,MAAM,CAAC;AACP,MAAM,CAAC;AACP,MAAM,CAAC,GAAG,EAAE;AACZ,MAAM,CAAC,GAAG,CA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,MAAA,EAAA;MAAMU,OAAO,EAAE,SAAAA,OAAA,GAAA;AAAA,QAAA,IAAAY,iBAAA,CAAA;AAAA,QAAA,OAAA,CAAAA,iBAAA,GAAMjC,QAAQ,CAACK,OAAO,MAAA,IAAA,IAAA4B,iBAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAhBA,iBAAA,CAAkBC,KAAK,EAAE,CAAA;AAAA,OAAA;AAAC,KAAA,EAAE/C,MAAa,CAAA;GAEjE,CAAC,EACDE,wBAAwB,iBACvBqB,KAAA,CAAAC,aAAA,CAACwB,qBAAqB,EAAA;AACpBR,IAAAA,QAAQ,EAAEI,OAAO,CAAC9C,KAAK,CAAE;AACzB4C,IAAAA,KAAK,EAAC,MAAM;AACZ5C,IAAAA,KAAK,KAAAmD,MAAA,CAAKnD,KAAK,CAAAmD,CAAAA,MAAA,CAAGjD,MAAM,CAAA;GACzB,CAEA,CACL,CAAC,CAAA;AAEP;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-molecules",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "A package of reusable molecular components for neeto products.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-molecules.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* This component can be used to display an input where the value is customizable by the user,
|
|
5
|
+
*
|
|
6
|
+
* but not the suffix. eg: Emails, blog urls etc.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* import SuffixedInput from "@bigbinary/neeto-molecules/SuffixedInput";
|
|
11
|
+
*
|
|
12
|
+
* const MailboxConfiguration = () => {
|
|
13
|
+
* return (<Form
|
|
14
|
+
* formikProps={{
|
|
15
|
+
* initialValues: { email: "" },
|
|
16
|
+
* onSubmit: noop,
|
|
17
|
+
* onreset: noop,
|
|
18
|
+
* }}
|
|
19
|
+
* >
|
|
20
|
+
* {({ values: { email } }) => (
|
|
21
|
+
* <div className="w-full p-6">
|
|
22
|
+
* <SuffixedInput
|
|
23
|
+
* {...{ ...args }}
|
|
24
|
+
* value={email}
|
|
25
|
+
* name="email"
|
|
26
|
+
* />
|
|
27
|
+
* </div>
|
|
28
|
+
* )}
|
|
29
|
+
* </Form>
|
|
30
|
+
* );
|
|
31
|
+
* };
|
|
32
|
+
* @endexample
|
|
33
|
+
*/
|
|
34
|
+
const SuffixedInput: React.FC<{
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
helpUrl?: string;
|
|
37
|
+
helpIconTooltipContent?: string;
|
|
38
|
+
label: string;
|
|
39
|
+
value: string;
|
|
40
|
+
getInputRef?: (ref: HTMLInputElement | null) => void;
|
|
41
|
+
suffix: string;
|
|
42
|
+
isCopyToClipboardEnabled?: boolean;
|
|
43
|
+
name?: string;
|
|
44
|
+
dataCy?: string;
|
|
45
|
+
}>;
|
|
46
|
+
export default SuffixedInput;
|