@vendorflow/components 2.1.0 → 3.0.4
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/lib/components/index.d.ts +1 -1
- package/lib/components/material-ui/DataTable/Data.d.ts +1 -1
- package/lib/components/material-ui/DataTable/DataTable.d.ts +9 -76
- package/lib/components/material-ui/DataTable/FilterTool/Filters/MultiSelectFilter.d.ts +1 -1
- package/lib/components/material-ui/DataTable/FilterTool/Filters/RangeFilter.d.ts +1 -1
- package/lib/components/material-ui/DataTable/FilterTool/Filters/SingleSelectFilter.d.ts +1 -1
- package/lib/components/material-ui/DataTable/FilterTool/Filters/TextFilter.d.ts +1 -1
- package/lib/components/material-ui/DataTable/FilterTool/index.d.ts +2 -2
- package/lib/components/material-ui/DataTable/TablePieces/BodyRow.d.ts +1 -1
- package/lib/components/material-ui/DataTable/TablePieces/HeaderCell.d.ts +1 -1
- package/lib/components/material-ui/DataTable/TablePieces/Toolbar.d.ts +1 -1
- package/lib/components/material-ui/DataTable/index.d.ts +1 -1
- package/lib/index.js +3 -14
- package/lib/index.js.LICENSE.txt +35 -0
- package/lib/index.js.map +1 -0
- package/lib/types/DataTable.types.d.ts +69 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +20 -99
- package/lib/TempHooks.d.ts +0 -9
- package/lib/TempHooks.js +0 -25
- package/lib/components/InfiniteScroll/InfiniteScroll.d.ts +0 -16
- package/lib/components/InfiniteScroll/InfiniteScroll.js +0 -159
- package/lib/components/InfiniteScroll/index.d.ts +0 -1
- package/lib/components/InfiniteScroll/index.js +0 -8
- package/lib/components/blueprint/InputGroup/InputGroup.d.ts +0 -20
- package/lib/components/blueprint/InputGroup/InputGroup.js +0 -13
- package/lib/components/blueprint/InputGroup/InputGroup.story.d.ts +0 -2
- package/lib/components/blueprint/InputGroup/InputGroup.story.js +0 -11
- package/lib/components/blueprint/InputGroup/index.d.ts +0 -1
- package/lib/components/blueprint/InputGroup/index.js +0 -4
- package/lib/components/blueprint/InputSelect/InputSelect.d.ts +0 -51
- package/lib/components/blueprint/InputSelect/InputSelect.js +0 -98
- package/lib/components/blueprint/InputSelect/InputSelect.story.d.ts +0 -3
- package/lib/components/blueprint/InputSelect/InputSelect.story.js +0 -19
- package/lib/components/blueprint/InputSelect/index.d.ts +0 -1
- package/lib/components/blueprint/InputSelect/index.js +0 -4
- package/lib/components/blueprint/InputTime/InputTime.d.ts +0 -24
- package/lib/components/blueprint/InputTime/InputTime.js +0 -28
- package/lib/components/blueprint/InputTime/InputTime.story.d.ts +0 -2
- package/lib/components/blueprint/InputTime/InputTime.story.js +0 -11
- package/lib/components/blueprint/InputTime/index.d.ts +0 -1
- package/lib/components/blueprint/InputTime/index.js +0 -4
- package/lib/components/index.js +0 -32
- package/lib/components/material-ui/AudioPlayer/AudioPlayer.js +0 -111
- package/lib/components/material-ui/AudioPlayer/AudioPlayer.story.js +0 -9
- package/lib/components/material-ui/AudioPlayer/index.js +0 -8
- package/lib/components/material-ui/Button/Button.js +0 -38
- package/lib/components/material-ui/Button/Button.story.js +0 -9
- package/lib/components/material-ui/Button/index.js +0 -8
- package/lib/components/material-ui/ButtonMenu/ButtonMenu.js +0 -115
- package/lib/components/material-ui/ButtonMenu/ButtonMenu.story.js +0 -79
- package/lib/components/material-ui/ButtonMenu/index.js +0 -8
- package/lib/components/material-ui/ChatInterface/ActionsMenu.d.ts +0 -4
- package/lib/components/material-ui/ChatInterface/ActionsMenu.js +0 -37
- package/lib/components/material-ui/ChatInterface/ChatInterface.d.ts +0 -33
- package/lib/components/material-ui/ChatInterface/ChatInterface.js +0 -109
- package/lib/components/material-ui/ChatInterface/ChatInterface.story.d.ts +0 -1
- package/lib/components/material-ui/ChatInterface/ChatInterface.story.js +0 -134
- package/lib/components/material-ui/ChatInterface/MessageInput.d.ts +0 -9
- package/lib/components/material-ui/ChatInterface/MessageInput.js +0 -53
- package/lib/components/material-ui/ChatInterface/MessageItem.d.ts +0 -8
- package/lib/components/material-ui/ChatInterface/MessageItem.js +0 -71
- package/lib/components/material-ui/ChatInterface/MessageThread.d.ts +0 -6
- package/lib/components/material-ui/ChatInterface/MessageThread.js +0 -119
- package/lib/components/material-ui/ChatInterface/index.d.ts +0 -1
- package/lib/components/material-ui/ChatInterface/index.js +0 -8
- package/lib/components/material-ui/ColorPicker/ColorPicker.js +0 -86
- package/lib/components/material-ui/ColorPicker/ColorPicker.story.js +0 -47
- package/lib/components/material-ui/ColorPicker/index.js +0 -8
- package/lib/components/material-ui/ColorPicker/styles.js +0 -24
- package/lib/components/material-ui/DataTable/AppliedFilters.d.ts +0 -12
- package/lib/components/material-ui/DataTable/AppliedFilters.js +0 -26
- package/lib/components/material-ui/DataTable/Data.js +0 -42
- package/lib/components/material-ui/DataTable/DataTable.js +0 -363
- package/lib/components/material-ui/DataTable/DataTable.story.js +0 -76
- package/lib/components/material-ui/DataTable/FilterTool/Filters/MultiSelectFilter.js +0 -63
- package/lib/components/material-ui/DataTable/FilterTool/Filters/RangeFilter.js +0 -76
- package/lib/components/material-ui/DataTable/FilterTool/Filters/SingleSelectFilter.js +0 -69
- package/lib/components/material-ui/DataTable/FilterTool/Filters/TextFilter.js +0 -52
- package/lib/components/material-ui/DataTable/FilterTool/index.js +0 -78
- package/lib/components/material-ui/DataTable/GlobalSearchFilter.d.ts +0 -10
- package/lib/components/material-ui/DataTable/GlobalSearchFilter.js +0 -49
- package/lib/components/material-ui/DataTable/IndeterminateCheckbox.d.ts +0 -4
- package/lib/components/material-ui/DataTable/IndeterminateCheckbox.js +0 -65
- package/lib/components/material-ui/DataTable/SortIndicator.d.ts +0 -10
- package/lib/components/material-ui/DataTable/SortIndicator.js +0 -33
- package/lib/components/material-ui/DataTable/TablePieces/AppliedFilters.js +0 -26
- package/lib/components/material-ui/DataTable/TablePieces/BodyCell.js +0 -50
- package/lib/components/material-ui/DataTable/TablePieces/BodyRow.js +0 -88
- package/lib/components/material-ui/DataTable/TablePieces/GlobalSearchFilter.js +0 -49
- package/lib/components/material-ui/DataTable/TablePieces/HeaderCell.js +0 -57
- package/lib/components/material-ui/DataTable/TablePieces/IndeterminateCheckbox.js +0 -65
- package/lib/components/material-ui/DataTable/TablePieces/SortIndicator.js +0 -33
- package/lib/components/material-ui/DataTable/TablePieces/Table.js +0 -47
- package/lib/components/material-ui/DataTable/TablePieces/TableBodyContent.js +0 -89
- package/lib/components/material-ui/DataTable/TablePieces/Toolbar.js +0 -59
- package/lib/components/material-ui/DataTable/TablePieces/ViewColumnTool.js +0 -77
- package/lib/components/material-ui/DataTable/Toolbar.d.ts +0 -24
- package/lib/components/material-ui/DataTable/Toolbar.js +0 -63
- package/lib/components/material-ui/DataTable/Utils.d.ts +0 -25
- package/lib/components/material-ui/DataTable/Utils.js +0 -119
- package/lib/components/material-ui/DataTable/ViewColumnTool.d.ts +0 -11
- package/lib/components/material-ui/DataTable/ViewColumnTool.js +0 -76
- package/lib/components/material-ui/DataTable/index.js +0 -8
- package/lib/components/material-ui/ErrorBoundary/ErrorBoundary.d.ts +0 -7
- package/lib/components/material-ui/ErrorBoundary/ErrorBoundary.js +0 -20
- package/lib/components/material-ui/ErrorBoundary/index.d.ts +0 -1
- package/lib/components/material-ui/ErrorBoundary/index.js +0 -8
- package/lib/components/material-ui/InputCheckboxGroup/InputCheckboxGroup.js +0 -99
- package/lib/components/material-ui/InputCheckboxGroup/InputCheckboxGroup.story.js +0 -52
- package/lib/components/material-ui/InputCheckboxGroup/index.js +0 -8
- package/lib/components/material-ui/InputDate/InputDate.js +0 -93
- package/lib/components/material-ui/InputDate/InputDate.story.js +0 -53
- package/lib/components/material-ui/InputDate/index.js +0 -8
- package/lib/components/material-ui/InputDateTime/InputDateTime.js +0 -82
- package/lib/components/material-ui/InputDateTime/InputDateTime.story.js +0 -53
- package/lib/components/material-ui/InputDateTime/index.js +0 -8
- package/lib/components/material-ui/InputGroup/InputGroup.js +0 -91
- package/lib/components/material-ui/InputGroup/InputGroup.story.js +0 -50
- package/lib/components/material-ui/InputGroup/index.js +0 -8
- package/lib/components/material-ui/InputRadioGroup/InputRadioGroup.js +0 -82
- package/lib/components/material-ui/InputRadioGroup/InputRadioGroup.story.js +0 -52
- package/lib/components/material-ui/InputRadioGroup/index.js +0 -8
- package/lib/components/material-ui/InputSearchDropdown/InputSearchDropdown.js +0 -146
- package/lib/components/material-ui/InputSearchDropdown/InputSearchDropdown.story.js +0 -66
- package/lib/components/material-ui/InputSearchDropdown/index.js +0 -8
- package/lib/components/material-ui/InputTime/InputTime.js +0 -82
- package/lib/components/material-ui/InputTime/InputTime.story.js +0 -53
- package/lib/components/material-ui/InputTime/index.js +0 -8
- package/lib/components/material-ui/Modal/Modal.js +0 -57
- package/lib/components/material-ui/Modal/Modal.story.js +0 -83
- package/lib/components/material-ui/Modal/index.js +0 -8
- package/lib/services/Select.service.d.ts +0 -5
- package/lib/services/Select.service.js +0 -67
- package/lib/stories/0-Inputs.stories.d.ts +0 -17
- package/lib/stories/0-Inputs.stories.js +0 -38
- package/lib/types/Component.types.js +0 -2
- package/lib/types/Internal.types.js +0 -2
- package/lib/types/index.js +0 -13
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
22
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
23
|
-
if (!m) return o;
|
|
24
|
-
var i = m.call(o), r, ar = [], e;
|
|
25
|
-
try {
|
|
26
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
27
|
-
}
|
|
28
|
-
catch (error) { e = { error: error }; }
|
|
29
|
-
finally {
|
|
30
|
-
try {
|
|
31
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
32
|
-
}
|
|
33
|
-
finally { if (e) throw e.error; }
|
|
34
|
-
}
|
|
35
|
-
return ar;
|
|
36
|
-
};
|
|
37
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
|
-
};
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
var react_1 = __importStar(require("react"));
|
|
42
|
-
var lab_1 = require("@mui/lab");
|
|
43
|
-
var AdapterDateFns_1 = __importDefault(require("@mui/lab/AdapterDateFns"));
|
|
44
|
-
var InputDate_1 = __importDefault(require("./InputDate"));
|
|
45
|
-
var InputDate = function () {
|
|
46
|
-
var _a = __read((0, react_1.useState)(null), 2), value = _a[0], setValue = _a[1];
|
|
47
|
-
return (react_1.default.createElement(lab_1.LocalizationProvider, { dateAdapter: AdapterDateFns_1.default },
|
|
48
|
-
react_1.default.createElement(InputDate_1.default, { label: "Bedtime", value: value, onChange: function (_a) {
|
|
49
|
-
var value = _a.target.value;
|
|
50
|
-
return setValue(value);
|
|
51
|
-
}, InputProps: { helperText: 'Go to sleep', error: true } })));
|
|
52
|
-
};
|
|
53
|
-
exports.default = InputDate;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var InputDate_1 = require("./InputDate");
|
|
8
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(InputDate_1).default; } });
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
-
if (mod && mod.__esModule) return mod;
|
|
27
|
-
var result = {};
|
|
28
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
-
__setModuleDefault(result, mod);
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
33
|
-
var t = {};
|
|
34
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
35
|
-
t[p] = s[p];
|
|
36
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
37
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
38
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39
|
-
t[p[i]] = s[p[i]];
|
|
40
|
-
}
|
|
41
|
-
return t;
|
|
42
|
-
};
|
|
43
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
44
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
45
|
-
if (!m) return o;
|
|
46
|
-
var i = m.call(o), r, ar = [], e;
|
|
47
|
-
try {
|
|
48
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
49
|
-
}
|
|
50
|
-
catch (error) { e = { error: error }; }
|
|
51
|
-
finally {
|
|
52
|
-
try {
|
|
53
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
54
|
-
}
|
|
55
|
-
finally { if (e) throw e.error; }
|
|
56
|
-
}
|
|
57
|
-
return ar;
|
|
58
|
-
};
|
|
59
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
-
var react_1 = __importStar(require("react"));
|
|
61
|
-
var date_fns_1 = require("date-fns");
|
|
62
|
-
var lab_1 = require("@mui/lab");
|
|
63
|
-
var material_1 = require("@mui/material");
|
|
64
|
-
var nanoid_1 = require("nanoid");
|
|
65
|
-
function InputDateTime(props) {
|
|
66
|
-
var _a = props.clearable, clearable = _a === void 0 ? true : _a, _b = props.inputFormat, inputFormat = _b === void 0 ? 'MM/dd/yyyy HH:mm' : _b, _c = props.InputProps, InputProps = _c === void 0 ? {} : _c, label = props.label, name = props.name, onChange = props.onChange, restOfProps = __rest(props, ["clearable", "inputFormat", "InputProps", "label", "name", "onChange"]);
|
|
67
|
-
var id = (0, react_1.useRef)((0, nanoid_1.nanoid)());
|
|
68
|
-
var _d = __read((0, react_1.useState)(null), 2), value = _d[0], setValue = _d[1];
|
|
69
|
-
(0, react_1.useEffect)(function () {
|
|
70
|
-
if (props.value !== value) {
|
|
71
|
-
setValue(props.value);
|
|
72
|
-
}
|
|
73
|
-
}, [props.value]);
|
|
74
|
-
function handleOnChange(date) {
|
|
75
|
-
setValue(date);
|
|
76
|
-
if (date === null || (0, date_fns_1.isValid)(date)) {
|
|
77
|
-
onChange({ target: { name: name, value: date ? (0, date_fns_1.formatISO)(date) : null } });
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return (react_1.default.createElement(lab_1.DateTimePicker, __assign({}, restOfProps, { clearable: clearable, inputFormat: inputFormat, label: label, onChange: handleOnChange, renderInput: function (params) { return (react_1.default.createElement(material_1.TextField, __assign({}, params, InputProps, { id: id.current, size: (InputProps === null || InputProps === void 0 ? void 0 : InputProps.size) || 'small' }))); }, value: value })));
|
|
81
|
-
}
|
|
82
|
-
exports.default = InputDateTime;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
22
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
23
|
-
if (!m) return o;
|
|
24
|
-
var i = m.call(o), r, ar = [], e;
|
|
25
|
-
try {
|
|
26
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
27
|
-
}
|
|
28
|
-
catch (error) { e = { error: error }; }
|
|
29
|
-
finally {
|
|
30
|
-
try {
|
|
31
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
32
|
-
}
|
|
33
|
-
finally { if (e) throw e.error; }
|
|
34
|
-
}
|
|
35
|
-
return ar;
|
|
36
|
-
};
|
|
37
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
|
-
};
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
var react_1 = __importStar(require("react"));
|
|
42
|
-
var lab_1 = require("@mui/lab");
|
|
43
|
-
var InputDateTime_1 = __importDefault(require("./InputDateTime"));
|
|
44
|
-
var AdapterDateFns_1 = __importDefault(require("@mui/lab/AdapterDateFns"));
|
|
45
|
-
var InputDateTime = function () {
|
|
46
|
-
var _a = __read((0, react_1.useState)(null), 2), value = _a[0], setValue = _a[1];
|
|
47
|
-
return (react_1.default.createElement(lab_1.LocalizationProvider, { dateAdapter: AdapterDateFns_1.default },
|
|
48
|
-
react_1.default.createElement(InputDateTime_1.default, { label: "Appointment", value: value, onChange: function (_a) {
|
|
49
|
-
var value = _a.target.value;
|
|
50
|
-
return setValue(value);
|
|
51
|
-
} })));
|
|
52
|
-
};
|
|
53
|
-
exports.default = InputDateTime;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var InputDateTime_1 = require("./InputDateTime");
|
|
8
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(InputDateTime_1).default; } });
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __assign = (this && this.__assign) || function () {
|
|
7
|
-
__assign = Object.assign || function(t) {
|
|
8
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
-
s = arguments[i];
|
|
10
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
-
t[p] = s[p];
|
|
12
|
-
}
|
|
13
|
-
return t;
|
|
14
|
-
};
|
|
15
|
-
return __assign.apply(this, arguments);
|
|
16
|
-
};
|
|
17
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
18
|
-
var t = {};
|
|
19
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
20
|
-
t[p] = s[p];
|
|
21
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
22
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
24
|
-
t[p[i]] = s[p[i]];
|
|
25
|
-
}
|
|
26
|
-
return t;
|
|
27
|
-
};
|
|
28
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
29
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
30
|
-
if (!m) return o;
|
|
31
|
-
var i = m.call(o), r, ar = [], e;
|
|
32
|
-
try {
|
|
33
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
34
|
-
}
|
|
35
|
-
catch (error) { e = { error: error }; }
|
|
36
|
-
finally {
|
|
37
|
-
try {
|
|
38
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
39
|
-
}
|
|
40
|
-
finally { if (e) throw e.error; }
|
|
41
|
-
}
|
|
42
|
-
return ar;
|
|
43
|
-
};
|
|
44
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
/** @jsxRuntime classic */
|
|
46
|
-
/** @jsx jsx */
|
|
47
|
-
var react_1 = require("@emotion/react");
|
|
48
|
-
var react_2 = require("react");
|
|
49
|
-
var lodash_1 = require("lodash");
|
|
50
|
-
var material_1 = require("@mui/material");
|
|
51
|
-
var nanoid_1 = require("nanoid");
|
|
52
|
-
function InputGroup(props) {
|
|
53
|
-
var changeValidator = props.changeValidator, charLimit = props.charLimit, className = props.className, hideCharCounter = props.hideCharCounter, _a = props.enableDebouncedOnChange, enableDebouncedOnChange = _a === void 0 ? true : _a, multiline = props.multiline, error = props.error, label = props.label, name = props.name, onChange = props.onChange, placeholder = props.placeholder, helperText = props.helperText, _b = props.variant, variant = _b === void 0 ? 'outlined' : _b, style = props.style, propsValue = props.value, _c = props.size, size = _c === void 0 ? 'small' : _c, restOfProps = __rest(props, ["changeValidator", "charLimit", "className", "hideCharCounter", "enableDebouncedOnChange", "multiline", "error", "label", "name", "onChange", "placeholder", "helperText", "variant", "style", "value", "size"]);
|
|
54
|
-
var id = (0, react_2.useRef)((0, nanoid_1.nanoid)());
|
|
55
|
-
var _d = __read((0, react_2.useState)(''), 2), value = _d[0], setValue = _d[1];
|
|
56
|
-
(0, react_2.useEffect)(function () {
|
|
57
|
-
if (propsValue !== value) {
|
|
58
|
-
setValue(propsValue || '');
|
|
59
|
-
}
|
|
60
|
-
}, [propsValue]);
|
|
61
|
-
var debouncedOnChangeHandler = (0, react_2.useCallback)((0, lodash_1.debounce)(function (evt) {
|
|
62
|
-
if (onChange) {
|
|
63
|
-
onChange(evt);
|
|
64
|
-
}
|
|
65
|
-
}, 300), []);
|
|
66
|
-
function handleOnChange(evt) {
|
|
67
|
-
var event = { target: { name: evt.target.name, value: evt.target.value } };
|
|
68
|
-
if ((!charLimit || (charLimit && evt.target.value.length <= charLimit)) &&
|
|
69
|
-
(!changeValidator || changeValidator(evt.target.value))) {
|
|
70
|
-
setValue(evt.target.value);
|
|
71
|
-
if (onChange) {
|
|
72
|
-
if (enableDebouncedOnChange) {
|
|
73
|
-
debouncedOnChangeHandler(event);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
onChange(event);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return ((0, react_1.jsx)("div", { className: className, style: style },
|
|
82
|
-
(0, react_1.jsx)(material_1.TextField, __assign({ id: id.current, error: error, label: label, name: name, onChange: handleOnChange, placeholder: placeholder, value: value, variant: variant, multiline: multiline, size: size }, restOfProps)),
|
|
83
|
-
(0, react_1.jsx)("div", null,
|
|
84
|
-
helperText && ((0, react_1.jsx)(material_1.Typography, { css: (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n float: left;\n margin-left: 14px;\n margin-top: 4px;\n color: ", ";\n width: calc(100% - 82px);\n "], ["\n float: left;\n margin-left: 14px;\n margin-top: 4px;\n color: ", ";\n width: calc(100% - 82px);\n "])), error ? 'red' : 'rgba(0, 0, 0, 0.54)'), variant: "caption" }, helperText)),
|
|
85
|
-
charLimit !== undefined && !hideCharCounter && ((0, react_1.jsx)(material_1.Typography, { css: (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-size: 0.75rem;\n text-align: right;\n float: right;\n margin-left: 14px;\n margin-right: 14px;\n margin-top: 4px;\n color: ", ";\n width: 40px;\n "], ["\n font-size: 0.75rem;\n text-align: right;\n float: right;\n margin-left: 14px;\n margin-right: 14px;\n margin-top: 4px;\n color: ", ";\n width: 40px;\n "])), error ? 'red' : 'rgba(0, 0, 0, 0.54)'), variant: "subtitle1" },
|
|
86
|
-
value.length,
|
|
87
|
-
"/",
|
|
88
|
-
charLimit)))));
|
|
89
|
-
}
|
|
90
|
-
exports.default = InputGroup;
|
|
91
|
-
var templateObject_1, templateObject_2;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
22
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
23
|
-
if (!m) return o;
|
|
24
|
-
var i = m.call(o), r, ar = [], e;
|
|
25
|
-
try {
|
|
26
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
27
|
-
}
|
|
28
|
-
catch (error) { e = { error: error }; }
|
|
29
|
-
finally {
|
|
30
|
-
try {
|
|
31
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
32
|
-
}
|
|
33
|
-
finally { if (e) throw e.error; }
|
|
34
|
-
}
|
|
35
|
-
return ar;
|
|
36
|
-
};
|
|
37
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
|
-
};
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
var react_1 = __importStar(require("react"));
|
|
42
|
-
var InputGroup_1 = __importDefault(require("./InputGroup"));
|
|
43
|
-
var InputGroup = function () {
|
|
44
|
-
var _a = __read((0, react_1.useState)(''), 2), value = _a[0], setValue = _a[1];
|
|
45
|
-
function onChange(evt) {
|
|
46
|
-
setValue(evt.target.value);
|
|
47
|
-
}
|
|
48
|
-
return (react_1.default.createElement(InputGroup_1.default, { name: "name", label: "First Name", fullWidth: true, helperText: "(required)", value: value, charLimit: 20, onChange: onChange }));
|
|
49
|
-
};
|
|
50
|
-
exports.default = InputGroup;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var InputGroup_1 = require("./InputGroup");
|
|
8
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(InputGroup_1).default; } });
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
-
}) : (function(o, m, k, k2) {
|
|
17
|
-
if (k2 === undefined) k2 = k;
|
|
18
|
-
o[k2] = m[k];
|
|
19
|
-
}));
|
|
20
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
-
}) : function(o, v) {
|
|
23
|
-
o["default"] = v;
|
|
24
|
-
});
|
|
25
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
-
if (mod && mod.__esModule) return mod;
|
|
27
|
-
var result = {};
|
|
28
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
-
__setModuleDefault(result, mod);
|
|
30
|
-
return result;
|
|
31
|
-
};
|
|
32
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
33
|
-
var t = {};
|
|
34
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
35
|
-
t[p] = s[p];
|
|
36
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
37
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
38
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39
|
-
t[p[i]] = s[p[i]];
|
|
40
|
-
}
|
|
41
|
-
return t;
|
|
42
|
-
};
|
|
43
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
44
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
45
|
-
if (!m) return o;
|
|
46
|
-
var i = m.call(o), r, ar = [], e;
|
|
47
|
-
try {
|
|
48
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
49
|
-
}
|
|
50
|
-
catch (error) { e = { error: error }; }
|
|
51
|
-
finally {
|
|
52
|
-
try {
|
|
53
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
54
|
-
}
|
|
55
|
-
finally { if (e) throw e.error; }
|
|
56
|
-
}
|
|
57
|
-
return ar;
|
|
58
|
-
};
|
|
59
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
-
var react_1 = __importStar(require("react"));
|
|
61
|
-
var material_1 = require("@mui/material");
|
|
62
|
-
function InputRadioGroup(props) {
|
|
63
|
-
var _a = props.color, color = _a === void 0 ? 'primary' : _a, disabled = props.disabled, error = props.error, helperText = props.helperText, label = props.label, name = props.name, onChange = props.onChange, options = props.options, _b = props.row, row = _b === void 0 ? false : _b, _c = props.size, size = _c === void 0 ? 'small' : _c, restOfProps = __rest(props, ["color", "disabled", "error", "helperText", "label", "name", "onChange", "options", "row", "size"]);
|
|
64
|
-
var _d = __read((0, react_1.useState)(null), 2), value = _d[0], setValue = _d[1];
|
|
65
|
-
(0, react_1.useEffect)(function () {
|
|
66
|
-
if (props.value !== value) {
|
|
67
|
-
setValue(props.value);
|
|
68
|
-
}
|
|
69
|
-
}, [props.value]);
|
|
70
|
-
function handleOnChange(_, value) {
|
|
71
|
-
setValue(value);
|
|
72
|
-
onChange({ target: { name: name, value: value } });
|
|
73
|
-
}
|
|
74
|
-
function renderOptions() {
|
|
75
|
-
return options.map(function (option) { return (react_1.default.createElement(material_1.FormControlLabel, { key: option.label, value: option.value, label: option.label, control: react_1.default.createElement(material_1.Radio, { size: size, color: color, disabled: disabled }) })); });
|
|
76
|
-
}
|
|
77
|
-
return (react_1.default.createElement(material_1.FormControl, __assign({ component: "fieldset", error: error }, restOfProps),
|
|
78
|
-
react_1.default.createElement(material_1.FormLabel, { component: "legend" }, label),
|
|
79
|
-
react_1.default.createElement(material_1.RadioGroup, { name: name, value: value, onChange: handleOnChange, row: row }, renderOptions()),
|
|
80
|
-
react_1.default.createElement(material_1.FormHelperText, null, helperText)));
|
|
81
|
-
}
|
|
82
|
-
exports.default = InputRadioGroup;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
22
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
23
|
-
if (!m) return o;
|
|
24
|
-
var i = m.call(o), r, ar = [], e;
|
|
25
|
-
try {
|
|
26
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
27
|
-
}
|
|
28
|
-
catch (error) { e = { error: error }; }
|
|
29
|
-
finally {
|
|
30
|
-
try {
|
|
31
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
32
|
-
}
|
|
33
|
-
finally { if (e) throw e.error; }
|
|
34
|
-
}
|
|
35
|
-
return ar;
|
|
36
|
-
};
|
|
37
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
|
-
};
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
var react_1 = __importStar(require("react"));
|
|
42
|
-
var InputRadioGroup_1 = __importDefault(require("./InputRadioGroup"));
|
|
43
|
-
var options = [
|
|
44
|
-
{ label: 'Apple', value: 'apple' },
|
|
45
|
-
{ label: 'Banana', value: 'banana' },
|
|
46
|
-
{ label: 'Orange', value: 'orange' },
|
|
47
|
-
];
|
|
48
|
-
var InputRadioGroup = function () {
|
|
49
|
-
var _a = __read((0, react_1.useState)(null), 2), value = _a[0], setValue = _a[1];
|
|
50
|
-
return (react_1.default.createElement(InputRadioGroup_1.default, { label: "Fruit", name: "fruit", helperText: "Please choose one", options: options, value: value, onChange: function (evt) { return setValue(evt.target.value || null); }, row: true }));
|
|
51
|
-
};
|
|
52
|
-
exports.default = InputRadioGroup;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var InputRadioGroup_1 = require("./InputRadioGroup");
|
|
8
|
-
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(InputRadioGroup_1).default; } });
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __assign = (this && this.__assign) || function () {
|
|
7
|
-
__assign = Object.assign || function(t) {
|
|
8
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
-
s = arguments[i];
|
|
10
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
-
t[p] = s[p];
|
|
12
|
-
}
|
|
13
|
-
return t;
|
|
14
|
-
};
|
|
15
|
-
return __assign.apply(this, arguments);
|
|
16
|
-
};
|
|
17
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
18
|
-
var t = {};
|
|
19
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
20
|
-
t[p] = s[p];
|
|
21
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
22
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
24
|
-
t[p[i]] = s[p[i]];
|
|
25
|
-
}
|
|
26
|
-
return t;
|
|
27
|
-
};
|
|
28
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
29
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
30
|
-
if (!m) return o;
|
|
31
|
-
var i = m.call(o), r, ar = [], e;
|
|
32
|
-
try {
|
|
33
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
34
|
-
}
|
|
35
|
-
catch (error) { e = { error: error }; }
|
|
36
|
-
finally {
|
|
37
|
-
try {
|
|
38
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
39
|
-
}
|
|
40
|
-
finally { if (e) throw e.error; }
|
|
41
|
-
}
|
|
42
|
-
return ar;
|
|
43
|
-
};
|
|
44
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
/** @jsxRuntime classic */
|
|
46
|
-
/** @jsx jsx */
|
|
47
|
-
var react_1 = require("@emotion/react");
|
|
48
|
-
var react_2 = require("react");
|
|
49
|
-
var styles_1 = require("@mui/styles");
|
|
50
|
-
var material_1 = require("@mui/material");
|
|
51
|
-
var nanoid_1 = require("nanoid");
|
|
52
|
-
var useStyles = (0, styles_1.makeStyles)({
|
|
53
|
-
option: {
|
|
54
|
-
'&[data-focus="true"]': { backgroundColor: '#5789ff', color: 'white' },
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
function InputSearchDropdown(props) {
|
|
58
|
-
var mRef = props.mRef, _a = props.autoHighlight, autoHighlight = _a === void 0 ? true : _a, _b = props.clearOnEscape, clearOnEscape = _b === void 0 ? true : _b, count = props.count, disableFilter = props.disableFilter, error = props.error, errors = props.errors, filterOptions = props.filterOptions, _c = props.filterSelectedOptions, filterSelectedOptions = _c === void 0 ? true : _c, getKey = props.getKey, label = props.label, helperText = props.helperText, name = props.name, onChange = props.onChange, _d = props.openOnFocus, openOnFocus = _d === void 0 ? true : _d, _e = props.renderInput, renderInput = _e === void 0 ? null : _e, renderOption = props.renderOption, renderTags = props.renderTags, _f = props.selectOnFocus, selectOnFocus = _f === void 0 ? true : _f, _g = props.variant, variant = _g === void 0 ? 'outlined' : _g, multiple = props.multiple, max = props.max, autoFocus = props.autoFocus, _h = props.size, size = _h === void 0 ? 'small' : _h, restOfProps = __rest(props, ["mRef", "autoHighlight", "clearOnEscape", "count", "disableFilter", "error", "errors", "filterOptions", "filterSelectedOptions", "getKey", "label", "helperText", "name", "onChange", "openOnFocus", "renderInput", "renderOption", "renderTags", "selectOnFocus", "variant", "multiple", "max", "autoFocus", "size"]);
|
|
59
|
-
var id = (0, react_2.useRef)((0, nanoid_1.nanoid)());
|
|
60
|
-
var _j = __read((0, react_2.useState)(null), 2), value = _j[0], setValue = _j[1];
|
|
61
|
-
var mainStyles = useStyles();
|
|
62
|
-
var getOptionLabel = (0, react_2.useCallback)(function (option) {
|
|
63
|
-
if (typeof option === 'string') {
|
|
64
|
-
return option;
|
|
65
|
-
}
|
|
66
|
-
if (!props.getOptionLabel) {
|
|
67
|
-
throw new Error('You must provide the getOptionLabel prop to the InputSearchDropdown component');
|
|
68
|
-
}
|
|
69
|
-
return props.getOptionLabel(option);
|
|
70
|
-
}, [props.getOptionLabel]);
|
|
71
|
-
var getKeySuffix = (0, react_2.useCallback)(function (option) {
|
|
72
|
-
return typeof option === 'string' ? option : getKey !== undefined ? getKey(option) : getOptionLabel(option);
|
|
73
|
-
}, [getOptionLabel, getKey]);
|
|
74
|
-
var getCount = (0, react_2.useCallback)(function () {
|
|
75
|
-
var _a;
|
|
76
|
-
if (count !== undefined) {
|
|
77
|
-
return count;
|
|
78
|
-
}
|
|
79
|
-
return ((_a = value) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
80
|
-
}, [count, value]);
|
|
81
|
-
var getValue = (0, react_2.useCallback)(function () {
|
|
82
|
-
if (multiple && value === null) {
|
|
83
|
-
return [];
|
|
84
|
-
}
|
|
85
|
-
if (multiple && !Array.isArray(value)) {
|
|
86
|
-
return [value];
|
|
87
|
-
}
|
|
88
|
-
if (!multiple && Array.isArray(value)) {
|
|
89
|
-
return value.length ? value[0] : null;
|
|
90
|
-
}
|
|
91
|
-
return value;
|
|
92
|
-
}, [multiple, value]);
|
|
93
|
-
var renderDefaultOption = (0, react_2.useCallback)(function (props, option) {
|
|
94
|
-
return ((0, react_1.jsx)("li", __assign({}, props, { key: "option-" + getKeySuffix(option) }), getOptionLabel(option)));
|
|
95
|
-
}, [getKeySuffix, getOptionLabel]);
|
|
96
|
-
var renderDefaultTags = (0, react_2.useCallback)(function (values, getTagProps) {
|
|
97
|
-
return values.map(function (value, index) {
|
|
98
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
99
|
-
var _a = getTagProps({ index: index }), key = _a.key, tagProps = __rest(_a, ["key"]);
|
|
100
|
-
return ((0, react_1.jsx)(material_1.Chip, __assign({ key: "chip-" + getKeySuffix(value), css: (0, react_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-color: ", ";\n "], ["\n border-color: ", ";\n "])), errors && errors[index] ? 'red' : 'initial'), variant: "outlined", label: getOptionLabel(value), size: "small" }, tagProps)));
|
|
101
|
-
});
|
|
102
|
-
}, [getKeySuffix, getOptionLabel, errors]);
|
|
103
|
-
var renderDefaultInput = (0, react_2.useCallback)(function (params) {
|
|
104
|
-
return ((0, react_1.jsx)(material_1.TextField, __assign({}, params, { error: error || !!(errors === null || errors === void 0 ? void 0 : errors.length), label: label, variant: variant, autoFocus: autoFocus })));
|
|
105
|
-
}, [error, errors, label, variant, autoFocus]);
|
|
106
|
-
(0, react_2.useEffect)(function () {
|
|
107
|
-
if (props.value !== value) {
|
|
108
|
-
if (!props.value && props.multiple) {
|
|
109
|
-
setValue([]);
|
|
110
|
-
}
|
|
111
|
-
setValue(props.value);
|
|
112
|
-
}
|
|
113
|
-
}, [props.value]); // eslint-disable-line
|
|
114
|
-
function handleOnChange(_, newValue, reason) {
|
|
115
|
-
// logic that prevents the input from exceeding its limit
|
|
116
|
-
if (multiple && max) {
|
|
117
|
-
if (count !== undefined) {
|
|
118
|
-
var delta = count - value.length;
|
|
119
|
-
if (newValue.length + delta > max) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
else if (newValue.length > max) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
setValue(newValue);
|
|
128
|
-
onChange({ target: { name: name, value: newValue } }, newValue, reason);
|
|
129
|
-
}
|
|
130
|
-
function handleOptionFilter() {
|
|
131
|
-
return (0, material_1.createFilterOptions)({
|
|
132
|
-
matchFrom: 'any',
|
|
133
|
-
stringify: getOptionLabel,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
return ((0, react_1.jsx)("div", null,
|
|
137
|
-
(0, react_1.jsx)(material_1.Autocomplete, __assign({ id: id.current, css: (0, react_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n // TODO: this is due to a bug in MaterialUI clear up when resolve -- should file a PR ticket\n &&& .MuiInputBase-root {\n padding-right: 39px;\n }\n "], ["\n // TODO: this is due to a bug in MaterialUI clear up when resolve -- should file a PR ticket\n &&& .MuiInputBase-root {\n padding-right: 39px;\n }\n "]))), autoHighlight: autoHighlight, clearOnEscape: clearOnEscape, filterOptions: !disableFilter ? filterOptions || handleOptionFilter() : function (options) { return options; }, filterSelectedOptions: filterSelectedOptions, onChange: handleOnChange, openOnFocus: openOnFocus, renderInput: renderInput || renderDefaultInput, renderOption: renderOption ? renderOption : renderDefaultOption, renderTags: renderTags || renderDefaultTags, selectOnFocus: selectOnFocus, multiple: multiple, classes: mainStyles, size: size }, restOfProps, { value: getValue(), ref: mRef })),
|
|
138
|
-
(0, react_1.jsx)("div", null,
|
|
139
|
-
helperText && ((0, react_1.jsx)(material_1.Typography, { css: (0, react_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n float: left;\n margin-left: 14px;\n margin-top: 4px;\n color: ", ";\n width: calc(100% - 82px);\n "], ["\n float: left;\n margin-left: 14px;\n margin-top: 4px;\n color: ", ";\n width: calc(100% - 82px);\n "])), error ? 'red' : 'rgba(0, 0, 0, 0.54)'), variant: "caption" }, helperText)),
|
|
140
|
-
multiple && max && ((0, react_1.jsx)(material_1.Typography, { css: (0, react_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: 0.75rem;\n text-align: right;\n float: right;\n margin-left: 14px;\n margin-right: 14px;\n margin-top: 4px;\n color: ", ";\n width: 40px;\n "], ["\n font-size: 0.75rem;\n text-align: right;\n float: right;\n margin-left: 14px;\n margin-right: 14px;\n margin-top: 4px;\n color: ", ";\n width: 40px;\n "])), error ? 'red' : 'rgba(0, 0, 0, 0.54)'), variant: "subtitle1" },
|
|
141
|
-
getCount(),
|
|
142
|
-
"/",
|
|
143
|
-
max)))));
|
|
144
|
-
}
|
|
145
|
-
exports.default = InputSearchDropdown;
|
|
146
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|