funda-ui 2.0.325 → 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 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 = ["fadeDisabled", "defaultActive", "expandedActiveClassNameForPanel", "tabpanelClass", "targetId", "index"];
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 fadeDisabled = props.fadeDisabled,
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 ? " show active ".concat(_expandClassName) : " ".concat(_expandClassName);
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 ".concat(fadeDisabled ? '' : 'fade', " ").concat(tabpanelClass, " ").concat(activedClassName) : "tab-pane ".concat(fadeDisabled ? '' : 'fade', " ").concat(activedClassName)
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
- node.classList.remove('show');
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
- _panel.classList.add('active', 'show');
262
+ elDisplay('show', _panel);
263
+ _panel.classList.add('active');
240
264
  runExClassName(_panel, _classNamePanel, 'add');
241
265
  }
242
266
  }, speed);
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, autoSizeBeginOneline) {
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)(0),
152
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
153
153
  _useState4 = _slicedToArray(_useState3, 2),
154
- dynamicDefaultRowHeight = _useState4[0],
155
- setDynamicDefaultRowHeight = _useState4[1];
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
 
@@ -299,7 +294,7 @@ var Textarea = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
299
294
  if (typeof value !== 'undefined' && value !== null) {
300
295
  if (value.length > 0 && autoSize) {
301
296
  // Recalculate height if default value exceeds initial height
302
- setChangedVal('');
297
+ setChangedVal("");
303
298
  setTimeout(function () {
304
299
  setChangedVal("".concat(value));
305
300
  }, 0);
@@ -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 = ["fadeDisabled", "defaultActive", "expandedActiveClassNameForPanel", "tabpanelClass", "targetId", "index"];
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 fadeDisabled = props.fadeDisabled,
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 ? " show active ".concat(_expandClassName) : " ".concat(_expandClassName);
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 ".concat(fadeDisabled ? '' : 'fade', " ").concat(tabpanelClass, " ").concat(activedClassName) : "tab-pane ".concat(fadeDisabled ? '' : 'fade', " ").concat(activedClassName)
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
- node.classList.remove('show');
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
- _panel.classList.add('active', 'show');
262
+ elDisplay('show', _panel);
263
+ _panel.classList.add('active');
240
264
  runExClassName(_panel, _classNamePanel, 'add');
241
265
  }
242
266
  }, speed);
@@ -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, autoSizeBeginOneline) {
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)(0),
152
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
153
153
  _useState4 = _slicedToArray(_useState3, 2),
154
- dynamicDefaultRowHeight = _useState4[0],
155
- setDynamicDefaultRowHeight = _useState4[1];
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
 
@@ -299,7 +294,7 @@ var Textarea = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
299
294
  if (typeof value !== 'undefined' && value !== null) {
300
295
  if (value.length > 0 && autoSize) {
301
296
  // Recalculate height if default value exceeds initial height
302
- setChangedVal('');
297
+ setChangedVal("");
303
298
  setTimeout(function () {
304
299
  setChangedVal("".concat(value));
305
300
  }, 0);
@@ -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 ? ` show active ${_expandClassName}` : ` ${_expandClassName}`;
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 data-index={index} data-tabpanel-index={index} role="tabpanel" id={targetId} className={ tabpanelClass ? `tab-pane ${fadeDisabled ? '' : 'fade'} ${tabpanelClass} ${activedClassName}` : `tab-pane ${fadeDisabled ? '' : 'fade'} ${activedClassName}`} {...attributes}></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
  )
@@ -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
- node.classList.remove('show');
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
- _panel.classList.add('active', 'show');
139
+
140
+ elDisplay('show', _panel);
141
+
142
+ _panel.classList.add('active');
119
143
  runExClassName(_panel, _classNamePanel, 'add');
120
144
  }
121
145
  }, speed);
@@ -145,17 +145,19 @@ const Textarea = forwardRef((props: TextareaProps, ref: any) => {
145
145
 
146
146
  useEffect(() => {
147
147
 
148
+
148
149
  // update default value
149
150
  //--------------
150
151
  if (typeof value !== 'undefined' && value !== null) {
151
-
152
-
152
+
153
153
  if (value.length > 0 && autoSize) {
154
+
154
155
  // Recalculate height if default value exceeds initial height
155
- setChangedVal('');
156
+ setChangedVal(``);
156
157
  setTimeout(() => {
157
158
  setChangedVal(`${value}`);
158
159
  }, 0);
160
+
159
161
  } else {
160
162
  setChangedVal(`${value}`); // Avoid displaying the number 0
161
163
  }
@@ -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.325",
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",