@vendorflow/components 2.0.99 → 2.1.0
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/TempHooks.d.ts +9 -0
- package/lib/TempHooks.js +25 -0
- package/lib/components/InfiniteScroll/InfiniteScroll.d.ts +16 -0
- package/lib/components/InfiniteScroll/InfiniteScroll.js +159 -0
- package/lib/components/InfiniteScroll/index.d.ts +1 -0
- package/lib/components/InfiniteScroll/index.js +8 -0
- package/lib/components/blueprint/InputGroup/InputGroup.d.ts +20 -0
- package/lib/components/blueprint/InputGroup/InputGroup.js +13 -0
- package/lib/components/blueprint/InputGroup/InputGroup.story.d.ts +2 -0
- package/lib/components/blueprint/InputGroup/InputGroup.story.js +11 -0
- package/lib/components/blueprint/InputGroup/index.d.ts +1 -0
- package/lib/components/blueprint/InputGroup/index.js +4 -0
- package/lib/components/blueprint/InputSelect/InputSelect.d.ts +51 -0
- package/lib/components/blueprint/InputSelect/InputSelect.js +98 -0
- package/lib/components/blueprint/InputSelect/InputSelect.story.d.ts +3 -0
- package/lib/components/blueprint/InputSelect/InputSelect.story.js +19 -0
- package/lib/components/blueprint/InputSelect/index.d.ts +1 -0
- package/lib/components/blueprint/InputSelect/index.js +4 -0
- package/lib/components/blueprint/InputTime/InputTime.d.ts +24 -0
- package/lib/components/blueprint/InputTime/InputTime.js +28 -0
- package/lib/components/blueprint/InputTime/InputTime.story.d.ts +2 -0
- package/lib/components/blueprint/InputTime/InputTime.story.js +11 -0
- package/lib/components/blueprint/InputTime/index.d.ts +1 -0
- package/lib/components/blueprint/InputTime/index.js +4 -0
- package/lib/components/material-ui/ChatInterface/ActionsMenu.d.ts +4 -0
- package/lib/components/material-ui/ChatInterface/ActionsMenu.js +37 -0
- package/lib/components/material-ui/ChatInterface/ChatInterface.d.ts +33 -0
- package/lib/components/material-ui/ChatInterface/ChatInterface.js +109 -0
- package/lib/components/material-ui/ChatInterface/ChatInterface.story.d.ts +1 -0
- package/lib/components/material-ui/ChatInterface/ChatInterface.story.js +134 -0
- package/lib/components/material-ui/ChatInterface/MessageInput.d.ts +9 -0
- package/lib/components/material-ui/ChatInterface/MessageInput.js +53 -0
- package/lib/components/material-ui/ChatInterface/MessageItem.d.ts +8 -0
- package/lib/components/material-ui/ChatInterface/MessageItem.js +71 -0
- package/lib/components/material-ui/ChatInterface/MessageThread.d.ts +6 -0
- package/lib/components/material-ui/ChatInterface/MessageThread.js +119 -0
- package/lib/components/material-ui/ChatInterface/index.d.ts +1 -0
- package/lib/components/material-ui/ChatInterface/index.js +8 -0
- package/lib/components/material-ui/ColorPicker/styles.d.ts +1 -1
- package/lib/components/material-ui/DataTable/AppliedFilters.d.ts +12 -0
- package/lib/components/material-ui/DataTable/AppliedFilters.js +26 -0
- package/lib/components/material-ui/DataTable/GlobalSearchFilter.d.ts +10 -0
- package/lib/components/material-ui/DataTable/GlobalSearchFilter.js +49 -0
- package/lib/components/material-ui/DataTable/IndeterminateCheckbox.d.ts +4 -0
- package/lib/components/material-ui/DataTable/IndeterminateCheckbox.js +65 -0
- package/lib/components/material-ui/DataTable/SortIndicator.d.ts +10 -0
- package/lib/components/material-ui/DataTable/SortIndicator.js +33 -0
- package/lib/components/material-ui/DataTable/Toolbar.d.ts +24 -0
- package/lib/components/material-ui/DataTable/Toolbar.js +63 -0
- package/lib/components/material-ui/DataTable/Utils.d.ts +25 -0
- package/lib/components/material-ui/DataTable/Utils.js +119 -0
- package/lib/components/material-ui/DataTable/ViewColumnTool.d.ts +11 -0
- package/lib/components/material-ui/DataTable/ViewColumnTool.js +76 -0
- package/lib/components/material-ui/ErrorBoundary/ErrorBoundary.d.ts +7 -0
- package/lib/components/material-ui/ErrorBoundary/ErrorBoundary.js +20 -0
- package/lib/components/material-ui/ErrorBoundary/index.d.ts +1 -0
- package/lib/components/material-ui/ErrorBoundary/index.js +8 -0
- package/lib/components/material-ui/InputSearchDropdown/InputSearchDropdown.js +44 -35
- package/lib/components/material-ui/InputSearchDropdown/InputSearchDropdown.story.js +1 -1
- package/lib/services/Select.service.d.ts +5 -0
- package/lib/services/Select.service.js +67 -0
- package/package.json +1 -1
|
@@ -55,19 +55,30 @@ var useStyles = (0, styles_1.makeStyles)({
|
|
|
55
55
|
},
|
|
56
56
|
});
|
|
57
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, 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", "renderTags", "selectOnFocus", "variant", "multiple", "max", "autoFocus", "size"]);
|
|
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
59
|
var id = (0, react_2.useRef)((0, nanoid_1.nanoid)());
|
|
60
60
|
var _j = __read((0, react_2.useState)(null), 2), value = _j[0], setValue = _j[1];
|
|
61
61
|
var mainStyles = useStyles();
|
|
62
|
-
(0, react_2.
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
setValue([]);
|
|
66
|
-
}
|
|
67
|
-
setValue(props.value);
|
|
62
|
+
var getOptionLabel = (0, react_2.useCallback)(function (option) {
|
|
63
|
+
if (typeof option === 'string') {
|
|
64
|
+
return option;
|
|
68
65
|
}
|
|
69
|
-
|
|
70
|
-
|
|
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 () {
|
|
71
82
|
if (multiple && value === null) {
|
|
72
83
|
return [];
|
|
73
84
|
}
|
|
@@ -78,7 +89,28 @@ function InputSearchDropdown(props) {
|
|
|
78
89
|
return value.length ? value[0] : null;
|
|
79
90
|
}
|
|
80
91
|
return value;
|
|
81
|
-
}
|
|
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
|
|
82
114
|
function handleOnChange(_, newValue, reason) {
|
|
83
115
|
// logic that prevents the input from exceeding its limit
|
|
84
116
|
if (multiple && max) {
|
|
@@ -98,34 +130,11 @@ function InputSearchDropdown(props) {
|
|
|
98
130
|
function handleOptionFilter() {
|
|
99
131
|
return (0, material_1.createFilterOptions)({
|
|
100
132
|
matchFrom: 'any',
|
|
101
|
-
stringify:
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
function renderDefaultInput(params) {
|
|
105
|
-
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 })));
|
|
106
|
-
}
|
|
107
|
-
function renderDefaultTags(values, getTagProps) {
|
|
108
|
-
return values.map(function (value, index) {
|
|
109
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
110
|
-
var _a = getTagProps({ index: index }), key = _a.key, tagProps = __rest(_a, ["key"]);
|
|
111
|
-
return ((0, react_1.jsx)(material_1.Chip, __assign({ key: "chip-" + (typeof value === 'string'
|
|
112
|
-
? value
|
|
113
|
-
: getKey !== undefined
|
|
114
|
-
? getKey(value)
|
|
115
|
-
: props.getOptionLabel !== undefined
|
|
116
|
-
? props.getOptionLabel(value)
|
|
117
|
-
: JSON.stringify(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: props.getOptionLabel ? props.getOptionLabel(value) : value, size: "small" }, tagProps)));
|
|
133
|
+
stringify: getOptionLabel,
|
|
118
134
|
});
|
|
119
135
|
}
|
|
120
|
-
function getCount() {
|
|
121
|
-
var _a;
|
|
122
|
-
if (count !== undefined) {
|
|
123
|
-
return count;
|
|
124
|
-
}
|
|
125
|
-
return ((_a = value) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
126
|
-
}
|
|
127
136
|
return ((0, react_1.jsx)("div", null,
|
|
128
|
-
(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, renderTags: renderTags || renderDefaultTags, selectOnFocus: selectOnFocus, multiple: multiple, classes: mainStyles, size: size }, restOfProps, { value: getValue(), ref: mRef })),
|
|
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 })),
|
|
129
138
|
(0, react_1.jsx)("div", null,
|
|
130
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)),
|
|
131
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" },
|
|
@@ -61,6 +61,6 @@ var InputSearchDropdownSingle = function () {
|
|
|
61
61
|
exports.InputSearchDropdownSingle = InputSearchDropdownSingle;
|
|
62
62
|
var InputSearchDropdownMulti = function () {
|
|
63
63
|
var _a = __read((0, react_1.useState)([]), 2), value = _a[0], setValue = _a[1];
|
|
64
|
-
return (react_1.default.createElement(InputSearchDropdown_1.default, { freeSolo: true, multiple: true, name: "footballPlayer", label: "Football Player", options: options, getOptionLabel: getOptionLabel, onChange: function (evt) { return setValue(evt.target.value); }, errors: errors, value: value, helperText: "hello", max: 10 }));
|
|
64
|
+
return (react_1.default.createElement(InputSearchDropdown_1.default, { freeSolo: true, multiple: true, name: "footballPlayer", label: "Football Player", options: options, getKey: getKey, getOptionLabel: getOptionLabel, onChange: function (evt) { return setValue(evt.target.value); }, errors: errors, value: value, helperText: "hello", max: 10 }));
|
|
65
65
|
};
|
|
66
66
|
exports.InputSearchDropdownMulti = InputSearchDropdownMulti;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IItemRendererProps } from '@blueprintjs/select';
|
|
3
|
+
import { UniqueKey, InputValueRender } from 'types/Component.types';
|
|
4
|
+
export declare function getFilter<T>(inputValueRenderer: InputValueRender<T>): (query: string, item: T, index?: number | undefined, exactMatch?: boolean | undefined) => boolean;
|
|
5
|
+
export declare function getItemRenderer<T>(uniqueKey: UniqueKey<T>, inputValueRenderer: InputValueRender<T>, isItemSelected?: (item: T) => boolean): (item: T, { handleClick, modifiers, query }: IItemRendererProps) => JSX.Element | null;
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
var react_1 = __importDefault(require("react"));
|
|
7
|
+
var core_1 = require("@blueprintjs/core");
|
|
8
|
+
function escapeRegExpChars(text) {
|
|
9
|
+
return text.replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1');
|
|
10
|
+
}
|
|
11
|
+
function highlightText(text, query) {
|
|
12
|
+
var lastIndex = 0;
|
|
13
|
+
var words = query
|
|
14
|
+
.split(/\s+/)
|
|
15
|
+
.filter(function (word) { return word.length > 0; })
|
|
16
|
+
.map(escapeRegExpChars);
|
|
17
|
+
if (words.length === 0) {
|
|
18
|
+
return [text];
|
|
19
|
+
}
|
|
20
|
+
var regexp = new RegExp(words.join('|'), 'gi');
|
|
21
|
+
var tokens = [];
|
|
22
|
+
while (true) {
|
|
23
|
+
var match = regexp.exec(text);
|
|
24
|
+
if (!match) {
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
var length_1 = match[0].length;
|
|
28
|
+
var before = text.slice(lastIndex, regexp.lastIndex - length_1);
|
|
29
|
+
if (before.length > 0) {
|
|
30
|
+
tokens.push(before);
|
|
31
|
+
}
|
|
32
|
+
lastIndex = regexp.lastIndex;
|
|
33
|
+
tokens.push(react_1.default.createElement("strong", { key: lastIndex }, match[0]));
|
|
34
|
+
}
|
|
35
|
+
var rest = text.slice(lastIndex);
|
|
36
|
+
if (rest.length > 0) {
|
|
37
|
+
tokens.push(rest);
|
|
38
|
+
}
|
|
39
|
+
return tokens;
|
|
40
|
+
}
|
|
41
|
+
function getFilter(inputValueRenderer) {
|
|
42
|
+
return function filterItems(query, item, index, exactMatch) {
|
|
43
|
+
return exactMatch
|
|
44
|
+
? inputValueRenderer(item).toLowerCase() === query.toLowerCase()
|
|
45
|
+
: inputValueRenderer(item).toLowerCase().includes(query.toLowerCase());
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
exports.getFilter = getFilter;
|
|
49
|
+
function getItemRenderer(uniqueKey, inputValueRenderer, isItemSelected) {
|
|
50
|
+
return function renderItem(item, _a) {
|
|
51
|
+
var handleClick = _a.handleClick, modifiers = _a.modifiers, query = _a.query;
|
|
52
|
+
if (!modifiers.matchesPredicate) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
var text = inputValueRenderer(item);
|
|
56
|
+
var key = null;
|
|
57
|
+
if (typeof uniqueKey === 'string') {
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
key = item[uniqueKey];
|
|
60
|
+
}
|
|
61
|
+
else if (typeof uniqueKey === 'function') {
|
|
62
|
+
key = uniqueKey(item);
|
|
63
|
+
}
|
|
64
|
+
return (react_1.default.createElement(core_1.MenuItem, { active: modifiers.active, icon: isItemSelected && isItemSelected(item) ? 'tick' : 'blank', disabled: modifiers.disabled, label: undefined, key: key, onClick: handleClick, text: highlightText(text, query) }));
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
exports.getItemRenderer = getItemRenderer;
|