@activecollab/components 1.0.185 → 1.0.187
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/dist/cjs/components/EditableContent/EditableContent.js +10 -24
- package/dist/cjs/components/EditableContent/EditableContent.js.map +1 -1
- package/dist/cjs/components/EditableText/EditableText.js +103 -0
- package/dist/cjs/components/EditableText/EditableText.js.map +1 -0
- package/dist/cjs/components/EditableText/index.js +19 -0
- package/dist/cjs/components/EditableText/index.js.map +1 -0
- package/dist/cjs/components/index.js +13 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/esm/components/EditableContent/EditableContent.d.ts.map +1 -1
- package/dist/esm/components/EditableContent/EditableContent.js +11 -12
- package/dist/esm/components/EditableContent/EditableContent.js.map +1 -1
- package/dist/esm/components/EditableText/EditableText.d.ts +9 -0
- package/dist/esm/components/EditableText/EditableText.d.ts.map +1 -0
- package/dist/esm/components/EditableText/EditableText.js +62 -0
- package/dist/esm/components/EditableText/EditableText.js.map +1 -0
- package/dist/esm/components/EditableText/index.d.ts +2 -0
- package/dist/esm/components/EditableText/index.d.ts.map +1 -0
- package/dist/esm/components/EditableText/index.js +2 -0
- package/dist/esm/components/EditableText/index.js.map +1 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/index.js +209 -150
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -19,18 +19,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
19
19
|
|
|
20
20
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
21
|
|
|
22
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
|
-
|
|
24
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
-
|
|
26
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
27
|
-
|
|
28
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
29
|
-
|
|
30
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
31
|
-
|
|
32
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
33
|
-
|
|
34
22
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
35
23
|
|
|
36
24
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -43,16 +31,13 @@ var EditableContent = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
43
31
|
inputProps = _ref.inputProps,
|
|
44
32
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
45
33
|
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
-
innerValue = _useState2[0],
|
|
51
|
-
setInnerValue = _useState2[1];
|
|
34
|
+
var intInputRef = (0, _react.useRef)(null);
|
|
35
|
+
var handleBlur = (0, _react.useCallback)(function (evt) {
|
|
36
|
+
var _intInputRef$current;
|
|
52
37
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}, []);
|
|
38
|
+
intInputRef === null || intInputRef === void 0 ? void 0 : (_intInputRef$current = intInputRef.current) === null || _intInputRef$current === void 0 ? void 0 : _intInputRef$current.setSelectionRange(0, 0);
|
|
39
|
+
typeof (inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur) === "function" && (inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur(evt));
|
|
40
|
+
}, [inputProps]);
|
|
56
41
|
return /*#__PURE__*/_react.default.createElement(_Styles.StyledDiv, _extends({
|
|
57
42
|
className: className,
|
|
58
43
|
ref: ref
|
|
@@ -60,12 +45,13 @@ var EditableContent = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
60
45
|
variant: variant,
|
|
61
46
|
forwardedAs: "span",
|
|
62
47
|
weight: weight
|
|
63
|
-
},
|
|
48
|
+
}, inputProps === null || inputProps === void 0 ? void 0 : inputProps.value), /*#__PURE__*/_react.default.createElement(_Styles.StyledInput, _extends({}, inputProps, {
|
|
49
|
+
ref: intInputRef,
|
|
64
50
|
forwardedAs: "input",
|
|
65
51
|
variant: variant,
|
|
66
52
|
weight: weight,
|
|
67
|
-
|
|
68
|
-
|
|
53
|
+
value: inputProps === null || inputProps === void 0 ? void 0 : inputProps.value,
|
|
54
|
+
onBlur: handleBlur
|
|
69
55
|
})));
|
|
70
56
|
});
|
|
71
57
|
exports.EditableContent = EditableContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/EditableContent/EditableContent.tsx"],"names":["EditableContent","ref","className","variant","weight","inputProps","props","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/EditableContent/EditableContent.tsx"],"names":["EditableContent","ref","className","variant","weight","inputProps","props","intInputRef","handleBlur","evt","current","setSelectionRange","onBlur","value","displayName"],"mappings":";;;;;;;;;AAAA;;AAEA;;;;;;;;;;;;;;AAWO,IAAMA,eAAe,gBAAG,uBAI7B,gBAAkEC,GAAlE,EAA0E;AAAA,MAAvEC,SAAuE,QAAvEA,SAAuE;AAAA,0BAA5DC,OAA4D;AAAA,MAA5DA,OAA4D,6BAAlD,QAAkD;AAAA,MAAxCC,MAAwC,QAAxCA,MAAwC;AAAA,MAAhCC,UAAgC,QAAhCA,UAAgC;AAAA,MAAjBC,KAAiB;;AAC1E,MAAMC,WAAW,GAAG,mBAAyB,IAAzB,CAApB;AAEA,MAAMC,UAAU,GAAG,wBACjB,UAACC,GAAD,EAAS;AAAA;;AACPF,IAAAA,WAAW,SAAX,IAAAA,WAAW,WAAX,oCAAAA,WAAW,CAAEG,OAAb,8EAAsBC,iBAAtB,CAAwC,CAAxC,EAA2C,CAA3C;AACA,YAAON,UAAP,aAAOA,UAAP,uBAAOA,UAAU,CAAEO,MAAnB,qBAA4CP,UAA5C,aAA4CA,UAA5C,uBAA4CA,UAAU,CAAEO,MAAZ,CAAmBH,GAAnB,CAA5C;AACD,GAJgB,EAKjB,CAACJ,UAAD,CALiB,CAAnB;AAQA,sBACE,6BAAC,iBAAD;AAAW,IAAA,SAAS,EAAEH,SAAtB;AAAiC,IAAA,GAAG,EAAED;AAAtC,KAA+CK,KAA/C,gBACE,6BAAC,kBAAD;AAAY,IAAA,OAAO,EAAEH,OAArB;AAA8B,IAAA,WAAW,EAAC,MAA1C;AAAiD,IAAA,MAAM,EAAEC;AAAzD,KACGC,UADH,aACGA,UADH,uBACGA,UAAU,CAAEQ,KADf,CADF,eAIE,6BAAC,mBAAD,eACMR,UADN;AAEE,IAAA,GAAG,EAAEE,WAFP;AAGE,IAAA,WAAW,EAAC,OAHd;AAIE,IAAA,OAAO,EAAEJ,OAJX;AAKE,IAAA,MAAM,EAAEC,MALV;AAME,IAAA,KAAK,EAAEC,UAAF,aAAEA,UAAF,uBAAEA,UAAU,CAAEQ,KANrB;AAOE,IAAA,MAAM,EAAEL;AAPV,KAJF,CADF;AAgBD,CA/B8B,CAAxB;;AAiCPR,eAAe,CAACc,WAAhB,GAA8B,iBAA9B","sourcesContent":["import React, { forwardRef, useRef, useCallback } from \"react\";\nimport { Variant } from \"../Typography/Typography\";\nimport { StyledDiv, StyledInput, StyledSpan } from \"./Styles\";\n\nexport interface EditableContentInterface {\n /** Typography variant. */\n variant?: Variant;\n /** Typography weight. */\n weight?: \"light\" | \"regular\" | \"bold\" | \"medium\";\n /** Input props. */\n inputProps?: Partial<React.ComponentPropsWithoutRef<\"input\">>;\n}\n\nexport const EditableContent = forwardRef<\n HTMLDivElement,\n EditableContentInterface &\n Omit<React.ComponentPropsWithoutRef<\"div\">, keyof EditableContentInterface>\n>(({ className, variant = \"Body 2\", weight, inputProps, ...props }, ref) => {\n const intInputRef = useRef<HTMLInputElement>(null);\n\n const handleBlur = useCallback(\n (evt) => {\n intInputRef?.current?.setSelectionRange(0, 0);\n typeof inputProps?.onBlur === `function` && inputProps?.onBlur(evt);\n },\n [inputProps]\n );\n\n return (\n <StyledDiv className={className} ref={ref} {...props}>\n <StyledSpan variant={variant} forwardedAs=\"span\" weight={weight}>\n {inputProps?.value}\n </StyledSpan>\n <StyledInput\n {...inputProps}\n ref={intInputRef}\n forwardedAs=\"input\"\n variant={variant}\n weight={weight}\n value={inputProps?.value}\n onBlur={handleBlur}\n />\n </StyledDiv>\n );\n});\n\nEditableContent.displayName = \"EditableContent\";\n"],"file":"EditableContent.js"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.EditableText = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _ = require("..");
|
|
13
|
+
|
|
14
|
+
var _excluded = ["onSave", "onCancel", "value", "inputProps"];
|
|
15
|
+
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
+
|
|
22
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
+
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
25
|
+
|
|
26
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
+
|
|
28
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
+
|
|
30
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
31
|
+
|
|
32
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
33
|
+
|
|
34
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
35
|
+
|
|
36
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
37
|
+
|
|
38
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
|
+
|
|
40
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
41
|
+
|
|
42
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
43
|
+
|
|
44
|
+
var EditableText = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
45
|
+
var onSave = _ref.onSave,
|
|
46
|
+
onCancel = _ref.onCancel,
|
|
47
|
+
value = _ref.value,
|
|
48
|
+
inputProps = _ref.inputProps,
|
|
49
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
50
|
+
|
|
51
|
+
var _useState = (0, _react.useState)(value),
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
currentValue = _useState2[0],
|
|
54
|
+
setCurrentValue = _useState2[1];
|
|
55
|
+
|
|
56
|
+
var _useState3 = (0, _react.useState)(value),
|
|
57
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
58
|
+
prevValue = _useState4[0],
|
|
59
|
+
setPrevValue = _useState4[1];
|
|
60
|
+
|
|
61
|
+
var escapeRef = (0, _react.useRef)(false);
|
|
62
|
+
var handleBlur = (0, _react.useCallback)(function (e) {
|
|
63
|
+
if (escapeRef.current) {
|
|
64
|
+
setCurrentValue(prevValue);
|
|
65
|
+
escapeRef.current = false;
|
|
66
|
+
} else {
|
|
67
|
+
if (e.target.value.trim().length > 0 && prevValue !== e.target.value) {
|
|
68
|
+
setPrevValue(e.target.value);
|
|
69
|
+
setCurrentValue(e.target.value);
|
|
70
|
+
typeof onSave === "function" && onSave();
|
|
71
|
+
} else {
|
|
72
|
+
setCurrentValue(prevValue);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, [onSave, prevValue]);
|
|
76
|
+
var handleKeyDown = (0, _react.useCallback)(function (e) {
|
|
77
|
+
if (e.key === "Enter") {
|
|
78
|
+
e.target.blur();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (e.key === "Escape") {
|
|
82
|
+
escapeRef.current = true;
|
|
83
|
+
e.target.blur();
|
|
84
|
+
typeof onCancel === "function" && onCancel();
|
|
85
|
+
}
|
|
86
|
+
}, [onCancel]);
|
|
87
|
+
var handleChange = (0, _react.useCallback)(function (e) {
|
|
88
|
+
setCurrentValue(e.target.value);
|
|
89
|
+
}, []);
|
|
90
|
+
return /*#__PURE__*/_react.default.createElement(_.EditableContent, _extends({}, props, {
|
|
91
|
+
ref: ref,
|
|
92
|
+
inputProps: _objectSpread(_objectSpread({}, inputProps), {}, {
|
|
93
|
+
value: currentValue,
|
|
94
|
+
onBlur: handleBlur,
|
|
95
|
+
onKeyDown: handleKeyDown,
|
|
96
|
+
onChange: handleChange,
|
|
97
|
+
type: "text"
|
|
98
|
+
})
|
|
99
|
+
}));
|
|
100
|
+
});
|
|
101
|
+
exports.EditableText = EditableText;
|
|
102
|
+
EditableText.displayName = "EditableText";
|
|
103
|
+
//# sourceMappingURL=EditableText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/EditableText/EditableText.tsx"],"names":["EditableText","ref","onSave","onCancel","value","inputProps","props","currentValue","setCurrentValue","prevValue","setPrevValue","escapeRef","handleBlur","e","current","target","trim","length","handleKeyDown","key","blur","handleChange","onBlur","onKeyDown","onChange","type","displayName"],"mappings":";;;;;;;;;AAAA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,IAAMA,YAAY,gBAAG,uBAC1B,gBAAoDC,GAApD,EAA4D;AAAA,MAAzDC,MAAyD,QAAzDA,MAAyD;AAAA,MAAjDC,QAAiD,QAAjDA,QAAiD;AAAA,MAAvCC,KAAuC,QAAvCA,KAAuC;AAAA,MAAhCC,UAAgC,QAAhCA,UAAgC;AAAA,MAAjBC,KAAiB;;AAC1D,kBAAwC,qBAASF,KAAT,CAAxC;AAAA;AAAA,MAAOG,YAAP;AAAA,MAAqBC,eAArB;;AACA,mBAAkC,qBAASJ,KAAT,CAAlC;AAAA;AAAA,MAAOK,SAAP;AAAA,MAAkBC,YAAlB;;AACA,MAAMC,SAAS,GAAG,mBAAO,KAAP,CAAlB;AAEA,MAAMC,UAAU,GAAG,wBACjB,UAACC,CAAD,EAAO;AACL,QAAIF,SAAS,CAACG,OA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MAAAA,MAAM,EAAEV,UAHA;AAIRW,MAAAA,SAAS,EAAEL,aAJH;AAKRM,MAAAA,QAAQ,EAAEH,YALF;AAMRI,MAAAA,IAAI,EAAE;AANE;AAHZ,KADF;AAcD,CA3DyB,CAArB;;AA8DPzB,YAAY,CAAC0B,WAAb,GAA2B,cAA3B","sourcesContent":["import React, { forwardRef, useCallback, useRef, useState } from \"react\";\nimport { EditableContent, EditableContentInterface } from \"..\";\n\nexport interface EditableTextInterface extends EditableContentInterface {\n /** Value to display. */\n value: string;\n /** Optional callback called on enter, click outside and tab. */\n onSave?: () => null;\n /** Optional callback called on input reset. */\n onCancel?: () => null;\n}\n\nexport const EditableText = forwardRef<HTMLDivElement, EditableTextInterface>(\n ({ onSave, onCancel, value, inputProps, ...props }, ref) => {\n const [currentValue, setCurrentValue] = useState(value);\n const [prevValue, setPrevValue] = useState(value);\n const escapeRef = useRef(false);\n\n const handleBlur = useCallback(\n (e) => {\n if (escapeRef.current) {\n setCurrentValue(prevValue);\n escapeRef.current = false;\n } else {\n if (\n e.target.value.trim().length > 0 &&\n prevValue !== e.target.value\n ) {\n setPrevValue(e.target.value);\n setCurrentValue(e.target.value);\n typeof onSave === \"function\" && onSave();\n } else {\n setCurrentValue(prevValue);\n }\n }\n },\n [onSave, prevValue]\n );\n\n const handleKeyDown = useCallback(\n (e) => {\n if (e.key === \"Enter\") {\n e.target.blur();\n }\n if (e.key === \"Escape\") {\n escapeRef.current = true;\n e.target.blur();\n typeof onCancel === \"function\" && onCancel();\n }\n },\n [onCancel]\n );\n\n const handleChange = useCallback((e) => {\n setCurrentValue(e.target.value);\n }, []);\n\n return (\n <EditableContent\n {...props}\n ref={ref}\n inputProps={{\n ...inputProps,\n value: currentValue,\n onBlur: handleBlur,\n onKeyDown: handleKeyDown,\n onChange: handleChange,\n type: \"text\",\n }}\n />\n );\n }\n);\n\nEditableText.displayName = \"EditableText\";\n"],"file":"EditableText.js"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _EditableText = require("./EditableText");
|
|
8
|
+
|
|
9
|
+
Object.keys(_EditableText).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _EditableText[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _EditableText[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/EditableText/index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./EditableText\";\n"],"file":"index.js"}
|
|
@@ -797,6 +797,19 @@ Object.keys(_EditableContent).forEach(function (key) {
|
|
|
797
797
|
});
|
|
798
798
|
});
|
|
799
799
|
|
|
800
|
+
var _EditableText = require("./EditableText");
|
|
801
|
+
|
|
802
|
+
Object.keys(_EditableText).forEach(function (key) {
|
|
803
|
+
if (key === "default" || key === "__esModule") return;
|
|
804
|
+
if (key in exports && exports[key] === _EditableText[key]) return;
|
|
805
|
+
Object.defineProperty(exports, key, {
|
|
806
|
+
enumerable: true,
|
|
807
|
+
get: function get() {
|
|
808
|
+
return _EditableText[key];
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
});
|
|
812
|
+
|
|
800
813
|
var _Folder = require("./Folder");
|
|
801
814
|
|
|
802
815
|
Object.keys(_Folder).forEach(function (key) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./Button\";\nexport * from \"./ButtonGroup\";\nexport * from \"./Breadcrumbs\";\nexport * from \"./CounterButton\";\nexport * from \"./Steppers\";\nexport * from \"./Tables\";\nexport * from \"./CompleteCheckbox\";\nexport * from \"./Paper\";\nexport * from \"./ScaleBar\";\nexport * from \"./Card\";\nexport * from \"./EntityCard\";\nexport * from \"./Signifier\";\nexport * from \"./Avatar\";\nexport * from \"./Tag\";\nexport * from \"./Loaders\";\nexport * from \"./Nav\";\nexport * from \"./Bubble\";\nexport * from \"./Input\";\nexport * from \"./Menu\";\nexport * from \"./Expanders\";\nexport * from \"./Pickers\";\nexport * from \"./DatePicker\";\nexport * from \"./List\";\nexport * from \"./MenuSelector\";\nexport * from \"./MultiAvatar\";\nexport * from \"./RadioButton\";\nexport * from \"./ScrollShadow\";\nexport * from \"./Icons\";\nexport * from \"./Textarea\";\nexport * from \"./Modal\";\nexport * from \"./Sheet\";\nexport * from \"./Header\";\nexport * from \"./AutoResizeTextarea\";\nexport * from \"./Overlay\";\nexport * from \"./Accordion\";\nexport * from \"./Choose\";\nexport * from \"./Links\";\nexport * from \"./SelectDate\";\nexport * from \"./Popper\";\nexport * from \"./ToastMessage\";\nexport * from \"./Tooltip\";\nexport * from \"./Transitions\";\nexport * from \"./Pressed\";\nexport * from \"./Window\";\nexport * from \"./ValueButton\";\nexport * from \"./Select\";\nexport * from \"./SelectTrigger\";\nexport * from \"./Dialog\";\nexport * from \"./ConfirmDialog\";\nexport * from \"./Checkbox\";\nexport * from \"./Toggle\";\nexport * from \"./Typography\";\nexport * from \"./Autocomplete\";\nexport * from \"./ComboBox\";\nexport * from \"./Button/AddToListButton\";\nexport * from \"./ProgressBar\";\nexport * from \"./Reactions\";\nexport * from \"./Label\";\nexport * from \"./GlobalStyle\";\nexport * from \"./ProgressRing\";\nexport * from \"./EditableContent\";\nexport * from \"./Folder\";\nexport * from \"./Chip\";\nexport * from \"./Trigger\";\nexport * from \"./Dot\";\nexport * from \"./Entity\";\nexport * from \"./Filter\";\nexport * from \"./Wizard\";\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from \"./Button\";\nexport * from \"./ButtonGroup\";\nexport * from \"./Breadcrumbs\";\nexport * from \"./CounterButton\";\nexport * from \"./Steppers\";\nexport * from \"./Tables\";\nexport * from \"./CompleteCheckbox\";\nexport * from \"./Paper\";\nexport * from \"./ScaleBar\";\nexport * from \"./Card\";\nexport * from \"./EntityCard\";\nexport * from \"./Signifier\";\nexport * from \"./Avatar\";\nexport * from \"./Tag\";\nexport * from \"./Loaders\";\nexport * from \"./Nav\";\nexport * from \"./Bubble\";\nexport * from \"./Input\";\nexport * from \"./Menu\";\nexport * from \"./Expanders\";\nexport * from \"./Pickers\";\nexport * from \"./DatePicker\";\nexport * from \"./List\";\nexport * from \"./MenuSelector\";\nexport * from \"./MultiAvatar\";\nexport * from \"./RadioButton\";\nexport * from \"./ScrollShadow\";\nexport * from \"./Icons\";\nexport * from \"./Textarea\";\nexport * from \"./Modal\";\nexport * from \"./Sheet\";\nexport * from \"./Header\";\nexport * from \"./AutoResizeTextarea\";\nexport * from \"./Overlay\";\nexport * from \"./Accordion\";\nexport * from \"./Choose\";\nexport * from \"./Links\";\nexport * from \"./SelectDate\";\nexport * from \"./Popper\";\nexport * from \"./ToastMessage\";\nexport * from \"./Tooltip\";\nexport * from \"./Transitions\";\nexport * from \"./Pressed\";\nexport * from \"./Window\";\nexport * from \"./ValueButton\";\nexport * from \"./Select\";\nexport * from \"./SelectTrigger\";\nexport * from \"./Dialog\";\nexport * from \"./ConfirmDialog\";\nexport * from \"./Checkbox\";\nexport * from \"./Toggle\";\nexport * from \"./Typography\";\nexport * from \"./Autocomplete\";\nexport * from \"./ComboBox\";\nexport * from \"./Button/AddToListButton\";\nexport * from \"./ProgressBar\";\nexport * from \"./Reactions\";\nexport * from \"./Label\";\nexport * from \"./GlobalStyle\";\nexport * from \"./ProgressRing\";\nexport * from \"./EditableContent\";\nexport * from \"./EditableText\";\nexport * from \"./Folder\";\nexport * from \"./Chip\";\nexport * from \"./Trigger\";\nexport * from \"./Dot\";\nexport * from \"./Entity\";\nexport * from \"./Filter\";\nexport * from \"./Wizard\";\n"],"file":"index.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditableContent.d.ts","sourceRoot":"","sources":["../../../../src/components/EditableContent/EditableContent.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"EditableContent.d.ts","sourceRoot":"","sources":["../../../../src/components/EditableContent/EditableContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGnD,MAAM,WAAW,wBAAwB;IAEvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;IAEjD,UAAU,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC;CAC/D;AAED,eAAO,MAAM,eAAe,yuJA+B1B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
var _excluded = ["className", "variant", "weight", "inputProps"];
|
|
4
|
-
import React, { forwardRef,
|
|
4
|
+
import React, { forwardRef, useRef, useCallback } from "react";
|
|
5
5
|
import { StyledDiv, StyledInput, StyledSpan } from "./Styles";
|
|
6
6
|
export var EditableContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
7
7
|
var className = _ref.className,
|
|
@@ -11,15 +11,13 @@ export var EditableContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
11
11
|
inputProps = _ref.inputProps,
|
|
12
12
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
13
13
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
innerValue = _useState[0],
|
|
18
|
-
setInnerValue = _useState[1];
|
|
14
|
+
var intInputRef = useRef(null);
|
|
15
|
+
var handleBlur = useCallback(function (evt) {
|
|
16
|
+
var _intInputRef$current;
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}, []);
|
|
18
|
+
intInputRef == null ? void 0 : (_intInputRef$current = intInputRef.current) == null ? void 0 : _intInputRef$current.setSelectionRange(0, 0);
|
|
19
|
+
typeof (inputProps == null ? void 0 : inputProps.onBlur) === "function" && (inputProps == null ? void 0 : inputProps.onBlur(evt));
|
|
20
|
+
}, [inputProps]);
|
|
23
21
|
return /*#__PURE__*/React.createElement(StyledDiv, _extends({
|
|
24
22
|
className: className,
|
|
25
23
|
ref: ref
|
|
@@ -27,12 +25,13 @@ export var EditableContent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
27
25
|
variant: variant,
|
|
28
26
|
forwardedAs: "span",
|
|
29
27
|
weight: weight
|
|
30
|
-
},
|
|
28
|
+
}, inputProps == null ? void 0 : inputProps.value), /*#__PURE__*/React.createElement(StyledInput, _extends({}, inputProps, {
|
|
29
|
+
ref: intInputRef,
|
|
31
30
|
forwardedAs: "input",
|
|
32
31
|
variant: variant,
|
|
33
32
|
weight: weight,
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
value: inputProps == null ? void 0 : inputProps.value,
|
|
34
|
+
onBlur: handleBlur
|
|
36
35
|
})));
|
|
37
36
|
});
|
|
38
37
|
EditableContent.displayName = "EditableContent";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/EditableContent/EditableContent.tsx"],"names":["React","forwardRef","
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/EditableContent/EditableContent.tsx"],"names":["React","forwardRef","useRef","useCallback","StyledDiv","StyledInput","StyledSpan","EditableContent","ref","className","variant","weight","inputProps","props","intInputRef","handleBlur","evt","current","setSelectionRange","onBlur","value","displayName"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,MAA5B,EAAoCC,WAApC,QAAuD,OAAvD;AAEA,SAASC,SAAT,EAAoBC,WAApB,EAAiCC,UAAjC,QAAmD,UAAnD;AAWA,OAAO,IAAMC,eAAe,gBAAGN,UAAU,CAIvC,gBAAkEO,GAAlE,EAA0E;AAAA,MAAvEC,SAAuE,QAAvEA,SAAuE;AAAA,0BAA5DC,OAA4D;AAAA,MAA5DA,OAA4D,6BAAlD,QAAkD;AAAA,MAAxCC,MAAwC,QAAxCA,MAAwC;AAAA,MAAhCC,UAAgC,QAAhCA,UAAgC;AAAA,MAAjBC,KAAiB;;AAC1E,MAAMC,WAAW,GAAGZ,MAAM,CAAmB,IAAnB,CAA1B;AAEA,MAAMa,UAAU,GAAGZ,WAAW,CAC5B,UAACa,GAAD,EAAS;AAAA;;AACPF,IAAAA,WAAW,QAAX,oCAAAA,WAAW,CAAEG,OAAb,0CAAsBC,iBAAtB,CAAwC,CAAxC,EAA2C,CAA3C;AACA,YAAON,UAAP,oBAAOA,UAAU,CAAEO,MAAnB,qBAA4CP,UAA5C,oBAA4CA,UAAU,CAAEO,MAAZ,CAAmBH,GAAnB,CAA5C;AACD,GAJ2B,EAK5B,CAACJ,UAAD,CAL4B,CAA9B;AAQA,sBACE,oBAAC,SAAD;AAAW,IAAA,SAAS,EAAEH,SAAtB;AAAiC,IAAA,GAAG,EAAED;AAAtC,KAA+CK,KAA/C,gBACE,oBAAC,UAAD;AAAY,IAAA,OAAO,EAAEH,OAArB;AAA8B,IAAA,WAAW,EAAC,MAA1C;AAAiD,IAAA,MAAM,EAAEC;AAAzD,KACGC,UADH,oBACGA,UAAU,CAAEQ,KADf,CADF,eAIE,oBAAC,WAAD,eACMR,UADN;AAEE,IAAA,GAAG,EAAEE,WAFP;AAGE,IAAA,WAAW,EAAC,OAHd;AAIE,IAAA,OAAO,EAAEJ,OAJX;AAKE,IAAA,MAAM,EAAEC,MALV;AAME,IAAA,KAAK,EAAEC,UAAF,oBAAEA,UAAU,CAAEQ,KANrB;AAOE,IAAA,MAAM,EAAEL;AAPV,KAJF,CADF;AAgBD,CA/BwC,CAAlC;AAiCPR,eAAe,CAACc,WAAhB,GAA8B,iBAA9B","sourcesContent":["import React, { forwardRef, useRef, useCallback } from \"react\";\nimport { Variant } from \"../Typography/Typography\";\nimport { StyledDiv, StyledInput, StyledSpan } from \"./Styles\";\n\nexport interface EditableContentInterface {\n /** Typography variant. */\n variant?: Variant;\n /** Typography weight. */\n weight?: \"light\" | \"regular\" | \"bold\" | \"medium\";\n /** Input props. */\n inputProps?: Partial<React.ComponentPropsWithoutRef<\"input\">>;\n}\n\nexport const EditableContent = forwardRef<\n HTMLDivElement,\n EditableContentInterface &\n Omit<React.ComponentPropsWithoutRef<\"div\">, keyof EditableContentInterface>\n>(({ className, variant = \"Body 2\", weight, inputProps, ...props }, ref) => {\n const intInputRef = useRef<HTMLInputElement>(null);\n\n const handleBlur = useCallback(\n (evt) => {\n intInputRef?.current?.setSelectionRange(0, 0);\n typeof inputProps?.onBlur === `function` && inputProps?.onBlur(evt);\n },\n [inputProps]\n );\n\n return (\n <StyledDiv className={className} ref={ref} {...props}>\n <StyledSpan variant={variant} forwardedAs=\"span\" weight={weight}>\n {inputProps?.value}\n </StyledSpan>\n <StyledInput\n {...inputProps}\n ref={intInputRef}\n forwardedAs=\"input\"\n variant={variant}\n weight={weight}\n value={inputProps?.value}\n onBlur={handleBlur}\n />\n </StyledDiv>\n );\n});\n\nEditableContent.displayName = \"EditableContent\";\n"],"file":"EditableContent.js"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { EditableContentInterface } from "..";
|
|
3
|
+
export interface EditableTextInterface extends EditableContentInterface {
|
|
4
|
+
value: string;
|
|
5
|
+
onSave?: () => null;
|
|
6
|
+
onCancel?: () => null;
|
|
7
|
+
}
|
|
8
|
+
export declare const EditableText: React.ForwardRefExoticComponent<EditableTextInterface & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
//# sourceMappingURL=EditableText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditableText.d.ts","sourceRoot":"","sources":["../../../../src/components/EditableText/EditableText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AACzE,OAAO,EAAmB,wBAAwB,EAAE,MAAM,IAAI,CAAC;AAE/D,MAAM,WAAW,qBAAsB,SAAQ,wBAAwB;IAErE,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,8FA4DxB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
var _excluded = ["onSave", "onCancel", "value", "inputProps"];
|
|
4
|
+
import React, { forwardRef, useCallback, useRef, useState } from "react";
|
|
5
|
+
import { EditableContent } from "..";
|
|
6
|
+
export var EditableText = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
7
|
+
var onSave = _ref.onSave,
|
|
8
|
+
onCancel = _ref.onCancel,
|
|
9
|
+
value = _ref.value,
|
|
10
|
+
inputProps = _ref.inputProps,
|
|
11
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
12
|
+
|
|
13
|
+
var _useState = useState(value),
|
|
14
|
+
currentValue = _useState[0],
|
|
15
|
+
setCurrentValue = _useState[1];
|
|
16
|
+
|
|
17
|
+
var _useState2 = useState(value),
|
|
18
|
+
prevValue = _useState2[0],
|
|
19
|
+
setPrevValue = _useState2[1];
|
|
20
|
+
|
|
21
|
+
var escapeRef = useRef(false);
|
|
22
|
+
var handleBlur = useCallback(function (e) {
|
|
23
|
+
if (escapeRef.current) {
|
|
24
|
+
setCurrentValue(prevValue);
|
|
25
|
+
escapeRef.current = false;
|
|
26
|
+
} else {
|
|
27
|
+
if (e.target.value.trim().length > 0 && prevValue !== e.target.value) {
|
|
28
|
+
setPrevValue(e.target.value);
|
|
29
|
+
setCurrentValue(e.target.value);
|
|
30
|
+
typeof onSave === "function" && onSave();
|
|
31
|
+
} else {
|
|
32
|
+
setCurrentValue(prevValue);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, [onSave, prevValue]);
|
|
36
|
+
var handleKeyDown = useCallback(function (e) {
|
|
37
|
+
if (e.key === "Enter") {
|
|
38
|
+
e.target.blur();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (e.key === "Escape") {
|
|
42
|
+
escapeRef.current = true;
|
|
43
|
+
e.target.blur();
|
|
44
|
+
typeof onCancel === "function" && onCancel();
|
|
45
|
+
}
|
|
46
|
+
}, [onCancel]);
|
|
47
|
+
var handleChange = useCallback(function (e) {
|
|
48
|
+
setCurrentValue(e.target.value);
|
|
49
|
+
}, []);
|
|
50
|
+
return /*#__PURE__*/React.createElement(EditableContent, _extends({}, props, {
|
|
51
|
+
ref: ref,
|
|
52
|
+
inputProps: _extends({}, inputProps, {
|
|
53
|
+
value: currentValue,
|
|
54
|
+
onBlur: handleBlur,
|
|
55
|
+
onKeyDown: handleKeyDown,
|
|
56
|
+
onChange: handleChange,
|
|
57
|
+
type: "text"
|
|
58
|
+
})
|
|
59
|
+
}));
|
|
60
|
+
});
|
|
61
|
+
EditableText.displayName = "EditableText";
|
|
62
|
+
//# sourceMappingURL=EditableText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/EditableText/EditableText.tsx"],"names":["React","forwardRef","useCallback","useRef","useState","EditableContent","EditableText","ref","onSave","onCancel","value","inputProps","props","currentValue","setCurrentValue","prevValue","setPrevValue","escapeRef","handleBlur","e","current","target","trim","length","handleKeyDown","key","blur","handleChange","onBlur","onKeyDown","onChange","type","displayName"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,WAA5B,EAAyCC,MAAzC,EAAiDC,QAAjD,QAAiE,OAAjE;AACA,SAASC,eAAT,QAA0D,IAA1D;AAWA,OAAO,IAAMC,YAAY,gBAAGL,UAAU,CACpC,gBAAoDM,GAApD,EAA4D;AAAA,MAAzDC,MAAyD,QAAzDA,MAAyD;AAAA,MAAjDC,QAAiD,QAAjDA,QAAiD;AAAA,MAAvCC,KAAuC,QAAvCA,KAAuC;AAAA,MAAhCC,UAAgC,QAAhCA,UAAgC;AAAA,MAAjBC,KAAiB;;AAC1D,kBAAwCR,QAAQ,CAACM,KAAD,CAAhD;AAAA,MAAOG,YAAP;AAAA,MAAqBC,eAArB;;AACA,mBAAkCV,QAAQ,CAACM,KAAD,CAA1C;AAAA,MAAOK,SAAP;AAAA,MAAkBC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,GAF+B,EAE7B,EAF6B,CAAhC;AAIA,sBACE,oBAAC,eAAD,eACME,KADN;AAEE,IAAA,GAAG,EAAEL,GAFP;AAGE,IAAA,UAAU,eACLI,UADK;AAERD,MAAAA,KAAK,EAAEG,YAFC;AAGRe,MAAAA,MAAM,EAAEV,UAHA;AAIRW,MAAAA,SAAS,EAAEL,aAJH;AAKRM,MAAAA,QAAQ,EAAEH,YALF;AAMRI,MAAAA,IAAI,EAAE;AANE;AAHZ,KADF;AAcD,CA3DmC,CAA/B;AA8DPzB,YAAY,CAAC0B,WAAb,GAA2B,cAA3B","sourcesContent":["import React, { forwardRef, useCallback, useRef, useState } from \"react\";\nimport { EditableContent, EditableContentInterface } from \"..\";\n\nexport interface EditableTextInterface extends EditableContentInterface {\n /** Value to display. */\n value: string;\n /** Optional callback called on enter, click outside and tab. */\n onSave?: () => null;\n /** Optional callback called on input reset. */\n onCancel?: () => null;\n}\n\nexport const EditableText = forwardRef<HTMLDivElement, EditableTextInterface>(\n ({ onSave, onCancel, value, inputProps, ...props }, ref) => {\n const [currentValue, setCurrentValue] = useState(value);\n const [prevValue, setPrevValue] = useState(value);\n const escapeRef = useRef(false);\n\n const handleBlur = useCallback(\n (e) => {\n if (escapeRef.current) {\n setCurrentValue(prevValue);\n escapeRef.current = false;\n } else {\n if (\n e.target.value.trim().length > 0 &&\n prevValue !== e.target.value\n ) {\n setPrevValue(e.target.value);\n setCurrentValue(e.target.value);\n typeof onSave === \"function\" && onSave();\n } else {\n setCurrentValue(prevValue);\n }\n }\n },\n [onSave, prevValue]\n );\n\n const handleKeyDown = useCallback(\n (e) => {\n if (e.key === \"Enter\") {\n e.target.blur();\n }\n if (e.key === \"Escape\") {\n escapeRef.current = true;\n e.target.blur();\n typeof onCancel === \"function\" && onCancel();\n }\n },\n [onCancel]\n );\n\n const handleChange = useCallback((e) => {\n setCurrentValue(e.target.value);\n }, []);\n\n return (\n <EditableContent\n {...props}\n ref={ref}\n inputProps={{\n ...inputProps,\n value: currentValue,\n onBlur: handleBlur,\n onKeyDown: handleKeyDown,\n onChange: handleChange,\n type: \"text\",\n }}\n />\n );\n }\n);\n\nEditableText.displayName = \"EditableText\";\n"],"file":"EditableText.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/EditableText/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/EditableText/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAd","sourcesContent":["export * from \"./EditableText\";\n"],"file":"index.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY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Ad;AACA,cAAc,iBAAd;AACA,cAAc,YAAd;AACA,cAAc,UAAd;AACA,cAAc,cAAd;AACA,cAAc,gBAAd;AACA,cAAc,YAAd;AACA,cAAc,0BAAd;AACA,cAAc,eAAd;AACA,cAAc,aAAd;AACA,cAAc,SAAd;AACA,cAAc,eAAd;AACA,cAAc,gBAAd;AACA,cAAc,mBAAd;AACA,cAAc,UAAd;AACA,cAAc,QAAd;AACA,cAAc,WAAd;AACA,cAAc,OAAd;AACA,cAAc,UAAd;AACA,cAAc,UAAd;AACA,cAAc,UAAd","sourcesContent":["export * from \"./Button\";\nexport * from \"./ButtonGroup\";\nexport * from \"./Breadcrumbs\";\nexport * from \"./CounterButton\";\nexport * from \"./Steppers\";\nexport * from \"./Tables\";\nexport * from \"./CompleteCheckbox\";\nexport * from \"./Paper\";\nexport * from \"./ScaleBar\";\nexport * from \"./Card\";\nexport * from \"./EntityCard\";\nexport * from \"./Signifier\";\nexport * from \"./Avatar\";\nexport * from \"./Tag\";\nexport * from \"./Loaders\";\nexport * from \"./Nav\";\nexport * from \"./Bubble\";\nexport * from \"./Input\";\nexport * from \"./Menu\";\nexport * from \"./Expanders\";\nexport * from \"./Pickers\";\nexport * from \"./DatePicker\";\nexport * from \"./List\";\nexport * from \"./MenuSelector\";\nexport * from \"./MultiAvatar\";\nexport * from \"./RadioButton\";\nexport * from \"./ScrollShadow\";\nexport * from \"./Icons\";\nexport * from \"./Textarea\";\nexport * from \"./Modal\";\nexport * from \"./Sheet\";\nexport * from \"./Header\";\nexport * from \"./AutoResizeTextarea\";\nexport * from \"./Overlay\";\nexport * from \"./Accordion\";\nexport * from \"./Choose\";\nexport * from \"./Links\";\nexport * from \"./SelectDate\";\nexport * from \"./Popper\";\nexport * from \"./ToastMessage\";\nexport * from \"./Tooltip\";\nexport * from \"./Transitions\";\nexport * from \"./Pressed\";\nexport * from \"./Window\";\nexport * from \"./ValueButton\";\nexport * from \"./Select\";\nexport * from \"./SelectTrigger\";\nexport * from \"./Dialog\";\nexport * from \"./ConfirmDialog\";\nexport * from \"./Checkbox\";\nexport * from \"./Toggle\";\nexport * from \"./Typography\";\nexport * from \"./Autocomplete\";\nexport * from \"./ComboBox\";\nexport * from \"./Button/AddToListButton\";\nexport * from \"./ProgressBar\";\nexport * from \"./Reactions\";\nexport * from \"./Label\";\nexport * from \"./GlobalStyle\";\nexport * from \"./ProgressRing\";\nexport * from \"./EditableContent\";\nexport * from \"./Folder\";\nexport * from \"./Chip\";\nexport * from \"./Trigger\";\nexport * from \"./Dot\";\nexport * from \"./Entity\";\nexport * from \"./Filter\";\nexport * from \"./Wizard\";\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAd;AACA,cAAc,eAAd;AACA,cAAc,eAAd;AACA,cAAc,iBAAd;AACA,cAAc,YAAd;AACA,cAAc,UAAd;AACA,cAAc,oBAAd;AACA,cAAc,SAAd;AACA,cAAc,YAAd;AACA,cAAc,QAAd;AACA,cAAc,cAAd;AACA,cAAc,aAAd;AACA,cAAc,UAAd;AACA,cAAc,OAAd;AACA,cAAc,WAAd;AACA,cAAc,OAAd;AACA,cAAc,UAAd;AACA,cAAc,SAAd;AACA,cAAc,QAAd;AACA,cAAc,aAAd;AACA,cAAc,WAAd;AACA,cAAc,cAAd;AACA,cAAc,QAAd;AACA,cAAc,gBAAd;AACA,cAAc,eAAd;AACA,cAAc,eAAd;AACA,cAAc,gBAAd;AACA,cAAc,SAAd;AACA,cAAc,YAAd;AACA,cAAc,SAAd;AACA,cAAc,SAAd;AACA,cAAc,UAAd;AACA,cAAc,sBAAd;AACA,cAAc,WAAd;AACA,cAAc,aAAd;AACA,cAAc,UAAd;AACA,cAAc,SAAd;AACA,cAAc,cAAd;AACA,cAAc,UAAd;AACA,cAAc,gBAAd;AACA,cAAc,WAAd;AACA,cAAc,eAAd;AACA,cAAc,WAAd;AACA,cAAc,UAAd;AACA,cAAc,eAAd;AACA,cAAc,UAAd;AACA,cAAc,iBAAd;AACA,cAAc,UAAd;AACA,cAAc,iBAAd;AACA,cAAc,YAAd;AACA,cAAc,UAAd;AACA,cAAc,cAAd;AACA,cAAc,gBAAd;AACA,cAAc,YAAd;AACA,cAAc,0BAAd;AACA,cAAc,eAAd;AACA,cAAc,aAAd;AACA,cAAc,SAAd;AACA,cAAc,eAAd;AACA,cAAc,gBAAd;AACA,cAAc,mBAAd;AACA,cAAc,gBAAd;AACA,cAAc,UAAd;AACA,cAAc,QAAd;AACA,cAAc,WAAd;AACA,cAAc,OAAd;AACA,cAAc,UAAd;AACA,cAAc,UAAd;AACA,cAAc,UAAd","sourcesContent":["export * from \"./Button\";\nexport * from \"./ButtonGroup\";\nexport * from \"./Breadcrumbs\";\nexport * from \"./CounterButton\";\nexport * from \"./Steppers\";\nexport * from \"./Tables\";\nexport * from \"./CompleteCheckbox\";\nexport * from \"./Paper\";\nexport * from \"./ScaleBar\";\nexport * from \"./Card\";\nexport * from \"./EntityCard\";\nexport * from \"./Signifier\";\nexport * from \"./Avatar\";\nexport * from \"./Tag\";\nexport * from \"./Loaders\";\nexport * from \"./Nav\";\nexport * from \"./Bubble\";\nexport * from \"./Input\";\nexport * from \"./Menu\";\nexport * from \"./Expanders\";\nexport * from \"./Pickers\";\nexport * from \"./DatePicker\";\nexport * from \"./List\";\nexport * from \"./MenuSelector\";\nexport * from \"./MultiAvatar\";\nexport * from \"./RadioButton\";\nexport * from \"./ScrollShadow\";\nexport * from \"./Icons\";\nexport * from \"./Textarea\";\nexport * from \"./Modal\";\nexport * from \"./Sheet\";\nexport * from \"./Header\";\nexport * from \"./AutoResizeTextarea\";\nexport * from \"./Overlay\";\nexport * from \"./Accordion\";\nexport * from \"./Choose\";\nexport * from \"./Links\";\nexport * from \"./SelectDate\";\nexport * from \"./Popper\";\nexport * from \"./ToastMessage\";\nexport * from \"./Tooltip\";\nexport * from \"./Transitions\";\nexport * from \"./Pressed\";\nexport * from \"./Window\";\nexport * from \"./ValueButton\";\nexport * from \"./Select\";\nexport * from \"./SelectTrigger\";\nexport * from \"./Dialog\";\nexport * from \"./ConfirmDialog\";\nexport * from \"./Checkbox\";\nexport * from \"./Toggle\";\nexport * from \"./Typography\";\nexport * from \"./Autocomplete\";\nexport * from \"./ComboBox\";\nexport * from \"./Button/AddToListButton\";\nexport * from \"./ProgressBar\";\nexport * from \"./Reactions\";\nexport * from \"./Label\";\nexport * from \"./GlobalStyle\";\nexport * from \"./ProgressRing\";\nexport * from \"./EditableContent\";\nexport * from \"./EditableText\";\nexport * from \"./Folder\";\nexport * from \"./Chip\";\nexport * from \"./Trigger\";\nexport * from \"./Dot\";\nexport * from \"./Entity\";\nexport * from \"./Filter\";\nexport * from \"./Wizard\";\n"],"file":"index.js"}
|