@singularsystems/neo-react 1.0.2 → 1.0.3
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/dist/ReactComponents/Badge.d.ts +21 -0
- package/dist/ReactComponents/Badge.js +25 -0
- package/dist/ReactComponents/DatePicker.js +1 -1
- package/dist/ReactComponents/DropDown/AutoCompleteDropDown.js +2 -2
- package/dist/ReactComponents/DropDown/DropDown.js +1 -1
- package/dist/ReactComponents/Input.js +1 -1
- package/dist/ReactComponents/InputHelpers.d.ts +1 -1
- package/dist/ReactComponents/InputHelpers.js +3 -3
- package/dist/ReactComponents/Notifications/Alert.d.ts +5 -1
- package/dist/ReactComponents/Notifications/Alert.js +2 -2
- package/dist/ReactComponents/NumberInput.js +1 -1
- package/dist/ReactComponents/_Exports.d.ts +2 -1
- package/dist/ReactComponents/_Exports.js +2 -1
- package/package.json +1 -1
- package/styles/Badge.scss +8 -0
- package/styles/Neo.scss +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { variant } from '@singularsystems/neo-core/dist/Components';
|
|
3
|
+
interface IBadgeProps {
|
|
4
|
+
/** Content of badge. */
|
|
5
|
+
text?: string;
|
|
6
|
+
/** Child Element */
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/** Bootstrap variant. */
|
|
9
|
+
variant?: variant;
|
|
10
|
+
/** Set a custom variant for when a standard variant is not provided. */
|
|
11
|
+
customVariant?: string;
|
|
12
|
+
/** Changes the type of badge. */
|
|
13
|
+
isLarge?: boolean;
|
|
14
|
+
/** Changes the badge to a pill which results in rounder borders. */
|
|
15
|
+
isPill?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export default class Badge extends React.Component<IBadgeProps & React.HTMLProps<HTMLDivElement>> {
|
|
18
|
+
constructor(props: IBadgeProps);
|
|
19
|
+
render(): React.JSX.Element;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { __assign, __decorate, __extends, __metadata, __rest } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
|
+
import { Utils } from '@singularsystems/neo-core';
|
|
5
|
+
var Badge = /** @class */ (function (_super) {
|
|
6
|
+
__extends(Badge, _super);
|
|
7
|
+
function Badge(props) {
|
|
8
|
+
return _super.call(this, props) || this;
|
|
9
|
+
}
|
|
10
|
+
Badge.prototype.render = function () {
|
|
11
|
+
var _a;
|
|
12
|
+
var _b = this.props, text = _b.text, variant = _b.variant, customVariant = _b.customVariant, isLarge = _b.isLarge, isPill = _b.isPill, children = _b.children, domProps = __rest(_b, ["text", "variant", "customVariant", "isLarge", "isPill", "children"]);
|
|
13
|
+
var variantClassName = "badge badge-".concat(((_a = customVariant !== null && customVariant !== void 0 ? customVariant : variant) !== null && _a !== void 0 ? _a : "primary"));
|
|
14
|
+
var largeBadgeClassName = isLarge ? "badge-lg" : "";
|
|
15
|
+
var pillClassName = isPill ? "badge-pill" : "";
|
|
16
|
+
domProps.className = Utils.joinWithSpaces(domProps.className, variantClassName, pillClassName, largeBadgeClassName);
|
|
17
|
+
return (React.createElement("div", __assign({}, domProps), children !== null && children !== void 0 ? children : text));
|
|
18
|
+
};
|
|
19
|
+
Badge = __decorate([
|
|
20
|
+
observer,
|
|
21
|
+
__metadata("design:paramtypes", [Object])
|
|
22
|
+
], Badge);
|
|
23
|
+
return Badge;
|
|
24
|
+
}(React.Component));
|
|
25
|
+
export default Badge;
|
|
@@ -45,7 +45,7 @@ var DatePicker = /** @class */ (function (_super) {
|
|
|
45
45
|
void this.props.bind.value;
|
|
46
46
|
}
|
|
47
47
|
return (React.createElement("div", { className: "neo-datepicker-container", ref: this.container }, Components.DatePicker.mustShowInput(splitProps.dateProps) &&
|
|
48
|
-
InputHelpers.surroundWithInputGroup(React.createElement("input", __assign({ type: "text" }, domProps, { ref: this.inputRef })), splitProps.editor, this.inputRef)));
|
|
48
|
+
InputHelpers.surroundWithInputGroup(React.createElement("input", __assign({ type: "text" }, domProps, { ref: this.inputRef })), splitProps.editor, domProps, this.inputRef)));
|
|
49
49
|
};
|
|
50
50
|
DatePicker.contextType = FormContext;
|
|
51
51
|
DatePicker = __decorate([
|
|
@@ -216,10 +216,10 @@ var AutoCompleteDropDown = /** @class */ (function (_super) {
|
|
|
216
216
|
}
|
|
217
217
|
};
|
|
218
218
|
if (this.props.itemSource !== undefined) {
|
|
219
|
-
return Tooltip.fromDataAttributes(InputHelpers.surroundWithInputGroup(React.createElement(this.asyncSelectImplementation, __assign({}, nativeProps, { placeholder: (_g = this.props.placeholder) !== null && _g !== void 0 ? _g : "", classNamePrefix: "react-select-bs", defaultOptions: defaultItems, loadOptions: this.onKeyPress, isMulti: bindItems !== undefined, noOptionsMessage: function (c) { var _a, _b; return c.inputValue && c.inputValue.length >= (minCharacters !== null && minCharacters !== void 0 ? minCharacters : 1) ? ((_a = _this.props.noRecordsPrompt) !== null && _a !== void 0 ? _a : "No records found") : ((_b = _this.props.typeToSearchPrompt) !== null && _b !== void 0 ? _b : "Type to search..."); }, value: value, onChange: this.onItemSelected, components: components })), splitProps.editor), nativeProps);
|
|
219
|
+
return Tooltip.fromDataAttributes(InputHelpers.surroundWithInputGroup(React.createElement(this.asyncSelectImplementation, __assign({}, nativeProps, { placeholder: (_g = this.props.placeholder) !== null && _g !== void 0 ? _g : "", classNamePrefix: "react-select-bs", defaultOptions: defaultItems, loadOptions: this.onKeyPress, isMulti: bindItems !== undefined, noOptionsMessage: function (c) { var _a, _b; return c.inputValue && c.inputValue.length >= (minCharacters !== null && minCharacters !== void 0 ? minCharacters : 1) ? ((_a = _this.props.noRecordsPrompt) !== null && _a !== void 0 ? _a : "No records found") : ((_b = _this.props.typeToSearchPrompt) !== null && _b !== void 0 ? _b : "Type to search..."); }, value: value, onChange: this.onItemSelected, components: components })), splitProps.editor, { disabled: nativeProps.isDisabled }), nativeProps);
|
|
220
220
|
}
|
|
221
221
|
else {
|
|
222
|
-
return Tooltip.fromDataAttributes(InputHelpers.surroundWithInputGroup(React.createElement(this.selectImplementation, __assign({}, nativeProps, { placeholder: (_h = this.props.placeholder) !== null && _h !== void 0 ? _h : "", classNamePrefix: "react-select-bs", options: defaultItems, isLoading: this.isLoading, isMulti: bindItems !== undefined, noOptionsMessage: function (c) { var _a; return (_a = _this.props.noRecordsPrompt) !== null && _a !== void 0 ? _a : "No records found"; }, value: value, onChange: this.onItemSelected, components: components })), splitProps.editor), nativeProps);
|
|
222
|
+
return Tooltip.fromDataAttributes(InputHelpers.surroundWithInputGroup(React.createElement(this.selectImplementation, __assign({}, nativeProps, { placeholder: (_h = this.props.placeholder) !== null && _h !== void 0 ? _h : "", classNamePrefix: "react-select-bs", options: defaultItems, isLoading: this.isLoading, isMulti: bindItems !== undefined, noOptionsMessage: function (c) { var _a; return (_a = _this.props.noRecordsPrompt) !== null && _a !== void 0 ? _a : "No records found"; }, value: value, onChange: this.onItemSelected, components: components })), splitProps.editor, { disabled: nativeProps.isDisabled }), nativeProps);
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
225
|
AutoCompleteDropDown.prototype.getOption = function (content, additionalClass) {
|
|
@@ -136,7 +136,7 @@ var DropDown = /** @class */ (function (_super) {
|
|
|
136
136
|
addBlankItem && React.createElement("option", { className: "option-default" }, notFound ? "(Not found): ".concat(value) : nullText),
|
|
137
137
|
items.map(function (item) { return (React.createElement("option", { value: item[_this.valueMember], key: item[_this.valueMember] }, item[_this.displayMember])); }));
|
|
138
138
|
}
|
|
139
|
-
return (InputHelpers.surroundWithInputGroup(control, splitProps.editor));
|
|
139
|
+
return (InputHelpers.surroundWithInputGroup(control, splitProps.editor, domProps));
|
|
140
140
|
};
|
|
141
141
|
DropDown.contextType = FormContext;
|
|
142
142
|
DropDown = __decorate([
|
|
@@ -112,7 +112,7 @@ var Input = /** @class */ (function (_super) {
|
|
|
112
112
|
splitProps.editor.append = this.props.bind.value ?
|
|
113
113
|
React.createElement(Button, __assign({ size: "sm" }, buttonOptions, { icon: !this.showPassword ? "far-eye fa-fw" : "far-eye-slash fa-fw", onClick: function () { return _this.showPassword = !_this.showPassword; } })) : null;
|
|
114
114
|
}
|
|
115
|
-
return (InputHelpers.surroundWithInputGroup(inputElement, splitProps.editor, this.domRef));
|
|
115
|
+
return (InputHelpers.surroundWithInputGroup(inputElement, splitProps.editor, domProps, this.domRef));
|
|
116
116
|
};
|
|
117
117
|
Input.contextType = FormContext;
|
|
118
118
|
__decorate([
|
|
@@ -2,6 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { ICommonEditorProps } from './PropTypes';
|
|
3
3
|
export declare class InputHelpers {
|
|
4
4
|
private static iconFactory?;
|
|
5
|
-
static surroundWithInputGroup<T extends React.ReactNode>(element: T, props: ICommonEditorProps, inputRef?: React.RefObject<HTMLElement>): React.JSX.Element | T;
|
|
5
|
+
static surroundWithInputGroup<T extends React.ReactNode>(element: T, props: ICommonEditorProps, domProps: React.HTMLProps<HTMLElement>, inputRef?: React.RefObject<HTMLElement>): React.JSX.Element | T;
|
|
6
6
|
private static getElement;
|
|
7
7
|
}
|
|
@@ -5,13 +5,13 @@ import BootstrapUtils from "./BootstrapUtils";
|
|
|
5
5
|
var InputHelpers = /** @class */ (function () {
|
|
6
6
|
function InputHelpers() {
|
|
7
7
|
}
|
|
8
|
-
InputHelpers.surroundWithInputGroup = function (element, props, inputRef) {
|
|
8
|
+
InputHelpers.surroundWithInputGroup = function (element, props, domProps, inputRef) {
|
|
9
9
|
if (!this.iconFactory) {
|
|
10
10
|
this.iconFactory = Misc.Globals.appService.get(NeoReactTypes.Components.IconFactory);
|
|
11
11
|
}
|
|
12
12
|
if (props.requiresGroup) {
|
|
13
|
-
var isBsPre5 = BootstrapUtils.isPre5;
|
|
14
|
-
return (React.createElement("div", { className: "input-group" },
|
|
13
|
+
var isBsPre5 = BootstrapUtils.isPre5, isDisabled = domProps.disabled || domProps.readOnly;
|
|
14
|
+
return (React.createElement("div", { className: "input-group" + (isDisabled ? " input-group-disabled" : "") },
|
|
15
15
|
this.getElement(isBsPre5, "input-group-prepend", inputRef, props.prependText, props.prependIcon, props.prepend),
|
|
16
16
|
element,
|
|
17
17
|
this.getElement(isBsPre5, "input-group-append", inputRef, props.appendText, props.appendIcon, props.append)));
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Components } from "@singularsystems/neo-core";
|
|
3
3
|
import CollapsableBase from '../CollapsableBase';
|
|
4
|
-
|
|
4
|
+
interface IAlertProps {
|
|
5
|
+
isOutline?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export default class Alert extends CollapsableBase<Components.INotificationOptions & IAlertProps & React.HTMLProps<HTMLDivElement>> {
|
|
5
8
|
private iconFactory;
|
|
6
9
|
render(): React.JSX.Element;
|
|
7
10
|
}
|
|
11
|
+
export {};
|
|
@@ -13,8 +13,8 @@ var Alert = /** @class */ (function (_super) {
|
|
|
13
13
|
return _this;
|
|
14
14
|
}
|
|
15
15
|
Alert.prototype.render = function () {
|
|
16
|
-
var _a = this.props, variant = _a.variant, heading = _a.heading, show = _a.show, bindShow = _a.bindShow, autoCloseTimeout = _a.autoCloseTimeout, animateInitial = _a.animateInitial, state = _a.state, onHidden = _a.onHidden, refreshValue = _a.refreshValue, icon = _a.icon, native = __rest(_a, ["variant", "heading", "show", "bindShow", "autoCloseTimeout", "animateInitial", "state", "onHidden", "refreshValue", "icon"]);
|
|
17
|
-
var className = Utils.joinWithSpaces(native.className, "alert", "alert-" + variant, "collapsable");
|
|
16
|
+
var _a = this.props, variant = _a.variant, heading = _a.heading, show = _a.show, bindShow = _a.bindShow, autoCloseTimeout = _a.autoCloseTimeout, animateInitial = _a.animateInitial, state = _a.state, onHidden = _a.onHidden, refreshValue = _a.refreshValue, icon = _a.icon, isOutline = _a.isOutline, native = __rest(_a, ["variant", "heading", "show", "bindShow", "autoCloseTimeout", "animateInitial", "state", "onHidden", "refreshValue", "icon", "isOutline"]);
|
|
17
|
+
var className = Utils.joinWithSpaces(native.className, "alert", "alert-" + variant, "collapsable" + (isOutline ? " alert-outline" : ""));
|
|
18
18
|
if (bindShow) {
|
|
19
19
|
className += " alert-dismissible";
|
|
20
20
|
}
|
|
@@ -246,7 +246,7 @@ var NumberInput = /** @class */ (function (_super) {
|
|
|
246
246
|
var decimals = NumberUtils.getDecimalPlaces(this.formatState.formatString);
|
|
247
247
|
domProps.step = decimals === 0 ? "1" : "0.".concat("0".repeat(decimals - 1), "1");
|
|
248
248
|
}
|
|
249
|
-
return (InputHelpers.surroundWithInputGroup(React.createElement("input", __assign({}, domProps, { defaultValue: this.formatState.getFormattedValue(editorProps.bind.value), type: useNative ? "number" : "text", onChange: this.onChanged, ref: this.inputElement })), editorProps, this.inputElement));
|
|
249
|
+
return (InputHelpers.surroundWithInputGroup(React.createElement("input", __assign({}, domProps, { defaultValue: this.formatState.getFormattedValue(editorProps.bind.value), type: useNative ? "number" : "text", onChange: this.onChanged, ref: this.inputElement })), editorProps, domProps, this.inputElement));
|
|
250
250
|
};
|
|
251
251
|
NumberInput.contextType = FormContext;
|
|
252
252
|
NumberInput = __decorate([
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Alert from './Notifications/Alert';
|
|
2
2
|
import AutoCompleteDropDown from './DropDown/AutoCompleteDropDown';
|
|
3
|
+
import Badge from './Badge';
|
|
3
4
|
import Button from './Button';
|
|
4
5
|
import Card from './Card';
|
|
5
6
|
import Collapsable from './Collapsable';
|
|
@@ -39,4 +40,4 @@ import ToastContainer from './Notifications/ToastContainer';
|
|
|
39
40
|
import Tooltip from './Tooltip';
|
|
40
41
|
import TooltipProvider from './TooltipProvider';
|
|
41
42
|
import ValidationSummary from './ValidationSummary';
|
|
42
|
-
export { Alert, AutoCompleteDropDown, Button, Card, Checkbox, Collapsable, ColorPicker, ContextMenuContainer, DatePicker, DropDown, FileBasicInput, FileContext, FileDropArea, FileInput, FileUploadButton, FileUploadProgress, Form, FormContext, FormGroup, FormGroupFloating, FormGroupInline, GridLayout, Icon, Input, Link, Loader, Modal, ModalContainer, NumberInput, Pager, PagerControlsBasic, PageSizeControl, Passwordbox, ProgressBar, RadioList, Slider, TabContainer, Tab, Textbox, Toast, ToastContainer, Tooltip, TooltipProvider, ValidationSummary };
|
|
43
|
+
export { Alert, AutoCompleteDropDown, Badge, Button, Card, Checkbox, Collapsable, ColorPicker, ContextMenuContainer, DatePicker, DropDown, FileBasicInput, FileContext, FileDropArea, FileInput, FileUploadButton, FileUploadProgress, Form, FormContext, FormGroup, FormGroupFloating, FormGroupInline, GridLayout, Icon, Input, Link, Loader, Modal, ModalContainer, NumberInput, Pager, PagerControlsBasic, PageSizeControl, Passwordbox, ProgressBar, RadioList, Slider, TabContainer, Tab, Textbox, Toast, ToastContainer, Tooltip, TooltipProvider, ValidationSummary };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Alert from './Notifications/Alert';
|
|
2
2
|
import AutoCompleteDropDown from './DropDown/AutoCompleteDropDown';
|
|
3
|
+
import Badge from './Badge';
|
|
3
4
|
import Button from './Button';
|
|
4
5
|
import Card from './Card';
|
|
5
6
|
import Collapsable from './Collapsable';
|
|
@@ -39,4 +40,4 @@ import ToastContainer from './Notifications/ToastContainer';
|
|
|
39
40
|
import Tooltip from './Tooltip';
|
|
40
41
|
import TooltipProvider from './TooltipProvider';
|
|
41
42
|
import ValidationSummary from './ValidationSummary';
|
|
42
|
-
export { Alert, AutoCompleteDropDown, Button, Card, Checkbox, Collapsable, ColorPicker, ContextMenuContainer, DatePicker, DropDown, FileBasicInput, FileContext, FileDropArea, FileInput, FileUploadButton, FileUploadProgress, Form, FormContext, FormGroup, FormGroupFloating, FormGroupInline, GridLayout, Icon, Input, Link, Loader, Modal, ModalContainer, NumberInput, Pager, PagerControlsBasic, PageSizeControl, Passwordbox, ProgressBar, RadioList, Slider, TabContainer, Tab, Textbox, Toast, ToastContainer, Tooltip, TooltipProvider, ValidationSummary };
|
|
43
|
+
export { Alert, AutoCompleteDropDown, Badge, Button, Card, Checkbox, Collapsable, ColorPicker, ContextMenuContainer, DatePicker, DropDown, FileBasicInput, FileContext, FileDropArea, FileInput, FileUploadButton, FileUploadProgress, Form, FormContext, FormGroup, FormGroupFloating, FormGroupInline, GridLayout, Icon, Input, Link, Loader, Modal, ModalContainer, NumberInput, Pager, PagerControlsBasic, PageSizeControl, Passwordbox, ProgressBar, RadioList, Slider, TabContainer, Tab, Textbox, Toast, ToastContainer, Tooltip, TooltipProvider, ValidationSummary };
|
package/package.json
CHANGED
package/styles/Neo.scss
CHANGED