authscape 1.0.324 → 1.0.325

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/index.js CHANGED
@@ -115,6 +115,73 @@ function AuthScapeApp(_ref) {
115
115
  }
116
116
  "use strict";
117
117
 
118
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
119
+ Object.defineProperty(exports, "__esModule", {
120
+ value: true
121
+ });
122
+ exports.AutoSaveTextField = AutoSaveTextField;
123
+ var _react = _interopRequireWildcard(require("react"));
124
+ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
125
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
126
+ 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); }
127
+ 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; }
128
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
129
+ 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."); }
130
+ 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); }
131
+ 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; }
132
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
133
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
134
+ function AutoSaveTextField(_ref) {
135
+ var _ref$label = _ref.label,
136
+ label = _ref$label === void 0 ? "" : _ref$label,
137
+ _ref$variant = _ref.variant,
138
+ variant = _ref$variant === void 0 ? "outlined" : _ref$variant,
139
+ _ref$timeout = _ref.timeout,
140
+ timeout = _ref$timeout === void 0 ? 2000 : _ref$timeout,
141
+ _ref$isMultiLine = _ref.isMultiLine,
142
+ isMultiLine = _ref$isMultiLine === void 0 ? false : _ref$isMultiLine,
143
+ _ref$rows = _ref.rows,
144
+ rows = _ref$rows === void 0 ? 1 : _ref$rows,
145
+ _ref$fullWidth = _ref.fullWidth,
146
+ fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
147
+ _ref$onChanged = _ref.onChanged,
148
+ onChanged = _ref$onChanged === void 0 ? null : _ref$onChanged;
149
+ var _useState = (0, _react.useState)(''),
150
+ _useState2 = _slicedToArray(_useState, 2),
151
+ text = _useState2[0],
152
+ setText = _useState2[1];
153
+ (0, _react.useEffect)(function () {
154
+ // Simulate saving text to a server or any storage mechanism
155
+ // In a real-world scenario, you would send a request to a server to save the text
156
+ // For this example, we'll just update the savedText state after 2 seconds
157
+ var saveTimeout = setTimeout(function () {
158
+ if (onChanged != null) {
159
+ onChanged(text);
160
+ }
161
+ }, timeout);
162
+
163
+ // Clean up the timeout to avoid unnecessary saves if the text changes again
164
+ return function () {
165
+ return clearTimeout(saveTimeout);
166
+ };
167
+ }, [text]);
168
+ var handleTextChange = function handleTextChange(event) {
169
+ var newText = event.target.value;
170
+ setText(newText);
171
+ };
172
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
173
+ label: label,
174
+ fullWidth: fullWidth,
175
+ variant: variant,
176
+ multiline: isMultiLine,
177
+ rows: rows,
178
+ value: text,
179
+ onChange: handleTextChange
180
+ }));
181
+ }
182
+ ;
183
+ "use strict";
184
+
118
185
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
119
186
  Object.defineProperty(exports, "__esModule", {
120
187
  value: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.324",
3
+ "version": "1.0.325",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,40 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import TextField from '@mui/material/TextField';
3
+
4
+ export function AutoSaveTextField ({label = "", variant = "outlined", timeout = 2000, isMultiLine = false, rows = 1, fullWidth = false, onChanged = null}) {
5
+ const [text, setText] = useState('');
6
+
7
+ useEffect(() => {
8
+ // Simulate saving text to a server or any storage mechanism
9
+ // In a real-world scenario, you would send a request to a server to save the text
10
+ // For this example, we'll just update the savedText state after 2 seconds
11
+ const saveTimeout = setTimeout(() => {
12
+ if (onChanged != null)
13
+ {
14
+ onChanged(text);
15
+ }
16
+ }, timeout);
17
+
18
+ // Clean up the timeout to avoid unnecessary saves if the text changes again
19
+ return () => clearTimeout(saveTimeout);
20
+ }, [text]);
21
+
22
+ const handleTextChange = (event) => {
23
+ const newText = event.target.value;
24
+ setText(newText);
25
+ };
26
+
27
+ return (
28
+ <div>
29
+ <TextField
30
+ label={label}
31
+ fullWidth={fullWidth}
32
+ variant={variant}
33
+ multiline={isMultiLine}
34
+ rows={rows}
35
+ value={text}
36
+ onChange={handleTextChange}
37
+ />
38
+ </div>
39
+ );
40
+ };