@supersoniks/concorde 1.1.2 → 1.1.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.
- package/cli.js +42 -1
- package/core/components/functional/fetch/fetch.d.ts +7 -3
- package/core/components/functional/fetch/fetch.js +6 -2
- package/core/components/functional/list/list.d.ts +10 -8
- package/core/components/functional/list/list.js +18 -9
- package/core/components/functional/queue/queue.d.ts +3 -1
- package/core/components/functional/queue/queue.js +13 -4
- package/core/components/functional/router/redirect.js +1 -1
- package/core/components/functional/states/states.js +2 -0
- package/core/components/functional/submit/submit.d.ts +1 -1
- package/core/components/functional/submit/submit.js +6 -7
- package/core/components/ui/alert/alert.js +6 -0
- package/core/components/ui/button/button.js +4 -1
- package/core/components/ui/icon/icons.json +1 -1
- package/core/components/ui/theme/theme-collection/core-variables.js +1 -1
- package/core/components/ui/toast/toast-item.d.ts +16 -0
- package/core/components/ui/toast/toast-item.js +243 -0
- package/core/components/ui/toast/toast.d.ts +4 -15
- package/core/components/ui/toast/toast.js +24 -169
- package/core/components/ui/toast/types.d.ts +9 -0
- package/core/components/ui/toast/types.js +1 -0
- package/core/mixins/Fetcher.d.ts +8 -2
- package/core/mixins/Fetcher.js +9 -4
- package/core/mixins/Subscriber.js +4 -1
- package/core/utils/DataBindObserver.js +11 -7
- package/core/utils/PublisherProxy.d.mts +14 -0
- package/core/utils/PublisherProxy.mjs +33 -2
- package/package.json +5 -1
package/cli.js
CHANGED
|
@@ -57,13 +57,54 @@ function enableShortPaths() {
|
|
|
57
57
|
console.log("✔️ Go and look to tsconfig.json to see generated paths");
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
function createConcordeTsApp() {
|
|
62
|
+
const { execSync } = require('child_process');
|
|
63
|
+
const runCommand = command => {
|
|
64
|
+
try {
|
|
65
|
+
execSync(command, { stdio: "inherit" });
|
|
66
|
+
} catch (e) {
|
|
67
|
+
console.error(`Failed to execute ${command}`, e);
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
const repoName = process.argv[2];
|
|
73
|
+
const gitCheckoutCommand = `git clone --depth 1 https://github.com/ladigitale/concorde-ts-starter ${repoName}`;
|
|
74
|
+
const removeDotGitCommand = `rm -rf ${repoName}/.git`;
|
|
75
|
+
const installDepsCommand = `cd ${repoName} && yarn install`
|
|
76
|
+
const enableShortPathCmd = `cd ${repoName} && npx concorde enable-short-paths`;
|
|
77
|
+
console.log(`Cloning repository with name ${repoName}`);
|
|
78
|
+
const checkout = runCommand(gitCheckoutCommand)
|
|
79
|
+
if (!checkout) process.exit(-1);
|
|
80
|
+
|
|
81
|
+
const removeDotGit = runCommand(removeDotGitCommand);
|
|
82
|
+
if (!removeDotGit) process.exit(-1);
|
|
83
|
+
|
|
84
|
+
console.log(`installing dependencies for ${repoName}`);
|
|
85
|
+
const installDeps = runCommand(installDepsCommand);
|
|
86
|
+
if (!installDeps) process.exit(-1);
|
|
87
|
+
|
|
88
|
+
const enableShortPath = runCommand(enableShortPathCmd);
|
|
89
|
+
if (!enableShortPath) process.exit(-1);
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
console.log("Congratulations! You are ready. Follow the following commands to start");
|
|
93
|
+
console.log(`cd ${repoName} && yarn dev`);
|
|
94
|
+
|
|
95
|
+
}
|
|
60
96
|
switch (process.argv[2]) {
|
|
61
97
|
case "enable-short-paths":
|
|
62
98
|
enableShortPaths();
|
|
63
|
-
|
|
99
|
+
break;
|
|
100
|
+
case "create-concorde-ts-app":
|
|
101
|
+
createConcordeTsApp();
|
|
102
|
+
break;
|
|
103
|
+
|
|
64
104
|
default:
|
|
65
105
|
console.log("Usage: npx concorde <command>");
|
|
66
106
|
console.log("Commands:");
|
|
67
107
|
console.log(" enable-short-paths");
|
|
108
|
+
console.log(" create-concorde-ts-app projectName");
|
|
68
109
|
break;
|
|
69
110
|
}
|
|
@@ -8,7 +8,7 @@ declare const Fetch_base: {
|
|
|
8
8
|
iObserver: IntersectionObserver | null;
|
|
9
9
|
isDefaultLoaderEnabled: boolean;
|
|
10
10
|
isFetchEnabled: boolean;
|
|
11
|
-
|
|
11
|
+
_fetchData(): Promise<void>;
|
|
12
12
|
disconnectedCallback(): void;
|
|
13
13
|
connectedCallback(): void;
|
|
14
14
|
firstUpdated(): void;
|
|
@@ -37,10 +37,14 @@ declare const Fetch_base: {
|
|
|
37
37
|
} & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
38
38
|
/**
|
|
39
39
|
* ###Fetch charge un contenu via un appel d'api web.
|
|
40
|
-
* *
|
|
41
|
-
* *
|
|
40
|
+
* * Fetch etendsles mixins Fetcher et Subscriber
|
|
41
|
+
* * On indique notamment la route de l'api avec l'attribut `endpoint` dans la balise du composant.
|
|
42
|
+
* * Si l'attribut `endpoint` n'est pas disponible le composant utilise la valeur de `dataProvider` "ancêtre" le plus proche.
|
|
43
|
+
* * L'attribut `key` peut être renseigné pour cibler une sous partie de la donnée chargée.
|
|
44
|
+
* Par exemple si la données est `{ma:{data:{a:1,b:2}}}` on peut ecrire `key="ma.data"`. Dans ce cas la données disponible dans le composant sera `{a:1, b:2}`
|
|
42
45
|
* * Les propriétés réactives de tout composants étendant [subscriber](./?path=/docs/miscallenous-🔔-subscriber--page) avec le même dataProvider seront renseignées avec les propriétés de l'objet chargé via l'api.
|
|
43
46
|
* * L'affichage du loader peut être désactivé en ajoutant l'attribut *noLoader* à la balise du composant.
|
|
47
|
+
* * On peut appler la methode invalidate() sur son publishe pour declencher le rechargement des données
|
|
44
48
|
*/
|
|
45
49
|
export declare class Fetch extends Fetch_base {
|
|
46
50
|
static styles: import("lit").CSSResult[];
|
|
@@ -10,10 +10,14 @@ import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
|
10
10
|
import Fetcher from "@supersoniks/concorde/core/mixins/Fetcher";
|
|
11
11
|
/**
|
|
12
12
|
* ###Fetch charge un contenu via un appel d'api web.
|
|
13
|
-
* *
|
|
14
|
-
* *
|
|
13
|
+
* * Fetch etendsles mixins Fetcher et Subscriber
|
|
14
|
+
* * On indique notamment la route de l'api avec l'attribut `endpoint` dans la balise du composant.
|
|
15
|
+
* * Si l'attribut `endpoint` n'est pas disponible le composant utilise la valeur de `dataProvider` "ancêtre" le plus proche.
|
|
16
|
+
* * L'attribut `key` peut être renseigné pour cibler une sous partie de la donnée chargée.
|
|
17
|
+
* Par exemple si la données est `{ma:{data:{a:1,b:2}}}` on peut ecrire `key="ma.data"`. Dans ce cas la données disponible dans le composant sera `{a:1, b:2}`
|
|
15
18
|
* * Les propriétés réactives de tout composants étendant [subscriber](./?path=/docs/miscallenous-🔔-subscriber--page) avec le même dataProvider seront renseignées avec les propriétés de l'objet chargé via l'api.
|
|
16
19
|
* * L'affichage du loader peut être désactivé en ajoutant l'attribut *noLoader* à la balise du composant.
|
|
20
|
+
* * On peut appler la methode invalidate() sur son publishe pour declencher le rechargement des données
|
|
17
21
|
*/
|
|
18
22
|
let Fetch = class Fetch extends Fetcher(Subscriber(LitElement)) {
|
|
19
23
|
render() {
|
|
@@ -10,7 +10,7 @@ declare const List_base: {
|
|
|
10
10
|
iObserver: IntersectionObserver | null;
|
|
11
11
|
isDefaultLoaderEnabled: boolean;
|
|
12
12
|
isFetchEnabled: boolean;
|
|
13
|
-
|
|
13
|
+
_fetchData(): Promise<void>;
|
|
14
14
|
disconnectedCallback(): void;
|
|
15
15
|
connectedCallback(): void;
|
|
16
16
|
firstUpdated(): void;
|
|
@@ -40,18 +40,20 @@ declare const List_base: {
|
|
|
40
40
|
/**
|
|
41
41
|
* ### List boucle sur sa propriété "props" et crée des éléments a partir des données en bouclant également sur ses templates.
|
|
42
42
|
*
|
|
43
|
-
* * Si le composant possède un attribut *fetch
|
|
44
|
-
*
|
|
45
|
-
*
|
|
43
|
+
* * Si le composant possède un attribut *fetch*, il charge un contenu via un appel d'api web comme le fait [fetch](./?path=/docs/core-components-functional-fetch--basic)
|
|
44
|
+
* * La proriété *key* (issue du fetcher) permet de cibler une propriété particulière du retour de l'api.
|
|
46
45
|
* * Chaque élément créé est englobé dans un objet [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
|
|
47
|
-
* un dataProvider y est associé a l'adresse suivante *dataProvider-de-la-liste$/*index-
|
|
48
|
-
* Les
|
|
46
|
+
* un dataProvider y est associé a l'adresse suivante *dataProvider-de-la-liste$/*index-de-la-ligne-courante*
|
|
47
|
+
* Les données de la ligne sont donc disponible pour les élements internes (subscribers, data-binding)
|
|
49
48
|
* * Lors du chargement un objet loader inline est affiché.
|
|
50
|
-
* * Si le résultat de la requête
|
|
51
|
-
*
|
|
49
|
+
* * Si le résultat de la requête est un objet, il est imbriqué dans un tableau pour garantir le fonctionnement.
|
|
50
|
+
* Cependant, si l'attribut `extractValues` est présent, les valeurs des propriétés de l'objet sont mises dans dans un tableau pour le rendu.
|
|
51
|
+
* * La propriété _key_ est ajoutés à la donnée de chaque item. Elle contient l'index dans le cas d'un liste simple ou la clés associée à la valeur si `extractValues` est définit.
|
|
52
|
+
* * On peut appler la methode invalidate() sur son publishe pour declencher le rechargement des données
|
|
52
53
|
*/
|
|
53
54
|
export declare class List extends List_base {
|
|
54
55
|
static styles: import("lit").CSSResult[];
|
|
56
|
+
itemPropertyMap: Object | null;
|
|
55
57
|
/**
|
|
56
58
|
* La propriété templateKey contient le nom de la propriété qui sera utilisé pour identifier le template à utiliser dans la donnée de la ligne.
|
|
57
59
|
* Par exemple si templateIdentifier = "name" et que la donnée de la ligne est {name: "myTemplate" ... }, alors le template possédant l'attribut data-value="myTemplate" sera utilisé.
|
|
@@ -18,19 +18,21 @@ import TemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesConta
|
|
|
18
18
|
/**
|
|
19
19
|
* ### List boucle sur sa propriété "props" et crée des éléments a partir des données en bouclant également sur ses templates.
|
|
20
20
|
*
|
|
21
|
-
* * Si le composant possède un attribut *fetch
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* * Si le composant possède un attribut *fetch*, il charge un contenu via un appel d'api web comme le fait [fetch](./?path=/docs/core-components-functional-fetch--basic)
|
|
22
|
+
* * La proriété *key* (issue du fetcher) permet de cibler une propriété particulière du retour de l'api.
|
|
24
23
|
* * Chaque élément créé est englobé dans un objet [Subscriber](./?path=/docs/miscallenous-🔔-subscriber--page)
|
|
25
|
-
* un dataProvider y est associé a l'adresse suivante *dataProvider-de-la-liste$/*index-
|
|
26
|
-
* Les
|
|
24
|
+
* un dataProvider y est associé a l'adresse suivante *dataProvider-de-la-liste$/*index-de-la-ligne-courante*
|
|
25
|
+
* Les données de la ligne sont donc disponible pour les élements internes (subscribers, data-binding)
|
|
27
26
|
* * Lors du chargement un objet loader inline est affiché.
|
|
28
|
-
* * Si le résultat de la requête
|
|
29
|
-
*
|
|
27
|
+
* * Si le résultat de la requête est un objet, il est imbriqué dans un tableau pour garantir le fonctionnement.
|
|
28
|
+
* Cependant, si l'attribut `extractValues` est présent, les valeurs des propriétés de l'objet sont mises dans dans un tableau pour le rendu.
|
|
29
|
+
* * La propriété _key_ est ajoutés à la donnée de chaque item. Elle contient l'index dans le cas d'un liste simple ou la clés associée à la valeur si `extractValues` est définit.
|
|
30
|
+
* * On peut appler la methode invalidate() sur son publishe pour declencher le rechargement des données
|
|
30
31
|
*/
|
|
31
32
|
let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))) {
|
|
32
33
|
constructor() {
|
|
33
34
|
super(...arguments);
|
|
35
|
+
this.itemPropertyMap = null;
|
|
34
36
|
/**
|
|
35
37
|
* La propriété templateKey contient le nom de la propriété qui sera utilisé pour identifier le template à utiliser dans la donnée de la ligne.
|
|
36
38
|
* Par exemple si templateIdentifier = "name" et que la donnée de la ligne est {name: "myTemplate" ... }, alors le template possédant l'attribut data-value="myTemplate" sera utilisé.
|
|
@@ -54,7 +56,8 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
54
56
|
// si props est une string on considère qu'il n'y a pas de résultats
|
|
55
57
|
if (typeof this.props == "string") {
|
|
56
58
|
return html `<div class="sonic-no-result-container">
|
|
57
|
-
<sonic-icon prefix="iconoir" name="emoji-think-left" size="lg"></sonic-icon
|
|
59
|
+
<sonic-icon prefix="iconoir" name="emoji-think-left" size="lg"></sonic-icon
|
|
60
|
+
><span class="sonic-no-result-text">${this.props}</span>
|
|
58
61
|
</div>`;
|
|
59
62
|
}
|
|
60
63
|
// si props est un objet mais qu'il n'y a pas de contenu on retourn une div vide (nécessaire pour le lazyload)
|
|
@@ -82,7 +85,9 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
82
85
|
counter++;
|
|
83
86
|
if (hasCustomTemplate)
|
|
84
87
|
counter = -1;
|
|
85
|
-
let
|
|
88
|
+
let key = extractValues ? item.key : index;
|
|
89
|
+
let pub = this.publisher[key];
|
|
90
|
+
pub._key_ = key + "";
|
|
86
91
|
return (item &&
|
|
87
92
|
html `
|
|
88
93
|
<sonic-subscriber
|
|
@@ -90,6 +95,7 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
90
95
|
.bindPublisher=${function () {
|
|
91
96
|
return pub;
|
|
92
97
|
}}
|
|
98
|
+
.propertyMap=${ifDefined(this.itemPropertyMap)}
|
|
93
99
|
dataProvider="${this.dataProvider}/list-item/${index}"
|
|
94
100
|
>
|
|
95
101
|
${hasCustomTemplate
|
|
@@ -115,6 +121,9 @@ List.styles = [
|
|
|
115
121
|
}
|
|
116
122
|
`,
|
|
117
123
|
];
|
|
124
|
+
__decorate([
|
|
125
|
+
property({ type: Object })
|
|
126
|
+
], List.prototype, "itemPropertyMap", void 0);
|
|
118
127
|
__decorate([
|
|
119
128
|
property({ type: String })
|
|
120
129
|
], List.prototype, "templateKey", void 0);
|
|
@@ -10,15 +10,17 @@ declare const Queue_base: (new (...args: any[]) => import("@supersoniks/concorde
|
|
|
10
10
|
* Les valeurs renseignées dans ce publisher sont ajoutées en get à chaque requête
|
|
11
11
|
* * la proriété *key* peut être utilisé pour cibler une propriété particulière du retour de l'api.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export default class Queue extends Queue_base {
|
|
14
14
|
templates: Array<HTMLTemplateElement> | null;
|
|
15
15
|
lastRequestTime: number;
|
|
16
16
|
key: String;
|
|
17
|
+
itemPropertyMap: Object | null;
|
|
17
18
|
/**
|
|
18
19
|
* Durée cible en ms d'une requête pour afficher 1 lot.
|
|
19
20
|
*/
|
|
20
21
|
targetRequestDuration: number;
|
|
21
22
|
limit: number;
|
|
23
|
+
offset: number;
|
|
22
24
|
static instanceCounter: number;
|
|
23
25
|
connectedCallback(): void;
|
|
24
26
|
filterPublisher: PublisherProxy | null;
|
|
@@ -26,6 +26,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
26
26
|
this.templates = null;
|
|
27
27
|
this.lastRequestTime = 0;
|
|
28
28
|
this.key = "";
|
|
29
|
+
this.itemPropertyMap = null;
|
|
29
30
|
/**
|
|
30
31
|
* Durée cible en ms d'une requête pour afficher 1 lot.
|
|
31
32
|
*/
|
|
@@ -35,6 +36,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
35
36
|
* Cette valeur est mise à jour ensuite par Queue pour chauq lot pour se rapprocher tanque possible de *targetRequestDuration*
|
|
36
37
|
*/
|
|
37
38
|
this.limit = 5;
|
|
39
|
+
this.offset = 0;
|
|
38
40
|
this.filterPublisher = null;
|
|
39
41
|
this.filterTimeoutId = undefined;
|
|
40
42
|
/**
|
|
@@ -89,7 +91,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
89
91
|
}
|
|
90
92
|
next(e) {
|
|
91
93
|
var _a, _b;
|
|
92
|
-
let offset =
|
|
94
|
+
let offset = this.offset;
|
|
93
95
|
const newTime = new Date().getTime();
|
|
94
96
|
const requestDuration = newTime - this.lastRequestTime;
|
|
95
97
|
if (e) {
|
|
@@ -101,7 +103,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
101
103
|
this.props = [];
|
|
102
104
|
}
|
|
103
105
|
else {
|
|
104
|
-
const props =
|
|
106
|
+
const props = this.props;
|
|
105
107
|
const item = props[props.length - 1];
|
|
106
108
|
offset = parseInt(item.offset.toString()) + parseInt(item.limit.toString());
|
|
107
109
|
}
|
|
@@ -123,7 +125,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
123
125
|
this.listDataProviders.push(dataProvider);
|
|
124
126
|
this.currentScrollPosition = (_b = document.scrollingElement) === null || _b === void 0 ? void 0 : _b.scrollTop;
|
|
125
127
|
this.props = [
|
|
126
|
-
...
|
|
128
|
+
...this.props,
|
|
127
129
|
{
|
|
128
130
|
id: searchParams.toString() + "/" + this.props.length,
|
|
129
131
|
dataProvider: dataProvider,
|
|
@@ -147,6 +149,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
147
149
|
${repeat(this.props, (item) => item.id, (item) => html `
|
|
148
150
|
<sonic-list
|
|
149
151
|
fetch
|
|
152
|
+
.itemPropertyMap=${this.itemPropertyMap}
|
|
150
153
|
debug=${ifDefined(this.defferedDebug)}
|
|
151
154
|
@load=${this.next}
|
|
152
155
|
key=${this.key}
|
|
@@ -161,12 +164,18 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
161
164
|
}
|
|
162
165
|
};
|
|
163
166
|
Queue.instanceCounter = 0;
|
|
167
|
+
__decorate([
|
|
168
|
+
property({ type: Object })
|
|
169
|
+
], Queue.prototype, "itemPropertyMap", void 0);
|
|
164
170
|
__decorate([
|
|
165
171
|
property()
|
|
166
172
|
], Queue.prototype, "targetRequestDuration", void 0);
|
|
167
173
|
__decorate([
|
|
168
174
|
property()
|
|
169
175
|
], Queue.prototype, "limit", void 0);
|
|
176
|
+
__decorate([
|
|
177
|
+
property()
|
|
178
|
+
], Queue.prototype, "offset", void 0);
|
|
170
179
|
__decorate([
|
|
171
180
|
property({ type: String })
|
|
172
181
|
], Queue.prototype, "dataProviderExpression", void 0);
|
|
@@ -176,7 +185,7 @@ __decorate([
|
|
|
176
185
|
Queue = Queue_1 = __decorate([
|
|
177
186
|
customElement("sonic-queue")
|
|
178
187
|
], Queue);
|
|
179
|
-
export
|
|
188
|
+
export default Queue;
|
|
180
189
|
//Ajout pour custom-elements-manifesy pour storybook notamment
|
|
181
190
|
try {
|
|
182
191
|
customElements.define("sonic-queue", Queue);
|
|
@@ -41,7 +41,7 @@ let SonicRedirect = class SonicRedirect extends Subscriber(LitElement) {
|
|
|
41
41
|
return;
|
|
42
42
|
let onDataPath = this.getAttribute("onData").split(".");
|
|
43
43
|
let searchedData = Objects.traverse(this.props, onDataPath);
|
|
44
|
-
if (searchedData) {
|
|
44
|
+
if (searchedData && !(Objects.isObject(searchedData) && searchedData)) {
|
|
45
45
|
LocationHandler.changeFromComponent(this);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -37,6 +37,7 @@ let SonicStates = class SonicStates extends Subscriber(TemplatesContainer(LitEle
|
|
|
37
37
|
}
|
|
38
38
|
connectedCallback() {
|
|
39
39
|
super.connectedCallback();
|
|
40
|
+
console.log("BB");
|
|
40
41
|
if (this.hasAttribute("data-path")) {
|
|
41
42
|
this.statePath = this.getAttribute("data-path");
|
|
42
43
|
}
|
|
@@ -64,6 +65,7 @@ let SonicStates = class SonicStates extends Subscriber(TemplatesContainer(LitEle
|
|
|
64
65
|
if ((!Array.isArray(state) && Objects.isObject(state)) || state === undefined) {
|
|
65
66
|
state = "";
|
|
66
67
|
}
|
|
68
|
+
console.log(state);
|
|
67
69
|
for (let t of this.templatePartsList) {
|
|
68
70
|
let path = t.getAttribute(this.templateValueAttribute);
|
|
69
71
|
let stateToMatch = state;
|
|
@@ -15,7 +15,7 @@ declare const Submit_base: (new (...args: any[]) => import("@supersoniks/concord
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class Submit extends Submit_base {
|
|
17
17
|
static styles: import("lit").CSSResult;
|
|
18
|
-
disabled:
|
|
18
|
+
disabled: boolean;
|
|
19
19
|
api: API | null;
|
|
20
20
|
connectedCallback(): void;
|
|
21
21
|
submit(): Promise<void>;
|
|
@@ -34,7 +34,7 @@ import { css, html, LitElement } from "lit";
|
|
|
34
34
|
let Submit = class Submit extends Subscriber(LitElement) {
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
|
-
this.disabled =
|
|
37
|
+
this.disabled = false;
|
|
38
38
|
this.api = null;
|
|
39
39
|
}
|
|
40
40
|
connectedCallback() {
|
|
@@ -51,7 +51,7 @@ let Submit = class Submit extends Subscriber(LitElement) {
|
|
|
51
51
|
submit() {
|
|
52
52
|
var _a, _b, _c, _d, _e;
|
|
53
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
this.publisher.disabled =
|
|
54
|
+
this.publisher.disabled = true;
|
|
55
55
|
let method = ((_a = this.getAttribute("method")) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) || "post";
|
|
56
56
|
let postData = PublisherManager.getInstance().get(this.getAncestorAttributeValue("formDataProvider")).get();
|
|
57
57
|
let result = null;
|
|
@@ -79,23 +79,22 @@ let Submit = class Submit extends Subscriber(LitElement) {
|
|
|
79
79
|
clearedDataProvider.split(" ").forEach(dataProvider => PublisherManager.getInstance().get(dataProvider).set({}));
|
|
80
80
|
}
|
|
81
81
|
PublisherManager.getInstance().get(this.getAncestorAttributeValue("submitResultDataProvider")).set(result);
|
|
82
|
-
this.publisher.disabled =
|
|
82
|
+
this.publisher.disabled = false;
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
render() {
|
|
86
|
-
|
|
87
|
-
return html `<div class="${disabled}"><slot></slot></div>`;
|
|
86
|
+
return html `<div ?data-disabled=${this.disabled}><slot></slot></div>`;
|
|
88
87
|
}
|
|
89
88
|
};
|
|
90
89
|
Submit.styles = css `
|
|
91
|
-
|
|
90
|
+
[data-disabled]{
|
|
92
91
|
opacity: 0.3;
|
|
93
92
|
pointer-events: none;
|
|
94
93
|
user-select: none;
|
|
95
94
|
}
|
|
96
95
|
`;
|
|
97
96
|
__decorate([
|
|
98
|
-
property({ type:
|
|
97
|
+
property({ type: Boolean })
|
|
99
98
|
], Submit.prototype, "disabled", void 0);
|
|
100
99
|
Submit = __decorate([
|
|
101
100
|
customElement("sonic-submit")
|
|
@@ -103,7 +103,13 @@ Alert.styles = [
|
|
|
103
103
|
bottom: 0;
|
|
104
104
|
opacity: 0.08;
|
|
105
105
|
border-radius: var(--sc-alert-rounded);
|
|
106
|
+
pointer-events:none;
|
|
106
107
|
}
|
|
108
|
+
:host([background]) > div {
|
|
109
|
+
z-index:2;
|
|
110
|
+
position:relative;
|
|
111
|
+
}
|
|
112
|
+
|
|
107
113
|
|
|
108
114
|
/*SIZE*/
|
|
109
115
|
:host([size="xs"]) {
|
|
@@ -151,7 +151,7 @@ let Button = class Button extends FormCheckable(FormElement(Subscriber(LitElemen
|
|
|
151
151
|
<slot @slotchange=${this.onSlotChange} part="prefix" name="prefix"></slot>
|
|
152
152
|
<slot part="main" class="main-slot"></slot>
|
|
153
153
|
<slot @slotchange=${this.onSlotChange} part="suffix" name="suffix"></slot>
|
|
154
|
-
${this.loading == true ? html `<sonic-icon prefix="
|
|
154
|
+
${this.loading == true ? html `<sonic-icon prefix="feather" name="loader" class="loader"></sonic-icon>` : ""}
|
|
155
155
|
</button>
|
|
156
156
|
`;
|
|
157
157
|
return this.href
|
|
@@ -282,6 +282,9 @@ Button.styles = [
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
/*SIZE*/
|
|
285
|
+
:host([size="2xs"]) {
|
|
286
|
+
--sc-btn-fs: 0.6rem;
|
|
287
|
+
}
|
|
285
288
|
:host([size="xs"]) {
|
|
286
289
|
--sc-btn-fs: 0.75rem;
|
|
287
290
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"iconoir":{"cancel":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6.75827 17.2426L12.0009 12M17.2435 6.75736L12.0009 12M12.0009 12L6.75827 6.75736M12.0009 12L17.2435 17.2426\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","check-circled-outline":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M7 12.5L10 15.5L17 8.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","check":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5 13L9 17L19 7\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","emoji-think-left":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M10 15H7M2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M8.5 9C8.22386 9 8 8.77614 8 8.5C8 8.22386 8.22386 8 8.5 8C8.77614 8 9 8.22386 9 8.5C9 8.77614 8.77614 9 8.5 9Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M15.5 9C15.2239 9 15 8.77614 15 8.5C15 8.22386 15.2239 8 15.5 8C15.7761 8 16 8.22386 16 8.5C16 8.77614 15.7761 9 15.5 9Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","info-empty":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 11.5V16.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 7.51L12.01 7.49889\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","more-vert":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 12.5C12.2761 12.5 12.5 12.2761 12.5 12C12.5 11.7239 12.2761 11.5 12 11.5C11.7239 11.5 11.5 11.7239 11.5 12C11.5 12.2761 11.7239 12.5 12 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 18.5C12.2761 18.5 12.5 18.2761 12.5 18C12.5 17.7239 12.2761 17.5 12 17.5C11.7239 17.5 11.5 17.7239 11.5 18C11.5 18.2761 11.7239 18.5 12 18.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 6.5C12.2761 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.2761 5.5 12 5.5C11.7239 5.5 11.5 5.72386 11.5 6C11.5 6.27614 11.7239 6.5 12 6.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","nav-arrow-down":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6 9L12 15L18 9\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","warning-circled-outline":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 7L12 13\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 17.01L12.01 16.9989\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n"}}
|
|
1
|
+
{"iconoir":{"cancel":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6.75827 17.2426L12.0009 12M17.2435 6.75736L12.0009 12M12.0009 12L6.75827 6.75736M12.0009 12L17.2435 17.2426\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","check-circled-outline":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M7 12.5L10 15.5L17 8.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","check":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5 13L9 17L19 7\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","emoji-think-left":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M10 15H7M2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M8.5 9C8.22386 9 8 8.77614 8 8.5C8 8.22386 8.22386 8 8.5 8C8.77614 8 9 8.22386 9 8.5C9 8.77614 8.77614 9 8.5 9Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M15.5 9C15.2239 9 15 8.77614 15 8.5C15 8.22386 15.2239 8 15.5 8C15.7761 8 16 8.22386 16 8.5C16 8.77614 15.7761 9 15.5 9Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","info-empty":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 11.5V16.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 7.51L12.01 7.49889\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","loader":"","more-vert":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 12.5C12.2761 12.5 12.5 12.2761 12.5 12C12.5 11.7239 12.2761 11.5 12 11.5C11.7239 11.5 11.5 11.7239 11.5 12C11.5 12.2761 11.7239 12.5 12 12.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 18.5C12.2761 18.5 12.5 18.2761 12.5 18C12.5 17.7239 12.2761 17.5 12 17.5C11.7239 17.5 11.5 17.7239 11.5 18C11.5 18.2761 11.7239 18.5 12 18.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 6.5C12.2761 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.2761 5.5 12 5.5C11.7239 5.5 11.5 5.72386 11.5 6C11.5 6.27614 11.7239 6.5 12 6.5Z\" fill=\"currentColor\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","nav-arrow-down":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6 9L12 15L18 9\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n","warning-circled-outline":"<svg width=\"24\" height=\"24\" stroke-width=\"1.5\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12 7L12 13\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 17.01L12.01 16.9989\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n"}}
|
|
@@ -4,7 +4,7 @@ export const coreVariables = css `
|
|
|
4
4
|
/* --sc-rfs: 16px; */
|
|
5
5
|
|
|
6
6
|
/* polices*/
|
|
7
|
-
--sc-font-family-base:
|
|
7
|
+
--sc-font-family-base: "neue-haas-unica", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
8
8
|
"Helvetica Neue", Arial, sans-serif;
|
|
9
9
|
--sc-font-weight-base: 400;
|
|
10
10
|
--sc-font-style-base: inherit;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LitElement, nothing } from "lit";
|
|
2
|
+
import "./types";
|
|
3
|
+
import { ToastStatus } from "./types";
|
|
4
|
+
export declare class SonicToastItem extends LitElement {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
title: string;
|
|
7
|
+
text: string;
|
|
8
|
+
status: ToastStatus;
|
|
9
|
+
ghost: boolean;
|
|
10
|
+
preserve: boolean;
|
|
11
|
+
visible: boolean;
|
|
12
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
13
|
+
hide(): void;
|
|
14
|
+
show(): void;
|
|
15
|
+
autoHide(): void;
|
|
16
|
+
}
|