trepur_components 0.2.57 → 0.2.60
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.
|
@@ -9,6 +9,8 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
11
|
|
|
12
|
+
require("core-js/modules/es.json.stringify.js");
|
|
13
|
+
|
|
12
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
15
|
|
|
14
16
|
var _Input = _interopRequireDefault(require("../Input"));
|
|
@@ -46,6 +48,7 @@ const TextAndTitle = _ref => {
|
|
|
46
48
|
withLiveUpdates = false,
|
|
47
49
|
onSave
|
|
48
50
|
} = _ref;
|
|
51
|
+
console.log('children: ', children);
|
|
49
52
|
const [isInEditingMode, setIsInEditingMode] = (0, _react.useState)(false);
|
|
50
53
|
const [titleText, setTitleText] = (0, _react.useState)(title);
|
|
51
54
|
const [isHovering, setIsHovering] = (0, _react.useState)(false);
|
|
@@ -81,6 +84,11 @@ const TextAndTitle = _ref => {
|
|
|
81
84
|
setIsHovering(false);
|
|
82
85
|
};
|
|
83
86
|
|
|
87
|
+
const handleButtonCancel = () => {
|
|
88
|
+
toggleEditState();
|
|
89
|
+
setIsHovering(false);
|
|
90
|
+
};
|
|
91
|
+
|
|
84
92
|
const handleChange = e => {
|
|
85
93
|
setTitleText(e.target.value);
|
|
86
94
|
};
|
|
@@ -89,6 +97,14 @@ const TextAndTitle = _ref => {
|
|
|
89
97
|
withLiveUpdates && setIsHovering(!isHovering);
|
|
90
98
|
};
|
|
91
99
|
|
|
100
|
+
const destructChildren = children => {
|
|
101
|
+
let data = '';
|
|
102
|
+
children && children.map(child => {
|
|
103
|
+
data += "".concat(JSON.parse(JSON.stringify(child)).props.children);
|
|
104
|
+
});
|
|
105
|
+
return data;
|
|
106
|
+
};
|
|
107
|
+
|
|
92
108
|
return /*#__PURE__*/_react.default.createElement("div", _extends({}, id && {
|
|
93
109
|
id: id
|
|
94
110
|
}, {
|
|
@@ -104,7 +120,7 @@ const TextAndTitle = _ref => {
|
|
|
104
120
|
type: "text"
|
|
105
121
|
}), /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
106
122
|
classes: "py-4",
|
|
107
|
-
value:
|
|
123
|
+
value: destructChildren(children),
|
|
108
124
|
onChange: e => handleChange(e),
|
|
109
125
|
type: "text"
|
|
110
126
|
}), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
@@ -115,6 +131,16 @@ const TextAndTitle = _ref => {
|
|
|
115
131
|
buttonHoverTextColor: "#000000",
|
|
116
132
|
buttonHoverBorderColor: "#000000",
|
|
117
133
|
buttonHoverBgColor: "white"
|
|
134
|
+
}), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
135
|
+
buttonClasses: "ml-4",
|
|
136
|
+
buttonText: "Cancel",
|
|
137
|
+
class: true,
|
|
138
|
+
buttonOnClick: handleButtonCancel,
|
|
139
|
+
buttonBgColor: "black",
|
|
140
|
+
buttonTextColor: "white",
|
|
141
|
+
buttonHoverTextColor: "#000000",
|
|
142
|
+
buttonHoverBorderColor: "#000000",
|
|
143
|
+
buttonHoverBgColor: "white"
|
|
118
144
|
})) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("p", {
|
|
119
145
|
style: titleStyles,
|
|
120
146
|
className: titleClassList,
|