@umbraco-ui/uui-toast-notification 1.0.0-alpha.0 → 1.0.0-rc.2

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # uui-toast-notification
2
2
 
3
- ![npm](https://img.shields.io/npm/v/@umbraco-ui/uui-toast-notification?logoColor=%231B264F)
3
+ [![npm](https://img.shields.io/npm/v/@umbraco-ui/uui-toast-notification?logoColor=%231B264F)](https://www.npmjs.com/package/@umbraco-ui/uui-toast-notification)
4
4
 
5
5
  Umbraco style toast-notification component.
6
6
 
@@ -7,8 +7,8 @@
7
7
  "attributes": [
8
8
  {
9
9
  "name": "color",
10
- "description": "Changes the look of the notification to one of the predefined, symbolic looks. Example set this to danger for errors.",
11
- "type": "\"\"|\"primary\"|\"positive\"|\"warning\"|\"danger\"",
10
+ "description": "Changes the color of the notification to one of the predefined, symbolic colors. Example: set this to danger to indicate errors.",
11
+ "type": "'' | 'default' | 'positive' | 'warning' | 'danger'",
12
12
  "default": "\"\\\"\\\"\""
13
13
  },
14
14
  {
@@ -33,8 +33,8 @@
33
33
  {
34
34
  "name": "color",
35
35
  "attribute": "color",
36
- "description": "Changes the look of the notification to one of the predefined, symbolic looks. Example set this to danger for errors.",
37
- "type": "\"\"|\"primary\"|\"positive\"|\"warning\"|\"danger\"",
36
+ "description": "Changes the color of the notification to one of the predefined, symbolic colors. Example: set this to danger to indicate errors.",
37
+ "type": "'' | 'default' | 'positive' | 'warning' | 'danger'",
38
38
  "default": "\"\\\"\\\"\""
39
39
  },
40
40
  {
package/lib/index.js CHANGED
@@ -37,8 +37,8 @@ let UUIToastNotificationElement = class extends LitElement {
37
37
  this._timer = null;
38
38
  this._pauseTimer = false;
39
39
  this.isOpen = false;
40
- this._animate = false;
41
40
  this._open = false;
41
+ this._animate = false;
42
42
  this._requestAnimationUpdate = 0;
43
43
  this.addEventListener("keyup", (event) => {
44
44
  if (event.key === "Escape") {
@@ -94,7 +94,12 @@ let UUIToastNotificationElement = class extends LitElement {
94
94
  demandCustomElement(this, "uui-icon");
95
95
  }
96
96
  _getAnimationDuration() {
97
- return parseInt(getComputedStyle(this).getPropertyValue("--uui-toast-notification-animation-duration"), 10) || 480;
97
+ return parseInt(
98
+ getComputedStyle(this).getPropertyValue(
99
+ "--uui-toast-notification-animation-duration"
100
+ ),
101
+ 10
102
+ ) || 480;
98
103
  }
99
104
  _makeOpen() {
100
105
  if (this._open === true) {
@@ -112,7 +117,9 @@ let UUIToastNotificationElement = class extends LitElement {
112
117
  this.setAttribute("is-open", "");
113
118
  this.style.height = this._toastEl.getBoundingClientRect().height + "px";
114
119
  this._animate = true;
115
- this.dispatchEvent(new UUIToastNotificationEvent(UUIToastNotificationEvent.OPENING));
120
+ this.dispatchEvent(
121
+ new UUIToastNotificationEvent(UUIToastNotificationEvent.OPENING)
122
+ );
116
123
  this._animationTimeout = window.setTimeout(() => {
117
124
  var _a;
118
125
  if (this.isOpen === true) {
@@ -121,7 +128,9 @@ let UUIToastNotificationElement = class extends LitElement {
121
128
  if (this._pauseTimer === false) {
122
129
  (_a = this._timer) == null ? void 0 : _a.start();
123
130
  }
124
- this.dispatchEvent(new UUIToastNotificationEvent(UUIToastNotificationEvent.OPENED));
131
+ this.dispatchEvent(
132
+ new UUIToastNotificationEvent(UUIToastNotificationEvent.OPENED)
133
+ );
125
134
  }
126
135
  }, this._getAnimationDuration());
127
136
  });
@@ -132,7 +141,10 @@ let UUIToastNotificationElement = class extends LitElement {
132
141
  if (this._open === false) {
133
142
  return;
134
143
  }
135
- const event = new UUIToastNotificationEvent(UUIToastNotificationEvent.CLOSING, { cancelable: true });
144
+ const event = new UUIToastNotificationEvent(
145
+ UUIToastNotificationEvent.CLOSING,
146
+ { cancelable: true }
147
+ );
136
148
  this.dispatchEvent(event);
137
149
  if (event.defaultPrevented === true) {
138
150
  return;
@@ -153,7 +165,9 @@ let UUIToastNotificationElement = class extends LitElement {
153
165
  this._animationTimeout = window.setTimeout(() => {
154
166
  if (this.isOpen === false) {
155
167
  this._animate = false;
156
- this.dispatchEvent(new UUIToastNotificationEvent(UUIToastNotificationEvent.CLOSED));
168
+ this.dispatchEvent(
169
+ new UUIToastNotificationEvent(UUIToastNotificationEvent.CLOSED)
170
+ );
157
171
  if (this.parentNode) {
158
172
  this.parentNode.removeChild(this);
159
173
  }
@@ -169,7 +183,7 @@ let UUIToastNotificationElement = class extends LitElement {
169
183
  <div id="close">
170
184
  <uui-button
171
185
  .label=${"close"}
172
- ?color=${this.color}
186
+ .color=${this.color}
173
187
  .look=${this.color ? "primary" : "default"}
174
188
  @click=${() => this.open = false}>
175
189
  <uui-icon
@@ -261,7 +275,7 @@ UUIToastNotificationElement.styles = [
261
275
  color: var(--uui-color-text,#060606);
262
276
  border-color: var(--uui-color-surface,#fff);
263
277
  }
264
- :host([color='primary']) #toast > div {
278
+ :host([color='default']) #toast > div {
265
279
  background-color: var(--uui-color-default,#1b264f);
266
280
  color: var(--uui-color-default-contrast,#fff);
267
281
  border-color: var(--uui-color-default-standalone,rgb(28, 35, 59));
@@ -11,12 +11,12 @@ import { LitElement } from 'lit';
11
11
  export declare class UUIToastNotificationElement extends LitElement {
12
12
  static styles: import("lit").CSSResult[];
13
13
  /**
14
- * Changes the look of the notification to one of the predefined, symbolic looks. Example set this to danger for errors.
15
- * @type {""|"primary"|"positive"|"warning"|"danger"}
14
+ * Changes the color of the notification to one of the predefined, symbolic colors. Example: set this to danger to indicate errors.
15
+ * @type {'' | 'default' | 'positive' | 'warning' | 'danger'}
16
16
  * @attr
17
17
  * @default ""
18
18
  */
19
- color: string;
19
+ color: '' | 'default' | 'positive' | 'warning' | 'danger';
20
20
  private _autoClose;
21
21
  /**
22
22
  * Set an auto-close timer.
@@ -35,13 +35,13 @@ export declare class UUIToastNotificationElement extends LitElement {
35
35
  */
36
36
  resumeAutoClose(): void;
37
37
  private _onOpenTimerComplete;
38
+ private _toastEl;
38
39
  private _timer;
39
40
  private _pauseTimer;
40
- private _toastEl;
41
- private _animationTimeout?;
42
41
  protected isOpen: boolean;
43
- private _animate;
44
42
  private _open;
43
+ private _animate;
44
+ private _animationTimeout?;
45
45
  /**
46
46
  * define if this toast should open or close.
47
47
  * @type boolean
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-ui/uui-toast-notification",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.0.0-rc.2",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "Umbraco",
@@ -30,11 +30,11 @@
30
30
  "custom-elements.json"
31
31
  ],
32
32
  "dependencies": {
33
- "@umbraco-ui/uui-base": "1.0.0-alpha.0",
34
- "@umbraco-ui/uui-button": "1.0.0-alpha.0",
35
- "@umbraco-ui/uui-css": "1.0.0-alpha.0",
36
- "@umbraco-ui/uui-icon": "1.0.0-alpha.0",
37
- "@umbraco-ui/uui-icon-registry-essential": "1.0.0-alpha.0"
33
+ "@umbraco-ui/uui-base": "1.0.0-rc.2",
34
+ "@umbraco-ui/uui-button": "1.0.0-rc.2",
35
+ "@umbraco-ui/uui-css": "1.0.0-rc.2",
36
+ "@umbraco-ui/uui-icon": "1.0.0-rc.2",
37
+ "@umbraco-ui/uui-icon-registry-essential": "1.0.0-rc.2"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
@@ -45,5 +45,5 @@
45
45
  "access": "public"
46
46
  },
47
47
  "homepage": "https://uui.umbraco.com/?path=/story/uui-toast-notification",
48
- "gitHead": "7d7608bf2fb63a8a077fcd8f0346dea73584b878"
48
+ "gitHead": "436dd8d9fff81481feb88f06b461167c98dac91a"
49
49
  }