@supersoniks/concorde 3.1.20 → 3.1.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supersoniks/concorde",
3
- "version": "3.1.20",
3
+ "version": "3.1.21",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "",
@@ -73,6 +73,8 @@
73
73
  "./ui/_css/type": "./src/core/components/ui/_css/type.ts",
74
74
  "./alert": "./src/core/components/ui/alert/alert.ts",
75
75
  "./ui/alert": "./src/core/components/ui/alert/alert.ts",
76
+ "./alert-messages": "./src/core/components/ui/alert-messages/alert-messages.ts",
77
+ "./ui/alert-messages": "./src/core/components/ui/alert-messages/alert-messages.ts",
76
78
  "./badge": "./src/core/components/ui/badge/badge.ts",
77
79
  "./ui/badge": "./src/core/components/ui/badge/badge.ts",
78
80
  "./button": "./src/core/components/ui/button/button.ts",
@@ -5,7 +5,7 @@ import Publisher from "../utils/PublisherProxy";
5
5
  export type Message = {
6
6
  type?: string;
7
7
  content?: string;
8
- status?: string;
8
+ status?: "warning" | "success" | "error" | "info";
9
9
  };
10
10
  export interface ConcordeWindow extends Window {
11
11
  SonicPublisherManager: any; //{get: () => any; getInstance: () => PublisherManager};
@@ -0,0 +1,50 @@
1
+ import { LitElement, html, nothing, css } from "lit";
2
+ import { customElement, property } from "lit/decorators.js";
3
+ import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
4
+ import { Message } from "@supersoniks/concorde/core/_types/types";
5
+ import { map } from "lit/directives/map.js";
6
+ import { Size } from "@supersoniks/concorde/core/components/ui/_css/size";
7
+
8
+ import { ifDefined } from "lit/directives/if-defined.js";
9
+ import { APIResult } from "@supersoniks/concorde/core/components/ui/toast/message-subscriber";
10
+
11
+ const tagName = "sonic-alert-messages";
12
+
13
+ //Superbe mix de multples versions d'api.
14
+ @customElement(tagName)
15
+ export class AlertMessages extends Subscriber(LitElement, {} as APIResult) {
16
+ @property({ type: String }) size: Size = "md";
17
+ @property({ type: Boolean }) background = false;
18
+ @property({ type: Boolean }) noIcon = false;
19
+ @property({ type: Array })
20
+ messages: Array<Message> = [];
21
+
22
+ static styles = [
23
+ css`
24
+ .container {
25
+ display: grid;
26
+ gap: 0.5em;
27
+ grid-template-columns: minmax(0, 1fr);
28
+ width: 100%;
29
+ }
30
+ `,
31
+ ];
32
+
33
+ render() {
34
+ if (!this.messages?.length) return nothing;
35
+
36
+ return html`<div class="container">
37
+ ${map(this.messages, (message) => {
38
+ if (message.type == "public") {
39
+ return html`<sonic-alert
40
+ status=${message.status || "default"}
41
+ text=${ifDefined(message.content)}
42
+ size=${this.size}
43
+ ?noIcon=${this.noIcon}
44
+ ?background=${this.background}
45
+ ></sonic-alert>`;
46
+ } else return nothing;
47
+ })}
48
+ </div>`;
49
+ }
50
+ }
@@ -4,7 +4,7 @@ import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
4
4
  import { SonicToast } from "@supersoniks/concorde/core/components/ui/toast/toast";
5
5
  import { Message } from "@supersoniks/concorde/core/_types/types";
6
6
 
7
- type APIResult = {
7
+ export type APIResult = {
8
8
  data?: object | string;
9
9
  message?: string;
10
10
  public_message?: string;
@@ -30,6 +30,8 @@ import "./menu/menu";
30
30
  // Misc
31
31
  import "./modal/modal";
32
32
  import "./alert/alert";
33
+ import "./alert-messages/alert-messages";
34
+
33
35
  import "./toast/toast";
34
36
  import "./toast/message-subscriber";
35
37
  import "./tooltip/tooltip";
package/src/tsconfig.json CHANGED
@@ -175,6 +175,12 @@
175
175
  "./ui/alert": [
176
176
  "/sites/concorde/src/core/components/ui/alert/alert.ts"
177
177
  ],
178
+ "./alert-messages": [
179
+ "/sites/concorde/src/core/components/ui/alert-messages/alert-messages.ts"
180
+ ],
181
+ "./ui/alert-messages": [
182
+ "/sites/concorde/src/core/components/ui/alert-messages/alert-messages.ts"
183
+ ],
178
184
  "./badge": [
179
185
  "/sites/concorde/src/core/components/ui/badge/badge.ts"
180
186
  ],