qc-trousse-sdg 1.4.5 → 1.4.7
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 +16 -0
- package/dist/css/qc-sdg-no-grid.min.css +1 -1
- package/dist/css/qc-sdg.min.css +1 -1
- package/dist/js/qc-sdg.min.js +1 -1
- package/package-lock.json +4689 -0
- package/package.json +1 -1
- package/plugins/buildHtmlDoc.js +5 -1
- package/public/css/qc-doc-sdg.css +69 -34
- package/public/css/qc-sdg-no-grid.css +86 -45
- package/public/css/qc-sdg.css +86 -45
- package/public/index.html +82 -51
- package/public/js/qc-doc-sdg.js +8081 -3972
- package/public/js/qc-sdg.js +8772 -5119
- package/rollup.config.js +3 -4
- package/src/doc/components/Code.svelte +13 -5
- package/src/doc/components/Exemple.svelte +0 -13
- package/src/doc/qc-doc-sdg.js +6 -1
- package/src/doc/scss/components/_code.scss +4 -21
- package/src/doc/scss/components/_exemple.scss +25 -0
- package/src/doc/scss/qc-doc-sdg.scss +23 -4
- package/src/sdg/bases/Icon/Icon.svelte +2 -0
- package/src/sdg/bases/links/_links.html +10 -10
- package/src/sdg/bases/links/_links.scss +18 -12
- package/src/sdg/components/Alert/Alert.svelte +28 -9
- package/src/sdg/components/Alert/AlertWC.svelte +20 -5
- package/src/sdg/components/Alert/Test/AlertSvelteTest.svelte +25 -0
- package/src/sdg/components/Alert/Test/alertBaselineTest.html +13 -0
- package/src/sdg/components/Alert/Test/alertSvelteTest.html +1 -0
- package/src/sdg/components/Alert/_alert.html +25 -13
- package/src/sdg/components/Checkbox/Checkbox.svelte +6 -5
- package/src/sdg/components/ChoiceGroup/_choiceGroup.html +0 -2
- package/src/sdg/components/DropdownList/DropdownList.svelte +65 -14
- package/src/sdg/components/DropdownList/DropdownListButton/DropdownListButton.svelte +2 -6
- package/src/sdg/components/DropdownList/DropdownListItems/DropdownListItems.svelte +4 -22
- package/src/sdg/components/DropdownList/DropdownListItems/DropdownListItemsMultiple/DropdownListItemsMultiple.svelte +2 -1
- package/src/sdg/components/DropdownList/DropdownListItems/DropdownListItemsSingle/DropdownListItemsSingle.svelte +2 -1
- package/src/sdg/components/DropdownList/SelectWC.svelte +39 -13
- package/src/sdg/components/DropdownList/Test/DropdownListSvelteTest.svelte +2 -2
- package/src/sdg/components/DropdownList/Test/dropdownListBaselineTest.html +7 -0
- package/src/sdg/components/DropdownList/_dropdownList.scss +7 -5
- package/src/sdg/components/DropdownList/_select.html +31 -5
- package/src/sdg/components/ExternalLink/ExternalLink.svelte +36 -74
- package/src/sdg/components/ExternalLink/ExternalLinkWC.svelte +44 -1
- package/src/sdg/components/ExternalLink/externalLinkBaselineTest.html +45 -0
- package/src/sdg/components/Fieldset/_fieldset.scss +1 -1
- package/src/sdg/components/FormfieldRow/_formfieldRow.html +7 -7
- package/src/sdg/components/Label/LabelText.svelte +2 -1
- package/src/sdg/components/Label/_label.scss +10 -2
- package/src/sdg/components/Notice/_notice.html +3 -3
- package/src/sdg/components/PivFooter/_pivFooter.html +4 -4
- package/src/sdg/components/PivHeader/Test/pivHeaderBaselineTest.html +2 -2
- package/src/sdg/components/PivHeader/Test/pivHeaderEmbeddedTest.svelte +2 -1
- package/src/sdg/components/PivHeader/_pivHeader.html +2 -2
- package/src/sdg/components/PivHeader/_pivHeader.scss +6 -4
- package/src/sdg/components/TextField/Test/TextFieldEmbededTest.svelte +19 -3
- package/src/sdg/components/TextField/Test/textFieldBaselineTest.html +5 -2
- package/src/sdg/components/TextField/TextField.svelte +12 -6
- package/src/sdg/components/TextField/TextFieldWC.svelte +27 -13
- package/src/sdg/components/TextField/_textField.html +0 -5
- package/src/sdg/components/TextField/textFieldUtils.js +3 -2
- package/src/sdg/components/utils.js +78 -14
- package/src/sdg/qc-sdg-test.js +2 -1
- package/src/sdg/scss/lib/_mixins.scss +6 -0
- package/src/sdg/scss/utilities/_states.scss +1 -1
- package/tests/alert-baseline.spec.ts +23 -0
- package/tests/alert-svelte.spec.ts +23 -0
- package/tests/buildSvelteTestsIgnore.json +2 -1
- package/tests/dropdown-list-baseline.spec.ts +8 -0
- package/tests/external-link-baseline.spec.ts +30 -0
- package/tests/textfield-baseline.spec.ts +5 -5
- package/tests/textfield-svelte.spec.ts +5 -5
- package/src/sdg/components/CharCount/_charCount.html +0 -7
- package/src/sdg/components/RadioButton/_radioButton.html +0 -24
package/rollup.config.js
CHANGED
|
@@ -18,12 +18,11 @@ import buildSvelteTests from "./plugins/buildSvelteTests";
|
|
|
18
18
|
|
|
19
19
|
const
|
|
20
20
|
dev_process = (process.env.npm_lifecycle_event == 'dev'),
|
|
21
|
-
version_process = (process.env.npm_lifecycle_event == 'version'),
|
|
22
21
|
build_process = (process.env.npm_lifecycle_event == 'build')
|
|
23
22
|
;
|
|
24
23
|
const verbose = false;
|
|
25
24
|
const includePaths = [
|
|
26
|
-
|
|
25
|
+
!build_process && 'src/doc/scss',
|
|
27
26
|
'src/sdg/scss',
|
|
28
27
|
"src",
|
|
29
28
|
].filter(Boolean);
|
|
@@ -66,7 +65,7 @@ const scssOptions = {
|
|
|
66
65
|
cssReplace({
|
|
67
66
|
data: {
|
|
68
67
|
'pkg-version': pkg.version,
|
|
69
|
-
'dev-env':
|
|
68
|
+
'dev-env': !build_process ? 'true' : 'false',
|
|
70
69
|
}
|
|
71
70
|
})
|
|
72
71
|
])
|
|
@@ -95,7 +94,7 @@ let
|
|
|
95
94
|
compilerOptions: {
|
|
96
95
|
// enable run-time checks
|
|
97
96
|
customElement: true,
|
|
98
|
-
dev:
|
|
97
|
+
dev: !build_process,
|
|
99
98
|
cssHash: ({ hash, name, filename, css }) => {
|
|
100
99
|
// replacement of default `svelte-${hash(css)}`
|
|
101
100
|
return `qc-hash-${hash(css)}`;
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
import pretty from "pretty";
|
|
15
15
|
import jsBeautify from "js-beautify";
|
|
16
16
|
|
|
17
|
+
const copyButtonTimeout = 2000;
|
|
18
|
+
|
|
17
19
|
let {
|
|
18
20
|
targetId = '',
|
|
19
21
|
rawCode = '',
|
|
@@ -23,11 +25,14 @@
|
|
|
23
25
|
|
|
24
26
|
let hlCode = $state();
|
|
25
27
|
let prettyCode = $state();
|
|
28
|
+
let copied = $state(false);
|
|
26
29
|
|
|
27
30
|
function copy() {
|
|
28
31
|
navigator.clipboard.writeText(prettyCode);
|
|
29
|
-
|
|
30
|
-
setTimeout(() => {
|
|
32
|
+
copied = true;
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
copied = false;
|
|
35
|
+
}, copyButtonTimeout);
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
function updateHLCode(rawCode, targetId) {
|
|
@@ -53,10 +58,13 @@
|
|
|
53
58
|
|
|
54
59
|
<pre
|
|
55
60
|
><code class="hljs"
|
|
56
|
-
><button class=
|
|
61
|
+
><button class={`qc-button qc-compact ${copied? "qc-secondary" : "qc-primary"}`}
|
|
57
62
|
onclick={copy}>
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
{#if !copied}
|
|
64
|
+
<span class="copy">Copier</span>
|
|
65
|
+
{:else}
|
|
66
|
+
<span class="copied">Copié !</span>
|
|
67
|
+
{/if}
|
|
60
68
|
</button
|
|
61
69
|
>{@html hlCode}</code
|
|
62
70
|
></pre>
|
|
@@ -59,16 +59,3 @@
|
|
|
59
59
|
<Code rawCode={exempleCode}></Code>
|
|
60
60
|
{/if}
|
|
61
61
|
</div>
|
|
62
|
-
<style lang="scss">
|
|
63
|
-
figure {
|
|
64
|
-
//display: block;
|
|
65
|
-
max-width: token-value(max-content-width);
|
|
66
|
-
width: 100%;
|
|
67
|
-
@include qc-shading(0);
|
|
68
|
-
margin-bottom: token-value(spacer content-block mb);
|
|
69
|
-
.exemple {
|
|
70
|
-
padding: token-value(spacer sm) token-value(spacer sm) 0 token-value(spacer sm);
|
|
71
|
-
margin-bottom: token-value(spacer sm);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
</style>
|
package/src/doc/qc-doc-sdg.js
CHANGED
|
@@ -16,7 +16,8 @@ const maskableAlert = document.getElementById("alerte-masquable");
|
|
|
16
16
|
if (displayAlertLink) {
|
|
17
17
|
displayAlertLink.addEventListener(
|
|
18
18
|
'click',
|
|
19
|
-
() => {
|
|
19
|
+
(evt) => {
|
|
20
|
+
evt.preventDefault();
|
|
20
21
|
maskableAlert.setAttribute('hide', 'false');
|
|
21
22
|
displayAlertLink.hidden = true;
|
|
22
23
|
}
|
|
@@ -29,6 +30,10 @@ if (displayAlertLink) {
|
|
|
29
30
|
}
|
|
30
31
|
)
|
|
31
32
|
}
|
|
33
|
+
|
|
34
|
+
if (maskableAlert && displayAlertLink && !maskableAlert.querySelector('.qc-general-alert')) {
|
|
35
|
+
displayAlertLink.removeAttribute('hidden');
|
|
36
|
+
}
|
|
32
37
|
// add version
|
|
33
38
|
|
|
34
39
|
|
|
@@ -10,34 +10,17 @@ pre {
|
|
|
10
10
|
padding: 0;
|
|
11
11
|
white-space: pre-wrap;
|
|
12
12
|
overflow: auto;
|
|
13
|
+
position: relative;
|
|
13
14
|
|
|
14
15
|
code, .qc-code {
|
|
15
16
|
font-family: token-value(font, family, code);
|
|
16
17
|
|
|
17
18
|
button {
|
|
18
19
|
float: right;
|
|
19
|
-
|
|
20
|
-
right: token-value(spacer
|
|
21
|
-
top: token-value(spacer
|
|
22
|
-
padding: token-value(spacer xs) token-value(spacer sm) ;
|
|
23
|
-
color : white;
|
|
24
|
-
background-color: token-value(color blue piv);
|
|
25
|
-
border: 1px solid;
|
|
20
|
+
position: absolute;
|
|
21
|
+
right: token-value(spacer sm);
|
|
22
|
+
top: token-value(spacer sm);
|
|
26
23
|
white-space: nowrap;
|
|
27
|
-
transition: none!important;
|
|
28
|
-
.copy {display: inline;}
|
|
29
|
-
.copied {display: none;}
|
|
30
|
-
&.copied {
|
|
31
|
-
background-color: transparent!important;
|
|
32
|
-
border-color: transparent!important;;
|
|
33
|
-
box-shadow: none!important;
|
|
34
|
-
color: token-value(color blue piv)!important;
|
|
35
|
-
.copy {display: none;}
|
|
36
|
-
.copied {
|
|
37
|
-
display: inline;
|
|
38
|
-
//animation: fadeout .5s;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
24
|
}
|
|
42
25
|
}
|
|
43
26
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@use "qc-sdg-lib" as *;
|
|
2
|
+
|
|
3
|
+
.exemple-area > figure {
|
|
4
|
+
display: block;
|
|
5
|
+
max-width: token-value(max-content-width);
|
|
6
|
+
width: 100%;
|
|
7
|
+
margin-bottom: token-value(spacer content-block mb);
|
|
8
|
+
padding-bottom: 1px;
|
|
9
|
+
.exemple {
|
|
10
|
+
padding: token-value(spacer sm) token-value(spacer sm) token-value(spacer sm) token-value(spacer sm);
|
|
11
|
+
@include qc-shading(0);
|
|
12
|
+
|
|
13
|
+
& > *:last-child {
|
|
14
|
+
margin-bottom: 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
& > figcaption {
|
|
19
|
+
display: block;
|
|
20
|
+
}
|
|
21
|
+
&:has(qc-select) {
|
|
22
|
+
overflow-x: visible;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use "qc-sdg-lib" as *;
|
|
2
2
|
@use "components/code" as *;
|
|
3
|
+
@use "components/exemple" as *;
|
|
3
4
|
@use "tables";
|
|
4
5
|
@use "jQueryUI/jquery-ui.autocomplete";
|
|
5
6
|
|
|
@@ -93,24 +94,39 @@ h1,h2,h3,h4,h5,h6 {
|
|
|
93
94
|
|
|
94
95
|
a {
|
|
95
96
|
|
|
97
|
+
&.pseudo-visited {
|
|
98
|
+
color: token-value(color,link,visited);
|
|
99
|
+
& > .qc-ext-link-img {
|
|
100
|
+
background-color: token-value(color, link, visited);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
96
103
|
&.pseudo-hover {
|
|
97
104
|
@include hover-link();
|
|
105
|
+
& > .qc-ext-link-img {
|
|
106
|
+
background-color: token-value(color, link, hover);
|
|
107
|
+
}
|
|
98
108
|
}
|
|
99
109
|
&.pseudo-active {
|
|
100
110
|
@include active-link();
|
|
111
|
+
& > .qc-ext-link-img {
|
|
112
|
+
background-color: token-value(color, link, active);
|
|
113
|
+
}
|
|
101
114
|
}
|
|
102
115
|
&.pseudo-focus {
|
|
103
116
|
@include focus-link();
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
117
|
+
& > .qc-ext-link-img {
|
|
118
|
+
background-color: token-value(color, link, text);
|
|
119
|
+
}
|
|
107
120
|
}
|
|
108
121
|
&.not-visited:visited:not(:hover) {
|
|
109
122
|
color: token-value(color,link,text);
|
|
123
|
+
& > .qc-ext-link-text {
|
|
124
|
+
color: token-value(color,link,text);
|
|
125
|
+
}
|
|
110
126
|
}
|
|
111
127
|
}
|
|
112
128
|
|
|
113
|
-
|
|
129
|
+
div.qc-ext-link-img {
|
|
114
130
|
a.pseudo-visited & {
|
|
115
131
|
background: token-value(color link visited)!important;
|
|
116
132
|
}
|
|
@@ -123,6 +139,9 @@ span.qc-ext-link-img {
|
|
|
123
139
|
a.pseudo-active & {
|
|
124
140
|
background: token-value(color link active)!important;
|
|
125
141
|
}
|
|
142
|
+
a.not-visited:visited:not(:hover) & {
|
|
143
|
+
background: token-value(color link text)!important;
|
|
144
|
+
}
|
|
126
145
|
}
|
|
127
146
|
|
|
128
147
|
p,h1,h2,h3,h4,h5,h6 {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
height='auto',
|
|
9
9
|
src='',
|
|
10
10
|
rotate = 0,
|
|
11
|
+
rootElement = $bindable(),
|
|
11
12
|
...rest
|
|
12
13
|
} = $props();
|
|
13
14
|
let attributes = $derived(width === 'auto' ? { 'data-img-size': size } : {});
|
|
@@ -30,5 +31,6 @@
|
|
|
30
31
|
{...attributes}
|
|
31
32
|
{...rest}
|
|
32
33
|
aria-hidden={label ? undefined : true}
|
|
34
|
+
bind:this={rootElement}
|
|
33
35
|
>
|
|
34
36
|
</div>
|
|
@@ -2,33 +2,33 @@
|
|
|
2
2
|
<qc-doc-exemple caption="Exemple de différents liens hypertexte selon leurs états.">
|
|
3
3
|
<dl>
|
|
4
4
|
<dt>Lien interne</dt>
|
|
5
|
-
<dd><a href="
|
|
5
|
+
<dd><a href="#" class="not-visited">Lien interne</a></dd>
|
|
6
6
|
<dd>
|
|
7
|
-
<qc-external-link><a href="
|
|
7
|
+
<qc-external-link><a href="#" class="not-visited">Lien externe</a></qc-external-link>
|
|
8
8
|
</dd>
|
|
9
9
|
|
|
10
10
|
<dt>Lien au survol (pseudo-classe :hover)</dt>
|
|
11
|
-
<dd><a href="
|
|
11
|
+
<dd><a href="#" class="pseudo-hover">Lien interne</a></dd>
|
|
12
12
|
<dd>
|
|
13
|
-
<qc-external-link><a href="
|
|
13
|
+
<qc-external-link><a href="#" class="pseudo-hover">Lien externe</a>
|
|
14
14
|
</qc-external-link>
|
|
15
15
|
</dd>
|
|
16
16
|
<dt>Lien au focus (pseudo-classe :focus)</dt>
|
|
17
|
-
<dd><a href="
|
|
17
|
+
<dd><a href="#" class="pseudo-focus">Lien interne</a></dd>
|
|
18
18
|
<dd>
|
|
19
|
-
<qc-external-link><a href="
|
|
19
|
+
<qc-external-link><a href="#" class="pseudo-focus">Lien externe</a>
|
|
20
20
|
</qc-external-link>
|
|
21
21
|
</dd>
|
|
22
22
|
<dt>Lien au clic (pseudo-classe :active)</dt>
|
|
23
|
-
<dd><a href="
|
|
23
|
+
<dd><a href="#" class="pseudo-active">Lien interne</a></dd>
|
|
24
24
|
<dd>
|
|
25
|
-
<qc-external-link><a href="
|
|
25
|
+
<qc-external-link><a href="#" class="pseudo-active">Lien externe</a>
|
|
26
26
|
</qc-external-link>
|
|
27
27
|
</dd>
|
|
28
28
|
<dt>Lien visité (pseudo-classe :visited)</dt>
|
|
29
|
-
<dd><a href="
|
|
29
|
+
<dd><a href="#" class="pseudo-visited">Lien interne</a></dd>
|
|
30
30
|
<dd>
|
|
31
|
-
<qc-external-link><a href="
|
|
31
|
+
<qc-external-link><a href="#" class="pseudo-visited">Lien externe</a>
|
|
32
32
|
</qc-external-link>
|
|
33
33
|
</dd>
|
|
34
34
|
</dl>
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
a {
|
|
6
6
|
color: token-value(color, link, text);
|
|
7
|
+
&:has(.qc-ext-link-text) {
|
|
8
|
+
white-space: nowrap;
|
|
9
|
+
text-decoration: none;
|
|
10
|
+
}
|
|
7
11
|
&:visited {
|
|
8
12
|
color: token-value(color, link, visited);
|
|
9
13
|
}
|
|
@@ -19,33 +23,35 @@ a {
|
|
|
19
23
|
.img-wrap {
|
|
20
24
|
white-space: nowrap;
|
|
21
25
|
}
|
|
26
|
+
}
|
|
22
27
|
|
|
28
|
+
.qc-external-link {
|
|
29
|
+
.qc-ext-link-text {
|
|
30
|
+
white-space: normal;
|
|
31
|
+
text-decoration: underline;
|
|
32
|
+
}
|
|
23
33
|
}
|
|
24
|
-
span.qc-ext-link-img {
|
|
25
34
|
|
|
35
|
+
.qc-ext-link-img {
|
|
26
36
|
@extend .icon-external-link;
|
|
27
37
|
$ratio : math.div(11,16) * 1em;
|
|
28
38
|
height: $ratio;
|
|
29
39
|
width: $ratio;
|
|
30
|
-
display: inline-block;
|
|
31
40
|
background: token-value(color link text);
|
|
32
41
|
mask-size: $ratio;
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
display: inline-block;
|
|
43
|
+
mask-repeat: no-repeat;
|
|
44
|
+
|
|
45
|
+
a:visited & {
|
|
35
46
|
background: token-value(color link visited);
|
|
36
47
|
}
|
|
37
|
-
a:focus
|
|
48
|
+
a:focus & {
|
|
38
49
|
background: token-value(color link hover);
|
|
39
50
|
}
|
|
40
|
-
a:hover
|
|
51
|
+
a:hover & {
|
|
41
52
|
background: token-value(color link hover);
|
|
42
53
|
}
|
|
43
|
-
a:active
|
|
54
|
+
a:active & {
|
|
44
55
|
background: token-value(color link active);
|
|
45
56
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
.img-wrap + & {
|
|
49
|
-
display: none;
|
|
50
|
-
}
|
|
51
57
|
}
|
|
@@ -2,14 +2,20 @@
|
|
|
2
2
|
import {Utils} from "../utils";
|
|
3
3
|
import Icon from "../../bases/Icon/Icon.svelte";
|
|
4
4
|
import IconButton from "../IconButton/IconButton.svelte";
|
|
5
|
+
import {onMount} from "svelte";
|
|
5
6
|
|
|
6
7
|
let {
|
|
7
8
|
type = "general",
|
|
8
9
|
maskable = "",
|
|
9
10
|
content = "",
|
|
10
|
-
hide = "false",
|
|
11
|
+
hide = $bindable("false"),
|
|
11
12
|
fullWidth = "false",
|
|
12
13
|
slotContent,
|
|
14
|
+
id,
|
|
15
|
+
persistenceKey,
|
|
16
|
+
persistHidden = false,
|
|
17
|
+
rootElement = $bindable(),
|
|
18
|
+
hideAlertCallback = () => {},
|
|
13
19
|
} = $props();
|
|
14
20
|
|
|
15
21
|
const language = Utils.getPageLanguage();
|
|
@@ -21,18 +27,31 @@
|
|
|
21
27
|
|
|
22
28
|
const label = type === 'general' ? generalLabel : warningLabel;
|
|
23
29
|
|
|
24
|
-
let rootElement = $state(null);
|
|
25
|
-
|
|
26
30
|
let containerClass = "qc-container" + (fullWidth === 'true' ? '-fluid' : '');
|
|
27
31
|
|
|
32
|
+
onMount(() => {
|
|
33
|
+
const key = getPersistenceKey();
|
|
34
|
+
if (!key) return;
|
|
35
|
+
hide = sessionStorage.getItem(key) ? "true" : "false";
|
|
36
|
+
})
|
|
37
|
+
|
|
28
38
|
function hideAlert() {
|
|
29
39
|
hide = "true";
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
);
|
|
40
|
+
persistHiddenState();
|
|
41
|
+
hideAlertCallback();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function getPersistenceKey() {
|
|
45
|
+
if (!persistHidden) return false;
|
|
46
|
+
const key = persistenceKey || id;
|
|
47
|
+
if (! key) return false;
|
|
48
|
+
return'qc-alert:' + key;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function persistHiddenState() {
|
|
52
|
+
const key = getPersistenceKey();
|
|
53
|
+
if (!key) return;
|
|
54
|
+
sessionStorage.setItem(key, Utils.now());
|
|
36
55
|
}
|
|
37
56
|
</script>
|
|
38
57
|
|
|
@@ -6,20 +6,35 @@
|
|
|
6
6
|
maskable : {attribute: 'maskable'},
|
|
7
7
|
fullWidth : {attribute: 'full-width'},
|
|
8
8
|
content: {attribute: 'content'},
|
|
9
|
-
hide: {attribute: 'hide'},
|
|
9
|
+
hide: {attribute: 'hide', reflect: true},
|
|
10
|
+
persistHidden: {attribute: 'persist-hidden', type: 'Boolean'},
|
|
11
|
+
persistenceKey: {attribute: 'persistence-key', type: 'String'},
|
|
10
12
|
}
|
|
11
|
-
}}"
|
|
13
|
+
}}"></svelte:options>
|
|
12
14
|
|
|
13
15
|
<script>
|
|
14
16
|
import Alert from "./Alert.svelte";
|
|
15
17
|
import {Utils} from "../utils";
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
let {hide = "false", ...props} = $props();
|
|
18
20
|
|
|
21
|
+
let rootElement = $state();
|
|
22
|
+
|
|
23
|
+
function hideAlertCallback() {
|
|
24
|
+
rootElement?.dispatchEvent(
|
|
25
|
+
new CustomEvent('qc.alert.hide', {
|
|
26
|
+
bubbles: true,
|
|
27
|
+
composed: true
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
}
|
|
19
31
|
</script>
|
|
20
32
|
|
|
21
33
|
<Alert
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
bind:hide
|
|
35
|
+
bind:rootElement
|
|
36
|
+
{hideAlertCallback}
|
|
37
|
+
{...props}
|
|
38
|
+
slotContent = {`<slot />`}
|
|
24
39
|
/>
|
|
25
40
|
<link rel='stylesheet' href='{Utils.cssPath}'>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Alert from "../Alert.svelte";
|
|
3
|
+
import {Utils} from "../../utils";
|
|
4
|
+
|
|
5
|
+
let regularAlertContent = $state();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<svelte:options customElement={{tag: "qc-alert-svelte-test" }} />
|
|
9
|
+
|
|
10
|
+
<Alert
|
|
11
|
+
id="alerte-masquable"
|
|
12
|
+
type="warning"
|
|
13
|
+
maskable="true"
|
|
14
|
+
content="Alerte jaune d’importance élevée"
|
|
15
|
+
persistHidden="true"
|
|
16
|
+
persistenceKey="hash-1238"
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<div hidden>
|
|
20
|
+
<p style="margin: 0;" bind:this={regularAlertContent}>Alerte bleue d’importance modérée <a href="#">avec un lien textuel</a></p>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<Alert type="general" slotContent={regularAlertContent?.outerHTML} />
|
|
24
|
+
|
|
25
|
+
<link rel='stylesheet' href='{Utils.cssPath}'>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<qc-alert id="alerte-masquable"
|
|
2
|
+
type="warning"
|
|
3
|
+
maskable="true"
|
|
4
|
+
content="Alerte jaune d’importance élevée"
|
|
5
|
+
persist-hidden
|
|
6
|
+
persistence-key="hash-1234"
|
|
7
|
+
>
|
|
8
|
+
</qc-alert>
|
|
9
|
+
|
|
10
|
+
<qc-alert type="general"
|
|
11
|
+
maskable="false">
|
|
12
|
+
<p>Alerte bleue d’importance modérée <a href="#">avec un lien textuel</a></p>
|
|
13
|
+
</qc-alert>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<qc-alert-svelte-test></qc-alert-svelte-test>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<h3>Exemples</h3>
|
|
3
3
|
<h4>Alerte jaune</h4>
|
|
4
4
|
<p>
|
|
5
|
-
<a href="
|
|
5
|
+
<a href="#"
|
|
6
6
|
id="show-qc-alert"
|
|
7
7
|
hidden
|
|
8
8
|
>
|
|
@@ -11,27 +11,26 @@
|
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<qc-doc-exemple id="alert-warning"
|
|
14
|
-
caption="Exemple d’alerte jaune">
|
|
14
|
+
caption="Exemple d’alerte jaune masquable. Elle reste masquée après rafraîchissement de la page tant que la session courante est active.">
|
|
15
15
|
<qc-alert id="alerte-masquable"
|
|
16
16
|
type="warning"
|
|
17
17
|
maskable="true"
|
|
18
18
|
content="Alerte jaune d’importance élevée"
|
|
19
|
+
persist-hidden
|
|
20
|
+
persistence-key="hash-1234"
|
|
19
21
|
>
|
|
20
22
|
</qc-alert>
|
|
21
23
|
</qc-doc-exemple>
|
|
22
|
-
<!-- <qc-code target-id="alert-warning"></qc-code>-->
|
|
23
24
|
|
|
24
25
|
<h4>Alerte bleue</h4>
|
|
25
26
|
<qc-doc-exemple id="alert-general"
|
|
26
27
|
caption="Exemple d’alerte générale">
|
|
27
28
|
<qc-alert type="general"
|
|
28
29
|
maskable="false">
|
|
29
|
-
<p>Alerte bleue d’importance modérée <a href="
|
|
30
|
+
<p>Alerte bleue d’importance modérée <a href="#">avec un lien textuel</a></p>
|
|
30
31
|
</qc-alert>
|
|
31
32
|
</qc-doc-exemple>
|
|
32
33
|
|
|
33
|
-
<!-- <qc-code target-id="alert-general"></qc-code>-->
|
|
34
|
-
|
|
35
34
|
<h3>Documentation technique</h3>
|
|
36
35
|
|
|
37
36
|
<h4>Attributs</h4>
|
|
@@ -51,12 +50,6 @@
|
|
|
51
50
|
<td>"general"</td>
|
|
52
51
|
<td>Type de l’alerte : s'il s'agit d’une alerte bleue ou jaune</td>
|
|
53
52
|
</tr>
|
|
54
|
-
<tr>
|
|
55
|
-
<td>maskable</td>
|
|
56
|
-
<td>"true" ou "false"</td>
|
|
57
|
-
<td>"true"</td>
|
|
58
|
-
<td>Afficher le bouton de fermeture de l’alerte</td>
|
|
59
|
-
</tr>
|
|
60
53
|
<tr>
|
|
61
54
|
<td>content</td>
|
|
62
55
|
<td>Texte</td>
|
|
@@ -77,6 +70,25 @@
|
|
|
77
70
|
qc-container-fluid)
|
|
78
71
|
</td>
|
|
79
72
|
</tr>
|
|
73
|
+
<tr>
|
|
74
|
+
<td>maskable</td>
|
|
75
|
+
<td>"true" ou "false"</td>
|
|
76
|
+
<td>"true"</td>
|
|
77
|
+
<td>Afficher le bouton de fermeture de l’alerte</td>
|
|
78
|
+
</tr>
|
|
79
|
+
<tr>
|
|
80
|
+
<td>persist-hidden</td>
|
|
81
|
+
<td>na</td>
|
|
82
|
+
<td></td>
|
|
83
|
+
<td>Masque l'alerte de façon persistente une fois qu'elle est masquée par l'internaute, c‑à‑d. qu'elle reste masquée lorsque l'utilisateur rafraîchit la page, pendant tout le temps de sa session.</td>
|
|
84
|
+
</tr>
|
|
85
|
+
<tr>
|
|
86
|
+
<td>persistence-key</td>
|
|
87
|
+
<td>Chaîne de caractère</td>
|
|
88
|
+
<td>Id de l'élément, valeur nulle sinon</td>
|
|
89
|
+
<td>Clé pour le stockage de session (<code>Window.sessionStorage</code>). Si non défini, l'id de l'élément sera utilisé. Si celui-ci non plus n'est pas défini, la persistence du masquage n'aura pas lieu.</td>
|
|
90
|
+
</tr>
|
|
91
|
+
|
|
80
92
|
</table>
|
|
81
93
|
</div>
|
|
82
94
|
|
|
@@ -89,7 +101,7 @@
|
|
|
89
101
|
document.addEventListener(
|
|
90
102
|
'qc.alert.hide',
|
|
91
103
|
(e) => {
|
|
92
|
-
console.log(
|
|
104
|
+
console.log(`Fermeture de l'alerte id='${e.target.id}'`);
|
|
93
105
|
}
|
|
94
106
|
)
|
|
95
107
|
</script>
|
|
@@ -40,15 +40,16 @@
|
|
|
40
40
|
if (labelElement) {
|
|
41
41
|
label = labelElement.querySelector('span')?.textContent;
|
|
42
42
|
}
|
|
43
|
-
})
|
|
43
|
+
});
|
|
44
44
|
|
|
45
45
|
$effect(_ => updateChoiceInput(input, required, invalid, compact, false, false))
|
|
46
46
|
|
|
47
47
|
$effect(() => {
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
if (required && label && requiredSpan) {
|
|
49
|
+
const textSpan = labelElement.querySelector('span');
|
|
50
|
+
textSpan.appendChild(requiredSpan);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
52
53
|
</script>
|
|
53
54
|
|
|
54
55
|
{#snippet requiredSpanSnippet()}
|
|
@@ -277,8 +277,6 @@
|
|
|
277
277
|
</table>
|
|
278
278
|
</div>
|
|
279
279
|
|
|
280
|
-
<p>Pour les autres attributs, voir la rubrique de <a href="#selection-button-attributes">boutons de sélection</a>.</p>
|
|
281
|
-
|
|
282
280
|
<h5>Zone d’ajout de contenu HTML</h5>
|
|
283
281
|
|
|
284
282
|
<p>Ce composant ne comporte qu'une seule zone d'ajout de contenu par défaut.</p>
|