funda-ui 2.0.355 → 2.0.375
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/Tabs/index.js +31 -7
- package/Textarea/index.d.ts +0 -1
- package/Textarea/index.js +7 -27
- package/lib/cjs/Tabs/index.js +31 -7
- package/lib/cjs/Textarea/index.d.ts +0 -1
- package/lib/cjs/Textarea/index.js +7 -27
- package/lib/esm/Tabs/TabPanel.tsx +16 -4
- package/lib/esm/Tabs/Tabs.tsx +26 -2
- package/lib/esm/Textarea/index.tsx +2 -16
- package/lib/esm/Textarea/utils/useAutosizeTextArea.js +1 -5
- package/package.json +1 -1
package/Tabs/index.js
CHANGED
|
@@ -126,28 +126,36 @@ var TabList = function TabList(props) {
|
|
|
126
126
|
};
|
|
127
127
|
/* harmony default export */ const src_TabList = (TabList);
|
|
128
128
|
;// CONCATENATED MODULE: ./src/TabPanel.tsx
|
|
129
|
-
var _excluded = ["
|
|
129
|
+
var _excluded = ["defaultActive", "expandedActiveClassNameForPanel", "tabpanelClass", "targetId", "index"];
|
|
130
130
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
131
131
|
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; }
|
|
132
132
|
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; }
|
|
133
133
|
|
|
134
134
|
;
|
|
135
135
|
var TabPanel = function TabPanel(props) {
|
|
136
|
-
var
|
|
137
|
-
defaultActive = props.defaultActive,
|
|
136
|
+
var defaultActive = props.defaultActive,
|
|
138
137
|
expandedActiveClassNameForPanel = props.expandedActiveClassNameForPanel,
|
|
139
138
|
tabpanelClass = props.tabpanelClass,
|
|
140
139
|
targetId = props.targetId,
|
|
141
140
|
index = props.index,
|
|
142
141
|
attributes = _objectWithoutProperties(props, _excluded);
|
|
143
142
|
var _expandClassName = typeof expandedActiveClassNameForPanel !== 'undefined' ? expandedActiveClassNameForPanel : '';
|
|
144
|
-
var activedClassName = typeof defaultActive !== 'undefined' && defaultActive !== false ? "
|
|
143
|
+
var activedClassName = typeof defaultActive !== 'undefined' && defaultActive !== false ? " active ".concat(_expandClassName) : " ".concat(_expandClassName);
|
|
144
|
+
|
|
145
|
+
// !!!Special note:
|
|
146
|
+
// If you want to hide the tab in advance, please use `{ height: 0; overflow: hidden; }`, do not use `{ display: none }`
|
|
147
|
+
// Otherwise it will cause the scrollHeight of the element inside the child node to be 0
|
|
148
|
+
var activedStyles = typeof defaultActive !== 'undefined' && defaultActive !== false ? {} : {
|
|
149
|
+
height: '0',
|
|
150
|
+
overflow: 'hidden'
|
|
151
|
+
};
|
|
145
152
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", _extends({
|
|
146
153
|
"data-index": index,
|
|
147
154
|
"data-tabpanel-index": index,
|
|
148
155
|
role: "tabpanel",
|
|
149
156
|
id: targetId,
|
|
150
|
-
className: tabpanelClass ? "tab-pane
|
|
157
|
+
className: tabpanelClass ? "tab-pane d-block ".concat(tabpanelClass, " ").concat(activedClassName) : "tab-pane d-block ".concat(activedClassName),
|
|
158
|
+
style: activedStyles
|
|
151
159
|
}, attributes)));
|
|
152
160
|
};
|
|
153
161
|
/* harmony default export */ const src_TabPanel = (TabPanel);
|
|
@@ -178,6 +186,20 @@ var Tabs = function Tabs(props) {
|
|
|
178
186
|
var uniqueID = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useId)().replace(/\:/g, "-");
|
|
179
187
|
var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
180
188
|
var speed = animTransitionDuration ? animTransitionDuration : 150;
|
|
189
|
+
var elDisplay = function elDisplay(type, node) {
|
|
190
|
+
if (node === null) return;
|
|
191
|
+
|
|
192
|
+
// !!!Special note:
|
|
193
|
+
// If you want to hide the tab in advance, please use `{ height: 0; overflow: hidden; }`, do not use `{ display: none }`
|
|
194
|
+
// Otherwise it will cause the scrollHeight of the element inside the child node to be 0
|
|
195
|
+
if (type === 'hide') {
|
|
196
|
+
node.style.setProperty('height', '0');
|
|
197
|
+
node.style.setProperty('overflow', 'hidden');
|
|
198
|
+
} else {
|
|
199
|
+
node.style.removeProperty('height');
|
|
200
|
+
node.style.removeProperty('overflow');
|
|
201
|
+
}
|
|
202
|
+
};
|
|
181
203
|
function handleClickItem(e) {
|
|
182
204
|
e.preventDefault();
|
|
183
205
|
var el = e.currentTarget;
|
|
@@ -220,7 +242,8 @@ var Tabs = function Tabs(props) {
|
|
|
220
242
|
runExClassName(node.firstChild, _classNameNav, 'remove');
|
|
221
243
|
});
|
|
222
244
|
$allContent.forEach(function (node) {
|
|
223
|
-
|
|
245
|
+
//
|
|
246
|
+
elDisplay('hide', node);
|
|
224
247
|
setTimeout(function () {
|
|
225
248
|
node.classList.remove('active');
|
|
226
249
|
runExClassName(node, _classNamePanel, 'remove');
|
|
@@ -236,7 +259,8 @@ var Tabs = function Tabs(props) {
|
|
|
236
259
|
setTimeout(function () {
|
|
237
260
|
var _panel = document.getElementById(tabID);
|
|
238
261
|
if (_panel !== null) {
|
|
239
|
-
|
|
262
|
+
elDisplay('show', _panel);
|
|
263
|
+
_panel.classList.add('active');
|
|
240
264
|
runExClassName(_panel, _classNamePanel, 'add');
|
|
241
265
|
}
|
|
242
266
|
}, speed);
|
package/Textarea/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ interface TextareaProps extends React.ComponentPropsWithoutRef<"textarea"> {
|
|
|
9
9
|
controlClassName?: string;
|
|
10
10
|
controlGroupWrapperClassName?: string;
|
|
11
11
|
controlGroupTextClassName?: string;
|
|
12
|
-
initializingText?: string;
|
|
13
12
|
value?: string;
|
|
14
13
|
label?: React.ReactNode | string;
|
|
15
14
|
name?: string;
|
package/Textarea/index.js
CHANGED
|
@@ -144,26 +144,21 @@ const App = () => {
|
|
|
144
144
|
|
|
145
145
|
|
|
146
146
|
// Updates the height of a <textarea> when the value changes.
|
|
147
|
-
var useAutosizeTextArea = function useAutosizeTextArea(el, value
|
|
147
|
+
var useAutosizeTextArea = function useAutosizeTextArea(el, value) {
|
|
148
148
|
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
|
|
149
149
|
_useState2 = _slicedToArray(_useState, 2),
|
|
150
150
|
defaultRowHeight = _useState2[0],
|
|
151
151
|
setDefaultRowHeight = _useState2[1];
|
|
152
|
-
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(
|
|
152
|
+
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
153
153
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
157
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
158
|
-
defaultRowHeightInit = _useState6[0],
|
|
159
|
-
setDefaultRowHeightInit = _useState6[1];
|
|
154
|
+
defaultRowHeightInit = _useState4[0],
|
|
155
|
+
setDefaultRowHeightInit = _useState4[1];
|
|
160
156
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
161
157
|
if (el) {
|
|
162
158
|
// initialize default row height
|
|
163
159
|
if (el.scrollHeight > 0 && !defaultRowHeightInit) {
|
|
164
160
|
var style = el.currentStyle || window.getComputedStyle(el);
|
|
165
161
|
setDefaultRowHeight(el.scrollHeight + parseInt(style.borderTopWidth) + parseInt(style.borderBottomWidth));
|
|
166
|
-
setDynamicDefaultRowHeight(el.scrollHeight);
|
|
167
162
|
setDefaultRowHeightInit(true);
|
|
168
163
|
}
|
|
169
164
|
|
|
@@ -187,7 +182,7 @@ var useAutosizeTextArea = function useAutosizeTextArea(el, value, autoSizeBeginO
|
|
|
187
182
|
};
|
|
188
183
|
/* harmony default export */ const utils_useAutosizeTextArea = (useAutosizeTextArea);
|
|
189
184
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
190
|
-
var _excluded = ["wrapperClassName", "controlClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "
|
|
185
|
+
var _excluded = ["wrapperClassName", "controlClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "cols", "rows", "disabled", "required", "placeholder", "autoSize", "iconLeft", "iconRight", "readOnly", "value", "label", "name", "id", "maxLength", "style", "tabIndex", "onChangeCallback", "onInputCallback", "onKeyPressedCallback", "onChange", "onBlur", "onFocus"];
|
|
191
186
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
192
187
|
function src_slicedToArray(arr, i) { return src_arrayWithHoles(arr) || src_iterableToArrayLimit(arr, i) || src_unsupportedIterableToArray(arr, i) || src_nonIterableRest(); }
|
|
193
188
|
function src_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."); }
|
|
@@ -205,7 +200,6 @@ var Textarea = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
205
200
|
controlClassName = props.controlClassName,
|
|
206
201
|
controlGroupWrapperClassName = props.controlGroupWrapperClassName,
|
|
207
202
|
controlGroupTextClassName = props.controlGroupTextClassName,
|
|
208
|
-
initializingText = props.initializingText,
|
|
209
203
|
cols = props.cols,
|
|
210
204
|
rows = props.rows,
|
|
211
205
|
disabled = props.disabled,
|
|
@@ -237,11 +231,6 @@ var Textarea = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
237
231
|
_useState2 = src_slicedToArray(_useState, 2),
|
|
238
232
|
changedVal = _useState2[0],
|
|
239
233
|
setChangedVal = _useState2[1];
|
|
240
|
-
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
241
|
-
_useState4 = src_slicedToArray(_useState3, 2),
|
|
242
|
-
initTextStatus = _useState4[0],
|
|
243
|
-
setInitTextStatus = _useState4[1];
|
|
244
|
-
var INIT_TEXT = initializingText || 'Initializing...';
|
|
245
234
|
|
|
246
235
|
// auto size
|
|
247
236
|
utils_useAutosizeTextArea(autoSize ? valRef.current : null, autoSize ? changedVal : '');
|
|
@@ -304,20 +293,11 @@ var Textarea = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
304
293
|
//--------------
|
|
305
294
|
if (typeof value !== 'undefined' && value !== null) {
|
|
306
295
|
if (value.length > 0 && autoSize) {
|
|
307
|
-
setInitTextStatus(true);
|
|
308
|
-
|
|
309
296
|
// Recalculate height if default value exceeds initial height
|
|
310
297
|
setChangedVal("");
|
|
311
|
-
setTimeout(function () {
|
|
312
|
-
setChangedVal(" "); // spacing here
|
|
313
|
-
}, 0);
|
|
314
|
-
setTimeout(function () {
|
|
315
|
-
setChangedVal("");
|
|
316
|
-
}, 750);
|
|
317
298
|
setTimeout(function () {
|
|
318
299
|
setChangedVal("".concat(value));
|
|
319
|
-
|
|
320
|
-
}, 1500);
|
|
300
|
+
}, 0);
|
|
321
301
|
} else {
|
|
322
302
|
setChangedVal("".concat(value)); // Avoid displaying the number 0
|
|
323
303
|
}
|
|
@@ -349,7 +329,7 @@ var Textarea = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
349
329
|
className: controlClassName || controlClassName === '' ? controlClassName : "form-control",
|
|
350
330
|
id: idRes,
|
|
351
331
|
name: name,
|
|
352
|
-
placeholder:
|
|
332
|
+
placeholder: placeholder || '',
|
|
353
333
|
value: changedVal,
|
|
354
334
|
maxLength: maxLength || null,
|
|
355
335
|
onFocus: handleFocus,
|
package/lib/cjs/Tabs/index.js
CHANGED
|
@@ -126,28 +126,36 @@ var TabList = function TabList(props) {
|
|
|
126
126
|
};
|
|
127
127
|
/* harmony default export */ const src_TabList = (TabList);
|
|
128
128
|
;// CONCATENATED MODULE: ./src/TabPanel.tsx
|
|
129
|
-
var _excluded = ["
|
|
129
|
+
var _excluded = ["defaultActive", "expandedActiveClassNameForPanel", "tabpanelClass", "targetId", "index"];
|
|
130
130
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
131
131
|
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; }
|
|
132
132
|
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; }
|
|
133
133
|
|
|
134
134
|
;
|
|
135
135
|
var TabPanel = function TabPanel(props) {
|
|
136
|
-
var
|
|
137
|
-
defaultActive = props.defaultActive,
|
|
136
|
+
var defaultActive = props.defaultActive,
|
|
138
137
|
expandedActiveClassNameForPanel = props.expandedActiveClassNameForPanel,
|
|
139
138
|
tabpanelClass = props.tabpanelClass,
|
|
140
139
|
targetId = props.targetId,
|
|
141
140
|
index = props.index,
|
|
142
141
|
attributes = _objectWithoutProperties(props, _excluded);
|
|
143
142
|
var _expandClassName = typeof expandedActiveClassNameForPanel !== 'undefined' ? expandedActiveClassNameForPanel : '';
|
|
144
|
-
var activedClassName = typeof defaultActive !== 'undefined' && defaultActive !== false ? "
|
|
143
|
+
var activedClassName = typeof defaultActive !== 'undefined' && defaultActive !== false ? " active ".concat(_expandClassName) : " ".concat(_expandClassName);
|
|
144
|
+
|
|
145
|
+
// !!!Special note:
|
|
146
|
+
// If you want to hide the tab in advance, please use `{ height: 0; overflow: hidden; }`, do not use `{ display: none }`
|
|
147
|
+
// Otherwise it will cause the scrollHeight of the element inside the child node to be 0
|
|
148
|
+
var activedStyles = typeof defaultActive !== 'undefined' && defaultActive !== false ? {} : {
|
|
149
|
+
height: '0',
|
|
150
|
+
overflow: 'hidden'
|
|
151
|
+
};
|
|
145
152
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", _extends({
|
|
146
153
|
"data-index": index,
|
|
147
154
|
"data-tabpanel-index": index,
|
|
148
155
|
role: "tabpanel",
|
|
149
156
|
id: targetId,
|
|
150
|
-
className: tabpanelClass ? "tab-pane
|
|
157
|
+
className: tabpanelClass ? "tab-pane d-block ".concat(tabpanelClass, " ").concat(activedClassName) : "tab-pane d-block ".concat(activedClassName),
|
|
158
|
+
style: activedStyles
|
|
151
159
|
}, attributes)));
|
|
152
160
|
};
|
|
153
161
|
/* harmony default export */ const src_TabPanel = (TabPanel);
|
|
@@ -178,6 +186,20 @@ var Tabs = function Tabs(props) {
|
|
|
178
186
|
var uniqueID = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useId)().replace(/\:/g, "-");
|
|
179
187
|
var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
180
188
|
var speed = animTransitionDuration ? animTransitionDuration : 150;
|
|
189
|
+
var elDisplay = function elDisplay(type, node) {
|
|
190
|
+
if (node === null) return;
|
|
191
|
+
|
|
192
|
+
// !!!Special note:
|
|
193
|
+
// If you want to hide the tab in advance, please use `{ height: 0; overflow: hidden; }`, do not use `{ display: none }`
|
|
194
|
+
// Otherwise it will cause the scrollHeight of the element inside the child node to be 0
|
|
195
|
+
if (type === 'hide') {
|
|
196
|
+
node.style.setProperty('height', '0');
|
|
197
|
+
node.style.setProperty('overflow', 'hidden');
|
|
198
|
+
} else {
|
|
199
|
+
node.style.removeProperty('height');
|
|
200
|
+
node.style.removeProperty('overflow');
|
|
201
|
+
}
|
|
202
|
+
};
|
|
181
203
|
function handleClickItem(e) {
|
|
182
204
|
e.preventDefault();
|
|
183
205
|
var el = e.currentTarget;
|
|
@@ -220,7 +242,8 @@ var Tabs = function Tabs(props) {
|
|
|
220
242
|
runExClassName(node.firstChild, _classNameNav, 'remove');
|
|
221
243
|
});
|
|
222
244
|
$allContent.forEach(function (node) {
|
|
223
|
-
|
|
245
|
+
//
|
|
246
|
+
elDisplay('hide', node);
|
|
224
247
|
setTimeout(function () {
|
|
225
248
|
node.classList.remove('active');
|
|
226
249
|
runExClassName(node, _classNamePanel, 'remove');
|
|
@@ -236,7 +259,8 @@ var Tabs = function Tabs(props) {
|
|
|
236
259
|
setTimeout(function () {
|
|
237
260
|
var _panel = document.getElementById(tabID);
|
|
238
261
|
if (_panel !== null) {
|
|
239
|
-
|
|
262
|
+
elDisplay('show', _panel);
|
|
263
|
+
_panel.classList.add('active');
|
|
240
264
|
runExClassName(_panel, _classNamePanel, 'add');
|
|
241
265
|
}
|
|
242
266
|
}, speed);
|
|
@@ -9,7 +9,6 @@ interface TextareaProps extends React.ComponentPropsWithoutRef<"textarea"> {
|
|
|
9
9
|
controlClassName?: string;
|
|
10
10
|
controlGroupWrapperClassName?: string;
|
|
11
11
|
controlGroupTextClassName?: string;
|
|
12
|
-
initializingText?: string;
|
|
13
12
|
value?: string;
|
|
14
13
|
label?: React.ReactNode | string;
|
|
15
14
|
name?: string;
|
|
@@ -144,26 +144,21 @@ const App = () => {
|
|
|
144
144
|
|
|
145
145
|
|
|
146
146
|
// Updates the height of a <textarea> when the value changes.
|
|
147
|
-
var useAutosizeTextArea = function useAutosizeTextArea(el, value
|
|
147
|
+
var useAutosizeTextArea = function useAutosizeTextArea(el, value) {
|
|
148
148
|
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
|
|
149
149
|
_useState2 = _slicedToArray(_useState, 2),
|
|
150
150
|
defaultRowHeight = _useState2[0],
|
|
151
151
|
setDefaultRowHeight = _useState2[1];
|
|
152
|
-
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(
|
|
152
|
+
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
153
153
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
157
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
158
|
-
defaultRowHeightInit = _useState6[0],
|
|
159
|
-
setDefaultRowHeightInit = _useState6[1];
|
|
154
|
+
defaultRowHeightInit = _useState4[0],
|
|
155
|
+
setDefaultRowHeightInit = _useState4[1];
|
|
160
156
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
161
157
|
if (el) {
|
|
162
158
|
// initialize default row height
|
|
163
159
|
if (el.scrollHeight > 0 && !defaultRowHeightInit) {
|
|
164
160
|
var style = el.currentStyle || window.getComputedStyle(el);
|
|
165
161
|
setDefaultRowHeight(el.scrollHeight + parseInt(style.borderTopWidth) + parseInt(style.borderBottomWidth));
|
|
166
|
-
setDynamicDefaultRowHeight(el.scrollHeight);
|
|
167
162
|
setDefaultRowHeightInit(true);
|
|
168
163
|
}
|
|
169
164
|
|
|
@@ -187,7 +182,7 @@ var useAutosizeTextArea = function useAutosizeTextArea(el, value, autoSizeBeginO
|
|
|
187
182
|
};
|
|
188
183
|
/* harmony default export */ const utils_useAutosizeTextArea = (useAutosizeTextArea);
|
|
189
184
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
190
|
-
var _excluded = ["wrapperClassName", "controlClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "
|
|
185
|
+
var _excluded = ["wrapperClassName", "controlClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "cols", "rows", "disabled", "required", "placeholder", "autoSize", "iconLeft", "iconRight", "readOnly", "value", "label", "name", "id", "maxLength", "style", "tabIndex", "onChangeCallback", "onInputCallback", "onKeyPressedCallback", "onChange", "onBlur", "onFocus"];
|
|
191
186
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
192
187
|
function src_slicedToArray(arr, i) { return src_arrayWithHoles(arr) || src_iterableToArrayLimit(arr, i) || src_unsupportedIterableToArray(arr, i) || src_nonIterableRest(); }
|
|
193
188
|
function src_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."); }
|
|
@@ -205,7 +200,6 @@ var Textarea = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
205
200
|
controlClassName = props.controlClassName,
|
|
206
201
|
controlGroupWrapperClassName = props.controlGroupWrapperClassName,
|
|
207
202
|
controlGroupTextClassName = props.controlGroupTextClassName,
|
|
208
|
-
initializingText = props.initializingText,
|
|
209
203
|
cols = props.cols,
|
|
210
204
|
rows = props.rows,
|
|
211
205
|
disabled = props.disabled,
|
|
@@ -237,11 +231,6 @@ var Textarea = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
237
231
|
_useState2 = src_slicedToArray(_useState, 2),
|
|
238
232
|
changedVal = _useState2[0],
|
|
239
233
|
setChangedVal = _useState2[1];
|
|
240
|
-
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
241
|
-
_useState4 = src_slicedToArray(_useState3, 2),
|
|
242
|
-
initTextStatus = _useState4[0],
|
|
243
|
-
setInitTextStatus = _useState4[1];
|
|
244
|
-
var INIT_TEXT = initializingText || 'Initializing...';
|
|
245
234
|
|
|
246
235
|
// auto size
|
|
247
236
|
utils_useAutosizeTextArea(autoSize ? valRef.current : null, autoSize ? changedVal : '');
|
|
@@ -304,20 +293,11 @@ var Textarea = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
304
293
|
//--------------
|
|
305
294
|
if (typeof value !== 'undefined' && value !== null) {
|
|
306
295
|
if (value.length > 0 && autoSize) {
|
|
307
|
-
setInitTextStatus(true);
|
|
308
|
-
|
|
309
296
|
// Recalculate height if default value exceeds initial height
|
|
310
297
|
setChangedVal("");
|
|
311
|
-
setTimeout(function () {
|
|
312
|
-
setChangedVal(" "); // spacing here
|
|
313
|
-
}, 0);
|
|
314
|
-
setTimeout(function () {
|
|
315
|
-
setChangedVal("");
|
|
316
|
-
}, 750);
|
|
317
298
|
setTimeout(function () {
|
|
318
299
|
setChangedVal("".concat(value));
|
|
319
|
-
|
|
320
|
-
}, 1500);
|
|
300
|
+
}, 0);
|
|
321
301
|
} else {
|
|
322
302
|
setChangedVal("".concat(value)); // Avoid displaying the number 0
|
|
323
303
|
}
|
|
@@ -349,7 +329,7 @@ var Textarea = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
349
329
|
className: controlClassName || controlClassName === '' ? controlClassName : "form-control",
|
|
350
330
|
id: idRes,
|
|
351
331
|
name: name,
|
|
352
|
-
placeholder:
|
|
332
|
+
placeholder: placeholder || '',
|
|
353
333
|
value: changedVal,
|
|
354
334
|
maxLength: maxLength || null,
|
|
355
335
|
onFocus: handleFocus,
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
interface TabPanelProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
5
|
-
fadeDisabled?: boolean;
|
|
6
5
|
defaultActive?: string | boolean | undefined;
|
|
7
6
|
expandedActiveClassNameForPanel?: string;
|
|
8
7
|
tabpanelClass?: string;
|
|
@@ -13,7 +12,6 @@ interface TabPanelProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
|
13
12
|
const TabPanel = (props: TabPanelProps) => {
|
|
14
13
|
|
|
15
14
|
const {
|
|
16
|
-
fadeDisabled,
|
|
17
15
|
defaultActive,
|
|
18
16
|
expandedActiveClassNameForPanel,
|
|
19
17
|
tabpanelClass,
|
|
@@ -24,12 +22,26 @@ const TabPanel = (props: TabPanelProps) => {
|
|
|
24
22
|
|
|
25
23
|
|
|
26
24
|
const _expandClassName = typeof(expandedActiveClassNameForPanel) !== 'undefined' ? expandedActiveClassNameForPanel : '';
|
|
27
|
-
const activedClassName = typeof(defaultActive) !== 'undefined' && defaultActive !== false ? `
|
|
25
|
+
const activedClassName = typeof(defaultActive) !== 'undefined' && defaultActive !== false ? ` active ${_expandClassName}` : ` ${_expandClassName}`;
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
// !!!Special note:
|
|
29
|
+
// If you want to hide the tab in advance, please use `{ height: 0; overflow: hidden; }`, do not use `{ display: none }`
|
|
30
|
+
// Otherwise it will cause the scrollHeight of the element inside the child node to be 0
|
|
31
|
+
const activedStyles = typeof(defaultActive) !== 'undefined' && defaultActive !== false ? {} : {height: '0', overflow: 'hidden'}
|
|
32
|
+
|
|
28
33
|
|
|
29
34
|
return (
|
|
30
35
|
<>
|
|
31
36
|
|
|
32
|
-
<div
|
|
37
|
+
<div
|
|
38
|
+
data-index={index}
|
|
39
|
+
data-tabpanel-index={index}
|
|
40
|
+
role="tabpanel" id={targetId}
|
|
41
|
+
className={ tabpanelClass ? `tab-pane d-block ${tabpanelClass} ${activedClassName}` : `tab-pane d-block ${activedClassName}`}
|
|
42
|
+
style={activedStyles}
|
|
43
|
+
{...attributes}
|
|
44
|
+
></div>
|
|
33
45
|
|
|
34
46
|
</>
|
|
35
47
|
)
|
package/lib/esm/Tabs/Tabs.tsx
CHANGED
|
@@ -41,6 +41,24 @@ const Tabs = (props: TabsProps) => {
|
|
|
41
41
|
const speed = animTransitionDuration ? animTransitionDuration : 150;
|
|
42
42
|
|
|
43
43
|
|
|
44
|
+
|
|
45
|
+
const elDisplay = (type: string, node: HTMLElement) => {
|
|
46
|
+
if (node === null) return;
|
|
47
|
+
|
|
48
|
+
// !!!Special note:
|
|
49
|
+
// If you want to hide the tab in advance, please use `{ height: 0; overflow: hidden; }`, do not use `{ display: none }`
|
|
50
|
+
// Otherwise it will cause the scrollHeight of the element inside the child node to be 0
|
|
51
|
+
if (type === 'hide') {
|
|
52
|
+
node.style.setProperty('height', '0');
|
|
53
|
+
node.style.setProperty('overflow', 'hidden');
|
|
54
|
+
} else {
|
|
55
|
+
node.style.removeProperty('height');
|
|
56
|
+
node.style.removeProperty('overflow');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
|
|
44
62
|
function handleClickItem(e: any) {
|
|
45
63
|
e.preventDefault();
|
|
46
64
|
|
|
@@ -97,7 +115,10 @@ const Tabs = (props: TabsProps) => {
|
|
|
97
115
|
|
|
98
116
|
|
|
99
117
|
$allContent.forEach( (node) => {
|
|
100
|
-
|
|
118
|
+
//
|
|
119
|
+
elDisplay('hide', node);
|
|
120
|
+
|
|
121
|
+
|
|
101
122
|
setTimeout(() => {
|
|
102
123
|
node.classList.remove('active');
|
|
103
124
|
runExClassName(node, _classNamePanel, 'remove');
|
|
@@ -115,7 +136,10 @@ const Tabs = (props: TabsProps) => {
|
|
|
115
136
|
setTimeout(() => {
|
|
116
137
|
const _panel = document.getElementById(tabID) as HTMLElement;
|
|
117
138
|
if ( _panel !== null ) {
|
|
118
|
-
|
|
139
|
+
|
|
140
|
+
elDisplay('show', _panel);
|
|
141
|
+
|
|
142
|
+
_panel.classList.add('active');
|
|
119
143
|
runExClassName(_panel, _classNamePanel, 'add');
|
|
120
144
|
}
|
|
121
145
|
}, speed);
|
|
@@ -13,7 +13,6 @@ interface TextareaProps extends React.ComponentPropsWithoutRef<"textarea"> {
|
|
|
13
13
|
controlClassName?: string;
|
|
14
14
|
controlGroupWrapperClassName?: string;
|
|
15
15
|
controlGroupTextClassName?: string;
|
|
16
|
-
initializingText?: string;
|
|
17
16
|
value?: string;
|
|
18
17
|
label?: React.ReactNode | string;
|
|
19
18
|
name?: string;
|
|
@@ -47,7 +46,6 @@ const Textarea = forwardRef((props: TextareaProps, ref: any) => {
|
|
|
47
46
|
controlClassName,
|
|
48
47
|
controlGroupWrapperClassName,
|
|
49
48
|
controlGroupTextClassName,
|
|
50
|
-
initializingText,
|
|
51
49
|
cols,
|
|
52
50
|
rows,
|
|
53
51
|
disabled,
|
|
@@ -79,8 +77,6 @@ const Textarea = forwardRef((props: TextareaProps, ref: any) => {
|
|
|
79
77
|
const rootRef = useRef<any>(null);
|
|
80
78
|
const valRef = useRef<any>(null);
|
|
81
79
|
const [changedVal, setChangedVal] = useState<string>(value || '');
|
|
82
|
-
const [initTextStatus, setInitTextStatus] = useState<boolean>(false);
|
|
83
|
-
const INIT_TEXT = initializingText || 'Initializing...'
|
|
84
80
|
|
|
85
81
|
|
|
86
82
|
// auto size
|
|
@@ -156,22 +152,12 @@ const Textarea = forwardRef((props: TextareaProps, ref: any) => {
|
|
|
156
152
|
|
|
157
153
|
if (value.length > 0 && autoSize) {
|
|
158
154
|
|
|
159
|
-
setInitTextStatus(true);
|
|
160
|
-
|
|
161
155
|
// Recalculate height if default value exceeds initial height
|
|
162
156
|
setChangedVal(``);
|
|
163
157
|
setTimeout(() => {
|
|
164
|
-
setChangedVal(`
|
|
158
|
+
setChangedVal(`${value}`);
|
|
165
159
|
}, 0);
|
|
166
160
|
|
|
167
|
-
setTimeout(() => {
|
|
168
|
-
setChangedVal(``);
|
|
169
|
-
}, 750);
|
|
170
|
-
|
|
171
|
-
setTimeout(() => {
|
|
172
|
-
setChangedVal(`${value}`);
|
|
173
|
-
setInitTextStatus(false);
|
|
174
|
-
}, 1500);
|
|
175
161
|
} else {
|
|
176
162
|
setChangedVal(`${value}`); // Avoid displaying the number 0
|
|
177
163
|
}
|
|
@@ -203,7 +189,7 @@ const Textarea = forwardRef((props: TextareaProps, ref: any) => {
|
|
|
203
189
|
className={controlClassName || controlClassName === '' ? controlClassName : "form-control"}
|
|
204
190
|
id={idRes}
|
|
205
191
|
name={name}
|
|
206
|
-
placeholder={
|
|
192
|
+
placeholder={placeholder || ''}
|
|
207
193
|
value={changedVal}
|
|
208
194
|
maxLength={maxLength || null}
|
|
209
195
|
onFocus={handleFocus}
|
|
@@ -37,12 +37,10 @@ import { useEffect, useState } from "react";
|
|
|
37
37
|
// Updates the height of a <textarea> when the value changes.
|
|
38
38
|
const useAutosizeTextArea = (
|
|
39
39
|
el,
|
|
40
|
-
value
|
|
41
|
-
autoSizeBeginOneline
|
|
40
|
+
value
|
|
42
41
|
) => {
|
|
43
42
|
|
|
44
43
|
const [defaultRowHeight, setDefaultRowHeight] = useState(0);
|
|
45
|
-
const [dynamicDefaultRowHeight, setDynamicDefaultRowHeight] = useState(0);
|
|
46
44
|
const [defaultRowHeightInit, setDefaultRowHeightInit] = useState(false);
|
|
47
45
|
|
|
48
46
|
useEffect(() => {
|
|
@@ -53,11 +51,9 @@ const useAutosizeTextArea = (
|
|
|
53
51
|
if (el.scrollHeight > 0 && !defaultRowHeightInit) {
|
|
54
52
|
const style = el.currentStyle || window.getComputedStyle(el);
|
|
55
53
|
setDefaultRowHeight(el.scrollHeight + parseInt(style.borderTopWidth) + parseInt(style.borderBottomWidth));
|
|
56
|
-
setDynamicDefaultRowHeight(el.scrollHeight);
|
|
57
54
|
setDefaultRowHeightInit(true);
|
|
58
55
|
}
|
|
59
56
|
|
|
60
|
-
|
|
61
57
|
// restore default row height
|
|
62
58
|
if (defaultRowHeight > 0) {
|
|
63
59
|
el.style.height = defaultRowHeight + "px";
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "UIUX Lab",
|
|
3
3
|
"email": "uiuxlab@gmail.com",
|
|
4
4
|
"name": "funda-ui",
|
|
5
|
-
"version": "2.0.
|
|
5
|
+
"version": "2.0.375",
|
|
6
6
|
"description": "React components using pure Bootstrap 5+ which does not contain any external style and script libraries.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|