@singularsystems/neo-react 1.0.4 → 1.0.5

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.
@@ -43,6 +43,7 @@ var IconFactory = /** @class */ (function () {
43
43
  if (style === null || style === void 0 ? void 0 : style.size) {
44
44
  inlineStyle = { fontSize: style.size };
45
45
  }
46
+ className += " neo-icon";
46
47
  return React.createElement("i", { className: className, style: inlineStyle });
47
48
  };
48
49
  IconFactory.prototype.createIconComponent = function (iconDescriptor, style) {
@@ -27,7 +27,7 @@ var MaterialSymbolsFontFactory = /** @class */ (function (_super) {
27
27
  }
28
28
  MaterialSymbolsFontFactory.prototype.mapStringToIcon = function (iconName, style) {
29
29
  var _a;
30
- var className = "material-symbols-outlined";
30
+ var className = "material-symbols-outlined neo-icon";
31
31
  var isFilled = (_a = style === null || style === void 0 ? void 0 : style.solid) !== null && _a !== void 0 ? _a : this.filledByDefault;
32
32
  // TODO: copy spin animation from font-awesome
33
33
  if (style === null || style === void 0 ? void 0 : style.spin) {
@@ -3,6 +3,7 @@ import { Components } from "@singularsystems/neo-core";
3
3
  import CollapsableBase from '../CollapsableBase';
4
4
  interface IAlertProps {
5
5
  isOutline?: boolean;
6
+ iconPosition?: "body" | "left";
6
7
  }
7
8
  export default class Alert extends CollapsableBase<Components.INotificationOptions & IAlertProps & React.HTMLProps<HTMLDivElement>> {
8
9
  private iconFactory;
@@ -13,21 +13,36 @@ 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, 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" : ""));
16
+ var _a, _b;
17
+ var _c = this.props, variant = _c.variant, heading = _c.heading, show = _c.show, bindShow = _c.bindShow, autoCloseTimeout = _c.autoCloseTimeout, animateInitial = _c.animateInitial, state = _c.state, onHidden = _c.onHidden, refreshValue = _c.refreshValue, icon = _c.icon, native = __rest(_c, ["variant", "heading", "show", "bindShow", "autoCloseTimeout", "animateInitial", "state", "onHidden", "refreshValue", "icon"]);
18
+ var isOutline = (_a = this.props.isOutline) !== null && _a !== void 0 ? _a : Misc.Settings.alerts.isOutline;
19
+ var iconPosition = (_b = this.props.iconPosition) !== null && _b !== void 0 ? _b : Misc.Settings.alerts.iconPosition;
20
+ var className = Utils.joinWithSpaces(native.className, "alert", "alert-" + variant, "collapsable" + (isOutline ? " alert-outline" : "") + (iconPosition === "left" ? " alert-left-icon" : ""));
18
21
  if (bindShow) {
19
22
  className += " alert-dismissible";
20
23
  }
24
+ if (heading) {
25
+ className += " with-heading";
26
+ }
21
27
  this.shouldShow = show !== false && (!bindShow || bindShow.value);
22
28
  return (React.createElement("div", __assign({}, native, { className: className, ref: this.containerRef }),
23
- heading &&
24
- React.createElement("h6", null, heading),
25
- icon &&
26
- React.createElement("div", { className: "notification-icon-container" },
27
- this.iconFactory.getIconComponent(icon),
28
- React.createElement("div", null, this.props.children)),
29
- !icon && this.props.children,
30
- bindShow && BootstrapUtils.getCloseButton(this.onClose)));
29
+ bindShow && BootstrapUtils.getCloseButton(this.onClose),
30
+ iconPosition === "body" &&
31
+ React.createElement(React.Fragment, null,
32
+ heading &&
33
+ React.createElement("h6", null, heading),
34
+ icon &&
35
+ React.createElement("div", { className: "notification-icon-container" },
36
+ this.iconFactory.getIconComponent(icon),
37
+ React.createElement("div", null, this.props.children)),
38
+ !icon && this.props.children),
39
+ iconPosition === "left" &&
40
+ React.createElement("div", null,
41
+ icon &&
42
+ React.createElement("div", { className: "notification-icon-container" }, this.iconFactory.getIconComponent(icon)),
43
+ React.createElement("div", null,
44
+ heading && React.createElement("h6", null, heading),
45
+ React.createElement("div", { className: "alert-body" }, this.props.children)))));
31
46
  };
32
47
  Alert = __decorate([
33
48
  observer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-react",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "React application logic and components for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "typescript": "5.4.2"
32
32
  },
33
33
  "dependencies": {
34
- "@singularsystems/neo-core": "1.0.2",
34
+ "@singularsystems/neo-core": "1.0.4",
35
35
  "@types/rc-slider": "^8.6.5",
36
36
  "@types/react-color": "^3.0.1",
37
37
  "axios": "1.6.7",
package/styles/Misc.scss CHANGED
@@ -141,4 +141,17 @@ div.tabs-header {
141
141
  .neo-file-progress-container {
142
142
  font-size: 0.9rem;
143
143
  margin-top: 0.5rem;
144
+ }
145
+
146
+ .alert.alert-left-icon {
147
+ >div {
148
+ display: flex;
149
+ align-items: flex-start;
150
+ }
151
+
152
+ .notification-icon-container {
153
+ position: relative;
154
+ left: -0.5rem;
155
+ font-size: 1.5rem;
156
+ }
144
157
  }